Skip to content

[dotnet-sdk-9.0.100-rc.1.24409.1] No "400 - bad" ErrorResponse shows in CleanArchitecture app #57343

Closed as duplicate of#57801
@Junjun-zhao

Description

@Junjun-zhao

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.
image

Steps To Reproduce

App Repro Steps

  1. 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"
      }
    ]
  1. Launch CleanArchitecture1\Clean.Architecture.Web.exe.
  2. Open edge to http://localhost:5000/swagger/index.html.

Actual Result:
400-Bad Request was disappeared and there is no ErrorRseponse in schemas.
image

Minimal Repro Steps (Demo attached):

  1. Create a default8.0 asp web api.
  2. Install FastEndpoints.Swagger 5.28.0.5-beta.
  3. 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; }
    }
}
  1. 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"
      }
    ]
  1. Launch the project.
  2. 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.
image

Actual Result:
400-Bad Request was disappeared and there are 2 items in schemas.
image

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

Metadata

Metadata

Assignees

Labels

area-minimalIncludes minimal APIs, endpoint filters, parameter binding, request delegate generator etcfeature-openapi

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions