-
-
Notifications
You must be signed in to change notification settings - Fork 231
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error creating Null string #339
Comments
See also this one: |
No. Constants.IsNull sees the value as "null" and returns false |
When I use select string(null) in the old kahanu/System.Linq.Dynamic it works. Diagnosis: The difference is in MethodFinder.cs IsBetterThan. The string constructor has 8 methods, FindBestMethod finds 3 methods (Char*, SByte* & Char[]) initially applicable. However System.Linq.Dynamic.Core IsBetterThan returns true when the parms are equal. Not sure how you would want to fix this. |
@rockResolve |
Actually using code like |
Thanks for the quick reply. The package didn't quite work for me. So I downloaded the branch to look closer. After I removed the "If only 1 argument, and the arg is ConstantExpression, just return the ConstantExpression" code, your pointer constructor removal worked well and built my string(null). Are you able to remove the "If only 1 argument, and the arg is ConstantExpression, just return the ConstantExpression" code or is it there for another reason? |
When you remove that line, the dynamic code behaves like this normal c# code: If you need concat, can't you just use |
Oops your right my test was falsely passing with an empty string. However I still do really need a string(null). |
Can you provide an simple console-app? |
Finally got a simple console-app made. |
Just create a new project on github. If needed I can copy it and debug in my solution. |
Added console-app at https://github.com/rockResolve/dlinq-demo-string-null. |
Also added possible System.Linq.Dynamic.Core fix with added/updated tests at: |
Can you create a PR, I'll have to check your changes. |
PR #354 |
PR is merged ; closing this issue. |
When using "select string(null)" I get the "Ambiguous invocation of 'String' constructor" error.
I was able to use this select in the old kahanu/System.Linq.Dynamic.
I need the String cast because I Concat this with a query with another and the Concat insists on matching types.
How can I get a Select to return a null string from a literal null?
The text was updated successfully, but these errors were encountered: