Bug 61054 - System.ArgumentNullException: Argument cannot be null. Parameter name: pointer using NSUrlSessionHandler
Summary: System.ArgumentNullException: Argument cannot be null. Parameter name: pointe...
Status: RESOLVED FIXED
Alias: None
Product: iOS
Classification: Xamarin
Component: Xamarin.iOS.dll ()
Version: XI 11.6 (xcode9.2)
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: 15.7
Assignee: Sebastien Pouliot
URL:
Depends on:
Blocks:
 
Reported: 2017-12-08 17:08 UTC by Anastasiia
Modified: 2018-03-19 16:34 UTC (History)
7 users (show)

Tags:
Is this bug a regression?: No
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and 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 Links.

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 Developer Community or GitHub 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.

Related Links:
Status:
RESOLVED FIXED

Description Anastasiia 2017-12-08 17:08:26 UTC
It's a critical issue and happens once in a while; unfortunately reproducing is unstable for now, but clearly something wrong with NSURLSessionHandler processing request (we are using refit), retry doesn't help, need to repeat whole request. We can provide only stack trace for now. We will explore this issue for more clues.

System.ArgumentNullException: Value cannot be null.
Parameter name: pointer
  at System.IO.UnmanagedMemoryStream.Initialize (System.Byte* pointer, System.Int64 length, System.Int64 capacity, System.IO.FileAccess access, System.Boolean skipSecurityCheck) [0x00005] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.6.1.2/src/mono/mcs/class/referencesource/mscorlib/system/io/unmanagedmemorystream.cs:233 
  at System.IO.UnmanagedMemoryStream..ctor (System.Byte* pointer, System.Int64 length) [0x00006] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.6.1.2/src/mono/mcs/class/referencesource/mscorlib/system/io/unmanagedmemorystream.cs:203 
  at Foundation.NSData+UnmanagedMemoryStreamWithRef..ctor (Foundation.NSData source) [0x00000] in /Users/builder/data/lanes/5665/6857dfcc/source/xamarin-macios/src/Foundation/NSData.cs:137 
  at Foundation.NSData.AsStream () [0x00012] in /Users/builder/data/lanes/5665/6857dfcc/source/xamarin-macios/src/Foundation/NSData.cs:211 
  at System.Net.Http.NSUrlSessionHandler+NSUrlSessionDataTaskStream+<ReadAsync>d__15.MoveNext () [0x00091] in /Users/builder/data/lanes/5665/6857dfcc/source/xamarin-macios/src/Foundation/NSUrlSessionHandler.cs:513 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.6.1.2/src/mono/mcs/class/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:152 
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00037] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.6.1.2/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:187 
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.6.1.2/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:156 
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.6.1.2/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:128 
  at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1+ConfiguredTaskAwaiter[TResult].GetResult () [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.6.1.2/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:535 
  at System.IO.Stream+<CopyToAsyncInternal>d__27.MoveNext () [0x000d3] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.6.1.2/src/mono/mcs/class/referencesource/mscorlib/system/io/stream.cs:171 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.6.1.2/src/mono/mcs/class/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:152 
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00037] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.6.1.2/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:187 
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.6.1.2/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:156 
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.6.1.2/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:128 
  at System.Runtime.CompilerServices.ConfiguredTaskAwaitable+ConfiguredTaskAwaiter.GetResult () [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.6.1.2/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:447 
  at System.Net.Http.HttpContent+<LoadIntoBufferAsync>d__17.MoveNext () [0x00064] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.6.1.2/src/mono/mcs/class/System.Net.Http/System.Net.Http/HttpContent.cs:146 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.6.1.2/src/mono/mcs/class/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:152 
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00037] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.6.1.2/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:187 
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.6.1.2/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:156 
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.6.1.2/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:128 
  at System.Runtime.CompilerServices.ConfiguredTaskAwaitable+ConfiguredTaskAwaiter.GetResult () [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.6.1.2/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:447 
  at System.Net.Http.HttpContent+<ReadAsStringAsync>d__20.MoveNext () [0x00028] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.6.1.2/src/mono/mcs/class/System.Net.Http/System.Net.Http/HttpContent.cs:172 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.6.1.2/src/mono/mcs/class/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:152 
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00037] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.6.1.2/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:187 
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.6.1.2/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:156 
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.6.1.2/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:128 
  at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1+ConfiguredTaskAwaiter[TResult].GetResult () [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.6.1.2/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:535 
  at Refit.RequestBuilderImplementation+<>c__DisplayClass12_0`1+<<buildCancellableTaskFuncForMethod>b__0>d[T].MoveNext () [0x0025a] in <243cb3fcdbe04921b879875212df321c>:0 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.6.1.2/src/mono/mcs/class/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:152 
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00037] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.6.1.2/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:187 
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.6.1.2/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:156 
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.6.1.2/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:128 
  at System.Runtime.CompilerServices.TaskAwaiter`1[TResult].GetResult () [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.6.1.2/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:357 
  at OnDemandCargo.Services.UserService+<GetCurrentUser>d__5.MoveNext () [0x00025] in /Users/nastia/Projects/on-demand-cargo/OnDemandCargo/Services/UserService.cs:31 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.6.1.2/src/mono/mcs/class/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:152 
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00037] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.6.1.2/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:187 
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.6.1.2/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:156 
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.6.1.2/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:128 
  at System.Runtime.CompilerServices.TaskAwaiter`1[TResult].GetResult () [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.6.1.2/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:357 
  at OnDemandCargo.ViewModels.ProfilePageViewModel+<ReloadOverride>d__57.MoveNext () [0x00052] in /Users/nastia/Projects/on-demand-cargo/OnDemandCargo/ViewModels/ProfilePageViewModel.cs:175 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.6.1.2/src/mono/mcs/class/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:152 
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00037] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.6.1.2/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:187 
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.6.1.2/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:156 
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.6.1.2/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:128 
  at System.Runtime.CompilerServices.ConfiguredTaskAwaitable+ConfiguredTaskAwaiter.GetResult () [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.6.1.2/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:447 
  at Polly.RetrySyntaxAsync+<>c__DisplayClass21_0+<<WaitAndRetryAsync>b__1>d.MoveNext () [0x0003f] in C:\projects\polly\src\Polly.Shared\Retry\RetrySyntaxAsync.cs:467 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.6.1.2/src/mono/mcs/class/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:152 
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00037] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.6.1.2/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:187 
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.6.1.2/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:156 
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.6.1.2/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:128 
  at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1+ConfiguredTaskAwaiter[TResult].GetResult () [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.6.1.2/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:535 
  at Polly.Retry.RetryEngine+<ImplementationAsync>d__1`1[TResult].MoveNext () [0x00099] in C:\projects\polly\src\Polly.Shared\Retry\RetryEngineAsync.cs:31 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.6.1.2/src/mono/mcs/class/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:152 
  at Polly.Retry.RetryEngine+<ImplementationAsync>d__1`1[TResult].MoveNext () [0x0023b] in C:\projects\polly\src\Polly.Shared\Retry\RetryEngineAsync.cs:49 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.6.1.2/src/mono/mcs/class/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:152 
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00037] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.6.1.2/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:187 
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.6.1.2/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:156 
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.6.1.2/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:128 
  at System.Runtime.CompilerServices.ConfiguredTaskAwaitable+ConfiguredTaskAwaiter.GetResult () [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.6.1.2/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:447 
  at Polly.Policy+<ExecuteAsync>d__98.MoveNext () [0x00085] in C:\projects\polly\src\Polly.Shared\PolicyAsync.cs:271 
--- End of stack trace from previous location where exception was thrown ---
  at OnDemandCargo.ViewModels.ViewModelBase+<WrapWithConnectivityCheck>d__32.MoveNext () [0x00146] in /Users/nastia/Projects/on-demand-cargo/OnDemandCargo/ViewModels/ViewModelBase.cs:198 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.6.1.2/src/mono/mcs/class/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:152 
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00037] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.6.1.2/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:187 
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.6.1.2/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:156 
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.6.1.2/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:128 
  at System.Runtime.CompilerServices.TaskAwaiter.GetResult () [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.6.1.2/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:113 
  at OnDemandCargo.ViewModels.ViewModelBase+<WrapWithExceptionHandling>d__33.MoveNext () [0x00024] in /Users/nastia/Projects/on-demand-cargo/OnDemandCargo/ViewModels/ViewModelBase.cs:209
Comment 1 Timothy Risi 2017-12-08 18:25:18 UTC
Please include your full build logs, crash reports (if any), test case (to reproduce) and all your version information.

To get full build logs just set the log verbosity to diagnostic at the following locations:
- On Visual Studio for Mac: Preferences > Projects > Build
- On Visual Studio for Windows: Tools > Options > Projects and Solutions > Build and Run

On Visual Studio Windows you also want to add `-v -v -v -v` to the mtouch additional arguments by right-clicking the project in the solution explorer and selecting `Properties`.
Note: this is done automatically on Visual Studio for Mac when the log verbosity is set to diagnostic.

The easiest way to get exact version information:
- On Visual Studio for Mac: "Visual Studio" menu, "About Visual Studio" item, "Show Details" button.
- On Visual Studio for Windows: "Help menu", "About Microsoft Visual Studio" item.
Then copy/paste the version information (you can use the "Copy Information" button).
Comment 2 Anastasiia 2017-12-12 14:29:08 UTC
Apple Developer Tools
Xcode 9.2
Xamarin.iOS
Version: 11.6.1.2 (Visual Studio Community)
Xamarin.Mac
Version: 4.0.0.214 (Visual Studio Community)
Operating System
Mac OS X 10.13.2

We created test project to reproduce this issue, you can find it here
(launch iOS project)
https://github.com/nastutusha/PointerExceptionTest

In this project we are sending lots of requests to our api end-point with high frequency and some of them are failing with the exception mentioned above. In our live project it's much easier for user to run into this exception performing more complex repeating requests in a short amount of time (e.g. quickly navigating through the app).
Comment 3 Sebastien Pouliot 2017-12-19 16:58:59 UTC
Thanks for the test case ! I can duplicate it the issue. When this happens stdout prints:

2017-12-19 11:53:26.088 PointerExceptionTest.iOS[83462:6611246] NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9802)
2017-12-19 11:53:26.091 PointerExceptionTest.iOS[83462:6611246] NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9802)

so something went wrong in the connection. However this should not result in an ArgumentNullException
Comment 4 Anastasiia 2017-12-20 13:37:33 UTC
We agree with both statements. 
There is definitely something wrong with our server (either this is a specific of Heroku services or our server side code has an error).
As you mentioned, it would be great to get a proper Web Exception instead of ArgumentNullException.
Comment 5 Sebastien Pouliot 2017-12-20 23:02:00 UTC
Failed request 297:
 Refit.ApiException: Response status code does not indicate success: 500 (Internal Server Error).
  at Refit.RequestBuilderImplementation+<>c__DisplayClass12_0`1+<<buildCancellableTaskFuncForMethod>b__0>d[T].MoveNext () [0x001b9] in <243cb3fcdbe04921b879875212df321c>:0 

^ this failure is unlikely to be caused by application. At least I still see it (randomly) with a local fix (that solve the ArgumentNullException)

I have not seen the `NSURLSession/NSURLConnection HTTP load failed` today, neither before or after testing my fix - so I'm not sure if some heroku servers could be set differently (in a way that apple does not support anymore without customizing the Info.plist).
Comment 6 Anastasiia 2017-12-21 12:35:03 UTC
Sebastien, thank you for the fast update!

As I mentioned, the error happens much often in our project than in the demo one.

Just let us know, if/when we can install Xamarin patch or update to the Alpha/Beta channel to test your fix.
Comment 7 Sebastien Pouliot 2018-01-08 20:12:23 UTC
> There is definitely something wrong with our server

Yes, even testing with the other HttpClientHandler I get weird (and hard to reproduce) results.

It's not clear if (or how) that could be the trigger for the problem I fixed. I've not been able to reproduce this with another server (and there's no other similar reports).

I'm moving this to the next milestone, it won't be in an alpha/beta soon - but I'll try to give you something to test independently.
Comment 8 Ewan 2018-01-18 10:47:42 UTC
Not sure if I should comment here or open an new issue but we experience the exact same issue with the Tidal HiFi API. The Tidal API responds as an Apache-Coyote/1.1 server.

It occurs fairly frequently here but unfortunately we can't provide a working sample as the API requires private access codes.

Interestingly we've not been able to reproduce this on a simulator running iOS 10.


We use:
Visual Studio Mac (Preview): 7.4 Preview (7.4 Build 839)
Xamarin iOS: 4.2.0.1 (Branch d15-6)
Mac OSX: High Sierra v 10.13.3 (Beta)
XCode: v9.2 (9C40b)
iPhone Simualtor: v10.0 (SimulatorApp: 835.5 | CoreSimulator 494.33)

Reproducible On:
---
iPhone 6s
iOS: 11.2.1 (15C153)

iPhone Simulator: 
Device: iPhone 6
iOS: 11.2 (15C107)


Can't reproduce on:
--- 
iPhone Simulator:
Device: iPhone 6
iOS: 10.3.1 (14E8301)
Comment 9 Ewan 2018-01-18 11:01:55 UTC
In addition to my comment above we've updated the iPhone to the latest iOS (11.2.2 - 15C202) and it still exhibits the same issue.
Comment 10 Vincent Dondain [MSFT] 2018-01-24 16:15:18 UTC
Additional information provided in https://github.com/xamarin/xamarin-macios/issues/3292 (closed because it's a duplicate of this bug).
Comment 11 Ewan 2018-01-25 10:49:23 UTC
I've been able to write a relatively small example calling the Tidal API in similar conditions as I initially experienced this exception.

Is there I way I can distribute it to you confidentially as it contains some private access codes?
Comment 12 Manuel de la Peña [MSFT] 2018-03-12 15:26:16 UTC
I have managed to reproduce the issue. I will be taking over where @sebastien left.
Comment 13 Manuel de la Peña [MSFT] 2018-03-13 11:44:26 UTC
I have created a PR with a fix for the issue here: https://github.com/xamarin/xamarin-macios/pull/3731/files

Once the PR is reviewed and landed, I'll provide a link to a build from master for the people in cc in this bug to test. If the fix is correct, we will close the bug and I will back port the fix to 15-7.
Comment 14 Manuel de la Peña [MSFT] 2018-03-16 09:55:57 UTC
PR got merged in master. Will link a master build here ASAP for the reporters to test. If the feedback is positive I will back port the fix to 15-7.
Comment 15 Manuel de la Peña [MSFT] 2018-03-16 11:42:31 UTC
Builds of master can be found here: https://jenkins.mono-project.com/view/Xamarin.MaciOS/job/xamarin-macios-builds-master/

Setting to fix for testing.
Comment 16 Ewan 2018-03-19 09:24:43 UTC
Patch looks good. Project I have no longer has this issue, previously would fail 1/5 requests.
Comment 17 Manuel de la Peña [MSFT] 2018-03-19 12:26:21 UTC
@Ewan thanks for the feedback. @Anastasiia  can you confirm that the issue is fixed in your application.
Comment 18 Anastasiia 2018-03-19 13:30:23 UTC
It works for us too! We had a case with 100% reproduce and now all requests are completing successfully or throw proper Web Exception if not, thanks Manuel!
Comment 19 Manuel de la Peña [MSFT] 2018-03-19 16:13:40 UTC
Great, will create a back port branch for 15-7 so that the fix is included there.
Comment 20 Manuel de la Peña [MSFT] 2018-03-19 16:34:02 UTC
Cherry-pick PR: https://github.com/xamarin/xamarin-macios/pull/3782

Once landed, this should be available in the next release on 15-7.