Using with Web.Optmization and Umbraco v6

Jun 3, 2014 at 3:14 AM

When I try to use the YuiCompressorTransform with the BundleTable and Umbraco v6, I get this error on application start:

Inheritance security rules violated while overriding member: 'Yahoo.Yui.Compressor.Web.Optimization.YuiCompressorTransform.Process(System.Web.Optimization.BundleContext, System.Web.Optimization.BundleResponse)'. Security accessibility of the overriding method must match the security accessibility of the method being overriden.

I tried some of the suggestions in this article:

But I still get the same error.

It looks like it may be an issue with the new security model in v4.5 of the framework (which is what I am using).

Has anyone else had this issue? If so, any suggestion on how to fix it?


Jun 3, 2014 at 4:45 AM
Hi Dan,

i've never seen this problem before with any projects I've worked on. So i'm not sure if I can help. I know that's not the answer you wanted to hear, but at least some type of comm's is better than none.

That said, the comment on that SO post mentions this...

[assembly: System.Security.AllowPartiallyTrustedCallers]

which does exist in -all- our dll's .. via this shared properties file.. Assembly Info/SharedAssemblyInfo.cs

so maybe this might help you by trying to remove that line, recompiling and seeing what happens?

I think that weird assembly thing code-line was added, for some Unit Tests stuff.
Jun 3, 2014 at 6:50 AM
To make sure it wasn't isolated to projects using Umbraco, I tried it in a clean MVC 4 website and get the same error.

Will try the code change and recompile and see if it makes a difference.
Jun 3, 2014 at 7:09 AM
Your suggestion seems to have fixed the problem.

I have created a pull request with the required code changes submitted.

Please let me know when this has been integrated and deployed to NuGet.