By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,584 Members | 1,774 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,584 IT Pros & Developers. It's quick & easy.

OS Loader lock exception

P: n/a
Hi,

I'm trying out the demo version of FastReports. All is running fine in a
small test project. I just copy my code from test project into a large
application to demonstrate tomorrow but have an error in this line:

dataSet = new TfrxUserDataSetClass();

This is the exception error:

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.

It does only happen when running in the IDE (VS2005 pro). The same code
runs in a test project without errors. I have no idea where the
difference is or where to start debugging. I don't use DLL's (here and
there P/Invoke for Win32 of course) and I don't have images. Also the
target application uses Microsoft MapPoint if that could make any
difference.

Can someone give me some hints from where to start locating the source
of the problem ? I have no source code of the product.

--
rgds, Wilfried [MapPoint MVP]
http://www.mestdagh.biz
Nov 12 '06 #1
Share this Question
Share on Google+
6 Replies


P: n/a

"Wilfried Mestdagh" <wi******@mestdagh.bizwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
| Hi,
|
| I'm trying out the demo version of FastReports. All is running fine in a
| small test project. I just copy my code from test project into a large
| application to demonstrate tomorrow but have an error in this line:
|
| dataSet = new TfrxUserDataSetClass();
|
| This is the exception error:
|
| 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.
|
| It does only happen when running in the IDE (VS2005 pro). The same code
| runs in a test project without errors. I have no idea where the
| difference is or where to start debugging. I don't use DLL's (here and
| there P/Invoke for Win32 of course) and I don't have images. Also the
| target application uses Microsoft MapPoint if that could make any
| difference.
|
| Can someone give me some hints from where to start locating the source
| of the problem ? I have no source code of the product.
|
| --
| rgds, Wilfried [MapPoint MVP]
| http://www.mestdagh.biz

You are definitely calling into a mixed mode DLL (MapPoint stuff?), which at
his turn calls into managed code from within the DllMain function.
Check following page for details on how to diagnose and possibly solve the
issue:
http://msdn2.microsoft.com/en-us/lib...66(VS.80).aspx
Willy.

Nov 12 '06 #2

P: n/a
Hi Willy,

I traced down a little bit. It is not MapPoint. It happens when I use
Weifenluo dock panel in same project [
http://sourceforge.net/forum/forum.php?forum_id=402316 ]. The problem is
that if there is a bug in A that shows up in B, then both authors will
probably say there is no bug :( Anyway I try to contact both.

But how can the use of a component give that kind of an error in another
component ?

--
rgds, Wilfried [MapPoint MVP]
http://www.mestdagh.biz
Nov 12 '06 #3

P: n/a

"Wilfried Mestdagh" <wi******@mestdagh.bizwrote in message
news:OO**************@TK2MSFTNGP02.phx.gbl...
| Hi Willy,
|
| I traced down a little bit. It is not MapPoint. It happens when I use
| Weifenluo dock panel in same project [
| http://sourceforge.net/forum/forum.php?forum_id=402316 ]. The problem is
| that if there is a bug in A that shows up in B, then both authors will
| probably say there is no bug :( Anyway I try to contact both.
|
| But how can the use of a component give that kind of an error in another
| component ?
|
| --
| rgds, Wilfried [MapPoint MVP]
| http://www.mestdagh.biz

I can't believe it's DocPanel, IFAIK it's CSharp code only, the OS Loader
issue is a Mixed mode C++ thing, CS assemblies don't have a DllMain function
nor are they loaded by the OS loader.

Willy.
Nov 12 '06 #4

P: n/a
Hi Willy,
>I can't believe it's DocPanel, IFAIK it's CSharp code only, the OS Loader
issue is a Mixed mode C++ thing, CS assemblies don't have a DllMain function
nor are they loaded by the OS loader.
I started a new application, and added the offending code line in the
form's Load event. Project runs normal in IDE. Then I drop a dockpanel
to main form. Now I have the exception. I'm not sure what's next to try :(

--
rgds, Wilfried [MapPoint MVP]
http://www.mestdagh.biz
Nov 13 '06 #5

P: n/a

"Wilfried Mestdagh" <wi******@mestdagh.bizwrote in message
news:eq**************@TK2MSFTNGP02.phx.gbl...
| Hi Willy,
|
| >I can't believe it's DocPanel, IFAIK it's CSharp code only, the OS
Loader
| >issue is a Mixed mode C++ thing, CS assemblies don't have a DllMain
function
| >nor are they loaded by the OS loader.
|
| I started a new application, and added the offending code line in the
| form's Load event. Project runs normal in IDE. Then I drop a dockpanel
| to main form. Now I have the exception. I'm not sure what's next to try :(
|
| --
| rgds, Wilfried [MapPoint MVP]
| http://www.mestdagh.biz

You don't call into MapPoint code do you? Did you try to build the DocPanel
from source using VS2005?
Are you sure you and/or DocPanel doesn't call into managed C++ code?
Once again, the "OS loader lock" exception is thrown when you call into the
CLR from unmanaged code in a DllMain function, and this, only when running
in the debugger, so I would start by investigating investigate the call
stack.
Willy.
Nov 13 '06 #6

P: n/a
Hi Willy,
You don't call into MapPoint code do you?
No I used a brand new project as test with only this single line of code.
Did you try to build the DocPanel from source using VS2005?
Yes I did, but result was same.
Are you sure you and/or DocPanel doesn't call into managed C++ code?
YesI think so. As you already have mentioned docpanel is written in pure
C#. But I'm not sure the problem "is" in dockpanel. I think it is in
FastReport (I think it is written in Delphi.net). The problem is only
there when dockPanel is sitting on a form.

I have solved it temporary by creating the FastRecord component before
creating DockPanel. This seems to be ok now.
Once again, the "OS loader lock" exception is thrown when you call into the
CLR from unmanaged code in a DllMain function, and this, only when running
in the debugger, so I would start by investigating investigate the call
stack.
There is almost nothing in the call stack when I have the error. The
test program is only 1 line of code.

One more question: Can I tell the IDE to ignore this ?

--
rgds, Wilfried [MapPoint MVP]
http://www.mestdagh.biz
Nov 13 '06 #7

This discussion thread is closed

Replies have been disabled for this discussion.