Indicates whether the callee calls the SetLastError Win32 API function before returning from the attributed method.
Assemblies: mscorlib (in mscorlib.dll)
System.Runtime.InteropServices (in System.Runtime.InteropServices.dll)
true to indicate that the callee will call SetLastError; otherwise, false. The default is false.
The runtime marshaler calls GetLastError and caches the value returned to prevent it from being overwritten by other API calls. You can retrieve the error code by calling GetLastWin32Error.
In some cases, Visual Basic developers use the DllImportAttribute, instead of using the Declare statement, to define a DLL function in managed code. Setting the field is one of those cases.