Troublesome System.TypeLoadException

I am currently running an ASP.NET application for my company. Recently, I get a System.TypeLoadException when trying to debug code.

Exact message:

Inheritance security rules that are violated by type: "System.Net.Http.Formatting.JsonContractResolver". Derived types must either correspond to the security of the underlying type, or be less accessible.

And he continues to point to the following area as the source of the error:

Line 21: new {controller = "Help", action = "Index", apiId = UrlParameter.Optional}); Line 22:
    Line 23: HelpPageConfig.Register (GlobalConfiguration.Configuration),
    Line 24:}
    Line 25:}

The above can be found in the manual page configuration for help on the web interface.

Has anyone had such problems?

UPDATE: This particular problem started when I deleted the bin folder from TFS.

+4
source share
3 answers

After more than 24 hours of tireless research (and concern), I solved the problem.

After seeing that I continued to throw a System.TypeLoadException , I examined this type and found several reasons why this exception is thrown.

, Newtonsoft.Json.dll, , , , , .NET 2.0 3.5. , , .

+4

, , , , HelpPageConfig.Register(GlobalConfiguration.Configuration) - , . - Register HelpPageConfig.

, , JsonContractResolver, . , , . , .

+1

Microsoft.AspNet.WebApi version="5.2.7" version="4.0.30506.0" newtonsoft 7.0.1.
. .

0

Source: https://habr.com/ru/post/1548638/


All Articles