New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Could not load type 'Microsoft.AspNetCore.Mvc.MvcJsonOptions' (Version=3.1.2.0) in NSwag.AspNetCore v 13.5.0 #2856
Comments
|
Might be related to #1961 (comment) |
Same Problem here :( |
Can you create a PR against a sample project in this repo to repro this? |
I don't see that in my .net core 3.1 projects... |
@maxberghammer @RicoSuter The main reason seems to be the missing |
Is this expected to work now? I continue to get this exception, even on a simple project. The solution from #1961 has no effect. Refer attached. I can continue from the exception, but parameter models are not resolved in controllers. System.TypeLoadException: 'Could not load type 'Microsoft.AspNetCore.Mvc.MvcJsonOptions' from assembly 'Microsoft.AspNetCore.Mvc.Formatters.Json, Version=3.1.9.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'.' |
It seems that we need to catch this error when Newtonsoft is not available and fall back to System.Text.Json (this should be there but probably it stops before it can fall back?). |
Also, this error gets thrown in .Net Core 3 where the Microsoft.AspNetCore.Mvc.MvcJsonOptions library is not even available regardless of whether you include NewtonsoftJson and specify .AddNewtonsoftJson(). It seems like it is thrown by the core libraries though I think the issue of the parameter models is a different issue to do with the modelbinders, and that this error is safely ignorable, but it would be great not to have it raised if it is irrelevant. |
I've spent 2 days looking into this after migrating to .NET 5, so if it is irrelevant it would be nice to hide it so no other developers will be left wondering. You need to enable the all CommonLanguageRuntimeExceptions check to see the exception. This option comes in handy some times when debugging. But this bug throws every time you run if you enable it. https://www.carlosjanderson.com/break-on-all-exceptions/ Startup
Project
Exception
Any thoughts? |
System.TypeLoadException: 'Could not load type 'Microsoft.AspNetCore.Mvc.MvcJsonOptions' from assembly 'Microsoft.AspNetCore.Mvc.Formatters.Json, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'.' And
I am ignoring exception as it is not blocking my app, any help please is welcome. |
Any update here? I have a similar exception in Startup of a FunctionApp on .NET Core 3.1
A host error has occurred during startup operation '9eae7ea7-d20b-4c8f-a5bc-f6d4ada2d40e'. |
Sorry for the last post. After a bit of thinking, I think that you get an EDIT: This method could be rewritten to remove the usage of the dynamic, by writing returns instead of storing the value inside |
Any chance to get rid of adding |
@dmitry-pavlov is this still a problem with the v14 previews? |
Yeah, now it's gone in v14 preview. Cool 👍 Thanks @RicoSuter ! |
Just a note how to handle |
I ma getting this error when I am opening in browser API Explorer
The text was updated successfully, but these errors were encountered: