Oleg,
Thanks for your continued help.
1. On the first development machine: I have now set debugging for both the
main project (compiled with /clr) to mixed, and also set debugging for the
managed project to mixed. Is that correct?
I have tried setting breakpoints at various places in MINTERNAL.H. This
appears to be the module where ModuleUninitializer.SingletonDomainUnload() is
defined. However, the program never stops at any of these breakpoints.
Do you have copies of MINTERNAL.H and MSTARTUP.CPP? If so, you can see where
the crash is occurring.
When I exit the program, the program crashes the output window shows the
following:
'FootanalNovel.exe': Loaded 'C:\WINDOWS\system32\xpsp2res.dll', Binary was
not built with debug information.
An unhandled exception of type 'System.StackOverflowException' occurred in
mscorlib.dll
As I said yesterday, the stack trace shows:
->mscorlib.dll!System.Collections.Stack.GetEnumerator()
msvcm80.dll!<CrtImplementationDetails>.ModuleUninitializer.SingletonDomainUnload(objec
source = {System.AppDomain}, System.EventArgs arguments = null) + 0x6a bytes
kernel32.dll!_BaseThreadStart@8() + 0x37 bytes
This is consistent from run to run. If I start the program and wait five
minutes, and then exit the program, the same thing happens.
===================================================
2nd Development system:
2. I have also tested this code on the 2nd development machine. That is the
one where the problem is occurring within DomainUnload(), defined in the file
MSTARTUP.CPP. I can set a breakpoint in this method. As I mentioned in my
previous posting in this thread, I can step through DomainUnload() until it
reaches the statement:
UninitializeAppDomain();
When I try to step into this function, the program crashes. This function,
UninitializeAppDomain() is also defined in MSTARUP.CPP. It has a single line
of code:
_app_exit_callback();
I have set a breakpoint on this line, but it doesn't get hit. But, I am just
repeating myself. This is all as I said in my last posting.
3. When the crash occurs attempting to execute UninitializeAppDomain(),
there is an "Exception" message. This is the message that I see in the
Output window:
First-chance exception at 0x7c812a5b in FootanalNovel.exe: 0xE053534F:
0xe053534f.
'FootanalNovel.exe': Loaded 'C:\WINDOWS\system32\xpsp2res.dll', Binary was
not built with debug information.
'FootanalNovel.exe': Loaded
'C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Culture.dll', No symbols
loaded.
'FootanalNovel.exe': Unloaded
'C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Culture.dll'
Managed Debugging Assistant 'FatalExecutionEngineError' has detected a
problem in 'd:\Program Development\FootAnalNovel\Ver
4.0.1\Debug\FootanalNovel.exe'.
Additional Information: The runtime has encountered a fatal error. The
address of the error was at 0x7c812a5b, on thread 0xb54. The error code is
0x800703e9. This error may be a bug in the CLR or in the unsafe or
non-verifiable portions of user code. Common sources of this bug include user
marshaling errors for COM-interop or PInvoke, which may corrupt the stack.
4. I have repeated this several times on each machine. Each machine is the
same as the previous time, but the final errors on the two machines are
different, they appear to be occurring in the same general area of code. That
is, <CrtImplementationDetails>::ModuleUninitializer::SingletonDomainUnload()
===============================================================
I would conclude that the problem is not random, although it occurs in a
slightly different place on my two developement systems.
Thanks again for your thoughts.
Jim
[quoted text, click to view] "Oleg Starodumov" wrote:
> Jim,
>
> Try to enable mixed mode debugging (in the project that you use to start debugging -
> probably, that's the main .exe's project):
> (Project properties | Configuration Properties | Debugging | Debugger Type -
> set to "Mixed" (but not "Auto")
> It should allow to set breakpoints in all kinds of code.
>
> The second time, what exception was reported? Was it also stack overflow,
> or another one? Is there always the same exception reported after the crash,
> or are there different exceptions?
>
> What does Debug Output window contain after a crash? Are there messages
> about some other (first chance) exceptions?
>
> Try to reproduce the problem several times in a row. Will it always occur in the same place?
> With the same call stack and exception type? If everything is the same, is it still the same
> if you let the app run for a while, then exit?
>
> (This all may sound like waste of time, but really it should help to see if the problem
> is random or not; if it always occurs in the same way, probably there is one place
> where the corruption / misconfiguration occurs, and we will try to find it;
> if it occurs truly randomly, we will have to invent something else to spot it)
>
> Oleg
>
>
>
>