Strange behaviour Debug/Release

Nov 3, 2010 at 6:22 PM

Hello Marc!

I've noticed one thing; when I compile vstnet-50709 (code and samples) using debug option I got strange hangs with some unmanaged plugins (Classic EQ.dll from kjarhus audio) and Jacobi.Vst.Samples.Host.exe. With Debug, I got the following exception message: Attempting managed execution inside OS Loader lock. Do not attempt to run managed code inside a DllMain or image initialization function since doing so can cause the application to hang...

When compiled with Release option, there is no exception. When switching from Release to Debug or vice versa make shure you cleaned both solutions and also delete all files from SharedAssemblies folder. Any suggestions?

regrads, kasaudio

Nov 4, 2010 at 11:00 AM
Edited Nov 4, 2010 at 11:02 AM

So you're loading an unmanaged plugin into a managed host application an you get a message that you should not attempt to run managed code inside the DllMain function inside the loader lock....?

I have never seen this before. The managed Host application starts as a normal managed application. It side-steps into unmanaged code in order to load the unmanaged plugin using a normal Win32 API method for that: LoadLibrary(A). If I understand it correctly its during that time that the loader lock is obtained and the DllMain is executed on the plugin. I dont see how this scenario could be a problem, but I am not an expert on this.

To get to the bottom of this you will have to debug and perhaps build sample unmanaged plugin dlls in order to be able to pinpoint the problem. You could start by debugging the Jacobi.Vst.Interop.Host.VstUnmanagedPluginContext class where the loading and initialization of the unmanaged plugin takes place. It would really help if you would have an unmanaged plugin with this problem for which you also have the source code...

I hope this helps.

Nov 6, 2010 at 2:26 AM

Do you get this exception when running your application outside visual studio?

Nov 13, 2010 at 10:40 AM


regards, kasaudio

Nov 20, 2010 at 7:24 PM

Maybe it's a typical loader lock exception in Visual Studio like the DirectX documented bugs. You could consider turning off loader lock exception in visual studio and ignore it.