Justin Rich wrote:
LoaderLock 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.
I have no idea what its talking about.
it seems to be kicking this off when i do my remote registry read.
I don't know what you're using for the remote registry read. If you've
written code yourself that causes managed code to be executed inside the
initialization of a DLL, you may indeed want to heed the warning. There
are ways you can call .NET code that would result in a deadlock.
However, my only actual first-hand experience with this MDA has been
when using Microsoft-provided components that themselves cause the
exception. My assumption (and it is only an assumption :( ) has been
that even though in these cases some managed code is being executed in a
DLL initialization, the authors of that code have avoided (intentionally
or not) calling .NET in a way that would result in deadlock.
You can search this newsgroup (or possibly
microsoft.public.dotnet.framwework...I'm not actually sure which) for
"loaderlock" and find previous messages, including my own, regarding the
topic. The short answer though is that you should try to avoid
executing managed code in a DLL initialization, but if you're not doing
so explicitly yourself you may simply be stuck hoping that the component
you're using and which does do so is doing so safely.
If you can come up with a concise-but-complete example of code that
reproduces the exception, then at least someone might be able to offer
insight as to what component is causing the exception and whether you
can avoid it in any practical way.
Finally, note that the MDA exceptions are part of the debugger. You
should be able to run the application without the debugger without
getting the exceptions. If the MDA is warning of a real problem, that
problem still exists, but otherwise you can safely deploy code that
generates MDA exceptions without worrying about them being set off when
the end user is using the code.
Pete