Hello,
I reproduced my problem by these steps (version 4.3.1 build 5680):
- Xtensive.Storage.Samples.Upgrade.Version1 = is signed with "Delay sign only"
- Xtensive.Storage.Samples.Common = is signed without "Delay sign only"
- Build or run
You obtain this exception:
Error 3 PostSharp.Sdk.CodeModel.AssemblyLoadException: Error while loading the assembly "C:\Users\Public\Documents\DataObjects.Net\Samples\Xtensive.Storage.Samples.Upgrade.Version1\obj\Debug\Before-PostSharp\Xtensive.Storage.Samples.Upgrade.Version1.exe": Could not load file or assembly 'Xtensive.Storage.Samples.Upgrade.Version1, Version=1.0.0.0, Culture=neutral, PublicKeyToken=52fa04a277708b7a' or one of its dependencies. Strong name validation failed. (Exception from HRESULT: 0x8013141A)
===== Start of PostSharp Assembly Binder ===========================
LOG: (ClrHost) GetAssemblyName: {C:\Users\Public\Documents\DataObjects.Net\Samples\Xtensive.Storage.Samples.Upgrade.Version1\obj\Debug\Before-PostSharp\Xtensive.Storage.Samples.Upgrade.Version1.exe}
LOG: Loading assembly from file {C:\Users\Public\Documents\DataObjects.Net\Samples\Xtensive.Storage.Samples.Upgrade.Version1\obj\Debug\Before-PostSharp\Xtensive.Storage.Samples.Upgrade.Version1.exe}.
LOG: NativeDotNet20Platform.LoadAssemblyFromFile: C:\Users\Public\Documents\DataObjects.Net\Samples\Xtensive.Storage.Samples.Upgrade.Version1\obj\Debug\Before-PostSharp\Xtensive.Storage.Samples.Upgrade.Version1.exe.
LOG: (ClrHost) GetAssemblyName: {C:\Users\Public\Documents\DataObjects.Net\Samples\Xtensive.Storage.Samples.Upgrade.Version1\obj\Debug\Before-PostSharp\Xtensive.Storage.Samples.Upgrade.Version1.exe}
LOG: Assembly identity returned by the host: xtensive.storage.samples.upgrade.version1, version=1.0.0.0, culture=neutral, publickeytoken=52fa04a277708b7a, processorarchitecture=msil.
LOG: Assembly 'xtensive.storage.samples.upgrade.version1, version=1.0.0.0, culture=neutral, publickeytoken=52fa04a277708b7a, processorarchitecture=msil' is not yet loaded in the AppDomain.
LOG: Invoking Assembly.Load({xtensive.storage.samples.upgrade.version1, version=1.0.0.0, culture=neutral, publickeytoken=52fa04a277708b7a, processorarchitecture=msil})
LOG: (ClrHost) ProvideAssembly: "xtensive.storage.samples.upgrade.version1, version=1.0.0.0, culture=neutral, publickeytoken=52fa04a277708b7a, processorarchitecture=msil".
LOG: Finding the assembly with binding identity 'xtensive.storage.samples.upgrade.version1, version=1.0.0.0, culture=neutral, publickeytoken=52fa04a277708b7a, processorarchitecture=msil'.
LOG: Location found from cache: 'C:\Users\Public\Documents\DataObjects.Net\Samples\Xtensive.Storage.Samples.Upgrade.Version1\obj\Debug\Before-PostSharp\Xtensive.Storage.Samples.Upgrade.Version1.exe'.
LOG: (ClrHost) ProvideAssembly: "xtensive.storage.samples.upgrade.version1, version=1.0.0.0, culture=neutral, publickeytoken=52fa04a277708b7a, processorarchitecture=msil": assembly found in search path.
LOG: (ClrHost) ProvideAssembly: "xtensive.storage.samples.upgrade.version1, version=1.0.0.0, culture=neutral, publickeytoken=52fa04a277708b7a, processorarchitecture=msil": located in "C:\Users\Public\Documents\DataObjects.Net\Samples\Xtensive.Storage.Samples.Upgrade.Version1\obj\Debug\Before-PostSharp\Xtensive.Storage.Samples.Upgrade.Version1.exe".
LOG: (ClrHost) ProvideAssembly: "xtensive.storage.samples.upgrade.version1, version=1.0.0.0, culture=neutral, publickeytoken=52fa04a277708b7a, processorarchitecture=msil": returned successfully.
LOG: AssemblyLoadException: Could not load file or assembly 'Xtensive.Storage.Samples.Upgrade.Version1, Version=1.0.0.0, Culture=neutral, PublicKeyToken=52fa04a277708b7a' or one of its dependencies. Strong name validation failed. (Exception from HRESULT: 0x8013141A)
LOG: Loaded: 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' from 'C:\Windows\Microsoft.NET\Framework64\v4.0.30319\mscorlib.dll'.
LOG: Loaded: 'PostSharp.Hosting, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b13fd38b8f9c99d7' from 'C:\Program Files (x86)\DataObjects.Net\Lib\PostSharp\Release\PostSharp.Hosting.dll'.
LOG: Loaded: 'PostSharp.Sdk, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b13fd38b8f9c99d7' from 'C:\Program Files (x86)\DataObjects.Net\Lib\PostSharp\Release\PostSharp.Sdk.dll'.
LOG: Loaded: 'PostSharp, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b13fd38b8f9c99d7' from 'C:\Program Files (x86)\DataObjects.Net\Lib\PostSharp\Release\PostSharp.dll'.
LOG: Loaded: 'System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' from 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System\v4.0_4.0.0.0__b77a5c561934e089\System.dll'.
LOG: Loaded: 'System.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' from 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Configuration\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Configuration.dll'.
LOG: Loaded: 'System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' from 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Xml\v4.0_4.0.0.0__b77a5c561934e089\System.Xml.dll'.
LOG: Loaded: 'System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' from 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Core\v4.0_4.0.0.0__b77a5c561934e089\System.Core.dll'.
LOG: Loaded: 'PostSharp.Sdk.XmlSerializers, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b13fd38b8f9c99d7' from 'C:\Program Files (x86)\DataObjects.Net\Lib\PostSharp\Release\PostSharp.Sdk.XmlSerializers.dll'.
======Exception Details ============================================
System.IO.FileLoadException: Could not load file or assembly 'Xtensive.Storage.Samples.Upgrade.Version1, Version=1.0.0.0, Culture=neutral, PublicKeyToken=52fa04a277708b7a' or one of its dependencies. Strong name validation failed. (Exception from HRESULT: 0x8013141A)
File name: 'Xtensive.Storage.Samples.Upgrade.Version1, Version=1.0.0.0, Culture=neutral, PublicKeyToken=52fa04a277708b7a' ---> System.Security.SecurityException: Strong name validation failed. (Exception from HRESULT: 0x8013141A)
The Zone of the assembly that failed was:
MyComputer
at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
at System.Reflection.Assembly.Load(String assemblyString)
at PostSharp.Hosting.NativeDotNet40Platform.LoadAssemblyImpl(IAssemblyName assemblyName)
at PostSharp.Hosting.NativeDotNetPlatform.LoadAssemblyImpl(String fileName, IAssemblyName assemblyName)
at PostSharp.Hosting.NativeDotNetPlatform.LoadAssemblyFromFile(String fileName)
at PostSharp.Sdk.CodeModel.AssemblyLoadHelper.LoadAssemblyFromFile(String fileName)
====================================================================
Server stack trace:
at PostSharp.Sdk.CodeModel.AssemblyLoadHelper.^sl7vYpr7(String _0, Exception _1)
at PostSharp.Sdk.CodeModel.AssemblyLoadHelper.LoadAssemblyFromFile(String fileName)
at PostSharp.Sdk.Extensibility.ModuleLoadReflectionFromFileStrategy.LoadAssembly()
at PostSharp.Sdk.Extensibility.ModuleLoadReflectionStrategy.Load(Domain domain)
at PostSharp.Sdk.Extensibility.Project.^LvMUl75+(ModuleLoadStrategy _0)
at PostSharp.Hosting.PostSharpObject.InvokeProject(ProjectInvocation projectInvocation)
at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs)
at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg, Int32 methodPtr, Boolean fExecuteInContext)
Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at PostSharp.Hosting.IPostSharpObject.InvokeProject(ProjectInvocation projectInvocation)
at PostSharp.Hosting.Program.ExecuteImpl() C:\Users\Public\Documents\DataObjects.Net\Samples\Xtensive.Storage.Samples.Upgrade.Version1\POSTSHARP Xtensive.Storage.Samples.Upgrade.Version1
Any suggestions how to fix it?
Have a nice day.
Tomas Bako
Updated at 29.07.2010 6:24:32
Hi.
Analogy of my problem:
In other forum thread i had problem with signing assemblies http://forum.x-tensive.com/viewtopic.php?f=29&t=5991. In this posts you suggested me to sign assemblies with delayed sign only.
I have two developer computers:
- At home : Signing delayed or not is not working. Both types of signing throw exceptions when I try to build the model assembly. Therefore I'm forced to use DO without any signing.
2. At work : Signing without delayed sign works perfectly without problems. When I try delayed signing, exception is thrown from previous posts.
I would like to be able build same project on both computers. In actual situation i must switching between signing according to where I'm actually developing.
It doesn't matter if I'm big company or freelancer developer, I just want to my assemblies be signed.
That's all.
Tomas B.
This thread was imported from our support forum. The original discussion may contain more detailed answer.
Original topic by bakotomas.
Do you get this exception during its processing by PostSharp? If so, this is probably a PostSharp issue. I'll forward this issue to PostSharp team.
Issue report: http://www.sharpcrafters.com/forum/Topic5129-21-1.aspx