Open
Description
This code emits the exact warning like what xantari mentioned.
@page "/debug/radio-buttons" @rendermode InteractiveWebAssembly <div> <InputRadioGroup @bind-Value="value1"> <InputRadio Value="@("false")" /> <InputRadio Value="@("true")" /> </InputRadioGroup> </div> @code { private string value1 = "true"; }/_/redacted.Client/obj/Release/net9.0/Microsoft.CodeAnalysis.Razor.Compiler/Microsoft.NET.Sdk.Razor.SourceGenerators.RazorSourceGenerator/Pages_DebugPages_RadioButtonPalette_razor.g.cs(285,9): warning IL2091: 'TValue' generic argument does not satisfy 'DynamicallyAccessedMemberTypes.All' in 'Microsoft.AspNetCore.Components.Forms.InputRadioGroup<TValue>'. The generic parameter 'TValue' of '__Blazor.redacted.Client.Pages.DebugPages.RadioButtonPalette.TypeInference.CreateInputRadioGroup_0<TValue>(RenderTreeBuilder, Int32, Int32, TValue, Int32, EventCallback<TValue>, Int32, Expression<Func<TValue>>, Int32, RenderFragment)' does not have matching annotations. The source value must declare at least the same requirements as those declared on the target location it is assigned to. /_/redacted.Client/obj/Release/net9.0/Microsoft.CodeAnalysis.Razor.Compiler/Microsoft.NET.Sdk.Razor.SourceGenerators.RazorSourceGenerator/Pages_DebugPages_RadioButtonPalette_razor.g.cs(302,9): warning IL2091: 'TValue' generic argument does not satisfy 'DynamicallyAccessedMemberTypes.All' in 'Microsoft.AspNetCore.Components.Forms.InputRadio<TValue>'. The generic parameter 'TValue' of '__Blazor.redacted.Client.Pages.DebugPages.RadioButtonPalette.TypeInference.CreateInputRadio_1<TValue>(RenderTreeBuilder, Int32, Int32, TValue, Int32, Object)' does not have matching annotations. The source value must declare at least the same requirements as those declared on the target location it is assigned to. ...I am at a loss what I am doing wrong.
Originally posted by @alexaka1 in #44845
I have the following enabled in my project:
<PropertyGroup Label="AOT analyzers">
<EnableTrimAnalyzer>true</EnableTrimAnalyzer>
<EnableSingleFileAnalyzer>true</EnableSingleFileAnalyzer>
<EnableAotAnalyzer>true</EnableAotAnalyzer>
</PropertyGroup>
<PropertyGroup Label="AOT">
<RunAOTCompilation>true</RunAOTCompilation>
<OptimizationPreference>Speed</OptimizationPreference>
<WasmStripILAfterAOT>true</WasmStripILAfterAOT>
<RequiredWorkloads>wasm-tools</RequiredWorkloads>
</PropertyGroup>