-
Notifications
You must be signed in to change notification settings - Fork 10.1k
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
.NET 9 breaks ShouldSerializeXXX methods in data model (NullReferenceException) #59402
Comments
What makes this a .NET or ASP.NET Core issue? The method you're pointing at is part of Newtonsoft.Json. If you think it is an ASP.NET Core issue, please provide a minimal repro project. |
WebApiTest.zip |
Please provide the project as a github repo not a zip |
OK, here is the github repo link: https://github.com/arisewanggithub/dotnetissue59402 |
Maybe it's an NSwag issue? |
Yeah, this looks like an NSwag issue. Closing as I don't see anything from ASP.NET Core in the stack. |
OK, I created a new issue on NSWag for this: RicoSuter/NSwag#5065 |
Is there an existing issue for this?
Describe the bug
We are currently using .net 8 and we are upgrading to .net 9. But with the upgrade, our service can't start because some ShouldSerializeXXX methods throw NullReferenceException. e.g.
And from stacktrace, I can see the ShouldSerializeXXX methods are called from here in namespace Newtonsoft.Json.Serialization:
Microsoft.AspNetCore.Mvc.NewtonsoftJson has already been upgraded to 9.0.0
This works fine in .net 8 but breaks in .net 9
Expected Behavior
NullReferenceException should not be thrown when start the service
Steps To Reproduce
No response
Exceptions (if any)
No response
.NET Version
9.0.101
Anything else?
No response
The text was updated successfully, but these errors were encountered: