WebRequest.Create eats an IOException on the first call - by Bill Menees

Status : 


Sign in
to vote
ID 773666 Comments
Status Closed Workarounds
Type Bug Repros 22
Opened 12/6/2012 6:05:37 AM
Access Restriction Public


The first time WebRequest.Create is called an IOException with a message of "The specified registry key does not exist." is raised and eaten within System.Net.HybridWebProxyFinder.InitializeFallbackSettings().  This exception only occurs if the LegacyWPADSupport key is missing in HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework (or HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\.NETFramework).

The code in InitializeFallbackSettings should be changed to not raise this exception.  Instead of calling RegistryKey.GetValueKind without checking for the key's existence, it should call RegistryKey.GetValue, pass in a default of 0, and check whether the returned value is an int.

There are a lot more details about this bug at http://stackoverflow.com/questions/13141434/httpclient-request-throws-ioexception.  It may have been introduced in security update: http://support.microsoft.com/kb/2745030.
Sign in to post a comment.
Posted by Microsoft on 4/29/2014 at 12:31 PM
Thank you for reporting this issue. This issue has been fixed in Visual Studio 2013. You can install a trial version of Visual Studio 2013 with the fix from: http://go.microsoft.com/?linkid=9832436
Posted by croban on 1/26/2014 at 10:25 AM
.DownloadStringTaskAsync throws also "The specified registry key does not exist."
StackTrace: at Microsoft.Win32.RegistryKey.Win32Error(Int32 errorCode, String str)
Source: mscorlib
Posted by Peter Huber on 10/25/2013 at 9:32 PM
I cannot use the Workaround, because I have no access to the registry on the hosting server.
Posted by Tom McKearney on 5/7/2013 at 11:10 AM
I wanted to add that I received this error from Silverlight as well and the Workaround seems to have fixed it
Posted by GarrMark on 4/25/2013 at 8:54 AM
Any follow up on this?
Posted by Microsoft on 12/7/2012 at 12:45 AM
Thanks for your feedback.

We are rerouting this issue to the appropriate group within the Visual Studio Product Team for triage and resolution. These specialized experts will follow-up with your issue.
Posted by Microsoft on 12/6/2012 at 6:50 AM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(http://support.microsoft.com)