Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Derived types must either match the security accessibility of the base type or be less accessible

I upgraded my MVC 4 app to MVC 5 a couple of days ago following these instructions and now I'm getting the following error. I updated DotNetOpenAuth to the latest bits using Nuget (v4.3.3.13295) but it still throws this error.

How do I fix this?

Inheritance security rules violated by type: 'DotNetOpenAuth.Messaging.OutgoingWebResponseActionResult'. Derived types must either match the security accessibility of the base type or be less accessible.

like image 526
TugboatCaptain Avatar asked Nov 22 '13 16:11

TugboatCaptain


1 Answers

Solved this finally. Turned out that I needed to make some changes to the source code of DotNetOpenAuth and re-compile it. This wasn’t easy at all since the source code won’t compile after downloading from github. I had to spend ~3 days trying various things and learning the build system meshed into DotNetOpenAuth’s project files until I finally got it to compile. Seems the author of this project has abandoned it. See more about this issue here.

  1. Download the 4.3 code base using this command line: git clone -b v4.3 https://github.com/DotNetOpenAuth/DotNetOpenAuth.git
  2. Edit the /src/version.txt and change it to 4.4.0. This makes this version higher than the official Nuget release so that installing Nuget packages don’t attempt to install old versions of DotNetOpenAuth assemblies from its repository.
  3. Remove all instances of the following string from all AssemblyInfo.cs files under the /src/ directory.

    [assembly: AllowPartiallyTrustedCallers]

  4. I had to mess around with the Microsoft.Contracts reference in two projects and point it to /tools/Contracts/PublicAssemblies/v3.5/Microsoft.Contracts.dll and then use a using alias to get classes from this assembly to resolve properly. A few Requires.NotNull() lines refused to compile so I just commented them out… c'est la vie..

  5. Run the following command to skip verification of these assemblies: sn.exe -Vr *,2780ccd10d57b246

Once the assemblies were built I referenced those, re-added Microsoft.AspNet.WebPages.OAuth 3.0 from Nuget, rebuilt my solution, and finally my app is up and running on MVC 5.

like image 118
TugboatCaptain Avatar answered Sep 30 '22 16:09

TugboatCaptain