webclient - AccessViolationException

Trips

Well-known member
Joined
Aug 7, 2010
Messages
2,788
<span style="font-family:Verdana,sans-serif; color:black; font-size:8pt During the past 6 months the following code using webclient worked. A few weeks ago MS Windows Update kicked in and installed a number of updates to my Windows 7 OS along
with security updates for .NET Framework, for MS VS 2010 Tools for Office Runtime Redistributable x64, and others. These updates (around 3 dozen of them) have a status as successful.
<p style="line-height:normal; margin:0in 0in 0pt 0.5in <span style="font-family:Courier New; color:#2b91af; font-size:9pt WebClient<span style="font-family:Courier New; font-size:9pt myWebClient =
<span style="color:blue new <span style="color:#2b91af WebClient();
<p style="line-height:normal; margin:0in 0in 0pt 0.5in <span style="font-family:Courier New; color:blue; font-size:9pt string<span style="font-family:Courier New; font-size:9pt <span>
uriString<span> = <span style="color:#a31515 "<my proprietary web address>";
<p style="line-height:normal; margin:0in 0in 0pt 0.5in <span style="font-family:Courier New; font-size:9pt myWebClient.Headers.Add(<span style="color:#a31515 "Content-Type",
<span style="color:#a31515 "application/x-www-form-urlencoded");
<p style="line-height:normal; margin:0in 0in 0pt 0.5in <span style="font-family:Courier New; font-size:9pt
<p style="line-height:normal; margin:0in 0in 0pt 0.5in <span style="font-family:Courier New; color:blue; font-size:9pt string<span style="font-family:Courier New; font-size:9pt postData<span>
= <span style="color:#a31515 "post_cmd=delete_game&game_id=" + game_id.ToString();
<p style="line-height:normal; margin:0in 0in 0pt 0.5in <span style="font-family:Courier New; color:blue; font-size:9pt byte<span style="font-family:Courier New; font-size:9pt [] postArray<span>
= <span style="color:#2b91af Encoding.ASCII.GetBytes(postData);
<p style="line-height:normal; margin:0in 0in 0pt 0.5in <span style="font-family:Courier New; font-size:9pt <span>

<p style="line-height:normal; margin:0in 0in 0pt 0.5in <span style="font-family:Courier New; color:blue; font-size:9pt byte<span style="font-family:Courier New; font-size:9pt [] responseArray = myWebClient.UploadData(uriString, postArray);
<p style="line-height:normal; margin:0in 0in 0pt 0.5in <span style="font-family:Courier New; color:blue; font-size:9pt string<span style="font-family:Courier New; font-size:9pt response<span>
= <span style="color:#2b91af Encoding.ASCII.GetString(responseArray);
<span style="font-family:Verdana,sans-serif; color:black; font-size:8pt Unfortunately when I run any of my code that includes WebClient, I now get an "AccessViolationException - Attempted to read or write protected memory". Keep in mind that the WebClient
call actually works. However, once the call completes then it appears that it has somehow damaged the internal memory of the dialog that it is associated with much like an army of termites might damage the foundation of your house - the house looks really
nice and then suddenly it collapses into a pile of sawdust. My dialog looks okay until you try to do something with it, and then it generates this "AccessViolationException" error.
<span style="font-family:Verdana,sans-serif; color:black; font-size:8pt Here is what Ive tried in order to fix this problem:
<p style="margin:0in 0in 6pt <span style="font-family:Verdana,sans-serif; color:black; font-size:8pt 1. Ran my program - that uses the WebClient class - on another computer and it worked like a charm. No problemos. Thus it appears to be that there is
something wrong with my brand spanking new computer.
<p style="margin:0in 0in 6pt <span style="font-family:Verdana,sans-serif; color:black; font-size:8pt 2. Queried the MSDN forums for a solution and did not find any.
<p style="margin:0in 0in 6pt <span style="font-family:Verdana,sans-serif; color:black; font-size:8pt 3. Queried the Internet using Google for a solution and did not find any.
<p style="margin:0in 0in 6pt <span style="font-family:Verdana,sans-serif; color:black; font-size:8pt 4. Reinstalled MS Visual Studio 2010 (version 10.0.30319.1 RTMRel). This also includes MS .NET Framework version 4.0.30319 RTMRel. Altho it took hours
to do this it didnt help at all.
<p style="margin:0in 0in 6pt <span style="font-family:Verdana,sans-serif; color:black; font-size:8pt 5. Used the System Restore utility to restore my system back a few weeks to a point before the MS Windows Upgrade happened. When this rollback did not
help I then undid it.
<p style="margin:0in 0in 6pt <span style="font-family:Verdana,sans-serif; color:black; font-size:8pt 6. Made certain that all current MS Windows required updates were installed.
<p style="margin:0in 0in 6pt <span style="font-family:Verdana,sans-serif; color:black; font-size:8pt 7. Tried replacing WebClient with WebRequest, but WebRequest generated the same AccessViolation error.
<span style="font-family:Verdana,sans-serif; color:black; font-size:8pt Here is my system info:
<span style="font-family:Verdana,sans-serif; color:black; font-size:8pt
<p style="line-height:normal; margin:0in 0in 0pt <span style="font-family:Courier New; color:black; font-size:8pt System Type<span>
x64-based PC
<p style="line-height:normal; margin:0in 0in 0pt <span style="font-family:Courier New; color:black; font-size:8pt Processor<span>
Intel(R) Core(TM) i7 CPU<span>
Q 720<span> @ 1.60GHz, 1600 Mhz, 4 Core(s), 8 Logical Processor(s)
<p style="line-height:normal; margin:0in 0in 0pt <span style="font-family:Courier New; color:black; font-size:8pt BIOS Version/Date<span>
Dell Inc. A09, 4/26/2010
<p style="line-height:normal; margin:0in 0in 0pt <span style="font-family:Courier New; color:black; font-size:8pt SMBIOS Version<span>
2.6
<p style="line-height:normal; margin:0in 0in 0pt <span style="font-family:Courier New; color:black; font-size:8pt Windows Directory<span>
C:Windows
<p style="line-height:normal; margin:0in 0in 0pt <span style="font-family:Courier New; color:black; font-size:8pt System Directory<span>
C:Windowssystem32
<p style="line-height:normal; margin:0in 0in 0pt <span style="font-family:Courier New; color:black; font-size:8pt Boot Device<span>
DeviceHarddiskVolume2
<p style="line-height:normal; margin:0in 0in 0pt <span style="font-family:Courier New; color:black; font-size:8pt Locale<span>
United States
<p style="line-height:normal; margin:0in 0in 0pt <span style="font-family:Courier New; color:black; font-size:8pt Hardware Abstraction Layer<span>
Version = "6.1.7600.16385"
<p style="line-height:normal; margin:0in 0in 0pt <span style="font-family:Courier New; color:black; font-size:8pt User Name<span>
KirkE-PCKirkE
<p style="line-height:normal; margin:0in 0in 0pt <span style="font-family:Courier New; color:black; font-size:8pt Time Zone<span>
Central Daylight Time
<p style="line-height:normal; margin:0in 0in 0pt <span style="font-family:Courier New; color:black; font-size:8pt Installed Physical Memory (RAM)<span>
6.00 GB
<p style="line-height:normal; margin:0in 0in 0pt <span style="font-family:Courier New; color:black; font-size:8pt Total Physical Memory<span>
5.99 GB
<p style="line-height:normal; margin:0in 0in 0pt <span style="font-family:Courier New; color:black; font-size:8pt Available Physical Memory<span>
3.93 GB
<p style="line-height:normal; margin:0in 0in 0pt <span style="font-family:Courier New; color:black; font-size:8pt Total Virtual Memory<span>
12.0 GB
<p style="line-height:normal; margin:0in 0in 0pt <span style="font-family:Courier New; color:black; font-size:8pt Available Virtual Memory<span>
8.82 GB
<p style="line-height:normal; margin:0in 0in 0pt <span style="font-family:Courier New; color:black; font-size:8pt Page File Space<span>
5.99 GB
<p style="line-height:normal; margin:0in 0in 0pt <span style="font-family:Courier New; color:black; font-size:8pt Page File<span>
C:pagefile.sys
<span style="font-family:Verdana,sans-serif; color:black; font-size:8pt So, I am now asking for your assistance in solving this problem. Hopefully you will have some insight that will help me identify and then remove, reinstall or reconfigure
the offending software so that webclient will behave once more, because if that isnt the case then my next move will be to smoke the hard drive and reinstall MS Windows 7 along with all other software and that will be really painful. I would much rather
have another root canal. Help me M-S-wan kenobe, you are my only hope!
<span style="font-family:Verdana,sans-serif; color:black; font-size:8pt Thanks!
<span style="font-family:Verdana,sans-serif; color:black; font-size:8pt Kirk

<

KAE - Prairie Dog Software, LLC


View the full article
 
Back
Top