Runtime: Making a web request with CachePolicy and Fiddler on causes null-reference exception

Created on 6 Dec 2017  路  7Comments  路  Source: dotnet/runtime

This bug occurs in .NET FX (tested .NET Framework 4.5.2 and 4.7). It only occurs when Fiddler is running as well.
The reproducer is a simple GET request with the cache policy enabled:

var httpClient = new HttpClient(new WebRequestHandler() { CachePolicy = new RequestCachePolicy(RequestCacheLevel.Default) });
var address = "http://coastwatch.pfeg.noaa.gov/erddap/wms/jplAmsreSstMon_LonPM180/request?VERSION=1.3.0&SERVICE=WMS&REQUEST=GetCapabilities";
var str = await httpClient.GetStringAsync(new Uri(address));

This request will fail with a HttpRequestException, but if you look at the inner exceptions, what's really happening is a NullReferenceException in HttpWebRequest.CheckCacheUpdateOnResponse():

https://github.com/Microsoft/referencesource/blob/7de0d30c7c5ef56ab60fee41fcdb50005d24979a/System/net/System/Net/HttpWebRequest.cs#L4310

oc7vba1b

It doesn't seem to happen with all URLs. The above URL has an attachment in the response, which I suspect is related.

/CC @fragmer

area-System.Net.Http bug

All 7 comments

Does it happen on .NET Core as well?
If not, we will have to move the bug - we do not track Desktop issues on GH
cc @davidsh

No idea. I don't think that API is in .NET Core. @terrajobst asked me to log it here.

Does it happen on .NET Core as well?
If not, we will have to move the bug - we do not track Desktop issues on GH
cc @davidsh

cc: @terrajobst

.NET Framework bugs should NOT be reported to this repo. Instead, they should be reported on developercommunity.visualstudio.com.

Here is an example bug that was originally opened in GitHub but moved:
https://developercommunity.visualstudio.com/content/problem/154698/deadlock-between-httpclienthandler-and-httpwebrequ.html

We suggest customers use the developercommunity.visualstudio.com portal to report issues with .NET Framework. Doing so will allow the right product group people to get involved, get an internal .NET Framework bug generated, and provide a channel for posting repro code and/or additional information back to the product team as well as report back status to the person opening the bug.

We have moved the bug here so that it will be logged as a bug in .NET Framework.
https://developercommunity.visualstudio.com/content/problem/163070/making-a-web-request-with-cachepolicy-and-fiddler.html

You will be able to track status from there.

FYI:
The fix is part of .NET 4.8 EAP:
https://github.com/Microsoft/dotnet-framework-early-access/blob/master/release-notes/NET48/dotnet-48-changes.md#networking

  • Fixed HTTP Status line parsing to be more tolerant of missing status description text in HTTP responses. [534936, System.dll, Bug, Build:3621]

@karelz Thanks for the update. That's great news.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

GitAntoinee picture GitAntoinee  路  3Comments

iCodeWebApps picture iCodeWebApps  路  3Comments

omariom picture omariom  路  3Comments

jchannon picture jchannon  路  3Comments

bencz picture bencz  路  3Comments