Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Making a web request with CachePolicy and Fiddler on causes null-reference exception #24363

Closed
dotMorten opened this issue Dec 6, 2017 · 7 comments

Comments

@dotMorten
Copy link

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

@karelz
Copy link
Member

karelz commented Dec 6, 2017

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

@dotMorten
Copy link
Author

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

@dotMorten
Copy link
Author

Just to confirm... I don't see the members that the stack trace points to in CoreFX: https://github.com/dotnet/corefx/blob/e3f74deb999571d3f34a6b2b8011caebcf06dbfc/src/System.Net.Requests/src/System/Net/HttpWebRequest.cs

@davidsh
Copy link
Contributor

davidsh commented Dec 6, 2017

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.

@davidsh
Copy link
Contributor

davidsh commented Dec 7, 2017

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.

@davidsh davidsh closed this as completed Dec 7, 2017
@karelz
Copy link
Member

karelz commented Dec 13, 2018

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]

@dotMorten
Copy link
Author

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

@msftgits msftgits transferred this issue from dotnet/corefx Jan 31, 2020
@msftgits msftgits added this to the 2.1.0 milestone Jan 31, 2020
@msftbot msftbot bot locked as resolved and limited conversation to collaborators Dec 19, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants