Native Plugins Crashing In Unity 2017.1 and 2017.2 - am I the only one seeing this?

Hi everyone,

I am trying to get a native c++ plugin to run under Unity 2017 (Windows 64Bit). It did work under Unity <= 5.6,
but with Unity 2017, a standalone build using the plugin crashes when proceeding past the screen setup
dialog. The plugin works correctly in the Editor, but I get the following error messages, which might give a clue:

Assertion failed: Assertion failed on expression: ‘Thread::CurrentThreadIsMainThread()’
Assertion failed: Assertion failed on expression: ‘Thread::CurrentThreadIsMainThread()’

Same with the 2017.2 RC.

The crash/error occurs even with a plugin stipped of all its functionality. I.e. this also occurs with
a minimal plugin which merely has NOOP entry points for LoadModule / UnloadModule.

Has anyone experienced the same? I have filed a bug report, but I guess I must hit some edge-case / incompatibility or surely someone else would have reported this already?

I have opened an issue here: https://fogbugz.unity3d.com/default.asp?954173_vk8ungbtl3kto79c

thanks,

Manuel

I have to correct myself: in addition to the NOOP entry points, I am calling into the plugin (although it is a NOOP routine as well), so that the DLL import mechanism is triggered. The timing of this call is probably the issue as it is done from the GameObjects constructor, and this is probably not permitted in Unity 2017. I’ll try to postpone pinvoke to some defined point in the GameObject lifecycle and see if that solves the issue.

Yay, it does! Thanks for listening to my monologue :slight_smile:

This is still a bug. Thanks for the bug report!