Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Join us on March 30, 2023, between 5 am & 1 pm EST, in the Performance Profiling Dev Blitz Day 2023 - Q&A forum and Discord where you can connect with our teams behind the Memory and CPU Profilers.
    Dismiss Notice

Loading a UWP DLL

Discussion in 'VR' started by j2inet, Jun 14, 2016.

  1. j2inet


    Jul 15, 2015
    There's some functionality I needed to invoke in a HoloLens application.

    I've added the DLL to my assets folder and added a reference to the DLL using the Mono editor. When I try to Build the project in Unity I get the following error.

    "Unhandled Exception: System.Reflection.ReflectionTypeLoadException: The classes in the module cannot be loaded"

    Any ideas in how to address this?

    Unhandled Exception: System.Reflection.ReflectionTypeLoadException: The classes in the module cannot be loaded.

    at (wrapper managed-to-native) System.Reflection.Assembly:GetTypes (bool)

    at System.Reflection.Assembly.GetTypes () [0x00000] in <filename unknown>:0

    at Mono.CSharp.RootNamespace.ComputeNamespaces (System.Reflection.Assembly assembly, System.Type extensionType) [0x00000] in <filename unknown>:0

    at Mono.CSharp.RootNamespace.ComputeNamespace (Mono.CSharp.CompilerContext ctx, System.Type extensionType) [0x00000] in <filename unknown>:0

    at Mono.CSharp.GlobalRootNamespace.ComputeNamespaces (Mono.CSharp.CompilerContext ctx) [0x00000] in <filename unknown>:0

    at Mono.CSharp.Driver.LoadReferences () [0x00000] in <filename unknown>:0

    at Mono.CSharp.Driver.Compile () [0x00000] in <filename unknown>:0

    at Mono.CSharp.Driver.Main (System.String[] args) [0x00000] in <filename unknown>:0

    The following assembly referenced from C:\Users\Joel\Documents\Unity\Projects\MqttTest\Assets\M2Mqtt.UWP.dll could not be loaded:
    Assembly: System.Runtime (assemblyref_index=0)
    Public Key: b03f5f7f11d50a3a
    The assembly was not found in the Global Assembly Cache, a path listed in the MONO_PATH environment variable, or in the location of the executing assembly (C:\Users\Joel\Documents\Unity\Projects\MqttTest\Assets\).

    Could not load file or assembly 'System.Runtime, Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies.
    Missing method .ctor in assembly C:\Users\Joel\Documents\Unity\Projects\MqttTest\Assets\M2Mqtt.UWP.dll, type System.Runtime.Versioning.TargetFrameworkAttribute
    Can't find custom attr constructor image: C:\Users\Joel\Documents\Unity\Projects\MqttTest\Assets\M2Mqtt.UWP.dll mtoken: 0x0a00000e
  2. Tautvydas-Zilys


    Unity Technologies

    Jul 25, 2013
    Click on the DLL inside Unity, and mark it as compatible with Windows Store .NET scripting backend only (the editor checkbox should be switched off).
    j2inet likes this.
  3. j2inet


    Jul 15, 2015
    Thanks, that was it!