-
Couldn't load subscription status.
- Fork 5.2k
Closed
Labels
api-approvedAPI was approved in API review, it can be implementedAPI was approved in API review, it can be implementedarea-System.Runtime.InteropServicescode-analyzerMarks an issue that suggests a Roslyn analyzerMarks an issue that suggests a Roslyn analyzercode-fixerMarks an issue that suggests a Roslyn code fixerMarks an issue that suggests a Roslyn code fixer
Milestone
Description
Describe the problem you are trying to solve
As part of the work to enable the new COM source generator, we want to make it easy to move from built-in COM to source-generated COM.
Describe suggestions on how to achieve the rule
- Offer a code-fix to convert
[ComImport]to[GeneratedComInterface]and remove shadowing methods that were required for inheritance in[ComImport]. - Offer a code-fix to add
[GeneratedComClass]to a class that implements a[GeneratedComInterface]-attributed type. - Report a diagnostic when a type with
[ComVisible(true)]implements a[GeneratedComInterface]-attributed type and COM hosting is enabled.- A
[GeneratedComInterface]-attributed type will not be exposed by built-in COM.
- A
- Report a diagnostic when a variable of a (compile-time) type or a
typeof(T)that has either[GeneratedComInterface]or[GeneratedComClass]is passed to one of the following built-in COM interop-related methods:- These APIs will not work with the source-generated COM:
Marshal.SetComObjectDataMarshal.GetComObjectDataMarshal.ReleaseComObjectMarshal.FinalReleaseComObjectMarshal.CreateAggregatedObjectMarshal.CreateWrapperOfTypeMarshal.GetTypedObjectForIUnknown
- These APIs will work with source-generated COM if the user provides their own
StrategyBasedComWrappersinstance as a global marshalling instance. We do not recommend doing this unless it's a stopgap measure to assist migration.Marshal.GetIUnknownForObjectMarshal.GetIUnknownForObjectInContextMarshal.GetIDispatchForObjectMarshal.GetIDispatchForObjectInContextMarshal.GetComInterfaceForObjectMarshal.GetTypedObjectForIUnknown
- These APIs will not work with the source-generated COM:
Additional context
jtschuster, Sergio0694 and PaulusParssinen
Metadata
Metadata
Assignees
Labels
api-approvedAPI was approved in API review, it can be implementedAPI was approved in API review, it can be implementedarea-System.Runtime.InteropServicescode-analyzerMarks an issue that suggests a Roslyn analyzerMarks an issue that suggests a Roslyn analyzercode-fixerMarks an issue that suggests a Roslyn code fixerMarks an issue that suggests a Roslyn code fixer