Message from discussion
VS 2005 LoaderLock problem
Thread-Topic: VS 2005 LoaderLock problem
thread-index: AcZUxa1bu2cH8BudSci9y3vpi9BUaQ==
X-WBNR-Posting-Host: 62.231.113.115
From: =?Utf-8?B?RGFu?= <D...@discussions.microsoft.com>
References: <OcprpL2#FHA.228@TK2MSFTNGP12.phx.gbl>
Subject: RE: VS 2005 LoaderLock problem
Date: Fri, 31 Mar 2006 05:19:02 -0800
Lines: 26
Message-ID: <5AE1920B-91EB-482A-88FB-620B2028427B@microsoft.com>
MIME-Version: 1.0
Content-Type: text/plain;
charset="Utf-8"
Content-Transfer-Encoding: 7bit
X-Newsreader: Microsoft CDO for Windows 2000
Content-Class: urn:content-classes:message
Importance: normal
Priority: normal
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.1830
Newsgroups: microsoft.public.dotnet.framework
NNTP-Posting-Host: TK2MSFTNGXA01.phx.gbl 10.40.2.250
Path: g2news1.google.com!news1.google.com!news3.google.com!newsfeed2.dallas1.level3.net!news.level3.com!newsfeed.gamma.ru!Gamma.RU!newsfeed.cw.net!cw.net!news-FFM2.ecrc.de!TK2MSFTFEEDS01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGXA01.phx.gbl
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