Share via

How to fix the Exception Unhandled described bellow?

DEOMWEYOLA-1025 0 Reputation points
2026-03-28T17:23:05.72+00:00

System.TypeLoadException: 'Method 'GetSwagger' in type 'Swashbuckle.AspNetCore.SwaggerGen.SwaggerGenerator' from assembly 'Swashbuckle.AspNetCore.SwaggerGen, Version=6.5.0.0, Culture=neutral, PublicKeyToken=d84d99fb0135530a' does not have an implementation.'

Developer technologies | ASP.NET Core | Other
0 comments No comments

Answer recommended by moderator

DEOMWEYOLA-1025 0 Reputation points
2026-03-30T23:07:31.7366667+00:00

Thank you, guys, for all your inputs. I finally got it straightened up. Indeed, there was a version discrepancy, and by removing all Swashbuckle.AspNetCore.Swagger

  • Swashbuckle.AspNetCore.SwaggerGen
  • Swashbuckle.AspNetCore.SwaggerUI Version 6s and installed .NET 9.0 instead of .NET 6.0 and Swashbuckle.AspNetCore.Swagger
    • Swashbuckle.AspNetCore.SwaggerGen
  • Swashbuckle.AspNetCore.SwaggerUI version 9.0.4. That fixed the problem.

Was this answer helpful?

2 people found this answer helpful.
0 comments No comments

5 additional answers

Sort by: Most helpful
  1. AI answer

    2026-03-28T17:23:14+00:00

    System.TypeLoadException in this case indicates a version mismatch between Swashbuckle assemblies: the code is calling a SwaggerGenerator.GetSwagger method whose signature no longer matches the implementation in the referenced Swashbuckle.AspNetCore.SwaggerGen, Version=6.5.0.0.

    To fix it, align the Swashbuckle packages and the ASP.NET Core version:

    1. Open the project file or NuGet Package Manager and ensure all Swashbuckle packages use the same version, for example:
      • Swashbuckle.AspNetCore.Swagger
      • Swashbuckle.AspNetCore.SwaggerGen
      • Swashbuckle.AspNetCore.SwaggerUI
      They must all be 6.5.0 (or all upgraded to the same newer version).
    2. Clean and rebuild the project after updating the packages.
    3. If targeting .NET 9 or later, consider using the built‑in OpenAPI support and only add Swashbuckle.AspNetCore.SwaggerUI for the UI, as described in the Swashbuckle getting‑started guidance. This avoids conflicts between the built‑in OpenAPI services and older Swashbuckle generator code.

    If the exception persists, remove all Swashbuckle packages, rebuild, then reinstall a consistent Swashbuckle version and regenerate any Swagger configuration code so it matches the installed version.


    References:

    AI-generated content may be incorrect. Read our transparency notes for more information.

    Was this answer helpful?

    2 people found this answer helpful.
  2. DEOMWEYOLA-1025 0 Reputation points
    2026-03-29T00:05:06.99+00:00

    I am using .NET 8.0

    Was this answer helpful?

    0 comments No comments

  3. DEOMWEYOLA-1025 0 Reputation points
    2026-03-29T00:02:20.3+00:00

    I had .NET 9.0, but I uninstalled it and loaded.Net8.0

    Based on your suggestion, I found that I had Swashbuckle.AspNetCore.Swagger 10.0 and 6.5.0

    • Swashbuckle.AspNetCore.SwaggerGen 10.1.0 and 6.6.2
    • Swashbuckle.AspNetCore.SwaggerUI 10.1.0 and 6.5.0

    I deleted all 10.1.0s and kept version 6.5.0s for all 3s. I cleaned and Rebuilt I got the following error: An unhandled exception of type 'System.Reflection.TargetInvocationException' occurred in System.Private.CoreLib.dll

    Exception has been thrown by the target of an invocation.

    Was this answer helpful?

    0 comments No comments

  4. Bruce (SqlWork.com) 84,066 Reputation points
    2026-03-28T20:54:12.4766667+00:00

    What version of .net are you using this nuget package is for? This package is for .net 5 which is long out of support.

    Was this answer helpful?

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.