[Mono-dev] mono 2.11.4 on Windows "GetThreadContext failed"
robertj at gmx.net
Mon Nov 19 11:30:48 UTC 2012
On 19.11.2012 11:29, Frank Fuchs wrote:
> I'm using mono-2.11.4 on Windows 7 in 32 bit and 64 bit for embedding
> into my C++ application. Since updating from an rather old 2.6.4 mono
> I'm getting an error "GetThreadContext failed" from the GC every now
> and then (there seems to be no pattern). The same error occurs with
> mono-3.0.1 both for 32 bit (directly downloaded from mono-project.com)
> and 64 bit (self compiled with external Boehm GC - the same as I used
> for 2.6.4).
> I don't use any antivirus software (in my virtual test machine) so I
> can exclude this as the reason.
> The only solution I found up to now was to mess with the GC itself and modify
> if (!GetThreadContext(THREAD_HANDLE(thread), &context))
> - ABORT("GetThreadContext failed");
> + return thread->stack_base;
Can you print the GetLastError() value when this occurs?
How are you loading mono*.dll and the external GC dll?
Boehm is relying on its DllMain function to detect threads.
If you're lazy-loading these DLLs you may miss all threads
that were created before loading Mono with LoadLibrary.
More information about the Mono-devel-list