Search Unity

DLL Fallback Handler Failure?

Discussion in 'Editor & General Support' started by Exbleative, Nov 24, 2021.

  1. Exbleative

    Exbleative

    Joined:
    Jan 26, 2014
    Posts:
    216
    Hi,
    We recently launched our game and we've got a sizable number of players who are having problems loading our middleware provider's (trueSky) dlls using your fallback handler. Mostly people with Win 7 but also some with Win8 and Win10.

    The main lines that look suspect/errors are:

    GfxDevice: creating device client; threaded=1; jobified=1
    d3d11: CreateDXGIFactory2(...) not found, fallbacking to CreateDXGIFactory1(...).
    d3d11: QueryInterface(IDXGIFactory5) failed (80004002).

    Fallback handler could not load library C:/Program Files (x86)/Steam/steamapps/common/Exo One/EXO ONE_Data/Mono/TrueSkyPluginRender_MT
    Fallback handler could not load library C:/Program Files (x86)/Steam/steamapps/common/Exo One/EXO ONE_Data/Mono/TrueSkyPluginRender_MT.dll

    DllNotFoundException: TrueSkyPluginRender_MT
    at (wrapper managed-to-native) simul.TrueSkyPluginRenderFunctionImporter.StaticGetOrAddView(intptr)
    at simul.TrueSkyCamera.InternalGetViewId () [0x0000b] in <70a3fc58468f465094658c80a9372033>:0
    at simul.TrueSkyCameraBase.PreRender () [0x00030] in <70a3fc58468f465094658c80a9372033>:0
    at simul.TrueSkyCamera.OnPreRender () [0x00033] in <70a3fc58468f465094658c80a9372033>:0

    We've tried placing the TrueSkyPluginRender_MT.dll in the Mono folder but still no good.

    We feel like perhaps your fallback handler may not be working?

    We're using Unity 2021.1.27f1
    Thanks,
    Jay
     
  2. Exbleative

    Exbleative

    Joined:
    Jan 26, 2014
    Posts:
    216
    Anyone at Unity please help us with this? I've got players unable to run our game.
     
  3. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    It sounds like that DLL depends on some other DLL that isn't present on the target machine. I recommend https://github.com/lucasg/Dependencies/releases to look at DLL dependencies.

    Did you build TrueSkyPluginRender_MT.dll yourself?
     
  4. Exbleative

    Exbleative

    Joined:
    Jan 26, 2014
    Posts:
    216
    We have tried exactly that, we have used dependenciesgui.exe to check what DLLs are dependent and we confirmed that many players can load the dll with dependenciesgui.exe, but not with Unity/our game. So our assumption is the issue must lie within Unity, if it is unable to load only within Unity.

    TrueSkyPluginRender_MT.dll was built by trueSky/Simul and provided to us.
     
  5. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    DependenciesGUI.exe will load the DLL even if dependent DLLs is missing. It's designed for that: to you show you DLL dependencies. It would be no good if it failed to work if dependencies were missing.

    I didn't mean running Dependencies on machines where it doesn't work. I meant inspecting the DLL list that the DLL depends on and making sure that you're shipping with every non-built-in Windows DLL that it depends on. If you post a screenshot of Dependencies with that DLL open, I can help you figure out what you're missing.
     
    Exbleative likes this.
  6. Exbleative

    Exbleative

    Joined:
    Jan 26, 2014
    Posts:
    216
    I'm trying my best to relay information from trueSky to you here so bear with me :)

    We can see that all the dependant dlls are present in dependanciesGUI, here's a screengrab from a player: https://imgur.com/K1TfS2V
     
  7. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    Is this screenshot taken from a machine where it fails to load?

    "vulkan-1.dll" isn't part of default Windows installation, you need to explicitly install Vulkan drivers from the driver vendor to get it so it could be why it fails to load on some machines.
     
  8. JamesSimul

    JamesSimul

    Joined:
    Jul 29, 2019
    Posts:
    5
    Hi, I'm part of the Simul team helping resolve this issue.

    The above screenshot was from a machine where Unity was failing to load the trueskypluginrender_MT.dll, and we have other cases where dependanciesgui.exe show that all dependencies are present, but Unity will still fail to load the dll.

    We are aware that Vulkan could be an issue in some cases and are in the process of changing it to a delayload, however we still have cases of users with the vulkan-1.dll who are getting this issue, for example from the screenshot above.
     
  9. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    That "Fallback handler could not load library" error is a red herring, it tries looking for DLL in several more places if the initial LoadLibraryW call fails.

    The few reasons I can think of for the DLL failing to load are these:

    1. Some dependency is missing (doesn't look like this is the case, though);
    2. A function in some dependency is missing (for instance, a new API was added on Windows 8 to kernel32.dll that is used by this DLL);
    3. Executable/DLL bitness doesn't match (32-bit game/64-bit DLL or vice versa);
    4. The DLL is just not on disk, it's been removed by something.

    However, it doesn't sound like it's any of these. Could you by any chance send me that DLL via a PM? I could try playing with it in some of our test environments that we have.
     
  10. JamesSimul

    JamesSimul

    Joined:
    Jul 29, 2019
    Posts:
    5
    Sent via PM
     
  11. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    Thanks. I can clearly see the issue.

    1. The DLL you sent me also links to d3d12.dll and dxgi.dll. d3d12.dll doesn't exist on Windows 7, and while dxgi.dll does, the function that's used in it (CreateDXGIFactory2) does not. However, in the delayed load DLL version this shouldn't be a problem as both of these are configured to be delay loaded:

    upload_2021-12-2_10-34-26.png

    2. It uses CreateFile2 function from kernel32.dll, which was added in Windows 8. Dependencies lights it up for me on Windows 7:

    upload_2021-12-2_10-35-52.png

    In conclusion:

    1. The people that are running into this on Windows 8/Windows 10 doesn't have Vulkan drivers installed. Getting them the delay loaded DLL will fix it.
    2. The DLL needs to be updated to use CreateFileW instead of CreateFile2 to work on Windows 7.

    Let me know if this helps :).
     
    Exbleative likes this.