From 35d2d1fe8ecafd067e5bc317bed484473022bdc8 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Wed, 22 Feb 2023 11:31:23 -0700 Subject: [PATCH] Emit an explanatory warning when users request generation of `IDispatch` or `IUnknown` Closes #861 --- src/Microsoft.Windows.CsWin32/Generator.Invariants.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Microsoft.Windows.CsWin32/Generator.Invariants.cs b/src/Microsoft.Windows.CsWin32/Generator.Invariants.cs index 8eebc3f5..5c9e3282 100644 --- a/src/Microsoft.Windows.CsWin32/Generator.Invariants.cs +++ b/src/Microsoft.Windows.CsWin32/Generator.Invariants.cs @@ -320,7 +320,9 @@ public partial class Generator .Add("ULARGE_INTEGER", "Use the C# ulong keyword instead.") .Add("OVERLAPPED", "Use System.Threading.NativeOverlapped instead.") .Add("POINT", "Use System.Drawing.Point instead.") - .Add("POINTF", "Use System.Drawing.PointF instead."); + .Add("POINTF", "Use System.Drawing.PointF instead.") + .Add("IUnknown", "This COM interface is implicit in the runtime. Interfaces that derive from it should apply the [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] attribute instead.") + .Add("IDispatch", "This COM interface is implicit in the runtime. Interfaces that derive from it should apply the [InterfaceType(ComInterfaceType.InterfaceIsIDispatch)] attribute instead."); /// /// Gets a map of interop APIs that should not be generated when marshaling is allowed, and messages to emit in diagnostics if these APIs are ever directly requested.