question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Bug with extra ? in URL on mono (Xamarin/Android/.NET Standard 1.1)

See original GitHub issue

I 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:closed
  • Created 6 years ago
  • Comments:14 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
canton7commented, Apr 22, 2017

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.

0reactions
jaredthirskcommented, Apr 22, 2017

I saw you put in a TrimStart(‘?’) right before setting the Query property – great! Thanks for making this fix!

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found