Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Interop / January 2007

Tip: Looking for answers? Try searching our database.

IErrorInfo to COMException problem

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Burgazon - 16 Jan 2007 07:12 GMT
Hi,

I have a COM-.NET exception handling problem and I would appreciate your help.

I have a COM server that “throws exception” from time to time (the COM
object implements ISupportErrorInfo and generates IErrorInfo objects upon
errors).
The IErrorInfo object that is generated by my COM server extends the
interface IErrorInfo by adding some additional properties (for example:
MoreDetails) – let’s say the name of the extended interface is IMyErrorInfo
(which inherits from IErrorInfo).

Up until now, my COM client caught the “exception” (AKA IErrorInfo) and
checked if it’s of type IMyErrorInfo. If that was the case – my client cast
the IErrorInfo object to IMyErrorInfo and read the additional properties.

Now I’m re-writing my COM client to a .NET code.
.NET maps the IErrorInfo object to COMException and I have no way to get my
additional properties. In other words I have no way to get IMyErrorInfo.

Is there a good way to bypass this problem? Is there a way to get the
IErroInfo object “thrown” by my COM server?

I would appreciate any help you can give.

Thanks,
Michael Phillips, Jr. - 16 Jan 2007 17:16 GMT
Try using Marshal.GetHRForException in your catch block with the
COMException.

This method sets up an IErrorInfo Object that you can obtain by calling
GetErrorInfo.

I am not sure that using QueryInterface on this object will give you your
extended IMyErrorInfo but you can certainly try it.

> Hi,
>
[quoted text clipped - 26 lines]
>
> Thanks,

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.