Umbraco 4.9 Could not load type 'System.Runtime.CompilerServices.ExtensionAttribute'
Hi Guys,
I have just upgraded from Umbraco 4.8.1 to 4.9 and everything seems to work, with the exeption of package installation. When trying to install any package I get the YSOD below. This happened for me with two different packages and will probably also be a problem with other packages.
It seems like something is missing. But I have all the 4.9 files, and using WinMerge the only difference in the bin folder is the other package dll's, which I installed when the website where version 4.8.1.
Anyone know of this problem?
My nice YSOD
Server Error in '/' Application.
Could not load type 'System.Runtime.CompilerServices.ExtensionAttribute' from assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.
Description:An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details:System.TypeLoadException: Could not load type 'System.Runtime.CompilerServices.ExtensionAttribute' from assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.
Source Error:
The source code that generated this unhandled exception can only be shown when compiled in debug mode. To enable this, please follow one of the below steps, then request the URL:
1. Add a "Debug=true" directive at the top of the file that generated the error. Example:
<%@ Page Language="C#" Debug="true" %>
or:
2) Add the following section to the configuration file of your application:
Note that this second technique will cause all files within a given application to be compiled in debug mode. The first technique will cause only that particular file to be compiled in debug mode.
Important: Running applications in debug mode does incur a memory/performance overhead. You should make sure that an application has debugging disabled before deploying into production scenario.
I ran into a similar problem yesterday - but not with Umbraco core upgrade, but a 3rd-party package.
Investigating the exception I found the root cause to be that the "ExtensionAttribute" had been moved from "System.Core" (in .NET 4.0) to "mscorlib" (in .NET 4.5) ... what this means is that one of the DLLs in your /bin folder has been compiled against .NET 4.5 instead of .NET 4.0.
I don't think it's Umbraco 4.9, as that works fine on my laptop (which only has .NET 4.0 installed).
Your options are:
Install .NET 4.5 on your machine/web-server.
Find the culprit DLL and ask the developer(s) to recompile it against .NET 4.0.
Also I should clarify, when Lee says compile against 4.0 he does not mean target 4.0 he means compile it on a PC that does not even have 4.5 installed.
Or... fix how they're using ILMerge (there may be other root causes also, but only this one has come to light)
@Murray - for me it was the initial release of the WidgetGrid package - was compiled in .NET 4.5 ... I grabbed the source, recompiled against .NET 4.0 and it worked fine. (Then Matt B accepted a pull request and released an update).
Not sure how to pin-point the culprit DLL ... have you installed any new packages?
Umbraco 4.9 Could not load type 'System.Runtime.CompilerServices.ExtensionAttribute'
Hi Guys,
I have just upgraded from Umbraco 4.8.1 to 4.9 and everything seems to work, with the exeption of package installation. When trying to install any package I get the YSOD below. This happened for me with two different packages and will probably also be a problem with other packages.
It seems like something is missing. But I have all the 4.9 files, and using WinMerge the only difference in the bin folder is the other package dll's, which I installed when the website where version 4.8.1.
Anyone know of this problem?
My nice YSOD
Server Error in '/' Application.
Could not load type 'System.Runtime.CompilerServices.ExtensionAttribute' from assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.Exception Details: System.TypeLoadException: Could not load type 'System.Runtime.CompilerServices.ExtensionAttribute' from assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.
Source Error:
The source code that generated this unhandled exception can only be shown when compiled in debug mode. To enable this, please follow one of the below steps, then request the URL:
1. Add a "Debug=true" directive at the top of the file that generated the error. Example:
<%@ Page Language="C#" Debug="true" %>
or:
2) Add the following section to the configuration file of your application:
<configuration>
<system.web>
<compilation debug="true"/>
</system.web>
</configuration>
Note that this second technique will cause all files within a given application to be compiled in debug mode. The first technique will cause only that particular file to be compiled in debug mode.
Important: Running applications in debug mode does incur a memory/performance overhead. You should make sure that an application has debugging disabled before deploying into production scenario.
Stack Trace:
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.272
Thanks
/Rune
Hi Rune,
I ran into a similar problem yesterday - but not with Umbraco core upgrade, but a 3rd-party package.
Investigating the exception I found the root cause to be that the "ExtensionAttribute" had been moved from "System.Core" (in .NET 4.0) to "mscorlib" (in .NET 4.5) ... what this means is that one of the DLLs in your /bin folder has been compiled against .NET 4.5 instead of .NET 4.0.
I don't think it's Umbraco 4.9, as that works fine on my laptop (which only has .NET 4.0 installed).
Your options are:
Good luck!
Cheers, Lee.
YES. Lee Kelleher FTW.
Thanks. Installing .NET 4.5 was the cure.
/Rune
How do you find the culprit DLL?
Also I should clarify, when Lee says compile against 4.0 he does not mean target 4.0 he means compile it on a PC that does not even have 4.5 installed.
Or... fix how they're using ILMerge (there may be other root causes also, but only this one has come to light)
http://www.mattwrock.com/post/2012/02/29/What-you-should-know-about-running-ILMerge-on-Net-45-Beta-assemblies-targeting-Net-40.aspx
@Murray - for me it was the initial release of the WidgetGrid package - was compiled in .NET 4.5 ... I grabbed the source, recompiled against .NET 4.0 and it worked fine. (Then Matt B accepted a pull request and released an update).
Not sure how to pin-point the culprit DLL ... have you installed any new packages?
Cheers, Lee.
is working on a reply...