TypeLoadException with LINQPad 7 Beta and Minimal APIs


When trying to run Minimal APIs on LINQPad 7 Beta I get the following error:

TypeLoadException: Could not load type 'Microsoft.AspNetCore.Builder.MinimalActionEndpointRouteBuilderExtensions' from assembly 'Microsoft.AspNetCore.Routing, Version=, Culture=neutral, PublicKeyToken=adb9793829ddae60'

An interesting thing is that exactly the same program runs fine under identical configuration on my laptop. Does anyone know what could cause this kind of error? It looks as it the assembly it is trying to run is corrupted.

Thanks a lot in advance!



  • How are you doing it? The following query works for me:

    var app = WebApplication.CreateBuilder().Build();
    app.MapGet ("/", () => "Hello from LINQPad!");
    // Test API
    Process.Start (new ProcessStartInfo ("http://localhost:5000") { UseShellExecute = true });

    Note that you shouldn't add any NuGet references to use ASP.NET in LINQPad. Just press F4 and tick the checkbox on the bottom right.

  • I am doing it with the same code as you posted. There are no NuGet packages referencing ASP.NET Core assemblies in the query, just the "Reference ASP.NET Core assemblies" ticket under Additional References tab. As I said, exactly the same code and configuration work fine on my other machine. The same code also works fine if I run it from Rider.

    The value of InnerException is null.

    Could the 'Version=' have any impact on the error considering that there is no such version of the Microsoft.AspNetCore.Routing assembly with the latest version being 2.2.2?

  • .NET 6 LTS solves the issue.

Sign In or Register to comment.