Add marshalling tests and warn if interface is not partial (#87146)
authorJackson Schuster <36744439+jtschuster@users.noreply.github.com>
Fri, 9 Jun 2023 22:25:44 +0000 (17:25 -0500)
committerGitHub <noreply@github.com>
Fri, 9 Jun 2023 22:25:44 +0000 (15:25 -0700)
Adds tests that marshal different types to and from native, and adds a warning if the interface or any containing types are not marked partial.

26 files changed:
docs/project/list-of-diagnostics.md
src/libraries/System.Runtime.InteropServices/gen/ComInterfaceGenerator/Analyzers/AnalyzerDiagnostics.cs
src/libraries/System.Runtime.InteropServices/gen/ComInterfaceGenerator/Analyzers/GeneratedComInterfaceAttributeAnalyzer.cs
src/libraries/System.Runtime.InteropServices/gen/ComInterfaceGenerator/ComInterfaceInfo.cs
src/libraries/System.Runtime.InteropServices/gen/ComInterfaceGenerator/ComMethodInfo.cs
src/libraries/System.Runtime.InteropServices/gen/ComInterfaceGenerator/GeneratorDiagnostics.cs
src/libraries/System.Runtime.InteropServices/gen/ComInterfaceGenerator/Resources/Strings.resx
src/libraries/System.Runtime.InteropServices/gen/ComInterfaceGenerator/Resources/xlf/Strings.cs.xlf
src/libraries/System.Runtime.InteropServices/gen/ComInterfaceGenerator/Resources/xlf/Strings.de.xlf
src/libraries/System.Runtime.InteropServices/gen/ComInterfaceGenerator/Resources/xlf/Strings.es.xlf
src/libraries/System.Runtime.InteropServices/gen/ComInterfaceGenerator/Resources/xlf/Strings.fr.xlf
src/libraries/System.Runtime.InteropServices/gen/ComInterfaceGenerator/Resources/xlf/Strings.it.xlf
src/libraries/System.Runtime.InteropServices/gen/ComInterfaceGenerator/Resources/xlf/Strings.ja.xlf
src/libraries/System.Runtime.InteropServices/gen/ComInterfaceGenerator/Resources/xlf/Strings.ko.xlf
src/libraries/System.Runtime.InteropServices/gen/ComInterfaceGenerator/Resources/xlf/Strings.pl.xlf
src/libraries/System.Runtime.InteropServices/gen/ComInterfaceGenerator/Resources/xlf/Strings.pt-BR.xlf
src/libraries/System.Runtime.InteropServices/gen/ComInterfaceGenerator/Resources/xlf/Strings.ru.xlf
src/libraries/System.Runtime.InteropServices/gen/ComInterfaceGenerator/Resources/xlf/Strings.tr.xlf
src/libraries/System.Runtime.InteropServices/gen/ComInterfaceGenerator/Resources/xlf/Strings.zh-Hans.xlf
src/libraries/System.Runtime.InteropServices/gen/ComInterfaceGenerator/Resources/xlf/Strings.zh-Hant.xlf
src/libraries/System.Runtime.InteropServices/tests/ComInterfaceGenerator.Tests/RcwAroundCcwTests.cs [new file with mode: 0644]
src/libraries/System.Runtime.InteropServices/tests/ComInterfaceGenerator.Tests/StringMarshallingTests.cs
src/libraries/System.Runtime.InteropServices/tests/ComInterfaceGenerator.Unit.Tests/CompileFails.cs
src/libraries/System.Runtime.InteropServices/tests/ComInterfaceGenerator.Unit.Tests/GeneratedComInterfaceAnalyzerTests.cs
src/libraries/System.Runtime.InteropServices/tests/TestAssets/SharedTypes/ComInterfaces/IDerived.cs
src/libraries/System.Runtime.InteropServices/tests/TestAssets/SharedTypes/ComInterfaces/IGetAndSetInt.cs

index eae2823..2d1eab1 100644 (file)
@@ -208,10 +208,10 @@ The diagnostic id values reserved for .NET Libraries analyzer warnings are `SYSL
 |  __`SYSLIB1089`__ | _`SYSLIB1070`-`SYSLIB1089` reserved for System.Runtime.InteropServices.JavaScript.JSImportGenerator._ |
 |  __`SYSLIB1090`__ | Invalid 'GeneratedComInterfaceAttribute' usage |
 |  __`SYSLIB1091`__ | Method is declared in different partial declaration than the 'GeneratedComInterface' attribute. |
-|  __`SYSLIB1092`__ | _`SYSLIB1092`-`SYSLIB1099` reserved for Microsoft.Interop.ComInteropGenerator._ |
-|  __`SYSLIB1093`__ | _`SYSLIB1092`-`SYSLIB1099` reserved for Microsoft.Interop.ComInteropGenerator._ |
-|  __`SYSLIB1094`__ | _`SYSLIB1092`-`SYSLIB1099` reserved for Microsoft.Interop.ComInteropGenerator._ |
-|  __`SYSLIB1095`__ | _`SYSLIB1092`-`SYSLIB1099` reserved for Microsoft.Interop.ComInteropGenerator._ |
+|  __`SYSLIB1092`__ | Specified interface derives from two or more 'GeneratedComInterfaceAttribute'-attributed interfaces. |
+|  __`SYSLIB1093`__ | Analysis for COM interface generation has failed |
+|  __`SYSLIB1094`__ | The base COM interface failed to generate source. Code will not be generated for this interface. |
+|  __`SYSLIB1095`__ | Invalid 'GeneratedComClassAttribute' usage |
 |  __`SYSLIB1096`__ | Use 'GeneratedComInterfaceAttribute' instead of 'ComImportAttribute' to generate COM marshalling code at compile time |
 |  __`SYSLIB1097`__ | This type implements at least one type with the 'GeneratedComInterfaceAttribute' attribute. Add the 'GeneratedComClassAttribute' to enable passing this type to COM and exposing the COM interfaces for the types with the 'GeneratedComInterfaceAttribute' from objects of this type. |
 |  __`SYSLIB1098`__ | .NET COM hosting with 'EnableComHosting' only supports built-in COM interop. It does not support source-generated COM interop with 'GeneratedComInterfaceAttribute'. |
index 53f778c..ad6a64e 100644 (file)
@@ -10,7 +10,6 @@ namespace Microsoft.Interop.Analyzers
         public static class Ids
         {
             public const string Prefix = "SYSLIB";
-            public const string InvalidGeneratedComAttributeUsage = Prefix + "1090";
             public const string ConvertToGeneratedComInterface = Prefix + "1096";
             public const string AddGeneratedComClassAttribute = Prefix + "1097";
             public const string ComHostingDoesNotSupportGeneratedComInterface = Prefix + "1098";
@@ -30,16 +29,6 @@ namespace Microsoft.Interop.Analyzers
             return new LocalizableResourceString(resourceName, SR.ResourceManager, typeof(FxResources.Microsoft.Interop.ComInterfaceGenerator.SR));
         }
 
-        public static readonly DiagnosticDescriptor InterfaceTypeNotSupported =
-            new DiagnosticDescriptor(
-                Ids.InvalidGeneratedComAttributeUsage,
-                GetResourceString(nameof(SR.InterfaceTypeNotSupportedTitle)),
-                GetResourceString(nameof(SR.InterfaceTypeNotSupportedMessage)),
-                Category,
-                DiagnosticSeverity.Error,
-                isEnabledByDefault: true,
-                description: GetResourceString(nameof(SR.InterfaceTypeNotSupportedMessage)));
-
         public static readonly DiagnosticDescriptor ConvertToGeneratedComInterface =
             new DiagnosticDescriptor(
                 Ids.ConvertToGeneratedComInterface,
index f3fecba..962d568 100644 (file)
@@ -18,7 +18,7 @@ namespace Microsoft.Interop.Analyzers
     public class GeneratedComInterfaceAttributeAnalyzer : DiagnosticAnalyzer
     {
         public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics { get; }
-            = ImmutableArray.Create(AnalyzerDiagnostics.InterfaceTypeNotSupported);
+            = ImmutableArray.Create(GeneratorDiagnostics.InterfaceTypeNotSupported);
 
         public static readonly ImmutableArray<ComInterfaceType> SupportedComInterfaceTypes = ImmutableArray.Create(ComInterfaceType.InterfaceIsIUnknown);
 
@@ -41,7 +41,7 @@ namespace Microsoft.Interop.Analyzers
                     && GetAttribute(typeSymbol, TypeNames.InterfaceTypeAttribute, out AttributeData? comInterfaceAttribute)
                     && !InterfaceTypeAttributeIsSupported(comInterfaceAttribute, out string unsupportedValue))
                 {
-                    context.ReportDiagnostic(comInterfaceAttribute.CreateDiagnosticInfo(AnalyzerDiagnostics.InterfaceTypeNotSupported, unsupportedValue).ToDiagnostic());
+                    context.ReportDiagnostic(comInterfaceAttribute.CreateDiagnosticInfo(GeneratorDiagnostics.InterfaceTypeNotSupported, unsupportedValue).ToDiagnostic());
                 }
             }, SymbolKind.NamedType);
         }
index 54b0864..f583ab6 100644 (file)
@@ -44,14 +44,14 @@ namespace Microsoft.Interop
                 }
             }
 
-            // Verify that the types the method is declared in are marked partial.
-            for (SyntaxNode? parentNode = syntax.Parent; parentNode is TypeDeclarationSyntax typeDecl; parentNode = parentNode.Parent)
+            // Verify that the types the interface is declared in are marked partial.
+            for (SyntaxNode? parentNode = syntax; parentNode is TypeDeclarationSyntax typeDecl; parentNode = parentNode.Parent)
             {
                 if (!typeDecl.Modifiers.Any(SyntaxKind.PartialKeyword))
                 {
                     return DiagnosticOrInterfaceInfo.From(
                         DiagnosticInfo.Create(
-                            GeneratorDiagnostics.InvalidAttributedMethodContainingTypeMissingModifiers,
+                            GeneratorDiagnostics.InvalidAttributedInterfaceMissingPartialModifiers,
                             syntax.Identifier.GetLocation(),
                             symbol.Name,
                             typeDecl.Identifier));
index 2fb9426..4c8cd8a 100644 (file)
@@ -69,8 +69,8 @@ namespace Microsoft.Interop
             // [GeneratedComInterface] attribute.
             // This restriction not only makes finding the syntax for a given method cheaper,
             // but it also enables us to ensure that we can determine vtable method order easily.
-            CodeAnalysis.Location interfaceLocation = ifaceContext.Declaration.GetLocation();
-            CodeAnalysis.Location? methodLocationInAttributedInterfaceDeclaration = null;
+            Location interfaceLocation = ifaceContext.Declaration.GetLocation();
+            Location? methodLocationInAttributedInterfaceDeclaration = null;
             foreach (var methodLocation in method.Locations)
             {
                 if (methodLocation.SourceTree == interfaceLocation.SourceTree
@@ -92,7 +92,6 @@ namespace Microsoft.Interop
             foreach (var declaringSyntaxReference in method.DeclaringSyntaxReferences)
             {
                 var declaringSyntax = declaringSyntaxReference.GetSyntax(ct);
-                Debug.Assert(declaringSyntax.IsKind(SyntaxKind.MethodDeclaration));
                 if (declaringSyntax.GetLocation().SourceSpan.Contains(methodLocationInAttributedInterfaceDeclaration.SourceSpan))
                 {
                     comMethodDeclaringSyntax = (MethodDeclarationSyntax)declaringSyntax;
index f02a6c2..9d77ff7 100644 (file)
@@ -20,11 +20,12 @@ namespace Microsoft.Interop
             public const string InvalidLibraryImportAttributeUsage = Prefix + "1050";
             public const string TypeNotSupported = Prefix + "1051";
             public const string ConfigurationNotSupported = Prefix + "1052";
+            public const string InvalidGeneratedComInterfaceAttributeUsage = Prefix + "1090";
             public const string MethodNotDeclaredInAttributedInterface = Prefix + "1091";
-            public const string InvalidGeneratedComInterfaceAttributeUsage = Prefix + "1092";
-            public const string MultipleComInterfaceBaseTypes = Prefix + "1093";
-            public const string AnalysisFailed = Prefix + "1094";
-            public const string BaseInterfaceFailedGeneration = Prefix + "1095";
+            public const string MultipleComInterfaceBaseTypes = Prefix + "1092";
+            public const string AnalysisFailed = Prefix + "1093";
+            public const string BaseInterfaceFailedGeneration = Prefix + "1094";
+            public const string InvalidGeneratedComClassAttributeUsage = Prefix + "1095";
         }
 
         private const string Category = "ComInterfaceGenerator";
@@ -51,6 +52,17 @@ namespace Microsoft.Interop
             isEnabledByDefault: true,
             description: GetResourceString(nameof(SR.InvalidAttributedMethodDescription)));
 
+        /// <inheritdoc cref="SR.InvalidGeneratedComInterfaceUsageMissingPartialModifier"/>
+        public static readonly DiagnosticDescriptor InvalidAttributedInterfaceMissingPartialModifiers =
+            new DiagnosticDescriptor(
+            Ids.InvalidGeneratedComInterfaceAttributeUsage,
+            GetResourceString(nameof(SR.InvalidGeneratedComInterfaceAttributeUsageTitle)),
+            GetResourceString(nameof(SR.InvalidGeneratedComInterfaceUsageMissingPartialModifier)),
+            Category,
+            DiagnosticSeverity.Error,
+            isEnabledByDefault: true,
+            description: GetResourceString(nameof(SR.InvalidGeneratedComInterfaceAttributeUsageDescription)));
+
         /// <inheritdoc cref="SR.InvalidAttributedMethodContainingTypeMissingUnmanagedObjectUnwrapperAttributeMessage"/>
         public static readonly DiagnosticDescriptor InvalidAttributedMethodContainingTypeMissingUnmanagedObjectUnwrapperAttribute =
             new DiagnosticDescriptor(
@@ -282,6 +294,28 @@ namespace Microsoft.Interop
                 isEnabledByDefault: true,
                 description: GetResourceString(nameof(SR.BaseInterfaceCannotBeGeneratedDescription)));
 
+        /// <inheritdoc cref="SR.InvalidGeneratedComClassAttributeUsageMissingPartialModifier"/>
+        public static readonly DiagnosticDescriptor InvalidAttributedClassMissingPartialModifier =
+            new DiagnosticDescriptor(
+                Ids.InvalidGeneratedComClassAttributeUsage,
+                GetResourceString(nameof(SR.InvalidGeneratedComClassAttributeUsageTitle)),
+                GetResourceString(nameof(SR.InvalidGeneratedComClassAttributeUsageMissingPartialModifier)),
+                Category,
+                DiagnosticSeverity.Error,
+                isEnabledByDefault: true,
+                description: GetResourceString(nameof(SR.InvalidGeneratedComClassAttributeUsageDescription)));
+
+        /// <inheritdoc cref="SR.InterfaceTypeNotSupportedMessage"/>
+        public static readonly DiagnosticDescriptor InterfaceTypeNotSupported =
+            new DiagnosticDescriptor(
+                Ids.InvalidGeneratedComInterfaceAttributeUsage,
+                GetResourceString(nameof(SR.InterfaceTypeNotSupportedTitle)),
+                GetResourceString(nameof(SR.InterfaceTypeNotSupportedMessage)),
+                Category,
+                DiagnosticSeverity.Error,
+                isEnabledByDefault: true,
+                description: GetResourceString(nameof(SR.InterfaceTypeNotSupportedMessage)));
+
         private readonly List<DiagnosticInfo> _diagnostics = new List<DiagnosticInfo>();
 
         public IEnumerable<DiagnosticInfo> Diagnostics => _diagnostics;
index b1660ff..9977853 100644 (file)
@@ -1,17 +1,17 @@
 <?xml version="1.0" encoding="utf-8"?>
 <root>
-  <!-- 
-    Microsoft ResX Schema 
-    
+  <!--
+    Microsoft ResX Schema
+
     Version 2.0
-    
-    The primary goals of this format is to allow a simple XML format 
-    that is mostly human readable. The generation and parsing of the 
-    various data types are done through the TypeConverter classes 
+
+    The primary goals of this format is to allow a simple XML format
+    that is mostly human readable. The generation and parsing of the
+    various data types are done through the TypeConverter classes
     associated with the data types.
-    
+
     Example:
-    
+
     ... ado.net/XML headers & schema ...
     <resheader name="resmimetype">text/microsoft-resx</resheader>
     <resheader name="version">2.0</resheader>
         <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
         <comment>This is a comment</comment>
     </data>
-                
-    There are any number of "resheader" rows that contain simple 
+
+    There are any number of "resheader" rows that contain simple
     name/value pairs.
-    
-    Each data row contains a name, and value. The row also contains a 
-    type or mimetype. Type corresponds to a .NET class that support 
-    text/value conversion through the TypeConverter architecture. 
-    Classes that don't support this are serialized and stored with the 
+
+    Each data row contains a name, and value. The row also contains a
+    type or mimetype. Type corresponds to a .NET class that support
+    text/value conversion through the TypeConverter architecture.
+    Classes that don't support this are serialized and stored with the
     mimetype set.
-    
-    The mimetype is used for serialized objects, and tells the 
-    ResXResourceReader how to depersist the object. This is currently not 
+
+    The mimetype is used for serialized objects, and tells the
+    ResXResourceReader how to depersist the object. This is currently not
     extensible. For a given mimetype the value must be set accordingly:
-    
-    Note - application/x-microsoft.net.object.binary.base64 is the format 
-    that the ResXResourceWriter will generate, however the reader can 
+
+    Note - application/x-microsoft.net.object.binary.base64 is the format
+    that the ResXResourceWriter will generate, however the reader can
     read any of the formats listed below.
-    
+
     mimetype: application/x-microsoft.net.object.binary.base64
-    value   : The object must be serialized with 
+    value   : The object must be serialized with
             : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
             : and then encoded with base64 encoding.
-    
+
     mimetype: application/x-microsoft.net.object.soap.base64
-    value   : The object must be serialized with 
+    value   : The object must be serialized with
             : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
             : and then encoded with base64 encoding.
 
     mimetype: application/x-microsoft.net.object.bytearray.base64
-    value   : The object must be serialized into a byte array 
+    value   : The object must be serialized into a byte array
             : using a System.ComponentModel.TypeConverter
             : and then encoded with base64 encoding.
     -->
     <value>Analysis of method '{0}' has failed. ComInterfaceGenerator will not generate code for this method.</value>
   </data>
   <data name="AnalysisFailedTitle" xml:space="preserve">
-    <value>Analysis for generation has failed.</value>
+    <value>Analysis for COM interface generation has failed.</value>
   </data>
   <data name="GeneratedComInterfaceStringMarshallingMustMatchBase" xml:space="preserve">
     <value>The configuration of 'StringMarshalling' and 'StringMarshallingCustomType' must match the base COM interface.</value>
     <value>COM interface {0} inherits from {1}, which has errors. ComInterfaceGenerator will not generate source for {0}.</value>
   </data>
   <data name="BaseInterfaceCannotBeGeneratedTitle" xml:space="preserve">
-    <value>The base COM interface failed to generate source. ComInterfaceGenerator will not generate source for this interface.</value>
+    <value>The base COM interface failed to generate source. Code will not be generated for this interface.</value>
   </data>
   <data name="InvalidStringMarshallingConfigurationOnInterfaceMessage" xml:space="preserve">
     <value>The configuration of 'StringMarshalling' and 'StringMarshallingCustomType' on interface '{0}' is invalid. {1}</value>
   </data>
+  <data name="InvalidGeneratedComInterfaceUsageMissingPartialModifier" xml:space="preserve">
+    <value>The interface '{0}' or one of its containing types is missing the 'partial' keyword. Code will not be generated for '{0}'.</value>
+  </data>
+  <data name="InvalidGeneratedComClassAttributeUsageDescription" xml:space="preserve">
+    <value>Classes with 'GeneratedComClassAttribute' must implement one or more interfaces with 'GeneratedComInterfaceAttribute', be marked partial, and be non-generic.</value>
+  </data>
+  <data name="InvalidGeneratedComClassAttributeUsageMissingPartialModifier" xml:space="preserve">
+    <value>Class '{0}' or one of its containing types is not marked 'partial'.</value>
+  </data>
+  <data name="InvalidGeneratedComClassAttributeUsageTitle" xml:space="preserve">
+    <value>Invalid 'GeneratedComClassAttribute' usage</value>
+  </data>
   <data name="ConvertToGeneratedComInterfaceDescription" xml:space="preserve">
     <value>Use 'GeneratedComInterfaceAttribute' instead of 'ComImportAttribute' to generate COM marshalling code at compile time</value>
   </data>
   <data name="ConvertComInterfaceMayProduceInvalidCode" xml:space="preserve">
     <value>Converting this interface to use 'GeneratedComInterfaceAttribute' may produce invalid code and may require additional work</value>
   </data>
-</root>
\ No newline at end of file
+</root>
index 0194951..640637e 100644 (file)
@@ -38,8 +38,8 @@
         <note />
       </trans-unit>
       <trans-unit id="AnalysisFailedTitle">
-        <source>Analysis for generation has failed.</source>
-        <target state="translated">Analýza pro generování se nezdařila</target>
+        <source>Analysis for COM interface generation has failed.</source>
+        <target state="needs-review-translation">Analýza pro generování se nezdařila</target>
         <note />
       </trans-unit>
       <trans-unit id="BaseInterfaceCannotBeGeneratedDescription">
@@ -53,8 +53,8 @@
         <note />
       </trans-unit>
       <trans-unit id="BaseInterfaceCannotBeGeneratedTitle">
-        <source>The base COM interface failed to generate source. ComInterfaceGenerator will not generate source for this interface.</source>
-        <target state="translated">Základnímu rozhraní COM se nepodařilo vygenerovat zdroj. ComInterfaceGenerator nevygeneruje zdroj pro toto rozhraní.</target>
+        <source>The base COM interface failed to generate source. Code will not be generated for this interface.</source>
+        <target state="needs-review-translation">Základnímu rozhraní COM se nepodařilo vygenerovat zdroj. ComInterfaceGenerator nevygeneruje zdroj pro toto rozhraní.</target>
         <note />
       </trans-unit>
       <trans-unit id="ComHostingDoesNotSupportGeneratedComInterfaceDescription">
         <target state="translated">Zadaná hodnota není známý příznak výčtu ExceptionMarsnuming.</target>
         <note />
       </trans-unit>
+      <trans-unit id="InvalidGeneratedComClassAttributeUsageDescription">
+        <source>Classes with 'GeneratedComClassAttribute' must implement one or more interfaces with 'GeneratedComInterfaceAttribute', be marked partial, and be non-generic.</source>
+        <target state="new">Classes with 'GeneratedComClassAttribute' must implement one or more interfaces with 'GeneratedComInterfaceAttribute', be marked partial, and be non-generic.</target>
+        <note />
+      </trans-unit>
+      <trans-unit id="InvalidGeneratedComClassAttributeUsageMissingPartialModifier">
+        <source>Class '{0}' or one of its containing types is not marked 'partial'.</source>
+        <target state="new">Class '{0}' or one of its containing types is not marked 'partial'.</target>
+        <note />
+      </trans-unit>
+      <trans-unit id="InvalidGeneratedComClassAttributeUsageTitle">
+        <source>Invalid 'GeneratedComClassAttribute' usage</source>
+        <target state="new">Invalid 'GeneratedComClassAttribute' usage</target>
+        <note />
+      </trans-unit>
       <trans-unit id="InvalidGeneratedComInterfaceAttributeUsageDescription">
         <source>Interfaces attributed with 'GeneratedComInterfaceAttribute' must be partial, non-generic, and must specify a GUID with 'System.Runtime.InteropServices.GuidAttribute'.</source>
         <target state="translated">Rozhraní s atributem GeneratedComInterfaceAttribute musí být částečná, neobecná a musí určovat identifikátor GUID s atributem System.Runtime.InteropServices.GuidAttribute.</target>
         <target state="translated">Neplatné použití atributu GeneratedComInterfaceAttribute</target>
         <note />
       </trans-unit>
+      <trans-unit id="InvalidGeneratedComInterfaceUsageMissingPartialModifier">
+        <source>The interface '{0}' or one of its containing types is missing the 'partial' keyword. Code will not be generated for '{0}'.</source>
+        <target state="new">The interface '{0}' or one of its containing types is missing the 'partial' keyword. Code will not be generated for '{0}'.</target>
+        <note />
+      </trans-unit>
       <trans-unit id="InvalidStringMarshallingConfigurationDescription">
         <source>The configuration of 'StringMarshalling' and 'StringMarshallingCustomType' is invalid.</source>
         <target state="translated">Konfigurace StringMarshalling a StringMarshallingCustomType je neplatná.</target>
index b1f1441..c0d3124 100644 (file)
@@ -38,8 +38,8 @@
         <note />
       </trans-unit>
       <trans-unit id="AnalysisFailedTitle">
-        <source>Analysis for generation has failed.</source>
-        <target state="translated">Fehler bei der Analyse für die Generierung.</target>
+        <source>Analysis for COM interface generation has failed.</source>
+        <target state="needs-review-translation">Fehler bei der Analyse für die Generierung.</target>
         <note />
       </trans-unit>
       <trans-unit id="BaseInterfaceCannotBeGeneratedDescription">
@@ -53,8 +53,8 @@
         <note />
       </trans-unit>
       <trans-unit id="BaseInterfaceCannotBeGeneratedTitle">
-        <source>The base COM interface failed to generate source. ComInterfaceGenerator will not generate source for this interface.</source>
-        <target state="translated">Die Basis-COM-Schnittstelle konnte die Quelle nicht generieren. ComInterfaceGenerator generiert keine Quelle für diese Schnittstelle.</target>
+        <source>The base COM interface failed to generate source. Code will not be generated for this interface.</source>
+        <target state="needs-review-translation">Die Basis-COM-Schnittstelle konnte die Quelle nicht generieren. ComInterfaceGenerator generiert keine Quelle für diese Schnittstelle.</target>
         <note />
       </trans-unit>
       <trans-unit id="ComHostingDoesNotSupportGeneratedComInterfaceDescription">
         <target state="translated">Der angegebene Wert ist kein bekanntes Flag der „ExceptionMarshalling“-Enumeration.</target>
         <note />
       </trans-unit>
+      <trans-unit id="InvalidGeneratedComClassAttributeUsageDescription">
+        <source>Classes with 'GeneratedComClassAttribute' must implement one or more interfaces with 'GeneratedComInterfaceAttribute', be marked partial, and be non-generic.</source>
+        <target state="new">Classes with 'GeneratedComClassAttribute' must implement one or more interfaces with 'GeneratedComInterfaceAttribute', be marked partial, and be non-generic.</target>
+        <note />
+      </trans-unit>
+      <trans-unit id="InvalidGeneratedComClassAttributeUsageMissingPartialModifier">
+        <source>Class '{0}' or one of its containing types is not marked 'partial'.</source>
+        <target state="new">Class '{0}' or one of its containing types is not marked 'partial'.</target>
+        <note />
+      </trans-unit>
+      <trans-unit id="InvalidGeneratedComClassAttributeUsageTitle">
+        <source>Invalid 'GeneratedComClassAttribute' usage</source>
+        <target state="new">Invalid 'GeneratedComClassAttribute' usage</target>
+        <note />
+      </trans-unit>
       <trans-unit id="InvalidGeneratedComInterfaceAttributeUsageDescription">
         <source>Interfaces attributed with 'GeneratedComInterfaceAttribute' must be partial, non-generic, and must specify a GUID with 'System.Runtime.InteropServices.GuidAttribute'.</source>
         <target state="translated">Schnittstellen, die mit "GeneratedComInterfaceAttribute" attributiert sind, müssen partielle, nicht generische Schnittstellen sein und eine GUID mit "System.Runtime.InteropServices.GuidAttribute" angeben.</target>
         <target state="translated">Ungültige Verwendung von „GeneratedComInterfaceAttribute“.</target>
         <note />
       </trans-unit>
+      <trans-unit id="InvalidGeneratedComInterfaceUsageMissingPartialModifier">
+        <source>The interface '{0}' or one of its containing types is missing the 'partial' keyword. Code will not be generated for '{0}'.</source>
+        <target state="new">The interface '{0}' or one of its containing types is missing the 'partial' keyword. Code will not be generated for '{0}'.</target>
+        <note />
+      </trans-unit>
       <trans-unit id="InvalidStringMarshallingConfigurationDescription">
         <source>The configuration of 'StringMarshalling' and 'StringMarshallingCustomType' is invalid.</source>
         <target state="translated">Die Konfiguration von \"StringMarshalling\" und \"StringMarshallingCustomType\" ist ungültig.</target>
index 3fa88a7..fb2702b 100644 (file)
@@ -38,8 +38,8 @@
         <note />
       </trans-unit>
       <trans-unit id="AnalysisFailedTitle">
-        <source>Analysis for generation has failed.</source>
-        <target state="translated">Error en el análisis de generación.</target>
+        <source>Analysis for COM interface generation has failed.</source>
+        <target state="needs-review-translation">Error en el análisis de generación.</target>
         <note />
       </trans-unit>
       <trans-unit id="BaseInterfaceCannotBeGeneratedDescription">
@@ -53,8 +53,8 @@
         <note />
       </trans-unit>
       <trans-unit id="BaseInterfaceCannotBeGeneratedTitle">
-        <source>The base COM interface failed to generate source. ComInterfaceGenerator will not generate source for this interface.</source>
-        <target state="translated">La interfaz COM base no pudo generar el origen. ComInterfaceGenerator no generará el origen para esta interfaz.</target>
+        <source>The base COM interface failed to generate source. Code will not be generated for this interface.</source>
+        <target state="needs-review-translation">La interfaz COM base no pudo generar el origen. ComInterfaceGenerator no generará el origen para esta interfaz.</target>
         <note />
       </trans-unit>
       <trans-unit id="ComHostingDoesNotSupportGeneratedComInterfaceDescription">
         <target state="translated">El valor proporcionado no es una marca conocida de la enumeración “ExceptionMarshalling”.</target>
         <note />
       </trans-unit>
+      <trans-unit id="InvalidGeneratedComClassAttributeUsageDescription">
+        <source>Classes with 'GeneratedComClassAttribute' must implement one or more interfaces with 'GeneratedComInterfaceAttribute', be marked partial, and be non-generic.</source>
+        <target state="new">Classes with 'GeneratedComClassAttribute' must implement one or more interfaces with 'GeneratedComInterfaceAttribute', be marked partial, and be non-generic.</target>
+        <note />
+      </trans-unit>
+      <trans-unit id="InvalidGeneratedComClassAttributeUsageMissingPartialModifier">
+        <source>Class '{0}' or one of its containing types is not marked 'partial'.</source>
+        <target state="new">Class '{0}' or one of its containing types is not marked 'partial'.</target>
+        <note />
+      </trans-unit>
+      <trans-unit id="InvalidGeneratedComClassAttributeUsageTitle">
+        <source>Invalid 'GeneratedComClassAttribute' usage</source>
+        <target state="new">Invalid 'GeneratedComClassAttribute' usage</target>
+        <note />
+      </trans-unit>
       <trans-unit id="InvalidGeneratedComInterfaceAttributeUsageDescription">
         <source>Interfaces attributed with 'GeneratedComInterfaceAttribute' must be partial, non-generic, and must specify a GUID with 'System.Runtime.InteropServices.GuidAttribute'.</source>
         <target state="translated">Las interfaces con el atributo “GeneratedComInterfaceAttribute” deben ser parciales, no genéricas y deben especificar un GUID con “System.Runtime.InteropServices.GuidAttribute”.</target>
         <target state="translated">Uso de 'GeneratedComInterfaceAttribute' no válido.</target>
         <note />
       </trans-unit>
+      <trans-unit id="InvalidGeneratedComInterfaceUsageMissingPartialModifier">
+        <source>The interface '{0}' or one of its containing types is missing the 'partial' keyword. Code will not be generated for '{0}'.</source>
+        <target state="new">The interface '{0}' or one of its containing types is missing the 'partial' keyword. Code will not be generated for '{0}'.</target>
+        <note />
+      </trans-unit>
       <trans-unit id="InvalidStringMarshallingConfigurationDescription">
         <source>The configuration of 'StringMarshalling' and 'StringMarshallingCustomType' is invalid.</source>
         <target state="translated">La configuración de “StringMarshalling” y “StringMarshallingCustomType” no es válida.</target>
index e76c3db..9fb27aa 100644 (file)
@@ -38,8 +38,8 @@
         <note />
       </trans-unit>
       <trans-unit id="AnalysisFailedTitle">
-        <source>Analysis for generation has failed.</source>
-        <target state="translated">Échec de l’analyse de la génération.</target>
+        <source>Analysis for COM interface generation has failed.</source>
+        <target state="needs-review-translation">Échec de l’analyse de la génération.</target>
         <note />
       </trans-unit>
       <trans-unit id="BaseInterfaceCannotBeGeneratedDescription">
@@ -53,8 +53,8 @@
         <note />
       </trans-unit>
       <trans-unit id="BaseInterfaceCannotBeGeneratedTitle">
-        <source>The base COM interface failed to generate source. ComInterfaceGenerator will not generate source for this interface.</source>
-        <target state="translated">L’interface COM de base n’a pas pu générer la source. ComInterfaceGenerator ne génère pas de source pour cette interface.</target>
+        <source>The base COM interface failed to generate source. Code will not be generated for this interface.</source>
+        <target state="needs-review-translation">L’interface COM de base n’a pas pu générer la source. ComInterfaceGenerator ne génère pas de source pour cette interface.</target>
         <note />
       </trans-unit>
       <trans-unit id="ComHostingDoesNotSupportGeneratedComInterfaceDescription">
         <target state="translated">La valeur fournie n’est pas un indicateur connu de l’énumération « ExceptionMarshalling ».</target>
         <note />
       </trans-unit>
+      <trans-unit id="InvalidGeneratedComClassAttributeUsageDescription">
+        <source>Classes with 'GeneratedComClassAttribute' must implement one or more interfaces with 'GeneratedComInterfaceAttribute', be marked partial, and be non-generic.</source>
+        <target state="new">Classes with 'GeneratedComClassAttribute' must implement one or more interfaces with 'GeneratedComInterfaceAttribute', be marked partial, and be non-generic.</target>
+        <note />
+      </trans-unit>
+      <trans-unit id="InvalidGeneratedComClassAttributeUsageMissingPartialModifier">
+        <source>Class '{0}' or one of its containing types is not marked 'partial'.</source>
+        <target state="new">Class '{0}' or one of its containing types is not marked 'partial'.</target>
+        <note />
+      </trans-unit>
+      <trans-unit id="InvalidGeneratedComClassAttributeUsageTitle">
+        <source>Invalid 'GeneratedComClassAttribute' usage</source>
+        <target state="new">Invalid 'GeneratedComClassAttribute' usage</target>
+        <note />
+      </trans-unit>
       <trans-unit id="InvalidGeneratedComInterfaceAttributeUsageDescription">
         <source>Interfaces attributed with 'GeneratedComInterfaceAttribute' must be partial, non-generic, and must specify a GUID with 'System.Runtime.InteropServices.GuidAttribute'.</source>
         <target state="translated">Les interfaces sont attribuées à « GeneratedComInterfaceAttribute » doivent être partielles, non génériques et doivent spécifier un GUID avec « System.Runtime.InteropServices.GuidAttribute ».</target>
         <target state="translated">Utilisation de « GeneratedComInterfaceAttribute » non valide.</target>
         <note />
       </trans-unit>
+      <trans-unit id="InvalidGeneratedComInterfaceUsageMissingPartialModifier">
+        <source>The interface '{0}' or one of its containing types is missing the 'partial' keyword. Code will not be generated for '{0}'.</source>
+        <target state="new">The interface '{0}' or one of its containing types is missing the 'partial' keyword. Code will not be generated for '{0}'.</target>
+        <note />
+      </trans-unit>
       <trans-unit id="InvalidStringMarshallingConfigurationDescription">
         <source>The configuration of 'StringMarshalling' and 'StringMarshallingCustomType' is invalid.</source>
         <target state="translated">La configuration de « StringMarshalling » et de « StringMarshallingCustomType » n’est pas valide.</target>
index 5806cfc..39f5e4b 100644 (file)
@@ -38,8 +38,8 @@
         <note />
       </trans-unit>
       <trans-unit id="AnalysisFailedTitle">
-        <source>Analysis for generation has failed.</source>
-        <target state="translated">L'analisi per la generazione non è riuscita.</target>
+        <source>Analysis for COM interface generation has failed.</source>
+        <target state="needs-review-translation">L'analisi per la generazione non è riuscita.</target>
         <note />
       </trans-unit>
       <trans-unit id="BaseInterfaceCannotBeGeneratedDescription">
@@ -53,8 +53,8 @@
         <note />
       </trans-unit>
       <trans-unit id="BaseInterfaceCannotBeGeneratedTitle">
-        <source>The base COM interface failed to generate source. ComInterfaceGenerator will not generate source for this interface.</source>
-        <target state="translated">L'interfaccia COM di base non è riuscita a generare l'origine. ComInterfaceGenerator non genererà l'origine per questa interfaccia.</target>
+        <source>The base COM interface failed to generate source. Code will not be generated for this interface.</source>
+        <target state="needs-review-translation">L'interfaccia COM di base non è riuscita a generare l'origine. ComInterfaceGenerator non genererà l'origine per questa interfaccia.</target>
         <note />
       </trans-unit>
       <trans-unit id="ComHostingDoesNotSupportGeneratedComInterfaceDescription">
         <target state="translated">Il valore specificato non è un flag noto dell'enumerazione 'ExceptionMarshalling'.</target>
         <note />
       </trans-unit>
+      <trans-unit id="InvalidGeneratedComClassAttributeUsageDescription">
+        <source>Classes with 'GeneratedComClassAttribute' must implement one or more interfaces with 'GeneratedComInterfaceAttribute', be marked partial, and be non-generic.</source>
+        <target state="new">Classes with 'GeneratedComClassAttribute' must implement one or more interfaces with 'GeneratedComInterfaceAttribute', be marked partial, and be non-generic.</target>
+        <note />
+      </trans-unit>
+      <trans-unit id="InvalidGeneratedComClassAttributeUsageMissingPartialModifier">
+        <source>Class '{0}' or one of its containing types is not marked 'partial'.</source>
+        <target state="new">Class '{0}' or one of its containing types is not marked 'partial'.</target>
+        <note />
+      </trans-unit>
+      <trans-unit id="InvalidGeneratedComClassAttributeUsageTitle">
+        <source>Invalid 'GeneratedComClassAttribute' usage</source>
+        <target state="new">Invalid 'GeneratedComClassAttribute' usage</target>
+        <note />
+      </trans-unit>
       <trans-unit id="InvalidGeneratedComInterfaceAttributeUsageDescription">
         <source>Interfaces attributed with 'GeneratedComInterfaceAttribute' must be partial, non-generic, and must specify a GUID with 'System.Runtime.InteropServices.GuidAttribute'.</source>
         <target state="translated">Le interfacce con attributo 'GeneratedComInterfaceAttribute' devono essere parziali, non generiche e devono specificare un GUID con 'System.Runtime.InteropServices.GuidAttribute'.</target>
         <target state="translated">Utilizzo di 'GeneratedComInterfaceAttribute' non valido.</target>
         <note />
       </trans-unit>
+      <trans-unit id="InvalidGeneratedComInterfaceUsageMissingPartialModifier">
+        <source>The interface '{0}' or one of its containing types is missing the 'partial' keyword. Code will not be generated for '{0}'.</source>
+        <target state="new">The interface '{0}' or one of its containing types is missing the 'partial' keyword. Code will not be generated for '{0}'.</target>
+        <note />
+      </trans-unit>
       <trans-unit id="InvalidStringMarshallingConfigurationDescription">
         <source>The configuration of 'StringMarshalling' and 'StringMarshallingCustomType' is invalid.</source>
         <target state="translated">La configurazione di 'StringMarshalling' e 'StringMarshallingCustomType' non è valida.</target>
index 8765737..7e1a209 100644 (file)
@@ -38,8 +38,8 @@
         <note />
       </trans-unit>
       <trans-unit id="AnalysisFailedTitle">
-        <source>Analysis for generation has failed.</source>
-        <target state="translated">生成の分析に失敗しました。</target>
+        <source>Analysis for COM interface generation has failed.</source>
+        <target state="needs-review-translation">生成の分析に失敗しました。</target>
         <note />
       </trans-unit>
       <trans-unit id="BaseInterfaceCannotBeGeneratedDescription">
@@ -53,8 +53,8 @@
         <note />
       </trans-unit>
       <trans-unit id="BaseInterfaceCannotBeGeneratedTitle">
-        <source>The base COM interface failed to generate source. ComInterfaceGenerator will not generate source for this interface.</source>
-        <target state="translated">ベース COM インターフェイスはソースを生成できませんでした。ComInterfaceGenerator は、このインターフェイスのソースを生成しません。</target>
+        <source>The base COM interface failed to generate source. Code will not be generated for this interface.</source>
+        <target state="needs-review-translation">ベース COM インターフェイスはソースを生成できませんでした。ComInterfaceGenerator は、このインターフェイスのソースを生成しません。</target>
         <note />
       </trans-unit>
       <trans-unit id="ComHostingDoesNotSupportGeneratedComInterfaceDescription">
         <target state="translated">指定された値は、'ExceptionMarshalling' 列挙型の既知のフラグではありません。</target>
         <note />
       </trans-unit>
+      <trans-unit id="InvalidGeneratedComClassAttributeUsageDescription">
+        <source>Classes with 'GeneratedComClassAttribute' must implement one or more interfaces with 'GeneratedComInterfaceAttribute', be marked partial, and be non-generic.</source>
+        <target state="new">Classes with 'GeneratedComClassAttribute' must implement one or more interfaces with 'GeneratedComInterfaceAttribute', be marked partial, and be non-generic.</target>
+        <note />
+      </trans-unit>
+      <trans-unit id="InvalidGeneratedComClassAttributeUsageMissingPartialModifier">
+        <source>Class '{0}' or one of its containing types is not marked 'partial'.</source>
+        <target state="new">Class '{0}' or one of its containing types is not marked 'partial'.</target>
+        <note />
+      </trans-unit>
+      <trans-unit id="InvalidGeneratedComClassAttributeUsageTitle">
+        <source>Invalid 'GeneratedComClassAttribute' usage</source>
+        <target state="new">Invalid 'GeneratedComClassAttribute' usage</target>
+        <note />
+      </trans-unit>
       <trans-unit id="InvalidGeneratedComInterfaceAttributeUsageDescription">
         <source>Interfaces attributed with 'GeneratedComInterfaceAttribute' must be partial, non-generic, and must specify a GUID with 'System.Runtime.InteropServices.GuidAttribute'.</source>
         <target state="translated">'GeneratedComInterfaceAttribute' の属性を持つインターフェイスは部分的で、非ジェネリックである必要があり、'System.Runtime.InteropServices.GuidAttribute' で GUID を指定する必要があります。</target>
         <target state="translated">'GeneratedComInterfaceAttribute' の使用法が無効です。</target>
         <note />
       </trans-unit>
+      <trans-unit id="InvalidGeneratedComInterfaceUsageMissingPartialModifier">
+        <source>The interface '{0}' or one of its containing types is missing the 'partial' keyword. Code will not be generated for '{0}'.</source>
+        <target state="new">The interface '{0}' or one of its containing types is missing the 'partial' keyword. Code will not be generated for '{0}'.</target>
+        <note />
+      </trans-unit>
       <trans-unit id="InvalidStringMarshallingConfigurationDescription">
         <source>The configuration of 'StringMarshalling' and 'StringMarshallingCustomType' is invalid.</source>
         <target state="translated">'StringMarshalling' と 'StringMarshallingCustomType' の構成が無効です。</target>
index 2062b2f..56e0539 100644 (file)
@@ -38,8 +38,8 @@
         <note />
       </trans-unit>
       <trans-unit id="AnalysisFailedTitle">
-        <source>Analysis for generation has failed.</source>
-        <target state="translated">생성에 필요한 분석이 실패했습니다.</target>
+        <source>Analysis for COM interface generation has failed.</source>
+        <target state="needs-review-translation">생성에 필요한 분석이 실패했습니다.</target>
         <note />
       </trans-unit>
       <trans-unit id="BaseInterfaceCannotBeGeneratedDescription">
@@ -53,8 +53,8 @@
         <note />
       </trans-unit>
       <trans-unit id="BaseInterfaceCannotBeGeneratedTitle">
-        <source>The base COM interface failed to generate source. ComInterfaceGenerator will not generate source for this interface.</source>
-        <target state="translated">기본 COM 인터페이스에서 원본을 생성하지 못했습니다. ComInterfaceGenerator는 이 인터페이스에 대한 원본을 생성하지 않습니다.</target>
+        <source>The base COM interface failed to generate source. Code will not be generated for this interface.</source>
+        <target state="needs-review-translation">기본 COM 인터페이스에서 원본을 생성하지 못했습니다. ComInterfaceGenerator는 이 인터페이스에 대한 원본을 생성하지 않습니다.</target>
         <note />
       </trans-unit>
       <trans-unit id="ComHostingDoesNotSupportGeneratedComInterfaceDescription">
         <target state="translated">제공된 값은 'ExceptionMarshalling' 열거형의 알려진 플래그가 아닙니다.</target>
         <note />
       </trans-unit>
+      <trans-unit id="InvalidGeneratedComClassAttributeUsageDescription">
+        <source>Classes with 'GeneratedComClassAttribute' must implement one or more interfaces with 'GeneratedComInterfaceAttribute', be marked partial, and be non-generic.</source>
+        <target state="new">Classes with 'GeneratedComClassAttribute' must implement one or more interfaces with 'GeneratedComInterfaceAttribute', be marked partial, and be non-generic.</target>
+        <note />
+      </trans-unit>
+      <trans-unit id="InvalidGeneratedComClassAttributeUsageMissingPartialModifier">
+        <source>Class '{0}' or one of its containing types is not marked 'partial'.</source>
+        <target state="new">Class '{0}' or one of its containing types is not marked 'partial'.</target>
+        <note />
+      </trans-unit>
+      <trans-unit id="InvalidGeneratedComClassAttributeUsageTitle">
+        <source>Invalid 'GeneratedComClassAttribute' usage</source>
+        <target state="new">Invalid 'GeneratedComClassAttribute' usage</target>
+        <note />
+      </trans-unit>
       <trans-unit id="InvalidGeneratedComInterfaceAttributeUsageDescription">
         <source>Interfaces attributed with 'GeneratedComInterfaceAttribute' must be partial, non-generic, and must specify a GUID with 'System.Runtime.InteropServices.GuidAttribute'.</source>
         <target state="translated">'GeneratedComInterfaceAttribute'로 특성이 지정된 인터페이스는 부분적이고 제네릭이 아니어야 하며 'System.Runtime.InteropServices.GuidAttribute'를 사용하여 GUID를 지정해야 합니다.</target>
         <target state="translated">잘못된 'GeneratedComInterfaceAttribute' 사용법입니다.</target>
         <note />
       </trans-unit>
+      <trans-unit id="InvalidGeneratedComInterfaceUsageMissingPartialModifier">
+        <source>The interface '{0}' or one of its containing types is missing the 'partial' keyword. Code will not be generated for '{0}'.</source>
+        <target state="new">The interface '{0}' or one of its containing types is missing the 'partial' keyword. Code will not be generated for '{0}'.</target>
+        <note />
+      </trans-unit>
       <trans-unit id="InvalidStringMarshallingConfigurationDescription">
         <source>The configuration of 'StringMarshalling' and 'StringMarshallingCustomType' is invalid.</source>
         <target state="translated">'StringMarshalling' 및 'StringMarshallingCustomType'의 구성이 잘못되었습니다.</target>
index 62d7ce1..cbe9032 100644 (file)
@@ -38,8 +38,8 @@
         <note />
       </trans-unit>
       <trans-unit id="AnalysisFailedTitle">
-        <source>Analysis for generation has failed.</source>
-        <target state="translated">Analiza generowania nie powiodła się.</target>
+        <source>Analysis for COM interface generation has failed.</source>
+        <target state="needs-review-translation">Analiza generowania nie powiodła się.</target>
         <note />
       </trans-unit>
       <trans-unit id="BaseInterfaceCannotBeGeneratedDescription">
@@ -53,8 +53,8 @@
         <note />
       </trans-unit>
       <trans-unit id="BaseInterfaceCannotBeGeneratedTitle">
-        <source>The base COM interface failed to generate source. ComInterfaceGenerator will not generate source for this interface.</source>
-        <target state="translated">Podstawowy interfejs COM nie może wygenerować źródła. Program ComInterfaceGenerator nie wygeneruje źródła dla tego interfejsu.</target>
+        <source>The base COM interface failed to generate source. Code will not be generated for this interface.</source>
+        <target state="needs-review-translation">Podstawowy interfejs COM nie może wygenerować źródła. Program ComInterfaceGenerator nie wygeneruje źródła dla tego interfejsu.</target>
         <note />
       </trans-unit>
       <trans-unit id="ComHostingDoesNotSupportGeneratedComInterfaceDescription">
         <target state="translated">Podana wartość nie jest znaną flagą wyliczenia „'ExceptionMarshalling”.</target>
         <note />
       </trans-unit>
+      <trans-unit id="InvalidGeneratedComClassAttributeUsageDescription">
+        <source>Classes with 'GeneratedComClassAttribute' must implement one or more interfaces with 'GeneratedComInterfaceAttribute', be marked partial, and be non-generic.</source>
+        <target state="new">Classes with 'GeneratedComClassAttribute' must implement one or more interfaces with 'GeneratedComInterfaceAttribute', be marked partial, and be non-generic.</target>
+        <note />
+      </trans-unit>
+      <trans-unit id="InvalidGeneratedComClassAttributeUsageMissingPartialModifier">
+        <source>Class '{0}' or one of its containing types is not marked 'partial'.</source>
+        <target state="new">Class '{0}' or one of its containing types is not marked 'partial'.</target>
+        <note />
+      </trans-unit>
+      <trans-unit id="InvalidGeneratedComClassAttributeUsageTitle">
+        <source>Invalid 'GeneratedComClassAttribute' usage</source>
+        <target state="new">Invalid 'GeneratedComClassAttribute' usage</target>
+        <note />
+      </trans-unit>
       <trans-unit id="InvalidGeneratedComInterfaceAttributeUsageDescription">
         <source>Interfaces attributed with 'GeneratedComInterfaceAttribute' must be partial, non-generic, and must specify a GUID with 'System.Runtime.InteropServices.GuidAttribute'.</source>
         <target state="translated">Interfejsy z atrybutem „GeneratedComInterfaceAttribute” muszą być częściowe, nie być ogóle, i muszą określać identyfikator GUID z atrybutem „System.Runtime.InteropServices.GuidAttribute”.</target>
         <target state="translated">Nieprawidłowe użycie atrybutu „GeneratedComInterfaceAttribute”.</target>
         <note />
       </trans-unit>
+      <trans-unit id="InvalidGeneratedComInterfaceUsageMissingPartialModifier">
+        <source>The interface '{0}' or one of its containing types is missing the 'partial' keyword. Code will not be generated for '{0}'.</source>
+        <target state="new">The interface '{0}' or one of its containing types is missing the 'partial' keyword. Code will not be generated for '{0}'.</target>
+        <note />
+      </trans-unit>
       <trans-unit id="InvalidStringMarshallingConfigurationDescription">
         <source>The configuration of 'StringMarshalling' and 'StringMarshallingCustomType' is invalid.</source>
         <target state="translated">Konfiguracja elementów „StringMarshalling” i „StringMarshallingCustomType” jest nieprawidłowa.</target>
index 5486a45..48c7fdb 100644 (file)
@@ -38,8 +38,8 @@
         <note />
       </trans-unit>
       <trans-unit id="AnalysisFailedTitle">
-        <source>Analysis for generation has failed.</source>
-        <target state="translated">Falha na análise de geração.</target>
+        <source>Analysis for COM interface generation has failed.</source>
+        <target state="needs-review-translation">Falha na análise de geração.</target>
         <note />
       </trans-unit>
       <trans-unit id="BaseInterfaceCannotBeGeneratedDescription">
@@ -53,8 +53,8 @@
         <note />
       </trans-unit>
       <trans-unit id="BaseInterfaceCannotBeGeneratedTitle">
-        <source>The base COM interface failed to generate source. ComInterfaceGenerator will not generate source for this interface.</source>
-        <target state="translated">A interface COM base falhou ao gerar a fonte. ComInterfaceGenerator não irá gerar fonte para esta interface.</target>
+        <source>The base COM interface failed to generate source. Code will not be generated for this interface.</source>
+        <target state="needs-review-translation">A interface COM base falhou ao gerar a fonte. ComInterfaceGenerator não irá gerar fonte para esta interface.</target>
         <note />
       </trans-unit>
       <trans-unit id="ComHostingDoesNotSupportGeneratedComInterfaceDescription">
         <target state="translated">O valor fornecido não é um sinalizador conhecido da enumeração 'ExceptionMarshalling'.</target>
         <note />
       </trans-unit>
+      <trans-unit id="InvalidGeneratedComClassAttributeUsageDescription">
+        <source>Classes with 'GeneratedComClassAttribute' must implement one or more interfaces with 'GeneratedComInterfaceAttribute', be marked partial, and be non-generic.</source>
+        <target state="new">Classes with 'GeneratedComClassAttribute' must implement one or more interfaces with 'GeneratedComInterfaceAttribute', be marked partial, and be non-generic.</target>
+        <note />
+      </trans-unit>
+      <trans-unit id="InvalidGeneratedComClassAttributeUsageMissingPartialModifier">
+        <source>Class '{0}' or one of its containing types is not marked 'partial'.</source>
+        <target state="new">Class '{0}' or one of its containing types is not marked 'partial'.</target>
+        <note />
+      </trans-unit>
+      <trans-unit id="InvalidGeneratedComClassAttributeUsageTitle">
+        <source>Invalid 'GeneratedComClassAttribute' usage</source>
+        <target state="new">Invalid 'GeneratedComClassAttribute' usage</target>
+        <note />
+      </trans-unit>
       <trans-unit id="InvalidGeneratedComInterfaceAttributeUsageDescription">
         <source>Interfaces attributed with 'GeneratedComInterfaceAttribute' must be partial, non-generic, and must specify a GUID with 'System.Runtime.InteropServices.GuidAttribute'.</source>
         <target state="translated">As interfaces atribuídas com "GeneratedComInterfaceAttribute" devem ser parciais, não-genéricas e especificar um GUID com "System.Runtime.InteropServices.GuidAttribute".</target>
         <target state="translated">Uso de "GeneratedComInterfaceAttribute" inválido.</target>
         <note />
       </trans-unit>
+      <trans-unit id="InvalidGeneratedComInterfaceUsageMissingPartialModifier">
+        <source>The interface '{0}' or one of its containing types is missing the 'partial' keyword. Code will not be generated for '{0}'.</source>
+        <target state="new">The interface '{0}' or one of its containing types is missing the 'partial' keyword. Code will not be generated for '{0}'.</target>
+        <note />
+      </trans-unit>
       <trans-unit id="InvalidStringMarshallingConfigurationDescription">
         <source>The configuration of 'StringMarshalling' and 'StringMarshallingCustomType' is invalid.</source>
         <target state="translated">A configuração de 'StringMarshalling' e 'StringMarshallingCustomType' é inválida.</target>
index 12e76c9..f2721f1 100644 (file)
@@ -38,8 +38,8 @@
         <note />
       </trans-unit>
       <trans-unit id="AnalysisFailedTitle">
-        <source>Analysis for generation has failed.</source>
-        <target state="translated">Сбой анализа для создания.</target>
+        <source>Analysis for COM interface generation has failed.</source>
+        <target state="needs-review-translation">Сбой анализа для создания.</target>
         <note />
       </trans-unit>
       <trans-unit id="BaseInterfaceCannotBeGeneratedDescription">
@@ -53,8 +53,8 @@
         <note />
       </trans-unit>
       <trans-unit id="BaseInterfaceCannotBeGeneratedTitle">
-        <source>The base COM interface failed to generate source. ComInterfaceGenerator will not generate source for this interface.</source>
-        <target state="translated">Базовому COM-интерфейсу не удалось создать источник. ComInterfaceGenerator не будет создавать источник для этого интерфейса.</target>
+        <source>The base COM interface failed to generate source. Code will not be generated for this interface.</source>
+        <target state="needs-review-translation">Базовому COM-интерфейсу не удалось создать источник. ComInterfaceGenerator не будет создавать источник для этого интерфейса.</target>
         <note />
       </trans-unit>
       <trans-unit id="ComHostingDoesNotSupportGeneratedComInterfaceDescription">
         <target state="translated">Указанное значение не является известным флагом перечисления ExceptionMarshalling.</target>
         <note />
       </trans-unit>
+      <trans-unit id="InvalidGeneratedComClassAttributeUsageDescription">
+        <source>Classes with 'GeneratedComClassAttribute' must implement one or more interfaces with 'GeneratedComInterfaceAttribute', be marked partial, and be non-generic.</source>
+        <target state="new">Classes with 'GeneratedComClassAttribute' must implement one or more interfaces with 'GeneratedComInterfaceAttribute', be marked partial, and be non-generic.</target>
+        <note />
+      </trans-unit>
+      <trans-unit id="InvalidGeneratedComClassAttributeUsageMissingPartialModifier">
+        <source>Class '{0}' or one of its containing types is not marked 'partial'.</source>
+        <target state="new">Class '{0}' or one of its containing types is not marked 'partial'.</target>
+        <note />
+      </trans-unit>
+      <trans-unit id="InvalidGeneratedComClassAttributeUsageTitle">
+        <source>Invalid 'GeneratedComClassAttribute' usage</source>
+        <target state="new">Invalid 'GeneratedComClassAttribute' usage</target>
+        <note />
+      </trans-unit>
       <trans-unit id="InvalidGeneratedComInterfaceAttributeUsageDescription">
         <source>Interfaces attributed with 'GeneratedComInterfaceAttribute' must be partial, non-generic, and must specify a GUID with 'System.Runtime.InteropServices.GuidAttribute'.</source>
         <target state="translated">Интерфейсы с атрибутом GeneratedComInterfaceAttribute должны быть частичными, не универсальными и должны указывать GUID с помощью System.Runtime.InteropServices.GuidAttribute.</target>
         <target state="translated">Недопустимое применение GeneratedComInterfaceAttribute.</target>
         <note />
       </trans-unit>
+      <trans-unit id="InvalidGeneratedComInterfaceUsageMissingPartialModifier">
+        <source>The interface '{0}' or one of its containing types is missing the 'partial' keyword. Code will not be generated for '{0}'.</source>
+        <target state="new">The interface '{0}' or one of its containing types is missing the 'partial' keyword. Code will not be generated for '{0}'.</target>
+        <note />
+      </trans-unit>
       <trans-unit id="InvalidStringMarshallingConfigurationDescription">
         <source>The configuration of 'StringMarshalling' and 'StringMarshallingCustomType' is invalid.</source>
         <target state="translated">Конфигурация \"StringMarshalling\" и \"StringMarshallingCustomType\" недопустима.</target>
index c40fff4..34a1e34 100644 (file)
@@ -38,8 +38,8 @@
         <note />
       </trans-unit>
       <trans-unit id="AnalysisFailedTitle">
-        <source>Analysis for generation has failed.</source>
-        <target state="translated">Oluşturma analizi başarısız oldu.</target>
+        <source>Analysis for COM interface generation has failed.</source>
+        <target state="needs-review-translation">Oluşturma analizi başarısız oldu.</target>
         <note />
       </trans-unit>
       <trans-unit id="BaseInterfaceCannotBeGeneratedDescription">
@@ -53,8 +53,8 @@
         <note />
       </trans-unit>
       <trans-unit id="BaseInterfaceCannotBeGeneratedTitle">
-        <source>The base COM interface failed to generate source. ComInterfaceGenerator will not generate source for this interface.</source>
-        <target state="translated">Temel COM arabirimi kaynak oluşturamadı. ComInterfaceGenerator bu arabirim için kaynak oluşturamaz.</target>
+        <source>The base COM interface failed to generate source. Code will not be generated for this interface.</source>
+        <target state="needs-review-translation">Temel COM arabirimi kaynak oluşturamadı. ComInterfaceGenerator bu arabirim için kaynak oluşturamaz.</target>
         <note />
       </trans-unit>
       <trans-unit id="ComHostingDoesNotSupportGeneratedComInterfaceDescription">
         <target state="translated">Sağlanan değer bilinen bir 'ExceptionMarshalling' sabit listesi bayrağı değil.</target>
         <note />
       </trans-unit>
+      <trans-unit id="InvalidGeneratedComClassAttributeUsageDescription">
+        <source>Classes with 'GeneratedComClassAttribute' must implement one or more interfaces with 'GeneratedComInterfaceAttribute', be marked partial, and be non-generic.</source>
+        <target state="new">Classes with 'GeneratedComClassAttribute' must implement one or more interfaces with 'GeneratedComInterfaceAttribute', be marked partial, and be non-generic.</target>
+        <note />
+      </trans-unit>
+      <trans-unit id="InvalidGeneratedComClassAttributeUsageMissingPartialModifier">
+        <source>Class '{0}' or one of its containing types is not marked 'partial'.</source>
+        <target state="new">Class '{0}' or one of its containing types is not marked 'partial'.</target>
+        <note />
+      </trans-unit>
+      <trans-unit id="InvalidGeneratedComClassAttributeUsageTitle">
+        <source>Invalid 'GeneratedComClassAttribute' usage</source>
+        <target state="new">Invalid 'GeneratedComClassAttribute' usage</target>
+        <note />
+      </trans-unit>
       <trans-unit id="InvalidGeneratedComInterfaceAttributeUsageDescription">
         <source>Interfaces attributed with 'GeneratedComInterfaceAttribute' must be partial, non-generic, and must specify a GUID with 'System.Runtime.InteropServices.GuidAttribute'.</source>
         <target state="translated">'GeneratedComInterfaceAttribute' özniteliğine sahip arabirimler kısmi olmalı, genel olmamalı ve 'System.Runtime.InteropServices.GuidAttribute' ile bir GUID belirtmelidir.</target>
         <target state="translated">Geçersiz 'GeneratedComInterfaceAttribute' kullanımı.</target>
         <note />
       </trans-unit>
+      <trans-unit id="InvalidGeneratedComInterfaceUsageMissingPartialModifier">
+        <source>The interface '{0}' or one of its containing types is missing the 'partial' keyword. Code will not be generated for '{0}'.</source>
+        <target state="new">The interface '{0}' or one of its containing types is missing the 'partial' keyword. Code will not be generated for '{0}'.</target>
+        <note />
+      </trans-unit>
       <trans-unit id="InvalidStringMarshallingConfigurationDescription">
         <source>The configuration of 'StringMarshalling' and 'StringMarshallingCustomType' is invalid.</source>
         <target state="translated">'StringMarshalling' ve 'StringMarshallingCustomType' yapılandırması geçersiz.</target>
index 4f4d31c..bf91ed4 100644 (file)
@@ -38,8 +38,8 @@
         <note />
       </trans-unit>
       <trans-unit id="AnalysisFailedTitle">
-        <source>Analysis for generation has failed.</source>
-        <target state="translated">生成分析失败。</target>
+        <source>Analysis for COM interface generation has failed.</source>
+        <target state="needs-review-translation">生成分析失败。</target>
         <note />
       </trans-unit>
       <trans-unit id="BaseInterfaceCannotBeGeneratedDescription">
@@ -53,8 +53,8 @@
         <note />
       </trans-unit>
       <trans-unit id="BaseInterfaceCannotBeGeneratedTitle">
-        <source>The base COM interface failed to generate source. ComInterfaceGenerator will not generate source for this interface.</source>
-        <target state="translated">基本 COM 接口无法生成源。ComInterfaceGenerator 不会为此接口生成源。</target>
+        <source>The base COM interface failed to generate source. Code will not be generated for this interface.</source>
+        <target state="needs-review-translation">基本 COM 接口无法生成源。ComInterfaceGenerator 不会为此接口生成源。</target>
         <note />
       </trans-unit>
       <trans-unit id="ComHostingDoesNotSupportGeneratedComInterfaceDescription">
         <target state="translated">提供的值不是 “ExceptionMarshalling” 枚举的已知标志。</target>
         <note />
       </trans-unit>
+      <trans-unit id="InvalidGeneratedComClassAttributeUsageDescription">
+        <source>Classes with 'GeneratedComClassAttribute' must implement one or more interfaces with 'GeneratedComInterfaceAttribute', be marked partial, and be non-generic.</source>
+        <target state="new">Classes with 'GeneratedComClassAttribute' must implement one or more interfaces with 'GeneratedComInterfaceAttribute', be marked partial, and be non-generic.</target>
+        <note />
+      </trans-unit>
+      <trans-unit id="InvalidGeneratedComClassAttributeUsageMissingPartialModifier">
+        <source>Class '{0}' or one of its containing types is not marked 'partial'.</source>
+        <target state="new">Class '{0}' or one of its containing types is not marked 'partial'.</target>
+        <note />
+      </trans-unit>
+      <trans-unit id="InvalidGeneratedComClassAttributeUsageTitle">
+        <source>Invalid 'GeneratedComClassAttribute' usage</source>
+        <target state="new">Invalid 'GeneratedComClassAttribute' usage</target>
+        <note />
+      </trans-unit>
       <trans-unit id="InvalidGeneratedComInterfaceAttributeUsageDescription">
         <source>Interfaces attributed with 'GeneratedComInterfaceAttribute' must be partial, non-generic, and must specify a GUID with 'System.Runtime.InteropServices.GuidAttribute'.</source>
         <target state="translated">通过 "GeneratedComInterfaceAttribute" 特性化的接口必须是部分的、非泛型的,并且必须使用 "System.Runtime.InteropServices.GuidAttribute" 指定 GUID。</target>
         <target state="translated">“GeneratedComInterfaceAttribute” 使用无效。</target>
         <note />
       </trans-unit>
+      <trans-unit id="InvalidGeneratedComInterfaceUsageMissingPartialModifier">
+        <source>The interface '{0}' or one of its containing types is missing the 'partial' keyword. Code will not be generated for '{0}'.</source>
+        <target state="new">The interface '{0}' or one of its containing types is missing the 'partial' keyword. Code will not be generated for '{0}'.</target>
+        <note />
+      </trans-unit>
       <trans-unit id="InvalidStringMarshallingConfigurationDescription">
         <source>The configuration of 'StringMarshalling' and 'StringMarshallingCustomType' is invalid.</source>
         <target state="translated">“StringMarshalling” 和 “StringMarshallingCustomType” 的配置无效。</target>
index c47e7b9..a68f8e0 100644 (file)
@@ -38,8 +38,8 @@
         <note />
       </trans-unit>
       <trans-unit id="AnalysisFailedTitle">
-        <source>Analysis for generation has failed.</source>
-        <target state="translated">產生分析失敗。</target>
+        <source>Analysis for COM interface generation has failed.</source>
+        <target state="needs-review-translation">產生分析失敗。</target>
         <note />
       </trans-unit>
       <trans-unit id="BaseInterfaceCannotBeGeneratedDescription">
@@ -53,8 +53,8 @@
         <note />
       </trans-unit>
       <trans-unit id="BaseInterfaceCannotBeGeneratedTitle">
-        <source>The base COM interface failed to generate source. ComInterfaceGenerator will not generate source for this interface.</source>
-        <target state="translated">基底 COM 介面無法產生來源。ComInterfaceGenerator 不會產生此介面的來源。</target>
+        <source>The base COM interface failed to generate source. Code will not be generated for this interface.</source>
+        <target state="needs-review-translation">基底 COM 介面無法產生來源。ComInterfaceGenerator 不會產生此介面的來源。</target>
         <note />
       </trans-unit>
       <trans-unit id="ComHostingDoesNotSupportGeneratedComInterfaceDescription">
         <target state="translated">提供的值不是 'ExceptionMarshalling' 列舉的已知旗標。</target>
         <note />
       </trans-unit>
+      <trans-unit id="InvalidGeneratedComClassAttributeUsageDescription">
+        <source>Classes with 'GeneratedComClassAttribute' must implement one or more interfaces with 'GeneratedComInterfaceAttribute', be marked partial, and be non-generic.</source>
+        <target state="new">Classes with 'GeneratedComClassAttribute' must implement one or more interfaces with 'GeneratedComInterfaceAttribute', be marked partial, and be non-generic.</target>
+        <note />
+      </trans-unit>
+      <trans-unit id="InvalidGeneratedComClassAttributeUsageMissingPartialModifier">
+        <source>Class '{0}' or one of its containing types is not marked 'partial'.</source>
+        <target state="new">Class '{0}' or one of its containing types is not marked 'partial'.</target>
+        <note />
+      </trans-unit>
+      <trans-unit id="InvalidGeneratedComClassAttributeUsageTitle">
+        <source>Invalid 'GeneratedComClassAttribute' usage</source>
+        <target state="new">Invalid 'GeneratedComClassAttribute' usage</target>
+        <note />
+      </trans-unit>
       <trans-unit id="InvalidGeneratedComInterfaceAttributeUsageDescription">
         <source>Interfaces attributed with 'GeneratedComInterfaceAttribute' must be partial, non-generic, and must specify a GUID with 'System.Runtime.InteropServices.GuidAttribute'.</source>
         <target state="translated">屬性為 'GeneratedComInterfaceAttribute' 的介面必須是部分的非泛型介面,且必須指定具有 'System.Runtime.InteropServices.GuidAttribute' 的 GUID。</target>
         <target state="translated">無效的 'GeneratedComInterfaceAttribute' 使用方式。</target>
         <note />
       </trans-unit>
+      <trans-unit id="InvalidGeneratedComInterfaceUsageMissingPartialModifier">
+        <source>The interface '{0}' or one of its containing types is missing the 'partial' keyword. Code will not be generated for '{0}'.</source>
+        <target state="new">The interface '{0}' or one of its containing types is missing the 'partial' keyword. Code will not be generated for '{0}'.</target>
+        <note />
+      </trans-unit>
       <trans-unit id="InvalidStringMarshallingConfigurationDescription">
         <source>The configuration of 'StringMarshalling' and 'StringMarshallingCustomType' is invalid.</source>
         <target state="translated">'StringMarshalling' 和 'StringMarshallingCustomType' 的設定無效。</target>
diff --git a/src/libraries/System.Runtime.InteropServices/tests/ComInterfaceGenerator.Tests/RcwAroundCcwTests.cs b/src/libraries/System.Runtime.InteropServices/tests/ComInterfaceGenerator.Tests/RcwAroundCcwTests.cs
new file mode 100644 (file)
index 0000000..c59d439
--- /dev/null
@@ -0,0 +1,365 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+
+using System;
+using System.Runtime.InteropServices.Marshalling;
+using System.Runtime.InteropServices;
+using SharedTypes.ComInterfaces;
+using Xunit;
+using static ComInterfaceGenerator.Tests.ComInterfaces;
+using System.Collections.Generic;
+
+namespace ComInterfaceGenerator.Tests
+{
+    public partial class RcwAroundCcwTests
+    {
+        static TInterface CreateWrapper<TClass, TInterface>() where TClass : TInterface, new()
+        {
+            var cw = new StrategyBasedComWrappers();
+            var comPtr = cw.GetOrCreateComInterfaceForObject(new TClass(), CreateComInterfaceFlags.None);
+            var comObject = cw.GetOrCreateObjectForComInstance(comPtr, CreateObjectFlags.None);
+            var ifaceObject = (TInterface)comObject;
+            return ifaceObject;
+        }
+
+        [Fact]
+        public void IGetAndSetInt()
+        {
+            var obj = CreateWrapper<GetAndSetInt, IGetAndSetInt>();
+            obj.SetInt(1);
+            Assert.Equal(1, obj.GetInt());
+        }
+
+        [Fact]
+        public void IDerived()
+        {
+            var obj = CreateWrapper<Derived, IDerived>();
+            obj.SetInt(1);
+            Assert.Equal(1, obj.GetInt());
+            obj.SetName("A");
+            Assert.Equal("A", obj.GetName());
+        }
+
+        [Fact]
+        public void IBool()
+        {
+            var obj = CreateWrapper<IBoolImpl, IBool>();
+            Assert.False(obj.Get());
+            obj.Set(true);
+            Assert.True(obj.Get());
+        }
+
+        [Fact]
+        public void IFloat()
+        {
+            var obj = CreateWrapper<IFloatImpl, IFloat>();
+            obj.Set(2.71F);
+            Assert.Equal(2.71F, obj.Get());
+        }
+
+        [Fact]
+        public void IIntArray()
+        {
+            var obj = CreateWrapper<IIntArrayImpl, IIntArray>();
+            int[] data = new int[] { 1, 2, 3 };
+            int length = data.Length;
+            obj.Set(data, length);
+            Assert.Equal(data, obj.Get(out int _));
+            obj.Get2(out var value);
+            Assert.Equal(data, value);
+        }
+
+        [Fact]
+        public void IJaggedIntArray()
+        {
+            int[][] data = new int[][] { new int[] { 1, 2, 3 }, new int[] { 4, 5 }, new int[] { 6, 7, 8, 9 } };
+            int[] widths = new int[] { 3, 2, 4 };
+            int length = data.Length;
+
+            var obj = CreateWrapper<IJaggedIntArrayImpl, IJaggedIntArray>();
+
+            obj.Set(data, widths, length);
+            Assert.Equal(data, obj.Get(out _, out _));
+            _ = obj.Get2(out var value, out _);
+            Assert.Equal(data, value);
+        }
+
+        [Fact]
+        public void IInterface()
+        {
+            var iint = CreateWrapper<IIntImpl, IInt>();
+            var obj = CreateWrapper<IInterfaceImpl, IInterface>();
+            obj.Set(iint);
+            _ = obj.Get();
+        }
+
+        [Fact]
+        public void ICollectionMarshallingFails()
+        {
+            var obj = CreateWrapper<ICollectionMarshallingFailsImpl, ICollectionMarshallingFails>();
+
+            Assert.Throws<ArgumentException>(() =>
+                _ = obj.Get()
+            );
+            Assert.Throws<ArgumentException>(() =>
+                obj.Set(new int[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 0 })
+            );
+        }
+    }
+
+    public static partial class ComInterfaces
+    {
+        [GeneratedComInterface]
+        [Guid("EE6D1F2A-3418-4317-A87C-35488F6546AB")]
+        internal partial interface IInt
+        {
+            public int Get();
+            public void Set(int value);
+        }
+
+        [GeneratedComClass]
+        internal partial class IIntImpl : IInt
+        {
+            int _data;
+            public int Get() => _data;
+            public void Set(int value) => _data = value;
+        }
+
+        [GeneratedComInterface]
+        [Guid("5A9D3ED6-CC17-4FB9-8F82-0070489B7213")]
+        internal partial interface IBool
+        {
+            [return: MarshalAs(UnmanagedType.I1)]
+            bool Get();
+            void Set([MarshalAs(UnmanagedType.I1)] bool value);
+        }
+
+        [GeneratedComClass]
+        internal partial class IBoolImpl : IBool
+        {
+            bool _data;
+            public bool Get() => _data;
+            public void Set(bool value) => _data = value;
+        }
+
+        [GeneratedComInterface]
+        [Guid("9FA4A8A9-2D8F-48A8-B6FB-B44B5F1B9FB6")]
+        internal partial interface IFloat
+        {
+            float Get();
+            void Set(float value);
+        }
+
+        [GeneratedComClass]
+        internal partial class IFloatImpl : IFloat
+        {
+            float _data;
+            public float Get() => _data;
+            public void Set(float value) => _data = value;
+        }
+
+        [GeneratedComInterface]
+        [Guid("9FA4A8A9-3D8F-48A8-B6FB-B45B5F1B9FB6")]
+        internal partial interface IIntArray
+        {
+            [return: MarshalUsing(CountElementName = nameof(size))]
+            int[] Get(out int size);
+            int Get2([MarshalUsing(CountElementName = MarshalUsingAttribute.ReturnsCountValue)] out int[] array);
+            void Set([MarshalUsing(CountElementName = nameof(size))] int[] array, int size);
+        }
+
+        [GeneratedComClass]
+        internal partial class IIntArrayImpl : IIntArray
+        {
+            int[] _data;
+            public int[] Get(out int size)
+            {
+                size = _data.Length;
+                return _data;
+            }
+            public int Get2(out int[] array)
+            {
+                array = _data;
+                return array.Length;
+            }
+            public void Set(int[] array, int size)
+            {
+                _data = array;
+            }
+        }
+
+        [GeneratedComInterface]
+        [Guid("9FA4A8A9-3D8F-48A8-B6FB-B45B5F1B9FB6")]
+        internal partial interface IJaggedIntArray
+        {
+            [return: MarshalUsing(CountElementName = nameof(length)),
+                MarshalUsing(ElementIndirectionDepth = 1, CountElementName = nameof(widths))]
+            int[][] Get(
+                [MarshalUsing(CountElementName = nameof(length))]
+                out int[] widths,
+                out int length);
+
+            int Get2(
+                [MarshalUsing(CountElementName = MarshalUsingAttribute.ReturnsCountValue),
+                MarshalUsing(ElementIndirectionDepth = 1, CountElementName = nameof(widths))]
+                out int[][] array,
+                [MarshalUsing(CountElementName = MarshalUsingAttribute.ReturnsCountValue)]
+                out int[] widths);
+
+            void Set(
+                [MarshalUsing(CountElementName = nameof(length)),
+                MarshalUsing(ElementIndirectionDepth = 1, CountElementName = nameof(widths))]
+                int[][] array,
+                [MarshalUsing(CountElementName = nameof(length))]
+                int[] widths,
+                int length);
+        }
+
+        [GeneratedComClass]
+        internal partial class IJaggedIntArrayImpl : IJaggedIntArray
+        {
+            int[][] _data = new int[][] { new int[] { 1, 2, 3 }, new int[] { 4, 5 }, new int[] { 6, 7, 8, 9 } };
+            int[] _widths = new int[] { 3, 2, 4 };
+            public int[][] Get(out int[] widths, out int length)
+            {
+                widths = _widths;
+                length = _data.Length;
+                return _data;
+            }
+            public int Get2(out int[][] array, out int[] widths)
+            {
+                array = _data;
+                widths = _widths;
+                return array.Length;
+            }
+            public void Set(int[][] array, int[] widths, int length)
+            {
+                _data = array;
+                _widths = widths;
+            }
+        }
+
+        [CustomMarshaller(typeof(int), MarshalMode.ElementIn, typeof(ThrowOn4thElementMarshalled))]
+        [CustomMarshaller(typeof(int), MarshalMode.ElementOut, typeof(ThrowOn4thElementMarshalled))]
+        internal static class ThrowOn4thElementMarshalled
+        {
+            static int _marshalledCount = 0;
+            static int _unmarshalledCount = 0;
+            public static nint ConvertToUnmanaged(int managed)
+            {
+                if (_marshalledCount++ == 3)
+                {
+                    _marshalledCount = 0;
+                    throw new ArgumentException("The element was the 4th element (with 0-based index 3)");
+                }
+                return managed;
+            }
+
+            public static int ConvertToManaged(nint unmanaged)
+            {
+                if (_unmarshalledCount++ == 3)
+                {
+                    _unmarshalledCount = 0;
+                    throw new ArgumentException("The element was the 4th element (with 0-based index 3)");
+                }
+                return (int)unmanaged;
+            }
+        }
+
+        [GeneratedComInterface]
+        [Guid("A4857395-06FB-4A6E-81DB-35461BE999C5")]
+        internal partial interface ICollectionMarshallingFails
+        {
+            [return: MarshalUsing(ConstantElementCount = 10)]
+            [return: MarshalUsing(typeof(ThrowOn4thElementMarshalled), ElementIndirectionDepth = 1)]
+            public int[] Get();
+            public void Set(
+                [MarshalUsing(ConstantElementCount = 10)]
+                [MarshalUsing(typeof(ThrowOn4thElementMarshalled), ElementIndirectionDepth = 1)]
+                int[] value);
+        }
+
+        [GeneratedComClass]
+        public partial class ICollectionMarshallingFailsImpl : ICollectionMarshallingFails
+        {
+            int[] _data = new[] { 1, 2, 3 };
+            public int[] Get() => _data;
+            public void Set(int[] value) => _data = value;
+        }
+
+        [GeneratedComInterface]
+        [Guid("9FA4A8A9-3D8F-48A8-B6FB-B45B5F1B9FB6")]
+        internal partial interface IJaggedIntArrayMarshallingFails
+        {
+            [return: MarshalUsing(CountElementName = nameof(length)),
+                MarshalUsing(ElementIndirectionDepth = 1, CountElementName = nameof(widths)),
+                MarshalUsing(typeof(ThrowOn4thElementMarshalled), ElementIndirectionDepth = 2)]
+            int[][] Get(
+                [MarshalUsing(CountElementName = nameof(length))]
+                out int[] widths,
+                out int length);
+
+            int Get2(
+                [MarshalUsing(CountElementName = MarshalUsingAttribute.ReturnsCountValue),
+                MarshalUsing(ElementIndirectionDepth = 1, CountElementName = nameof(widths)),
+                MarshalUsing(typeof(ThrowOn4thElementMarshalled), ElementIndirectionDepth = 2)]
+                out int[][] array,
+                [MarshalUsing(CountElementName = MarshalUsingAttribute.ReturnsCountValue)]
+                out int[] widths);
+
+            void Set(
+                [MarshalUsing(CountElementName = nameof(length)),
+                MarshalUsing(ElementIndirectionDepth = 1, CountElementName = nameof(widths)),
+                MarshalUsing(typeof(ThrowOn4thElementMarshalled), ElementIndirectionDepth = 2)]
+                int[][] array,
+                [MarshalUsing(CountElementName = nameof(length))]
+                int[] widths,
+                int length);
+        }
+
+        [GeneratedComClass]
+        internal partial class IJaggedIntArrayMarshallingFailsImpl : IJaggedIntArrayMarshallingFails
+        {
+            int[][] _data = new int[][] { new int[] { 1, 2, 3 }, new int[] { 4, 5 }, new int[] { 6, 7, 8, 9 } };
+            int[] _widths = new int[] { 3, 2, 4 };
+            public int[][] Get(out int[] widths, out int length)
+            {
+                widths = _widths;
+                length = _data.Length;
+                return _data;
+            }
+            public int Get2(out int[][] array, out int[] widths)
+            {
+                array = _data;
+                widths = _widths;
+                return array.Length;
+            }
+            public void Set(int[][] array, int[] widths, int length)
+            {
+                _data = array;
+                _widths = widths;
+            }
+        }
+
+        [GeneratedComInterface]
+        [Guid("A4857398-06FB-4A6E-81DB-35461BE999C5")]
+        internal partial interface IInterface
+        {
+            public IInt Get();
+            public void Set(IInt value);
+        }
+
+        [GeneratedComClass]
+        public partial class IInterfaceImpl : IInterface
+        {
+            IInt _data = new IIntImpl();
+            IInt IInterface.Get() => _data;
+            void IInterface.Set(IInt value)
+            {
+                int x = value.Get();
+                value.Set(x);
+                _data = value;
+            }
+        }
+    }
+}
index c359be7..59151d9 100644 (file)
@@ -78,7 +78,6 @@ namespace ComInterfaceGenerator.Tests
         }
 
         [Fact]
-        [ActiveIssue("https://github.com/dotnet/runtime/issues/85795", TargetFrameworkMonikers.Any)]
         public void RcwToCcw()
         {
             var cw = new StrategyBasedComWrappers();
index 7c00170..c7fc7cd 100644 (file)
@@ -421,6 +421,38 @@ namespace ComInterfaceGenerator.Unit.Tests
         }
 
         [Fact]
+        public async Task VerifyNonPartialInterfaceWarns()
+        {
+            string basic = $$"""
+                using System.Runtime.InteropServices;
+                using System.Runtime.InteropServices.Marshalling;
+       
+                [GeneratedComInterface]
+                [Guid("9D3FD745-3C90-4C10-B140-FAFB01E3541D")]
+                public interface {|#0:I|}
+                {
+                    void Method();
+                }
+                """;
+            string containingTypeIsNotPartial = $$"""
+                using System.Runtime.InteropServices;
+                using System.Runtime.InteropServices.Marshalling;
+       
+                public static class Test
+                {
+                    [GeneratedComInterface]
+                    [Guid("9D3FD745-3C90-4C10-B140-FAFB01E3541D")]
+                    public partial interface {|#0:I|}
+                    {
+                        void Method();
+                    }
+                }
+                """;
+            await VerifyComInterfaceGenerator.VerifySourceGeneratorAsync(basic, new DiagnosticResult(GeneratorDiagnostics.InvalidAttributedInterfaceMissingPartialModifiers).WithLocation(0).WithArguments("I"));
+            await VerifyComInterfaceGenerator.VerifySourceGeneratorAsync(containingTypeIsNotPartial, new DiagnosticResult(GeneratorDiagnostics.InvalidAttributedInterfaceMissingPartialModifiers).WithLocation(0).WithArguments("I"));
+        }
+
+        [Fact]
         public async Task VerifyComInterfaceInheritingFromComInterfaceInOtherAssemblyReportsDiagnostic()
         {
             string additionalSource = $$"""
index 32d2801..902c677 100644 (file)
@@ -212,7 +212,7 @@ namespace ComInterfaceGenerator.Unit.Tests
                 """;
                 await VerifyCS.VerifyAnalyzerAsync(
                     _usings + snippet,
-                    VerifyCS.Diagnostic(AnalyzerDiagnostics.InterfaceTypeNotSupported)
+                    VerifyCS.Diagnostic(GeneratorDiagnostics.InterfaceTypeNotSupported)
                         .WithLocation(0)
                         .WithArguments(TypeNames.ComInterfaceType + "." + nameof(ComInterfaceType.InterfaceIsIDispatch)));
             }
@@ -232,7 +232,7 @@ namespace ComInterfaceGenerator.Unit.Tests
                 """;
                 await VerifyCS.VerifyAnalyzerAsync(
                     _usings + snippet,
-                    VerifyCS.Diagnostic(AnalyzerDiagnostics.InterfaceTypeNotSupported)
+                    VerifyCS.Diagnostic(GeneratorDiagnostics.InterfaceTypeNotSupported)
                         .WithLocation(0)
                         .WithArguments("2"));
             }
@@ -252,7 +252,7 @@ namespace ComInterfaceGenerator.Unit.Tests
                 """;
                 await VerifyCS.VerifyAnalyzerAsync(
                     _usings + snippet,
-                    VerifyCS.Diagnostic(AnalyzerDiagnostics.InterfaceTypeNotSupported)
+                    VerifyCS.Diagnostic(GeneratorDiagnostics.InterfaceTypeNotSupported)
                         .WithLocation(0)
                         .WithArguments(TypeNames.ComInterfaceType + "." + nameof(ComInterfaceType.InterfaceIsIInspectable)));
             }
@@ -272,7 +272,7 @@ namespace ComInterfaceGenerator.Unit.Tests
                 """;
                 await VerifyCS.VerifyAnalyzerAsync(
                     _usings + snippet,
-                    VerifyCS.Diagnostic(AnalyzerDiagnostics.InterfaceTypeNotSupported)
+                    VerifyCS.Diagnostic(GeneratorDiagnostics.InterfaceTypeNotSupported)
                         .WithLocation(0)
                         .WithArguments("3"));
             }
@@ -292,7 +292,7 @@ namespace ComInterfaceGenerator.Unit.Tests
                 """;
                 await VerifyCS.VerifyAnalyzerAsync(
                     _usings + snippet,
-                    VerifyCS.Diagnostic(AnalyzerDiagnostics.InterfaceTypeNotSupported)
+                    VerifyCS.Diagnostic(GeneratorDiagnostics.InterfaceTypeNotSupported)
                         .WithLocation(0)
                         .WithArguments(TypeNames.ComInterfaceType + "." + nameof(ComInterfaceType.InterfaceIsDual)));
             }
@@ -312,7 +312,7 @@ namespace ComInterfaceGenerator.Unit.Tests
                 """;
                 await VerifyCS.VerifyAnalyzerAsync(
                     _usings + snippet,
-                    VerifyCS.Diagnostic(AnalyzerDiagnostics.InterfaceTypeNotSupported)
+                    VerifyCS.Diagnostic(GeneratorDiagnostics.InterfaceTypeNotSupported)
                         .WithLocation(0)
                         .WithArguments("0"));
             }
@@ -374,7 +374,7 @@ namespace ComInterfaceGenerator.Unit.Tests
                 """;
                 await VerifyCS.VerifyAnalyzerAsync(
                     _usings + snippet,
-                    VerifyCS.Diagnostic(AnalyzerDiagnostics.InterfaceTypeNotSupported)
+                    VerifyCS.Diagnostic(GeneratorDiagnostics.InterfaceTypeNotSupported)
                         .WithLocation(0)
                         .WithArguments(TypeNames.ComInterfaceType + "." + nameof(ComInterfaceType.InterfaceIsIDispatch)));
             }
@@ -396,7 +396,7 @@ namespace ComInterfaceGenerator.Unit.Tests
                 """;
                 await VerifyCS.VerifyAnalyzerAsync(
                     _usings + snippet,
-                    VerifyCS.Diagnostic(AnalyzerDiagnostics.InterfaceTypeNotSupported)
+                    VerifyCS.Diagnostic(GeneratorDiagnostics.InterfaceTypeNotSupported)
                         .WithLocation(0)
                         .WithArguments("2"));
             }
@@ -418,7 +418,7 @@ namespace ComInterfaceGenerator.Unit.Tests
                 """;
                 await VerifyCS.VerifyAnalyzerAsync(
                     _usings + snippet,
-                    VerifyCS.Diagnostic(AnalyzerDiagnostics.InterfaceTypeNotSupported)
+                    VerifyCS.Diagnostic(GeneratorDiagnostics.InterfaceTypeNotSupported)
                         .WithLocation(0)
                         .WithArguments(TypeNames.ComInterfaceType + "." + nameof(ComInterfaceType.InterfaceIsIInspectable)));
             }
@@ -440,7 +440,7 @@ namespace ComInterfaceGenerator.Unit.Tests
                 """;
                 await VerifyCS.VerifyAnalyzerAsync(
                     _usings + snippet,
-                    VerifyCS.Diagnostic(AnalyzerDiagnostics.InterfaceTypeNotSupported)
+                    VerifyCS.Diagnostic(GeneratorDiagnostics.InterfaceTypeNotSupported)
                         .WithLocation(0)
                         .WithArguments("3"));
             }
@@ -462,7 +462,7 @@ namespace ComInterfaceGenerator.Unit.Tests
                 """;
                 await VerifyCS.VerifyAnalyzerAsync(
                     _usings + snippet,
-                    VerifyCS.Diagnostic(AnalyzerDiagnostics.InterfaceTypeNotSupported)
+                    VerifyCS.Diagnostic(GeneratorDiagnostics.InterfaceTypeNotSupported)
                         .WithLocation(0)
                         .WithArguments(TypeNames.ComInterfaceType + "." + nameof(ComInterfaceType.InterfaceIsDual)));
             }
@@ -484,7 +484,7 @@ namespace ComInterfaceGenerator.Unit.Tests
                 """;
                 await VerifyCS.VerifyAnalyzerAsync(
                     _usings + snippet,
-                    VerifyCS.Diagnostic(AnalyzerDiagnostics.InterfaceTypeNotSupported)
+                    VerifyCS.Diagnostic(GeneratorDiagnostics.InterfaceTypeNotSupported)
                         .WithLocation(0)
                         .WithArguments("0"));
             }
index 1c82b96..54669fa 100644 (file)
@@ -2,6 +2,7 @@
 // The .NET Foundation licenses this file to you under the MIT license.
 
 using System;
+using System.Collections.Generic;
 using System.Runtime.InteropServices;
 using System.Runtime.InteropServices.Marshalling;
 
@@ -18,4 +19,12 @@ namespace SharedTypes.ComInterfaces
 
         internal new const string _guid = "7F0DB364-3C04-4487-9193-4BB05DC7B654";
     }
+
+    [GeneratedComClass]
+    internal partial class Derived : GetAndSetInt, IDerived
+    {
+        string _data = "hello";
+        public string GetName() => _data;
+        public void SetName(string name) => _data = name;
+    }
 }
index f1b46c8..54e7fb8 100644 (file)
@@ -17,4 +17,11 @@ namespace SharedTypes.ComInterfaces
 
         public const string _guid = "2c3f9903-b586-46b1-881b-adfce9af47b1";
     }
+    [GeneratedComClass]
+    internal partial class GetAndSetInt : IGetAndSetInt
+    {
+        int _data = 0;
+        public int GetInt() => _data;
+        public void SetInt(int x) => _data = x;
+    }
 }