TypeLoadException

Post here for help with installing or upgrading mojoPortal pre-compiled release packages. When posting in this forum, please provide all relevant details. You may also want to review the installation or upgrading documentation.

If you have questions about using the source code or working with mojoPortal in Visual Studio, please post in the Developer forum.

Post here for help with installation of mojoPortal pre-compiled release packages

When posting in this forum, please try to provide as many relevant details as possible. Particularly the following:

  • What operating system were you running when the bug appeared?
  • What database platform is your site using?
  • What version of mojoPortal are you running?
  • What version of .NET do you use?
  • What steps are necessary to reproduce the issue? Compare expected results vs actual results.

You may also want to review the installation or upgrading documentation.

If you have questions about using the source code or working with mojoPortal in Visual Studio, please post in the Developer forum.

This thread is closed to new posts. You must sign in to post in the forums.
8/29/2014 11:53:06 AM
Gravatar
Total Posts 118

Could not load type 'System.Runtime.CompilerServices.ExtensionAttribute' from assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.

Really need help here. I think I must have changed something in a layout.master file or web.config, but am seeing the following error when i load my site. .net v4.0 running the latest version of MojoPortal with SQL.


[TypeLoadException: Could not load type 'System.Runtime.CompilerServices.ExtensionAttribute' from assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.] System.ModuleHandle.ResolveType(RuntimeModule module, Int32 typeToken, IntPtr* typeInstArgs, Int32 typeInstCount, IntPtr* methodInstArgs, Int32 methodInstCount, ObjectHandleOnStack type) +0 System.ModuleHandle.ResolveTypeHandleInternal(RuntimeModule module, Int32 typeToken, RuntimeTypeHandle[] typeInstantiationContext, RuntimeTypeHandle[] methodInstantiationContext) +525 System.ModuleHandle.ResolveTypeHandle(Int32 typeToken, RuntimeTypeHandle[] typeInstantiationContext, RuntimeTypeHandle[] methodInstantiationContext) +19 System.Reflection.RuntimeModule.ResolveType(Int32 metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments) +315 System.Reflection.CustomAttribute.FilterCustomAttributeRecord(CustomAttributeRecord caRecord, MetadataImport scope, Assembly& lastAptcaOkAssembly, RuntimeModule decoratedModule, MetadataToken decoratedToken, RuntimeType attributeFilterType, Boolean mustBeInheritable, Object[] attributes, IList derivedAttributes, RuntimeType& attributeType, IRuntimeMethodInfo& ctor, Boolean& ctorHasParameters, Boolean& isVarArg) +208 System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeModule decoratedModule, Int32 decoratedMetadataToken, Int32 pcaCount, RuntimeType attributeFilterType, Boolean mustBeInheritable, IList derivedAttributes, Boolean isDecoratedTargetSecurityTransparent) +1171 System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeAssembly assembly, RuntimeType caType) +146 System.Web.UI.AssemblyCache.GetAjaxFrameworkAssemblyAttribute(Assembly assembly) +103 System.Web.UI.ScriptManager.get_DefaultAjaxFrameworkAssembly() +592 System.Web.UI.ScriptManager..ctor() +30 ASP.data_sites_1_skins_wcare1_layout_master.__BuildControlScriptManager1() +32 ASP.data_sites_1_skins_wcare1_layout_master.__BuildControlfrmMain() +627 ASP.data_sites_1_skins_wcare1_layout_master.__BuildControlBody() +545 ASP.data_sites_1_skins_wcare1_layout_master.__BuildControlTree(data_sites_1_skins_wcare1_layout_master __ctrl) +266 System.Web.UI.MasterPage.CreateMaster(TemplateControl owner, HttpContext context, VirtualPath masterPageFile, IDictionary contentTemplateCollection) +1349 System.Web.UI.Page.get_Master() +73 mojoPortal.Web.mojoBasePage.SetupMasterPage() +421 mojoPortal.Web.mojoBasePage.OnPreInit(EventArgs e) +633 mojoPortal.Web.UI.CmsPage.OnPreInit(EventArgs e) +23 System.Web.UI.Page.PerformPreInit() +49 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1716
 

8/29/2014 12:06:46 PM
Gravatar
Total Posts 18439

Re: TypeLoadException

that is a strange error to suddenly happen.

I would change the skin in the mp_Sites table in the database then touch web.config to clear the site settings cache and first get the site recovered, then try to figure out what changed in layout.master in your custom skin and change it back.

8/29/2014 12:18:11 PM
Gravatar
Total Posts 118

Re: TypeLoadException

Cheers Joe, changed the skin and will work on what's gone wrong with the other. 

8/29/2014 12:30:56 PM
Gravatar
Total Posts 18439

Re: TypeLoadException

is there any custom .NET code installed, ie 3rd party or your own custom features?

its weird the way a skin change can cause this kind of error unless it includes 3rd party controls

from more googling about the error I found among other things this post, which sounds like there can be problems if the build machine ie my local dev machine is trying to target the .NET 4 framework but it has .NET 4.5 installed, theoretically, it should not be a problem but in practice it apparently can be a problem, because it sounds like even though VS asked for .NET 4 for compiling it got 4.5. so possibly the dlls I compiled for .NET 4 for mojoportal are not really compatible with .NET 4 or else some other dll from a 3rd party or custom code might not be.

I don't have any machines that have not been updated to 4.5 and I don't know for sure if my dev machine is affected in a way that things I compile for .NET 4 in VS are actually targeting 4.5. I know that I have had 4.5 on this machine ever since it came out 2 years ago and we have had multiple releases that only targeted .NET 4 in that time and only the most recent version of mojoPortal after 2 years of waiting we finally changed our main target to 4.5 but we still kept alternate versions of the .csproj files to target .NET 4 so that we could continue providing dlls for .NET 4. So I certainly would have expected to know long before now if my machine was not compiling correctly when the build was targeting .NET 4. So, I m not saying for sure there is something wrong with our .NET 4 dlls but these are weird errors you are having that point to errors that look like framework mismatch errors.

in any case the best way forward in my opinion is to change to 4.5 hosting, any host has this on newer machines and your current host can probably move your site to a newer machine and you will have much less headaches I think.

 

9/1/2014 4:38:46 AM
Gravatar
Total Posts 118

Re: TypeLoadException

Hi Joe, 

thank's for your help on this. I don't have any 3rd party controls, other than I'm using the Superfish menu and have jquery locally rather than using a link, I currently run a multi-site installation with 8 sites.

Here's my version of events if it helps. 

  • Downloaded Form Wizard Pro, got errors as was running version 2.4.0.0 MSSQL
  • Upgraded from version 2.4.0.0 MSSQL to 2.4.0.4 MSSQL
  • Applied the .net 4.0 substantive files
  • Made my changes to web.config file
  • Currently get an AJAX error when I open a page with the form wizard pro module on
  • Had various layout.master / style.css / web.config files open, closed them all and got the error in this thread

As it stands I can't access any page with the form wizard module on it and also can't add the module to any page. My host is upgrading to .net 4.5.2 on Wednesday. Hopefully this will sort me out, do I need to just replace the substantive .net 4.0 dlls & web.config with the latest distribution?

9/1/2014 6:58:28 AM
Gravatar
Total Posts 18439

Re: TypeLoadException

yes, after your hosts upgrades your hosting to .NET 4.5 it would be best to use the dlls and web.config form the 4.5 package of mojoportal.

9/10/2014 2:47:15 AM
Gravatar
Total Posts 118

Re: TypeLoadException

Hello, just to update this thread. Upgrading to .net 4.5 and all working. 

You must sign in to post in the forums. This thread is closed to new posts.