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.

Invalid URI: The Uri string is too long. - NET MAUI

See original GitHub issue

Description

This exception occurs after running the app for several hours, I am trying to navigate to another page using the code below

var navigationParameter = new Dictionary<string, object> { { "PickCategories", info } }; await Shell.Current.GoToAsync(nameof(InformationView), true, navigationParameter);

I am passing the same data all the time in a loop, it works for hours then starts throwing the exception “Invalid URI: The Uri string is too long.” Why does it not complain at first and then start complaining about the same input?

Steps to Reproduce

1-Create a NET MAUI app with shell navigation as

var navigationParameter = new Dictionary<string, object>
{
    { "PickCategories", info }
};
await Shell.Current.GoToAsync(nameof(InformationView), true, navigationParameter);       

and send an object as a parameter and receive that object via ApplyQueryAttributes and bind the object sent to BindingContext

void IQueryAttributable.ApplyQueryAttributes(IDictionary<string, object> message)
{
var infoMessage = message["ImageMedia"] as Media;
BindingContext = infoMessage;
//The above line throws an exception

Link to public reproduction project repository

https://github.com/mgungorchamp/InfoBoard/tree/IndividualViewPage

Version with bug

7.0.49

Last version that worked well

6.0

Affected platforms

Android, Windows

Affected platform versions

.NET MAUI Windows and Android App

Did you find any workaround?

Nope

Relevant log output

No response

Issue Analytics

  • State:closed
  • Created 2 months ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
borrmanncommented, Aug 1, 2023

@mgungorchamp I am not quite sure if this is how it works, but I would suspect you are keep adding to your navigation stack until it is too long? how do you navigate back to your pages? if you are not using GoToAsync(“…”) when you leave a page and instead use GoToAsync(nameof(YourPage)), you could end up in an indefinite loop. I think using absolute uri strings when you are going back to your Root pages could also help to clear the stack.

0reactions
hartezcommented, Aug 7, 2023

@mgungorchamp Please open a separate issue for this new problem.

Read more comments on GitHub >

github_iconTop Results From Across the Web

HttpClient: The uri string is too long
I receive this rediculous error. {System.UriFormatException: Invalid URI: The Uri string is too long. at System.UriHelper.EscapeString at ...
Read more >
Error : HTTP Request: Invalid URI: The Uri string is too long
When I try to download the image using the url in HTTP request, getting this error, HTTP Request: Invalid URI: The Uri string...
Read more >
[iOS] SIGABRT: Invalid URI: The URI scheme is not valid.
Hello This is a strange crash on iOS in .Net Maui particularly on application startup the first but the second or on subsequent...
Read more >
Invalid URI: The Uri string is too long.
I try to send a file to a website. ... With smaller file works all fine, but with a bit bigger file i...
Read more >
Invalid URI: the Uri string is too long
[size="3"]Hi All, I am experiencing the following error using ASPRunner.NET: [/size] Description: An unhandled exception occurred during the ...
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