Skip to content

[NativeAOT] Test failures in System.Net.Http.Json.Unit.Tests #89195

@VSadov

Description

@VSadov

Example: https://helixre8s23ayyeko0k025g8.blob.core.windows.net/dotnet-runtime-refs-pull-85694-merge-ac99d648a653499ba7/System.Net.Http.Json.Unit.Tests/3/console.8bd3fbc0.log?helixlogtype=result

Failures look like:

Running assembly:System.Net.Http.Json.Unit.Tests, Version=8.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51
[FAIL] System.Net.Http.Json.Functional.Tests.TranscodingWriteStreamTest.WriteAsync_Works_WhenOutputIs_WesternEuropeanEncoding(message: "Hello world")
System.NotSupportedException : JsonTypeInfo metadata for type 'System.Net.Http.Json.Functional.Tests.TranscodingWriteStreamTest+TestModel' was not provided by TypeInfoResolver of type '[]'. If using source generation, ensure that all root types passed to the serializer have been annotated with 'JsonSerializableAttribute', along with any types that might be serialized polymorphically.
   at System.Text.Json.ThrowHelper.ThrowNotSupportedException_NoMetadataForType(Type, IJsonTypeInfoResolver) + 0x78
   at System.Text.Json.JsonSerializerOptions.GetTypeInfoInternal(Type, Boolean, Nullable`1, Boolean, Boolean) + 0xdc
   at System.Text.Json.JsonSerializerOptions.GetTypeInfoForRootType(Type, Boolean) + 0x68
   at System.Net.Http.Json.Functional.Tests.TranscodingWriteStreamTest.<WriteAsyncTest>d__8.MoveNext() + 0x150
--- End of stack trace from previous location ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() + 0x24
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task) + 0xfc
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task, ConfigureAwaitOptions) + 0x68
--- End of stack trace from previous location ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() + 0x24
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task) + 0xfc
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task, ConfigureAwaitOptions) + 0x68
--- End of stack trace from previous location ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() + 0x24
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task) + 0xfc
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task, ConfigureAwaitOptions) + 0x68
[FAIL] System.Net.Http.Json.Functional.Tests.TranscodingWriteStreamTest.WriteAsync_Works_WhenOutputIs_WesternEuropeanEncoding(message: "ABABABABABABABABABABABABABABABABABABABABABABABABAB"...)
System.NotSupportedException : JsonTypeInfo metadata for type 'System.Net.Http.Json.Functional.Tests.TranscodingWriteStreamTest+TestModel' was not provided by TypeInfoResolver of type '[]'. If using source generation, ensure that all root types passed to the serializer have been annotated with 'JsonSerializableAttribute', along with any types that might be serialized polymorphically.
   at System.Text.Json.ThrowHelper.ThrowNotSupportedException_NoMetadataForType(Type, IJsonTypeInfoResolver) + 0x78
   at System.Text.Json.JsonSerializerOptions.GetTypeInfoInternal(Type, Boolean, Nullable`1, Boolean, Boolean) + 0xdc
   at System.Text.Json.JsonSerializerOptions.GetTypeInfoForRootType(Type, Boolean) + 0x68
   at System.Net.Http.Json.Functional.Tests.TranscodingWriteStreamTest.<WriteAsyncTest>d__8.MoveNext() + 0x150
--- End of stack trace from previous location ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() + 0x24
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task) + 0xfc
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task, ConfigureAwaitOptions) + 0x68
--- End of stack trace from previous location ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() + 0x24
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task) + 0xfc
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task, ConfigureAwaitOptions) + 0x68
--- End of stack trace from previous location ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() + 0x24
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task) + 0xfc
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task, ConfigureAwaitOptions) + 0x68

Steps to repro:

build.cmd -s clr.aot+libs -rc checked -c Release
cd src\libraries\System.Net.Http.Json\tests\UnitTests
..\..\..\..\..\dotnet.cmd build /t:Test -c Release /p:TestNativeAot=true /p:CoreCLRConfiguration=checked

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions