Update GeneratedComInterfaceAttribute (#82647)
authorJackson Schuster <36744439+jtschuster@users.noreply.github.com>
Sat, 25 Feb 2023 00:54:30 +0000 (16:54 -0800)
committerGitHub <noreply@github.com>
Sat, 25 Feb 2023 00:54:30 +0000 (16:54 -0800)
src/libraries/System.Runtime.InteropServices/tests/Ancillary.Interop/GeneratedComInterfaceAttribute.cs
src/libraries/System.Runtime.InteropServices/tests/ComInterfaceGenerator.Unit.Tests/GeneratedComInterfaceAnalyzerTests.cs

index d8a5ac0..09c81e4 100644 (file)
@@ -8,19 +8,5 @@ namespace System.Runtime.InteropServices.Marshalling
     [AttributeUsage(AttributeTargets.Interface)]
     public class GeneratedComInterfaceAttribute : Attribute
     {
-        public GeneratedComInterfaceAttribute(Type comWrappersType)
-            => (ComWrappersType) = (comWrappersType);
-
-        public GeneratedComInterfaceAttribute(Type comWrappersType, bool generateManagedObjectWrapper, bool generateComObjectWrapper)
-            => (ComWrappersType, GenerateManagedObjectWrapper, GenerateComObjectWrapper)
-             = (comWrappersType, generateManagedObjectWrapper, generateComObjectWrapper);
-
-        public Type ComWrappersType { get; }
-
-        public bool GenerateManagedObjectWrapper { get; } = true;
-
-        public bool GenerateComObjectWrapper { get; } = true;
-
-        public bool ExportInterfaceDefinition { get; }
     }
 }
index d93701c..e4291e6 100644 (file)
@@ -201,7 +201,7 @@ namespace ComInterfaceGenerator.Unit.Tests
                 string snippet =
                     $$$"""
 
-                [GeneratedComInterface(typeof(MyComWrappers))]
+                [GeneratedComInterface]
                 interface IFoo
                 {
                     void Bar() {}
@@ -227,7 +227,7 @@ namespace ComInterfaceGenerator.Unit.Tests
                     $$$"""
 
                 [InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)]
-                [GeneratedComInterface(typeof(MyComWrappers))]
+                [GeneratedComInterface]
                 interface IFoo
                 {
                     void Bar() {}
@@ -249,7 +249,7 @@ namespace ComInterfaceGenerator.Unit.Tests
                     $$$"""
 
                 [InterfaceTypeAttribute((short)1)]
-                [GeneratedComInterface(typeof(MyComWrappers))]
+                [GeneratedComInterface]
                 interface IFoo
                 {
                     void Bar() {}
@@ -271,7 +271,7 @@ namespace ComInterfaceGenerator.Unit.Tests
                     $$$"""
 
                 [{|#0:InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIDispatch)|}]
-                [GeneratedComInterface(typeof(MyComWrappers))]
+                [GeneratedComInterface]
                 interface IFoo
                 {
                     void Bar() {}
@@ -297,7 +297,7 @@ namespace ComInterfaceGenerator.Unit.Tests
                     $$$"""
 
                 [{|#0:InterfaceTypeAttribute((short)2)|}]
-                [GeneratedComInterface(typeof(MyComWrappers))]
+                [GeneratedComInterface]
                 interface IFoo
                 {
                     void Bar() {}
@@ -323,7 +323,7 @@ namespace ComInterfaceGenerator.Unit.Tests
                     $$$"""
 
                 [{|#0:InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIInspectable)|}]
-                [GeneratedComInterface(typeof(MyComWrappers))]
+                [GeneratedComInterface]
                 interface IFoo
                 {
                     void Bar() {}
@@ -349,7 +349,7 @@ namespace ComInterfaceGenerator.Unit.Tests
                     $$$"""
 
                 [{|#0:InterfaceTypeAttribute((short)3)|}]
-                [GeneratedComInterface(typeof(MyComWrappers))]
+                [GeneratedComInterface]
                 interface IFoo
                 {
                     void Bar() {}
@@ -375,7 +375,7 @@ namespace ComInterfaceGenerator.Unit.Tests
                     $$$"""
 
                 [{|#0:InterfaceTypeAttribute(ComInterfaceType.InterfaceIsDual)|}]
-                [GeneratedComInterface(typeof(MyComWrappers))]
+                [GeneratedComInterface]
                 interface IFoo
                 {
                     void Bar() {}
@@ -401,7 +401,7 @@ namespace ComInterfaceGenerator.Unit.Tests
                     $$$"""
 
                 [{|#0:InterfaceTypeAttribute((short)0)|}]
-                [GeneratedComInterface(typeof(MyComWrappers))]
+                [GeneratedComInterface]
                 interface IFoo
                 {
                     void Bar() {}
@@ -436,7 +436,7 @@ namespace ComInterfaceGenerator.Unit.Tests
                     void Bar() {}
                 }
 
-                [GeneratedComInterface(typeof(MyComWrappers))]
+                [GeneratedComInterface]
                 partial interface IFoo { }
 
                 public unsafe partial class MyComWrappers : GeneratedComWrappersBase
@@ -460,7 +460,7 @@ namespace ComInterfaceGenerator.Unit.Tests
                     void Bar() {}
                 }
 
-                [GeneratedComInterface(typeof(MyComWrappers))]
+                [GeneratedComInterface]
                 partial interface IFoo { }
 
                 public unsafe partial class MyComWrappers : GeneratedComWrappersBase
@@ -484,7 +484,7 @@ namespace ComInterfaceGenerator.Unit.Tests
                     void Bar() {}
                 }
 
-                [GeneratedComInterface(typeof(MyComWrappers))]
+                [GeneratedComInterface]
                 partial interface IFoo { }
 
                 public unsafe partial class MyComWrappers : GeneratedComWrappersBase
@@ -512,7 +512,7 @@ namespace ComInterfaceGenerator.Unit.Tests
                     void Bar() {}
                 }
 
-                [GeneratedComInterface(typeof(MyComWrappers))]
+                [GeneratedComInterface]
                 partial interface IFoo { }
 
                 public unsafe partial class MyComWrappers : GeneratedComWrappersBase
@@ -540,7 +540,7 @@ namespace ComInterfaceGenerator.Unit.Tests
                     void Bar() {}
                 }
 
-                [GeneratedComInterface(typeof(MyComWrappers))]
+                [GeneratedComInterface]
                 partial interface IFoo { }
 
                 public unsafe partial class MyComWrappers : GeneratedComWrappersBase
@@ -568,7 +568,7 @@ namespace ComInterfaceGenerator.Unit.Tests
                     void Bar() {}
                 }
 
-                [GeneratedComInterface(typeof(MyComWrappers))]
+                [GeneratedComInterface]
                 partial interface IFoo { }
 
                 public unsafe partial class MyComWrappers : GeneratedComWrappersBase
@@ -596,7 +596,7 @@ namespace ComInterfaceGenerator.Unit.Tests
                     void Bar() {}
                 }
 
-                [GeneratedComInterface(typeof(MyComWrappers))]
+                [GeneratedComInterface]
                 partial interface IFoo { }
 
                 public unsafe partial class MyComWrappers : GeneratedComWrappersBase
@@ -624,7 +624,7 @@ namespace ComInterfaceGenerator.Unit.Tests
                     void Bar() {}
                 }
 
-                [GeneratedComInterface(typeof(MyComWrappers))]
+                [GeneratedComInterface]
                 partial interface IFoo { }
 
                 public unsafe partial class MyComWrappers : GeneratedComWrappersBase