Skip to content

Commit

Permalink
Merge pull request #212 from microsoft/fix198
Browse files Browse the repository at this point in the history
Attribute COM interfaces with [ComImport]
  • Loading branch information
AArnott committed Mar 18, 2021
2 parents 7c9a30c + c7175cf commit 2fec30c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Microsoft.Windows.CsWin32/Generator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ public class Generator : IDisposable
private static readonly IdentifierNameSyntax ComInterfaceFriendlyExtensionsClassName = IdentifierName("FriendlyOverloadExtensions");
private static readonly TypeSyntax SafeHandleTypeSyntax = IdentifierName("SafeHandle");
private static readonly IdentifierNameSyntax IntPtrTypeSyntax = IdentifierName(nameof(IntPtr));
private static readonly AttributeSyntax ComImportAttribute = Attribute(IdentifierName("ComImport"));
private static readonly AttributeSyntax PreserveSigAttribute = Attribute(IdentifierName("PreserveSig"));
private static readonly AttributeSyntax SupportedOSPlatformAttribute = Attribute(IdentifierName("SupportedOSPlatform"));
private static readonly AttributeListSyntax DefaultDllImportSearchPathsAttributeList = AttributeList().AddAttributes(
Expand Down Expand Up @@ -2632,7 +2633,7 @@ private TypeDeclarationSyntax DeclareInterfaceAsStruct(TypeDefinition typeDef, I

if (this.FindGuidFromAttribute(typeDef) is Guid guid)
{
ifaceDeclaration = ifaceDeclaration.AddAttributeLists(AttributeList().AddAttributes(GUID(guid), ifaceType));
ifaceDeclaration = ifaceDeclaration.AddAttributeLists(AttributeList().AddAttributes(GUID(guid), ifaceType, ComImportAttribute));
}

if (baseTypeSyntaxList.Count > 0)
Expand Down

0 comments on commit 2fec30c

Please sign in to comment.