Repository navigation
AndroidClientHandler Issue - Unable to convert instance of type 'Java.Net.URLConnectionInvoker' to type 'Java.Net.HttpURLConnection' #1945
Description
Steps to Reproduce
Looking at the HockeyApp exception reports for our latest release, we're all of a sudden seeing a large number of exceptions (1,270 so far) related to the AndroidClientHandler:
Unable to convert instance of type 'Java.Net.URLConnectionInvoker' to type 'Java.Net.HttpURLConnection'
Expected Behavior
No exceptions would be thrown.
Actual Behavior
Many exception are thrown:
Unable to convert instance of type 'Java.Net.URLConnectionInvoker' to type 'Java.Net.HttpURLConnection'
Version Information
=== Visual Studio Community 2017 for Mac ===
Version 7.5.3 (build 7)
Installation UUID: 62cf1ad2-0db0-41e1-ac78-aeb509d79f60
Runtime:
Mono 5.10.1.57 (2017-12/ea8a24b1bbf) (64-bit)
GTK+ 2.24.23 (Raleigh theme)
Xamarin.Mac 4.4.1.178 (master / eeaeb7e6)
Package version: 510010057
=== NuGet ===
Version: 4.3.1.4445
=== .NET Core ===
Runtime: /usr/local/share/dotnet/dotnet
Runtime Versions:
2.0.5
2.0.0
1.1.1
1.0.4
SDK: /usr/local/share/dotnet/sdk/2.1.4/Sdks
SDK Versions:
2.1.4
2.0.0
1.0.3
MSBuild SDKs: /Library/Frameworks/Mono.framework/Versions/5.10.1/lib/mono/msbuild/15.0/bin/Sdks
=== Xamarin.Profiler ===
Version: 1.6.2
Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler
=== Xamarin.Android ===
Version: 8.3.3.2 (Visual Studio Community)
Android SDK: /android/sdk
Supported Android versions:
5.0 (API level 21)
5.1 (API level 22)
6.0 (API level 23)
7.0 (API level 24)
7.1 (API level 25)
8.0 (API level 26)
8.1 (API level 27)
SDK Tools Version: 26.1.1
SDK Platform Tools Version: 28.0.0
SDK Build Tools Version: 28.0.0
Java SDK: /Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home
java version "1.8.0_101"
Java(TM) SE Runtime Environment (build 1.8.0_101-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.101-b13, mixed mode)
Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL
=== Apple Developer Tools ===
Xcode 9.4.1 (14161)
Build 9F2000
=== Xamarin.Mac ===
Version: 4.4.1.193 (Visual Studio Community)
=== Xamarin.iOS ===
Version: 11.12.0.4 (Visual Studio Community)
Hash: 64fece5f
Branch: d15-7
Build date: 2018-05-29 20:00:44-0400
=== Xamarin Inspector ===
Version: 1.4.0
Hash: b3f92f9
Branch: master
Build date: Fri, 19 Jan 2018 22:00:34 GMT
Client compatibility: 1
=== Build Information ===
Release ID: 705030007
Git revision: 13cecd02aceddf29a1ed57b86f81c02994df1483
Build date: 2018-06-14 15:48:08-04
Xamarin addins: 7065de97cf22c9038fdc39dd627f2c30790fd8af
Build lane: monodevelop-lion-d15-7
=== Operating System ===
Mac OS X 10.13.5
Darwin 17.6.0 Darwin Kernel Version 17.6.0
Tue May 8 15:22:16 PDT 2018
root:xnu-4570.61.1~1/RELEASE_X86_64 x86_64
=== Enabled user installed addins ===
Internet of Things (IoT) development (Preview) 7.5
Log File
Package: com.rpr.mobile
Version Code: 420
Version Name: 1.71.12
Android: 8.0.0
Android Build: R16NW.G950USQS3CRE2
Manufacturer: samsung
Model: SM-G950U
Thread: Thread-21-5991
CrashReporter Key: a3fd05b0-f000-4568-95b3-ee40431e79ad
Start Date: 2018-07-07T16:21:43.759Z
Date: 2018-07-07T16:22:05.663Zandroid.runtime.JavaProxyThrowable: System.InvalidCastException: Unable to convert instance of type 'Java.Net.URLConnectionInvoker' to type 'Java.Net.HttpURLConnection'.
at Java.Interop.JavaObjectExtensions.CastClass (Android.Runtime.IJavaObject instance, System.Type resultType) [0x0005d] in :0
at Java.Interop.JavaObjectExtensions._JavaCast[TResult] (Android.Runtime.IJavaObject instance) [0x0002f] in :0
at Java.Interop.JavaObjectExtensions.JavaCast[TResult] (Android.Runtime.IJavaObject instance) [0x00000] in :0
at Android.Runtime.Extensions.JavaCast[TResult] (Android.Runtime.IJavaObject instance) [0x00000] in :0
at Xamarin.Android.Net.AndroidClientHandler+d__58.MoveNext () [0x00027] in :0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <45e5348131954983a9a36665cb597c43>:0
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <45e5348131954983a9a36665cb597c43>:0
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <45e5348131954983a9a36665cb597c43>:0
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <45e5348131954983a9a36665cb597c43>:0
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable1+ConfiguredTaskAwaiter[TResult].GetResult () [0x00000] in <45e5348131954983a9a36665cb597c43>:0 at Xamarin.Android.Net.AndroidClientHandler+<SendAsync>d__39.MoveNext () [0x001a8] in <d4e2da295ca14e9cba1396287ae7ad25>:0 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <45e5348131954983a9a36665cb597c43>:0 at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <45e5348131954983a9a36665cb597c43>:0 at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <45e5348131954983a9a36665cb597c43>:0 at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <45e5348131954983a9a36665cb597c43>:0 at System.Runtime.CompilerServices.TaskAwaiter1[TResult].GetResult () [0x00000] in <45e5348131954983a9a36665cb597c43>:0
at RPR.Mobile.Shared.Http.ApiAuthenticationHandler+d__1.MoveNext () [0x00175] in <17afdd93c6d449ddbeeef231e7185398>:0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <45e5348131954983a9a36665cb597c43>:0
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <45e5348131954983a9a36665cb597c43>:0
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <45e5348131954983a9a36665cb597c43>:0
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <45e5348131954983a9a36665cb597c43>:0
at System.Runtime.CompilerServices.TaskAwaiter1[TResult].GetResult () [0x00000] in <45e5348131954983a9a36665cb597c43>:0 at RPR.Mobile.Shared.Http.CompressionHandler+<SendAsync>d__1.MoveNext () [0x000ae] in <17afdd93c6d449ddbeeef231e7185398>:0 --- End of stack trace from previous location where exception was thrown --- at RPR.Mobile.Shared.Http.LoggingHandler+<SendAsync>d__4.MoveNext () [0x003aa] in <17afdd93c6d449ddbeeef231e7185398>:0 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <45e5348131954983a9a36665cb597c43>:0 at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <45e5348131954983a9a36665cb597c43>:0 at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <45e5348131954983a9a36665cb597c43>:0 at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <45e5348131954983a9a36665cb597c43>:0 at System.Runtime.CompilerServices.ConfiguredTaskAwaitable1+ConfiguredTaskAwaiter[TResult].GetResult () [0x00000] in <45e5348131954983a9a36665cb597c43>:0
at System.Net.Http.HttpClient+d__49.MoveNext () [0x000ca] in <7fbbda94e790482788fef72ba707de84>:0
--- End of stack trace from previous location where exception was thrown ---
at Microsoft.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00042] in <1c7d529d87ec4bdcbde02e9494f3b5ae>:0
at Microsoft.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccess (System.Threading.Tasks.Task task) [0x0001c] in <1c7d529d87ec4bdcbde02e9494f3b5ae>:0
at Microsoft.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00009] in <1c7d529d87ec4bdcbde02e9494f3b5ae>:0
at Microsoft.Runtime.CompilerServices.TaskAwaiter1[TResult].GetResult () [0x00000] in <1c7d529d87ec4bdcbde02e9494f3b5ae>:0 at RPR.Mobile.Shared.Maps.ParcelBoundaryUtility+<GetImageUrl>d__2.MoveNext () [0x0006e] in <905a0792e577437783681affc41df2b7>:0 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <45e5348131954983a9a36665cb597c43>:0 at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <45e5348131954983a9a36665cb597c43>:0 at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <45e5348131954983a9a36665cb597c43>:0 at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <45e5348131954983a9a36665cb597c43>:0 at System.Runtime.CompilerServices.TaskAwaiter1[TResult].GetResult () [0x00000] in <45e5348131954983a9a36665cb597c43>:0
at RPR.Mobile.Droid.Adapters.PropertyDetails.LocationDetailsBuilder+<>c__DisplayClass10_0+<b__0>d.MoveNext () [0x000e3] in <17afdd93c6d449ddbeeef231e7185398>:0
Activity
dominik-weber commentedon Jul 11, 2018
@justintoth This might be a duplicate of #1923
justintoth commentedon Jul 11, 2018
@dominik-weber - Thanks for pointing that one out, my googling didn't uncover it! I'll test to see if there is a redirect going on for the api calls that are failing.
justintoth commentedon Jul 11, 2018
I'm not seeing a url redirect in my scenario, but will follow that ticket regardless. Here is an example url: http://dc1.parcelstream.com/GetMap.aspx?layers=DMP_LICENSE/Parcels&SS_CANDY=A4Xruc3AZGgd42psGeducOK4R0qLka1xWuxFUg~~&bbox=-117.692683897913,33.5006767409205,-117.683855742216,33.5042550091116&width=1440&height=700&resolution=40
grendello commentedon Dec 10, 2018
@justintoth I tested the URL you provided and it does not cause the crash with Xamarin.Android/master. I thus agree with @dominik-weber that it is likely a duplicate of #1923. Note however that the fix has not been released yet (it will be part of the next 15.9 update as well as of the 16.0 release). I'm going to close this issue now, but please feel free to reopen it if your problem persists after the fix hits the stable, thanks!