1

Closed

Code Access Security Violation Serialization.GetObjectData Override

description

When running under ASP.Net 4.0, both the 04.01.01 and 05.01.01 versions of Content Dejour throw the following exception during just-in-time compilation. Due to changes in the way that ASP.Net 4.0 applies code access security (CAS) levels, this has been a common error for many ASP.Net applications which had created a class inheriting from System.Runtime.Serialization to provide custom serialization of data.
 
InnerException: Inheritance security rules violated while overriding member: 'WESNet.DNN.Modules.ContentDejour.MonthArray.GetObjectData(System.Runtime.Serialization.SerializationInfo, System.Runtime.Serialization.StreamingContext)'. Security accessibility of the overriding method must match the security accessibility of the method being overriden.
FileName:
FileLineNumber: 0
FileColumnNumber: 0
Method: System.Reflection.RuntimeAssembly.GetType
StackTrace:
Message: DotNetNuke.Services.Exceptions.ModuleLoadException: Inheritance security rules violated while overriding member: 'WESNet.DNN.Modules.ContentDejour.MonthArray.GetObjectData(System.Runtime.Serialization.SerializationInfo, System.Runtime.Serialization.StreamingContext)'. Security accessibility of the overriding method must match the security accessibility of the method being overriden. ---> System.Web.HttpParseException: Inheritance security rules violated while overriding member: 'WESNet.DNN.Modules.ContentDejour.MonthArray.GetObjectData(System.Runtime.Serialization.SerializationInfo, System.Runtime.Serialization.StreamingContext)'. Security accessibility of the overriding method must match the security accessibility of the method being overriden. ---> System.Web.HttpParseException: Inheritance security rules violated while overriding member: 'WESNet.DNN.Modules.ContentDejour.MonthArray.GetObjectData(System.Runtime.Serialization.SerializationInfo, System.Runtime.Serialization.StreamingContext)'. Security accessibility of the overriding method must match the security accessibility of the method being overriden. ---> System.TypeLoadException: Inheritance security rules violated while overriding member: 'WESNet.DNN.Modules.ContentDejour.MonthArray.GetObjectData(System.Runtime.Serialization.SerializationInfo, System.Runtime.Serialization.StreamingContext)'. Security accessibility of the overriding method must match the security accessibility of the method being overriden. at System.Reflection.RuntimeAssembly.GetType(RuntimeAssembly assembly, String name, Boolean throwOnError, Boolean ignoreCase, ObjectHandleOnStack type) at System.Reflection.RuntimeAssembly.GetType(String name, Boolean throwOnError, Boolean ignoreCase) at System.Web.UI.Util.GetTypeFromAssemblies(IEnumerable assemblies, String typeName, Boolean ignoreCase) at System.Web.UI.TemplateParser.GetType(String typeName, Boolean ignoreCase, Boolean throwOnError) at System.Web.UI.TemplateParser.ProcessInheritsAttribute(String baseTypeName, String codeFileBaseTypeName, String src, Assembly assembly) at System.Web.UI.TemplateParser.PostProcessMainDirectiveAttributes(IDictionary parseData) --- End of inner exception stack trace --- at System.Web.UI.TemplateParser.ProcessException(Exception ex) at System.Web.UI.TemplateParser.ParseStringInternal(String text, Encoding fileEncoding) at System.Web.UI.TemplateParser.ParseString(String text, VirtualPath virtualPath, Encoding fileEncoding) --- End of inner exception stack trace --- at System.Web.UI.TemplateParser.ParseString(String text, VirtualPath virtualPath, Encoding fileEncoding) at System.Web.UI.TemplateParser.ParseFile(String physicalPath, VirtualPath virtualPath) at System.Web.UI.TemplateParser.Parse() at System.Web.Compilation.BaseTemplateBuildProvider.get_CodeCompilerType() at System.Web.Compilation.BuildProvider.GetCompilerTypeFromBuildProvider(BuildProvider buildProvider) at System.Web.Compilation.BuildProvidersCompiler.ProcessBuildProviders() at System.Web.Compilation.BuildProvidersCompiler.PerformBuild() at System.Web.Compilation.BuildManager.CompileWebFile(VirtualPath virtualPath) at System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate) at System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate) at System.Web.Compilation.BuildManager.GetVPathBuildResultWithAssert(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate) at System.Web.Compilation.BuildManager.GetVPathBuildResult(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean ensureIsUpToDate) at System.Web.UI.TemplateControl.LoadControl(VirtualPath virtualPath) at DotNetNuke.UI.ControlUtilities.LoadControl[T](TemplateControl containerControl, String ControlSrc) in C:\DNN Websites\DNN5 Source\Library\UI\ControlUtilities.vb:line 61 at DotNetNuke.UI.Modules.ModuleHost.LoadModuleControl() in C:\DNN Websites\DNN5 Source\Library\UI\Modules\ModuleHost.vb:line 229 --- End of inner exception stack trace ---
 
This will be fixed shortly in ContentDejour_05.02.00 which will be released as a pre-compiled WAP module (with separate Install and Source packages) rather than its current dynamically compiled WSP design.
Closed Oct 18, 2010 at 7:31 PM by imagemaker
Closed major issues/enhancements fixed in v 05.02.00.

comments