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 / CLR / December 2005

Tip: Looking for answers? Try searching our database.

How To Get HResult From IOException

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Rich S. - 19 Dec 2005 20:25 GMT
Hello,

The HResult code in an IOException is a Protected member.  How on Earth am I
supposed to read the HResult if it is protected?

My program needs to determine the exact cause of any IOException that occurs
in the WebRequest class.  How can I do this if I can't access the HResult
field because it is protected?

I understand that I could read the field in a derived class, but the
WebRequest class is not going to throw my derived exception, it's going to
throw one of the built-in exceptions.

This is very frustrating.

Thank you very much,
Rich S.
Mattias Sjögren - 19 Dec 2005 20:37 GMT
>The HResult code in an IOException is a Protected member.  How on Earth am I
>supposed to read the HResult if it is protected?

Try calling Marshal.GetHRForException

Mattias

Signature

Mattias Sjögren [C# MVP]  mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.

Rich S. - 19 Dec 2005 20:50 GMT
Thanks, Mattias!!  You really saved me from pulling my hair out!!

> >The HResult code in an IOException is a Protected member.  How on Earth am I
> >supposed to read the HResult if it is protected?
>
> Try calling Marshal.GetHRForException
>
> Mattias

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.