"Droopy" <dr**************@hotmail.com> wrote in message
news:Xn**********************************@195.129. 110.71...
| "Willy Denoyette [MVP]" <wi*************@telenet.be> wrote in
| news:ON**************@TK2MSFTNGP04.phx.gbl:
|
| >
| > "Droopy" <dr**************@hotmail.com> wrote in message
| > news:Xn**********************************@195.129. 110.72...
| >| "Willy Denoyette [MVP]" <wi*************@telenet.be> wrote in
| >| news:Ok**************@TK2MSFTNGP03.phx.gbl:
| >|
| >| >
| >| > "Droopy" <dr**************@hotmail.com> wrote in message
| >| > news:Xn**********************************@195.129. 110.72...
| >| >| Hi,
| >| >|
| >| >| When I start my application, I notice that it takes 50% CPU in
| >| >| idle status !
| >| >| I used Process Explorer from Sysinternals to find what thread is
| >| >| consuming that much CPU.
| >| >| Only 1 thread is consuming the whole 50% : "mscorwks.dll!
| >| >| CreateApplicationContext".
| >| >|
| >| >| To be complete :
| >| >| . I am using VS2005 (=> dotnet framework 2.0)
| >| >| . my application is calling a dll written in C# dotnet framework
| >| >| 1.1 that is a wrapper for C++ legacy code handling a serial port
| >| >| . my application previous version written in dotnet framework 1.1
| >| >| used the same wrapper code (but not via a dll), cpu was almost 0
| >| >| in this case.
| >| >|
| >| >| Thanks a lot in advance for your help.
| >| >|
| >| >| Droopy.
| >| >
| >| >
| >| > Do you mean that your application keeps consuming 50% of the CPU
| >| > while executing the CreateApplicationContext function?
| >|
| >| Yes !
| >|
| >
| > Well, that would mean that this function never returns, more, it loops
| > endlessly, which IMO is not quite possible. Only possible way to know
| > for sure what's happening is to attach a debugger (native mode).
| >
| > Willy.
| >
| >
| >
|
| Not sure I understand !
| I didn't call this function so how can I check if it returns ?
| By the way, I have the whole source code so I can start the application
| in debug mode in vs2005.
| Should I put a breakpoint somewhere ?
Ok, I suppose that your application doesn't run, right? That means it's
looping indefinitely without ever doing what it is supposed to do. If this
is not the case forget all that follows, and forget about Process explorer,
use a debugger or permon to watch CPU consumption, PE is not the right tool
for this.
Now, CreateApplicationContext is called by Fusion whenever classes are to be
loaded in an AD. So it can happen very early in the process when the CLR
loads system classes into the shared domain, that is before the JIT is
loaded. However I don't believe this is the case here.
The only way to set a breakpoint at mscorwks!CreateApplicationContext, is by
starting the application in an unmanaged debugger like Windbg. All you need
is a correct setup of the debugger environment and the symbol files.
But before you go down that route, run the application in the VS debugger,
if the function doesn't return (which I doubt) the application will loop, so
when you break you are sure you are in the mscorwks!CreateApplicationContext
native code (make sure you have the symbol path set to the symbol server -
http://msdl.microsoft.com/download/symbols ) and you can single step and
watch if it's effectively looping, if it does you will need to be a debugger
expert to be able to draw a conclusion.
Therefore I would suggest you take a close look at your code, compile the
wrapper using VS2005 and try again.
Willy.