-
Notifications
You must be signed in to change notification settings - Fork 160
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
Serialization of optional relationships is now failing where id did not in v8.2.0 #1017
Comments
@ElizabethOkerio It's coming from this PR ea4e79c#diff-732b595c31c0f7e9b97687d1ab7bce7d1f35d3fc2ce9adfcec3ef13e1d373b99. It looks like a regression and would you please take a look? any help, please do a hot release for the regression. |
I have a minimal sample project that demonstrates the null value exception. webapi + entity framework + sqlite + swagger Expand "AzureClassUser" with asterisk (*) or "userClass". https://github.com/greg-lomax/dotnet-core-odata-webapi-sample |
Further observation is that expand and select wildcard are not working. It appears that instead of matching * to expand and/or select, * is being matched against model properties, and is failing to match. all of these fail in 8.2.1 etc. |
Seems to be working in v8.2.3 |
Assemblies affected
Which assemblies and versions are known to be affected e.g. ASP.NET Core OData 8.2.1
Describe the bug
I think a new bug has been introduced here since if instance is null you attempt to call GetType() on it.
I'm experiencing a problem with expands (not sure if this is related to the code i've highlighted but I suspect a few places might have this same issue, I figured i'd dig through the release notes though to find out if I could see my issue and this is the only thing that stuck out to me).
The problem does not exist in version 8.2.0 but does in 8.2.1
Reproduce steps
Expanding with $expand=NullableRelationship causes a "Nullable object cannot be null" exception to be thrown even if the metadata is showing that the relationship is fine to be nullable.
EDM (CSDL) Model
My EDM metadata looks like this ...
When I ask for ~/OfferLine?$expand=InvoiceReference,CreditReference (I expect only one to be populated) I get the above exception when it hits the null relationship object.
As you can see OfferId and CurrencyId are not nullable so expanding on Offer or currency I would expect an exception if either was null, but for InvoiceReference and CreditReference the relationship is not required.
Expected behavior
Serialization should succeed as per 8.2.0 but the null value should be a json null response for the relationship object.
The text was updated successfully, but these errors were encountered: