Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Managed C++ / November 2007

Tip: Looking for answers? Try searching our database.

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

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
redec - 05 Nov 2007 21:42 GMT
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
redec - 06 Nov 2007 17:43 GMT
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;
}
Carl Daniel [VC++ MVP] - 07 Nov 2007 02:00 GMT
> I believe I've found a bug in either the compiler or in the
> runtime....for some reason when accessing a specific unmanaged object
[quoted text clipped - 14 lines]
> 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
redec - 07 Nov 2007 15:40 GMT
> Interesting.  I can repro what you describe, both with VS2005 SP1 and a very
> recent build of VS2008.
[quoted text clipped - 4 lines]
>
> -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....
Carl Daniel [VC++ MVP] - 07 Nov 2007 16:13 GMT
>> Interesting.  I can repro what you describe, both with VS2005 SP1
>> and a very recent build of VS2008.
[quoted text clipped - 10 lines]
> 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

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.