'Fatal Execution Engine Error' using unmanaged obj from 2 appdomai

G

Guest

I believe I've found a bug in either the compiler or in the runtime....for
some reason when accessing a specific unmanaged object from 2 appdomains it
causes a fatal execution engine error. It took me over a week to narrow it
down, but here's a nice simple snippet of code that showcases this issue:
http://rafb.net/p/Z94NfD16.html

Anyone have any idea what exactly is the root cause of this or how to fix it
properly? It seems that if I change the code much (such as remove the
'virtual' from either of the methods, or change the return types, or change
the dictionary to something else) the problem goes away, but I'm more worried
about where else in my code this affects and I'm hoping for a more viable
solution than "search through 500K lines of code and look for that
pattern"....not realistic

If anyone wants more detail I've put a rar up which contains the source, a
debug build with symbols, the eventlog entry, and an adplus dump with
corresponding reports:
http://www.virgeweb.com/redec/crap/RuntimeFailureTest.rar
 
G

Guest

well apparently pastes on rafb.net don't stick around for long....so here's
the source that causes the problem:

#include <msclr/appdomain.h>

using namespace System;
using namespace System::Collections::Generic;
using namespace msclr;

ref class MyManagedClass
{
};

class MyUnmanagedClass
{
public:
virtual MyManagedClass^ Foo() { return nullptr; }
virtual Object^ CrashyCrashy()
{
Dictionary<String^, MyManagedClass^> ^bar = gcnew
Dictionary<String^, MyManagedClass^>();
bar->Add("", nullptr);
return nullptr;
}
};

void Test(MyUnmanagedClass *foo)
{
foo->CrashyCrashy();
}

int WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
{
MyUnmanagedClass foo;
AppDomain ^domain1 = AppDomain::CreateDomain("TestDomainOfGoodness");
call_in_appdomain<MyUnmanagedClass*>(domain1->Id, &Test, &foo);
return 0;
}
 
C

Carl Daniel [VC++ MVP]

redec said:
I believe I've found a bug in either the compiler or in the
runtime....for some reason when accessing a specific unmanaged object
from 2 appdomains it causes a fatal execution engine error. It took
me over a week to narrow it down, but here's a nice simple snippet of
code that showcases this issue: http://rafb.net/p/Z94NfD16.html

Anyone have any idea what exactly is the root cause of this or how to
fix it properly? It seems that if I change the code much (such as
remove the 'virtual' from either of the methods, or change the return
types, or change the dictionary to something else) the problem goes
away, but I'm more worried about where else in my code this affects
and I'm hoping for a more viable solution than "search through 500K
lines of code and look for that pattern"....not realistic

If anyone wants more detail I've put a rar up which contains the
source, a debug build with symbols, the eventlog entry, and an adplus
dump with corresponding reports:
http://www.virgeweb.com/redec/crap/RuntimeFailureTest.rar

Interesting. I can repro what you describe, both with VS2005 SP1 and a very
recent build of VS2008.

You might want to contact Microsoft PSS about this - it seems very likely
that what you're encountering is a bug, and charges for support calls are
generally waived if the underlying problem is a bug in the product.

-cd
 
G

Guest

Carl Daniel said:
Interesting. I can repro what you describe, both with VS2005 SP1 and a very
recent build of VS2008.

You might want to contact Microsoft PSS about this - it seems very likely
that what you're encountering is a bug, and charges for support calls are
generally waived if the underlying problem is a bug in the product.

-cd

Yeah...I've been trying to avoid that phone call :p....You'd think they'd
have a better way to submit bugs....I've looked on
http://connect.microsoft.com but there doesn't seem to be an appropriate
place for vs-related issues....
 
C

Carl Daniel [VC++ MVP]

redec said:
Yeah...I've been trying to avoid that phone call :p....You'd think
they'd have a better way to submit bugs....I've looked on
http://connect.microsoft.com but there doesn't seem to be an
appropriate place for vs-related issues....

There is (https://connect.microsoft.com/feedback/?SiteID=210), but Connect
is not a path to a solution for a problem that's blocking your progress.
Rather, it's path to get bugs into the system to be fixed in some future
version (at this point, Orcas+1 at the earliest). If you need a short-term
solution, PSS is your option. No guarantees that you'll get a solution that
way, but you surely won't get one through Connect.

I'm not sure where all you've posted, but you might try posting in
microsoft.public.dotnet.framework, where the core CLR experts are more
likely to congregate.

-cd
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top