From fc681a66f3fb35862e63fb9772958f05a95654ea Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 27 May 2022 22:05:06 -0600 Subject: [PATCH] Unify the `IDataObject` interface with the one in the BCL --- src/Microsoft.Windows.CsWin32/Generator.cs | 3 ++- test/Microsoft.Windows.CsWin32.Tests/GeneratorTests.cs | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Microsoft.Windows.CsWin32/Generator.cs b/src/Microsoft.Windows.CsWin32/Generator.cs index 0e3bce7e..d4245321 100644 --- a/src/Microsoft.Windows.CsWin32/Generator.cs +++ b/src/Microsoft.Windows.CsWin32/Generator.cs @@ -54,6 +54,7 @@ public class Generator : IDisposable internal static readonly Dictionary AdditionalBclInteropStructsMarshaled = new Dictionary(StringComparer.Ordinal) { + { nameof(System.Runtime.InteropServices.ComTypes.IDataObject), ParseTypeName("global::System.Runtime.InteropServices.ComTypes.IDataObject") }, ////{ "BOOL", PredefinedType(TokenWithSpace(SyntaxKind.BoolKeyword)) }, }; @@ -385,7 +386,7 @@ public Generator(string metadataLibraryPath, Docs? docs, GeneratorOptions option this.delegateSignatureTypeSettings = this.generalTypeSettings with { QualifyNames = true }; this.enumTypeSettings = this.generalTypeSettings; this.fieldOfHandleTypeDefTypeSettings = this.generalTypeSettings with { PreferNativeInt = false }; - this.externSignatureTypeSettings = this.generalTypeSettings with { QualifyNames = true, PreferMarshaledTypes = true }; + this.externSignatureTypeSettings = this.generalTypeSettings with { QualifyNames = true, PreferMarshaledTypes = options.AllowMarshaling }; this.externReleaseSignatureTypeSettings = this.externSignatureTypeSettings with { PreferNativeInt = false, PreferMarshaledTypes = false }; this.comSignatureTypeSettings = this.generalTypeSettings with { QualifyNames = true }; this.extensionMethodSignatureTypeSettings = this.generalTypeSettings with { QualifyNames = true }; diff --git a/test/Microsoft.Windows.CsWin32.Tests/GeneratorTests.cs b/test/Microsoft.Windows.CsWin32.Tests/GeneratorTests.cs index 735839df..3aa52507 100644 --- a/test/Microsoft.Windows.CsWin32.Tests/GeneratorTests.cs +++ b/test/Microsoft.Windows.CsWin32.Tests/GeneratorTests.cs @@ -299,6 +299,7 @@ public void COMInterfaceWithSupportedOSPlatform(bool net50, bool allowMarshaling "D3D9ON12_ARGS", // Contains an inline array of IUnknown objects "NCryptOpenKey", // Generates a SafeHandle based on a UIntPtr "X509_CERT", // A constant defined as PCSTR + "CIDLData_CreateFromIDArray", // Method with out parameter of a possibly marshaled interop type shared with the BCL, "ID3D12Resource", // COM interface with base types "ID2D1RectangleGeometry")] // COM interface with base types string api,