Description
This was introduced in #102499. This blocking runtime ingestion in ASP.NET for preview 5.
This exception is thrown when running a BlazorWasm application.
NullabilityInfoContext is not supported in the current application because 'System.Reflection.NullabilityInfoContext.IsSupported' is set to false. Set the MSBuild Property 'NullabilityInfoContextSupport' to true in order to enable it.
The BlazorWebAssembly SDK disabled the feature https://github.com/dotnet/sdk/blob/a304e06708d72c1be0d78e214366a2c7c601b5d8/src/BlazorWasmSdk/Targets/Microsoft.NET.Sdk.BlazorWebAssembly.6_0.targets#L49
This method should check NullabilityInfoContext.IsSupported is true before using calling NullabilityInfoContext.Create.
Reproduction Steps
Run a BlazorWebAssembly application like this one:
https://github.com/dotnet/aspnetcore/blob/release/9.0-preview5/src/Components/WebAssembly/testassets/StandaloneApp/StandaloneApp.csproj
Expected behavior
Application should not throw an exception when the System.Reflection.NullabilityInfoContext.IsSupported flag is false.
Actual behavior
An exception is thrown.
Regression?
Yes
Known Workarounds
Enable the System.Reflection.NullabilityInfoContext.IsSupported switch.
Configuration
No response
Other information
No response
Description
This was introduced in #102499. This blocking runtime ingestion in ASP.NET for preview 5.
This exception is thrown when running a BlazorWasm application.
The BlazorWebAssembly SDK disabled the feature https://github.com/dotnet/sdk/blob/a304e06708d72c1be0d78e214366a2c7c601b5d8/src/BlazorWasmSdk/Targets/Microsoft.NET.Sdk.BlazorWebAssembly.6_0.targets#L49
This method should check
NullabilityInfoContext.IsSupportedistruebefore using callingNullabilityInfoContext.Create.Reproduction Steps
Run a BlazorWebAssembly application like this one:
https://github.com/dotnet/aspnetcore/blob/release/9.0-preview5/src/Components/WebAssembly/testassets/StandaloneApp/StandaloneApp.csproj
Expected behavior
Application should not throw an exception when the
System.Reflection.NullabilityInfoContext.IsSupportedflag isfalse.Actual behavior
An exception is thrown.
Regression?
Yes
Known Workarounds
Enable the
System.Reflection.NullabilityInfoContext.IsSupportedswitch.Configuration
No response
Other information
No response