Print Page | Close Window

PostSharp AssemblyLoadException

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce 2010
Forum Discription: For .NET 4.0
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=3081
Printed Date: 13-May-2026 at 6:18pm


Topic: PostSharp AssemblyLoadException
Posted By: gregweb
Subject: PostSharp AssemblyLoadException
Date Posted: 03-Nov-2011 at 1:15pm
I installed the Code first bits from DevForce as well as PostSharp and ran the WalkThrough code and all worked fine.

Then I upgraded a project using Code Second. The upgrade went fine, but there is still one build error left:

This is the error message:

Error     76     Unhandled exception (2.1.5.1, 32 bit, CLR 4.0, Release): PostSharp.Sdk.CodeModel.AssemblyLoadException: Cannot load assembly mscorlib_15. [Public key mismatch]
============ PostSharp Assembly Loading Log ===================
LOG: Finding the assembly with binding identity 'mscorlib, version=2.0.5.0, culture=neutral, publickeytoken=7cec85d7bea7798e, processorarchitecture=msil'.
LOG: Looking in GAC for mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, processorArchitecture=x86.
LOG: Looking in GAC for mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, processorArchitecture=msil.
LOG: Looking in GAC for mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e.
LOG: Probing location 'C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\mscorlib.dll' because this file was explicitly added to the search path.
LOG: File 'C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\mscorlib.dll' has identity 'mscorlib, version=4.0.0.0, culture=neutral, publickeytoken=b77a5c561934e089, processorarchitecture=msil'.
LOG: File 'C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\mscorlib.dll' does not match the reference.
LOG: Probing location 'C:\Program Files (x86)\PostSharp 2.1\Release\mscorlib.exe' because this directory is in the search path.
LOG: The file 'C:\Program Files (x86)\PostSharp 2.1\Release\mscorlib.exe' could not be found.
LOG: Probing location 'C:\Program Files (x86)\PostSharp 2.1\Release\mscorlib.dll' because this directory is in the search path.
LOG: The file 'C:\Program Files (x86)\PostSharp 2.1\Release\mscorlib.dll' could not be found.
LOG: Probing location 'D:\Clients\Jet\Jet\Jet.Web\mscorlib.exe' because this directory is in the search path.
LOG: The file 'D:\Clients\Jet\Jet\Jet.Web\mscorlib.exe' could not be found.
LOG: Probing location 'D:\Clients\Jet\Jet\Jet.Web\mscorlib.dll' because this directory is in the search path.
LOG: The file 'D:\Clients\Jet\Jet\Jet.Web\mscorlib.dll' could not be found.
LOG: Probing location 'C:\Program Files (x86)\PostSharp 2.1\PlugIns\mscorlib.exe' because this directory is in the search path.
LOG: The file 'C:\Program Files (x86)\PostSharp 2.1\PlugIns\mscorlib.exe' could not be found.
LOG: Probing location 'C:\Program Files (x86)\PostSharp 2.1\PlugIns\mscorlib.dll' because this directory is in the search path.
LOG: The file 'C:\Program Files (x86)\PostSharp 2.1\PlugIns\mscorlib.dll' could not be found.
LOG: Probing location 'D:\Clients\Jet\Jet\Jet.Web\bin\mscorlib.exe' because this directory is in the search path.
LOG: The file 'D:\Clients\Jet\Jet\Jet.Web\bin\mscorlib.exe' could not be found.
LOG: Probing location 'D:\Clients\Jet\Jet\Jet.Web\bin\mscorlib.dll' because this directory is in the search path.
LOG: The file 'D:\Clients\Jet\Jet\Jet.Web\bin\mscorlib.dll' could not be found.
LOG: Probing location 'D:\Clients\Jet\Jet\Jet.Web\obj\Release\mscorlib.exe' because this directory is in the search path.
LOG: The file 'D:\Clients\Jet\Jet\Jet.Web\obj\Release\mscorlib.exe' could not be found.
LOG: Probing location 'D:\Clients\Jet\Jet\Jet.Web\obj\Release\mscorlib.dll' because this directory is in the search path.
LOG: The file 'D:\Clients\Jet\Jet\Jet.Web\obj\Release\mscorlib.dll' could not be found.
LOG: Probing location 'C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\mscorlib.exe' because this directory is in the search path.
LOG: The file 'C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\mscorlib.exe' could not be found.
LOG: Probing location 'C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\mscorlib.dll' because this directory is in the search path.
LOG: File 'C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\mscorlib.dll' has identity 'mscorlib, version=4.0.0.0, culture=neutral, publickeytoken=b77a5c561934e089, processorarchitecture=msil'.
LOG: File 'C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\mscorlib.dll' does not match the reference.
LOG: Probing location 'D:\Clients\Jet\Jet\Jet.Web\obj\Release\Before-PostSharp\mscorlib.exe' because this directory is in the search path.
LOG: The file 'D:\Clients\Jet\Jet\Jet.Web\obj\Release\Before-PostSharp\mscorlib.exe' could not be found.
LOG: Probing location 'D:\Clients\Jet\Jet\Jet.Web\obj\Release\Before-PostSharp\mscorlib.dll' because this directory is in the search path.
LOG: The file 'D:\Clients\Jet\Jet\Jet.Web\obj\Release\Before-PostSharp\mscorlib.dll' could not be found.
LOG: The assembly 'mscorlib_15' was not found.
LOG:      Loading assembly {mscorlib_15}.
LOG:      NativeDotNetPlatform.LoadAssemblyFromName: mscorlib_15.
LOG:      Assembly 'mscorlib_15' is not yet loaded in the AppDomain.
LOG:      Finding the assembly with binding identity 'mscorlib, version=2.0.5.0, culture=neutral, publickeytoken=7cec85d7bea7798e, processorarchitecture=msil'.
LOG:      Looking in GAC for mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, processorArchitecture=x86.
LOG:      Looking in GAC for mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, processorArchitecture=msil.
LOG:      Looking in GAC for mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e.
LOG:      Probing location 'C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\mscorlib.dll' because this file was explicitly added to the search path.
LOG:      File 'C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\mscorlib.dll' has identity 'mscorlib, version=4.0.0.0, culture=neutral, publickeytoken=b77a5c561934e089, processorarchitecture=msil'.
LOG:      File 'C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\mscorlib.dll' does not match the reference.
LOG:      Probing location 'C:\Program Files (x86)\PostSharp 2.1\Release\mscorlib.exe' because this directory is in the search path.
LOG:      The file 'C:\Program Files (x86)\PostSharp 2.1\Release\mscorlib.exe' could not be found.
LOG:      Probing location 'C:\Program Files (x86)\PostSharp 2.1\Release\mscorlib.dll' because this directory is in the search path.
LOG:      The file 'C:\Program Files (x86)\PostSharp 2.1\Release\mscorlib.dll' could not be found.
LOG:      Probing location 'D:\Clients\Jet\Jet\Jet.Web\mscorlib.exe' because this directory is in the search path.
LOG:      The file 'D:\Clients\Jet\Jet\Jet.Web\mscorlib.exe' could not be found.
LOG:      Probing location 'D:\Clients\Jet\Jet\Jet.Web\mscorlib.dll' because this directory is in the search path.
LOG:      The file 'D:\Clients\Jet\Jet\Jet.Web\mscorlib.dll' could not be found.
LOG:      Probing location 'C:\Program Files (x86)\PostSharp 2.1\PlugIns\mscorlib.exe' because this directory is in the search path.
LOG:      The file 'C:\Program Files (x86)\PostSharp 2.1\PlugIns\mscorlib.exe' could not be found.
LOG:      Probing location 'C:\Program Files (x86)\PostSharp 2.1\PlugIns\mscorlib.dll' because this directory is in the search path.
LOG:      The file 'C:\Program Files (x86)\PostSharp 2.1\PlugIns\mscorlib.dll' could not be found.
LOG:      Probing location 'D:\Clients\Jet\Jet\Jet.Web\bin\mscorlib.exe' because this directory is in the search path.
LOG:      The file 'D:\Clients\Jet\Jet\Jet.Web\bin\mscorlib.exe' could not be found.
LOG:      Probing location 'D:\Clients\Jet\Jet\Jet.Web\bin\mscorlib.dll' because this directory is in the search path.
LOG:      The file 'D:\Clients\Jet\Jet\Jet.Web\bin\mscorlib.dll' could not be found.
LOG:      Probing location 'D:\Clients\Jet\Jet\Jet.Web\obj\Release\mscorlib.exe' because this directory is in the search path.
LOG:      The file 'D:\Clients\Jet\Jet\Jet.Web\obj\Release\mscorlib.exe' could not be found.
LOG:      Probing location 'D:\Clients\Jet\Jet\Jet.Web\obj\Release\mscorlib.dll' because this directory is in the search path.
LOG:      The file 'D:\Clients\Jet\Jet\Jet.Web\obj\Release\mscorlib.dll' could not be found.
LOG:      Probing location 'C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\mscorlib.exe' because this directory is in the search path.
LOG:      The file 'C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\mscorlib.exe' could not be found.
LOG:      Probing location 'C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\mscorlib.dll' because this directory is in the search path.
LOG:      File 'C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\mscorlib.dll' has identity 'mscorlib, version=4.0.0.0, culture=neutral, publickeytoken=b77a5c561934e089, processorarchitecture=msil'.
LOG:      File 'C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\mscorlib.dll' does not match the reference.
LOG:      Probing location 'D:\Clients\Jet\Jet\Jet.Web\obj\Release\Before-PostSharp\mscorlib.exe' because this directory is in the search path.
LOG:      The file 'D:\Clients\Jet\Jet\Jet.Web\obj\Release\Before-PostSharp\mscorlib.exe' could not be found.
LOG:      Probing location 'D:\Clients\Jet\Jet\Jet.Web\obj\Release\Before-PostSharp\mscorlib.dll' because this directory is in the search path.
LOG:      The file 'D:\Clients\Jet\Jet\Jet.Web\obj\Release\Before-PostSharp\mscorlib.dll' could not be found.
LOG:      The assembly 'mscorlib_15' was not found.
LOG: Cannot load the system assembly. Attempting a metadata-only load.
===============================================================
   at PostSharp.Sdk.CodeModel.Domain.GetAssembly(IAssemblyName assemblyName, BindingOptions bindingOptions)
   at PostSharp.Sdk.CodeModel.AssemblyRefDeclaration.GetAssemblyEnvelope()
   at PostSharp.Sdk.CodeModel.TypeRefDeclaration.GetTypeDefinition(BindingOptions bindingOptions)
   at PostSharp.Sdk.CodeModel.TypeRefDeclaration.GetTypeDefinition()
   at ^I3av2ouCqwmI.^4+F3cylo(INamedType _0, INamedType _1, BindingOptions _2)
   at PostSharp.Sdk.CodeModel.TypeRefDeclaration.^A9yFoe2uB3TC(ITypeSignature _0, BindingOptions _1)
   at ^I3av2ouCqwmI.^4+F3cylo(IMethodSignature _0, IMethodSignature _1, BindingOptions _2)
   at PostSharp.Sdk.CodeModel.Binding.MethodSignatureComparer.Equals(IMethodSignature x, IMethodSignature y)
   at System.Collections.Generic.Dictionary`2.FindEntry(TKey key)
   at System.Collections.Generic.Dictionary`2.TryGetValue(TKey key, TValue& value)
   at PostSharp.Sdk.Binary.ModuleWriter.GetMethodSignatureBlobIndex(IMethodSignature _0)
   at PostSharp.Sdk.Binary.ModuleWriter.GetMemberSignatureIndex(MemberRefDeclaration _0)
   at PostSharp.Sdk.Binary.ModuleWriter.WriteMemberRef(MemberRefDeclaration _0, MetadataToken _1)
   at PostSharp.Sdk.Binary.ModuleWriter.GetMappedDeclarationToken(MetadataDeclaration _0)
   at PostSharp.Sdk.Binary.ModuleWriter.SetMappedMetadataToken(MetadataDeclaration _0, UInt32* _1)
   at ^R00FfLNj7vE0.^rk33N/hO(OpCodeNumber _0, MetadataDeclaration _1)
   at ^R00FfLNj7vE0.EmitInstructionMethod(OpCodeNumber _0, IMethod _1)
   at PostSharp.Sdk.CodeModel.Instruction.Write(BaseInstructionWriter writer)
   at ^zpGNRK5nUM9z.^x98p/iJs13L+(InstructionReader _0)
   at PostSharp.Sdk.CodeModel.MethodBodyDeclaration.^uPrQJ6gs(InstructionBlock _0, IMethodBodyVisitor[] _1, InstructionAction _2, InstructionReader _3, InstructionBlockExceptionHandlingKind _4)
   at PostSharp.Sdk.CodeModel.MethodBodyDeclaration.^uPrQJ6gs(InstructionBlock _0, IMethodBodyVisitor[] _1, InstructionAction _2, InstructionReader _3, InstructionBlockExceptionHandlingKind _4)
   at PostSharp.Sdk.CodeModel.MethodBodyDeclaration.^uPrQJ6gs(InstructionBlock _0, IMethodBodyVisitor[] _1, InstructionAction _2, InstructionReader _3, InstructionBlockExceptionHandlingKind _4)
   at PostSharp.Sdk.CodeModel.MethodBodyDeclaration.^uPrQJ6gs(InstructionBlock _0, IMethodBodyVisitor[] _1, InstructionAction _2, InstructionReader _3, InstructionBlockExceptionHandlingKind _4)
   at PostSharp.Sdk.CodeModel.MethodBodyDeclaration.^uPrQJ6gs(InstructionBlock _0, IMethodBodyVisitor[] _1, InstructionAction _2, InstructionReader _3, InstructionBlockExceptionHandlingKind _4)
   at ^zpGNRK5nUM9z.^e2BtLyuT(^Kh85h0nXrulm& _0, Int32& _1)
   at ^zpGNRK5nUM9z.^SkiT(^ceSOybcTEumb _0)
   at PostSharp.Sdk.Binary.ModuleWriter.WriteMethodBodies(^ceSOybcTEumb _0, UInt32 _1)
   at ^Up6wxUIUnN6a.^VfvrABjR()
   at ^Up6wxUIUnN6a.^SkiT()
   at ^cyC/TYSlPGB/.^wvPm(^RtksFin57NJ8 _0, ^8gP93Xsl\+Imn _1)
   at PostSharp.Sdk.Extensibility.Tasks.CompileTask.Execute()
   at PostSharp.Sdk.Extensibility.Project.ExecutePhase(String phase)
   at PostSharp.Sdk.Extensibility.Project.Execute()
   at PostSharp.Hosting.PostSharpObject.ExecuteProjects()
   at PostSharp.Hosting.PostSharpObject.InvokeProject(ProjectInvocation projectInvocation)     D:\Clients\Jet\Jet\Jet.Web\POSTSHARP     Jet.Web





Replies:
Posted By: kimj
Date Posted: 03-Nov-2011 at 2:18pm
Hi Greg,
 
We haven't seen this before.  What kind of project is it?  Did you tweak any of the PostSharp property settings?  Which PostSharp assemblies are you referencing?


Posted By: gregweb
Date Posted: 03-Nov-2011 at 2:29pm
It is the Web project of a SL/Web project combo. I did not change any PostSharp settings from the default.

The PostSharp assembly is: C:\Program Files (x86)\PostSharp 2.1\Reference Assemblies\.NET Framework 2.0\PostSharp.dll

The file version is 2.1.5.1.

I also posted this over on the PostSharp site.

Greg   


Posted By: kimj
Date Posted: 03-Nov-2011 at 2:40pm
Thanks for also posting this on the SharpCrafter's forum, since it might be a problem they've seen before.
 
You said you'd built the WPF CodeFirstWalk solution successfully, did you also try the Silverlight "CF Tour"?  http://drc.ideablade.com/xwiki/bin/view/Documentation/code-sample-code-first-tour - http://drc.ideablade.com/xwiki/bin/view/Documentation/code-sample-code-first-tour
 
Do you have any older versions of PostSharp installed too?  How about .NET 4.5? 


Posted By: gregweb
Date Posted: 03-Nov-2011 at 7:17pm
Well, through trial and error, I found a setting on the project PostSharp configuration that resolved this error: There is a Build Host, and setting this to "Managed" was the trick.

I have no data as to the consequences of this, but for now, this seems to work.

Greg



Print Page | Close Window