Do we really need to throw exceptions for P / Invoke methods?
I am using P / Invoke methods in my .NET application. Since functions are C ++ functions; they each have a return type such as int, intptr, or any structure. The return type is enough to tell me if the function was successful or not. Should I still be catching the generic or COM exception in this case?
+2
a source to share
3 answers
C ++ functions can throw exceptions.
The Windows API can throw exceptions, whether they are thrown directly from P / Invoke or from C ++ functions.
Is it possible for your users to see exception messages (error messages) from Windows or do you want your program to display your message?
+1
a source to share