Search code examples
windowsmacosvisual-studio.net-coreopeniddict

"Application is in Break Mode" with OpenIddict on .net Core 2.0 Win vs. Mac (scary)


I encounter a scary problem with OpenIddict on .NET Core 2.0. I use a Windows 10 PC with Visual Studio 2017 at work and a Mac when I'm doing homeoffice. On the Mac I use Visual Studio for Mac.

So sometimes I continue work on my Mac, pushing changes to the Git repository and check them out on the Windows PC.

Without doing any changes on the code that deals with OpenIddict I am suddenly encountering problems only on windows when the code comes to return an access token through an AuthController method with this signature:

public async System.Threading.Tasks.Task<IActionResult> GetTokenAsync(OpenIdConnectRequest request)

The return command is

return SignIn(ticket.Principal, ticket.Properties, ticket.AuthenticationScheme);

I can debug until the end of GetTokenAsync(). Then the system runs into the following case and falls into the Application Break Mode.

An unhandled exception of type 'System.ExecutionEngineException' occurred in AspNet.Security.OpenIdConnect.Extensions.dll

The project compiles fine on both my Mac and Windows. When I deploy to Azure from Visual Studio 2017 for Windows, the software crashes on Azure as well. When I deploy to Azure from my Mac, the software works.

Conclusion: It must be a problem with Visual Studio or the NuGet packages?

These are my used package references, they are pretty much up to date:

<PackageReference Include="AspNet.Security.OAuth.Introspection" Version="2.0.0-rc1-final" />
<PackageReference Include="AutoMapper" Version="6.1.1" />
<PackageReference Include="Jwt.Token.Authorization.Server" Version="1.0.3" />
<PackageReference Include="Mailjet.Api" Version="1.0.1" />
<PackageReference Include="Microsoft.AspNetCore" Version="2.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="2.0.0" />
<PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="2.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Formatters.Xml" Version="2.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="2.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="2.0.0" />
<PackageReference Include="MySql.Data" Version="8.0.9-dmr" />
<PackageReference Include="Newtonsoft.Json" Version="10.0.3" />
<PackageReference Include="AspNet.Security.OAuth.Validation" Version="2.0.0-rc1-final" />
<PackageReference Include="OpenIddict" Version="2.0.0-rc1-final" />
<PackageReference Include="OpenIddict.EntityFrameworkCore" Version="2.0.0-rc1-final" />
<PackageReference Include="OpenIddict.Mvc" Version="2.0.0-rc1-final" />
<PackageReference Include="System.Threading.Timer" Version="4.3.0" />
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="2.0.0" />
<PackageReference Include="WindowsAzure.Storage" Version="8.5.0" />
<PackageReference Include="HtmlAgilityPack" Version="1.6.2" />

Does anybody has an idea, how I can get my Windows environment back to work? I even stepped back on my Git history to a point where I didn't do the last checkout from my Mac, but the problem persists. So I am pretty sure that it is a problem of .net core, NuGet or Visual Studio.

Thanks in advance!


Solution

  • I fixed the problem by deleting the contents of C:\Users\Me\.nuget.

    @Pinpoint's comment points to the solution as well.