Description
Is there an existing issue for this?
- I have searched the existing issues
Describe the bug
When run the 3rd party application with the latest .NET 9 build, there is no 400 - bad request in /swagger/index.html. it passed with dotnet-sdk-9.0.100-preview.7.24402.8 and fails with dotnet-sdk-9.0.100-rc.1.24409.1
Application Name: CleanArchitecture1
OS: Windows 10 21H2
CPU: X64
.NET Build Number: dotnet-sdk-9.0.100-rc.1.24409.1
App & Source checking at: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/2208398
Github Link:https://github.com/ardalis/CleanArchitecture
Verify Scenarios:
1). Windows 10 21H2 AMD64 + dotnet-sdk-8.0.400: Pass
2). Windows 10 21H2 AMD64 + dotnet-sdk-9.0.100-preview.7.24402.8: Pass
3). Windows 10 21H2 AMD64 + dotnet-sdk-9.0.100-rc.1.24409.1: Fail
Expected Behavior
400-Bad Request show in Responses and there is ErrorResponse in schemas.
Steps To Reproduce
App Repro Steps
- Copy the app to your local machine and change the CleanArchitecture1\Clean.Architecture.Web.runtimeconfig.json to let the app run against with dotnet-sdk-9.0.100-rc.1.24409.1.
"frameworks": [
{
"name": "Microsoft.NETCore.App",
"version": "9.0.0-rc.1.24408.12"
},
{
"name": "Microsoft.AspNetCore.App",
"version": "9.0.0-rc.1.24407.10"
}
]
- Launch CleanArchitecture1\Clean.Architecture.Web.exe.
- Open edge to http://localhost:5000/swagger/index.html.
Actual Result:
400-Bad Request was disappeared and there is no ErrorRseponse in schemas.
Minimal Repro Steps (Demo attached):
- Create a default8.0 asp web api.
- Install FastEndpoints.Swagger 5.28.0.5-beta.
- Copy the following code to replace code in Program.cs.
using FastEndpoints;
using FastEndpoints.Swagger;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddFastEndpoints().SwaggerDocument();
var app = builder.Build();
app.UseFastEndpoints().UseSwaggerGen();
app.Run();
5. Create MyEndpoint.cs with below code.
using FastEndpoints;
namespace ApiDemo
{
public class MyEndpoint : Endpoint<MyRequest, MyResponse>
{
public override void Configure()
{
Post("/Test");
Description(b => b.ProducesProblemDetails(400));
}
public override async Task HandleAsync(MyRequest r, CancellationToken c)
{
await SendAsync(new()
{
Name = "Test"
});
}
}
public class MyRequest
{
public int Id { get; set; }
}
public class MyResponse
{
public string Name { get; set; }
}
}
- Change the runtime.config file to let the app run against with dotnet-sdk-9.0.100-rc.1.24409.1.
"frameworks": [
{
"name": "Microsoft.NETCore.App",
"version": "9.0.0-rc.1.24408.12"
},
{
"name": "Microsoft.AspNetCore.App",
"version": "9.0.0-rc.1.24407.10"
}
]
- Launch the project.
- Go to "http://localhost:5000/swagger/index.html". (If launch by vs, it will redirect to the page automatically.)
Expected Result:
400-Bad Request show in Responses and there are 4 items in schemas.
Actual Result:
400-Bad Request was disappeared and there are 2 items in schemas.
Exceptions (if any)
No response
.NET Version
9.0.100-rc.1.24409.1
Anything else?
Dotnet Info:
.NET SDK:
Version: 9.0.100-rc.1.24409.1
Commit: 43360291a5
Workload version: 9.0.100-manifests.f198e26c
MSBuild version: 17.12.0-preview-24407-03+6bc91d5e2
Runtime Environment:
OS Name: Windows
OS Version: 10.0.19045
OS Platform: Windows
RID: win-x64
Base Path: C:\Program Files\dotnet\sdk\9.0.100-rc.1.24409.1\
Host:
Version: 9.0.0-rc.1.24408.12
Architecture: x64
Commit: static
.NET SDKs installed:
9.0.100-rc.1.24409.1 [C:\Program Files\dotnet\sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 9.0.0-rc.1.24407.10 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 9.0.0-rc.1.24408.12 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 9.0.0-rc.1.24408.3 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
@dotnet-actwx-bot @dotnet/compat