Closed lambdageek closed 7 months ago
Tagging subscribers to this area: @dotnet/area-system-text-json, @gregsdennis See info in area-owners.md if you want to be subscribed.
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 .csproj
:
<ItemGroup>
<TrimmerRootDescriptor Include="roots.xml" />
</ItemGroup>
cc @MichalStrehovsky
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 __Canon[]
template.
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.
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