Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

10 Commits

Folders and files

Repository files navigation

repro-dotnet-runtime-async-aot-json

Minimal standalone NativeAOT repro for the ILC crash seen in: https://github.com/npgsql/npgsql/actions/runs/24466578450/job/71495217567?pr=6488

Requires the .NET 11 preview SDK (11.0.100-preview.3.26207.106 or later). See global.json.

Repro

cd ReproAsyncAotJson
dotnet publish -c Release

The runtime-async feature is enabled by default via the RuntimeAsync MSBuild property in the .csproj. As of Preview 3, <EnablePreviewFeatures>true</EnablePreviewFeatures> is no longer required — only <Features>runtime-async=on</Features> is needed (release notes):

<!-- Set to false to verify the issue only occurs with runtime-async enabled -->
<RuntimeAsync Condition="'$(RuntimeAsync)' == ''">true</RuntimeAsync>

To confirm the crash is only triggered by runtime-async, pass RuntimeAsync=false:

dotnet publish -c Release -p:RuntimeAsync=false   # succeeds
dotnet publish -c Release -p:RuntimeAsync=true    # fails (default)

The failing pattern is the generic async overload called from a generic method:

await JsonSerializer.DeserializeAsync(stream, typeInfoOfT, cancellationToken)

Workaround

Replace the generic DeserializeAsync<T> calls with the non-generic overload using JsonTypeInfo:

(T?)await JsonSerializer.DeserializeAsync(stream, (JsonTypeInfo)typeInfoOfT, cancellationToken)

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages