Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / March 2006

Tip: Looking for answers? Try searching our database.

VS 2005 LoaderLock problem

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Glass Half Full - 07 Dec 2005 19:17 GMT
I'm using VS 2005 (v8.0.50727.42 (RTM.050727-4200) with the v2.0.50727
framework.

I have a problem.  I can instantiate a COM object, but the first time I try
to use the object I get the following exeception:

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.

If I disable this exeception the application does indeed hang.  However, if
I run this application outside the debugger it runs fine.  If I recompile on
a different machine, I can run it in the debugger.

What exactly is this error message suppose to be telling me?  I'm not
running managed code inside DllMain or a image initialization function.

Is there any hope this can be fixed, or do I need to go back to vs2003 where
the debugger worked?

Thanks
"Peter Huang" [MSFT] - 08 Dec 2005 05:26 GMT
Hi

It seems to be the new feature in Whidbey which is called Managed Debugging
Assistants.
http://msdn2.microsoft.com/en-us/library/d21c150d.aspx

If you did not want that you may try to follow the steps above in disable
the feature.

Best regards,

Peter Huang
Microsoft Online Partner Support

Signature

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

Glass Half Full - 08 Dec 2005 14:26 GMT
I've put about 20 hours into just this problem and I'm becoming quite
frustrated.

From the link you provided I took this file content:
---
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework]
"MDA"="0"
---
Placed it in a file and ran that file.  Using regedit I see "MDA REG_SZ 0"
in the appropriate location.

I bring up visual studio, compile, entry debug, get the same MDA error on
the same line as before.
No difference, no effect.  As I said in my first note I can disable the
LoaderLock exception from the Debug/Exceptions/Managed Debugging Assistants
option, but that just causes the app to hang in the debugger.  Application
runs fine outside of the debugger.  Application runs in debug when compiled
and run on a different machine.  Last night I COMPLETELY removed VS2005 and
.NET 2.0 (and other 2005 components), then reinstalled.  Absolutely, no
change in behavior.

Following the MDA exception I get the following message:
"No symbols are loaded for any call stack frame.  The source code cannot be
displayed."

Basically, I'm getting an exception that is impossible to turn off but that
comes for nowhere.

Other "odd" (likely unrelated) problems with my version of VS2005

1) Tools/Options/Text Editor/C#/Formatting generates a panel with the
message "An error occurred loading this property page".

2) When I recompile I see the following warning:
Warning 1 'System.Configuration.ConfigurationSettings.AppSettings' is
obsolete: 'This method is obsolete, it has been replaced by
System.Configuration!System.Configuration.ConfigurationManager.AppSettings'
...

** There is only one problem with this ... THERE IS NO
System.Configuration.ConfigurationManager

The machine is a Dell that ran VS2003 fine.  VS versions 6, 7 (vs2003), and
8(vs2005) are all installed on this machine.

Help!

> Hi
>
[quoted text clipped - 14 lines]
> This posting is provided "AS IS" with no warranties, and confers no
> rights.
Kevin Spencer - 08 Dec 2005 17:05 GMT
> ** There is only one problem with this ... THERE IS NO
> System.Configuration.ConfigurationManager

You must not have the assembly that has this referenced. That is the
System.Configuration assembly.

Signature

HTH,

Kevin Spencer
Microsoft MVP
.Net Developer
You can lead a fish to a bicycle,
but you can't make it stink.

> I've put about 20 hours into just this problem and I'm becoming quite
> frustrated.
[quoted text clipped - 62 lines]
>> This posting is provided "AS IS" with no warranties, and confers no
>> rights.
Glass Half Full - 08 Dec 2005 19:34 GMT
Thanks, that does indeed fix that warning.   I feel a bit foolish I missed
that one.

>> ** There is only one problem with this ... THERE IS NO
>> System.Configuration.ConfigurationManager
[quoted text clipped - 69 lines]
>>> This posting is provided "AS IS" with no warranties, and confers no
>>> rights.
Kevin Spencer - 08 Dec 2005 20:47 GMT
It's a change from the 1.1 version. Don't feel bad.

Signature

HTH,

Kevin Spencer
Microsoft MVP
.Net Developer
You can lead a fish to a bicycle,
but you can't make it stink.

> Thanks, that does indeed fix that warning.   I feel a bit foolish I missed
> that one.
[quoted text clipped - 72 lines]
>>>> This posting is provided "AS IS" with no warranties, and confers no
>>>> rights.
lotuspro - 30 Jan 2006 17:06 GMT
I was wondering... did you ever find a solution to your problem noted in
point 1: "An error occurred loading this property page". I seem to be
experiencing the same thing. I've fully uninstalled and reinstalled VS and
the problem remains.

> I've put about 20 hours into just this problem and I'm becoming quite
> frustrated.
[quoted text clipped - 62 lines]
> > This posting is provided "AS IS" with no warranties, and confers no
> > rights.
Kevin Spencer - 30 Jan 2006 18:50 GMT
Without a lot of explaning (I did this some time ago, and the references I
found are lost to me), the easiest solution to this issue is:

Use the "Debug" menu, and go to "Exceptions..."

Expand the "Managed Debugging Assistants" and uncheck the "Thrown" and
possibly "User-unhandled" boxes (if using the "Just My Code" option).

All I can remember about it right now is that there is an issue with the
Managed Debugging Assistant for "Loader Lock". I have never had any problems
as a result of turning this off.

Signature

HTH,

Kevin Spencer
Microsoft MVP
.Net Developer
Who is Mighty Abbott?
A twin turret scalawag.

>I was wondering... did you ever find a solution to your problem noted in
> point 1: "An error occurred loading this property page". I seem to be
[quoted text clipped - 76 lines]
>> > This posting is provided "AS IS" with no warranties, and confers no
>> > rights.
Glass Half Full - 08 Dec 2005 21:49 GMT
One more data point on the debug problem.

It was determined that if (in Project/Properties/Debug) "Enable unmanaged
code debugging" is set (box checked), the MDA problem goes away.  At this
point I have no idea why this would effect the problem, but it does.

> Hi
>
[quoted text clipped - 14 lines]
> This posting is provided "AS IS" with no warranties, and confers no
> rights.
"Peter Huang" [MSFT] - 09 Dec 2005 04:55 GMT
Hi

Thanks for your update, I think all the community will benefit from your
experience.

Best regards,

Peter Huang
Microsoft Online Partner Support

Signature

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

Rick Kamp - 27 Jan 2006 22:37 GMT
Thanks so much!   I only spent 10 hours on trying to resolve this
problem.  

I'm definitely going to mark this web site as one of my favorites.

Rick
Dan - 31 Mar 2006 14:19 GMT
Hi,
I'm using Microsoft Sql Management Objects (SMO) -  the sql 2005 version of
SQL_DMO) to obtain information about a table's schema.

I have this code:
List<SMOColumn> GetTableSchema( string tableName, bool onlyPKs )
{
    Database db = sqlSrv.Databases[ dbName ];
...
}

When I execute the code from VS 2005, at this line, I get this exception:
"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."
and the application hangs.

However, when I run the unit tests (with Nunit) that go into the same code,
the damn thing works flawlessly.

Why this exception appears and how can I get rid of it?

Many thanks,
Dan

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.