From e964140a984421c6eb64530edb61a87a73d0f182 Mon Sep 17 00:00:00 2001 From: Jackson Schuster Date: Tue, 6 Jun 2023 15:22:56 -0700 Subject: [PATCH 1/7] Warn on CustomMarshallerAnalyzer if the MarshaMode is not valid --- .../CustomMarshallerAttributeAnalyzer.cs | 19 ++++++++++ .../Resources/Strings.resx | 8 ++++- .../Resources/xlf/Strings.cs.xlf | 10 ++++++ .../Resources/xlf/Strings.de.xlf | 10 ++++++ .../Resources/xlf/Strings.es.xlf | 10 ++++++ .../Resources/xlf/Strings.fr.xlf | 10 ++++++ .../Resources/xlf/Strings.it.xlf | 10 ++++++ .../Resources/xlf/Strings.ja.xlf | 10 ++++++ .../Resources/xlf/Strings.ko.xlf | 10 ++++++ .../Resources/xlf/Strings.pl.xlf | 10 ++++++ .../Resources/xlf/Strings.pt-BR.xlf | 10 ++++++ .../Resources/xlf/Strings.ru.xlf | 10 ++++++ .../Resources/xlf/Strings.tr.xlf | 10 ++++++ .../Resources/xlf/Strings.zh-Hans.xlf | 10 ++++++ .../Resources/xlf/Strings.zh-Hant.xlf | 10 ++++++ ...allerAttributeFixerTests_AttributeUsage.cs | 36 +++++++++++++++++++ 16 files changed, 192 insertions(+), 1 deletion(-) diff --git a/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Analyzers/CustomMarshallerAttributeAnalyzer.cs b/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Analyzers/CustomMarshallerAttributeAnalyzer.cs index b0dbeea67f5b78..6b068a2bce39fc 100644 --- a/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Analyzers/CustomMarshallerAttributeAnalyzer.cs +++ b/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Analyzers/CustomMarshallerAttributeAnalyzer.cs @@ -395,6 +395,17 @@ public static ImmutableDictionary CreateDiagnosticPropertiesForM isEnabledByDefault: true, description: GetResourceString(nameof(SR.ManagedTypeMustBeNonNullDescription))); + /// + public static readonly DiagnosticDescriptor MarshalModeMustBeValidValue = + new DiagnosticDescriptor( + Ids.InvalidCustomMarshallerAttributeUsage, + GetResourceString(nameof(SR.InvalidMarshalModeTitle)), + GetResourceString(nameof(SR.MarshalModeMustBeValidEnumValue)), + Category, + DiagnosticSeverity.Error, + isEnabledByDefault: true, + description: GetResourceString(nameof(SR.MarshalModeMustBeValidEnumValue))); + // We are intentionally using the same diagnostic IDs as the parent type. // These diagnostics are the same diagnostics, but with a different severity, // as the Default marshaller shape can have support for the managed-to-unmanaged shape @@ -676,6 +687,14 @@ public void AnalyzeAttribute(OperationAnalysisContext context) { return; } + var marshalModeArgument = attrCreation.GetArgumentByOrdinal(1); + if (marshalModeArgument.Syntax.ChildNodes().SingleOrDefault() is BinaryExpressionSyntax expression + || !Enum.IsDefined(typeof(MarshalMode), (MarshalMode) marshalModeArgument.Value.ConstantValue.Value)) + { + DiagnosticReporter marshalModeReporter = DiagnosticReporter.CreateForLocation(marshalModeArgument.Syntax.GetLocation(), context.ReportDiagnostic); + marshalModeReporter.CreateAndReportDiagnostic(MarshalModeMustBeValidValue); + return; + } AnalyzeMarshallerType( marshallerTypeReporter, diff --git a/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/Strings.resx b/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/Strings.resx index 8224ad74f4b73f..63aaa8f80be189 100644 --- a/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/Strings.resx +++ b/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/Strings.resx @@ -497,4 +497,10 @@ Convert to 'LibraryImport' with '{0}' suffix and enable unsafe code - + + Invalid MarshalMode value. + + + The 'marshalMode' argument of 'CustomMarshallerAttribute' must be a valid enum value of MarshalMode. + + \ No newline at end of file diff --git a/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.cs.xlf b/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.cs.xlf index 0371a69dfb1063..684de9e15b285b 100644 --- a/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.cs.xlf +++ b/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.cs.xlf @@ -217,6 +217,11 @@ Zadaný spravovaný typ je neplatný + + Invalid MarshalMode value. + Invalid MarshalMode value. + + Specified marshaller type is invalid Zadaný zařazovací typ je neplatný @@ -312,6 +317,11 @@ Spravovaný typ pro zařazovací typ vstupního bodu {0} nesmí nabývat hodnoty null. + + The 'marshalMode' value of CustomMarshallerAttribute must be a valid enum value of MarshalMode. + The 'marshalMode' value of CustomMarshallerAttribute must be a valid enum value of MarshalMode. + + The marshaller type must be a closed generic or have the same number of generic parameters as the managed type so the emitted code can use a specific instantiation. Zařazovací typ musí být uzavřený obecný typ nebo mít stejný počet obecných parametrů jako spravovaný typ, aby mohl vygenerovaný kód použít konkrétní vytvoření instance. diff --git a/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.de.xlf b/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.de.xlf index 6568eef9a5179e..ed362785efe366 100644 --- a/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.de.xlf +++ b/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.de.xlf @@ -217,6 +217,11 @@ Der angegebene verwaltete Typ ist ungültig. + + Invalid MarshalMode value. + Invalid MarshalMode value. + + Specified marshaller type is invalid Der angegebene Marshallertyp ist ungültig. @@ -312,6 +317,11 @@ Der verwaltete Typ für den Einstiegspunkt-Marshallertyp "{0}" darf nicht "NULL" sein + + The 'marshalMode' value of CustomMarshallerAttribute must be a valid enum value of MarshalMode. + The 'marshalMode' value of CustomMarshallerAttribute must be a valid enum value of MarshalMode. + + The marshaller type must be a closed generic or have the same number of generic parameters as the managed type so the emitted code can use a specific instantiation. Der Marshaller-Typ muss ein geschlossener generischer Typ sein oder dieselbe Anzahl generischer Parameter wie der verwaltete Typ aufweisen, damit der ausgegebene Code eine bestimmte Instanziierung verwenden kann. diff --git a/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.es.xlf b/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.es.xlf index 466e28d4ce7b75..2501a6051dba78 100644 --- a/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.es.xlf +++ b/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.es.xlf @@ -217,6 +217,11 @@ El tipo administrado especificado no es válido + + Invalid MarshalMode value. + Invalid MarshalMode value. + + Specified marshaller type is invalid El tipo de serializador especificado no es válido @@ -312,6 +317,11 @@ El tipo administrado para el tipo de serializador de punto de entrada "{0}" no debe ser "null" + + The 'marshalMode' value of CustomMarshallerAttribute must be a valid enum value of MarshalMode. + The 'marshalMode' value of CustomMarshallerAttribute must be a valid enum value of MarshalMode. + + The marshaller type must be a closed generic or have the same number of generic parameters as the managed type so the emitted code can use a specific instantiation. El tipo serializador debe ser un genérico cerrado o tener el mismo número de parámetros genéricos que el tipo administrado para que el código emitido pueda usar una creación de instancia específica. diff --git a/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.fr.xlf b/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.fr.xlf index 085613c575fb5c..fc564991e033a4 100644 --- a/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.fr.xlf +++ b/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.fr.xlf @@ -217,6 +217,11 @@ Le type managé spécifié n’est pas valide + + Invalid MarshalMode value. + Invalid MarshalMode value. + + Specified marshaller type is invalid Le type de marshaleur spécifié n’est pas valide @@ -312,6 +317,11 @@ Le type managé du type marshaleur de point d’entrée « {0} » ne doit pas avoir la valeur 'null' + + The 'marshalMode' value of CustomMarshallerAttribute must be a valid enum value of MarshalMode. + The 'marshalMode' value of CustomMarshallerAttribute must be a valid enum value of MarshalMode. + + The marshaller type must be a closed generic or have the same number of generic parameters as the managed type so the emitted code can use a specific instantiation. Le type marshaler doit être un générique fermé ou avoir le même nombre de paramètres génériques que le type managé pour que le code émis puisse utiliser une instanciation spécifique. diff --git a/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.it.xlf b/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.it.xlf index 30039cecd7c00c..22a943408c89a0 100644 --- a/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.it.xlf +++ b/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.it.xlf @@ -217,6 +217,11 @@ Il tipo gestito specificato non è valido + + Invalid MarshalMode value. + Invalid MarshalMode value. + + Specified marshaller type is invalid Il tipo di marshaller specificato non è valido @@ -312,6 +317,11 @@ Il tipo gestito per il tipo di marshaller del punto di ingresso '{0}' non deve essere 'null' + + The 'marshalMode' value of CustomMarshallerAttribute must be a valid enum value of MarshalMode. + The 'marshalMode' value of CustomMarshallerAttribute must be a valid enum value of MarshalMode. + + The marshaller type must be a closed generic or have the same number of generic parameters as the managed type so the emitted code can use a specific instantiation. Il tipo di marshaller deve essere un generico chiuso o avere lo stesso numero di parametri generici del tipo gestito, in modo che il codice generato possa usare una creazione di istanza specifica. diff --git a/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.ja.xlf b/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.ja.xlf index ecf2587cbdf319..7df3128bde6106 100644 --- a/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.ja.xlf +++ b/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.ja.xlf @@ -217,6 +217,11 @@ 指定されたマネージド型が無効です + + Invalid MarshalMode value. + Invalid MarshalMode value. + + Specified marshaller type is invalid 指定されたマーシャラー型が無効です @@ -312,6 +317,11 @@ エントリ ポイント マーシャラー型 '{0}' のマネージド型を 'null' にすることはできません + + The 'marshalMode' value of CustomMarshallerAttribute must be a valid enum value of MarshalMode. + The 'marshalMode' value of CustomMarshallerAttribute must be a valid enum value of MarshalMode. + + The marshaller type must be a closed generic or have the same number of generic parameters as the managed type so the emitted code can use a specific instantiation. マーシャラー型は、クローズ ジェネリックであるか、マネージド型と同じ数のジェネリック パラメーターを持つ必要があります。これにより、生成されたコードが特定のインスタンス化を使用できるようになります。 diff --git a/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.ko.xlf b/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.ko.xlf index 472d83e9e2eb21..a3000f8362afbe 100644 --- a/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.ko.xlf +++ b/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.ko.xlf @@ -217,6 +217,11 @@ 지정된 관리 유형이 잘못되었습니다. + + Invalid MarshalMode value. + Invalid MarshalMode value. + + Specified marshaller type is invalid 지정된 마샬러 유형이 잘못되었습니다. @@ -312,6 +317,11 @@ 진입점 마샬러 유형 '{0}'의 관리 유형은 'null'이 아니어야 합니다. + + The 'marshalMode' value of CustomMarshallerAttribute must be a valid enum value of MarshalMode. + The 'marshalMode' value of CustomMarshallerAttribute must be a valid enum value of MarshalMode. + + The marshaller type must be a closed generic or have the same number of generic parameters as the managed type so the emitted code can use a specific instantiation. 마샬러 형식은 닫힌 제네릭이거나 관리되는 형식과 동일한 수의 제네릭 매개 변수가 있어야 내보낸 코드에서 특정 인스턴스화를 사용할 수 있습니다. diff --git a/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.pl.xlf b/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.pl.xlf index c676a94b3cf76f..5291f8ff262c1e 100644 --- a/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.pl.xlf +++ b/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.pl.xlf @@ -217,6 +217,11 @@ Określony typ zarządzany jest nieprawidłowy + + Invalid MarshalMode value. + Invalid MarshalMode value. + + Specified marshaller type is invalid Określony typ marshallera jest nieprawidłowy @@ -312,6 +317,11 @@ Typ zarządzany dla typu marshaller punktu wejścia „{0}” nie może mieć wartości „null” + + The 'marshalMode' value of CustomMarshallerAttribute must be a valid enum value of MarshalMode. + The 'marshalMode' value of CustomMarshallerAttribute must be a valid enum value of MarshalMode. + + The marshaller type must be a closed generic or have the same number of generic parameters as the managed type so the emitted code can use a specific instantiation. Typ marshallera musi być zamkniętym typem ogólnym lub mieć taką samą liczbę parametrów ogólnych jak typ zarządzany, aby emitowany kod mógł używać określonego wystąpienia. diff --git a/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.pt-BR.xlf b/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.pt-BR.xlf index 0287f442c221ea..65e4e0bd7bd60f 100644 --- a/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.pt-BR.xlf +++ b/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.pt-BR.xlf @@ -217,6 +217,11 @@ O tipo gerenciado especificado é inválido + + Invalid MarshalMode value. + Invalid MarshalMode value. + + Specified marshaller type is invalid O tipo de empacotador especificado é inválido @@ -312,6 +317,11 @@ O tipo gerenciado para o tipo de empacotador de ponto de entrada '{0}' não deve ser 'nulo' + + The 'marshalMode' value of CustomMarshallerAttribute must be a valid enum value of MarshalMode. + The 'marshalMode' value of CustomMarshallerAttribute must be a valid enum value of MarshalMode. + + The marshaller type must be a closed generic or have the same number of generic parameters as the managed type so the emitted code can use a specific instantiation. O tipo de empacotador deve ser um genérico fechado ou ter o mesmo número de parâmetros genéricos que o tipo gerenciado para que o código emitido possa usar uma instanciação específica. diff --git a/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.ru.xlf b/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.ru.xlf index 2a5d553958d215..13f592eef8df77 100644 --- a/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.ru.xlf +++ b/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.ru.xlf @@ -217,6 +217,11 @@ Указан недопустимый управляемый тип + + Invalid MarshalMode value. + Invalid MarshalMode value. + + Specified marshaller type is invalid Указан недопустимый тип маршалера @@ -312,6 +317,11 @@ Управляемый тип для типа маршалера точки входа "{0}" должен отличаться от "NULL" + + The 'marshalMode' value of CustomMarshallerAttribute must be a valid enum value of MarshalMode. + The 'marshalMode' value of CustomMarshallerAttribute must be a valid enum value of MarshalMode. + + The marshaller type must be a closed generic or have the same number of generic parameters as the managed type so the emitted code can use a specific instantiation. Тип маршалера должен быть закрытым универсальным или иметь то же количество универсальных параметров, что и управляемый тип, чтобы создаваемый код мог использовать конкретный экземпляр. diff --git a/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.tr.xlf b/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.tr.xlf index 7734ac571418d5..ad085d2645bcd3 100644 --- a/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.tr.xlf +++ b/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.tr.xlf @@ -217,6 +217,11 @@ Belirtilen yönetilen tür geçersiz + + Invalid MarshalMode value. + Invalid MarshalMode value. + + Specified marshaller type is invalid Belirtilen hazırlayıcı türü geçersiz @@ -312,6 +317,11 @@ Giriş noktası hazırlayıcı türü '{0}' için yönetilen tür 'null' olmamalıdır + + The 'marshalMode' value of CustomMarshallerAttribute must be a valid enum value of MarshalMode. + The 'marshalMode' value of CustomMarshallerAttribute must be a valid enum value of MarshalMode. + + The marshaller type must be a closed generic or have the same number of generic parameters as the managed type so the emitted code can use a specific instantiation. Hazırlayıcı türü kapalı bir genel tür olmalıdır veya gösterilen kodun belirli bir örnek oluşturma kullanabilmesi için yönetilen türle aynı sayıda genel parametreye sahip olmalıdır. diff --git a/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.zh-Hans.xlf b/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.zh-Hans.xlf index 1a804b14381b3b..585f5c10001ef6 100644 --- a/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.zh-Hans.xlf +++ b/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.zh-Hans.xlf @@ -217,6 +217,11 @@ 指定的托管类型无效 + + Invalid MarshalMode value. + Invalid MarshalMode value. + + Specified marshaller type is invalid 指定的封送处理程序类型无效 @@ -312,6 +317,11 @@ 入口点封送处理程序类型“{0}”的托管类型不能为“null” + + The 'marshalMode' value of CustomMarshallerAttribute must be a valid enum value of MarshalMode. + The 'marshalMode' value of CustomMarshallerAttribute must be a valid enum value of MarshalMode. + + The marshaller type must be a closed generic or have the same number of generic parameters as the managed type so the emitted code can use a specific instantiation. 封送处理程序类型必须是封闭泛型或具有与托管类型相同数目的泛型参数,以便发出的代码可以使用特定实例化。 diff --git a/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.zh-Hant.xlf b/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.zh-Hant.xlf index 0673dd5cf0f962..47e97bea72ad4f 100644 --- a/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.zh-Hant.xlf +++ b/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.zh-Hant.xlf @@ -217,6 +217,11 @@ 指定的受控類型無效 + + Invalid MarshalMode value. + Invalid MarshalMode value. + + Specified marshaller type is invalid 指定的封送處理器類型無效 @@ -312,6 +317,11 @@ 進入點封送處理器類型 '{0}' 的受控類型不得為 'null' + + The 'marshalMode' value of CustomMarshallerAttribute must be a valid enum value of MarshalMode. + The 'marshalMode' value of CustomMarshallerAttribute must be a valid enum value of MarshalMode. + + The marshaller type must be a closed generic or have the same number of generic parameters as the managed type so the emitted code can use a specific instantiation. 封送處理器類型必須是封閉式泛型或具有與受控類型相同的泛型參數數目,因此發出的程式碼可以使用特定的具現化。 diff --git a/src/libraries/System.Runtime.InteropServices/tests/LibraryImportGenerator.UnitTests/CustomMarshallerAttributeFixerTests_AttributeUsage.cs b/src/libraries/System.Runtime.InteropServices/tests/LibraryImportGenerator.UnitTests/CustomMarshallerAttributeFixerTests_AttributeUsage.cs index 03775e7aef3a18..dd47fcba5fac0a 100644 --- a/src/libraries/System.Runtime.InteropServices/tests/LibraryImportGenerator.UnitTests/CustomMarshallerAttributeFixerTests_AttributeUsage.cs +++ b/src/libraries/System.Runtime.InteropServices/tests/LibraryImportGenerator.UnitTests/CustomMarshallerAttributeFixerTests_AttributeUsage.cs @@ -4,6 +4,7 @@ using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.Testing; using System.Collections.Generic; +using System.Runtime.InteropServices.Marshalling; using System.Threading.Tasks; using Xunit; using static Microsoft.Interop.Analyzers.CustomMarshallerAttributeAnalyzer; @@ -30,6 +31,41 @@ static class MarshallerType {} await VerifyCS.VerifyAnalyzerAsync(source, VerifyCS.Diagnostic(ManagedTypeMustBeNonNullRule).WithLocation(0).WithArguments("MarshallerType")); } + [Fact] + public async Task UsingMarshalModeAsFlags_ReportsDiagnostic() + { + string source = """ + using System.Collections.Generic; + using System.Runtime.InteropServices; + using System.Runtime.InteropServices.Marshalling; + [CustomMarshaller(typeof(int), {|#0:MarshalMode.ElementIn | MarshalMode.ElementOut | MarshalMode.Default|}, typeof(MyMarshaller))] + public static class MyMarshaller + { + + } + """; + + await VerifyCS.VerifyAnalyzerAsync(source, + VerifyCS.Diagnostic(MarshalModeMustBeValidValue).WithLocation(0)); + } + + [Fact] + public async Task UsingInvalidMarshalMode_ReportsDiagnostic() + { + string source = """ + using System.Collections.Generic; + using System.Runtime.InteropServices; + using System.Runtime.InteropServices.Marshalling; + [CustomMarshaller(typeof(int), {|#0:(MarshalMode)10|}, typeof(MyMarshaller))] + public static class MyMarshaller + { + + } + """; + + await VerifyCS.VerifyAnalyzerAsync(source, + VerifyCS.Diagnostic(MarshalModeMustBeValidValue).WithLocation(0)); + } [Fact] public async Task MarshallerWithEntryPointAttributeForType_DoesNotReportDiagnostic() From ee34794c62b6e330638b514e102f5600366f6436 Mon Sep 17 00:00:00 2001 From: Jackson Schuster Date: Tue, 6 Jun 2023 17:05:05 -0700 Subject: [PATCH 2/7] Build xlf --- .../gen/LibraryImportGenerator/Resources/xlf/Strings.cs.xlf | 4 ++-- .../gen/LibraryImportGenerator/Resources/xlf/Strings.de.xlf | 4 ++-- .../gen/LibraryImportGenerator/Resources/xlf/Strings.es.xlf | 4 ++-- .../gen/LibraryImportGenerator/Resources/xlf/Strings.fr.xlf | 4 ++-- .../gen/LibraryImportGenerator/Resources/xlf/Strings.it.xlf | 4 ++-- .../gen/LibraryImportGenerator/Resources/xlf/Strings.ja.xlf | 4 ++-- .../gen/LibraryImportGenerator/Resources/xlf/Strings.ko.xlf | 4 ++-- .../gen/LibraryImportGenerator/Resources/xlf/Strings.pl.xlf | 4 ++-- .../LibraryImportGenerator/Resources/xlf/Strings.pt-BR.xlf | 4 ++-- .../gen/LibraryImportGenerator/Resources/xlf/Strings.ru.xlf | 4 ++-- .../gen/LibraryImportGenerator/Resources/xlf/Strings.tr.xlf | 4 ++-- .../LibraryImportGenerator/Resources/xlf/Strings.zh-Hans.xlf | 4 ++-- .../LibraryImportGenerator/Resources/xlf/Strings.zh-Hant.xlf | 4 ++-- 13 files changed, 26 insertions(+), 26 deletions(-) diff --git a/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.cs.xlf b/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.cs.xlf index 684de9e15b285b..20c37f3d94833c 100644 --- a/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.cs.xlf +++ b/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.cs.xlf @@ -318,8 +318,8 @@ - The 'marshalMode' value of CustomMarshallerAttribute must be a valid enum value of MarshalMode. - The 'marshalMode' value of CustomMarshallerAttribute must be a valid enum value of MarshalMode. + The 'marshalMode' argument of 'CustomMarshallerAttribute' must be a valid enum value of MarshalMode. + The 'marshalMode' argument of 'CustomMarshallerAttribute' must be a valid enum value of MarshalMode. diff --git a/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.de.xlf b/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.de.xlf index ed362785efe366..4abe0f01b96ea4 100644 --- a/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.de.xlf +++ b/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.de.xlf @@ -318,8 +318,8 @@ - The 'marshalMode' value of CustomMarshallerAttribute must be a valid enum value of MarshalMode. - The 'marshalMode' value of CustomMarshallerAttribute must be a valid enum value of MarshalMode. + The 'marshalMode' argument of 'CustomMarshallerAttribute' must be a valid enum value of MarshalMode. + The 'marshalMode' argument of 'CustomMarshallerAttribute' must be a valid enum value of MarshalMode. diff --git a/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.es.xlf b/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.es.xlf index 2501a6051dba78..c6bc645e7fe928 100644 --- a/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.es.xlf +++ b/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.es.xlf @@ -318,8 +318,8 @@ - The 'marshalMode' value of CustomMarshallerAttribute must be a valid enum value of MarshalMode. - The 'marshalMode' value of CustomMarshallerAttribute must be a valid enum value of MarshalMode. + The 'marshalMode' argument of 'CustomMarshallerAttribute' must be a valid enum value of MarshalMode. + The 'marshalMode' argument of 'CustomMarshallerAttribute' must be a valid enum value of MarshalMode. diff --git a/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.fr.xlf b/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.fr.xlf index fc564991e033a4..ee8d25867f82ae 100644 --- a/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.fr.xlf +++ b/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.fr.xlf @@ -318,8 +318,8 @@ - The 'marshalMode' value of CustomMarshallerAttribute must be a valid enum value of MarshalMode. - The 'marshalMode' value of CustomMarshallerAttribute must be a valid enum value of MarshalMode. + The 'marshalMode' argument of 'CustomMarshallerAttribute' must be a valid enum value of MarshalMode. + The 'marshalMode' argument of 'CustomMarshallerAttribute' must be a valid enum value of MarshalMode. diff --git a/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.it.xlf b/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.it.xlf index 22a943408c89a0..664b0ad443e9ae 100644 --- a/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.it.xlf +++ b/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.it.xlf @@ -318,8 +318,8 @@ - The 'marshalMode' value of CustomMarshallerAttribute must be a valid enum value of MarshalMode. - The 'marshalMode' value of CustomMarshallerAttribute must be a valid enum value of MarshalMode. + The 'marshalMode' argument of 'CustomMarshallerAttribute' must be a valid enum value of MarshalMode. + The 'marshalMode' argument of 'CustomMarshallerAttribute' must be a valid enum value of MarshalMode. diff --git a/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.ja.xlf b/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.ja.xlf index 7df3128bde6106..6df55ddfef0a23 100644 --- a/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.ja.xlf +++ b/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.ja.xlf @@ -318,8 +318,8 @@ - The 'marshalMode' value of CustomMarshallerAttribute must be a valid enum value of MarshalMode. - The 'marshalMode' value of CustomMarshallerAttribute must be a valid enum value of MarshalMode. + The 'marshalMode' argument of 'CustomMarshallerAttribute' must be a valid enum value of MarshalMode. + The 'marshalMode' argument of 'CustomMarshallerAttribute' must be a valid enum value of MarshalMode. diff --git a/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.ko.xlf b/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.ko.xlf index a3000f8362afbe..ea845e9802ea6c 100644 --- a/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.ko.xlf +++ b/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.ko.xlf @@ -318,8 +318,8 @@ - The 'marshalMode' value of CustomMarshallerAttribute must be a valid enum value of MarshalMode. - The 'marshalMode' value of CustomMarshallerAttribute must be a valid enum value of MarshalMode. + The 'marshalMode' argument of 'CustomMarshallerAttribute' must be a valid enum value of MarshalMode. + The 'marshalMode' argument of 'CustomMarshallerAttribute' must be a valid enum value of MarshalMode. diff --git a/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.pl.xlf b/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.pl.xlf index 5291f8ff262c1e..9d9347614430d9 100644 --- a/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.pl.xlf +++ b/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.pl.xlf @@ -318,8 +318,8 @@ - The 'marshalMode' value of CustomMarshallerAttribute must be a valid enum value of MarshalMode. - The 'marshalMode' value of CustomMarshallerAttribute must be a valid enum value of MarshalMode. + The 'marshalMode' argument of 'CustomMarshallerAttribute' must be a valid enum value of MarshalMode. + The 'marshalMode' argument of 'CustomMarshallerAttribute' must be a valid enum value of MarshalMode. diff --git a/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.pt-BR.xlf b/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.pt-BR.xlf index 65e4e0bd7bd60f..84162b79639f26 100644 --- a/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.pt-BR.xlf +++ b/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.pt-BR.xlf @@ -318,8 +318,8 @@ - The 'marshalMode' value of CustomMarshallerAttribute must be a valid enum value of MarshalMode. - The 'marshalMode' value of CustomMarshallerAttribute must be a valid enum value of MarshalMode. + The 'marshalMode' argument of 'CustomMarshallerAttribute' must be a valid enum value of MarshalMode. + The 'marshalMode' argument of 'CustomMarshallerAttribute' must be a valid enum value of MarshalMode. diff --git a/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.ru.xlf b/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.ru.xlf index 13f592eef8df77..f04184c6206e76 100644 --- a/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.ru.xlf +++ b/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.ru.xlf @@ -318,8 +318,8 @@ - The 'marshalMode' value of CustomMarshallerAttribute must be a valid enum value of MarshalMode. - The 'marshalMode' value of CustomMarshallerAttribute must be a valid enum value of MarshalMode. + The 'marshalMode' argument of 'CustomMarshallerAttribute' must be a valid enum value of MarshalMode. + The 'marshalMode' argument of 'CustomMarshallerAttribute' must be a valid enum value of MarshalMode. diff --git a/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.tr.xlf b/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.tr.xlf index ad085d2645bcd3..221ed338cba550 100644 --- a/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.tr.xlf +++ b/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.tr.xlf @@ -318,8 +318,8 @@ - The 'marshalMode' value of CustomMarshallerAttribute must be a valid enum value of MarshalMode. - The 'marshalMode' value of CustomMarshallerAttribute must be a valid enum value of MarshalMode. + The 'marshalMode' argument of 'CustomMarshallerAttribute' must be a valid enum value of MarshalMode. + The 'marshalMode' argument of 'CustomMarshallerAttribute' must be a valid enum value of MarshalMode. diff --git a/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.zh-Hans.xlf b/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.zh-Hans.xlf index 585f5c10001ef6..0424b6ad98b1e7 100644 --- a/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.zh-Hans.xlf +++ b/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.zh-Hans.xlf @@ -318,8 +318,8 @@ - The 'marshalMode' value of CustomMarshallerAttribute must be a valid enum value of MarshalMode. - The 'marshalMode' value of CustomMarshallerAttribute must be a valid enum value of MarshalMode. + The 'marshalMode' argument of 'CustomMarshallerAttribute' must be a valid enum value of MarshalMode. + The 'marshalMode' argument of 'CustomMarshallerAttribute' must be a valid enum value of MarshalMode. diff --git a/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.zh-Hant.xlf b/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.zh-Hant.xlf index 47e97bea72ad4f..72f133be1b1c92 100644 --- a/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.zh-Hant.xlf +++ b/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.zh-Hant.xlf @@ -318,8 +318,8 @@ - The 'marshalMode' value of CustomMarshallerAttribute must be a valid enum value of MarshalMode. - The 'marshalMode' value of CustomMarshallerAttribute must be a valid enum value of MarshalMode. + The 'marshalMode' argument of 'CustomMarshallerAttribute' must be a valid enum value of MarshalMode. + The 'marshalMode' argument of 'CustomMarshallerAttribute' must be a valid enum value of MarshalMode. From e4d092f2940f57bc5903bc02be557d4b1795f74b Mon Sep 17 00:00:00 2001 From: Jackson Schuster Date: Wed, 7 Jun 2023 17:32:25 -0700 Subject: [PATCH 3/7] Use operation tree, reuse local instead of refetching data --- .../Analyzers/CustomMarshallerAttributeAnalyzer.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Analyzers/CustomMarshallerAttributeAnalyzer.cs b/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Analyzers/CustomMarshallerAttributeAnalyzer.cs index 6b068a2bce39fc..60b71b3dba98ac 100644 --- a/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Analyzers/CustomMarshallerAttributeAnalyzer.cs +++ b/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Analyzers/CustomMarshallerAttributeAnalyzer.cs @@ -688,8 +688,8 @@ public void AnalyzeAttribute(OperationAnalysisContext context) return; } var marshalModeArgument = attrCreation.GetArgumentByOrdinal(1); - if (marshalModeArgument.Syntax.ChildNodes().SingleOrDefault() is BinaryExpressionSyntax expression - || !Enum.IsDefined(typeof(MarshalMode), (MarshalMode) marshalModeArgument.Value.ConstantValue.Value)) + if (marshalModeArgument.Value is not IFieldReferenceOperation { ConstantValue.Value: var marshalMode } + || !Enum.IsDefined(typeof(MarshalMode), (MarshalMode) marshalMode)) { DiagnosticReporter marshalModeReporter = DiagnosticReporter.CreateForLocation(marshalModeArgument.Syntax.GetLocation(), context.ReportDiagnostic); marshalModeReporter.CreateAndReportDiagnostic(MarshalModeMustBeValidValue); @@ -699,7 +699,7 @@ public void AnalyzeAttribute(OperationAnalysisContext context) AnalyzeMarshallerType( marshallerTypeReporter, managedType, - (MarshalMode)attrCreation.GetArgumentByOrdinal(1).Value.ConstantValue.Value, + (MarshalMode)marshalModeArgument.Value.ConstantValue.Value, (INamedTypeSymbol)marshallerType, ManualTypeMarshallingHelper.IsLinearCollectionEntryPoint(entryType)); } From 52183a8dd8d3d3e9aec340f27abc660678c2ba1a Mon Sep 17 00:00:00 2001 From: Jackson Schuster Date: Wed, 7 Jun 2023 17:33:00 -0700 Subject: [PATCH 4/7] forgot to hit save in the edito --- .../Analyzers/CustomMarshallerAttributeAnalyzer.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Analyzers/CustomMarshallerAttributeAnalyzer.cs b/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Analyzers/CustomMarshallerAttributeAnalyzer.cs index 60b71b3dba98ac..9c81a83f377339 100644 --- a/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Analyzers/CustomMarshallerAttributeAnalyzer.cs +++ b/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Analyzers/CustomMarshallerAttributeAnalyzer.cs @@ -689,7 +689,7 @@ public void AnalyzeAttribute(OperationAnalysisContext context) } var marshalModeArgument = attrCreation.GetArgumentByOrdinal(1); if (marshalModeArgument.Value is not IFieldReferenceOperation { ConstantValue.Value: var marshalMode } - || !Enum.IsDefined(typeof(MarshalMode), (MarshalMode) marshalMode)) + || !Enum.IsDefined(typeof(MarshalMode), (MarshalMode)marshalMode)) { DiagnosticReporter marshalModeReporter = DiagnosticReporter.CreateForLocation(marshalModeArgument.Syntax.GetLocation(), context.ReportDiagnostic); marshalModeReporter.CreateAndReportDiagnostic(MarshalModeMustBeValidValue); @@ -699,7 +699,7 @@ public void AnalyzeAttribute(OperationAnalysisContext context) AnalyzeMarshallerType( marshallerTypeReporter, managedType, - (MarshalMode)marshalModeArgument.Value.ConstantValue.Value, + (MarshalMode)marshalMode, (INamedTypeSymbol)marshallerType, ManualTypeMarshallingHelper.IsLinearCollectionEntryPoint(entryType)); } From 78821bb9bd3d12785267f346a06e531921b45486 Mon Sep 17 00:00:00 2001 From: Jackson Schuster Date: Fri, 9 Jun 2023 12:40:08 -0700 Subject: [PATCH 5/7] Code cleanup --- .../Analyzers/CustomMarshallerAttributeAnalyzer.cs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Analyzers/CustomMarshallerAttributeAnalyzer.cs b/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Analyzers/CustomMarshallerAttributeAnalyzer.cs index 9c81a83f377339..f5ed61fb817e5d 100644 --- a/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Analyzers/CustomMarshallerAttributeAnalyzer.cs +++ b/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Analyzers/CustomMarshallerAttributeAnalyzer.cs @@ -4,13 +4,9 @@ using System; using System.Collections.Generic; using System.Collections.Immutable; -using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.Linq; -using System.Runtime.InteropServices; -using System.Text; using Microsoft.CodeAnalysis; -using Microsoft.CodeAnalysis.CSharp; using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.CodeAnalysis.Diagnostics; using Microsoft.CodeAnalysis.DotnetRuntime.Extensions; From de2919fc325e19525d4619999965075a2d163a8a Mon Sep 17 00:00:00 2001 From: Jackson Schuster Date: Fri, 9 Jun 2023 17:09:00 -0700 Subject: [PATCH 6/7] update strings --- .../Resources/Strings.resx | 60 +++++++++---------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/Strings.resx b/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/Strings.resx index 63aaa8f80be189..d05dd577c8b606 100644 --- a/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/Strings.resx +++ b/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/Strings.resx @@ -1,17 +1,17 @@  - @@ -498,9 +498,9 @@ Convert to 'LibraryImport' with '{0}' suffix and enable unsafe code - Invalid MarshalMode value. + Invalid 'MarshalMode' value. - The 'marshalMode' argument of 'CustomMarshallerAttribute' must be a valid enum value of MarshalMode. + The 'marshalMode' argument of 'CustomMarshallerAttribute' must be a valid enum value of 'MarshalMode'. - \ No newline at end of file + From 1d6d6afafd97bc9a9ec9c0a85a93aeea3db75a4f Mon Sep 17 00:00:00 2001 From: Jackson Schuster Date: Fri, 9 Jun 2023 17:10:31 -0700 Subject: [PATCH 7/7] Build xlf --- .../LibraryImportGenerator/Resources/xlf/Strings.cs.xlf | 8 ++++---- .../LibraryImportGenerator/Resources/xlf/Strings.de.xlf | 8 ++++---- .../LibraryImportGenerator/Resources/xlf/Strings.es.xlf | 8 ++++---- .../LibraryImportGenerator/Resources/xlf/Strings.fr.xlf | 8 ++++---- .../LibraryImportGenerator/Resources/xlf/Strings.it.xlf | 8 ++++---- .../LibraryImportGenerator/Resources/xlf/Strings.ja.xlf | 8 ++++---- .../LibraryImportGenerator/Resources/xlf/Strings.ko.xlf | 8 ++++---- .../LibraryImportGenerator/Resources/xlf/Strings.pl.xlf | 8 ++++---- .../Resources/xlf/Strings.pt-BR.xlf | 8 ++++---- .../LibraryImportGenerator/Resources/xlf/Strings.ru.xlf | 8 ++++---- .../LibraryImportGenerator/Resources/xlf/Strings.tr.xlf | 8 ++++---- .../Resources/xlf/Strings.zh-Hans.xlf | 8 ++++---- .../Resources/xlf/Strings.zh-Hant.xlf | 8 ++++---- 13 files changed, 52 insertions(+), 52 deletions(-) diff --git a/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.cs.xlf b/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.cs.xlf index 20c37f3d94833c..b5212d6d007901 100644 --- a/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.cs.xlf +++ b/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.cs.xlf @@ -218,8 +218,8 @@ - Invalid MarshalMode value. - Invalid MarshalMode value. + Invalid 'MarshalMode' value. + Invalid 'MarshalMode' value. @@ -318,8 +318,8 @@ - The 'marshalMode' argument of 'CustomMarshallerAttribute' must be a valid enum value of MarshalMode. - The 'marshalMode' argument of 'CustomMarshallerAttribute' must be a valid enum value of MarshalMode. + The 'marshalMode' argument of 'CustomMarshallerAttribute' must be a valid enum value of 'MarshalMode'. + The 'marshalMode' argument of 'CustomMarshallerAttribute' must be a valid enum value of 'MarshalMode'. diff --git a/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.de.xlf b/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.de.xlf index 4abe0f01b96ea4..b4f25336b85c82 100644 --- a/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.de.xlf +++ b/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.de.xlf @@ -218,8 +218,8 @@ - Invalid MarshalMode value. - Invalid MarshalMode value. + Invalid 'MarshalMode' value. + Invalid 'MarshalMode' value. @@ -318,8 +318,8 @@ - The 'marshalMode' argument of 'CustomMarshallerAttribute' must be a valid enum value of MarshalMode. - The 'marshalMode' argument of 'CustomMarshallerAttribute' must be a valid enum value of MarshalMode. + The 'marshalMode' argument of 'CustomMarshallerAttribute' must be a valid enum value of 'MarshalMode'. + The 'marshalMode' argument of 'CustomMarshallerAttribute' must be a valid enum value of 'MarshalMode'. diff --git a/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.es.xlf b/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.es.xlf index c6bc645e7fe928..5cbbc2ee9a1306 100644 --- a/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.es.xlf +++ b/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.es.xlf @@ -218,8 +218,8 @@ - Invalid MarshalMode value. - Invalid MarshalMode value. + Invalid 'MarshalMode' value. + Invalid 'MarshalMode' value. @@ -318,8 +318,8 @@ - The 'marshalMode' argument of 'CustomMarshallerAttribute' must be a valid enum value of MarshalMode. - The 'marshalMode' argument of 'CustomMarshallerAttribute' must be a valid enum value of MarshalMode. + The 'marshalMode' argument of 'CustomMarshallerAttribute' must be a valid enum value of 'MarshalMode'. + The 'marshalMode' argument of 'CustomMarshallerAttribute' must be a valid enum value of 'MarshalMode'. diff --git a/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.fr.xlf b/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.fr.xlf index ee8d25867f82ae..1809d7ac02029d 100644 --- a/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.fr.xlf +++ b/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.fr.xlf @@ -218,8 +218,8 @@ - Invalid MarshalMode value. - Invalid MarshalMode value. + Invalid 'MarshalMode' value. + Invalid 'MarshalMode' value. @@ -318,8 +318,8 @@ - The 'marshalMode' argument of 'CustomMarshallerAttribute' must be a valid enum value of MarshalMode. - The 'marshalMode' argument of 'CustomMarshallerAttribute' must be a valid enum value of MarshalMode. + The 'marshalMode' argument of 'CustomMarshallerAttribute' must be a valid enum value of 'MarshalMode'. + The 'marshalMode' argument of 'CustomMarshallerAttribute' must be a valid enum value of 'MarshalMode'. diff --git a/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.it.xlf b/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.it.xlf index 664b0ad443e9ae..22f9e58491ca38 100644 --- a/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.it.xlf +++ b/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.it.xlf @@ -218,8 +218,8 @@ - Invalid MarshalMode value. - Invalid MarshalMode value. + Invalid 'MarshalMode' value. + Invalid 'MarshalMode' value. @@ -318,8 +318,8 @@ - The 'marshalMode' argument of 'CustomMarshallerAttribute' must be a valid enum value of MarshalMode. - The 'marshalMode' argument of 'CustomMarshallerAttribute' must be a valid enum value of MarshalMode. + The 'marshalMode' argument of 'CustomMarshallerAttribute' must be a valid enum value of 'MarshalMode'. + The 'marshalMode' argument of 'CustomMarshallerAttribute' must be a valid enum value of 'MarshalMode'. diff --git a/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.ja.xlf b/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.ja.xlf index 6df55ddfef0a23..9ee8299f0ea570 100644 --- a/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.ja.xlf +++ b/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.ja.xlf @@ -218,8 +218,8 @@ - Invalid MarshalMode value. - Invalid MarshalMode value. + Invalid 'MarshalMode' value. + Invalid 'MarshalMode' value. @@ -318,8 +318,8 @@ - The 'marshalMode' argument of 'CustomMarshallerAttribute' must be a valid enum value of MarshalMode. - The 'marshalMode' argument of 'CustomMarshallerAttribute' must be a valid enum value of MarshalMode. + The 'marshalMode' argument of 'CustomMarshallerAttribute' must be a valid enum value of 'MarshalMode'. + The 'marshalMode' argument of 'CustomMarshallerAttribute' must be a valid enum value of 'MarshalMode'. diff --git a/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.ko.xlf b/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.ko.xlf index ea845e9802ea6c..cc4bc77517d36d 100644 --- a/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.ko.xlf +++ b/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.ko.xlf @@ -218,8 +218,8 @@ - Invalid MarshalMode value. - Invalid MarshalMode value. + Invalid 'MarshalMode' value. + Invalid 'MarshalMode' value. @@ -318,8 +318,8 @@ - The 'marshalMode' argument of 'CustomMarshallerAttribute' must be a valid enum value of MarshalMode. - The 'marshalMode' argument of 'CustomMarshallerAttribute' must be a valid enum value of MarshalMode. + The 'marshalMode' argument of 'CustomMarshallerAttribute' must be a valid enum value of 'MarshalMode'. + The 'marshalMode' argument of 'CustomMarshallerAttribute' must be a valid enum value of 'MarshalMode'. diff --git a/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.pl.xlf b/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.pl.xlf index 9d9347614430d9..d0b5e5ed20fed8 100644 --- a/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.pl.xlf +++ b/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.pl.xlf @@ -218,8 +218,8 @@ - Invalid MarshalMode value. - Invalid MarshalMode value. + Invalid 'MarshalMode' value. + Invalid 'MarshalMode' value. @@ -318,8 +318,8 @@ - The 'marshalMode' argument of 'CustomMarshallerAttribute' must be a valid enum value of MarshalMode. - The 'marshalMode' argument of 'CustomMarshallerAttribute' must be a valid enum value of MarshalMode. + The 'marshalMode' argument of 'CustomMarshallerAttribute' must be a valid enum value of 'MarshalMode'. + The 'marshalMode' argument of 'CustomMarshallerAttribute' must be a valid enum value of 'MarshalMode'. diff --git a/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.pt-BR.xlf b/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.pt-BR.xlf index 84162b79639f26..ebd39b8487dfbd 100644 --- a/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.pt-BR.xlf +++ b/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.pt-BR.xlf @@ -218,8 +218,8 @@ - Invalid MarshalMode value. - Invalid MarshalMode value. + Invalid 'MarshalMode' value. + Invalid 'MarshalMode' value. @@ -318,8 +318,8 @@ - The 'marshalMode' argument of 'CustomMarshallerAttribute' must be a valid enum value of MarshalMode. - The 'marshalMode' argument of 'CustomMarshallerAttribute' must be a valid enum value of MarshalMode. + The 'marshalMode' argument of 'CustomMarshallerAttribute' must be a valid enum value of 'MarshalMode'. + The 'marshalMode' argument of 'CustomMarshallerAttribute' must be a valid enum value of 'MarshalMode'. diff --git a/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.ru.xlf b/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.ru.xlf index f04184c6206e76..755e0c157a34f2 100644 --- a/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.ru.xlf +++ b/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.ru.xlf @@ -218,8 +218,8 @@ - Invalid MarshalMode value. - Invalid MarshalMode value. + Invalid 'MarshalMode' value. + Invalid 'MarshalMode' value. @@ -318,8 +318,8 @@ - The 'marshalMode' argument of 'CustomMarshallerAttribute' must be a valid enum value of MarshalMode. - The 'marshalMode' argument of 'CustomMarshallerAttribute' must be a valid enum value of MarshalMode. + The 'marshalMode' argument of 'CustomMarshallerAttribute' must be a valid enum value of 'MarshalMode'. + The 'marshalMode' argument of 'CustomMarshallerAttribute' must be a valid enum value of 'MarshalMode'. diff --git a/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.tr.xlf b/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.tr.xlf index 221ed338cba550..39173fb5d0cdd1 100644 --- a/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.tr.xlf +++ b/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.tr.xlf @@ -218,8 +218,8 @@ - Invalid MarshalMode value. - Invalid MarshalMode value. + Invalid 'MarshalMode' value. + Invalid 'MarshalMode' value. @@ -318,8 +318,8 @@ - The 'marshalMode' argument of 'CustomMarshallerAttribute' must be a valid enum value of MarshalMode. - The 'marshalMode' argument of 'CustomMarshallerAttribute' must be a valid enum value of MarshalMode. + The 'marshalMode' argument of 'CustomMarshallerAttribute' must be a valid enum value of 'MarshalMode'. + The 'marshalMode' argument of 'CustomMarshallerAttribute' must be a valid enum value of 'MarshalMode'. diff --git a/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.zh-Hans.xlf b/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.zh-Hans.xlf index 0424b6ad98b1e7..6ed83988fdb531 100644 --- a/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.zh-Hans.xlf +++ b/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.zh-Hans.xlf @@ -218,8 +218,8 @@ - Invalid MarshalMode value. - Invalid MarshalMode value. + Invalid 'MarshalMode' value. + Invalid 'MarshalMode' value. @@ -318,8 +318,8 @@ - The 'marshalMode' argument of 'CustomMarshallerAttribute' must be a valid enum value of MarshalMode. - The 'marshalMode' argument of 'CustomMarshallerAttribute' must be a valid enum value of MarshalMode. + The 'marshalMode' argument of 'CustomMarshallerAttribute' must be a valid enum value of 'MarshalMode'. + The 'marshalMode' argument of 'CustomMarshallerAttribute' must be a valid enum value of 'MarshalMode'. diff --git a/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.zh-Hant.xlf b/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.zh-Hant.xlf index 72f133be1b1c92..b8a7111c3a0bff 100644 --- a/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.zh-Hant.xlf +++ b/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Resources/xlf/Strings.zh-Hant.xlf @@ -218,8 +218,8 @@ - Invalid MarshalMode value. - Invalid MarshalMode value. + Invalid 'MarshalMode' value. + Invalid 'MarshalMode' value. @@ -318,8 +318,8 @@ - The 'marshalMode' argument of 'CustomMarshallerAttribute' must be a valid enum value of MarshalMode. - The 'marshalMode' argument of 'CustomMarshallerAttribute' must be a valid enum value of MarshalMode. + The 'marshalMode' argument of 'CustomMarshallerAttribute' must be a valid enum value of 'MarshalMode'. + The 'marshalMode' argument of 'CustomMarshallerAttribute' must be a valid enum value of 'MarshalMode'.