Movatterモバイル変換


[0]ホーム

URL:


Skip to main content

This browser is no longer supported.

Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.

Download Microsoft EdgeMore info about Internet Explorer and Microsoft Edge
Table of contentsExit focus mode

CA1419: Provide a parameterless constructor that is as visible as the containing type for concrete types derived from 'System.Runtime.InteropServices.SafeHandle'

  • 2023-12-16
Feedback

In this article

PropertyValue
Rule IDCA1419
TitleProvide a parameterless constructor that is as visible as the containing type for concrete types derived from 'System.Runtime.InteropServices.SafeHandle'
CategoryInteroperability
Fix is breaking or non-breakingNon-breaking
Enabled by default in .NET 9As suggestion

Cause

A concreteSafeHandle type requires a parameterless constructor that is at least as visible as the containing type.

Rule description

Providing a public parameterless constructor for a type derived fromSafeHandle enables better performance and usage with source-generated interop solutions.

How to fix violations

Add a parameterless constructor to your type.

When to suppress warnings

Do not suppress a warning from this rule.

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, seeour contributor guide.

Feedback

Was this page helpful?

YesNo

In this article

Was this page helpful?

YesNo