wixsharp: Confusing error: "API restriction: The assembly '' has already loaded from a different location. It cannot be loaded from a new location within the same appdomain."

After upgrade to 1.14.3, the error occurs. It is unclear whether the problem also occurs with 1.14.2

Logging the calls with first chance exception handler in place returns:

2020-04-28 17:55:53: WIX GUID generation seed 'Component.INSTALLDIR.samples.EmptyDirectory' results in hash by integer -682.106.330 and outcome '545c8cc7-c52b-4aba-9c4f-ebec0f525049'.
2020-04-28 17:55:53: First chance exception handling of type 'NotSupportedException':
2020-04-28 17:55:53: The invoked member is not supported in a dynamic assembly.
2020-04-28 17:55:53: Stack trace:
2020-04-28 17:55:53:    at System.Environment.GetStackTrace(Exception e, Boolean needFileInfo)
   at System.Environment.get_StackTrace()
   at SIDY.RY.X()
   at Invantive.Deploy.Error.CurrentDomain_FirstChanceException(Object sender, FirstChanceExceptionEventArgs e)
   at System.Reflection.Emit.InternalAssemblyBuilder.get_Location()
   at WixSharp.Extensions.GetLocation(Assembly assembly)
   at WixSharp.Utils.<>c__DisplayClass4_0.<OriginalAssemblyFile>b__0(Assembly a)
   at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source, Func`2 predicate)
   at WixSharp.Utils.OriginalAssemblyFile(String file)
   at WixSharp.Compiler.PackageManagedAsm(String asm, String nativeDll, String[] refAssemblies, String outDir, String configFilePath, Nullable`1 platform, Boolean embeddedUI, String batchFile)
   at WixSharp.Compiler.ProcessCustomActions(Project wProject, XElement product)
   at WixSharp.Compiler.GenerateWixProj(Project project)
   at WixSharp.Compiler.BuildWxs(Project project, String path, OutputType type)
   at WixSharp.Project.BuildWxs(OutputType type, String path)
   at (Object , OutputType , String )
   at SIDY.EXR.X(Object , OutputType , String )
   at Invantive.Deploy.ProjectBase.Build()
   at Invantive.Producer.Control.Setup.Program.Main() in C:\Users\gle3.WS212\Documents\ws-20.0\Invantive.Control\src\Invantive.Producer.Control.Setup\Program.cs:line 35
2020-04-28 17:55:54: First chance exception handling of type 'FileLoadException':
2020-04-28 17:55:54: API restriction: The assembly '' has already loaded from a different location. It cannot be loaded from a new location within the same appdomain.
2020-04-28 17:55:54: Stack trace:
2020-04-28 17:55:54:    at System.Environment.GetStackTrace(Exception e, Boolean needFileInfo)
   at System.Environment.get_StackTrace()
   at SIDY.RY.X()
   at Invantive.Deploy.Error.CurrentDomain_FirstChanceException(Object sender, FirstChanceExceptionEventArgs e)
   at System.Reflection.RuntimeAssembly.nLoadImage(Byte[] rawAssembly, Byte[] rawSymbolStore, Evidence evidence, StackCrawlMark& stackMark, Boolean fIntrospection, Boolean fSkipIntegrityCheck, SecurityContextSource securityContextSource)
   at System.Reflection.Assembly.ReflectionOnlyLoad(Byte[] rawAssembly)
   at WixSharp.Utils.OriginalAssemblyFile(String file)
   at WixSharp.Compiler.PackageManagedAsm(String asm, String nativeDll, String[] refAssemblies, String outDir, String configFilePath, Nullable`1 platform, Boolean embeddedUI, String batchFile)
   at WixSharp.Compiler.ProcessCustomActions(Project wProject, XElement product)
   at WixSharp.Compiler.GenerateWixProj(Project project)
   at WixSharp.Compiler.BuildWxs(Project project, String path, OutputType type)
   at WixSharp.Project.BuildWxs(OutputType type, String path)
   at (Object , OutputType , String )
   at SIDY.EXR.X(Object , OutputType , String )
   at Invantive.Deploy.ProjectBase.Build()
   at Invantive.Producer.Control.Setup.Program.Main() in C:\Users\gle3.WS212\Documents\ws-20.0\Invantive.Control\src\Invantive.Producer.Control.Setup\Program.cs:line 35

Striking is that the assembly is ‘’, instead of a name. Also peculiar is the NotSupportedException occuring from OriginalAssemblyFile enumerating FirstOrDefault().

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 16 (9 by maintainers)

Commits related to this issue

Most upvoted comments

All good. We got there eventually 😃

It may help if you just give me some extra details. It is a build error so debugging needs to happen. WXS usually helps with the runtime errors.

Thanks for fixing it. I forgot to provide you with data. My apologies.

Yes, same here 😃

I can confirm that I can build properly with the hotfix. Thanks for the quick response 😃