This is a copy of a shared ChatGPT conversation
You said:
https://learn.microsoft.com/en-us/dotnet/standard/native-interop/abi-support there is a quote "In .NET 5+, low-level, cross-platform, IUnknown lifetime support is provided by ComWrappers."
My question is, does that cross-platform support include Linux?ChatGPT said:
Yes—on current .NET versions, “cross-platform” includes Linux.
ComWrappers can be used on Linux to interoperate with native objects that implement the IUnknown binary contract:
QueryInterface AddRef Release <additional interface methods>
Microsoft describes the IUnknown ABI as supported on all .NET platforms, and ComWrappers provides the runtime-side object identity and lifetime-management machinery. Microsoft Learn+1
What Linux support actually provides
On Linux, ComWrappers can:
-
expose a managed object through an
IUnknown-style vtable; -
wrap a native
IUnknown*as a managed object; -
associate native pointers with managed wrappers;
-
implement the
QueryInterface/AddRef/Releaselifetime model; -
call interface methods through native function pointers;
-
use source-generated wrappers through
[GeneratedComInterface]and[GeneratedComClass]in .NET 8+.Microsoft Learn+1
This is useful when a Linux native library intentionally exposes a COM-like, ABI-stable object interface, even though it is not using Windows COM services.
For example:
C// Exported by a Linux shared library IUnknownLike* create_audio_processor(void);
Your .NET code could obtain that pointer through LibraryImport/P/Invoke and then wrap it with:
C#object wrapper = comWrappers.GetOrCreateObjectForComInstance( nativePointer, CreateObjectFlags.None);
What it does not provide
It does not mean that Linux has the Windows COM infrastructure.
You do not automatically get:
-
CoCreateInstance; -
CLSID/ProgID registration through the Windows Registry;
-
COM apartments and Windows message pumping;
-
the Running Object Table;
-
DCOM;
-
COM proxy/stub infrastructure;
-
OLE or ActiveX;
-
normal Windows COM server activation;
-
automatic support for arbitrary Windows COM components.
On Linux, you normally obtain the initial native interface pointer from an exported C function, a native factory, or some other library-specific mechanism. ComWrappers handles the wrapper and lifetime side—not discovery or activation of the native component. Microsoft’s tutorial explicitly treats COM activation as a separate concern and uses the Windows CoCreateInstance API only as a Windows-specific example. Microsoft Learn
Important version qualification
There is a slight historical imprecision in the wording “.NET 5+”:
-
ComWrapperswas introduced in the .NET 5 era. -
The runtime work explicitly enabling it on Linux was merged in July 2021 for the .NET 6 release.
-
The corresponding runtime issue was assigned to the
.NET 6.0.0milestone.GitHub+1
Therefore, the safest practical statement is:
ComWrapperssupports Linux in .NET 6 and later.
For .NET 8, .NET 9, .NET 10, and later, Linux is unambiguously included.
The conceptual distinction
The documentation is referring to:
Cross-platform support for the
IUnknownABI and lifetime model
not:
A cross-platform implementation of the complete Microsoft COM platform
That distinction is the key to interpreting the quoted sentence. The project context similarly calls for separating low-level technical capability from the broader platform infrastructure it may appear to imply.