trullock / NUglify

NUglify is a HTML, JavaScript and CSS minification Library for .NET (fork of AjaxMin + new features)
Other
398 stars 79 forks source link

AllowPartiallyTrustedCallersAttribute issue #358

Open srikanthvarmapenmetsa opened 1 year ago

srikanthvarmapenmetsa commented 1 year ago

Hi i am getting below error when i use NUglify dll in my project

Forms Server error occurred. Contact your administrator. Error Description: Attempt by security transparent method 'Test.Minify.JSMinify.Minify(System.String)' to access security critical method 'NUglify.Uglify.Js(System.String, System.String, NUglify.JavaScript.CodeSettings)' failed. Assembly 'Test, Version=1.0.0.0, Culture=neutral, PublicKeyToken=d86c87abe4a71948' is marked with the AllowPartiallyTrustedCallersAttribute, and uses the level 2 security transparency model. Level 2 transparency causes all methods in AllowPartiallyTrustedCallers assemblies to become security transparent by default, which may be the cause of this exception.

trullock commented 1 year ago

I dont know enought about this to have an opinion.

I dont know if this attribute is explicitly set for some reason or not, if it is then its definitely very old, probably ported from AjaxMin. Otherwise, is it the default?

Happy to do something to resolve this, but I dont know what. Do we need to have separately published/secured assemblies?

srikanthvarmapenmetsa commented 1 year ago

An update on this. This is working fine if we set SecurityCritical attribute in caller method. Please let me know if there is any other solution for this.