Showing posts with label COM. Show all posts
Showing posts with label COM. Show all posts

Thursday, August 6, 2009

Chapter 12-Lesson 2

  • COM Callable Wrapper (CCW) works the exact opposite of RCW. i.e. it makes .NET assemblies usable for COM.
  • We may se it simpy by putting a check on Register for COMInterOp option in Project Properties -> Build tab.
  • To turn on/off COM visibility of individual elements within an assembly use COMVisible attribute and set it to either true or false.
  • Any class or members of a class that need to be available for COM need to be public.
  • Also, the class thats required for COM visibility should use default constructor with no parameters, and should not be abstract as well.
  • After the assembly is built, we may use Type Library Exporter utility (TlbExp.exe) to export it.
  • Interface Definition Language (IDL) may be used to generate resource scripts for COM available .NET libraries.

Chapter 13-Lesson 1

  • Runtime Callable Wrapper (RCW) is the .NET Component that handles all complex issues related to referencing and communicating COM components.
  • Type Library Importer Tool (TlbImp.exe) may be used besides Visual Studio to add reference to a COM component.
  • Regsvr32 maybe used to register any DLLs for use as COM components.
  • null value cannot be passed during a Call By Reference.
  • TlbImp generates a .NET assembly from a COM assembly.
  • Intermediate Language Disassembler (Ildasm.exe) allows to view a visual representation of the Intermediate Language (IL).
  • Use Assembly Registration Tool (Regasm.exe) to Add/Remove .NET assemblies from system registration database.
  • In .NET versions prior to 2.0, System.Exception would handles only Common Language Specification (CLS)-compliant exception. Because COM errors won’t be CLS compliant, they won’t be caught.
  • However, in .NET 2.0 there exists RuntimeWrappedException class in System.Runtime.CompilerServices namespace which inherits from System.Exception class. Therefore, now we may catch all Exceptions (CLS-based and Non-CLS-based) through System.Exception class.
  • See Limitations of COM InterOp on page 794.