mscorwks.dll!CreateApplicationContext issue in C#

Red Squirrel

No Lifer
May 24, 2003
70,157
13,566
126
www.anyf.ca
I have an app that I code on my xp box, then test further on a win2k3 VM on another server. In XP it runs fine, on win2k3, there is a thread called mscorwks.dll!CreateApplicationContext that HOGS the cpu like mad. Usually about 70% or so. The whole app just grinds to a halt.

It's running .net 2.0 and has a dependancy (mysql connector) which I think may be possibly part of the issue.

Anyone ever hear of this?
 

MrChad

Lifer
Aug 22, 2001
13,507
3
81
mscorwks.dll is part of the Common Language Runtime, I believe. Are both copies of .NET 2.0 running at the same patch level?
 

Red Squirrel

No Lifer
May 24, 2003
70,157
13,566
126
www.anyf.ca
Should be, is there a way I can find out? the folder names match (2.0.50727)

I tried to install 3.0 to try that but there is no csc.exe in the folder so I can't seem to compile as a 3.0 app.
 

MrChad

Lifer
Aug 22, 2001
13,507
3
81
HKEY_LOCAL_MACHINE\Software\Microsoft\NET Framework Setup\NDP\v2.0.50727

There's a DWORD key called "SP" that will tell you the service pack level. Also, some quick googling reveals that this may be related to thread issues. Is your app multi-threaded?
 

Red Squirrel

No Lifer
May 24, 2003
70,157
13,566
126
www.anyf.ca
Yeah there's actually one more thread in it. For some reason theres like 15 threads when there should only be 2 though. But on XP it does the same. Probably a C# thing I guess.

Also the win2k3 box is single core.
 

DaveSimmons

Elite Member
Aug 12, 2001
40,730
670
126
How much RAM does the 2K3 box have?

I put 2K3 on my music server and wondered why it was running so badly, then I checked the system info and saw I'd only installed 1 GB on that box not the 2 GB I had thought. It runs much better now with 2 GB.
 

Red Squirrel

No Lifer
May 24, 2003
70,157
13,566
126
www.anyf.ca
there's about 1.5GB of ram, but this app only uses 783MB so I really hope I can get away with not adding more ram. Cheap to do at home, but very expensive to do in the production environment (usually 40 bucks per month extra for 1GB).

I will allocate more ram to the VM and see if there's still issues.


edit: Just tried with 2.5GB and still no change.
 

Crusty

Lifer
Sep 30, 2001
12,684
2
81
Have you run it through the debugger and looked to see what that thread is executing? Are you doing any resource intensive operations like network/file I/O that would suffer from performance hits of running in the virtual machine?
 

Red Squirrel

No Lifer
May 24, 2003
70,157
13,566
126
www.anyf.ca
I've never ran a C# app through a debugger, should probably learn... how would I go about doing that?

And there is no intensive stuff going on. Basically there's the main program loop, then another loop that submits SQL queries, which arn't numerous if nobody is logged in to the game. Maybe 1 per second average. It's not using 100% but it's close. If it was using 100% non stop I would suspect something in my code such as a continuous loop but does not seem like it's the case.