Swashbuckle.aspnetcore: AddSwaggerGen broken with the latest ASP.NET Core 1.1

Created on 18 Nov 2016  路  18Comments  路  Source: domaindrivendev/Swashbuckle.AspNetCore

ASP.NET Core 1.1 was released yesterday and it broke SwashBuckle. What are the chances of getting it fixed soon? Reverting back to an old ASP.NET Core is a discouraging concept.

)
In ConfigureServices I have
services.AddSwaggerGen

That line generates the following exception:

FatalExecutionEngineError occurred
HResult=-2146233082
Message=Exception of type 'System.ExecutionEngineException' was thrown.
InnerException:

Additional information: The runtime has encountered a fatal error. The address of the error was at 0xca2b3c23, on thread 0xcf8. The error code is 0xc0000005. This error may be a bug in the CLR or in the unsafe or non-verifiable portions of user code. Common sources of this bug include user marshaling errors for COM-interop or PInvoke, which may corrupt the stack.

I would be very grateful for any indication on what to do with this!

Thanks

Most helpful comment

Swashbuckle is component-based, consisting of 3 different packages (all described in the readme).

If you want the generation functionality, then you need to include the following package:

Swashbuckle.AspNetCore.SwaggerGen

All 18 comments

I try it yesterday and at a first time I had the same error; then in project.json under dependency I add
_"Microsoft.NETCore.App": {
"version": "1.1.0",
"type": "platform"
},_
and then project runs well (also AddSwaggerGen :) )

Hope it help

Thanks cherici-simone, I went the hard route and added the three swagger projects to my vs solution and then upgraded all the Microsoft assemblies, which worked, but your solution seems much simpler!

Hi again,

Just wondering if anyone is going to address this? The solution offered (adding Microsoft.NETCore.App) does not work - I am targeting .NET Framework 4.6.1 and it says that Package Microsoft.NETCore.App 1.1.0 is not compatible with net461.

Is there anything I can do to resolve swashbuckle working wtih ASP.NET core 1.1.0 targeting framework 4.6.1?

Thanks,

Ian

I also have to target Net 4.6.1 since I'm using ADAL. Is there support for this planned or do I have to drop Swashbuckle from the project which would be really sad since I love it...

Until they have fixed it there is an (ugly) workaround. Just download the version of ahoy sourcecode you're using (not the latest version), open in visual studio and update all the microsoft nuget packages, then add the three swashbuckle projects to your project solution and change all the swashbuckle references to project references. This worked for me. Of course there will be no further nuget updates this way, but hopefully by then this will have been fixed.

Some quick searching makes it sound like this is the result of mixing different framework versions. Have you tried updating all of your references to the latest NuGet package versions (not just Swashbuckle/Ahoy)?

This is probably going to be a long-running issue since not everyone will update at the same time to ASP.NET Core "latest version" so "fixing it" at the Swashbuckle level may not necessarily be the correct solution. This is a lot like early on in classic .NET where binding redirects were a painful thing to figure out.

Determining _why_ this error is happening (maybe having a small repro if someone can post one?) would go a long way to figuring out the right way to solve this. It may just be a bad combination of references, but it's hard to say without seeing it in action.

We had this issue too after upgrading to .NET Core 1.1 on .NET 4.6.1
The solution was to delete all contents of the bin and obj folders.

Wow, I believe you are correct - apologies to all for not trying this at the outset. Thanks very much kapsiR.

On Visual Studio 2017 RC, after creating a new project using csproj rather than project.json, then moving to .NET Core 1.1, Swashbuckle is broken.

image

Has anyone found a solution to this?

@gcsuk I found that all I had to do was delete my bin and obj project folders, clean the solution and rebuild it and it seemed to pick those references up just fine!

I have the same issues as @gcsuk
No solution yet.

Same problem here: _Unable to resolve 'Swashbuckle.AspNetCore' for '.NETCoreApp,Version=v1.1'._

Any news on this topic? I would really love to use swagger with vs17 and .net core 1.1 but sadly also receiving errors when trying to use the API.

Kind regards

I am using it in a couple projects with VS2017 and the latest .NET core with no issues. If you wish, you can put a project on GH and I'll take a quick look and see if I can spot the problem...

@IanElsinga thank you for the opportunity. You will find the broken code here
https://github.com/SamiAl90/entertainment-database-aspnet-core

It simply doesn't recognize the command "AddSwaggerGen".

Thanks in advance

Swashbuckle is component-based, consisting of 3 different packages (all described in the readme).

If you want the generation functionality, then you need to include the following package:

Swashbuckle.AspNetCore.SwaggerGen

Stupid me, thank you.

@domaindrivendev However the documentation here
https://github.com/domaindrivendev/Swashbuckle.AspNetCore

...states

Install the standard Nuget package into your ASP.NET Core application.
Install-Package Swashbuckle.AspNetCore

and

They can be installed together, via the "Swashbuckle.AspNetCore" meta-package

Which appears to be incorrect as doing that results in none of the exports of those assemblies being recognised.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

m-demydiuk picture m-demydiuk  路  3Comments

vanillajonathan picture vanillajonathan  路  3Comments

JoelAdamWeiss picture JoelAdamWeiss  路  4Comments

voroninp picture voroninp  路  3Comments

jluqueba picture jluqueba  路  4Comments