Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set ErrorInfo #218

Merged
merged 2 commits into from
Mar 19, 2012
Merged

Set ErrorInfo #218

merged 2 commits into from
Mar 19, 2012

Conversation

ermshiperete
Copy link
Contributor

These changes implement setting and getting the error info in the Marshal class. This is necessary to pass error information to/from unmanaged code.

To successfully use this code on Linux there needs to be an implementation of the Get/SetErrorInfo methods available, e.g. by installing libcom (http://linux.lsdev.sil.org/svn/COM/trunk/; http://linux.lsdev.sil.org/wiki/index.php/Libcom). However, the new code has try/catch blocks around so if Get/SetErrorInfo methods can't be found it behaves as before.

Also use additional information provided by IErrorInfo to fill in
exception details.

To make use of IErrorInfo on Linux a suitable implementation has to be
provided, e.g. by including libcom plus adding a mapping from
oleauth32.dll to the shared library that provides the implementation.

This completes mono bug 496138
(https://bugzilla.novell.com/show_bug.cgi?id=496138)
Marshal.GetHRForException had a MonoTODO because it needs to set
the errorinfo object so that exceptions get properly passed to
unmanaged code. Since not all managed exceptions have a corresponding
HR value but we might need to get to the original thrown exception
we implement a ManagedErrorInfo helper class that implements the
IErrorInfo interface but also stores the exception.

In GetExceptionForHR we check if the errorinfo we get is a
ManagedErrorInfo. If it is we return the exception stored in there
(if it converts to the same error code), otherwise we construct a new
exception.

Change-Id: Ib400636ee3caa54c9db8f41dbd40f15710024a63
@migueldeicaza
Copy link
Contributor

Thanks for the patch!

migueldeicaza added a commit that referenced this pull request Mar 19, 2012
@migueldeicaza migueldeicaza merged commit 468760a into mono:mono-2-10-8 Mar 19, 2012
@ermshiperete ermshiperete deleted the mono-2-10-8 branch July 3, 2018 17:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants