-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
[net9.0-preview3]: NativeAOT System.Text.Json throws "System.NotSupportedException: 'System.Text.Json.Serialization.JsonDerivedTypeAttribute[]' is missing native code or metadata." #101205
Comments
Tagging subscribers to this area: @dotnet/area-system-text-json, @gregsdennis |
blocked on dotnet#101205
As a workaround I can add: public class Root
{
public static System.Text.Json.Serialization.JsonDerivedTypeAttribute[] r1 = new System.Text.Json.Serialization.JsonDerivedTypeAttribute[] {null};
} roots.xml: <linker>
<assembly fullname="roundtrip-json">
<type fullname="Root" preserve="all" />
</assembly>
</linker> and then add that as a root descriptor in my <ItemGroup>
<TrimmerRootDescriptor Include="roots.xml" />
</ItemGroup> |
This is what I fixed in #100626 (and #101048). Custom attribute activation has a suppression that assumes we can always create arrays of reference types but this is only possible if there's a We have not been running a ton of tests since the test merging happened. This would have been caught there. I'm in the process of fixing the regressions in #100331. |
Until we get dotnet#101048 from codeflow, work around dotnet#101205 by adding a trimmer root for JsonDerivedTypeAttribute[].
Until we get dotnet#101048 from codeflow, work around dotnet#101205 by adding a trimmer root for JsonDerivedTypeAttribute[].
When compiling an app that uses System.Text.Json using NativeAOT, using .NET 9 Preview 3, the app throws an exception:
This is a regression from .NET 8.
Repro: https://github.com/lambdageek/roundtrip-json
The text was updated successfully, but these errors were encountered: