diff --git a/docs/project/list-of-diagnostics.md b/docs/project/list-of-diagnostics.md
index 3c9a9afb9c4199..4b46d49f5813f0 100644
--- a/docs/project/list-of-diagnostics.md
+++ b/docs/project/list-of-diagnostics.md
@@ -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 |
diff --git a/src/libraries/System.Runtime.InteropServices/gen/ComInterfaceGenerator/DiagnosticDescriptorProvider.cs b/src/libraries/System.Runtime.InteropServices/gen/ComInterfaceGenerator/DiagnosticDescriptorProvider.cs
index c676f27cb9f401..fab2d39182c8b7 100644
--- a/src/libraries/System.Runtime.InteropServices/gen/ComInterfaceGenerator/DiagnosticDescriptorProvider.cs
+++ b/src/libraries/System.Runtime.InteropServices/gen/ComInterfaceGenerator/DiagnosticDescriptorProvider.cs
@@ -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,
diff --git a/src/libraries/System.Runtime.InteropServices/gen/ComInterfaceGenerator/GeneratorDiagnostics.cs b/src/libraries/System.Runtime.InteropServices/gen/ComInterfaceGenerator/GeneratorDiagnostics.cs
index b213e3a9704f29..1e1849592f7ba4 100644
--- a/src/libraries/System.Runtime.InteropServices/gen/ComInterfaceGenerator/GeneratorDiagnostics.cs
+++ b/src/libraries/System.Runtime.InteropServices/gen/ComInterfaceGenerator/GeneratorDiagnostics.cs
@@ -485,6 +485,17 @@ public class Ids
DiagnosticSeverity.Info,
isEnabledByDefault: true);
+ ///
+ 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");
+
///
/// Report diagnostic for invalid configuration for string marshalling.
///
diff --git a/src/libraries/System.Runtime.InteropServices/gen/Common/Resources/Strings.resx b/src/libraries/System.Runtime.InteropServices/gen/Common/Resources/Strings.resx
index ebf0170e328752..2da298e8a7b0df 100644
--- a/src/libraries/System.Runtime.InteropServices/gen/Common/Resources/Strings.resx
+++ b/src/libraries/System.Runtime.InteropServices/gen/Common/Resources/Strings.resx
@@ -875,7 +875,13 @@
[In] and [Out] attributes
- The `[Out]` attribute is only supported on array parameters. Consider using 'out' or 'ref' keywords to make the parameter mutable.
+ The '[Out]' attribute is only supported on array parameters. Consider using 'out' or 'ref' keywords to make the parameter mutable.
+
+
+ The '[In]' attribute is only supported on array parameters. By-value parameters are considered read-only by default.
+
+
+ The '[In]' and '[Out]' attributes are only supported on array parameters. Consider using the 'ref' keyword to make the parameter mutable.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.
@@ -889,4 +895,19 @@
This type will be treated as a struct in the native signature, not as a native HRESULT
-
\ No newline at end of file
+
+ It is recommended to use explicit '[In]' and '[Out]' attributes on array parameters.
+
+
+ The usage of 'GeneratedComInterfaceAttribute' does not follow recommendations.
+
+
+ The usage of 'GeneratedComInterfaceAttribute' does not follow recommendations. {0}
+
+
+ The usage of 'LibraryImportAttribute' does not follow recommendations.
+
+
+ The usage of 'LibraryImportAttribute' does not follow recommendations. {0}
+
+
diff --git a/src/libraries/System.Runtime.InteropServices/gen/Common/Resources/xlf/Strings.cs.xlf b/src/libraries/System.Runtime.InteropServices/gen/Common/Resources/xlf/Strings.cs.xlf
index e1b25c7690ffa4..829de99735954b 100644
--- a/src/libraries/System.Runtime.InteropServices/gen/Common/Resources/xlf/Strings.cs.xlf
+++ b/src/libraries/System.Runtime.InteropServices/gen/Common/Resources/xlf/Strings.cs.xlf
@@ -147,6 +147,16 @@
Hostování .NET COM s EnableComHosting nepodporuje rozhraní s generatedComInterfaceAttribute
+
+
+ The usage of 'GeneratedComInterfaceAttribute' does not follow recommendations. {0}
+
+
+
+
+ The usage of 'GeneratedComInterfaceAttribute' does not follow recommendations.
+
+ 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].
@@ -447,6 +457,11 @@
Tento typ bude v nativním podpisu považován za strukturu, nikoli za nativní HRESULT.
+
+
+ The '[In]' attribute is only supported on array parameters. By-value parameters are considered read-only by default.
+
+ Atribut [In] není podporován, pokud není použit také atribut [Out]. Blittable arrays nelze zařadit pouze jako [In].
@@ -467,6 +482,11 @@
Poskytnuté atributy „[In]“ a „[Out]“ u tohoto parametru se na tomto parametru nepodporují.
+
+
+ The '[In]' and '[Out]' attributes are only supported on array parameters. Consider using the 'ref' keyword to make the parameter mutable.
+
+ atributy [In] a [Out]
@@ -702,6 +722,16 @@
Neplatné použití atributu VirtualMethodIndexAttribute
+
+
+ The usage of 'LibraryImportAttribute' does not follow recommendations. {0}
+
+
+
+
+ The usage of 'LibraryImportAttribute' does not follow recommendations.
+
+ Typ prvku ReadOnlySpan vrácený GetManagedValuesSource musí být stejný, jako typ prvku vrácený GetManagedValuesDestination.
@@ -903,8 +933,8 @@
-
- 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.
+
+ The '[Out]' attribute is only supported on array parameters. Consider using 'out' or 'ref' keywords to make the parameter mutable.
@@ -917,6 +947,11 @@
Typ {0}určuje, že podporuje zařazování ve směru „Out“, ale neposkytuje metodu ToManaged, která vrací spravovaný typ
+
+
+ It is recommended to use explicit '[In]' and '[Out]' attributes on array parameters.
+
+ GeneratedComInterfaceAttribute a GeneratedComClassAttribute vyžadují nebezpečný kód. Projekt se musí aktualizovat na <AllowUnsafeBlocks>true</AllowUnsafeBlocks>.
@@ -1276,4 +1311,4 @@