-
Notifications
You must be signed in to change notification settings - Fork 4.5k
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
Blazor app - 8.0.1 AOT producing Json errors #98180
Comments
Tagging subscribers to this area: @dotnet/area-system-text-json, @gregsdennis Issue DetailsDescriptionI get this error underneath my function call FAILURE: System.NotSupportedException: ConstructorContainsNullParameterNames, System.Collections.Generic.KeyValuePair This error does not appear when AOT is disabled, and I'm not using JsonSerializer for anything. In fact, I rolled my own serialization logic because I thought it was something related to the .net serializer. What's really interesting, is if I just eat this error and continue, it doesn't happen again, so I'm purposely inciting and eating this error in my initialization now. Reproduction StepsWill be very time-consuming to reduce my project to a working sample. Let's pursue that if what I've provided isn't enough. Expected behaviorno errors Actual behaviorthe indicated error Regression?There's nothing wrong with my code. It works perfectly when AOT is disabled. AOT breaks it. Known WorkaroundsEat the initial errors, works great after that Configurationlatest everything Other informationNo response
|
Duplicate of dotnet/aspnetcore#52947 |
Not sure if it's the same issue. I agree under the hood, the deprecated serialization of KeyValuePair in 8.0 is the issue, but I'd like to add the following notes because I believe this shouldn't have generated the error in the first place. I have:
The code:
will trigger the exception indicated, whereas this alternate approach:
works fine. |
And here's another example of strange AOT behavior eliciting this exception, once again by LINQ and 'not' directly using serialization or KeyValuePair. This code triggers the exception:
But this alternative approach works fine
|
Description
I get this error underneath my function call
FAILURE: System.NotSupportedException: ConstructorContainsNullParameterNames, System.Collections.Generic.KeyValuePair
2[System.String,System.Collections.Generic.List
1[System.String]] at System.Text.Json.Serialization.Metadata.DefaultJsonTypeInfoResolver.GetTypeInfo(Type , JsonSerializerOptions ) at System.Text.Json.JsonSerializerOptions.CachingContext.CreateCacheEntry(Type type, CachingContext context) --- End of stack trace from previous location --- at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& , Thread ) --- End of stack trace from previous location --- at (and then my function stack)This error does not appear when AOT is disabled, and I'm not using JsonSerializer for anything. In fact, I rolled my own serialization logic because I thought it was something related to the .net serializer.
What's really interesting, is if I just eat this error and continue, it doesn't happen again, so I'm purposely inciting and eating this error in my initialization now.
Reproduction Steps
Will be very time-consuming to reduce my project to a working sample. Let's pursue that if what I've provided isn't enough.
Expected behavior
no errors
Actual behavior
the indicated error
Regression?
There's nothing wrong with my code. It works perfectly when AOT is disabled. AOT breaks it.
Known Workarounds
Eat the initial errors, works great after that
Configuration
latest everything
Other information
No response
The text was updated successfully, but these errors were encountered: