Skip to content

[AOT] Explore Alternatives to MakeGenericType/MakeGenericMethod For Web UI #45795

@Nick-Stanton

Description

@Nick-Stanton

Is there an existing issue for this?

  • I have searched the existing issues

Is your feature request related to a problem? Please describe the problem.

There are multiple uses of MakeGenericType() and MakeGenericMethod() throughout the Microsoft.AspNetCore.Components and Microsoft.JSInterop projects that make them unsafe for AOT scenarios. Initially it was believed that the warnings surrounding these would be suppressible since these projects are already trim-safe, but there are multiple places where we cannot guarantee the safety of the suppression.

During review of #45580, there was the suggestion of exploring a non-dynamic code fallback such as here. Further investigation found that the performance degradation would make this a poor approach when dealing with Blazor.

Describe the solution you'd like

The below uses of MakeGenericMethod() and MakeGenericType() need to either have an AOT-safe fallback or a refactor (e.g. source generation) which allows these type-generic methods to not require JIT compilation.

Microsoft.AspNetCore.Components

Microsoft.JSInterop

Additional context

Linked to #45578, the other part of Web UI's remaining work in #45473.

AOT analysis for these projects is already turned off by #45604.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions