Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
Mono organizations on
GitHub to continue tracking issues. Bugzilla will remain
available for reference in read-only mode. We will continue to work
on open Bugzilla bugs, copy them to the new locations
as needed for follow-up, and add the new items under Related
Our sincere thanks to everyone who has contributed on this bug
tracker over the years. Thanks also for your understanding as we
make these adjustments and improvements for the future.
Please create a new report on
GitHub or Developer Community with
your current version information, steps to reproduce, and relevant error
messages or log files if you are hitting an issue that looks similar to
this resolved bug and you do not yet see a matching new report.
Created attachment 9358 [details]
Xamarin version information
When using HttpClient to make web requests on an iPhone I intermittently get the exception below.
A few notes:
1. I am reusing HttpClient object but never run concurrent requests on the same HttpClient.
2. I have a pool of HttpClients that usually ranges from 2-3 depending on usage.
3. I patterned my code based on a blog entry by Henrik on how to use HttpClient using ContinueWith.
4. I create a new task for each request prior to making request.
5. If I repeat the request immediately with the same HttpClient, it works.
6. It seems to always fail on the PostAsync, not the later
Steps to reproduce: Repeated PostAsync requests on the same HttpClient.
The exception is this:
*****MakeWebReqeust NullReferenceException for url = chat/receive: message = 'Object reference not set to an instance of an object' elapsed time = 505
stack trace = at System.Net.Http.HttpClientHandler.CreateResponseMessage (System.Net.HttpWebResponse wr, System.Net.Http.HttpRequestMessage requestMessage, CancellationToken cancellationToken) [0x00000] in ///Library/Frameworks/Xamarin.iOS.framework/Versions/126.96.36.199/src/mono/mcs/class/System.Net.Http/System.Net.Http/HttpClientHandler.cs:290
at System.Net.Http.HttpClientHandler+<SendAsync>c__async0.MoveNext () [0x0041f] in ///Library/Frameworks/Xamarin.iOS.framework/Versions/188.8.131.52/src/mono/mcs/class/System.Net.Http/System.Net.Http/HttpClientHandler.cs:355
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000b] in /Developer/MonoTouch/Source/mono/mcs/class/corlib/System.Runtime.ExceptionServices/ExceptionDispatchInfo.cs:62
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1+ConfiguredTaskAwaiter[System.Net.Http.HttpResponseMessage].GetResult () [0x00000] in <filename unknown>:0
at System.Net.Http.HttpClient+<SendAsyncWorker>c__async0.MoveNext () [0x000a9] in ///Library/Frameworks/Xamarin.iOS.framework/Versions/184.108.40.206/src/mono/mcs/class/System.Net.Http/System.Net.Http/HttpClient.cs:273
*** This bug has been marked as a duplicate of bug 22724 ***
@Marek Safar - I am familiar with the bug you reference but I don't believe this is a duplicate of that. I am NOT running concurrent requests. I am reusing the same HTTPClient object but I never run concurrent requests.
#22724 does not need to involve concurrent request. I believe the issues was address. If you have repro which does still exhibits the problem, please reopen the bug report.
@marek Safar - #22724 specifically refers to android. Does the fix apply to iOS as well?
yes, the code is exactly same
@Marek Safar - thanks. So, how do I get the fix? Is this on the alpha, beta, or stable channels?
Yes, the fix should be included in latest Xamarin.iOS alpha