HighTechTalks DotNet Forums  

How To Get HResult From IOException

Dotnet Framework (CLR) microsoft.public.dotnet.framework.clr


Discuss How To Get HResult From IOException in the Dotnet Framework (CLR) forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Rich S.
 
Posts: n/a

Default How To Get HResult From IOException - 12-19-2005 , 03:25 PM






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.

Reply With Quote
  #2  
Old   
Rich S.
 
Posts: n/a

Default Re: How To Get HResult From IOException - 12-19-2005 , 03:50 PM






Thanks, Mattias!! You really saved me from pulling my hair out!!





"Mattias Sjögren" wrote:

Quote:
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

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


Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.