Bug with extra ? in URL on mono (Xamarin/Android/.NET Standard 1.1)
See original GitHub issueI am getting two ?'s in the URLs when building for NETSTANDARD (Xamarin Android) (WPF seemed to work fine.) This causes REST HTTP calls to fail.
- Potential Problem 1:
initialQueryString = "?" + rawQueryParameter;
(Requester.ConstructUri) - Potential Problem 2:
char separator = String.IsNullOrWhiteSpace(query) ? '?' : '&';
(QueryParamBuilder.Build) - Definite problem for me 3:
sb.Append(hasQuery ? '&' : '?');
(QueryHelpers.AddQueryString)
You can see ?'s are added in a few places and there is a different code path for .NET Framework, so I’m not sure how to best fix this aside from just forcing it to be right inside Requester.ConstructUri.
Temporary hackish fix in Requester.ConstructUri() that worked for me:
var builtQuery = QueryParamBuilder.Build(initialQueryString, queryParams);
if (builtQuery != null && builtQuery.Length > 0 && builtQuery.StartsWith("?")) { builtQuery = builtQuery.Substring(1); }
uriBuilder.Query = builtQuery;
Reference on Stackoverflow: http://stackoverflow.com/a/11083456/208304
Issue Analytics
- State:
- Created 6 years ago
- Comments:14 (6 by maintainers)
Top Results From Across the Web
Conflicting types with mono + nugets + new .net core types
If you use an earlier .netstandard (the above logs shows 2.0) then some nugets, that wants/needs the feature, might be including the type...
Read more >Bug in Visual studio 2022 + Xamarin + SignalR (method ...
SignalR cannot be used in a Xamarin Forms app because the HubConnectionBuilder fails with a MissingMethodException. By all accounts the problem ...
Read more >c# - .NET Core vs Mono
NET Core is mixed up with NetStandard, which is a bit of a wrapper around System.Runtime/mscorelib (and some others), that allows you to...
Read more >FAQ: Technical | Mono
NET API implemented and when executing a binary from Windows that consumes an unimplemented API you might get an obscure message about tokens...
Read more >Setup for .Net (xamarin forms on Visual Studio Code for mac)
Hello, I have a very simple .Net app, based on a xamarin forms template on visual studio for mac. It is the default...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I did have a code comment in there, but looks like I took it out.
QueryHelpers is imported verbatim from another package. I don’t want to edit it.
I saw you put in a TrimStart(‘?’) right before setting the Query property – great! Thanks for making this fix!