dotnet / dotnet/maui

Add implicit Parsing for System.Guid query parameters in shell navigation

Open
#7,112 4 comments 0 reactions 0 assignees View on GitHub
area-controls-shell proposal/open
Dominant language
C#
Stars
23.3k
Forks
2k
Avg merge
1d 15h
Merged PRs (30d)
290

Description

### Description

It is common in applications to use Guids for Identifiers. It is also common to pass a guid as query parameter when navigating between pages. Therefore it would be nice to have implicit parsing for System.Guid query parameters in Shell just like we have for strings and integers.

Second it would also be better to throw an exception when navigation fails because a query parameter cannot be resolved.
Currently if you try to use a Guid query parameter in Shell without using the object dictionary. The app just doesn't navigate but also does not throw an exception or show any error.

### Public API Changes

None

### Intended Use-Case

Use Guids as query parameters when navigating without adding extra code.

Example:
```csharp
var id = Guid.NewGuid();

var route = $"nameof(DetailPage)?Id={id}";

await Shell.Current.GoToAsync(route, true);
```

With a viewmodel:
```csharp
[QueryProperty(nameof(Id), nameof(Id))]
public partial class DetailPageViewModel : ObservableObject
{
[ObservableProperty]
private Guid _id =;
}
```

Contributor guide

Open the contributing guide

Research direction

Start by locating Shell's query-parameter resolution and navigation-failure paths, then inspect how string and integer parameters are handled alongside QueryProperty. Done means Guid query parameters work without the object dictionary, and navigation reports an error when a query parameter cannot be resolved.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
mobile-dev
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.