G
Guest
I have a .NET console application that is kicked off by a .NET Windows
service. They communicate via .NET Remoting, although there isn't much
communication between the two while the console app is running. There can
be, and are typically, several instances of the console app running at the
same time communicating back to the service.
The console app creates a delegate to do some work while the main thread
waits on a ManualResetEvent to be signaled (ManualResetEvent.WaitOne()).
When the delegate is done, it calls Set on the ManualResetEvent, the WaitOne
returns and the app exits - 99.99999% of the time.
This is very hard to reproduce, but every once in a while, once the console
app has finished running all of the code I put in it, but it continues to run
- and at 45-50% of the CPU. Here is my Main:
[STAThread]
static void Main(string[] args)
{
try
{
// Create the one and only TsDPDllHost class for this process
WriteTrace( "1 Creating object" );
MyClass myClass = new MyClass);
WriteTrace( "2 calling myClass.Run" );
myClass.Run();
WriteTrace( "3 Exiting" );
}
catch(Exception e)
{
WriteTrace( "4 Exiting - ERROR e.Message=" + e.Message );
}
}
No exceptions are thrown and the trace statements #1, 2, and 3 are written
to a log file. TaskManager says the console app has 1 thread left, but
trying to attach to it with a debugger never comes back. Using SysInternals'
Process Explorer shows the following as the stack on the 1 thread:
ntdll.dll!RtlFreeHeap+0x67
!TipUnloadProject+0xc2d
!TipUnloadProject+0xba7
!TipUnloadProject+0x741
!BASIC_DISPINTERFACE_GetTICount+0xd5bf
ntdll.dll!LdrInitializeThunk+0x29
ntdll.dll!LdrShutdownProcess+0x142
!IsValidLocale+0x8eb
!ExitProcess+0x14
!GetCompileInfo+0x6553c
!CorExeMain+0x79
!RegisterWaitForInputIdle+0x49
Has anybody seen anything like this or know what might be going on?
Thanks,
Tim
service. They communicate via .NET Remoting, although there isn't much
communication between the two while the console app is running. There can
be, and are typically, several instances of the console app running at the
same time communicating back to the service.
The console app creates a delegate to do some work while the main thread
waits on a ManualResetEvent to be signaled (ManualResetEvent.WaitOne()).
When the delegate is done, it calls Set on the ManualResetEvent, the WaitOne
returns and the app exits - 99.99999% of the time.
This is very hard to reproduce, but every once in a while, once the console
app has finished running all of the code I put in it, but it continues to run
- and at 45-50% of the CPU. Here is my Main:
[STAThread]
static void Main(string[] args)
{
try
{
// Create the one and only TsDPDllHost class for this process
WriteTrace( "1 Creating object" );
MyClass myClass = new MyClass);
WriteTrace( "2 calling myClass.Run" );
myClass.Run();
WriteTrace( "3 Exiting" );
}
catch(Exception e)
{
WriteTrace( "4 Exiting - ERROR e.Message=" + e.Message );
}
}
No exceptions are thrown and the trace statements #1, 2, and 3 are written
to a log file. TaskManager says the console app has 1 thread left, but
trying to attach to it with a debugger never comes back. Using SysInternals'
Process Explorer shows the following as the stack on the 1 thread:
ntdll.dll!RtlFreeHeap+0x67
!TipUnloadProject+0xc2d
!TipUnloadProject+0xba7
!TipUnloadProject+0x741
!BASIC_DISPINTERFACE_GetTICount+0xd5bf
ntdll.dll!LdrInitializeThunk+0x29
ntdll.dll!LdrShutdownProcess+0x142
!IsValidLocale+0x8eb
!ExitProcess+0x14
!GetCompileInfo+0x6553c
!CorExeMain+0x79
!RegisterWaitForInputIdle+0x49
Has anybody seen anything like this or know what might be going on?
Thanks,
Tim