Hi,
I´m using Ultrawintoolbar now and I always get a Loadlock Exception when I close my Mainform and exit the Application.
LoaderLock was detectedLoaderLock was detected 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.
Sometimes VS shows me a disassembly pointing to Infragistics.Win.UltraWinToolsbars.UltraToolbarsManager.HookProc
00000138 lea esp,[ebp-0Ch]
VS2008/WIN XP /Infragistics2.Win.UltraWinToolbars.v10.2/10.2.20102.1004
What is happening here?
Thanks
This problem was occurring for me recently too. I traced it to the fact that we improperly assigned the UltraToolbarManager's DockWithinContainer property to the window containing the UltraToolbarManager, rather than to a child control (like an UltraPanel) of that window. Once I set the DockWithinContainer properly to a child panel, the LoaderLock detections went away.
It sounds like maybe the UltraToolbarsManager is not getting disposed and so it is being disposed in the finalizer. Can you hook the Disposed event of the UltraToolbarsManager to see if it is getting disposed when the application is closed?
It doesn't look like Disposed is firing before the LoaderLock exception occurs. It isn't firing before or after I set the DockWithinContainer property to something other than the main form holding the UltraToolbarsManager, but somehow the LoaderLock doesn't occur if DockWithinContainer isn't the main form.
FYI, the UltraToolbarsManager is being used in a .Net DLL extension to another program (ArcMap), and is not in a standalone program. Things are fine with the DockWithinContainer being set to the main form in a standalone program, and the Disposed event is firing in that case before the program terminates.
Ok, so it sounds like the issue is caused when the UltraToolbarsManager is cleaned up by the finalizer thread and not by being disposed. This could be a bug, so you can submit it here if you want, but I think this could be easily worked around by simply disposing the UltraToolbarsManager in code. If you know it will be going away, you can just call Dispose on it directly. This normally happens in standalone Forms for you because the Form keeps a components collection which is passed to the UltraToolbarsManager constructor. When the Form disposes, it disposes the components collection, which then tells the UltraToolbarsManager to dispose itself.