Closed NN--- closed 7 years ago
If this diverges from the behavior of Win32Exception
on .NET Framework, that's not inline with the goal for this class. If Win32Exception
behavior varies between platforms that can ultimately cause unexpected issues for consumers.
So while I don't challenge the value that you're proposing, PInvoke's charter is not to improve on Win32Exception
. We only implement it in the first place because PCL profiles don't define it themselves.
Consider adding NativeErrorCode in the exception message. Greatly improves debugging and logs reading.
For instance
Another option is to hack "_message" property to not store the same message twice and get free serialization.