You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Analyzer and Code-Fix to enable easy adoption of [GeneratedComInterface] #86343
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.
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.SetComObjectData
Marshal.GetComObjectData
Marshal.ReleaseComObject
Marshal.FinalReleaseComObject
Marshal.CreateAggregatedObject
Marshal.CreateWrapperOfType
Marshal.GetTypedObjectForIUnknown
These APIs will work with source-generated COM if the user provides their own StrategyBasedComWrappers instance as a global marshalling instance. We do not recommend doing this unless it's a stopgap measure to assist migration.
Marshal.GetIUnknownForObject
Marshal.GetIUnknownForObjectInContext
Marshal.GetIDispatchForObject
Marshal.GetIDispatchForObjectInContext
Marshal.GetComInterfaceForObject
Marshal.GetTypedObjectForIUnknown
Additional context
Reacted by Jackson Schuster, Sergio Pedri and Paulus Pärssinen
Activity
terrajobst commentedon May 30, 2023
Video
Looks good as proposed