Search Issue Tracker

Fixed in 2020.1.X

Fixed in 2019.2.X, 2019.3.X

Votes

0

Found in

2018.4.0f1

2019.2.0a1

2019.3.0a1

2019.3.0a2

2020.1.0a1

Issue ID

1190295

Regression

No

[UWP] Player will not load native plugin with a period in it's name

Steps to reproduce:
1. Download 1190295_repro.zip and open "new" scene
2. Switch platform to UWP
3. Build project for x86
4. Open VS solution and build an app

Results: Error is printed: Plugins: Failed to load 'Test.Plugin' because one or more of its dependencies could not be loaded.

Reproduced with: 2020.1.0a8, 2019.3.0b7, 2019.2.9f1, 2018.4.11f1

IMPORTANT: This issue is specific to the Unity runtime when loading native Plugin modules. However, this problem also occurs in IL2CPP when using the [DllImport] attribute to P/Invoke into native APIs. This is being tracked by a separate case: 1198403.

See Resolution Notes for more details.

  1. Resolution Note (fix version 2020.1):

    This appears to be a Windows API bug in LoadPackagedLibrary.

    When processing plugins, the runtime strips the extension and just uses the base filename when loading the module, e.g. calling LoadLibrary (WindowsStandalone) or LoadPackagedLibrary (UWP). In the case of LoadPackagedLibrary, according to the API documentation this is acceptable as:

    "If this parameter specifies a module name without a path and the file name extension is omitted, the function appends the default library extension .dll to the module name. To prevent the function from appending .dll to the module name, include a trailing point character (.) in the module name string."

    However, when the base filename contains a '.' this apparently doesn't work, resulting in a ERROR_MOD_NOT_FOUND error. Unity will work around this flaw by manually appending the .dll extension to the filename in this case.

    IMPORTANT:

    IL2CPP's implementation of [DllImport] attribute calls into LoadPackageLibrary separately from the Unity runtime, which likewise fails if the module contains a '.' in the name (and the .dll extension is omitted). This bug is being tracked by a different case (1198403). It's possible to work around the IL2CPP bug by simply including the ".dll" extension in the [DllImport] attribute. For example:

    [DllImport("Test.Plugin")]
    static extern void Foo();

    will fail to load the module; "Test.Plugin" cannot be found. However, this will work:

    [DllImport("Test.Plugin.dll")]
    static extern void Foo();

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.