You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Unhandled Exception: System.TypeLoadException: Could not load type 'Microsoft.Extensions.FileProviders.CompositeFileProvider' from assembly 'Microsoft.AspNetCore.Mvc.Razor.Extensions, Version=2.1.2.0, Culture=neutral
....
at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider provider, Type serviceType)
at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService[T](IServiceProvider provider)
at Microsoft.AspNetCore.Builder.MvcApplicationBuilderExtensions.UseMvc(IApplicationBuilder app, Action`1 configureRoutes)
at DockerTest.Startup.Configure(IApplicationBuilder app, IHostingEnvironment env) in /app/Startup.cs:line 45
Culprit removed library:
Before linking (B) After linking (B) Size decrease
----------- ----------- ----------- -----------
Total size of assemblies 69,785,560 43,704,832 37.373%
----------- ----------- ----------- -----------
...
Microsoft.Extensions.FileProviders.Composite.dll 17,400 0 100.000%
This is a simple barebones webapi generated through the dotnet cli
Even in .NET 7 wepapi projects use libraries which are not yet fully annotated for trimming, so it's possible they don't work. There has been some begining efforts in the ASP.NET repo to start annotating the libraries for trimming, but it's been slow (and difficult).
The dotnet/runtime part of the app should be trimmable, but ASP.NET libraries are a problem currently. I suggest you create a new issue in the dotnet/aspnetcore repo, updated with a project targeting .NET 7.
Full repro: https://github.com/swratten/docker-test just
git clone
anddocker build
Exception at runtime:
Culprit removed library:
This is a simple barebones webapi generated through the dotnet cli
My build commands are in the dockerfile:
https://github.com/swratten/docker-test/blob/master/Dockerfile
As suggested at #314 I ran into this previous error, so I added the workaround for that issue
The text was updated successfully, but these errors were encountered: