diff --git a/docs/project/list-of-diagnostics.md b/docs/project/list-of-diagnostics.md index eae28234ac0..2d1eab1db02 100644 --- a/docs/project/list-of-diagnostics.md +++ b/docs/project/list-of-diagnostics.md @@ -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'. | diff --git a/src/libraries/System.Runtime.InteropServices/gen/ComInterfaceGenerator/Analyzers/AnalyzerDiagnostics.cs b/src/libraries/System.Runtime.InteropServices/gen/ComInterfaceGenerator/Analyzers/AnalyzerDiagnostics.cs index 53f778ce0e7..ad6a64e6ac9 100644 --- a/src/libraries/System.Runtime.InteropServices/gen/ComInterfaceGenerator/Analyzers/AnalyzerDiagnostics.cs +++ b/src/libraries/System.Runtime.InteropServices/gen/ComInterfaceGenerator/Analyzers/AnalyzerDiagnostics.cs @@ -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, diff --git a/src/libraries/System.Runtime.InteropServices/gen/ComInterfaceGenerator/Analyzers/GeneratedComInterfaceAttributeAnalyzer.cs b/src/libraries/System.Runtime.InteropServices/gen/ComInterfaceGenerator/Analyzers/GeneratedComInterfaceAttributeAnalyzer.cs index f3fecbaf3a6..962d568867c 100644 --- a/src/libraries/System.Runtime.InteropServices/gen/ComInterfaceGenerator/Analyzers/GeneratedComInterfaceAttributeAnalyzer.cs +++ b/src/libraries/System.Runtime.InteropServices/gen/ComInterfaceGenerator/Analyzers/GeneratedComInterfaceAttributeAnalyzer.cs @@ -18,7 +18,7 @@ namespace Microsoft.Interop.Analyzers public class GeneratedComInterfaceAttributeAnalyzer : DiagnosticAnalyzer { public override ImmutableArray SupportedDiagnostics { get; } - = ImmutableArray.Create(AnalyzerDiagnostics.InterfaceTypeNotSupported); + = ImmutableArray.Create(GeneratorDiagnostics.InterfaceTypeNotSupported); public static readonly ImmutableArray 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); } diff --git a/src/libraries/System.Runtime.InteropServices/gen/ComInterfaceGenerator/ComInterfaceInfo.cs b/src/libraries/System.Runtime.InteropServices/gen/ComInterfaceGenerator/ComInterfaceInfo.cs index 54b08649d46..f583ab6b3ac 100644 --- a/src/libraries/System.Runtime.InteropServices/gen/ComInterfaceGenerator/ComInterfaceInfo.cs +++ b/src/libraries/System.Runtime.InteropServices/gen/ComInterfaceGenerator/ComInterfaceInfo.cs @@ -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)); diff --git a/src/libraries/System.Runtime.InteropServices/gen/ComInterfaceGenerator/ComMethodInfo.cs b/src/libraries/System.Runtime.InteropServices/gen/ComInterfaceGenerator/ComMethodInfo.cs index 2fb94268abd..4c8cd8afd00 100644 --- a/src/libraries/System.Runtime.InteropServices/gen/ComInterfaceGenerator/ComMethodInfo.cs +++ b/src/libraries/System.Runtime.InteropServices/gen/ComInterfaceGenerator/ComMethodInfo.cs @@ -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; diff --git a/src/libraries/System.Runtime.InteropServices/gen/ComInterfaceGenerator/GeneratorDiagnostics.cs b/src/libraries/System.Runtime.InteropServices/gen/ComInterfaceGenerator/GeneratorDiagnostics.cs index f02a6c20996..9d77ff794ea 100644 --- a/src/libraries/System.Runtime.InteropServices/gen/ComInterfaceGenerator/GeneratorDiagnostics.cs +++ b/src/libraries/System.Runtime.InteropServices/gen/ComInterfaceGenerator/GeneratorDiagnostics.cs @@ -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))); + /// + 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))); + /// public static readonly DiagnosticDescriptor InvalidAttributedMethodContainingTypeMissingUnmanagedObjectUnwrapperAttribute = new DiagnosticDescriptor( @@ -282,6 +294,28 @@ namespace Microsoft.Interop isEnabledByDefault: true, description: GetResourceString(nameof(SR.BaseInterfaceCannotBeGeneratedDescription))); + /// + 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))); + + /// + 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 _diagnostics = new List(); public IEnumerable Diagnostics => _diagnostics; diff --git a/src/libraries/System.Runtime.InteropServices/gen/ComInterfaceGenerator/Resources/Strings.resx b/src/libraries/System.Runtime.InteropServices/gen/ComInterfaceGenerator/Resources/Strings.resx index b1660ff2b95..99778535fa9 100644 --- a/src/libraries/System.Runtime.InteropServices/gen/ComInterfaceGenerator/Resources/Strings.resx +++ b/src/libraries/System.Runtime.InteropServices/gen/ComInterfaceGenerator/Resources/Strings.resx @@ -1,17 +1,17 @@  - @@ -250,7 +250,7 @@ Analysis of method '{0}' has failed. ComInterfaceGenerator will not generate code for this method. - Analysis for generation has failed. + Analysis for COM interface generation has failed. The configuration of 'StringMarshalling' and 'StringMarshallingCustomType' must match the base COM interface. @@ -262,11 +262,23 @@ COM interface {0} inherits from {1}, which has errors. ComInterfaceGenerator will not generate source for {0}. - The base COM interface failed to generate source. ComInterfaceGenerator will not generate source for this interface. + The base COM interface failed to generate source. Code will not be generated for this interface. The configuration of 'StringMarshalling' and 'StringMarshallingCustomType' on interface '{0}' is invalid. {1} + + The interface '{0}' or one of its containing types is missing the 'partial' keyword. Code will not be generated for '{0}'. + + + Classes with 'GeneratedComClassAttribute' must implement one or more interfaces with 'GeneratedComInterfaceAttribute', be marked partial, and be non-generic. + + + Class '{0}' or one of its containing types is not marked 'partial'. + + + Invalid 'GeneratedComClassAttribute' usage + Use 'GeneratedComInterfaceAttribute' instead of 'ComImportAttribute' to generate COM marshalling code at compile time @@ -315,4 +327,4 @@ Converting this interface to use 'GeneratedComInterfaceAttribute' may produce invalid code and may require additional work - \ No newline at end of file + diff --git a/src/libraries/System.Runtime.InteropServices/gen/ComInterfaceGenerator/Resources/xlf/Strings.cs.xlf b/src/libraries/System.Runtime.InteropServices/gen/ComInterfaceGenerator/Resources/xlf/Strings.cs.xlf index 01949511f9c..640637ec3d5 100644 --- a/src/libraries/System.Runtime.InteropServices/gen/ComInterfaceGenerator/Resources/xlf/Strings.cs.xlf +++ b/src/libraries/System.Runtime.InteropServices/gen/ComInterfaceGenerator/Resources/xlf/Strings.cs.xlf @@ -38,8 +38,8 @@ - Analysis for generation has failed. - Analýza pro generování se nezdařila + Analysis for COM interface generation has failed. + Analýza pro generování se nezdařila @@ -53,8 +53,8 @@ - The base COM interface failed to generate source. ComInterfaceGenerator will not generate source for this interface. - Základnímu rozhraní COM se nepodařilo vygenerovat zdroj. ComInterfaceGenerator nevygeneruje zdroj pro toto rozhraní. + The base COM interface failed to generate source. Code will not be generated for this interface. + Základnímu rozhraní COM se nepodařilo vygenerovat zdroj. ComInterfaceGenerator nevygeneruje zdroj pro toto rozhraní. @@ -197,6 +197,21 @@ Zadaná hodnota není známý příznak výčtu ExceptionMarsnuming. + + Classes with 'GeneratedComClassAttribute' must implement one or more interfaces with 'GeneratedComInterfaceAttribute', be marked partial, and be non-generic. + Classes with 'GeneratedComClassAttribute' must implement one or more interfaces with 'GeneratedComInterfaceAttribute', be marked partial, and be non-generic. + + + + Class '{0}' or one of its containing types is not marked 'partial'. + Class '{0}' or one of its containing types is not marked 'partial'. + + + + Invalid 'GeneratedComClassAttribute' usage + Invalid 'GeneratedComClassAttribute' usage + + Interfaces attributed with 'GeneratedComInterfaceAttribute' must be partial, non-generic, and must specify a GUID with 'System.Runtime.InteropServices.GuidAttribute'. Rozhraní s atributem GeneratedComInterfaceAttribute musí být částečná, neobecná a musí určovat identifikátor GUID s atributem System.Runtime.InteropServices.GuidAttribute. @@ -217,6 +232,11 @@ Neplatné použití atributu GeneratedComInterfaceAttribute + + The interface '{0}' or one of its containing types is missing the 'partial' keyword. Code will not be generated for '{0}'. + The interface '{0}' or one of its containing types is missing the 'partial' keyword. Code will not be generated for '{0}'. + + The configuration of 'StringMarshalling' and 'StringMarshallingCustomType' is invalid. Konfigurace StringMarshalling a StringMarshallingCustomType je neplatná. diff --git a/src/libraries/System.Runtime.InteropServices/gen/ComInterfaceGenerator/Resources/xlf/Strings.de.xlf b/src/libraries/System.Runtime.InteropServices/gen/ComInterfaceGenerator/Resources/xlf/Strings.de.xlf index b1f1441d093..c0d3124df74 100644 --- a/src/libraries/System.Runtime.InteropServices/gen/ComInterfaceGenerator/Resources/xlf/Strings.de.xlf +++ b/src/libraries/System.Runtime.InteropServices/gen/ComInterfaceGenerator/Resources/xlf/Strings.de.xlf @@ -38,8 +38,8 @@ - Analysis for generation has failed. - Fehler bei der Analyse für die Generierung. + Analysis for COM interface generation has failed. + Fehler bei der Analyse für die Generierung. @@ -53,8 +53,8 @@ - The base COM interface failed to generate source. ComInterfaceGenerator will not generate source for this interface. - Die Basis-COM-Schnittstelle konnte die Quelle nicht generieren. ComInterfaceGenerator generiert keine Quelle für diese Schnittstelle. + The base COM interface failed to generate source. Code will not be generated for this interface. + Die Basis-COM-Schnittstelle konnte die Quelle nicht generieren. ComInterfaceGenerator generiert keine Quelle für diese Schnittstelle. @@ -197,6 +197,21 @@ Der angegebene Wert ist kein bekanntes Flag der „ExceptionMarshalling“-Enumeration. + + Classes with 'GeneratedComClassAttribute' must implement one or more interfaces with 'GeneratedComInterfaceAttribute', be marked partial, and be non-generic. + Classes with 'GeneratedComClassAttribute' must implement one or more interfaces with 'GeneratedComInterfaceAttribute', be marked partial, and be non-generic. + + + + Class '{0}' or one of its containing types is not marked 'partial'. + Class '{0}' or one of its containing types is not marked 'partial'. + + + + Invalid 'GeneratedComClassAttribute' usage + Invalid 'GeneratedComClassAttribute' usage + + Interfaces attributed with 'GeneratedComInterfaceAttribute' must be partial, non-generic, and must specify a GUID with 'System.Runtime.InteropServices.GuidAttribute'. Schnittstellen, die mit "GeneratedComInterfaceAttribute" attributiert sind, müssen partielle, nicht generische Schnittstellen sein und eine GUID mit "System.Runtime.InteropServices.GuidAttribute" angeben. @@ -217,6 +232,11 @@ Ungültige Verwendung von „GeneratedComInterfaceAttribute“. + + The interface '{0}' or one of its containing types is missing the 'partial' keyword. Code will not be generated for '{0}'. + The interface '{0}' or one of its containing types is missing the 'partial' keyword. Code will not be generated for '{0}'. + + The configuration of 'StringMarshalling' and 'StringMarshallingCustomType' is invalid. Die Konfiguration von \"StringMarshalling\" und \"StringMarshallingCustomType\" ist ungültig. diff --git a/src/libraries/System.Runtime.InteropServices/gen/ComInterfaceGenerator/Resources/xlf/Strings.es.xlf b/src/libraries/System.Runtime.InteropServices/gen/ComInterfaceGenerator/Resources/xlf/Strings.es.xlf index 3fa88a764fd..fb2702bbd5b 100644 --- a/src/libraries/System.Runtime.InteropServices/gen/ComInterfaceGenerator/Resources/xlf/Strings.es.xlf +++ b/src/libraries/System.Runtime.InteropServices/gen/ComInterfaceGenerator/Resources/xlf/Strings.es.xlf @@ -38,8 +38,8 @@ - Analysis for generation has failed. - Error en el análisis de generación. + Analysis for COM interface generation has failed. + Error en el análisis de generación. @@ -53,8 +53,8 @@ - The base COM interface failed to generate source. ComInterfaceGenerator will not generate source for this interface. - La interfaz COM base no pudo generar el origen. ComInterfaceGenerator no generará el origen para esta interfaz. + The base COM interface failed to generate source. Code will not be generated for this interface. + La interfaz COM base no pudo generar el origen. ComInterfaceGenerator no generará el origen para esta interfaz. @@ -197,6 +197,21 @@ El valor proporcionado no es una marca conocida de la enumeración “ExceptionMarshalling”. + + Classes with 'GeneratedComClassAttribute' must implement one or more interfaces with 'GeneratedComInterfaceAttribute', be marked partial, and be non-generic. + Classes with 'GeneratedComClassAttribute' must implement one or more interfaces with 'GeneratedComInterfaceAttribute', be marked partial, and be non-generic. + + + + Class '{0}' or one of its containing types is not marked 'partial'. + Class '{0}' or one of its containing types is not marked 'partial'. + + + + Invalid 'GeneratedComClassAttribute' usage + Invalid 'GeneratedComClassAttribute' usage + + Interfaces attributed with 'GeneratedComInterfaceAttribute' must be partial, non-generic, and must specify a GUID with 'System.Runtime.InteropServices.GuidAttribute'. Las interfaces con el atributo “GeneratedComInterfaceAttribute” deben ser parciales, no genéricas y deben especificar un GUID con “System.Runtime.InteropServices.GuidAttribute”. @@ -217,6 +232,11 @@ Uso de 'GeneratedComInterfaceAttribute' no válido. + + The interface '{0}' or one of its containing types is missing the 'partial' keyword. Code will not be generated for '{0}'. + The interface '{0}' or one of its containing types is missing the 'partial' keyword. Code will not be generated for '{0}'. + + The configuration of 'StringMarshalling' and 'StringMarshallingCustomType' is invalid. La configuración de “StringMarshalling” y “StringMarshallingCustomType” no es válida. diff --git a/src/libraries/System.Runtime.InteropServices/gen/ComInterfaceGenerator/Resources/xlf/Strings.fr.xlf b/src/libraries/System.Runtime.InteropServices/gen/ComInterfaceGenerator/Resources/xlf/Strings.fr.xlf index e76c3dba719..9fb27aa1881 100644 --- a/src/libraries/System.Runtime.InteropServices/gen/ComInterfaceGenerator/Resources/xlf/Strings.fr.xlf +++ b/src/libraries/System.Runtime.InteropServices/gen/ComInterfaceGenerator/Resources/xlf/Strings.fr.xlf @@ -38,8 +38,8 @@ - Analysis for generation has failed. - Échec de l’analyse de la génération. + Analysis for COM interface generation has failed. + Échec de l’analyse de la génération. @@ -53,8 +53,8 @@ - The base COM interface failed to generate source. ComInterfaceGenerator will not generate source for this interface. - 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. + The base COM interface failed to generate source. Code will not be generated for this interface. + 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. @@ -197,6 +197,21 @@ La valeur fournie n’est pas un indicateur connu de l’énumération « ExceptionMarshalling ». + + Classes with 'GeneratedComClassAttribute' must implement one or more interfaces with 'GeneratedComInterfaceAttribute', be marked partial, and be non-generic. + Classes with 'GeneratedComClassAttribute' must implement one or more interfaces with 'GeneratedComInterfaceAttribute', be marked partial, and be non-generic. + + + + Class '{0}' or one of its containing types is not marked 'partial'. + Class '{0}' or one of its containing types is not marked 'partial'. + + + + Invalid 'GeneratedComClassAttribute' usage + Invalid 'GeneratedComClassAttribute' usage + + Interfaces attributed with 'GeneratedComInterfaceAttribute' must be partial, non-generic, and must specify a GUID with 'System.Runtime.InteropServices.GuidAttribute'. Les interfaces sont attribuées à « GeneratedComInterfaceAttribute » doivent être partielles, non génériques et doivent spécifier un GUID avec « System.Runtime.InteropServices.GuidAttribute ». @@ -217,6 +232,11 @@ Utilisation de « GeneratedComInterfaceAttribute » non valide. + + The interface '{0}' or one of its containing types is missing the 'partial' keyword. Code will not be generated for '{0}'. + The interface '{0}' or one of its containing types is missing the 'partial' keyword. Code will not be generated for '{0}'. + + The configuration of 'StringMarshalling' and 'StringMarshallingCustomType' is invalid. La configuration de « StringMarshalling » et de « StringMarshallingCustomType » n’est pas valide. diff --git a/src/libraries/System.Runtime.InteropServices/gen/ComInterfaceGenerator/Resources/xlf/Strings.it.xlf b/src/libraries/System.Runtime.InteropServices/gen/ComInterfaceGenerator/Resources/xlf/Strings.it.xlf index 5806cfc7b20..39f5e4b8c18 100644 --- a/src/libraries/System.Runtime.InteropServices/gen/ComInterfaceGenerator/Resources/xlf/Strings.it.xlf +++ b/src/libraries/System.Runtime.InteropServices/gen/ComInterfaceGenerator/Resources/xlf/Strings.it.xlf @@ -38,8 +38,8 @@ - Analysis for generation has failed. - L'analisi per la generazione non è riuscita. + Analysis for COM interface generation has failed. + L'analisi per la generazione non è riuscita. @@ -53,8 +53,8 @@ - The base COM interface failed to generate source. ComInterfaceGenerator will not generate source for this interface. - L'interfaccia COM di base non è riuscita a generare l'origine. ComInterfaceGenerator non genererà l'origine per questa interfaccia. + The base COM interface failed to generate source. Code will not be generated for this interface. + L'interfaccia COM di base non è riuscita a generare l'origine. ComInterfaceGenerator non genererà l'origine per questa interfaccia. @@ -197,6 +197,21 @@ Il valore specificato non è un flag noto dell'enumerazione 'ExceptionMarshalling'. + + Classes with 'GeneratedComClassAttribute' must implement one or more interfaces with 'GeneratedComInterfaceAttribute', be marked partial, and be non-generic. + Classes with 'GeneratedComClassAttribute' must implement one or more interfaces with 'GeneratedComInterfaceAttribute', be marked partial, and be non-generic. + + + + Class '{0}' or one of its containing types is not marked 'partial'. + Class '{0}' or one of its containing types is not marked 'partial'. + + + + Invalid 'GeneratedComClassAttribute' usage + Invalid 'GeneratedComClassAttribute' usage + + Interfaces attributed with 'GeneratedComInterfaceAttribute' must be partial, non-generic, and must specify a GUID with 'System.Runtime.InteropServices.GuidAttribute'. Le interfacce con attributo 'GeneratedComInterfaceAttribute' devono essere parziali, non generiche e devono specificare un GUID con 'System.Runtime.InteropServices.GuidAttribute'. @@ -217,6 +232,11 @@ Utilizzo di 'GeneratedComInterfaceAttribute' non valido. + + The interface '{0}' or one of its containing types is missing the 'partial' keyword. Code will not be generated for '{0}'. + The interface '{0}' or one of its containing types is missing the 'partial' keyword. Code will not be generated for '{0}'. + + The configuration of 'StringMarshalling' and 'StringMarshallingCustomType' is invalid. La configurazione di 'StringMarshalling' e 'StringMarshallingCustomType' non è valida. diff --git a/src/libraries/System.Runtime.InteropServices/gen/ComInterfaceGenerator/Resources/xlf/Strings.ja.xlf b/src/libraries/System.Runtime.InteropServices/gen/ComInterfaceGenerator/Resources/xlf/Strings.ja.xlf index 87657379981..7e1a2096dfe 100644 --- a/src/libraries/System.Runtime.InteropServices/gen/ComInterfaceGenerator/Resources/xlf/Strings.ja.xlf +++ b/src/libraries/System.Runtime.InteropServices/gen/ComInterfaceGenerator/Resources/xlf/Strings.ja.xlf @@ -38,8 +38,8 @@ - Analysis for generation has failed. - 生成の分析に失敗しました。 + Analysis for COM interface generation has failed. + 生成の分析に失敗しました。 @@ -53,8 +53,8 @@ - The base COM interface failed to generate source. ComInterfaceGenerator will not generate source for this interface. - ベース COM インターフェイスはソースを生成できませんでした。ComInterfaceGenerator は、このインターフェイスのソースを生成しません。 + The base COM interface failed to generate source. Code will not be generated for this interface. + ベース COM インターフェイスはソースを生成できませんでした。ComInterfaceGenerator は、このインターフェイスのソースを生成しません。 @@ -197,6 +197,21 @@ 指定された値は、'ExceptionMarshalling' 列挙型の既知のフラグではありません。 + + Classes with 'GeneratedComClassAttribute' must implement one or more interfaces with 'GeneratedComInterfaceAttribute', be marked partial, and be non-generic. + Classes with 'GeneratedComClassAttribute' must implement one or more interfaces with 'GeneratedComInterfaceAttribute', be marked partial, and be non-generic. + + + + Class '{0}' or one of its containing types is not marked 'partial'. + Class '{0}' or one of its containing types is not marked 'partial'. + + + + Invalid 'GeneratedComClassAttribute' usage + Invalid 'GeneratedComClassAttribute' usage + + Interfaces attributed with 'GeneratedComInterfaceAttribute' must be partial, non-generic, and must specify a GUID with 'System.Runtime.InteropServices.GuidAttribute'. 'GeneratedComInterfaceAttribute' の属性を持つインターフェイスは部分的で、非ジェネリックである必要があり、'System.Runtime.InteropServices.GuidAttribute' で GUID を指定する必要があります。 @@ -217,6 +232,11 @@ 'GeneratedComInterfaceAttribute' の使用法が無効です。 + + The interface '{0}' or one of its containing types is missing the 'partial' keyword. Code will not be generated for '{0}'. + The interface '{0}' or one of its containing types is missing the 'partial' keyword. Code will not be generated for '{0}'. + + The configuration of 'StringMarshalling' and 'StringMarshallingCustomType' is invalid. 'StringMarshalling' と 'StringMarshallingCustomType' の構成が無効です。 diff --git a/src/libraries/System.Runtime.InteropServices/gen/ComInterfaceGenerator/Resources/xlf/Strings.ko.xlf b/src/libraries/System.Runtime.InteropServices/gen/ComInterfaceGenerator/Resources/xlf/Strings.ko.xlf index 2062b2fb61a..56e0539b8f4 100644 --- a/src/libraries/System.Runtime.InteropServices/gen/ComInterfaceGenerator/Resources/xlf/Strings.ko.xlf +++ b/src/libraries/System.Runtime.InteropServices/gen/ComInterfaceGenerator/Resources/xlf/Strings.ko.xlf @@ -38,8 +38,8 @@ - Analysis for generation has failed. - 생성에 필요한 분석이 실패했습니다. + Analysis for COM interface generation has failed. + 생성에 필요한 분석이 실패했습니다. @@ -53,8 +53,8 @@ - The base COM interface failed to generate source. ComInterfaceGenerator will not generate source for this interface. - 기본 COM 인터페이스에서 원본을 생성하지 못했습니다. ComInterfaceGenerator는 이 인터페이스에 대한 원본을 생성하지 않습니다. + The base COM interface failed to generate source. Code will not be generated for this interface. + 기본 COM 인터페이스에서 원본을 생성하지 못했습니다. ComInterfaceGenerator는 이 인터페이스에 대한 원본을 생성하지 않습니다. @@ -197,6 +197,21 @@ 제공된 값은 'ExceptionMarshalling' 열거형의 알려진 플래그가 아닙니다. + + Classes with 'GeneratedComClassAttribute' must implement one or more interfaces with 'GeneratedComInterfaceAttribute', be marked partial, and be non-generic. + Classes with 'GeneratedComClassAttribute' must implement one or more interfaces with 'GeneratedComInterfaceAttribute', be marked partial, and be non-generic. + + + + Class '{0}' or one of its containing types is not marked 'partial'. + Class '{0}' or one of its containing types is not marked 'partial'. + + + + Invalid 'GeneratedComClassAttribute' usage + Invalid 'GeneratedComClassAttribute' usage + + Interfaces attributed with 'GeneratedComInterfaceAttribute' must be partial, non-generic, and must specify a GUID with 'System.Runtime.InteropServices.GuidAttribute'. 'GeneratedComInterfaceAttribute'로 특성이 지정된 인터페이스는 부분적이고 제네릭이 아니어야 하며 'System.Runtime.InteropServices.GuidAttribute'를 사용하여 GUID를 지정해야 합니다. @@ -217,6 +232,11 @@ 잘못된 'GeneratedComInterfaceAttribute' 사용법입니다. + + The interface '{0}' or one of its containing types is missing the 'partial' keyword. Code will not be generated for '{0}'. + The interface '{0}' or one of its containing types is missing the 'partial' keyword. Code will not be generated for '{0}'. + + The configuration of 'StringMarshalling' and 'StringMarshallingCustomType' is invalid. 'StringMarshalling' 및 'StringMarshallingCustomType'의 구성이 잘못되었습니다. diff --git a/src/libraries/System.Runtime.InteropServices/gen/ComInterfaceGenerator/Resources/xlf/Strings.pl.xlf b/src/libraries/System.Runtime.InteropServices/gen/ComInterfaceGenerator/Resources/xlf/Strings.pl.xlf index 62d7ce1f9ef..cbe9032ed19 100644 --- a/src/libraries/System.Runtime.InteropServices/gen/ComInterfaceGenerator/Resources/xlf/Strings.pl.xlf +++ b/src/libraries/System.Runtime.InteropServices/gen/ComInterfaceGenerator/Resources/xlf/Strings.pl.xlf @@ -38,8 +38,8 @@ - Analysis for generation has failed. - Analiza generowania nie powiodła się. + Analysis for COM interface generation has failed. + Analiza generowania nie powiodła się. @@ -53,8 +53,8 @@ - The base COM interface failed to generate source. ComInterfaceGenerator will not generate source for this interface. - Podstawowy interfejs COM nie może wygenerować źródła. Program ComInterfaceGenerator nie wygeneruje źródła dla tego interfejsu. + The base COM interface failed to generate source. Code will not be generated for this interface. + Podstawowy interfejs COM nie może wygenerować źródła. Program ComInterfaceGenerator nie wygeneruje źródła dla tego interfejsu. @@ -197,6 +197,21 @@ Podana wartość nie jest znaną flagą wyliczenia „'ExceptionMarshalling”. + + Classes with 'GeneratedComClassAttribute' must implement one or more interfaces with 'GeneratedComInterfaceAttribute', be marked partial, and be non-generic. + Classes with 'GeneratedComClassAttribute' must implement one or more interfaces with 'GeneratedComInterfaceAttribute', be marked partial, and be non-generic. + + + + Class '{0}' or one of its containing types is not marked 'partial'. + Class '{0}' or one of its containing types is not marked 'partial'. + + + + Invalid 'GeneratedComClassAttribute' usage + Invalid 'GeneratedComClassAttribute' usage + + Interfaces attributed with 'GeneratedComInterfaceAttribute' must be partial, non-generic, and must specify a GUID with 'System.Runtime.InteropServices.GuidAttribute'. Interfejsy z atrybutem „GeneratedComInterfaceAttribute” muszą być częściowe, nie być ogóle, i muszą określać identyfikator GUID z atrybutem „System.Runtime.InteropServices.GuidAttribute”. @@ -217,6 +232,11 @@ Nieprawidłowe użycie atrybutu „GeneratedComInterfaceAttribute”. + + The interface '{0}' or one of its containing types is missing the 'partial' keyword. Code will not be generated for '{0}'. + The interface '{0}' or one of its containing types is missing the 'partial' keyword. Code will not be generated for '{0}'. + + The configuration of 'StringMarshalling' and 'StringMarshallingCustomType' is invalid. Konfiguracja elementów „StringMarshalling” i „StringMarshallingCustomType” jest nieprawidłowa. diff --git a/src/libraries/System.Runtime.InteropServices/gen/ComInterfaceGenerator/Resources/xlf/Strings.pt-BR.xlf b/src/libraries/System.Runtime.InteropServices/gen/ComInterfaceGenerator/Resources/xlf/Strings.pt-BR.xlf index 5486a4506d2..48c7fdb85d7 100644 --- a/src/libraries/System.Runtime.InteropServices/gen/ComInterfaceGenerator/Resources/xlf/Strings.pt-BR.xlf +++ b/src/libraries/System.Runtime.InteropServices/gen/ComInterfaceGenerator/Resources/xlf/Strings.pt-BR.xlf @@ -38,8 +38,8 @@ - Analysis for generation has failed. - Falha na análise de geração. + Analysis for COM interface generation has failed. + Falha na análise de geração. @@ -53,8 +53,8 @@ - The base COM interface failed to generate source. ComInterfaceGenerator will not generate source for this interface. - A interface COM base falhou ao gerar a fonte. ComInterfaceGenerator não irá gerar fonte para esta interface. + The base COM interface failed to generate source. Code will not be generated for this interface. + A interface COM base falhou ao gerar a fonte. ComInterfaceGenerator não irá gerar fonte para esta interface. @@ -197,6 +197,21 @@ O valor fornecido não é um sinalizador conhecido da enumeração 'ExceptionMarshalling'. + + Classes with 'GeneratedComClassAttribute' must implement one or more interfaces with 'GeneratedComInterfaceAttribute', be marked partial, and be non-generic. + Classes with 'GeneratedComClassAttribute' must implement one or more interfaces with 'GeneratedComInterfaceAttribute', be marked partial, and be non-generic. + + + + Class '{0}' or one of its containing types is not marked 'partial'. + Class '{0}' or one of its containing types is not marked 'partial'. + + + + Invalid 'GeneratedComClassAttribute' usage + Invalid 'GeneratedComClassAttribute' usage + + Interfaces attributed with 'GeneratedComInterfaceAttribute' must be partial, non-generic, and must specify a GUID with 'System.Runtime.InteropServices.GuidAttribute'. As interfaces atribuídas com "GeneratedComInterfaceAttribute" devem ser parciais, não-genéricas e especificar um GUID com "System.Runtime.InteropServices.GuidAttribute". @@ -217,6 +232,11 @@ Uso de "GeneratedComInterfaceAttribute" inválido. + + The interface '{0}' or one of its containing types is missing the 'partial' keyword. Code will not be generated for '{0}'. + The interface '{0}' or one of its containing types is missing the 'partial' keyword. Code will not be generated for '{0}'. + + The configuration of 'StringMarshalling' and 'StringMarshallingCustomType' is invalid. A configuração de 'StringMarshalling' e 'StringMarshallingCustomType' é inválida. diff --git a/src/libraries/System.Runtime.InteropServices/gen/ComInterfaceGenerator/Resources/xlf/Strings.ru.xlf b/src/libraries/System.Runtime.InteropServices/gen/ComInterfaceGenerator/Resources/xlf/Strings.ru.xlf index 12e76c94559..f2721f11669 100644 --- a/src/libraries/System.Runtime.InteropServices/gen/ComInterfaceGenerator/Resources/xlf/Strings.ru.xlf +++ b/src/libraries/System.Runtime.InteropServices/gen/ComInterfaceGenerator/Resources/xlf/Strings.ru.xlf @@ -38,8 +38,8 @@ - Analysis for generation has failed. - Сбой анализа для создания. + Analysis for COM interface generation has failed. + Сбой анализа для создания. @@ -53,8 +53,8 @@ - The base COM interface failed to generate source. ComInterfaceGenerator will not generate source for this interface. - Базовому COM-интерфейсу не удалось создать источник. ComInterfaceGenerator не будет создавать источник для этого интерфейса. + The base COM interface failed to generate source. Code will not be generated for this interface. + Базовому COM-интерфейсу не удалось создать источник. ComInterfaceGenerator не будет создавать источник для этого интерфейса. @@ -197,6 +197,21 @@ Указанное значение не является известным флагом перечисления ExceptionMarshalling. + + Classes with 'GeneratedComClassAttribute' must implement one or more interfaces with 'GeneratedComInterfaceAttribute', be marked partial, and be non-generic. + Classes with 'GeneratedComClassAttribute' must implement one or more interfaces with 'GeneratedComInterfaceAttribute', be marked partial, and be non-generic. + + + + Class '{0}' or one of its containing types is not marked 'partial'. + Class '{0}' or one of its containing types is not marked 'partial'. + + + + Invalid 'GeneratedComClassAttribute' usage + Invalid 'GeneratedComClassAttribute' usage + + Interfaces attributed with 'GeneratedComInterfaceAttribute' must be partial, non-generic, and must specify a GUID with 'System.Runtime.InteropServices.GuidAttribute'. Интерфейсы с атрибутом GeneratedComInterfaceAttribute должны быть частичными, не универсальными и должны указывать GUID с помощью System.Runtime.InteropServices.GuidAttribute. @@ -217,6 +232,11 @@ Недопустимое применение GeneratedComInterfaceAttribute. + + The interface '{0}' or one of its containing types is missing the 'partial' keyword. Code will not be generated for '{0}'. + The interface '{0}' or one of its containing types is missing the 'partial' keyword. Code will not be generated for '{0}'. + + The configuration of 'StringMarshalling' and 'StringMarshallingCustomType' is invalid. Конфигурация \"StringMarshalling\" и \"StringMarshallingCustomType\" недопустима. diff --git a/src/libraries/System.Runtime.InteropServices/gen/ComInterfaceGenerator/Resources/xlf/Strings.tr.xlf b/src/libraries/System.Runtime.InteropServices/gen/ComInterfaceGenerator/Resources/xlf/Strings.tr.xlf index c40fff4ef18..34a1e3448ca 100644 --- a/src/libraries/System.Runtime.InteropServices/gen/ComInterfaceGenerator/Resources/xlf/Strings.tr.xlf +++ b/src/libraries/System.Runtime.InteropServices/gen/ComInterfaceGenerator/Resources/xlf/Strings.tr.xlf @@ -38,8 +38,8 @@ - Analysis for generation has failed. - Oluşturma analizi başarısız oldu. + Analysis for COM interface generation has failed. + Oluşturma analizi başarısız oldu. @@ -53,8 +53,8 @@ - The base COM interface failed to generate source. ComInterfaceGenerator will not generate source for this interface. - Temel COM arabirimi kaynak oluşturamadı. ComInterfaceGenerator bu arabirim için kaynak oluşturamaz. + The base COM interface failed to generate source. Code will not be generated for this interface. + Temel COM arabirimi kaynak oluşturamadı. ComInterfaceGenerator bu arabirim için kaynak oluşturamaz. @@ -197,6 +197,21 @@ Sağlanan değer bilinen bir 'ExceptionMarshalling' sabit listesi bayrağı değil. + + Classes with 'GeneratedComClassAttribute' must implement one or more interfaces with 'GeneratedComInterfaceAttribute', be marked partial, and be non-generic. + Classes with 'GeneratedComClassAttribute' must implement one or more interfaces with 'GeneratedComInterfaceAttribute', be marked partial, and be non-generic. + + + + Class '{0}' or one of its containing types is not marked 'partial'. + Class '{0}' or one of its containing types is not marked 'partial'. + + + + Invalid 'GeneratedComClassAttribute' usage + Invalid 'GeneratedComClassAttribute' usage + + Interfaces attributed with 'GeneratedComInterfaceAttribute' must be partial, non-generic, and must specify a GUID with 'System.Runtime.InteropServices.GuidAttribute'. 'GeneratedComInterfaceAttribute' özniteliğine sahip arabirimler kısmi olmalı, genel olmamalı ve 'System.Runtime.InteropServices.GuidAttribute' ile bir GUID belirtmelidir. @@ -217,6 +232,11 @@ Geçersiz 'GeneratedComInterfaceAttribute' kullanımı. + + The interface '{0}' or one of its containing types is missing the 'partial' keyword. Code will not be generated for '{0}'. + The interface '{0}' or one of its containing types is missing the 'partial' keyword. Code will not be generated for '{0}'. + + The configuration of 'StringMarshalling' and 'StringMarshallingCustomType' is invalid. 'StringMarshalling' ve 'StringMarshallingCustomType' yapılandırması geçersiz. diff --git a/src/libraries/System.Runtime.InteropServices/gen/ComInterfaceGenerator/Resources/xlf/Strings.zh-Hans.xlf b/src/libraries/System.Runtime.InteropServices/gen/ComInterfaceGenerator/Resources/xlf/Strings.zh-Hans.xlf index 4f4d31caf85..bf91ed426bb 100644 --- a/src/libraries/System.Runtime.InteropServices/gen/ComInterfaceGenerator/Resources/xlf/Strings.zh-Hans.xlf +++ b/src/libraries/System.Runtime.InteropServices/gen/ComInterfaceGenerator/Resources/xlf/Strings.zh-Hans.xlf @@ -38,8 +38,8 @@ - Analysis for generation has failed. - 生成分析失败。 + Analysis for COM interface generation has failed. + 生成分析失败。 @@ -53,8 +53,8 @@ - The base COM interface failed to generate source. ComInterfaceGenerator will not generate source for this interface. - 基本 COM 接口无法生成源。ComInterfaceGenerator 不会为此接口生成源。 + The base COM interface failed to generate source. Code will not be generated for this interface. + 基本 COM 接口无法生成源。ComInterfaceGenerator 不会为此接口生成源。 @@ -197,6 +197,21 @@ 提供的值不是 “ExceptionMarshalling” 枚举的已知标志。 + + Classes with 'GeneratedComClassAttribute' must implement one or more interfaces with 'GeneratedComInterfaceAttribute', be marked partial, and be non-generic. + Classes with 'GeneratedComClassAttribute' must implement one or more interfaces with 'GeneratedComInterfaceAttribute', be marked partial, and be non-generic. + + + + Class '{0}' or one of its containing types is not marked 'partial'. + Class '{0}' or one of its containing types is not marked 'partial'. + + + + Invalid 'GeneratedComClassAttribute' usage + Invalid 'GeneratedComClassAttribute' usage + + Interfaces attributed with 'GeneratedComInterfaceAttribute' must be partial, non-generic, and must specify a GUID with 'System.Runtime.InteropServices.GuidAttribute'. 通过 "GeneratedComInterfaceAttribute" 特性化的接口必须是部分的、非泛型的,并且必须使用 "System.Runtime.InteropServices.GuidAttribute" 指定 GUID。 @@ -217,6 +232,11 @@ “GeneratedComInterfaceAttribute” 使用无效。 + + The interface '{0}' or one of its containing types is missing the 'partial' keyword. Code will not be generated for '{0}'. + The interface '{0}' or one of its containing types is missing the 'partial' keyword. Code will not be generated for '{0}'. + + The configuration of 'StringMarshalling' and 'StringMarshallingCustomType' is invalid. “StringMarshalling” 和 “StringMarshallingCustomType” 的配置无效。 diff --git a/src/libraries/System.Runtime.InteropServices/gen/ComInterfaceGenerator/Resources/xlf/Strings.zh-Hant.xlf b/src/libraries/System.Runtime.InteropServices/gen/ComInterfaceGenerator/Resources/xlf/Strings.zh-Hant.xlf index c47e7b9519c..a68f8e0273a 100644 --- a/src/libraries/System.Runtime.InteropServices/gen/ComInterfaceGenerator/Resources/xlf/Strings.zh-Hant.xlf +++ b/src/libraries/System.Runtime.InteropServices/gen/ComInterfaceGenerator/Resources/xlf/Strings.zh-Hant.xlf @@ -38,8 +38,8 @@ - Analysis for generation has failed. - 產生分析失敗。 + Analysis for COM interface generation has failed. + 產生分析失敗。 @@ -53,8 +53,8 @@ - The base COM interface failed to generate source. ComInterfaceGenerator will not generate source for this interface. - 基底 COM 介面無法產生來源。ComInterfaceGenerator 不會產生此介面的來源。 + The base COM interface failed to generate source. Code will not be generated for this interface. + 基底 COM 介面無法產生來源。ComInterfaceGenerator 不會產生此介面的來源。 @@ -197,6 +197,21 @@ 提供的值不是 'ExceptionMarshalling' 列舉的已知旗標。 + + Classes with 'GeneratedComClassAttribute' must implement one or more interfaces with 'GeneratedComInterfaceAttribute', be marked partial, and be non-generic. + Classes with 'GeneratedComClassAttribute' must implement one or more interfaces with 'GeneratedComInterfaceAttribute', be marked partial, and be non-generic. + + + + Class '{0}' or one of its containing types is not marked 'partial'. + Class '{0}' or one of its containing types is not marked 'partial'. + + + + Invalid 'GeneratedComClassAttribute' usage + Invalid 'GeneratedComClassAttribute' usage + + Interfaces attributed with 'GeneratedComInterfaceAttribute' must be partial, non-generic, and must specify a GUID with 'System.Runtime.InteropServices.GuidAttribute'. 屬性為 'GeneratedComInterfaceAttribute' 的介面必須是部分的非泛型介面,且必須指定具有 'System.Runtime.InteropServices.GuidAttribute' 的 GUID。 @@ -217,6 +232,11 @@ 無效的 'GeneratedComInterfaceAttribute' 使用方式。 + + The interface '{0}' or one of its containing types is missing the 'partial' keyword. Code will not be generated for '{0}'. + The interface '{0}' or one of its containing types is missing the 'partial' keyword. Code will not be generated for '{0}'. + + The configuration of 'StringMarshalling' and 'StringMarshallingCustomType' is invalid. 'StringMarshalling' 和 'StringMarshallingCustomType' 的設定無效。 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 index 00000000000..c59d439df86 --- /dev/null +++ b/src/libraries/System.Runtime.InteropServices/tests/ComInterfaceGenerator.Tests/RcwAroundCcwTests.cs @@ -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() 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(); + obj.SetInt(1); + Assert.Equal(1, obj.GetInt()); + } + + [Fact] + public void IDerived() + { + var obj = CreateWrapper(); + obj.SetInt(1); + Assert.Equal(1, obj.GetInt()); + obj.SetName("A"); + Assert.Equal("A", obj.GetName()); + } + + [Fact] + public void IBool() + { + var obj = CreateWrapper(); + Assert.False(obj.Get()); + obj.Set(true); + Assert.True(obj.Get()); + } + + [Fact] + public void IFloat() + { + var obj = CreateWrapper(); + obj.Set(2.71F); + Assert.Equal(2.71F, obj.Get()); + } + + [Fact] + public void IIntArray() + { + var obj = CreateWrapper(); + 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(); + + 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(); + var obj = CreateWrapper(); + obj.Set(iint); + _ = obj.Get(); + } + + [Fact] + public void ICollectionMarshallingFails() + { + var obj = CreateWrapper(); + + Assert.Throws(() => + _ = obj.Get() + ); + Assert.Throws(() => + 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; + } + } + } +} diff --git a/src/libraries/System.Runtime.InteropServices/tests/ComInterfaceGenerator.Tests/StringMarshallingTests.cs b/src/libraries/System.Runtime.InteropServices/tests/ComInterfaceGenerator.Tests/StringMarshallingTests.cs index c359be79f29..59151d91f13 100644 --- a/src/libraries/System.Runtime.InteropServices/tests/ComInterfaceGenerator.Tests/StringMarshallingTests.cs +++ b/src/libraries/System.Runtime.InteropServices/tests/ComInterfaceGenerator.Tests/StringMarshallingTests.cs @@ -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(); diff --git a/src/libraries/System.Runtime.InteropServices/tests/ComInterfaceGenerator.Unit.Tests/CompileFails.cs b/src/libraries/System.Runtime.InteropServices/tests/ComInterfaceGenerator.Unit.Tests/CompileFails.cs index 7c00170541d..c7fc7cd4324 100644 --- a/src/libraries/System.Runtime.InteropServices/tests/ComInterfaceGenerator.Unit.Tests/CompileFails.cs +++ b/src/libraries/System.Runtime.InteropServices/tests/ComInterfaceGenerator.Unit.Tests/CompileFails.cs @@ -420,6 +420,38 @@ namespace ComInterfaceGenerator.Unit.Tests await VerifyComInterfaceGenerator.VerifySourceGeneratorAsync(source, expectedDiagnostic); } + [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() { diff --git a/src/libraries/System.Runtime.InteropServices/tests/ComInterfaceGenerator.Unit.Tests/GeneratedComInterfaceAnalyzerTests.cs b/src/libraries/System.Runtime.InteropServices/tests/ComInterfaceGenerator.Unit.Tests/GeneratedComInterfaceAnalyzerTests.cs index 32d2801fce6..902c6775c77 100644 --- a/src/libraries/System.Runtime.InteropServices/tests/ComInterfaceGenerator.Unit.Tests/GeneratedComInterfaceAnalyzerTests.cs +++ b/src/libraries/System.Runtime.InteropServices/tests/ComInterfaceGenerator.Unit.Tests/GeneratedComInterfaceAnalyzerTests.cs @@ -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")); } diff --git a/src/libraries/System.Runtime.InteropServices/tests/TestAssets/SharedTypes/ComInterfaces/IDerived.cs b/src/libraries/System.Runtime.InteropServices/tests/TestAssets/SharedTypes/ComInterfaces/IDerived.cs index 1c82b963588..54669fa6c38 100644 --- a/src/libraries/System.Runtime.InteropServices/tests/TestAssets/SharedTypes/ComInterfaces/IDerived.cs +++ b/src/libraries/System.Runtime.InteropServices/tests/TestAssets/SharedTypes/ComInterfaces/IDerived.cs @@ -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; + } } diff --git a/src/libraries/System.Runtime.InteropServices/tests/TestAssets/SharedTypes/ComInterfaces/IGetAndSetInt.cs b/src/libraries/System.Runtime.InteropServices/tests/TestAssets/SharedTypes/ComInterfaces/IGetAndSetInt.cs index f1b46c81b79..54e7fb896bf 100644 --- a/src/libraries/System.Runtime.InteropServices/tests/TestAssets/SharedTypes/ComInterfaces/IGetAndSetInt.cs +++ b/src/libraries/System.Runtime.InteropServices/tests/TestAssets/SharedTypes/ComInterfaces/IGetAndSetInt.cs @@ -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; + } }