How CLR achieve the binary level of interoperability that COM achieved? Or don't?
See the question and my original answer on StackOverflowMore than 15 years ago, developers working in Microsoft ecosystem had basically 3 main choices when working with COM:
- use C++
- use C++ with some help (MFC for desktop or ATL initially for servers)
- use another language. In pure Microsoft terms, it meant VB (VB4, 5, and 6). Other vendors were present (Borland, etc.).
When working with C++, developers were faced with many difficulties:
- class factories
- AddRef / Release ref counting dangers and leaks (cycles, etc.)
- threading (where COM brought the single, both, free notions)
- marshaling
- out-of-process / in-process support
- aggregation
- registration
- inexistent error handling (beyond HRESULTs)
- security
- etc.
Note that VB did a good work in some areas, and was largely adopted, but many people were dissatisfied with VB for reasons I will not mention here. Actually it also added more difficulties for C++ programmers because automation interfaces are easy to use in VB (and other automation clients such as VBScript or JScript) but difficult to use in C++ (VARIANT, BSTR, SAFEARRAY, etc.).
So Microsoft decided to create a "COM+ runtime" thing (it was part of a bigger "COM+" picture):
- To make it easier to build COM components
- To address key issues in developing and deploying COM-based apps
This is mentioned in this old 1998 article: Object-Oriented Software Development Made Simple with COM+ Runtime Services
Eventually, this "COM+ runtime" became something called "The .NET Framework" (and intermediary name was NGWS: Next Generation Windows Services for those like me who attended the PDC in 2001...). You can see traces of this in the name of .NET native hosting interfaces, for example ICorRuntimeHost Interface where Cor stands for "COm Runtime".
So, .NET is somewhow an evolution of COM. It's based on it. It's complementary. Note that WinRT is also an evolution of COM, but quite different.
They're both descendant from COM. One way of viewing this is to consider that the .NET framework is the child of the Microsoft Developer division (Visual Studio and tools), and WinRT the child of the Microsoft Windows division (they never liked the first child mostly because of his "memory problem" - the GC).