.NET : .NET News
Updated: 7/1/2002; 9:28:36 PM.

 

Click to see the XML version of this web page.

Click here to send an email to the editor of this weblog.

 
 

Wednesday, April 03, 2002

Today's Adentures in .NET Land - Calling C# VS.NET Automation from ATL COM


Today, in the "real" world, I was working on a mechanism to allow us to write VS.NET Automation model code in C# and then call it, through .NET's COM Interop mechanism, from ATL/C++ COM unmanaged components which contain a VSIP code. Let me explain. I have been doing some work integrating an environment with Visual Studio .NET. There are really two major choices: use the automation model of VS.NET or pay $30,000 and join the Visual Studio Integration Program (http://msdn.microsoft.com/vstudio/vsip/default.asp) and get the code and COM Interfaces of VS.NET. There are many reasons why you have to choose option 2. The automation model allows you to have what is known as an "add-in" and can only do certain things. An add-in is actually a COM Component that implements the IDTExtensibilty2 interface. Using VSIP code, however, allows you to do just about anything. You become an actual "part" of VS.NET, through the use of what are known as Packages, or VsPackages. VSIP allows you to add your own splash screen or your own editor, or heck, even implement your own language. Its quite powerful but amazingly complex. It is hundreds of thousands of lines of code and based on tons and tons of COM Interfaces. The base example to just put up a new project type takes 66 files!!

I am using VSIP to have a COM component that implements IDTWizard. It turns out that lots of things in VS.NET are actually Wizards. My wizard calls one of VS.NET's wizards to launch a C# project that suppplies a WinForm and populates it with a base implementation of code for something. And I add toolbar tabs with custom tools and I add menus. A lot of this is of course better done through the Automation model. So I have been going through this laborious process of using C# to work out all the automation code I want, tweaking it, and then "porting" it all to C++/ATL COM code for inclusion in the ATL COM component that implements VSIP and IDTWizard. Yikes! I had forgotten how hard and time consuming COM was! I haven't done anything but Managed code for 2 years and had gotten used to how much easier it all is.

So what I wanted was a way to do my automation stuff in C# and then call the managed code through COM Interop. So I put everything in a C# class and then signed it. I then ran regasm /tlb on it to generate the CCW, register COM gunk in the Registry and generate the Type Library. I then imported the TLB into the C++ code and proceeded on to party on. Or so I thought. It turns out that, by default, COM Interop, does not expose type library information and worse than that, generates only IDispatch late-bound interfaces! I'll post why later but it's wrong, wrong, wrong. Late bound IDispatch interfaces are a legacy of VB3 and have no place other than Scripting languages in a modern world. I had to decorate the class with an attribute to "force" it to generate type info and generate a dual interface. Yeck.

Then it got worse. The DTE object in VS.NET Automation is full of bugs, missing functionality, and incomplete documentation. And there was still getting the types right across the boundary...More tomorrow...



10:13:51 PM    

AOL/Time Warner,the monopoly, like most, fail to understand .NET


We have this:

Microsoft remedy should address .NET says AOL exec [IDG InfoWorld]

First of all, how on earth does .NET, which is plumbing for developing software quicker and for the Internet threaten anything at AOL? Once again, we have people equating .NET = Passport. When are people going to get that they are two very different things? Then, of all people, AOL/Time Warner is the biggest monopoly in the world and exerts that power even up here in Nashua NH where we can't get decent broadband or decent cable because there's no darn competition! AOL/Time Warner owns the majority of this country's newspapers, magazines, cable, TV and radio stations. If anyone should be sued for anti-trust, its them. I encourage people to write their congresspeople. Enough is enough.



9:07:54 PM    


© Copyright 2002 Sam Gentile.



Click here to visit the Radio UserLand website.

 


April 2002
Sun Mon Tue Wed Thu Fri Sat
  1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30        
Mar   May

Click on the coffee mug to add Sam Gentile's Instant Outline to your Radio UserLand buddy list.