Hi
On the MSDN I've found the following description for the two attributes:
PreserveSig Set the PreserveSig field to true to directly translate unmanaged signatures with HRESULT or retval values; set it to false to automatically convert HRESULT or retval values to exceptions. By default, the PreserveSig field is true.
SetLastError Enables the caller to use the Marshal.GetLastWin32Error API function to determine whether an error occurred while executing the method. In Visual Basic, the default is true (which adds some overhead); in C# and C++, the default is false.
My question is: How these two relate to each other? Suppose I have PreserveSig set to 'false' - it means that I should have HRESULT converted to exception - if unmanaged function returns integer indicating that error or no error occured, how could this be translated to exception?
Also why do I need to call GetLastWin32Error method if I somehow managed to extract the exception using PreserveSig?
Kind regards PK