FCHouse A blog about our lives, our passions, our photos

.Net & COM: hard cohabitation

When I started working with .Net, COM & VB was already old for me.
Three years later, today, the needs to work with .Net (c#) with a middle layer written in Visual Basic is letting me think a simple thing:
The cohabitation between .Net and COM is very hard!

You can, of course, access a COM component with .net, using the tblimp, that generates an accessible layer to use the components. The problems relies on the com coding (its structures, the parameters and a lot of other things) but if you will ever had to do something like that you will find that Hating Vb is SOOOOO Easy!

Now One of the worst part if you are using .net is the “Garbage Collection”, that usually works well with your code, but with the com components the things are “slightly” different. The Garbage Collector cannot release those components in a good way, so you must help yourself with:
System.Reflection.InteropServices.Marshal.ReleaseComObject
But be aware: sometimes one single call is not enough: this function returns a integer value, and only when it is not more than zero you can stop calling it!

Intelligent?

If you understand what I am talking about just be aware of another thing: some COM components are SINGLE THREADING, while .Net is Multithreading by default… play a while and you will understand that working with those two different visions is a little tricky.

COM SUCKS!


No Comments Yet


There are no comments yet. You could be the first!

Leave a Comment

Energia Rinnovabile iTunes TV Series Store