Is there an existing issue for this?
Describe the bug
When the GenerateE2EManifest MSBuild task from Microsoft.AspNetCore.Components.Testing 11.0.0-preview.5.26276.113 (latest on the dotnet11 public feed) runs under SDK 11.0.100-preview.5.26272.118, it crashes with a MissingMethodException:
error MSB4018: The "GenerateE2EManifest" task failed unexpectedly.
System.MissingMethodException: Method not found: 'Void System.Text.Json.Serialization.Metadata.JsonObjectInfoValues`1.set_PolymorphismOptions(System.Text.Json.Serialization.Metadata.JsonPolymorphismOptions)'.
at Microsoft.AspNetCore.Components.Testing.Tasks.E2EManifestJsonContext.Create_E2EManifestModel(JsonSerializerOptions options)
at Microsoft.AspNetCore.Components.Testing.Tasks.E2EManifestJsonContext.global::System.Text.Json.Serialization.Metadata.IJsonTypeInfoResolver.GetTypeInfo(Type type, JsonSerializerOptions options)
at System.Text.Json.JsonSerializerOptions.GetTypeInfoNoCaching(Type type)
at System.Text.Json.JsonSerializerOptions.CachingContext.CreateCacheEntry(Type type, CachingContext context)
--- End of stack trace from previous location ---
at System.Text.Json.JsonSerializerOptions.GetTypeInfoInternal(...)
at System.Text.Json.JsonSerializerOptions.GetTypeInfo(Type type)
at Microsoft.AspNetCore.Components.Testing.Tasks.E2EManifestJsonContext.get_E2EManifestModel()
at Microsoft.AspNetCore.Components.Testing.Tasks.GenerateE2EManifest.Execute()
E2EManifestJsonContext is a JsonSerializerContext source-generated inside Microsoft.AspNetCore.Components.Testing.Tasks.dll (netstandard2.0). The generated Create_E2EManifestModel calls JsonObjectInfoValues<T>.set_PolymorphismOptions, which is not present on the System.Text.Json assembly the MSBuild host loads at runtime. The result is that every build that consumes this package fails the GenerateE2EManifest task.
This is a different failure mode than #66617 — that issue was the task being silently skipped due to a path mismatch in preview.4. In preview.5 the path resolution has been fixed (the task now executes), but the source generator's emitted code references an STJ surface that does not exist in the SDK's STJ.
Expected Behavior
GenerateE2EManifest runs to completion and produces *.e2e-manifest.json next to the test DLL.
Steps To Reproduce
Minimal repro project layout (the consuming pattern from dotnet/aspnetcore's test infrastructure, reduced):
<!-- AppRepro.csproj -->
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net11.0</TargetFramework>
<OutputType>Exe</OutputType>
<IsPackable>false</IsPackable>
<IsTestProject>false</IsTestProject>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Components.Testing" Version="11.0.0-preview.5.26276.113" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\BlazorApp\BlazorApp.csproj">
<E2EApp>true</E2EApp>
</ProjectReference>
</ItemGroup>
</Project>
(Where BlazorApp.csproj is any Blazor Web App.)
dotnet build fails with the MissingMethodException above. A full real-world repro is at https://github.com/danroth27/AspNetCore11Samples/tree/main/BlazorFeatures.E2E.Tests.
Note: that project also has a <_E2ETasksAssembly> override pointing at tasks/netstandard2.0/Microsoft.AspNetCore.Components.Testing.Tasks.dll as a workaround for #66617. Removing it does not change the outcome in preview.5 — the targets file's own probe also resolves the task DLL, executes it, and hits the same STJ crash.
Environment
.NET SDK: 11.0.100-preview.5.26272.118
Microsoft.AspNetCore.Components.Testing: 11.0.0-preview.5.26276.113 (dotnet11 feed)
Host runtime STJ: System.Text.Json 11.0.0-preview.5.26272.118
Task assembly: tasks/netstandard2.0/Microsoft.AspNetCore.Components.Testing.Tasks.dll
(ProductVersion 11.0.0-preview.5.26276.113)
OS: Windows 11
Anything else?
Likely root cause: the JsonSerializerContext source generator that produced E2EManifestJsonContext was run against an older System.Text.Json and emitted a set_PolymorphismOptions setter call. In the STJ that ships with the .NET 11 Preview 5 runtime, JsonObjectInfoValues<T>.PolymorphismOptions no longer exposes a setter at that signature, so the generated code throws MissingMethodException at JIT time as soon as the context is touched.
If that diagnosis is correct, regenerating the task assembly's source-gen against current STJ — or pinning the task to a known-compatible STJ — should resolve it.
Impact: any test project that takes a PackageReference on Microsoft.AspNetCore.Components.Testing 11.0.0-preview.5.26276.113 from the public dotnet11 feed cannot build, so consumers of the public preview cannot run Blazor E2E tests on Preview 5.
Is there an existing issue for this?
Describe the bug
When the
GenerateE2EManifestMSBuild task fromMicrosoft.AspNetCore.Components.Testing11.0.0-preview.5.26276.113(latest on thedotnet11public feed) runs under SDK11.0.100-preview.5.26272.118, it crashes with aMissingMethodException:E2EManifestJsonContextis aJsonSerializerContextsource-generated insideMicrosoft.AspNetCore.Components.Testing.Tasks.dll(netstandard2.0). The generatedCreate_E2EManifestModelcallsJsonObjectInfoValues<T>.set_PolymorphismOptions, which is not present on theSystem.Text.Jsonassembly the MSBuild host loads at runtime. The result is that every build that consumes this package fails theGenerateE2EManifesttask.This is a different failure mode than #66617 — that issue was the task being silently skipped due to a path mismatch in preview.4. In preview.5 the path resolution has been fixed (the task now executes), but the source generator's emitted code references an STJ surface that does not exist in the SDK's STJ.
Expected Behavior
GenerateE2EManifestruns to completion and produces*.e2e-manifest.jsonnext to the test DLL.Steps To Reproduce
Minimal repro project layout (the consuming pattern from
dotnet/aspnetcore's test infrastructure, reduced):(Where
BlazorApp.csprojis any Blazor Web App.)dotnet buildfails with theMissingMethodExceptionabove. A full real-world repro is at https://github.com/danroth27/AspNetCore11Samples/tree/main/BlazorFeatures.E2E.Tests.Note: that project also has a
<_E2ETasksAssembly>override pointing attasks/netstandard2.0/Microsoft.AspNetCore.Components.Testing.Tasks.dllas a workaround for #66617. Removing it does not change the outcome in preview.5 — the targets file's own probe also resolves the task DLL, executes it, and hits the same STJ crash.Environment
Anything else?
Likely root cause: the
JsonSerializerContextsource generator that producedE2EManifestJsonContextwas run against an olderSystem.Text.Jsonand emitted aset_PolymorphismOptionssetter call. In the STJ that ships with the .NET 11 Preview 5 runtime,JsonObjectInfoValues<T>.PolymorphismOptionsno longer exposes a setter at that signature, so the generated code throwsMissingMethodExceptionat JIT time as soon as the context is touched.If that diagnosis is correct, regenerating the task assembly's source-gen against current STJ — or pinning the task to a known-compatible STJ — should resolve it.
Impact: any test project that takes a
PackageReferenceonMicrosoft.AspNetCore.Components.Testing11.0.0-preview.5.26276.113from the publicdotnet11feed cannot build, so consumers of the public preview cannot run Blazor E2E tests on Preview 5.