You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using default Razor syntax with and (as generated in standard Blazor templates) triggers trimming and AOT warnings when publishing with PublishTrimmed=true and PublishAot=true.
IL2110: Blazor.UI.App.<>c.<BuildRenderTree>b__0_1(RenderTreeBuilder): Field 'Microsoft.AspNetCore.Components.LayoutView.<Layout>k__BackingField' with 'DynamicallyAccessedMembersAttribute' is accessed via reflection.
IL2111: LayoutView.WrapInLayout(Type, RenderFragment) is accessed via reflection and can't guarantee trim-safety.
These warnings come from the standard boilerplate code, and there is no obvious way to annotate the Razor or suppress the reflection usage safely without manually refactoring the rendering logic.
Expected Behavior
The generated templates and idiomatic Razor code should either:
Avoid unsafe reflection, or
Automatically preserve required types/members (e.g., via linker config or DynamicDependency)
Or at least clearly document the required workaround
IL2110: Blazor.UI.App.<>c.b__0_1(RenderTreeBuilder): Field 'Microsoft.AspNetCore.Components.LayoutView.k__BackingField' with 'DynamicallyAccessedMembersAttribute' is accessed via reflection.
IL2111: LayoutView.WrapInLayout(Type, RenderFragment) is accessed via reflection and can't guarantee trim-safety.
.NET Version
9.0.202
Anything else?
Environment:
Arch linux x64
The text was updated successfully, but these errors were encountered:
Is there an existing issue for this?
Describe the bug
Using default Razor syntax with and (as generated in standard Blazor templates) triggers trimming and AOT warnings when publishing with PublishTrimmed=true and PublishAot=true.
For example, this code:
produces trimming warnings such as:
These warnings come from the standard boilerplate code, and there is no obvious way to annotate the Razor or suppress the reflection usage safely without manually refactoring the rendering logic.
Expected Behavior
The generated templates and idiomatic Razor code should either:
Steps To Reproduce
Exceptions (if any)
IL2110: Blazor.UI.App.<>c.b__0_1(RenderTreeBuilder): Field 'Microsoft.AspNetCore.Components.LayoutView.k__BackingField' with 'DynamicallyAccessedMembersAttribute' is accessed via reflection.
IL2111: LayoutView.WrapInLayout(Type, RenderFragment) is accessed via reflection and can't guarantee trim-safety.
.NET Version
9.0.202
Anything else?
Environment:
Arch linux x64
The text was updated successfully, but these errors were encountered: