ComNativeDescriptor is dependent on Windows
- Dominant language
- C#
- Stars
- 4.9k
- Forks
- 1.1k
- Avg merge
- 20h 23m
- Merged PRs (30d)
- 103
Description
We've recently enabled using `ComWrappers` with the `ComNativeDescriptor`- this `TypeDescriptionProvider` is what is used by the .NET runtime `TypeDescriptor` for COM objects.
`ComWrappers` supports other platforms (Unix/Mac), but our current implementation is dependent on Windows PInvokes. These are used both in the `ComNativeDescriptor` code directly and in support code, such as our `VARIANT` implementation.
We could remove some of these dependencies, but not everything. As a starting point it would probably be good to target COM types that have no complicated types (that is "primitives") exposed as properties (as described in the `ITypeInfo` for the type).
Converters that have dependencies on Windows APIs (directly, or indirectly through System.Drawing) would need to be conditionalized. It is unclear what would be the right answer for these. Do we skip a property when it has an IPicture or IFont, for example?
Ideally, we would get cross-plat primitive VARIANT handling from the .NET runtime (that would work with AOT/Trimming enabled). The notable Win32 dependency we have is with SafeArray handling. I haven't looked closely at those APIs, so I'm not sure how difficult it would be to manually implement.
Capturing this for the future. This is unlikely to get scheduled in the near term.
Contributor guide
Assessment
This issue has not been assessed yet.