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 / January 2005

Tip: Looking for answers? Try searching our database.

Advice Needed

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Robert Porter - 25 Jan 2005 02:55 GMT
We are in the process of porting a series of applications from VB6 to managed code. Our programs automate via COM a third party application. In order to minimize the impact of this effort we are porting small portions or components one at a time, so for a period we will be living with Interop.

An example, we now have a managed object that is called from the VB6 app, interacts with objects both COM based and .NET based that were instantiated and controlled by the parent VB6 app. Amazingly this approach has worked fine so far. Carefully following the guidelines and walkthroughs we have been able to get everything to play well together.

My question, and the advice I am seeking is, what issues should we look for that we may not have run into yet, especially in terms of memory leaks etc. We have not noticed any decrease in overall application stability and performance, other than a slightly longer "cold" start to the application. Presumably the overhead of initializing both the VB6 runtimes and the CLR. We have also not noticed any significant resource leaks. But I am wary and know we have to live in this mode for an extended period of time as we port our applications and bring our staff up to speed with .NET so I thought I would solicit any advise I could from this group.

The app is Winforms based for now, and heavily database oriented. We are looking at creating an ASP version and possibly a PocketPC version as well in the future, once the port is completed.

Thanks in advance for your time.

Cheers,

Robert Porter
"Peter Huang" [MSFT] - 25 Jan 2005 07:01 GMT
Hi

So far it is hard to guess what would happen. If you encounter any problem,
please feel free to post in the newsgroup.

Here are some links you may take a look.
839047 FIX: A memory leak may occur when COM objects are passed as VARIANT
in
http://support.microsoft.com/?id=839047

828980 BUG: COM objects with events are not correctly released by Garbage
http://support.microsoft.com/?id=828980

Best regards,

Perter Huang
Microsoft Online Partner Support

Signature

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

Mattias Sj?gren - 25 Jan 2005 12:33 GMT
Peter,

>828980 BUG: COM objects with events are not correctly released by Garbage
>http://support.microsoft.com/?id=828980

This article doesn't appear to be public (yet).

Mattias

Signature

Mattias Sjögren [MVP]  mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.

Robert Porter - 26 Jan 2005 02:10 GMT
Thanks, this actually proved to be opportune as we use a great deal of event handling code with our objects. Specifically we integrate with our third party app by reacting to events that it raises.

Cheers,

Bob

  nntp://msnews.microsoft.com/microsoft.public.dotnet.framework.interop/<OLzrKotAFHA.2584@TK2MSFTNGP09.phx.gbl>

Peter,

>828980 BUG: COM objects with events are not correctly released by Garbage
>http://support.microsoft.com/?id=828980

This article doesn't appear to be public (yet).



Mattias

--
Mattias Sj&ouml;gren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.

[microsoft.public.dotnet.framework.interop]
"Peter Huang" [MSFT] - 26 Jan 2005 05:30 GMT
Hi Bob,

Yes, it seems that article has not been published and it is still under
test.
So as a suggestion, I think we would better release the Com Event handle
before we set the object to null.

e.g.
ComServer.CMyClass MC = new ComServer.CMyClassClass();
MC.Close += new ComServer._IMyClassEvents_CloseEventHandler(MC_Close);
MC.Close -= new ComServer._IMyClassEvents_CloseEventHandler(MC_Close);
MC = null;
GC.Collect();
GC.WaitForPendingFinalizers();
GC.Collect();
GC.WaitForPendingFinalizers();

Hope this helps.

Best regards,

Perter Huang
Microsoft Online Partner Support

Signature

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

Robert Porter - 26 Jan 2005 22:40 GMT
Thanks Peter,

I will give that a try, makes sense so I should be able to implement it in my environment.

Bob

  nntp://msnews.microsoft.com/microsoft.public.dotnet.framework.interop/<T#b5tg2AFHA.3152@cpmsftngxa10.phx.gbl>

Hi Bob,

Yes, it seems that article has not been published and it is still under
test.
So as a suggestion, I think we would better release the Com Event handle
before we set the object to null.

e.g.
ComServer.CMyClass MC = new ComServer.CMyClassClass();
MC.Close += new ComServer._IMyClassEvents_CloseEventHandler(MC_Close);
MC.Close -= new ComServer._IMyClassEvents_CloseEventHandler(MC_Close);
MC = null;
GC.Collect();
GC.WaitForPendingFinalizers();
GC.Collect();
GC.WaitForPendingFinalizers();

Hope this helps.

Best regards,

Perter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.


[microsoft.public.dotnet.framework.interop]
"Peter Huang" [MSFT] - 27 Jan 2005 02:24 GMT
Hi

I am glad that my suggestion will help you.

Best regards,

Perter Huang
Microsoft Online Partner Support

Signature

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

Robert Porter - 26 Jan 2005 02:09 GMT
Thanks!

Exactly the kind of info I was looking for!

Cheers,

Bob Porter

  nntp://msnews.microsoft.com/microsoft.public.dotnet.framework.interop/<#ZlGEvqAFHA.2732@cpmsftngxa10.phx.gbl>

Hi

So far it is hard to guess what would happen. If you encounter any problem,
please feel free to post in the newsgroup.

Here are some links you may take a look.
839047 FIX: A memory leak may occur when COM objects are passed as VARIANT
in
http://support.microsoft.com/?id=839047

828980 BUG: COM objects with events are not correctly released by Garbage
http://support.microsoft.com/?id=828980


Best regards,

Perter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.


[microsoft.public.dotnet.framework.interop]

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.