aspnetcore: [dotnet-sdk-10.0.100-alpha.1.25057.15] CleanArchitecture1 get error: System.TypeLoadException: Method 'get_Description' in type 'FastEndpoints.ProducesResponseTypeMetadata' from assembly FastEndpoints does not have an implementation.
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 10 build, it failed with error: System.TypeLoadException: Method 'get_Description' in type 'FastEndpoints.ProducesResponseTypeMetadata' from assembly 'FastEndpoints, Version=5.27.0.0, Culture=neutral, PublicKeyToken=null' does not have an implementation.
Application Name: CleanArchitecture1 OS: Windows 10 22H2 CPU: X64 .NET Build Number: dotnet-sdk-10.0.100-alpha.1.25057.15 App & Source Location checking at: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/2338907 Github Link: https://github.com/ardalis/CleanArchitecture
Verify Scenarios: 1). Windows 10 22H2 AMD64 + dotnet-sdk-9.0.102: Pass 2). Windows 10 22H2 AMD64 + dotnet-sdk-10.0.100-alpha.1.25057.15: Fail
Expected Behavior
Launch successfully.
Steps To Reproduce
App Repro Steps:
- Copy AppSource\SourceShare\CleanArchitecture1to your local machine .
- Open “CleanArchitecture1\App\CleanArchitecture1\Clean.Architecture.Web.runtimeconfig.json” file .
- Change the “Clean.Architecture.Web.runtimeconfig.json” file to let the app run against with
dotnet-sdk-10.0.100-alpha.1.25057.15.
"frameworks": [
{
"name": "Microsoft.NETCore.App",
"version": "10.0.0-alpha.1.25052.4"
},
{
"name": "Microsoft.AspNetCore.App",
"version": "10.0.0-alpha.2.25056.9"
}
]
- Run the ”CleanArchitecture1\App\CleanArchitecture1\Clean.Architecture.Web.exe”.
- Open edge and go to “http://localhost:5000/swagger/index.html”.
Expected Result: Launch successfully.
Actual Result: Launch failed with error:
System.TypeLoadException: Method 'get_Description' in type 'FastEndpoints.ProducesResponseTypeMetadata' from assembly 'FastEndpoints, Version=5.27.0.0, Culture=neutral, PublicKeyToken=null' does not have an implementation.
Minimal Repro steps (Demo attached:WebApiDemo.zip):
- Create a default8.0 asp web api.
- Install FastEndpoints.Swagger 5.33.0.0.
- 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();
- Create MyEndpoint.cs with below code.
using FastEndpoints;
namespace WebApiDemo
{
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; }
}
}
- Publish the app with command “dotnet publish”.
- Change the runtime.config file to let the app run against with dotnet-sdk-10.0.100-alpha.1.25057.15.
"frameworks": [
{
"name": "Microsoft.NETCore.App",
"version": "10.0.0-alpha.1.25052.4"
},
{
"name": "Microsoft.AspNetCore.App",
"version": "10.0.0-alpha.2.25056.9"
}
]
- Launch the app by WebApiDemo.exe.
- Open edge and go to “http://localhost:5000/swagger/index.html”.
Expected Result: Launch successfully.
Exceptions (if any)
Actual Result:
Launch failed with error:
System.TypeLoadException: Method 'get_Description' in type 'FastEndpoints.ProducesResponseTypeMetadata' from assembly 'FastEndpoints, Version=5.33.0.0, Culture=neutral, PublicKeyToken=null' does not have an implementation.
.NET Version
10.0.100-alpha.1.25057.15
Anything else?
Dotnet info:
.NET SDK:
Version: 10.0.100-alpha.1.25057.15
Commit: 39da6dde11
Workload version: 10.0.100-manifests.a166a9cf
MSBuild version: 17.14.0-preview-25056-07+8d395fd27
Runtime Environment:
OS Name: Windows
OS Version: 10.0.19045
OS Platform: Windows
RID: win-x64
Base Path: C:\Program Files\dotnet\sdk\10.0.100-alpha.1.25057.15\
Host:
Version: 10.0.0-alpha.1.25052.4
Architecture: x64
Commit: efdd299533
.NET SDKs installed:
10.0.100-alpha.1.25057.15 [C:\Program Files\dotnet\sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 10.0.0-alpha.2.25056.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 10.0.0-alpha.1.25052.4 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 10.0.0-alpha.1.25056.2 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 15 (11 by maintainers)
Verified this issue with dotnet-sdk-10.0.100-preview.3.25174.2, it has been fixed.
@sander1095 If you’re up for it, here’s another issue for you.
Should just be a matter of updating the interface type with a default implementation (null seems fine?).
starting with
v5.35.0.603-beta, FastEndpoints supports .NET 10 now. so i suppose, this issue can be closed.It seems that FastEndpoints (version 5.33.0) uses its own implementation of IProducesResponseTypeMetadata from AspNetCore, however that interface was recently changed to include a Description property. This means that trying to cast (with the newest build) the interface into FastEndpoints’ custom type will not work as it does not yet implement that Description property. I don’t think this is an issue related to ASP.NET Core itself.