Skip to content
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

Update CreateSlimBuilder for Microsoft.Extensions.Hosting.Host.CreateEmptyApplicationBuilder #46293

Closed
eerhardt opened this issue Jan 27, 2023 · 2 comments · Fixed by #46579
Closed
Assignees
Labels
area-web-frameworks *DEPRECATED* This label is deprecated in favor of the area-mvc and area-minimal labels
Milestone

Comments

@eerhardt
Copy link
Member

eerhardt commented Jan 27, 2023

Once dotnet/runtime#81280 is implemented, we should take advantage of this new API in CreateSlimBuilder:

_hostApplicationBuilder = new HostApplicationBuilder(new HostApplicationBuilderSettings
{
DisableDefaults = true,
Args = options.Args,
ApplicationName = options.ApplicationName,
EnvironmentName = options.EnvironmentName,
ContentRootPath = options.ContentRootPath,
Configuration = configuration,
});

This should cut about 1.3 MB of a NativeAOT published Windows x64 app. Prototyping this change on my machine results the Benchmark app:

Before
15.2 MB (16,007,168 bytes)

After
13.9 MB (14,593,024 bytes)

And 1.4MB on Linux x64:

Before
18.6 MB (19,601,424 bytes)

After
17.2 MB (18,132,768 bytes)

@eerhardt eerhardt self-assigned this Jan 27, 2023
@adityamandaleeka
Copy link
Member

Marking this blocked until the runtime API is ready

@adityamandaleeka adityamandaleeka added the blocked The work on this issue is blocked due to some dependency label Jan 30, 2023
@adityamandaleeka adityamandaleeka added this to the .NET 8 Planning milestone Jan 30, 2023
@ghost
Copy link

ghost commented Jan 30, 2023

Thanks for contacting us.

We're moving this issue to the .NET 8 Planning milestone for future evaluation / consideration. We would like to keep this around to collect more feedback, which can help us with prioritizing this work. We will re-evaluate this issue, during our next planning meeting(s).
If we later determine, that the issue has no community involvement, or it's very rare and low-impact issue, we will close it - so that the team can focus on more important and high impact issues.
To learn more about what to expect next and how this issue will be handled you can read more about our triage process here.

@adityamandaleeka adityamandaleeka added area-web-frameworks *DEPRECATED* This label is deprecated in favor of the area-mvc and area-minimal labels and removed area-runtime labels Jan 30, 2023
@eerhardt eerhardt removed the blocked The work on this issue is blocked due to some dependency label Feb 9, 2023
eerhardt added a commit to eerhardt/aspnetcore that referenced this issue Feb 11, 2023
Also fix 2 existing bugs:
1. ContentRootPath is set to the app's BaseDirectory, and not CurrentWorkingDirectory. Default to CWD by using the same logic as HostApplicationBuilder.
2. Add un-prefixed environment variables to the configuration, and ensure the configuration order is the same as WebApplication.CreateBuilder.

Fix dotnet#46293
eerhardt added a commit that referenced this issue Feb 16, 2023
…46579)

* Update CreateSlimBuilder to use Host.CreateEmptyApplicationBuilder.

Also fix 2 existing bugs:
1. ContentRootPath is set to the app's BaseDirectory, and not CurrentWorkingDirectory. Default to CWD by using the same logic as HostApplicationBuilder.
2. Add un-prefixed environment variables to the configuration, and ensure the configuration order is the same as WebApplication.CreateBuilder.

Fix #46293
@ghost ghost locked as resolved and limited conversation to collaborators Mar 19, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-web-frameworks *DEPRECATED* This label is deprecated in favor of the area-mvc and area-minimal labels
Projects
No open projects
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants