A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/ca1017 below:

CA1017: Mark assemblies with ComVisibleAttribute (code analysis) - .NET

CA1017: Mark assemblies with ComVisibleAttribute

In this article Property Value Rule ID CA1017 Title Mark assemblies with ComVisibleAttribute Category Design Fix is breaking or non-breaking Non-breaking Enabled by default in .NET 9 No Cause

An assembly does not have the System.Runtime.InteropServices.ComVisibleAttribute attribute applied to it.

Rule description

The ComVisibleAttribute attribute determines how COM clients access managed code. Good design dictates that assemblies explicitly indicate COM visibility. COM visibility can be set for a whole assembly and then overridden for individual types and type members. If the attribute is not present, the contents of the assembly are visible to COM clients.

How to fix violations

To fix a violation of this rule, add the attribute to the assembly. If you do not want the assembly to be visible to COM clients, apply the attribute and set its value to false.

When to suppress warnings

Do not suppress a warning from this rule. If you want the assembly to be visible, apply the attribute and set its value to true.

Example

The following example shows an assembly that has the ComVisibleAttribute attribute applied to prevent it from being visible to COM clients.

<Assembly: System.Runtime.InteropServices.ComVisible(False)>
Namespace DesignLibrary
End Namespace
[assembly: System.Runtime.InteropServices.ComVisible(false)]
namespace DesignLibrary {}
See also

Collaborate with us on GitHub

The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, see our contributor guide.

Additional resources

In this article

Was this page helpful?


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4