-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Closed
Labels
Description
Is there an existing issue for this?
- I have searched the existing issues
Describe the bug
This GetFolderPath call costs about 8% of CPU samples during startup in the Stage 1 Native AOT application:
| if (!OperatingSystem.IsWindows() || !string.Equals(cwd, System.Environment.GetFolderPath(System.Environment.SpecialFolder.System), StringComparison.OrdinalIgnoreCase)) |
It triggers loading shell32.dll and windows.storage.dll that we probably wouldn't need.
Expected Behavior
shell32.dll doesn't need to be loaded by default on an asp.net api app.
Steps To Reproduce
Run the BasicMinimalApi app and profile the startup logic.
Exceptions (if any)
No response
.NET Version
8.0
Anything else?
Note that this code was copied from Microsoft.Extensions.Hosting.HostApplicationBuilder. If we make a change here, we should make the same change in Extensions Hosting.