Loader Lock issue when runing in Debug Mode

  • Within VS 2005, using the following code

    Code
    pdfOutput.SetLicense("LicenseName", "LicenseCode", 0)pdfOutput.FileName = "c:\test.pdf"pdfOutput.BeginDoc()


    I'm getting a Loader Lock issue when runing in Debug Mode, (Running the compiled Exe's don't have this problem)

    Code
    LoaderLock was detectedMessage: 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.


    The Call Stack is as follows

    Code
    wPDF3.dll!wPDF.wPDFControlWrap.InitializeEngine() + 0x2c bytes	 	wPDF3.dll!wPDF.PDFControl.NeedEngine() + 0x6e bytes	 	wPDF3.dll!wPDF.PDFControl.BeginDoc(string FileName = "c:\\test.pdf", System.IO.Stream OutStream = null) + 0x36 bytes	 	wPDF3.dll!wPDF.PDFControl.BeginDoc() + 0x35 bytes	>	compliance.dll!Compliance.Scanning.SimpleButton3_Click(Object sender = {DevExpress.XtraEditors.SimpleButton}, System.EventArgs e = {System.EventArgs}) Line 133 + 0x15 bytes	Basic 	System.Windows.Forms.dll!System.Windows.Forms.Control.OnClick(System.EventArgs e) + 0x57 bytes	 	DevExpress.XtraEditors.v7.1.dll!DevExpress.XtraEditors.BaseButton.OnClick(System.EventArgs e) + 0x45 bytes	 	DevExpress.XtraEditors.v7.1.dll!DevExpress.XtraEditors.BaseButton.OnMouseUp(System.Windows.Forms.MouseEventArgs e = {X = 61 Y = 15 Button = Left}) + 0x89 bytes	 	System.Windows.Forms.dll!System.Windows.Forms.Control.WmMouseUp(ref System.Windows.Forms.Message m, System.Windows.Forms.MouseButtons button, int clicks) + 0xf2 bytes	 	System.Windows.Forms.dll!System.Windows.Forms.Control.WndProc(ref System.Windows.Forms.Message m) + 0x544 bytes	 	DevExpress.Utils.v7.1.dll!DevExpress.Utils.Controls.ControlBase.WndProc(ref System.Windows.Forms.Message m) + 0x46 bytes	 	System.Windows.Forms.dll!System.Windows.Forms.Control.ControlNativeWindow.OnMessage(ref System.Windows.Forms.Message m) + 0xd bytes	 	System.Windows.Forms.dll!System.Windows.Forms.Control.ControlNativeWindow.WndProc(ref System.Windows.Forms.Message m) + 0xd6 bytes	 	System.Windows.Forms.dll!System.Windows.Forms.NativeWindow.DebuggableCallback(System.IntPtr hWnd, int msg = 514, System.IntPtr wparam, System.IntPtr lparam) + 0x75 bytes	 	[Native to Managed Transition]	 	[Managed to Native Transition]	 	System.Windows.Forms.dll!System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(int dwComponentID, int reason = -1, int pvLoopData = 0) + 0x2ea bytes	 	System.Windows.Forms.dll!System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(int reason = -1, System.Windows.Forms.ApplicationContext context = {Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.WinFormsAppContext}) + 0x17d bytes	 	System.Windows.Forms.dll!System.Windows.Forms.Application.ThreadContext.RunMessageLoop(int reason, System.Windows.Forms.ApplicationContext context) + 0x53 bytes	 	System.Windows.Forms.dll!System.Windows.Forms.Application.Run(System.Windows.Forms.ApplicationContext context) + 0x15 bytes	 	Microsoft.VisualBasic.dll!Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun() + 0xc0 bytes	 	Microsoft.VisualBasic.dll!Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel() + 0xe4 bytes	 	Microsoft.VisualBasic.dll!Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(string[] commandLine) + 0x62 bytes	 	[Native to Managed Transition]	 	[Managed to Native Transition]	 	mscorlib.dll!System.AppDomain.ExecuteAssembly(string assemblyFile, System.Security.Policy.Evidence assemblySecurity, string[] args) + 0x32 bytes	 	Microsoft.VisualStudio.HostingProcess.Utilities.dll!Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() + 0x2b bytes	 	mscorlib.dll!System.Threading.ThreadHelper.ThreadStart_Context(object state) + 0x3b bytes	 	mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state) + 0x81 bytes	 	mscorlib.dll!System.Threading.ThreadHelper.ThreadStart() + 0x40 bytes

    The same applies if i have a WPViewer on the form (below is that call stack)