A code feature is used that requires runtime marshalling, and runtime marshalling is explicitly disabled.
Rule descriptionUsing features that require runtime marshalling when runtime marshalling is disabled will result in run-time exceptions.
How to fix violationsEnable runtime marshalling or remove the code that requires runtime marshalling.
When to suppress warningsDon't suppress a warning from this rule.
ExampleThe following code snippet shows a violation of CA1420:
using System.Runtime.InteropServices;
using System.Runtime.CompilerServices;
[assembly: DisableRuntimeMarshalling]
class C
{
// Violates rule CA1420.
[DllImport("NativeLibrary", SetLastError = true)]
public static extern void MyMethod ();
}
Imports System.Runtime.InteropServices
Imports System.Runtime.CompilerServices
<Assembly: DisableRuntimeMarshalling>
Class C
' Violates rule CA1420.
<DllImport("NativeLibrary", SetLastError:=True)>
Public Shared Sub MyMethod()
'...
End Sub
End Class
To fix the violation, remove the DisableRuntimeMarshallingAttribute on the assembly.
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