Open zspitz opened 5 years ago
Apparently, this is because the VB compiler inserts a conversion node whenever the type of the argument doesn't precisely match the parameter. In this case, the first parameter of Any
is IEnumerable<Trip>
while the Trips
property is defined as ICollection<Trip>
.
The Visual Basic expression tree looks like this:
while the C# expression tree looks like this:
So if I define Trips
as IEnumerable<Trip>
, the code works fine in VB as well.
Nevertheless, it might be a good idea to check if the pre-conversion node's Type (in this case x.Trips
) is assignable to the post-conversion type (IEnumerable<Trip>
) then the conversion should be ignored in the parsing.
Interesting. Thank you for the investigation. I will think about what can be done here.
When I use the following C# code:
the code runs as expected and ouputs the relative URL. However, if I run the corresponding code in Visual Basic:
I get a NullReferenceException:
The stack trace (for the inner exception) is as follows:
I'm using the NuGet package version 5.8.0 of the V4 client.
The entity classes are as follows (for both the C# and VB code):