Skip to content

I get IL2111 after adding the NotFoundPage to my Router in Blazor Hybrid with full linker #63951

@mattleibow

Description

@mattleibow

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

After adding the NotFoundPage to my Router object, I can no longer build without errors:

.../Microsoft.NET.Sdk.Razor.SourceGenerators.RazorSourceGenerator/Components_Routes_razor.g.cs(81,13): error IL2111: Method 'Microsoft.AspNetCore.Components.Routing.Router.NotFoundPage.set' with parameters or return value with DynamicallyAccessedMembersAttribute is accessed via reflection. Trimmer can't guarantee availability of the requirements of the method.

I am not sure what I am supposed to do. Is this a terrible issue and I can no longer use full linker, or is this a false positive and we can ignore? What is the best way to ignore without disabling this check?

Expected Behavior

No errors.

Steps To Reproduce

This requires the usage of the new templates, but is also really a small chnage to use this new property. But...

dotnet new maui-blazor -f net10.0 
dotnet build -c Release -f:net10.0-ios -p:TreatWarningsAsErrors=true -p:TrimmerSingleWarn=false -p:TrimMode=full

Exceptions (if any)

No response

.NET Version

.NET 10 RC 1

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs: Author FeedbackThe author of this issue needs to respond in order for us to continue investigating this issue.area-blazorIncludes: Blazor, Razor Components

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions