none
HRESULT -2147024770 when importing a simple library on other machines RRS feed

  • Question

  • I wrote a simple DLL plugin for Dynamo [1] on my laptop (Visual Studio 2017, Windows 10), written in C++/CLI with only one class and one method, and tried to distribute it to some colleagues for testing. This was met with mixed results: it imported fine on some machines, but failed on others. After debugging Dynamo on one of the failing machines, I found that this line:

    Assembly.LoadFrom(name);

    threw an exception with HRESULT -2147024770.

    The stack trace can be found below.

    Unfortunately there are not so many discussions about this on the internet. One discussion, although perhaps more specific for Sketchup [2], can be found here [3]. It was suggested that older versions of Windows may need to have Windows 10 Universal C Runtime [4]. However this was weird, because one of the failing machines runs Windows 10, and obviously could not install the above Runtime. I tried to install Windows 10 SDK [5], but afterwards Dynamo failed to run, and there was the following warning upon building Dynamo.

    ALINK : warning AL1073: Referenced assembly 'mscorlib.dll' targets a different processor

    I was trying to avoid the need to install Visual Studio because we want to provide our potential library users with pre-built DLLs, so I will be happy if someone can please help me with this problem. Thank you.

    References:

    [1] http://dynamobim.org/
    [2] https://www.sketchup.com/
    [3] https://forums.sketchup.com/t/install-problem-thumbsup-dll/36736/18
    [4] https://www.microsoft.com/en-us/download/details.aspx?id=48234
    [5] https://developer.microsoft.com/en-us/windows/downloads/windows-10-sdk

    Stack trace:

    Trying to load assembly: C:\Users\<User>\Downloads\<Folder>\TestInstallZeroTouch.dllThe thread 0x6a0 has exited with code 0 (0x0).
    Exception thrown: 'System.IO.FileNotFoundException' in mscorlib.dll
    Could not load file or assembly 'TestInstallZeroTouch.dll' or one of its dependencies. The specified module could not be found.
       at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
       at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
       at System.Reflection.RuntimeAssembly.InternalLoadFrom(String assemblyFile, Evidence securityEvidence, Byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm, Boolean forIntrospection, Boolean suppressSecurityChecks, StackCrawlMark& stackMark)
       at System.Reflection.Assembly.LoadFrom(String assemblyFile)
       at ProtoFFI.FFIExecutionManager.LoadAssembly(String name) in C:\Users\<User>\Downloads\Dynamo-master\src\Engine\ProtoCore\FFI\FFIExecutionManager.cs:line 37
       at ProtoFFI.CSModuleHelper.getModule(String name) in C:\Users\<User>\Downloads\Dynamo-master\src\Engine\ProtoCore\FFI\CLRDLLModule.cs:line 

    Wednesday, August 8, 2018 7:06 AM