-
Notifications
You must be signed in to change notification settings - Fork 525
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
Regression: Newtonsoft.Json.JsonReaderException
on Xamarin.Android v 10.0.0.40
#3626
Comments
Thanks for the report! This problem appears to be due to an incorrect change in behavior in the managed linker. Candidate workaround: Add a new linker.xml file to the project, set the Build Action to LinkDescription, and add the following lines to it to preserve the <linker>
<assembly fullname="Mono.Android">
<type fullname="Xamarin.Android.Net.AndroidClientHandler" preserve="all" />
</assembly>
</linker> This resolved the issue in my local environment, testing with the JsonParseTextRepro example project on an Android 7.0 Nougat (API level 25) x86_64, Google APIs emulator ( Additional notes for the team members who work on the managed linker:
|
Stack trace of the
|
This is a workaround for the current preview channel of Visual Studio for Mac: dotnet/android#3626 (comment)
Internal cross-referencing link for the Microsoft team:
|
Thanks @brendanzagaeski I confirmed that the work-around was successful for me 👍 To prevent the linker from removing the |
Fixes: dotnet#3626 mono/mono@6034bc0 introduced new `HttpClient.CreateDefaultHandler()` method, which replaces the `HttpClient.GetDefaultHandler()` method. Our XA linker logic was detecting `AndroidClientHandler` usage by checking the `GetDefaultHandler` method and so it doesn't work anymore.
Fixes: dotnet#3626 mono/mono@6034bc0 mono/mono@2d6f02a introduced new `HttpClient.CreateDefaultHandler()` method, which replaces the `HttpClient.GetDefaultHandler()` method. Our XA linker logic was detecting `AndroidClientHandler` usage by checking the `GetDefaultHandler` method and so it doesn't work anymore.
Fixes: dotnet#3626 mono/mono@6034bc0 mono/mono@2d6f02a introduced new `HttpClient.CreateDefaultHandler()` method, which replaces the `HttpClient.GetDefaultHandler()` method. Our XA linker logic was detecting `AndroidClientHandler` usage by checking the `GetDefaultHandler` method and so it doesn't work anymore.
Fixes: #3626 mono/mono@6034bc0 mono/mono@2d6f02a introduced new `HttpClient.CreateDefaultHandler()` method, which replaces the `HttpClient.GetDefaultHandler()` method. Our XA linker logic was detecting `AndroidClientHandler` usage by checking the `GetDefaultHandler` method and so it doesn't work anymore. Added a new test to avoid similar regression in the future.
Fixes: #3626 mono/mono@6034bc0 mono/mono@2d6f02a introduced new `HttpClient.CreateDefaultHandler()` method, which replaces the `HttpClient.GetDefaultHandler()` method. Our XA linker logic was detecting `AndroidClientHandler` usage by checking the `GetDefaultHandler` method and so it doesn't work anymore. Added a new test to avoid similar regression in the future.
Release status update A new Preview version has now been published that includes the fix for this item. The fix is not yet included in a Release version. I will update this item again when a Release version is available that includes the fix. Fix included in Xamarin.Android 10.1.0.1. Fix included on Windows in Visual Studio 2019 version 16.4 Preview 2. To try the Preview version that includes the fix, check for the latest updates in Visual Studio Preview. Fix included on macOS in Visual Studio 2019 for Mac version 8.4 Preview 1. To try the Preview version that includes the fix, check for the latest updates on the Preview updater channel. |
Release status update A new Release version has now been published on Windows that includes the fix for this item. The fix is not yet published in a Release version on macOS. I will update this item again when a Release version is available on macOS that includes the fix. Fix included in Xamarin.Android 10.1.0.30. Fix included on Windows in Visual Studio 2019 version 16.4. To get the new version that includes the fix, check for the latest updates or install the latest version from https://visualstudio.microsoft.com/downloads/. (Fix also included on macOS in Visual Studio 2019 for Mac version 8.4 Preview 2.1 and higher. To try the Preview version that includes the fix, check for the latest updates on the Preview updater channel.) |
Release status update A new Release version has now been published on macOS that includes the fix for this item. Fix included in Xamarin.Android 10.1.1.0. Fix included on macOS in Visual Studio 2019 for Mac version 8.4. To get the new version that includes the fix, check for the latest updates on the Stable updater channel. (Fix also included on Windows in Visual Studio 2019 version 16.4 and higher. To get the new version that includes the fix, check for the latest updates or install the latest version from https://visualstudio.microsoft.com/downloads/.) |
Reproduction sample: https://github.com/brminnick/JsonParseTextRepro/
Steps to Reproduce
JsonParseTextRepro.sln
Newtonsoft.Json.JsonReaderException
Expected Behavior
The JSON should parse successfully, no exception should be thrown, displaying
Success
on the screen.Actual Behavior
Newtonsoft.Json.JsonReaderException
is thrown.Work Around
JsonParseTextRepro.sln
Success
Environment
=== Visual Studio Enterprise 2019 for Mac (Preview) ===
Version 8.3 Preview (8.3 build 1630)
Installation UUID: 6e5142b4-e8be-4d1c-b75e-4744b0d8c3de
GTK+ 2.24.23 (Raleigh theme)
Xamarin.Mac 5.16.1.24 (d16-3 / 08809f5b)
=== Mono Framework MDK ===
Runtime:
Mono 6.4.0.190 (2019-06/6b4b99e571b) (64-bit)
Package version: 604000190
=== NuGet ===
Version: 5.3.0.6192
=== .NET Core ===
Runtime: /usr/local/share/dotnet/dotnet
Runtime Versions:
3.0.0-preview9-19423-09
3.0.0-preview6-27804-01
2.2.5
2.1.9
2.1.2
2.1.1
2.0.5
2.0.0
1.1.1
1.0.4
SDK: /usr/local/share/dotnet/sdk/3.0.100-preview9-014004/Sdks
SDK Versions:
3.0.100-preview9-014004
3.0.100-preview6-012264
2.2.107
2.1.505
2.1.302
2.1.301
2.1.4
2.0.0
1.0.1
MSBuild SDKs: /Library/Frameworks/Mono.framework/Versions/6.4.0/lib/mono/msbuild/Current/bin/Sdks
=== Xamarin.Profiler ===
Version: 1.6.11.16
Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler
=== Updater ===
Version: 11
=== Xamarin.Android ===
Version: 10.0.0.40 (Visual Studio Enterprise)
Commit: xamarin-android/d16-3/080eaac
Android SDK: /Users/brandonm/Library/Developer/Xamarin/android-sdk-macosx
Supported Android versions:
None installed
SDK Tools Version: 26.1.1
SDK Platform Tools Version: 28.0.2
SDK Build Tools Version: 28.0.3
Build Information:
Mono: mono/mono@6434153d8b7
Java.Interop: xamarin/java.interop/d16-3@5836f58
LibZipSharp: grendello/LibZipSharp/d16-3@71f4a94
LibZip: nih-at/libzip@b95cf3f
ProGuard: xamarin/proguard@905836d
SQLite: xamarin/sqlite@8212a2d
Xamarin.Android Tools: xamarin/xamarin-android-tools/d16-3@cb41333
=== Microsoft Mobile OpenJDK ===
Java SDK: /Users/brandonm/Library/Developer/Xamarin/jdk/microsoft_dist_openjdk_1.8.0.25
1.8.0-25
Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL
=== Android SDK Manager ===
Version: 1.4.0.64
Hash: f70cfd2
Branch: remotes/origin/d16-3
Build date: 2019-09-02 17:32:00 UTC
=== Android Device Manager ===
Version: 1.2.0.112
Hash: 791e68e
Branch: remotes/origin/d16-3
Build date: 2019-09-02 17:32:26 UTC
=== Xamarin Designer ===
Version: 16.3.0.178
Hash: 725c87d57
Branch: remotes/origin/d16-3
Build date: 2019-08-29 22:57:50 UTC
=== Apple Developer Tools ===
Xcode 11.0 (14935)
Build 11A419c
=== Xamarin.Mac ===
Version: 5.16.1.24 (Visual Studio Enterprise)
Hash: 08809f5b
Branch: d16-3
Build date: 2019-09-06 08:42:41-0400
=== Xamarin.iOS ===
Version: 12.16.1.24 (Visual Studio Enterprise)
Hash: 08809f5b
Branch: d16-3
Build date: 2019-09-06 08:42:42-0400
=== Xamarin Inspector ===
Version: 1.4.3
Hash: db27525
Branch: 1.4-release
Build date: Mon, 09 Jul 2018 21:20:18 GMT
Client compatibility: 1
=== Build Information ===
Release ID: 803001630
Git revision: 456143789d948850ef2518c7401bcd0637d88e99
Build date: 2019-09-11 21:24:24+00
Build branch: release-8.3-preview4
Xamarin extensions: 52c395755d16d1c7077d3568574a19af9a23b423
=== Operating System ===
Mac OS X 10.15.0
Darwin 19.0.0 Darwin Kernel Version 19.0.0
Sun Aug 18 23:37:31 PDT 2019
root:xnu-6153.0.166~17/RELEASE_X86_64 x86_64
The text was updated successfully, but these errors were encountered: