A call to WebClient.DownloadString gives a first chance exception:
IOException: The specified registry key does not exist.
For some time now I'm recieving first chance exceptions running our software in existing code.
We have the policy that our code should run without giving first change exceptions to make debugging easier.
The first chance exception occurs in the WebClient class when calling the DownloadString and in a remoting scenario where the remote host is unavailable.
Does anyone know how we can prevent this first chance exception?
I'm running VS 2010 on a Windows 8 machine. I don't have any anti virus or firewalls running as far as I know of.
The code is running on x86 mode for the .Net framework 4.0 with debugging enabled. The code is a mix of VB.Net and C#
This method retrieves the specified resource. After it downloads the resource, the method uses the encoding specified in the Encoding property to convert the resource to a String.
When an exception is thrown, the common language runtime (CLR) looks for the catch statement that handles this exception. If the currently executing method does not contain such a catch block, the CLR looks at the method that called the current method, and so on up the call stack.
Use try / catch blocks around code that can potentially generate an exception, and your code can recover from that exception. In catch blocks, always order exceptions from the most derived to the least derived. All exceptions derive from the Exception class.
It's a .NET issue, Microsoft released an update here:
http://technet.microsoft.com/en-us/security/bulletin/ms12-074
You can add the registery key that is missing your self:
Registry location: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework
DWORD (32-bit) Value name: LegacyWPADSupport
Value data: 0
and for 64bit machines:
Registry location: HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\.NETFramework
DWORD (32-bit) Value name: LegacyWPADSupport
Value data: 0
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With