-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
[release/6.0] Fix NETStandard library using JSON source gen #63520
Conversation
NETStandard libraries using JSON source gen would fail to load on .NETCore due to missing IsExternalInit in the assembly. On .NETCore this is defined, whereas on .NETStandard JSON carries an internal copy. The compiler emits references to the internal type when a NETStandard library calls init-only setters in JSON types, but these references are not satisfied when the library runs on .NETCore. Fix this by adding a type forward to JSON for the IsExternalInit type.
Note regarding the This serves as a reminder for when your PR is modifying a ref *.cs file and adding/modifying public APIs, to please make sure the API implementation in the src *.cs file is documented with triple slash comments, so the PR reviewers can sign off that change. |
Tagging subscribers to this area: @dotnet/area-system-text-json Issue DetailsFixes #61737 Customer ImpactCustomers cannot use JSON source generators defined in a TestingAdded tests to catch this scenario. Tests fail without fix, succeed with. Searched repo for any other instances. RiskVery low. We are merely adding a typeforward to System.Text.Json for
|
Approved over email |
I don't understand what the issue is? I thought the compiler doesn't care about the type identity of the attribute, only about the name of the applied attribute. What causes this to be an issue during reflection? |
Fixes #61737
Customer Impact
Customers cannot use JSON source generators defined in a
netstandard
library from anet6.0
app. This will fail withMissingMethodException
.Testing
Added tests to catch this scenario. Tests fail without fix, succeed with. Searched repo for any other instances.
Risk
Very low. We are merely adding a typeforward to System.Text.Json for
IsExternalInit
.