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 / .NET Framework / Interop / August 2006

Tip: Looking for answers? Try searching our database.

Native code unloads before Managed code

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
jornfa - 18 Aug 2006 09:11 GMT
I have a project where I use the MFC support for interop: <afxwinforms.h>,
CWinFormsControl<Ctrl> etc. This works fine exept for some problems when the
application closes down. Now and then I get an ASSERT in wincore.cpp l .2870
(WalkPreTranslateTree). Further I can see in the output window that the
native code unloads before the Managed code. Normally this is the other way
round as the EXE is a native C++ program, while the GUI is made up of
contained .NET controls.

Order of output in the debug window:
The program '[3328] Test.exe: Native' has exited with code 0 (0x0).
The program '[3328] Test.exe: Managed' has exited with code 0 (0x0).

Why do I still get messages to the WalkPreTranslateTree function after the
corresponding window is destroyed. And why does the managed code unload after
the native? And could these issues be related?

Any ideas? All help appreciated.

////Jørn
jornfa - 31 Aug 2006 14:04 GMT
Further problems seems to be bound to the cleanup in MFC with CWinformsControl:

1) There is a memory leak problem in viewform.cpp. It allocates an
_AFX_OCC_DIALOG_INFO structure on line 285, but this is never deallocated.
This is when you use the MFC class CFormView as the container. It is possible
to delete this internal MFC structure in your own code, but it flags a
problem.

2) 2 first chance exceptions is fired, which are "0xC0000005: Access
violation".

All this can be reproduced by a simple wizard generated MFC MDI program with
a CFormView based view class and a contained .NET user control through
CWinFormsControl.

Any ideas?

> I have a project where I use the MFC support for interop: <afxwinforms.h>,
> CWinFormsControl<Ctrl> etc. This works fine exept for some problems when the
[quoted text clipped - 15 lines]
>
> ////Jørn

Rate this thread:







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.