Open NoahStahl opened 2 weeks ago
cc: @javiercn
There's a chance that the MapStaticAssets
API might take a dependency on some services/middleware that aren't registered when you call CreateSlimBuilder
.
@captainsafia I'm trying to think what that would be.
@NoahStahl are you seeing any error on the command line logs? Is there any exception being thrown?
@javiercn The reproduction is pretty straightforward, are you able to see this behavior?
dotnet new mvc
Program.cs
, change CreateBuilder
to CreateSlimBuilder
Describe the bug
In an app built with
WebApplication.CreateSlimBuilder()
and using the newMapStaticAssets
in .NET 9, responses for static files are empty with 200 status code. To reproduce, create a new ASPNET Core project from template, then changeWebApplication.CreateBuilder()
toWebApplication.CreateSlimBuilder()
in Program.cs.It appears that calling
UseStaticWebAssets
allows this to work, but this isn't documented as far as I can tell.Would like to understand what is expected and what the correct setup should be. It seems that if
CreateSlimBuilder
alone isn't sufficient, there should be some kind of warning visible to developer. At the very least, this aspect should be documented.Expected Behavior
Either
MapStaticAssets
truly works as a "drop-in replacelement" ofUseWebStaticFiles
, or incompatbilities are documented and/or warned to developer in tooling/build..NET Version
9.0.100