संपादित करें

इसके माध्यम से साझा किया गया


Portability and interoperability rules

Portability rules support portability across different platforms. Interoperability rules support interaction with COM clients.

In this section

Rule Description
CA1401: P/Invokes should not be visible A public or protected method in a public type has the System.Runtime.InteropServices.DllImportAttribute attribute (also implemented by the Declare keyword in Visual Basic). Such methods should not be exposed.
CA1416: Validate platform compatibility Using platform-dependent APIs on a component makes the code no longer work across all platforms.
CA1417: Do not use OutAttribute on string parameters for P/Invokes String parameters passed by value with the OutAttribute can destabilize the runtime if the string is an interned string.
CA1418: Use valid platform string Platform compatibility analyzer requires a valid platform name and version.
CA1419: Provide a parameterless constructor that is as visible as the containing type for concrete types derived from 'System.Runtime.InteropServices.SafeHandle' Providing a parameterless constructor that is as visible as the containing type for a type derived from System.Runtime.InteropServices.SafeHandle enables better performance and usage with source-generated interop solutions.
CA1420: Property, type, or attribute requires runtime marshalling Using features that require runtime marshalling when runtime marshalling is disabled will result in run-time exceptions.
CA1421: Method uses runtime marshalling when DisableRuntimeMarshallingAttribute is applied A method uses runtime marshalling, and runtime marshalling is explicitly disabled.
CA1422: Validate platform compatibility Calling an API that's obsolete in a given OS (version) from a call site that's reachable from that OS (version) is not recommended.