未验证 提交 22a50ac0 编写于 作者: J Jackson Schuster 提交者: GitHub

[ComInterfaceGenerator] Recommend [In] and [Out] attributes on array parameters (#91094) (#91231)

Recommend that methods with array parameters use [In] or [Out] attributes if there are none already, and the parameter is not in, ref, or out.
上级 259a8a45
......@@ -208,7 +208,7 @@ 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`__ | 'GenerateComInterfaceAttribute' usage not recommended. See aka.ms/GeneratedComInterfaceUsage for recommended usage. |
| __`SYSLIB1092`__ | Usage of '[LibraryImport|GeneratedComInterface]' does not follow recommendation. See aka.ms/[LibraryImport|GeneratedComInterface]Usage for best practices. |
| __`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 |
......
......@@ -26,6 +26,7 @@ internal sealed class DiagnosticDescriptorProvider : IDiagnosticDescriptorProvid
GeneratorDiagnostic.NotSupported { NotSupportedDetails: not null, TypePositionInfo.IsManagedReturnPosition: false } => GeneratorDiagnostics.ParameterTypeNotSupportedWithDetails,
GeneratorDiagnostic.UnnecessaryData { TypePositionInfo.IsManagedReturnPosition: false } => GeneratorDiagnostics.UnnecessaryParameterMarshallingInfo,
GeneratorDiagnostic.UnnecessaryData { TypePositionInfo.IsManagedReturnPosition: true } => GeneratorDiagnostics.UnnecessaryReturnMarshallingInfo,
GeneratorDiagnostic.NotRecommended => GeneratorDiagnostics.GeneratedComInterfaceUsageDoesNotFollowBestPractices,
{ IsFatal: false } => null,
{ TypePositionInfo.IsManagedReturnPosition: true } => GeneratorDiagnostics.ReturnTypeNotSupported,
{ TypePositionInfo.IsManagedReturnPosition: false } => GeneratorDiagnostics.ParameterTypeNotSupported,
......
......@@ -485,6 +485,17 @@ public class Ids
DiagnosticSeverity.Info,
isEnabledByDefault: true);
/// <inheritdoc cref="SR.ComInterfaceUsageDoesNotFollowBestPracticesMessageWithDetails"/>
public static readonly DiagnosticDescriptor GeneratedComInterfaceUsageDoesNotFollowBestPractices =
new DiagnosticDescriptor(
Ids.NotRecommendedGeneratedComInterfaceUsage,
GetResourceString(nameof(SR.ComInterfaceUsageDoesNotFollowBestPracticesTitle)),
GetResourceString(nameof(SR.ComInterfaceUsageDoesNotFollowBestPracticesMessageWithDetails)),
Category,
DiagnosticSeverity.Info,
isEnabledByDefault: true,
helpLinkUri: "aka.ms/GeneratedComInterfaceUsage");
/// <summary>
/// Report diagnostic for invalid configuration for string marshalling.
/// </summary>
......
......@@ -875,7 +875,13 @@
<value>[In] and [Out] attributes</value>
</data>
<data name="OutAttributeNotSupportedOnByValueParameters" xml:space="preserve">
<value>The `[Out]` attribute is only supported on array parameters. Consider using 'out' or 'ref' keywords to make the parameter mutable.</value>
<value>The '[Out]' attribute is only supported on array parameters. Consider using 'out' or 'ref' keywords to make the parameter mutable.</value>
</data>
<data name="InAttributeNotSupportedOnByValueParameters" xml:space="preserve">
<value>The '[In]' attribute is only supported on array parameters. By-value parameters are considered read-only by default.</value>
</data>
<data name="InOutAttributeNotSupportedOnByValueParameters" xml:space="preserve">
<value>The '[In]' and '[Out]' attributes are only supported on array parameters. Consider using the 'ref' keyword to make the parameter mutable.</value>
</data>
<data name="ComMethodReturningIntWillBeOutParameterMessage" xml:space="preserve">
<value>The return value in the managed definition will be converted to an 'out' parameter when calling the unmanaged COM method. If the return value is intended to be the HRESULT code returned by the unmanaged COM method, use '[PreserveSig]' on the method.</value>
......@@ -889,4 +895,19 @@
<data name="HResultTypeWillBeTreatedAsStructTitle" xml:space="preserve">
<value>This type will be treated as a struct in the native signature, not as a native HRESULT</value>
</data>
</root>
\ No newline at end of file
<data name="PreferExplicitInOutAttributesOnArrays" xml:space="preserve">
<value>It is recommended to use explicit '[In]' and '[Out]' attributes on array parameters.</value>
</data>
<data name="ComInterfaceUsageDoesNotFollowBestPracticesTitle" xml:space="preserve">
<value>The usage of 'GeneratedComInterfaceAttribute' does not follow recommendations.</value>
</data>
<data name="ComInterfaceUsageDoesNotFollowBestPracticesMessageWithDetails" xml:space="preserve">
<value>The usage of 'GeneratedComInterfaceAttribute' does not follow recommendations. {0}</value>
</data>
<data name="LibraryImportUsageDoesNotFollowBestPracticesTitle" xml:space="preserve">
<value>The usage of 'LibraryImportAttribute' does not follow recommendations.</value>
</data>
<data name="LibraryImportUsageDoesNotFollowBestPracticesMessageWithDetails" xml:space="preserve">
<value>The usage of 'LibraryImportAttribute' does not follow recommendations. {0}</value>
</data>
</root>
......@@ -147,6 +147,16 @@
<target state="translated">Hostování .NET COM s EnableComHosting nepodporuje rozhraní s generatedComInterfaceAttribute</target>
<note />
</trans-unit>
<trans-unit id="ComInterfaceUsageDoesNotFollowBestPracticesMessageWithDetails">
<source>The usage of 'GeneratedComInterfaceAttribute' does not follow recommendations. {0}</source>
<target state="new">The usage of 'GeneratedComInterfaceAttribute' does not follow recommendations. {0}</target>
<note />
</trans-unit>
<trans-unit id="ComInterfaceUsageDoesNotFollowBestPracticesTitle">
<source>The usage of 'GeneratedComInterfaceAttribute' does not follow recommendations.</source>
<target state="new">The usage of 'GeneratedComInterfaceAttribute' does not follow recommendations.</target>
<note />
</trans-unit>
<trans-unit id="ComMethodReturningIntWillBeOutParameterMessage">
<source>The return value in the managed definition will be converted to an 'out' parameter when calling the unmanaged COM method. If the return value is intended to be the HRESULT code returned by the unmanaged COM method, use '[PreserveSig]' on the method.</source>
<target state="translated">Vrácená hodnota ve spravované definici se při volání nespravované metody COM převede na parametr out. Pokud má být návratovou hodnotou kód HRESULT vrácený nespravovanou metodou COM, použijte u metody [PreserveSig].</target>
......@@ -447,6 +457,11 @@
<target state="translated">Tento typ bude v nativním podpisu považován za strukturu, nikoli za nativní HRESULT.</target>
<note />
</trans-unit>
<trans-unit id="InAttributeNotSupportedOnByValueParameters">
<source>The '[In]' attribute is only supported on array parameters. By-value parameters are considered read-only by default.</source>
<target state="new">The '[In]' attribute is only supported on array parameters. By-value parameters are considered read-only by default.</target>
<note />
</trans-unit>
<trans-unit id="InAttributeNotSupportedWithoutOutBlittableArray">
<source>The '[In]' attribute is not supported unless the '[Out]' attribute is also used. Blittable arrays cannot be marshalled as '[In]' only.</source>
<target state="translated">Atribut [In] není podporován, pokud není použit také atribut [Out]. Blittable arrays nelze zařadit pouze jako [In].</target>
......@@ -467,6 +482,11 @@
<target state="translated">Poskytnuté atributy „[In]“ a „[Out]“ u tohoto parametru se na tomto parametru nepodporují.</target>
<note />
</trans-unit>
<trans-unit id="InOutAttributeNotSupportedOnByValueParameters">
<source>The '[In]' and '[Out]' attributes are only supported on array parameters. Consider using the 'ref' keyword to make the parameter mutable.</source>
<target state="new">The '[In]' and '[Out]' attributes are only supported on array parameters. Consider using the 'ref' keyword to make the parameter mutable.</target>
<note />
</trans-unit>
<trans-unit id="InOutAttributes">
<source>[In] and [Out] attributes</source>
<target state="translated">atributy [In] a [Out]</target>
......@@ -702,6 +722,16 @@
<target state="translated">Neplatné použití atributu VirtualMethodIndexAttribute</target>
<note />
</trans-unit>
<trans-unit id="LibraryImportUsageDoesNotFollowBestPracticesMessageWithDetails">
<source>The usage of 'LibraryImportAttribute' does not follow recommendations. {0}</source>
<target state="new">The usage of 'LibraryImportAttribute' does not follow recommendations. {0}</target>
<note />
</trans-unit>
<trans-unit id="LibraryImportUsageDoesNotFollowBestPracticesTitle">
<source>The usage of 'LibraryImportAttribute' does not follow recommendations.</source>
<target state="new">The usage of 'LibraryImportAttribute' does not follow recommendations.</target>
<note />
</trans-unit>
<trans-unit id="LinearCollectionElementTypesMustMatchDescription">
<source>The element type of the 'ReadOnlySpan' returned by 'GetManagedValuesSource' must be the same as the element type returned by 'GetManagedValuesDestination'.</source>
<target state="translated">Typ prvku ReadOnlySpan vrácený GetManagedValuesSource musí být stejný, jako typ prvku vrácený GetManagedValuesDestination.</target>
......@@ -903,8 +933,8 @@
<note />
</trans-unit>
<trans-unit id="OutAttributeNotSupportedOnByValueParameters">
<source>The `[Out]` attribute is only supported on array parameters. Consider using 'out' or 'ref' keywords to make the parameter mutable.</source>
<target state="translated">Atribut „[Out]“ se podporuje pouze u parametrů pole. Zvažte použití klíčových slov „out“ nebo „ref“, aby se parametr dalo měnit.</target>
<source>The '[Out]' attribute is only supported on array parameters. Consider using 'out' or 'ref' keywords to make the parameter mutable.</source>
<target state="new">The '[Out]' attribute is only supported on array parameters. Consider using 'out' or 'ref' keywords to make the parameter mutable.</target>
<note />
</trans-unit>
<trans-unit id="OutRequiresToManagedDescription">
......@@ -917,6 +947,11 @@
<target state="translated">Typ {0}určuje, že podporuje zařazování ve směru „Out“, ale neposkytuje metodu ToManaged, která vrací spravovaný typ</target>
<note />
</trans-unit>
<trans-unit id="PreferExplicitInOutAttributesOnArrays">
<source>It is recommended to use explicit '[In]' and '[Out]' attributes on array parameters.</source>
<target state="new">It is recommended to use explicit '[In]' and '[Out]' attributes on array parameters.</target>
<note />
</trans-unit>
<trans-unit id="RequiresAllowUnsafeBlocksDescriptionCom">
<source>'GeneratedComInterfaceAttribute' and 'GeneratedComClassAttribute' require unsafe code. Project must be updated with '&lt;AllowUnsafeBlocks&gt;true&lt;/AllowUnsafeBlocks&gt;'.</source>
<target state="translated">GeneratedComInterfaceAttribute a GeneratedComClassAttribute vyžadují nebezpečný kód. Projekt se musí aktualizovat na &lt;AllowUnsafeBlocks&gt;true&lt;/AllowUnsafeBlocks&gt;.</target>
......@@ -1276,4 +1311,4 @@
</trans-unit>
</body>
</file>
</xliff>
\ No newline at end of file
</xliff>
......@@ -147,6 +147,16 @@
<target state="translated">Das .NET COM-Hosting mit "EnableComHosting" unterstützt keine Schnittstellen mit "GeneratedComInterfaceAttribute".</target>
<note />
</trans-unit>
<trans-unit id="ComInterfaceUsageDoesNotFollowBestPracticesMessageWithDetails">
<source>The usage of 'GeneratedComInterfaceAttribute' does not follow recommendations. {0}</source>
<target state="new">The usage of 'GeneratedComInterfaceAttribute' does not follow recommendations. {0}</target>
<note />
</trans-unit>
<trans-unit id="ComInterfaceUsageDoesNotFollowBestPracticesTitle">
<source>The usage of 'GeneratedComInterfaceAttribute' does not follow recommendations.</source>
<target state="new">The usage of 'GeneratedComInterfaceAttribute' does not follow recommendations.</target>
<note />
</trans-unit>
<trans-unit id="ComMethodReturningIntWillBeOutParameterMessage">
<source>The return value in the managed definition will be converted to an 'out' parameter when calling the unmanaged COM method. If the return value is intended to be the HRESULT code returned by the unmanaged COM method, use '[PreserveSig]' on the method.</source>
<target state="translated">Der Rückgabewert in der verwalteten Definition wird beim Aufrufen der nicht verwalteten COM-Methode in einen out-Parameter konvertiert. Wenn als Rückgabewert der von der nicht verwalteten COM-Methode zurückgegebene HRESULT-Code eingesetzt werden soll, verwenden Sie "[PreserveSig]" für die Methode.</target>
......@@ -447,6 +457,11 @@
<target state="translated">Dieser Typ wird als Struktur in der nativen Signatur und nicht als natives HRESULT behandelt</target>
<note />
</trans-unit>
<trans-unit id="InAttributeNotSupportedOnByValueParameters">
<source>The '[In]' attribute is only supported on array parameters. By-value parameters are considered read-only by default.</source>
<target state="new">The '[In]' attribute is only supported on array parameters. By-value parameters are considered read-only by default.</target>
<note />
</trans-unit>
<trans-unit id="InAttributeNotSupportedWithoutOutBlittableArray">
<source>The '[In]' attribute is not supported unless the '[Out]' attribute is also used. Blittable arrays cannot be marshalled as '[In]' only.</source>
<target state="translated">Das [In]-Attribut wird nur unterstützt, wenn auch das [Out]-Attribut verwendet wird. Blittable-Arrays können nicht nur als "[In]" gemarshallt werden.</target>
......@@ -467,6 +482,11 @@
<target state="translated">Die angegebenen Attribute \"[In]\" und \"[Out]\" für diesen Parameter werden für diesen Parameter nicht unterstützt.</target>
<note />
</trans-unit>
<trans-unit id="InOutAttributeNotSupportedOnByValueParameters">
<source>The '[In]' and '[Out]' attributes are only supported on array parameters. Consider using the 'ref' keyword to make the parameter mutable.</source>
<target state="new">The '[In]' and '[Out]' attributes are only supported on array parameters. Consider using the 'ref' keyword to make the parameter mutable.</target>
<note />
</trans-unit>
<trans-unit id="InOutAttributes">
<source>[In] and [Out] attributes</source>
<target state="translated">[In]- und [Out]-Attribute</target>
......@@ -702,6 +722,16 @@
<target state="translated">Ungültige Verwendung von "VirtualMethodIndexAttribute"</target>
<note />
</trans-unit>
<trans-unit id="LibraryImportUsageDoesNotFollowBestPracticesMessageWithDetails">
<source>The usage of 'LibraryImportAttribute' does not follow recommendations. {0}</source>
<target state="new">The usage of 'LibraryImportAttribute' does not follow recommendations. {0}</target>
<note />
</trans-unit>
<trans-unit id="LibraryImportUsageDoesNotFollowBestPracticesTitle">
<source>The usage of 'LibraryImportAttribute' does not follow recommendations.</source>
<target state="new">The usage of 'LibraryImportAttribute' does not follow recommendations.</target>
<note />
</trans-unit>
<trans-unit id="LinearCollectionElementTypesMustMatchDescription">
<source>The element type of the 'ReadOnlySpan' returned by 'GetManagedValuesSource' must be the same as the element type returned by 'GetManagedValuesDestination'.</source>
<target state="translated">Der von \"GetManagedValuesSource\" zurückgegebene Elementtyp \"ReadOnlySpan\" muss mit dem Elementtyp identisch sein, der von \"GetManagedValuesDestination\" zurückgegeben wird.</target>
......@@ -903,8 +933,8 @@
<note />
</trans-unit>
<trans-unit id="OutAttributeNotSupportedOnByValueParameters">
<source>The `[Out]` attribute is only supported on array parameters. Consider using 'out' or 'ref' keywords to make the parameter mutable.</source>
<target state="translated">Das [Out]-Attribut wird nur für Arrayparameter gemarshallt werden. Erwägen Sie die Verwendung der Schlüsselwörter "out" oder "ref", um den Parameter änderbar zu machen.</target>
<source>The '[Out]' attribute is only supported on array parameters. Consider using 'out' or 'ref' keywords to make the parameter mutable.</source>
<target state="new">The '[Out]' attribute is only supported on array parameters. Consider using 'out' or 'ref' keywords to make the parameter mutable.</target>
<note />
</trans-unit>
<trans-unit id="OutRequiresToManagedDescription">
......@@ -917,6 +947,11 @@
<target state="translated">Der Typ \"{0}\" gibt an, dass das Marshalling in der Out-Richtung unterstützt wird. Er stellt jedoch keine ToManaged-Methode bereit, die den verwalteten Typ zurückgibt.</target>
<note />
</trans-unit>
<trans-unit id="PreferExplicitInOutAttributesOnArrays">
<source>It is recommended to use explicit '[In]' and '[Out]' attributes on array parameters.</source>
<target state="new">It is recommended to use explicit '[In]' and '[Out]' attributes on array parameters.</target>
<note />
</trans-unit>
<trans-unit id="RequiresAllowUnsafeBlocksDescriptionCom">
<source>'GeneratedComInterfaceAttribute' and 'GeneratedComClassAttribute' require unsafe code. Project must be updated with '&lt;AllowUnsafeBlocks&gt;true&lt;/AllowUnsafeBlocks&gt;'.</source>
<target state="translated">'GeneratedComInterfaceAttribute' und 'GeneratedComClassAttribute' erfordern unsicheren Code. Das Projekt muss mit '&lt;AllowUnsafeBlocks&gt;wahr&lt;/AllowUnsafeBlocks&gt;' aktualisiert werden.</target>
......@@ -1276,4 +1311,4 @@
</trans-unit>
</body>
</file>
</xliff>
\ No newline at end of file
</xliff>
......@@ -147,6 +147,16 @@
<target state="translated">El hospedaje COM de .NET con “EnableComHosting” no admite interfaces con “GeneratedComInterfaceAttribute”</target>
<note />
</trans-unit>
<trans-unit id="ComInterfaceUsageDoesNotFollowBestPracticesMessageWithDetails">
<source>The usage of 'GeneratedComInterfaceAttribute' does not follow recommendations. {0}</source>
<target state="new">The usage of 'GeneratedComInterfaceAttribute' does not follow recommendations. {0}</target>
<note />
</trans-unit>
<trans-unit id="ComInterfaceUsageDoesNotFollowBestPracticesTitle">
<source>The usage of 'GeneratedComInterfaceAttribute' does not follow recommendations.</source>
<target state="new">The usage of 'GeneratedComInterfaceAttribute' does not follow recommendations.</target>
<note />
</trans-unit>
<trans-unit id="ComMethodReturningIntWillBeOutParameterMessage">
<source>The return value in the managed definition will be converted to an 'out' parameter when calling the unmanaged COM method. If the return value is intended to be the HRESULT code returned by the unmanaged COM method, use '[PreserveSig]' on the method.</source>
<target state="translated">El valor devuelto en la definición administrada se convertirá en un parámetro “out” al llamar al método COM no administrado. Si el valor devuelto debe ser el código HRESULT devuelto por el método COM no administrado, use “[PreserveSig]” en el método.</target>
......@@ -447,6 +457,11 @@
<target state="translated">Este tipo se tratará como una estructura en la firma nativa, no como un HRESULT nativo.</target>
<note />
</trans-unit>
<trans-unit id="InAttributeNotSupportedOnByValueParameters">
<source>The '[In]' attribute is only supported on array parameters. By-value parameters are considered read-only by default.</source>
<target state="new">The '[In]' attribute is only supported on array parameters. By-value parameters are considered read-only by default.</target>
<note />
</trans-unit>
<trans-unit id="InAttributeNotSupportedWithoutOutBlittableArray">
<source>The '[In]' attribute is not supported unless the '[Out]' attribute is also used. Blittable arrays cannot be marshalled as '[In]' only.</source>
<target state="translated">El atributo '[In]' no se admite a menos que también se use el atributo '[Out]'. Las matrices que se pueden transferir en bloque de bits no se pueden serializar solo como '[In]'.</target>
......@@ -467,6 +482,11 @@
<target state="translated">En este parámetro, los atributos “[In]” y “[Out]” proporcionados no se admiten.</target>
<note />
</trans-unit>
<trans-unit id="InOutAttributeNotSupportedOnByValueParameters">
<source>The '[In]' and '[Out]' attributes are only supported on array parameters. Consider using the 'ref' keyword to make the parameter mutable.</source>
<target state="new">The '[In]' and '[Out]' attributes are only supported on array parameters. Consider using the 'ref' keyword to make the parameter mutable.</target>
<note />
</trans-unit>
<trans-unit id="InOutAttributes">
<source>[In] and [Out] attributes</source>
<target state="translated">Atributos [In] y [Out]</target>
......@@ -702,6 +722,16 @@
<target state="translated">Uso de ”VirtualMethodIndexAttribute” no válido</target>
<note />
</trans-unit>
<trans-unit id="LibraryImportUsageDoesNotFollowBestPracticesMessageWithDetails">
<source>The usage of 'LibraryImportAttribute' does not follow recommendations. {0}</source>
<target state="new">The usage of 'LibraryImportAttribute' does not follow recommendations. {0}</target>
<note />
</trans-unit>
<trans-unit id="LibraryImportUsageDoesNotFollowBestPracticesTitle">
<source>The usage of 'LibraryImportAttribute' does not follow recommendations.</source>
<target state="new">The usage of 'LibraryImportAttribute' does not follow recommendations.</target>
<note />
</trans-unit>
<trans-unit id="LinearCollectionElementTypesMustMatchDescription">
<source>The element type of the 'ReadOnlySpan' returned by 'GetManagedValuesSource' must be the same as the element type returned by 'GetManagedValuesDestination'.</source>
<target state="translated">El tipo de elemento del “ReadOnlySpan” devuelto por “GetManagedValuesSource” debe ser el mismo que el tipo de elemento devuelto por “GetManagedValuesDestination”.</target>
......@@ -903,8 +933,8 @@
<note />
</trans-unit>
<trans-unit id="OutAttributeNotSupportedOnByValueParameters">
<source>The `[Out]` attribute is only supported on array parameters. Consider using 'out' or 'ref' keywords to make the parameter mutable.</source>
<target state="translated">El atributo "[Out]" solo se admite en parámetros de matriz. Considere la posibilidad de usar palabras clave "out" o "ref" para hacer que el parámetro sea mutable.</target>
<source>The '[Out]' attribute is only supported on array parameters. Consider using 'out' or 'ref' keywords to make the parameter mutable.</source>
<target state="new">The '[Out]' attribute is only supported on array parameters. Consider using 'out' or 'ref' keywords to make the parameter mutable.</target>
<note />
</trans-unit>
<trans-unit id="OutRequiresToManagedDescription">
......@@ -917,6 +947,11 @@
<target state="translated">El tipo “{0}” especifica que admite la serialización en la dirección “Out”, pero no proporciona un método “ToManaged” que devuelva el tipo administrado</target>
<note />
</trans-unit>
<trans-unit id="PreferExplicitInOutAttributesOnArrays">
<source>It is recommended to use explicit '[In]' and '[Out]' attributes on array parameters.</source>
<target state="new">It is recommended to use explicit '[In]' and '[Out]' attributes on array parameters.</target>
<note />
</trans-unit>
<trans-unit id="RequiresAllowUnsafeBlocksDescriptionCom">
<source>'GeneratedComInterfaceAttribute' and 'GeneratedComClassAttribute' require unsafe code. Project must be updated with '&lt;AllowUnsafeBlocks&gt;true&lt;/AllowUnsafeBlocks&gt;'.</source>
<target state="translated">"GeneratedComInterfaceAttribute" y "GeneratedComClassAttribute" requieren código no seguro. El proyecto debe actualizarse con "&lt;AllowUnsafeBlocks&gt;true&lt;/AllowUnsafeBlocks&gt;".</target>
......@@ -1276,4 +1311,4 @@
</trans-unit>
</body>
</file>
</xliff>
\ No newline at end of file
</xliff>
......@@ -147,6 +147,16 @@
<target state="translated">L'hébergement .NET COM avec 'EnableComHosting' ne prend pas en charge les interfaces avec 'GeneratedComInterfaceAttribute'</target>
<note />
</trans-unit>
<trans-unit id="ComInterfaceUsageDoesNotFollowBestPracticesMessageWithDetails">
<source>The usage of 'GeneratedComInterfaceAttribute' does not follow recommendations. {0}</source>
<target state="new">The usage of 'GeneratedComInterfaceAttribute' does not follow recommendations. {0}</target>
<note />
</trans-unit>
<trans-unit id="ComInterfaceUsageDoesNotFollowBestPracticesTitle">
<source>The usage of 'GeneratedComInterfaceAttribute' does not follow recommendations.</source>
<target state="new">The usage of 'GeneratedComInterfaceAttribute' does not follow recommendations.</target>
<note />
</trans-unit>
<trans-unit id="ComMethodReturningIntWillBeOutParameterMessage">
<source>The return value in the managed definition will be converted to an 'out' parameter when calling the unmanaged COM method. If the return value is intended to be the HRESULT code returned by the unmanaged COM method, use '[PreserveSig]' on the method.</source>
<target state="translated">La valeur de retour dans la définition managée est convertie en paramètre 'out' lors de l’appel de la méthode COM non managée. Si la valeur de retour doit être le code HRESULT retourné par la méthode COM non managée, utilisez '[PreserveSig]' sur la méthode.</target>
......@@ -447,6 +457,11 @@
<target state="translated">Ce type sera traité en tant que struct dans la signature native, et non en tant que HRESULT natif</target>
<note />
</trans-unit>
<trans-unit id="InAttributeNotSupportedOnByValueParameters">
<source>The '[In]' attribute is only supported on array parameters. By-value parameters are considered read-only by default.</source>
<target state="new">The '[In]' attribute is only supported on array parameters. By-value parameters are considered read-only by default.</target>
<note />
</trans-unit>
<trans-unit id="InAttributeNotSupportedWithoutOutBlittableArray">
<source>The '[In]' attribute is not supported unless the '[Out]' attribute is also used. Blittable arrays cannot be marshalled as '[In]' only.</source>
<target state="translated">L’attribut '[In]' n’est pas pris en charge, sauf si l’attribut '[Out]' est également utilisé. Les tableaux blittables ne peuvent pas être marshalés en tant que « [In] » uniquement.</target>
......@@ -467,6 +482,11 @@
<target state="translated">Les attributs « [In] » et « [Out] » fournis sur ce paramètre ne sont pas pris en charge sur ce paramètre.</target>
<note />
</trans-unit>
<trans-unit id="InOutAttributeNotSupportedOnByValueParameters">
<source>The '[In]' and '[Out]' attributes are only supported on array parameters. Consider using the 'ref' keyword to make the parameter mutable.</source>
<target state="new">The '[In]' and '[Out]' attributes are only supported on array parameters. Consider using the 'ref' keyword to make the parameter mutable.</target>
<note />
</trans-unit>
<trans-unit id="InOutAttributes">
<source>[In] and [Out] attributes</source>
<target state="translated">Attributs [In] et [Out]</target>
......@@ -702,6 +722,16 @@
<target state="translated">Utilisation de « VirtualMethodIndexAttribute » non valide</target>
<note />
</trans-unit>
<trans-unit id="LibraryImportUsageDoesNotFollowBestPracticesMessageWithDetails">
<source>The usage of 'LibraryImportAttribute' does not follow recommendations. {0}</source>
<target state="new">The usage of 'LibraryImportAttribute' does not follow recommendations. {0}</target>
<note />
</trans-unit>
<trans-unit id="LibraryImportUsageDoesNotFollowBestPracticesTitle">
<source>The usage of 'LibraryImportAttribute' does not follow recommendations.</source>
<target state="new">The usage of 'LibraryImportAttribute' does not follow recommendations.</target>
<note />
</trans-unit>
<trans-unit id="LinearCollectionElementTypesMustMatchDescription">
<source>The element type of the 'ReadOnlySpan' returned by 'GetManagedValuesSource' must be the same as the element type returned by 'GetManagedValuesDestination'.</source>
<target state="translated">Le type d’élément de « ReadOnlySpan » retourné par « GetManagedValuesSource » doit être identique au type d’élément retourné par « GetManagedValuesDestination ».</target>
......@@ -903,8 +933,8 @@
<note />
</trans-unit>
<trans-unit id="OutAttributeNotSupportedOnByValueParameters">
<source>The `[Out]` attribute is only supported on array parameters. Consider using 'out' or 'ref' keywords to make the parameter mutable.</source>
<target state="translated">L’attribut '[Out]' est uniquement pris en charge sur les paramètres de tableau. Envisagez d’utiliser des mots clés 'out' ou 'ref' pour rendre le paramètre mutable.</target>
<source>The '[Out]' attribute is only supported on array parameters. Consider using 'out' or 'ref' keywords to make the parameter mutable.</source>
<target state="needs-review-translation">L’attribut '[Out]' est uniquement pris en charge sur les paramètres de tableau. Envisagez d’utiliser des mots clés 'out' ou 'ref' pour rendre le paramètre mutable.</target>
<note />
</trans-unit>
<trans-unit id="OutRequiresToManagedDescription">
......@@ -917,6 +947,11 @@
<target state="translated">Le type « {0} » spécifie qu’il prend en charge le marshaling dans la direction « Out », mais il ne fournit pas de méthode « ToManaged » qui retourne le type managé</target>
<note />
</trans-unit>
<trans-unit id="PreferExplicitInOutAttributesOnArrays">
<source>It is recommended to use explicit '[In]' and '[Out]' attributes on array parameters.</source>
<target state="new">It is recommended to use explicit '[In]' and '[Out]' attributes on array parameters.</target>
<note />
</trans-unit>
<trans-unit id="RequiresAllowUnsafeBlocksDescriptionCom">
<source>'GeneratedComInterfaceAttribute' and 'GeneratedComClassAttribute' require unsafe code. Project must be updated with '&lt;AllowUnsafeBlocks&gt;true&lt;/AllowUnsafeBlocks&gt;'.</source>
<target state="translated">« GeneratedComInterfaceAttribute » et « GeneratedComClassAttribute » nécessitent du code non sécurisé. Le projet doit être mis à jour avec « &lt;AllowUnsafeBlocks&gt;true&lt;/AllowUnsafeBlocks&gt; ».</target>
......
......@@ -147,6 +147,16 @@
<target state="translated">L'hosting COM .NET con 'EnableComHosting' non supporta le interfacce con 'GeneratedComInterfaceAttribute'.</target>
<note />
</trans-unit>
<trans-unit id="ComInterfaceUsageDoesNotFollowBestPracticesMessageWithDetails">
<source>The usage of 'GeneratedComInterfaceAttribute' does not follow recommendations. {0}</source>
<target state="new">The usage of 'GeneratedComInterfaceAttribute' does not follow recommendations. {0}</target>
<note />
</trans-unit>
<trans-unit id="ComInterfaceUsageDoesNotFollowBestPracticesTitle">
<source>The usage of 'GeneratedComInterfaceAttribute' does not follow recommendations.</source>
<target state="new">The usage of 'GeneratedComInterfaceAttribute' does not follow recommendations.</target>
<note />
</trans-unit>
<trans-unit id="ComMethodReturningIntWillBeOutParameterMessage">
<source>The return value in the managed definition will be converted to an 'out' parameter when calling the unmanaged COM method. If the return value is intended to be the HRESULT code returned by the unmanaged COM method, use '[PreserveSig]' on the method.</source>
<target state="translated">Il valore restituito nella definizione gestita verrà convertito in un parametro 'out' quando si chiama il metodo COM non gestito. Se il valore restituito deve essere il codice HRESULT restituito dal metodo COM non gestito, utilizzare '[PreserveSig]' sul metodo.</target>
......@@ -447,6 +457,11 @@
<target state="translated">Questo tipo verrà considerato come uno struct nella firma nativa, non come HRESULT nativo</target>
<note />
</trans-unit>
<trans-unit id="InAttributeNotSupportedOnByValueParameters">
<source>The '[In]' attribute is only supported on array parameters. By-value parameters are considered read-only by default.</source>
<target state="new">The '[In]' attribute is only supported on array parameters. By-value parameters are considered read-only by default.</target>
<note />
</trans-unit>
<trans-unit id="InAttributeNotSupportedWithoutOutBlittableArray">
<source>The '[In]' attribute is not supported unless the '[Out]' attribute is also used. Blittable arrays cannot be marshalled as '[In]' only.</source>
<target state="translated">L'attributo '[In]' non è supportato a meno che non venga usato anche l'attributo '[Out]'. Le matrici copiabili da BLT non possono essere sottoposte a marshalling solo come '[In]'.</target>
......@@ -467,6 +482,11 @@
<target state="translated">Gli attributi '[In]' e '[Out]' specificati per questo parametro non sono supportati in questo parametro.</target>
<note />
</trans-unit>
<trans-unit id="InOutAttributeNotSupportedOnByValueParameters">
<source>The '[In]' and '[Out]' attributes are only supported on array parameters. Consider using the 'ref' keyword to make the parameter mutable.</source>
<target state="new">The '[In]' and '[Out]' attributes are only supported on array parameters. Consider using the 'ref' keyword to make the parameter mutable.</target>
<note />
</trans-unit>
<trans-unit id="InOutAttributes">
<source>[In] and [Out] attributes</source>
<target state="translated">Attributi [In] e [Out]</target>
......@@ -702,6 +722,16 @@
<target state="translated">Utilizzo di 'VirtualMethodIndexAttribute' non valido</target>
<note />
</trans-unit>
<trans-unit id="LibraryImportUsageDoesNotFollowBestPracticesMessageWithDetails">
<source>The usage of 'LibraryImportAttribute' does not follow recommendations. {0}</source>
<target state="new">The usage of 'LibraryImportAttribute' does not follow recommendations. {0}</target>
<note />
</trans-unit>
<trans-unit id="LibraryImportUsageDoesNotFollowBestPracticesTitle">
<source>The usage of 'LibraryImportAttribute' does not follow recommendations.</source>
<target state="new">The usage of 'LibraryImportAttribute' does not follow recommendations.</target>
<note />
</trans-unit>
<trans-unit id="LinearCollectionElementTypesMustMatchDescription">
<source>The element type of the 'ReadOnlySpan' returned by 'GetManagedValuesSource' must be the same as the element type returned by 'GetManagedValuesDestination'.</source>
<target state="translated">Il tipo di elemento di 'ReadOnlySpan' restituito da 'GetManagedValuesSource' deve essere uguale al tipo di elemento restituito da 'GetManagedValuesDestination'.</target>
......@@ -903,8 +933,8 @@
<note />
</trans-unit>
<trans-unit id="OutAttributeNotSupportedOnByValueParameters">
<source>The `[Out]` attribute is only supported on array parameters. Consider using 'out' or 'ref' keywords to make the parameter mutable.</source>
<target state="translated">L'attributo '[Out]' è supportato solo nei parametri di matrice. Provare a usare le parole chiave 'out' o 'ref' per rendere modificabile il parametro.</target>
<source>The '[Out]' attribute is only supported on array parameters. Consider using 'out' or 'ref' keywords to make the parameter mutable.</source>
<target state="needs-review-translation">L'attributo '[Out]' è supportato solo nei parametri di matrice. Provare a usare le parole chiave 'out' o 'ref' per rendere modificabile il parametro.</target>
<note />
</trans-unit>
<trans-unit id="OutRequiresToManagedDescription">
......@@ -917,6 +947,11 @@
<target state="translated">Il tipo '{0}' specifica che supporta il marshalling nella direzione 'Out', ma non fornisce un metodo 'ToManaged' che restituisce il tipo gestito</target>
<note />
</trans-unit>
<trans-unit id="PreferExplicitInOutAttributesOnArrays">
<source>It is recommended to use explicit '[In]' and '[Out]' attributes on array parameters.</source>
<target state="new">It is recommended to use explicit '[In]' and '[Out]' attributes on array parameters.</target>
<note />
</trans-unit>
<trans-unit id="RequiresAllowUnsafeBlocksDescriptionCom">
<source>'GeneratedComInterfaceAttribute' and 'GeneratedComClassAttribute' require unsafe code. Project must be updated with '&lt;AllowUnsafeBlocks&gt;true&lt;/AllowUnsafeBlocks&gt;'.</source>
<target state="translated">GeneratedComInterfaceAttribute e 'GeneratedComClassAttribute' richiedono codice non gestito. Il progetto deve essere aggiornato con '&lt;AllowUnsafeBlocks&gt;true&lt;/AllowUnsafeBlocks&gt;'.</target>
......
......@@ -147,6 +147,16 @@
<target state="translated">'EnableComHosting' を使用した .NET COM ホスティングでは、'GeneratedComInterfaceAttribute' のインターフェイスはサポートされていません</target>
<note />
</trans-unit>
<trans-unit id="ComInterfaceUsageDoesNotFollowBestPracticesMessageWithDetails">
<source>The usage of 'GeneratedComInterfaceAttribute' does not follow recommendations. {0}</source>
<target state="new">The usage of 'GeneratedComInterfaceAttribute' does not follow recommendations. {0}</target>
<note />
</trans-unit>
<trans-unit id="ComInterfaceUsageDoesNotFollowBestPracticesTitle">
<source>The usage of 'GeneratedComInterfaceAttribute' does not follow recommendations.</source>
<target state="new">The usage of 'GeneratedComInterfaceAttribute' does not follow recommendations.</target>
<note />
</trans-unit>
<trans-unit id="ComMethodReturningIntWillBeOutParameterMessage">
<source>The return value in the managed definition will be converted to an 'out' parameter when calling the unmanaged COM method. If the return value is intended to be the HRESULT code returned by the unmanaged COM method, use '[PreserveSig]' on the method.</source>
<target state="translated">マネージド定義の戻り値は、アンマネージド COM メソッドを呼び出すときに 'out' パラメーターに変換されます。戻り値を、アンマネージド COM メソッドによって返される HRESULT コードにする場合は、メソッドで '[PreserveSig]' を使用してください。</target>
......@@ -447,6 +457,11 @@
<target state="translated">この型はネイティブの HRESULT ではなく、ネイティブ シグネチャの構造体として扱われます</target>
<note />
</trans-unit>
<trans-unit id="InAttributeNotSupportedOnByValueParameters">
<source>The '[In]' attribute is only supported on array parameters. By-value parameters are considered read-only by default.</source>
<target state="new">The '[In]' attribute is only supported on array parameters. By-value parameters are considered read-only by default.</target>
<note />
</trans-unit>
<trans-unit id="InAttributeNotSupportedWithoutOutBlittableArray">
<source>The '[In]' attribute is not supported unless the '[Out]' attribute is also used. Blittable arrays cannot be marshalled as '[In]' only.</source>
<target state="translated">'[In]'属性は、'[Out]'属性も使用しない限りサポートされません。Blittable 配列は、'[In]'としてのみマーシャリングできません。</target>
......@@ -467,6 +482,11 @@
<target state="translated">このパラメーターに指定された '[In]' 属性と '[Out]' 属性は、このパラメーターではサポートされていません。</target>
<note />
</trans-unit>
<trans-unit id="InOutAttributeNotSupportedOnByValueParameters">
<source>The '[In]' and '[Out]' attributes are only supported on array parameters. Consider using the 'ref' keyword to make the parameter mutable.</source>
<target state="new">The '[In]' and '[Out]' attributes are only supported on array parameters. Consider using the 'ref' keyword to make the parameter mutable.</target>
<note />
</trans-unit>
<trans-unit id="InOutAttributes">
<source>[In] and [Out] attributes</source>
<target state="translated">属性の[In]と[Out]</target>
......@@ -702,6 +722,16 @@
<target state="translated">'VirtualMethodIndexAttribute' の使用法が無効です</target>
<note />
</trans-unit>
<trans-unit id="LibraryImportUsageDoesNotFollowBestPracticesMessageWithDetails">
<source>The usage of 'LibraryImportAttribute' does not follow recommendations. {0}</source>
<target state="new">The usage of 'LibraryImportAttribute' does not follow recommendations. {0}</target>
<note />
</trans-unit>
<trans-unit id="LibraryImportUsageDoesNotFollowBestPracticesTitle">
<source>The usage of 'LibraryImportAttribute' does not follow recommendations.</source>
<target state="new">The usage of 'LibraryImportAttribute' does not follow recommendations.</target>
<note />
</trans-unit>
<trans-unit id="LinearCollectionElementTypesMustMatchDescription">
<source>The element type of the 'ReadOnlySpan' returned by 'GetManagedValuesSource' must be the same as the element type returned by 'GetManagedValuesDestination'.</source>
<target state="translated">'GetManagedValuesSource' によって返される 'ReadOnlySpan' の要素型は、'GetManagedValuesDestination' によって返される要素型と同じである必要があります。</target>
......@@ -903,8 +933,8 @@
<note />
</trans-unit>
<trans-unit id="OutAttributeNotSupportedOnByValueParameters">
<source>The `[Out]` attribute is only supported on array parameters. Consider using 'out' or 'ref' keywords to make the parameter mutable.</source>
<target state="translated">'[Out]' 属性は、配列パラメーターでのみサポートされます。パラメーターを変更可能にするには、'out' または 'ref' キーワードを使用することを検討してください。</target>
<source>The '[Out]' attribute is only supported on array parameters. Consider using 'out' or 'ref' keywords to make the parameter mutable.</source>
<target state="new">The '[Out]' attribute is only supported on array parameters. Consider using 'out' or 'ref' keywords to make the parameter mutable.</target>
<note />
</trans-unit>
<trans-unit id="OutRequiresToManagedDescription">
......@@ -917,6 +947,11 @@
<target state="translated">型 '{0}' は、'Out' 方向のマーシャリングをサポートしますが、マネージド型を返す 'ToManaged' メソッドは指定されません</target>
<note />
</trans-unit>
<trans-unit id="PreferExplicitInOutAttributesOnArrays">
<source>It is recommended to use explicit '[In]' and '[Out]' attributes on array parameters.</source>
<target state="new">It is recommended to use explicit '[In]' and '[Out]' attributes on array parameters.</target>
<note />
</trans-unit>
<trans-unit id="RequiresAllowUnsafeBlocksDescriptionCom">
<source>'GeneratedComInterfaceAttribute' and 'GeneratedComClassAttribute' require unsafe code. Project must be updated with '&lt;AllowUnsafeBlocks&gt;true&lt;/AllowUnsafeBlocks&gt;'.</source>
<target state="translated">'GeneratedComInterfaceAttribute' および 'GeneratedComClassAttribute' にはアンセーフ コードが必要です。プロジェクトは '&lt;AllowUnsafeBlocks&gt;true&lt;/AllowUnsafeBlocks&gt;' で更新する必要があります。</target>
......@@ -1277,4 +1312,4 @@
</trans-unit>
</body>
</file>
</xliff>
\ No newline at end of file
</xliff>
......@@ -147,6 +147,16 @@
<target state="translated">'EnableComHosting'을 사용한 .NET COM 호스팅은 'GeneratedComInterfaceAttribute'를 사용한 인터페이스를 지원하지 않습니다.</target>
<note />
</trans-unit>
<trans-unit id="ComInterfaceUsageDoesNotFollowBestPracticesMessageWithDetails">
<source>The usage of 'GeneratedComInterfaceAttribute' does not follow recommendations. {0}</source>
<target state="new">The usage of 'GeneratedComInterfaceAttribute' does not follow recommendations. {0}</target>
<note />
</trans-unit>
<trans-unit id="ComInterfaceUsageDoesNotFollowBestPracticesTitle">
<source>The usage of 'GeneratedComInterfaceAttribute' does not follow recommendations.</source>
<target state="new">The usage of 'GeneratedComInterfaceAttribute' does not follow recommendations.</target>
<note />
</trans-unit>
<trans-unit id="ComMethodReturningIntWillBeOutParameterMessage">
<source>The return value in the managed definition will be converted to an 'out' parameter when calling the unmanaged COM method. If the return value is intended to be the HRESULT code returned by the unmanaged COM method, use '[PreserveSig]' on the method.</source>
<target state="translated">관리 정의의 반환 값은 관리되지 않는 COM 메서드를 호출할 때 'out' 매개 변수로 변환됩니다. 반환 값이 관리되지 않는 COM 메서드에서 반환된 HRESULT 코드인 경우 메서드에서 '[PreserveSig]'를 사용하세요.</target>
......@@ -447,6 +457,11 @@
<target state="translated">이 형식은 네이티브 HRESULT가 아니라 네이티브 서명의 구조체로 처리됩니다.</target>
<note />
</trans-unit>
<trans-unit id="InAttributeNotSupportedOnByValueParameters">
<source>The '[In]' attribute is only supported on array parameters. By-value parameters are considered read-only by default.</source>
<target state="new">The '[In]' attribute is only supported on array parameters. By-value parameters are considered read-only by default.</target>
<note />
</trans-unit>
<trans-unit id="InAttributeNotSupportedWithoutOutBlittableArray">
<source>The '[In]' attribute is not supported unless the '[Out]' attribute is also used. Blittable arrays cannot be marshalled as '[In]' only.</source>
<target state="translated">'[Out]' 특성도 사용되지 않는 한 '[In]' 특성은 지원되지 않습니다. Blittable 배열은 '[In]'으로만 마샬링할 수 없습니다.</target>
......@@ -467,6 +482,11 @@
<target state="translated">이 매개 변수에 제공된 '[In]' 및 '[Out]' 특성은 이 매개 변수에서 지원되지 않습니다.</target>
<note />
</trans-unit>
<trans-unit id="InOutAttributeNotSupportedOnByValueParameters">
<source>The '[In]' and '[Out]' attributes are only supported on array parameters. Consider using the 'ref' keyword to make the parameter mutable.</source>
<target state="new">The '[In]' and '[Out]' attributes are only supported on array parameters. Consider using the 'ref' keyword to make the parameter mutable.</target>
<note />
</trans-unit>
<trans-unit id="InOutAttributes">
<source>[In] and [Out] attributes</source>
<target state="translated">[In] 및 [Out] 속성</target>
......@@ -702,6 +722,16 @@
<target state="translated">잘못된 'VirtualMethodIndexAttribute' 사용</target>
<note />
</trans-unit>
<trans-unit id="LibraryImportUsageDoesNotFollowBestPracticesMessageWithDetails">
<source>The usage of 'LibraryImportAttribute' does not follow recommendations. {0}</source>
<target state="new">The usage of 'LibraryImportAttribute' does not follow recommendations. {0}</target>
<note />
</trans-unit>
<trans-unit id="LibraryImportUsageDoesNotFollowBestPracticesTitle">
<source>The usage of 'LibraryImportAttribute' does not follow recommendations.</source>
<target state="new">The usage of 'LibraryImportAttribute' does not follow recommendations.</target>
<note />
</trans-unit>
<trans-unit id="LinearCollectionElementTypesMustMatchDescription">
<source>The element type of the 'ReadOnlySpan' returned by 'GetManagedValuesSource' must be the same as the element type returned by 'GetManagedValuesDestination'.</source>
<target state="translated">'GetManagedValuesSource'에서 반환된 'ReadOnlySpan'의 요소 형식은 'GetManagedValuesDestination'에서 반환된 요소 형식과 동일해야 합니다.</target>
......@@ -903,8 +933,8 @@
<note />
</trans-unit>
<trans-unit id="OutAttributeNotSupportedOnByValueParameters">
<source>The `[Out]` attribute is only supported on array parameters. Consider using 'out' or 'ref' keywords to make the parameter mutable.</source>
<target state="translated">'[Out]' 특성은 배열 매개 변수에서만 지원됩니다. 매개 변수를 변경할 수 있도록 'out' 또는 'ref' 키워드를 사용하는 것이 좋습니다.</target>
<source>The '[Out]' attribute is only supported on array parameters. Consider using 'out' or 'ref' keywords to make the parameter mutable.</source>
<target state="new">The '[Out]' attribute is only supported on array parameters. Consider using 'out' or 'ref' keywords to make the parameter mutable.</target>
<note />
</trans-unit>
<trans-unit id="OutRequiresToManagedDescription">
......@@ -917,6 +947,11 @@
<target state="translated">형식 '{0}'은(는) 'Out' 방향으로 마샬링을 지원하도록 지정하지만 관리 형식을 반환하는 'ToManaged' 메서드를 제공하지 않습니다.</target>
<note />
</trans-unit>
<trans-unit id="PreferExplicitInOutAttributesOnArrays">
<source>It is recommended to use explicit '[In]' and '[Out]' attributes on array parameters.</source>
<target state="new">It is recommended to use explicit '[In]' and '[Out]' attributes on array parameters.</target>
<note />
</trans-unit>
<trans-unit id="RequiresAllowUnsafeBlocksDescriptionCom">
<source>'GeneratedComInterfaceAttribute' and 'GeneratedComClassAttribute' require unsafe code. Project must be updated with '&lt;AllowUnsafeBlocks&gt;true&lt;/AllowUnsafeBlocks&gt;'.</source>
<target state="translated">'GeneratedComInterfaceAttribute' 및 'GeneratedComClassAttribute'에는 안전하지 않은 코드가 필요합니다. 프로젝트를 '&lt;AllowUnsafeBlocks&gt;true&lt;/AllowUnsafeBlocks&gt;'로 업데이트해야 합니다.</target>
......@@ -1276,4 +1311,4 @@
</trans-unit>
</body>
</file>
</xliff>
\ No newline at end of file
</xliff>
......@@ -147,6 +147,16 @@
<target state="translated">Hosting modelu COM platformy .NET z elementem „EnableComHosting” nie obsługuje interfejsów z atrybutem „GeneratedComInterfaceAttribute”</target>
<note />
</trans-unit>
<trans-unit id="ComInterfaceUsageDoesNotFollowBestPracticesMessageWithDetails">
<source>The usage of 'GeneratedComInterfaceAttribute' does not follow recommendations. {0}</source>
<target state="new">The usage of 'GeneratedComInterfaceAttribute' does not follow recommendations. {0}</target>
<note />
</trans-unit>
<trans-unit id="ComInterfaceUsageDoesNotFollowBestPracticesTitle">
<source>The usage of 'GeneratedComInterfaceAttribute' does not follow recommendations.</source>
<target state="new">The usage of 'GeneratedComInterfaceAttribute' does not follow recommendations.</target>
<note />
</trans-unit>
<trans-unit id="ComMethodReturningIntWillBeOutParameterMessage">
<source>The return value in the managed definition will be converted to an 'out' parameter when calling the unmanaged COM method. If the return value is intended to be the HRESULT code returned by the unmanaged COM method, use '[PreserveSig]' on the method.</source>
<target state="translated">Wartość zwracana w definicji zarządzanej zostanie przekonwertowana na parametr „out” podczas wywoływania niezarządzanej metody COM. Jeśli wartość zwracana ma być kodem HRESULT zwracanym przez niezarządzaną metodę COM, należy użyć „[PreserveSig]” w metodzie.</target>
......@@ -447,6 +457,11 @@
<target state="translated">Ten typ będzie traktowany jako struktura w podpisie natywnym, a nie jako natywny wynik HRESULT</target>
<note />
</trans-unit>
<trans-unit id="InAttributeNotSupportedOnByValueParameters">
<source>The '[In]' attribute is only supported on array parameters. By-value parameters are considered read-only by default.</source>
<target state="new">The '[In]' attribute is only supported on array parameters. By-value parameters are considered read-only by default.</target>
<note />
</trans-unit>
<trans-unit id="InAttributeNotSupportedWithoutOutBlittableArray">
<source>The '[In]' attribute is not supported unless the '[Out]' attribute is also used. Blittable arrays cannot be marshalled as '[In]' only.</source>
<target state="translated">Atrybut „[In]” nie jest obsługiwany, chyba że używany jest również atrybut „[Out]”. Tablice kopiowalne nie mogą być kierowane tylko jako „[In]”.</target>
......@@ -467,6 +482,11 @@
<target state="translated">Podane atrybuty „[In]” i „[Out]” w tym parametrze nie są obsługiwane w tym parametrze.</target>
<note />
</trans-unit>
<trans-unit id="InOutAttributeNotSupportedOnByValueParameters">
<source>The '[In]' and '[Out]' attributes are only supported on array parameters. Consider using the 'ref' keyword to make the parameter mutable.</source>
<target state="new">The '[In]' and '[Out]' attributes are only supported on array parameters. Consider using the 'ref' keyword to make the parameter mutable.</target>
<note />
</trans-unit>
<trans-unit id="InOutAttributes">
<source>[In] and [Out] attributes</source>
<target state="translated">Atrybuty [In] i [Out]</target>
......@@ -702,6 +722,16 @@
<target state="translated">Nieprawidłowe użycie atrybutu „VirtualMethodIndexAttribute”</target>
<note />
</trans-unit>
<trans-unit id="LibraryImportUsageDoesNotFollowBestPracticesMessageWithDetails">
<source>The usage of 'LibraryImportAttribute' does not follow recommendations. {0}</source>
<target state="new">The usage of 'LibraryImportAttribute' does not follow recommendations. {0}</target>
<note />
</trans-unit>
<trans-unit id="LibraryImportUsageDoesNotFollowBestPracticesTitle">
<source>The usage of 'LibraryImportAttribute' does not follow recommendations.</source>
<target state="new">The usage of 'LibraryImportAttribute' does not follow recommendations.</target>
<note />
</trans-unit>
<trans-unit id="LinearCollectionElementTypesMustMatchDescription">
<source>The element type of the 'ReadOnlySpan' returned by 'GetManagedValuesSource' must be the same as the element type returned by 'GetManagedValuesDestination'.</source>
<target state="translated">Typ elementu „ReadOnlySpan” zwracany przez element „GetManagedValuesSource” musi być taki sam jak typ elementu zwracany przez element „GetManagedValuesDestination”.</target>
......@@ -903,8 +933,8 @@
<note />
</trans-unit>
<trans-unit id="OutAttributeNotSupportedOnByValueParameters">
<source>The `[Out]` attribute is only supported on array parameters. Consider using 'out' or 'ref' keywords to make the parameter mutable.</source>
<target state="translated">Atrybut „[Out]” jest obsługiwany tylko w przypadku parametrów tablicy. Rozważ użycie słów kluczowych „out” lub „ref”, aby umożliwić modyfikowanie parametru.</target>
<source>The '[Out]' attribute is only supported on array parameters. Consider using 'out' or 'ref' keywords to make the parameter mutable.</source>
<target state="needs-review-translation">Atrybut „[Out]” jest obsługiwany tylko w przypadku parametrów tablicy. Rozważ użycie słów kluczowych „out” lub „ref”, aby umożliwić modyfikowanie parametru.</target>
<note />
</trans-unit>
<trans-unit id="OutRequiresToManagedDescription">
......@@ -917,6 +947,11 @@
<target state="translated">Typ „{0}” określa, że obsługuje skierowanie w kierunku „Out”, ale nie zapewnia metody „ToManaged”, która zwraca typ zarządzany</target>
<note />
</trans-unit>
<trans-unit id="PreferExplicitInOutAttributesOnArrays">
<source>It is recommended to use explicit '[In]' and '[Out]' attributes on array parameters.</source>
<target state="new">It is recommended to use explicit '[In]' and '[Out]' attributes on array parameters.</target>
<note />
</trans-unit>
<trans-unit id="RequiresAllowUnsafeBlocksDescriptionCom">
<source>'GeneratedComInterfaceAttribute' and 'GeneratedComClassAttribute' require unsafe code. Project must be updated with '&lt;AllowUnsafeBlocks&gt;true&lt;/AllowUnsafeBlocks&gt;'.</source>
<target state="translated">Atrybut „GeneratedComInterfaceAttribute” i „GeneratedComClassAttribute” wymagają niebezpiecznego kodu. Projekt musi zostać zaktualizowany za pomocą polecenia „&lt;AllowUnsafeBlocks&gt;true&lt;/AllowUnsafeBlocks&gt;”.</target>
......
......@@ -147,6 +147,16 @@
<target state="translated">A hospedagem .NET COM com 'EnableComHosting' não dá suporte a interfaces com 'GeneratedComInterfaceAttribute'</target>
<note />
</trans-unit>
<trans-unit id="ComInterfaceUsageDoesNotFollowBestPracticesMessageWithDetails">
<source>The usage of 'GeneratedComInterfaceAttribute' does not follow recommendations. {0}</source>
<target state="new">The usage of 'GeneratedComInterfaceAttribute' does not follow recommendations. {0}</target>
<note />
</trans-unit>
<trans-unit id="ComInterfaceUsageDoesNotFollowBestPracticesTitle">
<source>The usage of 'GeneratedComInterfaceAttribute' does not follow recommendations.</source>
<target state="new">The usage of 'GeneratedComInterfaceAttribute' does not follow recommendations.</target>
<note />
</trans-unit>
<trans-unit id="ComMethodReturningIntWillBeOutParameterMessage">
<source>The return value in the managed definition will be converted to an 'out' parameter when calling the unmanaged COM method. If the return value is intended to be the HRESULT code returned by the unmanaged COM method, use '[PreserveSig]' on the method.</source>
<target state="translated">O valor de retorno na definição gerenciada será convertido em um parâmetro 'out' ao chamar o método COM não gerenciado. Se o valor de retorno for o código HRESULT retornado pelo método COM não gerenciado, use '[PreserveSig]' no método.</target>
......@@ -447,6 +457,11 @@
<target state="translated">Este tipo será tratado como uma estrutura na assinatura nativa, não como um HRESULT nativo</target>
<note />
</trans-unit>
<trans-unit id="InAttributeNotSupportedOnByValueParameters">
<source>The '[In]' attribute is only supported on array parameters. By-value parameters are considered read-only by default.</source>
<target state="new">The '[In]' attribute is only supported on array parameters. By-value parameters are considered read-only by default.</target>
<note />
</trans-unit>
<trans-unit id="InAttributeNotSupportedWithoutOutBlittableArray">
<source>The '[In]' attribute is not supported unless the '[Out]' attribute is also used. Blittable arrays cannot be marshalled as '[In]' only.</source>
<target state="translated">O atributo '[In]' não é suportado, a menos que o atributo '[Out]' também seja usado. Matrizes Blittable não podem ser empacotadas apenas como '[In]'.</target>
......@@ -467,6 +482,11 @@
<target state="translated">Os atributos '[In]' e '[Out]' neste parâmetro não têm suporte neste parâmetro.</target>
<note />
</trans-unit>
<trans-unit id="InOutAttributeNotSupportedOnByValueParameters">
<source>The '[In]' and '[Out]' attributes are only supported on array parameters. Consider using the 'ref' keyword to make the parameter mutable.</source>
<target state="new">The '[In]' and '[Out]' attributes are only supported on array parameters. Consider using the 'ref' keyword to make the parameter mutable.</target>
<note />
</trans-unit>
<trans-unit id="InOutAttributes">
<source>[In] and [Out] attributes</source>
<target state="translated">Atributos [In] e [Out]</target>
......@@ -702,6 +722,16 @@
<target state="translated">Uso de 'VirtualMethodIndexAttribute' inválido</target>
<note />
</trans-unit>
<trans-unit id="LibraryImportUsageDoesNotFollowBestPracticesMessageWithDetails">
<source>The usage of 'LibraryImportAttribute' does not follow recommendations. {0}</source>
<target state="new">The usage of 'LibraryImportAttribute' does not follow recommendations. {0}</target>
<note />
</trans-unit>
<trans-unit id="LibraryImportUsageDoesNotFollowBestPracticesTitle">
<source>The usage of 'LibraryImportAttribute' does not follow recommendations.</source>
<target state="new">The usage of 'LibraryImportAttribute' does not follow recommendations.</target>
<note />
</trans-unit>
<trans-unit id="LinearCollectionElementTypesMustMatchDescription">
<source>The element type of the 'ReadOnlySpan' returned by 'GetManagedValuesSource' must be the same as the element type returned by 'GetManagedValuesDestination'.</source>
<target state="translated">O tipo de elemento de 'ReadOnlySpan' retornado por 'GetManagedValuesSource' deve ser igual ao tipo de elemento retornado por 'GetManagedValuesDestination'.</target>
......@@ -903,8 +933,8 @@
<note />
</trans-unit>
<trans-unit id="OutAttributeNotSupportedOnByValueParameters">
<source>The `[Out]` attribute is only supported on array parameters. Consider using 'out' or 'ref' keywords to make the parameter mutable.</source>
<target state="translated">O atributo "[Out]" só tem suporte em parâmetros de matriz. Considere usar palavras-chave "out" ou "ref" para tornar o parâmetro mutável.</target>
<source>The '[Out]' attribute is only supported on array parameters. Consider using 'out' or 'ref' keywords to make the parameter mutable.</source>
<target state="new">The '[Out]' attribute is only supported on array parameters. Consider using 'out' or 'ref' keywords to make the parameter mutable.</target>
<note />
</trans-unit>
<trans-unit id="OutRequiresToManagedDescription">
......@@ -917,6 +947,11 @@
<target state="translated">O tipo '{0}' especifica que ele dá suporte a marshalling na direção 'Out', mas não fornece um método 'ToManaged' que retorna o tipo gerenciado</target>
<note />
</trans-unit>
<trans-unit id="PreferExplicitInOutAttributesOnArrays">
<source>It is recommended to use explicit '[In]' and '[Out]' attributes on array parameters.</source>
<target state="new">It is recommended to use explicit '[In]' and '[Out]' attributes on array parameters.</target>
<note />
</trans-unit>
<trans-unit id="RequiresAllowUnsafeBlocksDescriptionCom">
<source>'GeneratedComInterfaceAttribute' and 'GeneratedComClassAttribute' require unsafe code. Project must be updated with '&lt;AllowUnsafeBlocks&gt;true&lt;/AllowUnsafeBlocks&gt;'.</source>
<target state="translated">"GeneratedComInterfaceAttribute" e "GeneratedComClassAttribute" exigem código não seguro. O projeto deve ser atualizado com "&lt;AllowUnsafeBlocks&gt;true&lt;/AllowUnsafeBlocks&gt;".</target>
......@@ -1276,4 +1311,4 @@
</trans-unit>
</body>
</file>
</xliff>
\ No newline at end of file
</xliff>
......@@ -147,6 +147,16 @@
<target state="translated">Размещение .NET COM с "EnableComHosting" не поддерживает интерфейсы с "GeneratedComInterfaceAttribute"</target>
<note />
</trans-unit>
<trans-unit id="ComInterfaceUsageDoesNotFollowBestPracticesMessageWithDetails">
<source>The usage of 'GeneratedComInterfaceAttribute' does not follow recommendations. {0}</source>
<target state="new">The usage of 'GeneratedComInterfaceAttribute' does not follow recommendations. {0}</target>
<note />
</trans-unit>
<trans-unit id="ComInterfaceUsageDoesNotFollowBestPracticesTitle">
<source>The usage of 'GeneratedComInterfaceAttribute' does not follow recommendations.</source>
<target state="new">The usage of 'GeneratedComInterfaceAttribute' does not follow recommendations.</target>
<note />
</trans-unit>
<trans-unit id="ComMethodReturningIntWillBeOutParameterMessage">
<source>The return value in the managed definition will be converted to an 'out' parameter when calling the unmanaged COM method. If the return value is intended to be the HRESULT code returned by the unmanaged COM method, use '[PreserveSig]' on the method.</source>
<target state="translated">Возвращаемое значение в управляемом определении будет преобразовано в параметр "out" при вызове неуправляемого метода COM. Если возвращаемое значение должно быть кодом HRESULT, возвращаемым неуправляемым COM-методом, используйте "[PreserveSig]" в методе.</target>
......@@ -447,6 +457,11 @@
<target state="translated">Этот тип будет рассматриваться как структура в собственной подписи, а не как собственный HRESULT.</target>
<note />
</trans-unit>
<trans-unit id="InAttributeNotSupportedOnByValueParameters">
<source>The '[In]' attribute is only supported on array parameters. By-value parameters are considered read-only by default.</source>
<target state="new">The '[In]' attribute is only supported on array parameters. By-value parameters are considered read-only by default.</target>
<note />
</trans-unit>
<trans-unit id="InAttributeNotSupportedWithoutOutBlittableArray">
<source>The '[In]' attribute is not supported unless the '[Out]' attribute is also used. Blittable arrays cannot be marshalled as '[In]' only.</source>
<target state="translated">Атрибут "[In]" не поддерживается, если также не используется атрибут "[Out]". Преобразуемые массивы нельзя сортировать только как "[In]".</target>
......@@ -467,6 +482,11 @@
<target state="translated">Указанные атрибуты \"[In]\" и \"[Out]\" для этого параметра не поддерживаются.</target>
<note />
</trans-unit>
<trans-unit id="InOutAttributeNotSupportedOnByValueParameters">
<source>The '[In]' and '[Out]' attributes are only supported on array parameters. Consider using the 'ref' keyword to make the parameter mutable.</source>
<target state="new">The '[In]' and '[Out]' attributes are only supported on array parameters. Consider using the 'ref' keyword to make the parameter mutable.</target>
<note />
</trans-unit>
<trans-unit id="InOutAttributes">
<source>[In] and [Out] attributes</source>
<target state="translated">Атрибуты [In] и [Out]</target>
......@@ -702,6 +722,16 @@
<target state="translated">Недопустимое использование VirtualMethodIndexAttribute</target>
<note />
</trans-unit>
<trans-unit id="LibraryImportUsageDoesNotFollowBestPracticesMessageWithDetails">
<source>The usage of 'LibraryImportAttribute' does not follow recommendations. {0}</source>
<target state="new">The usage of 'LibraryImportAttribute' does not follow recommendations. {0}</target>
<note />
</trans-unit>
<trans-unit id="LibraryImportUsageDoesNotFollowBestPracticesTitle">
<source>The usage of 'LibraryImportAttribute' does not follow recommendations.</source>
<target state="new">The usage of 'LibraryImportAttribute' does not follow recommendations.</target>
<note />
</trans-unit>
<trans-unit id="LinearCollectionElementTypesMustMatchDescription">
<source>The element type of the 'ReadOnlySpan' returned by 'GetManagedValuesSource' must be the same as the element type returned by 'GetManagedValuesDestination'.</source>
<target state="translated">Тип элемента \"ReadOnlySpan\", возвращенный методом \"GetManagedValuesSource\", должен совпадать с типом элемента, возвращаемым методом \"GetManagedValuesDestination\".</target>
......@@ -903,8 +933,8 @@
<note />
</trans-unit>
<trans-unit id="OutAttributeNotSupportedOnByValueParameters">
<source>The `[Out]` attribute is only supported on array parameters. Consider using 'out' or 'ref' keywords to make the parameter mutable.</source>
<target state="translated">Атрибут "[Out]" поддерживается только для параметров массива. Рассмотрите возможность использования ключевых слов "out" или "ref", чтобы сделать параметр изменяемым.</target>
<source>The '[Out]' attribute is only supported on array parameters. Consider using 'out' or 'ref' keywords to make the parameter mutable.</source>
<target state="needs-review-translation">Атрибут "[Out]" поддерживается только для параметров массива. Рассмотрите возможность использования ключевых слов "out" или "ref", чтобы сделать параметр изменяемым.</target>
<note />
</trans-unit>
<trans-unit id="OutRequiresToManagedDescription">
......@@ -917,6 +947,11 @@
<target state="translated">Тип \"{0}\" указывает, что поддерживает маршализацию в направлении \"наружу\", но не предоставляет метод \"ToManaged\", который возвращает управляемый тип</target>
<note />
</trans-unit>
<trans-unit id="PreferExplicitInOutAttributesOnArrays">
<source>It is recommended to use explicit '[In]' and '[Out]' attributes on array parameters.</source>
<target state="new">It is recommended to use explicit '[In]' and '[Out]' attributes on array parameters.</target>
<note />
</trans-unit>
<trans-unit id="RequiresAllowUnsafeBlocksDescriptionCom">
<source>'GeneratedComInterfaceAttribute' and 'GeneratedComClassAttribute' require unsafe code. Project must be updated with '&lt;AllowUnsafeBlocks&gt;true&lt;/AllowUnsafeBlocks&gt;'.</source>
<target state="translated">Для "GeneratedComInterfaceAttribute" и "GeneratedComClassAttribute" требуется небезопасный код. Проект необходимо обновить с использованием значения "&lt;AllowUnsafeBlocks&gt;true&lt;/AllowUnsafeBlocks&gt;".</target>
......
......@@ -147,6 +147,16 @@
<target state="translated">'EnableComHosting' ile barındırma .NET COM, 'GeneratedComInterfaceAttribute' ile arabirimleri desteklemez</target>
<note />
</trans-unit>
<trans-unit id="ComInterfaceUsageDoesNotFollowBestPracticesMessageWithDetails">
<source>The usage of 'GeneratedComInterfaceAttribute' does not follow recommendations. {0}</source>
<target state="new">The usage of 'GeneratedComInterfaceAttribute' does not follow recommendations. {0}</target>
<note />
</trans-unit>
<trans-unit id="ComInterfaceUsageDoesNotFollowBestPracticesTitle">
<source>The usage of 'GeneratedComInterfaceAttribute' does not follow recommendations.</source>
<target state="new">The usage of 'GeneratedComInterfaceAttribute' does not follow recommendations.</target>
<note />
</trans-unit>
<trans-unit id="ComMethodReturningIntWillBeOutParameterMessage">
<source>The return value in the managed definition will be converted to an 'out' parameter when calling the unmanaged COM method. If the return value is intended to be the HRESULT code returned by the unmanaged COM method, use '[PreserveSig]' on the method.</source>
<target state="translated">Yönetilen tanımdaki dönüş değeri, yönetilmeyen COM yöntemi çağrılırken 'out' parametresine dönüştürülür. Dönüş değerinin yönetilmeyen COM yöntemi tarafından döndürülen HRESULT kodu olması amaçlanmışsa, yöntemde '[PreserveSig]' kullanın.</target>
......@@ -447,6 +457,11 @@
<target state="translated">Bu tür, yerel HRESULT olarak değil, yerel imzada bir yapı olarak değerlendirilir</target>
<note />
</trans-unit>
<trans-unit id="InAttributeNotSupportedOnByValueParameters">
<source>The '[In]' attribute is only supported on array parameters. By-value parameters are considered read-only by default.</source>
<target state="new">The '[In]' attribute is only supported on array parameters. By-value parameters are considered read-only by default.</target>
<note />
</trans-unit>
<trans-unit id="InAttributeNotSupportedWithoutOutBlittableArray">
<source>The '[In]' attribute is not supported unless the '[Out]' attribute is also used. Blittable arrays cannot be marshalled as '[In]' only.</source>
<target state="translated">'[Out]' özniteliği de kullanılmadığı sürece '[In]' özniteliği desteklenmez. Blittable dizileri yalnızca '[In]' olarak hazırlanamaz.</target>
......@@ -467,6 +482,11 @@
<target state="translated">Bu parametrede sağlanan '[In]' ve '[Out]' öznitelikleri bu parametrede desteklenmiyor.</target>
<note />
</trans-unit>
<trans-unit id="InOutAttributeNotSupportedOnByValueParameters">
<source>The '[In]' and '[Out]' attributes are only supported on array parameters. Consider using the 'ref' keyword to make the parameter mutable.</source>
<target state="new">The '[In]' and '[Out]' attributes are only supported on array parameters. Consider using the 'ref' keyword to make the parameter mutable.</target>
<note />
</trans-unit>
<trans-unit id="InOutAttributes">
<source>[In] and [Out] attributes</source>
<target state="translated">[In] ve [Out] öznitelikleri</target>
......@@ -702,6 +722,16 @@
<target state="translated">Geçersiz 'VirtualMethodIndexAttribute' kullanımı</target>
<note />
</trans-unit>
<trans-unit id="LibraryImportUsageDoesNotFollowBestPracticesMessageWithDetails">
<source>The usage of 'LibraryImportAttribute' does not follow recommendations. {0}</source>
<target state="new">The usage of 'LibraryImportAttribute' does not follow recommendations. {0}</target>
<note />
</trans-unit>
<trans-unit id="LibraryImportUsageDoesNotFollowBestPracticesTitle">
<source>The usage of 'LibraryImportAttribute' does not follow recommendations.</source>
<target state="new">The usage of 'LibraryImportAttribute' does not follow recommendations.</target>
<note />
</trans-unit>
<trans-unit id="LinearCollectionElementTypesMustMatchDescription">
<source>The element type of the 'ReadOnlySpan' returned by 'GetManagedValuesSource' must be the same as the element type returned by 'GetManagedValuesDestination'.</source>
<target state="translated">'GetManagedValuesSource' tarafından döndürülen 'ReadOnlySpan' öğe türü, 'GetManagedValuesDestination' tarafından döndürülen öğe türüyle aynı olmalıdır.</target>
......@@ -903,8 +933,8 @@
<note />
</trans-unit>
<trans-unit id="OutAttributeNotSupportedOnByValueParameters">
<source>The `[Out]` attribute is only supported on array parameters. Consider using 'out' or 'ref' keywords to make the parameter mutable.</source>
<target state="translated">'[Out]' özniteliği yalnızca dizi parametrelerinde desteklenir. Parametreyi değiştirilebilir yapmak için 'out' veya 'ref' anahtar sözcükleri kullanmayı düşünün.</target>
<source>The '[Out]' attribute is only supported on array parameters. Consider using 'out' or 'ref' keywords to make the parameter mutable.</source>
<target state="needs-review-translation">'[Out]' özniteliği yalnızca dizi parametrelerinde desteklenir. Parametreyi değiştirilebilir yapmak için 'out' veya 'ref' anahtar sözcükleri kullanmayı düşünün.</target>
<note />
</trans-unit>
<trans-unit id="OutRequiresToManagedDescription">
......@@ -917,6 +947,11 @@
<target state="translated">'{0}' türü, 'Out' yönünde sıralamayı desteklediğini belirtiyor, ancak yönetilen türü döndüren bir 'ToManaged' metodu sağlamıyor</target>
<note />
</trans-unit>
<trans-unit id="PreferExplicitInOutAttributesOnArrays">
<source>It is recommended to use explicit '[In]' and '[Out]' attributes on array parameters.</source>
<target state="new">It is recommended to use explicit '[In]' and '[Out]' attributes on array parameters.</target>
<note />
</trans-unit>
<trans-unit id="RequiresAllowUnsafeBlocksDescriptionCom">
<source>'GeneratedComInterfaceAttribute' and 'GeneratedComClassAttribute' require unsafe code. Project must be updated with '&lt;AllowUnsafeBlocks&gt;true&lt;/AllowUnsafeBlocks&gt;'.</source>
<target state="translated">'GeneratedComInterfaceAttribute' ve 'GeneratedComClassAttribute' güvenli olmayan kod gerektiriyor. Projenin '&lt;AllowUnsafeBlocks&gt;true&lt;/AllowUnsafeBlocks&gt;' ile güncelleştirilmiş olması gerekiyor.</target>
......
......@@ -147,6 +147,16 @@
<target state="translated">具有“EnableComHosting”的 .NET COM 托管不支持具有“GeneratedComInterfaceAttribute”的接口</target>
<note />
</trans-unit>
<trans-unit id="ComInterfaceUsageDoesNotFollowBestPracticesMessageWithDetails">
<source>The usage of 'GeneratedComInterfaceAttribute' does not follow recommendations. {0}</source>
<target state="new">The usage of 'GeneratedComInterfaceAttribute' does not follow recommendations. {0}</target>
<note />
</trans-unit>
<trans-unit id="ComInterfaceUsageDoesNotFollowBestPracticesTitle">
<source>The usage of 'GeneratedComInterfaceAttribute' does not follow recommendations.</source>
<target state="new">The usage of 'GeneratedComInterfaceAttribute' does not follow recommendations.</target>
<note />
</trans-unit>
<trans-unit id="ComMethodReturningIntWillBeOutParameterMessage">
<source>The return value in the managed definition will be converted to an 'out' parameter when calling the unmanaged COM method. If the return value is intended to be the HRESULT code returned by the unmanaged COM method, use '[PreserveSig]' on the method.</source>
<target state="translated">调用非托管 COM 方法时,托管定义中的返回值将转换为 "out" 参数。如果返回值是非托管 COM 方法返回的 HRESULT 代码,请对方法使用 "[PreserveSig]"。</target>
......@@ -447,6 +457,11 @@
<target state="translated">此类型将被视为本机签名中的结构,而不是本机 HRESULT</target>
<note />
</trans-unit>
<trans-unit id="InAttributeNotSupportedOnByValueParameters">
<source>The '[In]' attribute is only supported on array parameters. By-value parameters are considered read-only by default.</source>
<target state="new">The '[In]' attribute is only supported on array parameters. By-value parameters are considered read-only by default.</target>
<note />
</trans-unit>
<trans-unit id="InAttributeNotSupportedWithoutOutBlittableArray">
<source>The '[In]' attribute is not supported unless the '[Out]' attribute is also used. Blittable arrays cannot be marshalled as '[In]' only.</source>
<target state="translated">不支持“[In]”属性,除非也使用“[Out]”属性。不能仅将 Blittable 数组封送为“[In]”。</target>
......@@ -467,6 +482,11 @@
<target state="translated">此参数上提供的 “[In]” 和 “[Out]” 属性在此参数上不受支持。</target>
<note />
</trans-unit>
<trans-unit id="InOutAttributeNotSupportedOnByValueParameters">
<source>The '[In]' and '[Out]' attributes are only supported on array parameters. Consider using the 'ref' keyword to make the parameter mutable.</source>
<target state="new">The '[In]' and '[Out]' attributes are only supported on array parameters. Consider using the 'ref' keyword to make the parameter mutable.</target>
<note />
</trans-unit>
<trans-unit id="InOutAttributes">
<source>[In] and [Out] attributes</source>
<target state="translated">[In] 和 [Out] 属性</target>
......@@ -702,6 +722,16 @@
<target state="translated">“VirtualMethodIndexAttribute” 使用情况无效</target>
<note />
</trans-unit>
<trans-unit id="LibraryImportUsageDoesNotFollowBestPracticesMessageWithDetails">
<source>The usage of 'LibraryImportAttribute' does not follow recommendations. {0}</source>
<target state="new">The usage of 'LibraryImportAttribute' does not follow recommendations. {0}</target>
<note />
</trans-unit>
<trans-unit id="LibraryImportUsageDoesNotFollowBestPracticesTitle">
<source>The usage of 'LibraryImportAttribute' does not follow recommendations.</source>
<target state="new">The usage of 'LibraryImportAttribute' does not follow recommendations.</target>
<note />
</trans-unit>
<trans-unit id="LinearCollectionElementTypesMustMatchDescription">
<source>The element type of the 'ReadOnlySpan' returned by 'GetManagedValuesSource' must be the same as the element type returned by 'GetManagedValuesDestination'.</source>
<target state="translated">“GetManagedValuesSource” 返回的 “ReadOnlySpan” 的元素类型必须与 “GetManagedValuesDestination” 返回的元素类型相同。</target>
......@@ -903,8 +933,8 @@
<note />
</trans-unit>
<trans-unit id="OutAttributeNotSupportedOnByValueParameters">
<source>The `[Out]` attribute is only supported on array parameters. Consider using 'out' or 'ref' keywords to make the parameter mutable.</source>
<target state="translated">`[Out]` 属性仅在数组参数上受支持。请考虑使用“out”或“ref”关键字使参数可变。</target>
<source>The '[Out]' attribute is only supported on array parameters. Consider using 'out' or 'ref' keywords to make the parameter mutable.</source>
<target state="new">The '[Out]' attribute is only supported on array parameters. Consider using 'out' or 'ref' keywords to make the parameter mutable.</target>
<note />
</trans-unit>
<trans-unit id="OutRequiresToManagedDescription">
......@@ -917,6 +947,11 @@
<target state="translated">类型“{0}”指定它支持按 “Out” 方向进行封送,但不提供返回托管类型的 “ToManaged” 方法</target>
<note />
</trans-unit>
<trans-unit id="PreferExplicitInOutAttributesOnArrays">
<source>It is recommended to use explicit '[In]' and '[Out]' attributes on array parameters.</source>
<target state="new">It is recommended to use explicit '[In]' and '[Out]' attributes on array parameters.</target>
<note />
</trans-unit>
<trans-unit id="RequiresAllowUnsafeBlocksDescriptionCom">
<source>'GeneratedComInterfaceAttribute' and 'GeneratedComClassAttribute' require unsafe code. Project must be updated with '&lt;AllowUnsafeBlocks&gt;true&lt;/AllowUnsafeBlocks&gt;'.</source>
<target state="translated">“GeneratedComInterfaceAttribute”和“GeneratedComClassAttribute”需要不安全代码。必须将项目更新为“&lt;AllowUnsafeBlocks&gt;true&lt;/AllowUnsafeBlocks&gt;”。</target>
......@@ -1276,4 +1311,4 @@
</trans-unit>
</body>
</file>
</xliff>
\ No newline at end of file
</xliff>
......@@ -147,6 +147,16 @@
<target state="translated">以 'EnableComHosting' 裝載的 .NET COM 不支援具有 'GeneratedComInterfaceAttribute' 的介面</target>
<note />
</trans-unit>
<trans-unit id="ComInterfaceUsageDoesNotFollowBestPracticesMessageWithDetails">
<source>The usage of 'GeneratedComInterfaceAttribute' does not follow recommendations. {0}</source>
<target state="new">The usage of 'GeneratedComInterfaceAttribute' does not follow recommendations. {0}</target>
<note />
</trans-unit>
<trans-unit id="ComInterfaceUsageDoesNotFollowBestPracticesTitle">
<source>The usage of 'GeneratedComInterfaceAttribute' does not follow recommendations.</source>
<target state="new">The usage of 'GeneratedComInterfaceAttribute' does not follow recommendations.</target>
<note />
</trans-unit>
<trans-unit id="ComMethodReturningIntWillBeOutParameterMessage">
<source>The return value in the managed definition will be converted to an 'out' parameter when calling the unmanaged COM method. If the return value is intended to be the HRESULT code returned by the unmanaged COM method, use '[PreserveSig]' on the method.</source>
<target state="translated">呼叫未受控 COM 方法時,受控定義中的傳回值將轉換為 'out' 參數。如果傳回值預期是未受控 COM 方法傳回的 HRESULT 代碼,請在方法上使用 '[PreserveSig]'。</target>
......@@ -447,6 +457,11 @@
<target state="translated">此類型會被視為原生簽章中的結構,而非原生 HRESULT</target>
<note />
</trans-unit>
<trans-unit id="InAttributeNotSupportedOnByValueParameters">
<source>The '[In]' attribute is only supported on array parameters. By-value parameters are considered read-only by default.</source>
<target state="new">The '[In]' attribute is only supported on array parameters. By-value parameters are considered read-only by default.</target>
<note />
</trans-unit>
<trans-unit id="InAttributeNotSupportedWithoutOutBlittableArray">
<source>The '[In]' attribute is not supported unless the '[Out]' attribute is also used. Blittable arrays cannot be marshalled as '[In]' only.</source>
<target state="translated">除非也使用 '[Out]' 屬性,否則不支援 '[In]' 屬性。無法只將 Blittable 陣列整理為 '[In]'。</target>
......@@ -467,6 +482,11 @@
<target state="translated">此參數不支援在此參數上提供的 '[In]' 和 '[Out]' 屬性。</target>
<note />
</trans-unit>
<trans-unit id="InOutAttributeNotSupportedOnByValueParameters">
<source>The '[In]' and '[Out]' attributes are only supported on array parameters. Consider using the 'ref' keyword to make the parameter mutable.</source>
<target state="new">The '[In]' and '[Out]' attributes are only supported on array parameters. Consider using the 'ref' keyword to make the parameter mutable.</target>
<note />
</trans-unit>
<trans-unit id="InOutAttributes">
<source>[In] and [Out] attributes</source>
<target state="translated">[In] 與 [Out] 屬性</target>
......@@ -702,6 +722,16 @@
<target state="translated">'VirtualMethodIndexAttribute' 使用方式無效</target>
<note />
</trans-unit>
<trans-unit id="LibraryImportUsageDoesNotFollowBestPracticesMessageWithDetails">
<source>The usage of 'LibraryImportAttribute' does not follow recommendations. {0}</source>
<target state="new">The usage of 'LibraryImportAttribute' does not follow recommendations. {0}</target>
<note />
</trans-unit>
<trans-unit id="LibraryImportUsageDoesNotFollowBestPracticesTitle">
<source>The usage of 'LibraryImportAttribute' does not follow recommendations.</source>
<target state="new">The usage of 'LibraryImportAttribute' does not follow recommendations.</target>
<note />
</trans-unit>
<trans-unit id="LinearCollectionElementTypesMustMatchDescription">
<source>The element type of the 'ReadOnlySpan' returned by 'GetManagedValuesSource' must be the same as the element type returned by 'GetManagedValuesDestination'.</source>
<target state="translated">'GetManagedValuesSource' 傳回的 'ReadOnlySpan' 元素類型必須與 'GetManagedValuesDestination' 傳回的元素類型相同。</target>
......@@ -903,8 +933,8 @@
<note />
</trans-unit>
<trans-unit id="OutAttributeNotSupportedOnByValueParameters">
<source>The `[Out]` attribute is only supported on array parameters. Consider using 'out' or 'ref' keywords to make the parameter mutable.</source>
<target state="translated">只有陣列參數才支援 '[Out]' 屬性。請考慮使用 'out' 或 'ref' 關鍵字將參數設為可變。</target>
<source>The '[Out]' attribute is only supported on array parameters. Consider using 'out' or 'ref' keywords to make the parameter mutable.</source>
<target state="needs-review-translation">只有陣列參數才支援 '[Out]' 屬性。請考慮使用 'out' 或 'ref' 關鍵字將參數設為可變。</target>
<note />
</trans-unit>
<trans-unit id="OutRequiresToManagedDescription">
......@@ -917,6 +947,11 @@
<target state="translated">類型 '{0}' 指定它支援以 'Out' 方向排列,但未提供傳回受管理類型的 'ToManaged' 方法</target>
<note />
</trans-unit>
<trans-unit id="PreferExplicitInOutAttributesOnArrays">
<source>It is recommended to use explicit '[In]' and '[Out]' attributes on array parameters.</source>
<target state="new">It is recommended to use explicit '[In]' and '[Out]' attributes on array parameters.</target>
<note />
</trans-unit>
<trans-unit id="RequiresAllowUnsafeBlocksDescriptionCom">
<source>'GeneratedComInterfaceAttribute' and 'GeneratedComClassAttribute' require unsafe code. Project must be updated with '&lt;AllowUnsafeBlocks&gt;true&lt;/AllowUnsafeBlocks&gt;'.</source>
<target state="translated">'GeneratedComInterfaceAttribute' 和 'GeneratedComClassAttribute' 需要不安全的程式碼。專案必須以 '&lt;AllowUnsafeBlocks&gt;true&lt;/AllowUnsafeBlocks&gt;' 更新。</target>
......
......@@ -24,6 +24,7 @@ internal sealed class DiagnosticDescriptorProvider : IDiagnosticDescriptorProvid
GeneratorDiagnostic.NotSupported { NotSupportedDetails: not null, TypePositionInfo.IsManagedReturnPosition: false } => GeneratorDiagnostics.ParameterTypeNotSupportedWithDetails,
GeneratorDiagnostic.UnnecessaryData { TypePositionInfo.IsManagedReturnPosition: false } => GeneratorDiagnostics.UnnecessaryParameterMarshallingInfo,
GeneratorDiagnostic.UnnecessaryData { TypePositionInfo.IsManagedReturnPosition: true } => GeneratorDiagnostics.UnnecessaryReturnMarshallingInfo,
GeneratorDiagnostic.NotRecommended => GeneratorDiagnostics.LibraryImportUsageDoesNotFollowBestPractices,
{ IsFatal: false } => null,
{ TypePositionInfo.IsManagedReturnPosition: true } => GeneratorDiagnostics.ReturnTypeNotSupported,
{ TypePositionInfo.IsManagedReturnPosition: false } => GeneratorDiagnostics.ParameterTypeNotSupported,
......
......@@ -254,6 +254,16 @@ public class Ids
DiagnosticSeverity.Warning,
isEnabledByDefault: true);
/// <inheritdoc cref="SR.LibraryImportUsageDoesNotFollowBestPracticesMessageWithDetails"/>
public static readonly DiagnosticDescriptor LibraryImportUsageDoesNotFollowBestPractices =
new DiagnosticDescriptor(
Ids.NotRecommendedGeneratedComInterfaceUsage,
GetResourceString(nameof(SR.LibraryImportUsageDoesNotFollowBestPracticesTitle)),
GetResourceString(nameof(SR.LibraryImportUsageDoesNotFollowBestPracticesMessageWithDetails)),
Category,
DiagnosticSeverity.Info,
isEnabledByDefault: true);
/// <summary>
/// Report diagnostic for invalid configuration for string marshalling.
/// </summary>
......
......@@ -47,7 +47,7 @@ public static IncrementalValuesProvider<TNode> SelectNormalized<TNode>(this Incr
return provider.Select((node, ct) => node.NormalizeWhitespace());
}
public static (IncrementalValuesProvider<T>, IncrementalValuesProvider<T2>) Split<T, T2>(this IncrementalValuesProvider<(T, T2)> provider)
public static (IncrementalValuesProvider<T>, IncrementalValuesProvider<T2>) Split<T, T2>(this IncrementalValuesProvider<(T, T2)> provider)
{
return (provider.Select(static (data, ct) => data.Item1), provider.Select(static (data, ct) => data.Item2));
}
......
......@@ -431,17 +431,10 @@ private ResolvedGenerator CreateCustomNativeTypeMarshaller(TypePositionInfo info
{
byValueMarshalKindSupport = ByValueMarshalKindSupportDescriptor.Default;
}
else if (!elementIsBlittable || ElementTypeIsSometimesNonBlittable(elementInfo))
{
// If the type is not blittable or is sometimes not blittable, we will generate different code when the attributes are provided.
byValueMarshalKindSupport = ByValueMarshalKindSupportDescriptor.ArrayParameter;
}
else
{
// If the type is always blittable, we'll generate the same code regardless of the attributes,
// but we'll allow them to make it easier to transition to source-generated code and allow users to be clear about expectations
// for values in pre-allocated buffers.
byValueMarshalKindSupport = ByValueMarshalKindSupportDescriptor.PinnedParameter;
// If we have an array, we will use the Array [In, Out] support descriptor
byValueMarshalKindSupport = ByValueMarshalKindSupportDescriptor.ArrayParameter;
}
// Elements in the collection must be blittable to use the pinnable marshaller.
......
......@@ -27,7 +27,7 @@ public ResolvedGenerator Create(TypePositionInfo info, StubCodeContext context)
private static ResolvedGenerator ValidateByValueMarshalKind(TypePositionInfo info, StubCodeContext context, ResolvedGenerator generator)
{
if (generator.Generator is Forwarder || info.ByValueContentsMarshalKind == ByValueContentsMarshalKind.Default)
if (generator.Generator is Forwarder)
{
// Forwarder allows everything since it just forwards to a P/Invoke.
// The Default marshal kind is always valid.
......@@ -41,6 +41,7 @@ private static ResolvedGenerator ValidateByValueMarshalKind(TypePositionInfo inf
ByValueMarshalKindSupport.Supported => generator,
ByValueMarshalKindSupport.NotSupported => ResolvedGenerator.ResolvedWithDiagnostics(s_forwarder, generator.Diagnostics.Add(diagnostic!)),
ByValueMarshalKindSupport.Unnecessary => generator with { Diagnostics = generator.Diagnostics.Add(diagnostic!) },
ByValueMarshalKindSupport.NotRecommended => generator with { Diagnostics = generator.Diagnostics.Add(diagnostic!) },
_ => throw new UnreachableException()
};
}
......
......@@ -3,127 +3,105 @@
using System;
using System.Collections.Immutable;
using System.Diagnostics;
namespace Microsoft.Interop
{
public record struct ByValueMarshalKindSupportInfo(ByValueMarshalKindSupport Support, string? details)
{
public ByValueMarshalKindSupport GetSupport(TypePositionInfo info, StubCodeContext context, out GeneratorDiagnostic? diagnostic)
{
diagnostic = Support switch
{
ByValueMarshalKindSupport.Supported => null,
ByValueMarshalKindSupport.NotRecommended =>
new GeneratorDiagnostic.NotRecommended(info, context)
{
Details = details
},
ByValueMarshalKindSupport.Unnecessary =>
new GeneratorDiagnostic.UnnecessaryData(
info,
context,
ImmutableArray.Create(info.ByValueMarshalAttributeLocations.OutLocation))
{
UnnecessaryDataName = SR.InOutAttributes,
UnnecessaryDataDetails = details
},
ByValueMarshalKindSupport.NotSupported =>
new GeneratorDiagnostic.NotSupported(info, context)
{
NotSupportedDetails = details
},
_ => throw new UnreachableException()
};
return Support;
}
}
/// <summary>
/// Provides an implementation of <see cref="IMarshallingGenerator.SupportsByValueMarshalKind(ByValueContentsMarshalKind, TypePositionInfo, StubCodeContext, out GeneratorDiagnostic?)"/> through <see cref="GetSupport(ByValueContentsMarshalKind, TypePositionInfo, StubCodeContext, out GeneratorDiagnostic?)"/>
/// </summary>
public record ByValueMarshalKindSupportDescriptor(
ByValueMarshalKindSupport InSupport, string? InSupportDetails,
ByValueMarshalKindSupport OutSupport, string? OutSupportDetails,
ByValueMarshalKindSupport InOutSupport, string? InOutSupportDetails)
ByValueMarshalKindSupportInfo DefaultSupport,
ByValueMarshalKindSupportInfo InSupport,
ByValueMarshalKindSupportInfo OutSupport,
ByValueMarshalKindSupportInfo InOutSupport)
{
/// <summary>
/// A default <see cref="ByValueMarshalKindSupportDescriptor"/> for by value parameters. [In] is allowed, but unnecessary. Out is not allowed.
/// </summary>
public static readonly ByValueMarshalKindSupportDescriptor Default = new ByValueMarshalKindSupportDescriptor(
InSupport: ByValueMarshalKindSupport.Unnecessary, InSupportDetails: SR.InAttributeOnlyIsDefault,
OutSupport: ByValueMarshalKindSupport.NotSupported, OutSupportDetails: SR.OutAttributeNotSupportedOnByValueParameters,
InOutSupport: ByValueMarshalKindSupport.NotSupported, InOutSupportDetails: SR.OutAttributeNotSupportedOnByValueParameters);
DefaultSupport: new(ByValueMarshalKindSupport.Supported, null),
InSupport: new(ByValueMarshalKindSupport.NotSupported, SR.InAttributeNotSupportedOnByValueParameters),
OutSupport: new(ByValueMarshalKindSupport.NotSupported, SR.OutAttributeNotSupportedOnByValueParameters),
InOutSupport: new(ByValueMarshalKindSupport.NotSupported, SR.InOutAttributeNotSupportedOnByValueParameters));
/// <summary>
/// A default <see cref="ByValueMarshalKindSupportDescriptor"/> for by value array parameters. [In] is allowed, but unnecessary. Out is allowed.
/// A default <see cref="ByValueMarshalKindSupportDescriptor"/> for by value array parameters. Default is allowed, but Not Recommended. [In], [Out], and [In, Out] are allowed
/// </summary>
public static readonly ByValueMarshalKindSupportDescriptor ArrayParameter = new ByValueMarshalKindSupportDescriptor(
InSupport: ByValueMarshalKindSupport.Unnecessary, InSupportDetails: SR.InAttributeOnlyIsDefault,
OutSupport: ByValueMarshalKindSupport.Supported, OutSupportDetails: null,
InOutSupport: ByValueMarshalKindSupport.Supported, InOutSupportDetails: null);
/// <summary>
/// A default <see cref="ByValueMarshalKindSupportDescriptor"/> for pinned parameters. [In] is allowed, but unnecessary. Out is allowed.
/// </summary>
public static readonly ByValueMarshalKindSupportDescriptor PinnedParameter = new ByValueMarshalKindSupportDescriptor(
InSupport: ByValueMarshalKindSupport.Unnecessary, InSupportDetails: SR.InAttributeOnlyIsDefault,
OutSupport: ByValueMarshalKindSupport.Supported, OutSupportDetails: null,
InOutSupport: ByValueMarshalKindSupport.Supported, InOutSupportDetails: null);
DefaultSupport: new(ByValueMarshalKindSupport.NotRecommended, SR.PreferExplicitInOutAttributesOnArrays),
InSupport: new(ByValueMarshalKindSupport.Supported, null),
OutSupport: new(ByValueMarshalKindSupport.Supported, null),
InOutSupport: new(ByValueMarshalKindSupport.Supported, null));
/// <summary>
/// Returns the support for the ByValueContentsMarshalKind, and if it is not <see cref="ByValueMarshalKindSupport.Supported"/>, diagnostic is not null
/// </summary>
public ByValueMarshalKindSupport GetSupport(ByValueContentsMarshalKind marshalKind, TypePositionInfo info, StubCodeContext context, out GeneratorDiagnostic? diagnostic)
{
if (info.IsByRef && marshalKind != ByValueContentsMarshalKind.Default)
if (info.IsByRef)
{
diagnostic = new GeneratorDiagnostic.NotSupported(info, context)
// ByRef with ByValue attributes is not allowed
if (marshalKind != ByValueContentsMarshalKind.Default)
{
NotSupportedDetails = SR.InOutAttributeByRefNotSupported
};
return ByValueMarshalKindSupport.NotSupported;
}
switch (marshalKind)
{
case ByValueContentsMarshalKind.Default:
diagnostic = null;
return ByValueMarshalKindSupport.Supported;
case ByValueContentsMarshalKind.Out:
diagnostic = OutSupport switch
diagnostic = new GeneratorDiagnostic.NotSupported(info, context)
{
ByValueMarshalKindSupport.Supported => null,
ByValueMarshalKindSupport.Unnecessary
=> new GeneratorDiagnostic.UnnecessaryData(
info,
context,
ImmutableArray.Create(info.ByValueMarshalAttributeLocations.OutLocation))
{
UnnecessaryDataName = SR.InOutAttributes,
UnnecessaryDataDetails = OutSupportDetails
},
ByValueMarshalKindSupport.NotSupported
=> new GeneratorDiagnostic.NotSupported(
info,
context)
{ NotSupportedDetails = OutSupportDetails },
_ => throw new UnreachableException($"Unexpected {nameof(ByValueMarshalKindSupport)} Variant: {InOutSupport}")
NotSupportedDetails = SR.InOutAttributeByRefNotSupported
};
return OutSupport;
case ByValueContentsMarshalKind.In:
diagnostic = InSupport switch
{
ByValueMarshalKindSupport.Supported => null,
ByValueMarshalKindSupport.Unnecessary
=> new GeneratorDiagnostic.UnnecessaryData(
info,
context,
ImmutableArray.Create(info.ByValueMarshalAttributeLocations.InLocation))
{
UnnecessaryDataName = SR.InOutAttributes,
UnnecessaryDataDetails = InSupportDetails
},
ByValueMarshalKindSupport.NotSupported
=> new GeneratorDiagnostic.NotSupported(
info,
context)
{ NotSupportedDetails = InSupportDetails },
_ => throw new UnreachableException($"Unexpected {nameof(ByValueMarshalKindSupport)} Variant: {InOutSupport}")
};
return InSupport;
case ByValueContentsMarshalKind.InOut:
diagnostic = InOutSupport switch
{
ByValueMarshalKindSupport.Supported => null,
ByValueMarshalKindSupport.Unnecessary
=> new GeneratorDiagnostic.UnnecessaryData(
info,
context,
ImmutableArray.Create(
info.ByValueMarshalAttributeLocations.InLocation,
info.ByValueMarshalAttributeLocations.OutLocation))
{
UnnecessaryDataName = SR.InOutAttributes,
UnnecessaryDataDetails = InOutSupportDetails
},
ByValueMarshalKindSupport.NotSupported
=> new GeneratorDiagnostic.NotSupported(
info,
context)
{ NotSupportedDetails = InOutSupportDetails },
_ => throw new UnreachableException($"Unexpected {nameof(ByValueMarshalKindSupport)} Variant: {InOutSupport}")
};
return InOutSupport;
default:
throw new UnreachableException($"Unexpected {nameof(ByValueContentsMarshalKind)} variant: {marshalKind}");
return ByValueMarshalKindSupport.NotSupported;
}
// ByRef with no ByValue attributes is supported
diagnostic = null;
return ByValueMarshalKindSupport.Supported;
}
// Return can never have In or Out attributes, so can assume valid ByValue attributes
if (info.ManagedIndex < 0)
{
Debug.Assert(marshalKind is ByValueContentsMarshalKind.Default);
diagnostic = null;
return ByValueMarshalKindSupport.Supported;
}
return marshalKind switch
{
ByValueContentsMarshalKind.Default => DefaultSupport.GetSupport(info, context, out diagnostic),
ByValueContentsMarshalKind.In => InSupport.GetSupport(info, context, out diagnostic),
ByValueContentsMarshalKind.Out => OutSupport.GetSupport(info, context, out diagnostic),
ByValueContentsMarshalKind.InOut => InOutSupport.GetSupport(info, context, out diagnostic),
_ => throw new UnreachableException()
};
}
}
}
......@@ -62,5 +62,18 @@ public override DiagnosticInfo ToDiagnosticInfo(DiagnosticDescriptor descriptor,
UnnecessaryDataDetails ?? "");
}
}
public sealed record NotRecommended(TypePositionInfo TypePositionInfo, StubCodeContext StubCodeContext) : GeneratorDiagnostic(TypePositionInfo, StubCodeContext, isFatal: false)
{
public string? Details { get; init; }
public override DiagnosticInfo ToDiagnosticInfo(DiagnosticDescriptor descriptor, Location location, string elementName)
{
return DiagnosticInfo.Create(
descriptor,
location,
Details);
}
}
}
}
......@@ -83,6 +83,10 @@ public enum ByValueMarshalKindSupport
/// The provided <see cref="ByValueContentsMarshalKind" /> is supported but does not change behavior from the default in this scenario.
/// </summary>
Unnecessary,
/// <summary>
/// The provided <see cref="ByValueContentsMarshalKind" /> is supported but does not follow best practices.
/// </summary>
NotRecommended,
}
/// <summary>
......
......@@ -105,7 +105,7 @@ private IEnumerable<StatementSyntax> GeneratePinningPath(TypePositionInfo info,
public ByValueMarshalKindSupport SupportsByValueMarshalKind(ByValueContentsMarshalKind marshalKind, TypePositionInfo info, StubCodeContext context, out GeneratorDiagnostic? diagnostic)
{
return ByValueMarshalKindSupportDescriptor.PinnedParameter.GetSupport(marshalKind, info, context, out diagnostic);
return _innerMarshallingGenerator.SupportsByValueMarshalKind(marshalKind, info, context, out diagnostic);
}
}
}
......@@ -3,6 +3,7 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
......@@ -12,12 +13,26 @@ namespace ComInterfaceGenerator.Unit.Tests
{
internal partial class CodeSnippets
{
internal static IComInterfaceAttributeProvider GetAttributeProvider(GeneratorKind generator)
=> generator switch
{
GeneratorKind.VTableIndexStubGenerator => new VirtualMethodIndexAttributeProvider(),
GeneratorKind.ComInterfaceGeneratorManagedObjectWrapper => new GeneratedComInterfaceAttributeProvider(System.Runtime.InteropServices.Marshalling.ComInterfaceOptions.ManagedObjectWrapper),
GeneratorKind.ComInterfaceGeneratorComObjectWrapper => new GeneratedComInterfaceAttributeProvider(System.Runtime.InteropServices.Marshalling.ComInterfaceOptions.ComObjectWrapper),
GeneratorKind.ComInterfaceGenerator => new GeneratedComInterfaceAttributeProvider(),
_ => throw new UnreachableException(),
};
private readonly IComInterfaceAttributeProvider _attributeProvider;
public CodeSnippets(IComInterfaceAttributeProvider attributeProvider)
{
_attributeProvider = attributeProvider;
}
public CodeSnippets(GeneratorKind generator) : this(GetAttributeProvider(generator))
{
}
private string VirtualMethodIndex(
int index,
bool? ImplicitThisParameter = null,
......@@ -49,6 +64,51 @@ private string UnmanagedCallConv(Type[]? CallConvs = null)
+ arguments + "]";
}
public static string GetCustomCollectionType(string elementName) => $"StatelessCollectionAllShapes<{elementName}>";
public const string CustomCollectionAndMarshaller = CustomCollectionDefinition + CustomCollectionAllShapesMarshaller;
public const string CustomCollectionDefinition = """
internal class StatelessCollectionAllShapes<T>
{
public T _field;
}
""";
public const string CustomCollectionAllShapesMarshaller = """
[ContiguousCollectionMarshaller]
[CustomMarshaller(typeof(StatelessCollectionAllShapes<>), MarshalMode.Default, typeof(StatelessCollectionAllShapesMarshaller<,>))]
internal unsafe static class StatelessCollectionAllShapesMarshaller<TManagedElement, TUnmanagedElement> where TUnmanagedElement : unmanaged
{
public static void Free(TUnmanagedElement* unmanaged) { }
// ToUnmanaged
public static TUnmanagedElement* AllocateContainerForUnmanagedElements(StatelessCollectionAllShapes<TManagedElement> managed, out int numElements)
=> throw null;
public static System.ReadOnlySpan<TManagedElement> GetManagedValuesSource(StatelessCollectionAllShapes<TManagedElement> managed) // Can throw exceptions
=> throw null;
public static System.Span<TUnmanagedElement> GetUnmanagedValuesDestination(TUnmanagedElement* unmanaged, int numElements) // Can throw exceptions
=> throw null;
public static ref TUnmanagedElement* GetPinnableReference(StatelessCollectionAllShapes<TManagedElement> managed)
=> throw null;
// Caller Allocated buffer ToUnmanaged
public static int BufferSize { get; } = 10;
public static TUnmanagedElement* AllocateContainerForUnmanagedElements(StatelessCollectionAllShapes<TManagedElement> managed, System.Span<byte> buffer, out int numElements)
=> throw null;
// ToManaged
public static StatelessCollectionAllShapes<TManagedElement> AllocateContainerForManagedElements(TUnmanagedElement* unmanaged, int numElements)
=> throw null;
public static System.Span<TManagedElement> GetManagedValuesDestination(StatelessCollectionAllShapes<TManagedElement> managed)
=> throw null;
public static System.ReadOnlySpan<TUnmanagedElement> GetUnmanagedValuesSource(TUnmanagedElement* unmanaged, int numElements)
=> throw null;
//ToManaged Guaranteed marshalling
public static StatelessCollectionAllShapes<TManagedElement> AllocateContainerForManagedElementsFinally(TUnmanagedElement* unmanaged, int numElements)
=> throw null;
}
""";
public static readonly string DisableRuntimeMarshalling = "[assembly:System.Runtime.CompilerServices.DisableRuntimeMarshalling]";
public static readonly string UsingSystemRuntimeInteropServicesMarshalling = "using System.Runtime.InteropServices.Marshalling;";
public const string IntMarshaller = """
......
......@@ -33,6 +33,7 @@
<ItemGroup>
<ProjectReference Include="..\Ancillary.Interop\Ancillary.Interop.csproj" />
<ProjectReference Include="..\..\gen\ComInterfaceGenerator\ComInterfaceGenerator.csproj" />
<EnabledGenerators Include="ComInterfaceGenerator" />
</ItemGroup>
<ItemGroup>
......
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.Diagnostics;
using Microsoft.CodeAnalysis.Testing;
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
......@@ -15,6 +11,10 @@
using System.Runtime.InteropServices;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.Diagnostics;
using Microsoft.CodeAnalysis.Testing;
using Xunit;
namespace Microsoft.Interop.UnitTests
......@@ -51,6 +51,10 @@ public enum TestTargetFramework
public static class TestUtils
{
public static string ID(
[CallerLineNumber] int lineNumber = 0,
[CallerFilePath] string? filePath = null)
=> TestUtils.GetFileLineName(lineNumber, filePath);
internal static string GetFileLineName(
[CallerLineNumber] int lineNumber = 0,
[CallerFilePath] string? filePath = null)
......@@ -298,7 +302,7 @@ public void Stop()
int count = Interlocked.Decrement(ref _count);
if (count == 0)
{
Environment.SetEnvironmentVariable(EnvVarName, null);
Environment.SetEnvironmentVariable(EnvVarName, null);
}
}
}
......
// 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.Collections.Generic;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.Testing;
using Microsoft.Interop;
using Xunit;
using static Microsoft.Interop.UnitTests.TestUtils;
using VerifyCS = Microsoft.Interop.UnitTests.Verifiers.CSharpSourceGeneratorVerifier<Microsoft.Interop.LibraryImportGenerator>;
namespace LibraryImportGenerator.UnitTests
{
public class ByValueContentsMarshalling
{
public static IEnumerable<object[]> ByValueMarshalAttributeOnValueTypes()
{
CodeSnippets.ByValueParameterWithModifier("int[]", "In");
const string In = "InAttribute";
const string Out = "OutAttribute";
const string InOut = "InAttribute, OutAttribute";
const string paramName = "p";
const string MarshalUsingUtf16 = "MarshalUsing(typeof(Utf16StringMarshaller))";
var diagnostic = new DiagnosticResult(GeneratorDiagnostics.ParameterTypeNotSupportedWithDetails);
var outAttributeNotSupported = diagnostic
.WithLocation(0)
.WithArguments(SR.OutAttributeNotSupportedOnByValueParameters, paramName);
var inAttributeIsNotSupported = diagnostic
.WithLocation(0)
.WithArguments(SR.InAttributeNotSupportedOnByValueParameters, paramName);
var inOutAttributeNotSupported = diagnostic
.WithLocation(0)
.WithArguments(SR.InOutAttributeNotSupportedOnByValueParameters, paramName);
DiagnosticResult[] InIsNotSupported = [inAttributeIsNotSupported];
yield return new object[] { ID(), CodeSnippets.ByValueParameterWithModifier("int", In), InIsNotSupported };
yield return new object[] { ID(), CodeSnippets.ByValueParameterWithModifier("byte", In), InIsNotSupported };
yield return new object[] { ID(), CodeSnippets.ByValueParameterWithModifier("string", In + " , " + MarshalUsingUtf16), InIsNotSupported };
yield return new object[] { ID(), CodeSnippets.ByValueParameterWithModifier("IntStruct", In, CodeSnippets.IntStructAndMarshaller), InIsNotSupported };
yield return new object[] { ID(), CodeSnippets.ByValueParameterWithModifier("IntClass", In, CodeSnippets.IntClassAndMarshaller), InIsNotSupported };
DiagnosticResult[] OutIsNotSupported = [outAttributeNotSupported];
yield return new object[] { ID(), CodeSnippets.ByValueParameterWithModifier("int", Out), OutIsNotSupported };
yield return new object[] { ID(), CodeSnippets.ByValueParameterWithModifier("byte", Out), OutIsNotSupported };
yield return new object[] { ID(), CodeSnippets.ByValueParameterWithModifier("string", Out + " , " + MarshalUsingUtf16), OutIsNotSupported };
yield return new object[] { ID(), CodeSnippets.ByValueParameterWithModifier("IntStruct", Out, CodeSnippets.IntStructAndMarshaller), OutIsNotSupported };
yield return new object[] { ID(), CodeSnippets.ByValueParameterWithModifier("IntClass", Out, CodeSnippets.IntClassAndMarshaller), OutIsNotSupported };
DiagnosticResult[] InOutIsNotSupported = [inOutAttributeNotSupported];
yield return new object[] { ID(), CodeSnippets.ByValueParameterWithModifier("int", InOut), InOutIsNotSupported };
yield return new object[] { ID(), CodeSnippets.ByValueParameterWithModifier("byte", InOut), InOutIsNotSupported };
yield return new object[] { ID(), CodeSnippets.ByValueParameterWithModifier("string", InOut + " , " + MarshalUsingUtf16), InOutIsNotSupported };
yield return new object[] { ID(), CodeSnippets.ByValueParameterWithModifier("IntStruct", InOut, CodeSnippets.IntStructAndMarshaller), InOutIsNotSupported };
yield return new object[] { ID(), CodeSnippets.ByValueParameterWithModifier("IntClass", InOut, CodeSnippets.IntClassAndMarshaller), InOutIsNotSupported };
var inAndOutNotAllowedWithRefKind = new DiagnosticResult(GeneratorDiagnostics.ParameterTypeNotSupportedWithDetails)
.WithLocation(0)
.WithArguments("The '[In]' and '[Out]' attributes are unsupported on parameters passed by reference. Use the 'in', 'ref', or 'out' keywords instead.", "p");
DiagnosticResult[] InAndOutNotAllowedWithRefKind = [inAndOutNotAllowedWithRefKind];
yield return new object[] { ID(), CodeSnippets.ByValueParameterWithModifier("in int", In), InAndOutNotAllowedWithRefKind };
yield return new object[] { ID(), CodeSnippets.ByValueParameterWithModifier("ref int", In), InAndOutNotAllowedWithRefKind };
yield return new object[] { ID(), CodeSnippets.ByValueParameterWithModifier("ref int", InOut), InAndOutNotAllowedWithRefKind };
yield return new object[] { ID(), CodeSnippets.ByValueParameterWithModifier("out int", Out), InAndOutNotAllowedWithRefKind };
}
public static IEnumerable<object[]> ByValueMarshalAttributeOnArrays()
{
CodeSnippets.ByValueParameterWithModifier("int[]", "In");
const string In = "InAttribute";
const string Out = "OutAttribute";
const string InOut = "InAttribute, OutAttribute";
const string MarshalUsingUtf16 = "MarshalUsing(typeof(Utf16StringMarshaller), ElementIndirectionDepth = 1)";
const string Count = "MarshalUsing(ConstantElementCount = 10)";
DiagnosticResult[] None = [];
yield return new object[] { ID(), CodeSnippets.ByValueParameterWithModifier("int[]", string.Join(',', Count, In)), None };
yield return new object[] { ID(), CodeSnippets.ByValueParameterWithModifier("byte[]", string.Join(',', Count, In)), None };
yield return new object[] { ID(), CodeSnippets.ByValueParameterWithModifier("string[]", string.Join(',', Count, In, MarshalUsingUtf16)), None };
yield return new object[] { ID(), CodeSnippets.ByValueParameterWithModifier("IntStruct[]", string.Join(',', Count, In), CodeSnippets.IntStructAndMarshaller), None };
yield return new object[] { ID(), CodeSnippets.ByValueParameterWithModifier("IntClass[]", string.Join(',', Count, In), CodeSnippets.IntClassAndMarshaller), None };
yield return new object[] { ID(), CodeSnippets.ByValueParameterWithModifier("int[]", string.Join(',', Count, Out)), None };
yield return new object[] { ID(), CodeSnippets.ByValueParameterWithModifier("byte[]", string.Join(',', Count, Out)), None };
yield return new object[] { ID(), CodeSnippets.ByValueParameterWithModifier("string[]", string.Join(',', Count, Out, MarshalUsingUtf16)), None };
yield return new object[] { ID(), CodeSnippets.ByValueParameterWithModifier("IntStruct[]", string.Join(',', Count, Out), CodeSnippets.IntStructAndMarshaller), None };
yield return new object[] { ID(), CodeSnippets.ByValueParameterWithModifier("IntClass[]", string.Join(',', Count, Out), CodeSnippets.IntClassAndMarshaller), None };
yield return new object[] { ID(), CodeSnippets.ByValueParameterWithModifier("int[]", string.Join(',', Count, InOut)), None };
yield return new object[] { ID(), CodeSnippets.ByValueParameterWithModifier("byte[]", string.Join(',', Count, InOut)), None };
yield return new object[] { ID(), CodeSnippets.ByValueParameterWithModifier("string[]", string.Join(',', Count, InOut, MarshalUsingUtf16)), None };
yield return new object[] { ID(), CodeSnippets.ByValueParameterWithModifier("IntStruct[]", string.Join(',', Count, InOut), CodeSnippets.IntStructAndMarshaller), None };
yield return new object[] { ID(), CodeSnippets.ByValueParameterWithModifier("IntClass[]", string.Join(',', Count, InOut), CodeSnippets.IntClassAndMarshaller), None };
DiagnosticResult preferAttributes = new DiagnosticResult(GeneratorDiagnostics.LibraryImportUsageDoesNotFollowBestPractices)
.WithArguments(SR.PreferExplicitInOutAttributesOnArrays)
.WithLocation(0);
DiagnosticResult[] PreferAttributes = [preferAttributes];
yield return new object[] { ID(), CodeSnippets.ByValueParameterWithModifier("int[]", Count), PreferAttributes };
yield return new object[] { ID(), CodeSnippets.ByValueParameterWithModifier("byte[]", Count), PreferAttributes };
yield return new object[] { ID(), CodeSnippets.ByValueParameterWithModifier("string[]", string.Join(',', Count, MarshalUsingUtf16)), PreferAttributes };
yield return new object[] { ID(), CodeSnippets.ByValueParameterWithModifier("IntStruct[]", Count, CodeSnippets.IntStructAndMarshaller), PreferAttributes };
yield return new object[] { ID(), CodeSnippets.ByValueParameterWithModifier("IntClass[]", Count, CodeSnippets.IntClassAndMarshaller), PreferAttributes };
var inAndOutNotAllowedWithRefKind = new DiagnosticResult(GeneratorDiagnostics.ParameterTypeNotSupportedWithDetails)
.WithLocation(0)
.WithArguments("The '[In]' and '[Out]' attributes are unsupported on parameters passed by reference. Use the 'in', 'ref', or 'out' keywords instead.", "p");
DiagnosticResult[] InAndOutNotAllowedWithRefKind = [inAndOutNotAllowedWithRefKind];
yield return new object[] { ID(), CodeSnippets.ByValueParameterWithModifier("in int[]", string.Join(',', Count, In)), InAndOutNotAllowedWithRefKind };
yield return new object[] { ID(), CodeSnippets.ByValueParameterWithModifier("ref int[]", string.Join(',', Count, In)), InAndOutNotAllowedWithRefKind };
yield return new object[] { ID(), CodeSnippets.ByValueParameterWithModifier("ref int[]", string.Join(',', Count, In, Out)), InAndOutNotAllowedWithRefKind };
yield return new object[] { ID(), CodeSnippets.ByValueParameterWithModifier("out int[]", string.Join(',', Count, Out)), InAndOutNotAllowedWithRefKind };
}
[Theory]
[MemberData(nameof(ByValueMarshalAttributeOnValueTypes))]
[MemberData(nameof(ByValueMarshalAttributeOnArrays))]
public async Task VerifyByValueMarshallingAttributeUsageInfoMessages(string id, string source, DiagnosticResult[] diagnostics)
{
_ = id;
VerifyCS.Test test = new(referenceAncillaryInterop: false)
{
TestCode = source,
TestBehaviors = TestBehaviors.SkipGeneratedSourcesCheck,
};
test.DisabledDiagnostics.Remove(GeneratorDiagnostics.Ids.NotRecommendedGeneratedComInterfaceUsage);
test.ExpectedDiagnostics.AddRange(diagnostics);
await test.RunAsync();
}
}
}
......@@ -986,6 +986,22 @@ partial class Test
}
""";
public const string IntClassAndMarshaller = IntClassDefinition + IntClassMarshallerDefinition;
public const string IntClassDefinition = """
internal struct IntClass
{
public int Field;
}
""";
public const string IntClassMarshallerDefinition = """
[CustomMarshaller(typeof(IntClass), MarshalMode.Default, typeof(IntClassMarshaller))]
internal static class IntClassMarshaller
{
public static nint ConvertToUnmanaged(IntClass managed) => (nint)0;
public static IntClass ConvertToManaged(nint unmanaged) => default;
}
""";
public const string IntStructAndMarshaller = IntStructDefinition + IntStructMarshallerDefinition;
public const string IntStructDefinition = """
internal struct IntStruct
......
......@@ -350,56 +350,6 @@ public static IEnumerable<object[]> CodeSnippetsToCompile()
.WithArguments("MarshalAsAttribute", "t")
}};
// Unsupported [In, Out] attributes usage
// By ref with [In, Out] attributes
yield return new object[] { ID(), CodeSnippets.ByValueParameterWithModifier("in int", "In"), new[]
{
VerifyCS.Diagnostic(GeneratorDiagnostics.ParameterTypeNotSupportedWithDetails)
.WithLocation(0)
.WithArguments("The '[In]' and '[Out]' attributes are unsupported on parameters passed by reference. Use the 'in', 'ref', or 'out' keywords instead.", "p")
} };
yield return new object[] { ID(), CodeSnippets.ByValueParameterWithModifier("ref int", "In"), new[]
{
VerifyCS.Diagnostic(GeneratorDiagnostics.ParameterTypeNotSupportedWithDetails)
.WithLocation(0)
.WithArguments("The '[In]' and '[Out]' attributes are unsupported on parameters passed by reference. Use the 'in', 'ref', or 'out' keywords instead.", "p")
} };
yield return new object[] { ID(), CodeSnippets.ByValueParameterWithModifier("ref int", "In, Out"), new[]
{
VerifyCS.Diagnostic(GeneratorDiagnostics.ParameterTypeNotSupportedWithDetails)
.WithLocation(0)
.WithArguments("The '[In]' and '[Out]' attributes are unsupported on parameters passed by reference. Use the 'in', 'ref', or 'out' keywords instead.", "p")
} };
yield return new object[] { ID(), CodeSnippets.ByValueParameterWithModifier("out int", "Out"), new[]
{
VerifyCS.Diagnostic(GeneratorDiagnostics.ParameterTypeNotSupportedWithDetails)
.WithLocation(0)
.WithArguments("The '[In]' and '[Out]' attributes are unsupported on parameters passed by reference. Use the 'in', 'ref', or 'out' keywords instead.", "p")
} };
// By value non-array with [In, Out] attributes
yield return new object[] { ID(), CodeSnippets.ByValueParameterWithModifier<byte>("{|#1:In|}"), new [] {
VerifyCS.Diagnostic(GeneratorDiagnostics.UnnecessaryParameterMarshallingInfo)
.WithLocation(0)
.WithLocation(1)
.WithArguments(SR.InOutAttributes, "p", SR.InAttributeOnlyIsDefault)
.WithSeverity(DiagnosticSeverity.Info)
} };
yield return new object[] { ID(), CodeSnippets.ByValueParameterWithModifier<byte>("Out"), new[]
{
VerifyCS.Diagnostic(GeneratorDiagnostics.ParameterTypeNotSupportedWithDetails)
.WithLocation(0)
.WithArguments(SR.OutAttributeNotSupportedOnByValueParameters, "p")
} };
yield return new object[] { ID(), CodeSnippets.ByValueParameterWithModifier<byte>("In, Out"), new[]
{
VerifyCS.Diagnostic(GeneratorDiagnostics.ParameterTypeNotSupportedWithDetails)
.WithLocation(0)
.WithArguments(SR.OutAttributeNotSupportedOnByValueParameters, "p")
} };
// LCIDConversion
yield return new object[] { ID(), CodeSnippets.LCIDConversionAttribute, new[] {
VerifyCS.Diagnostic(GeneratorDiagnostics.ConfigurationNotSupported)
......@@ -832,13 +782,6 @@ public static IEnumerable<object[]> CodeSnippetsToCompile()
.WithLocation(1)
.WithArguments("ref return", "Basic.RefReadonlyReturn()"),
} };
yield return new object[] { ID(), CodeSnippets.ByValueParameterWithModifier<int[]>("{|#10:In|}"), new[]
{
VerifyCS.Diagnostic(GeneratorDiagnostics.UnnecessaryParameterMarshallingInfo)
.WithLocation(0)
.WithLocation(10)
.WithArguments("[In] and [Out] attributes", "p", SR.InAttributeOnlyIsDefault)
} };
}
[Theory]
......
......@@ -17,7 +17,6 @@
using Microsoft.CodeAnalysis.Text;
using Microsoft.Interop.UnitTests;
using Xunit;
using GeneratorDiagnostics = Microsoft.Interop.GeneratorDiagnostics;
using VerifyCS = Microsoft.Interop.UnitTests.Verifiers.CSharpSourceGeneratorVerifier<Microsoft.Interop.LibraryImportGenerator>;
namespace LibraryImportGenerator.UnitTests
......@@ -744,28 +743,5 @@ protected override async Task<(Compilation compilation, ImmutableArray<Diagnosti
return (newCompilation, diagnostics);
}
}
public static IEnumerable<object[]> ByValueMarshalKindSnippets()
{
// Blittable array
yield return new object[] { ID(), CodeSnippets.ByValueParameterWithModifier<int[]>("{|#10:Out|}"), new DiagnosticResult[] { } };
yield return new object[] { ID(), CodeSnippets.ByValueParameterWithModifier<int[]>("{|#10:In|}, {|#11:Out|}"), new DiagnosticResult[] { } };
yield return new object[] { ID(), CodeSnippets.ByValueParameterWithModifier<int[]>("{|#10:In|}"), new DiagnosticResult[] {
VerifyCS.Diagnostic(GeneratorDiagnostics.UnnecessaryParameterMarshallingInfo)
.WithLocation(0)
.WithLocation(10)
.WithArguments("[In] and [Out] attributes", "p", SR.InAttributeOnlyIsDefault)
} };
}
[MemberData(nameof(ByValueMarshalKindSnippets))]
[Theory]
public async Task ValidateDiagnosticsForUnnecessaryByValueMarshalKindAttributes(string id, string source, DiagnosticResult[] diagnostics)
{
_ = id;
await VerifyCS.VerifySourceGeneratorAsync(source, diagnostics);
}
}
}
......@@ -11,6 +11,8 @@
<ItemGroup>
<ProjectReference Include="..\..\Ancillary.Interop\Ancillary.Interop.csproj" />
<!-- This project just has shared types, but shouldn't generate code for the types -->
<EnabledGenerators Remove="@(EnabledGenerators)" />
</ItemGroup>
</Project>
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册