ModernHttpClient | https :// www | Runtime Evironment library
kandi X-RAY | ModernHttpClient Summary
kandi X-RAY | ModernHttpClient Summary
Available on NuGet: [NuGet] This library brings the latest platform-specific networking libraries to Xamarin applications via a custom HttpClient handler.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of ModernHttpClient
ModernHttpClient Key Features
ModernHttpClient Examples and Code Snippets
Community Discussions
Trending Discussions on ModernHttpClient
QUESTION
I'm building an Xamarin Android app with latest Visual Studio 2019 updates. On some devices I get some exceptions that I don't understand, because on most of the devices it seems to be fine.
Exception 1:
...ANSWER
Answered 2021-Apr-16 at 10:01I could solve this issue by enabling "Bundle assemblies into native code" under "Android Options" in project properties, hopefully.
QUESTION
I'm trying to run the xamarin forms sample from the Dot net conf 2019 keynote. I've hosted the grpc service and a .net core console application can get data from it without any issues. But when running the xamarin app, the ALPN negotiation(Client hello) happens with http 1.1 and therefore the grpc call fails. Source code available here
Error message: Grpc.Core.RpcException: Status(StatusCode=Internal, Detail="Bad gRPC response. Response protocol downgraded to HTTP/1.1."
Debugger reveals that the SocketsHttpHandler used underneath on xamarin does not have the code that support Http 2.
Questions:
- Apparently Xamarin supports Grpc and Http. Why does this fail? Given that my suspect is correct, so that the issue is because xamarin uses an old version of System.Net.Http.dll that doesn't support Http2.
- How to make sure Xamarin uses correct runtime assemblies that support Http2?
- If this works for someone, Can you please share the system configuration?
Configuration
Use shared runtime: true
Mono shared runtime version (as seen on android device): 10.1.0-18.
Visual studio 2019 on windows 10:
Xamarin.Android SDK 10.1.4.0 (d16-4/e44d1ae)
Xamarin.Android Reference Assemblies and MSBuild support.
Mono: fd9f379
Java.Interop: xamarin/java.interop/d16-4@c4e569f
Xamarin.Android Tools: xamarin/xamarin-android-tools/d16-5@9f4ed4b
Things I tried:
- Switch to Managed HttpClient implementation /NativeMessageHandler from ModernHttpClient. Still fails with same error. (Because ALPN negotiation still uses same code?)
- Send a HttpRequestMessage with Version 2 on a new HttpClient. Still the underlying handler is the same. So it fails to negotiate Http2.
- Disable shared runtime. Didn't work.
On .net core console app HttpConnectionSettings used by the SocketsHttpHandler has http2 supporting code:
But on xamarin it doesn't. AndroidClientHandler is selected, but t delegates to the SocketsHttpHandler. It's settings doesn't have the http2 support:
...ANSWER
Answered 2020-Feb-23 at 18:43I make it work your provided solution. Sorry i didnt cover exact details why your way didnt worked and this one worked. Also i couldn't test iOs version.
Server. I changed only port version. I used release version. Btw I am not sure how successfully you could run Http1AndHttp2 and same ip and port. I had issues on personal project.
Mobile Added Grpc.Core and Grpc.Core.Api nugets to both projects.
I am creating channel differently. Your solution version
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install ModernHttpClient
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page