Imported from the CodePlex archive for reference purposes. Support for MvcCodeRouting has ended.
Commented on
MvcCodeRouting was working fine for months. Suddenly it started to throw this error:
Assembly 'MvcCodeRouting, Version=1.3.0.0, Culture=neutral, PublicKeyToken=bf7cf9743009fe42' is partially trusted, which causes the CLR to make it entirely security transparent regardless of any transparency annotations in the assembly itself. In order to access security critical code, this assembly must be fully trusted.
Exception Details: System.MethodAccessException: Attempt by security transparent method 'MvcCodeRouting.Web.Mvc.MvcControllerInfo.Create (System.Type, MvcCodeRouting.RegisterSettings, MvcCodeRouting.CodeRoutingProvider)' to access security critical method 'System.Runtime.Serialization.FormatterServices.GetUninitializedObject(System.Type)' failed.
It's not clear to me what really happened.
I think my host provider just enabled some security stuff.
It seems to me that you have to flag your assembly for use in "medium trust" context.
"There is no programmatic way for partially trusted code to call a library that does not have the AllowPartiallyTrustedCallersAttribute attribute."
Is that right?
How can I fix this?
Thanks in advance.
Medium trust is obsolete, so developing for it is not worth it. At the same time, that code enables a very obscure feature that I'm sure no one uses, and the whole described-based metadata is pretty much broken since MVC 4, so I should just remove all that.
In the meantime, try this:
Fork the code.
Remove everything in MvcControllerInfo.Create except the last line where it returns ReflectedMvcControllerInfo. You can also remove the type constructor and related fields.
Build and replace MvcCodeRouting.dll in your production website with your modified assembly.