-
Notifications
You must be signed in to change notification settings - Fork 10.4k
[AOT] Fix Blazor AOT warnings #45473
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I have opened, and plan on fixing this week, dotnet/runtime#79286 for this issue. |
I would not suppress warnings without some mechanism for ensuring they are ONLY ever used with reference types (e.g. Debug.Assert for internal code, runtime checks for public APIs, etc). Even if it is uncommon or unlikely for the call to MakeGenericType with a ValueType, if it is possible for a customer to do it - the warning needs to be addressed. We can't suppress warnings unless we are sure it is impossible for the code to fail at runtime. |
@Nick-Stanton can you please research this and summarize what are the changes required from our side (Blazor) to achieve what's needed? Thanks! |
@amcasey will look at the ones in the runtime area. |
Web UI's biggest pain point here is our JSON serialization and deserialization. To become more AOT-friendly, we need to do some work implementing
Web UI has a small handful of these. I agree with @eerhardt's point of adding some insurance, but otherwise they all looked suppressible. There were a couple warnings related to DI and following the completion of dotnet/runtime#79286 we should follow up and make sure that they are resolved. I have tracked the projects that we need to change below. CC @mkArtakMSFT Projects for Web UI to resolveBoth JSON and Reflection
JSON
Reflection
|
I have opened #45527 to track this work specifically. |
@eerhardt @Nick-Stanton has completed the changes which are straight forward in the Blazor areas. The remaining work for our team is tracked as part of #45795 and #45578, but we plan to tackle that in the future - not immediately. |
I enabled AOT analysis for all server-focused trimmed projects in #45604 Warnings were addressed for ASP.NET Core server-focused projects (hosting, servers, middleware, etc). AOT analysis was disabled for Blazor projects. It should be re-enabled for Blazor projects when looking at this issue. Disabled AOT analysis projects:
|
I've split out and self-assigned the SPA Proxy work so the remaining projects to be addressed are all Blazor. |
Closing this as we have separate issues tracking the remaining work. |
It doesn't look like the remaining work was addressed. aspnetcore/src/Components/Web/src/Microsoft.AspNetCore.Components.Web.csproj Lines 11 to 12 in ccde043
If there's a separate issue tracking this, we should update the comment in the csproj. |
It's been a while, but I believe #45795 and #45578 cover the remaining work for Blazor |
Thanks for contacting us. We're moving this issue to the |
Closing as we'll be addressing this as part of #51598 |
Uh oh!
There was an error while loading. Please reload this page.
Is there an existing issue for this?
Is your feature request related to a problem? Please describe the problem.
Hosting, HTTP, servers, middleware, routing, and auth were annotated for trimming in .NET 7. Projects with trimming are at https://github.com/dotnet/aspnetcore/blob/82daf67c4754ae5b1beac13d14c1b2e49b1351e8/eng/TrimmableProjects.props.
AOT adds new analysis warnings. I tested enabling AOT analysis for all trimmable projects and got 80ish warnings.
These warnings seem to fall into a bunch of categories:
MakeGenericType
andMakeGenericMethod
. These methods can't be used with value types in AOT. Fortunately, most usages are with reference types, so they can be suppressed.Describe the solution you'd like
Enable AOT analysis for all the projects in https://github.com/dotnet/aspnetcore/blob/82daf67c4754ae5b1beac13d14c1b2e49b1351e8/eng/TrimmableProjects.props. Most of these projects are in @adityamandaleeka space, but there are a couple of components projects for @mkArtakMSFT. Can place
<EnableAOTAnalyzer>false</EnableAOTAnalyzer>
to exclude some projects temporarily.Additional context
No response
The text was updated successfully, but these errors were encountered: