dotnet / dotnet/maui

OnPlatform for Grid not using the extension to enable AOT

Open
#30,770 2 comments 0 reactions 0 assignees View on GitHub
layout-grid platform/android platform/ios platform/macos platform/windows s/triaged s/verified t/bug
Dominant language
C#
Stars
23.3k
Forks
2k
Avg merge
1d 15h
Merged PRs (30d)
290

Description

### Description

Im trying to use the non extension version of OnPlatform so we can turn on AOT and app trimming but i cant find a good example of ColumnDefinitions and RowDefinitions except from Xamarin which compiles but crashes at runtime

Hopefully this is just a syntax error

### Steps to Reproduce

Create new Maui app
Add a grid to xaml
Add a ColumnDefinition with OnPlatform

```







```
Run the app

### Link to public reproduction project repository

https://github.com/duindain/onPlatformMaui/tree/main

### Version with bug

9.0.90 SR9

### Is this a regression from previous behavior?

Not sure, did not test other versions

### Last version that worked well

Unknown/Other

### Affected platforms

iOS, Android, Windows

### Affected platform versions

_No response_

### Did you find any workaround?

The platformextension works fine

But then we wont be able to enable AOT and app trimming

### Relevant log output

```shell
Exception thrown: 'Microsoft.Maui.Controls.Xaml.XamlParseException' in Microsoft.Maui.Controls.Xaml.dll
An exception of type 'Microsoft.Maui.Controls.Xaml.XamlParseException' occurred in Microsoft.Maui.Controls.Xaml.dll but was not handled in user code
Position 17:66. Type converter failed: Specified method is not supported.
```

Contributor guide

Open the contributing guide

Research direction

Start with the public reproduction project at https://github.com/duindain/onPlatformMaui and run the XAML Grid example on an affected platform. Inspect the non-extension OnPlatform usage for ColumnDefinition.Width and the reported XamlParseException at Position 17:66. Done means the non-extension syntax works without the type-converter exception while preserving the AOT and trimming scenario.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, xml
Domain
frontend, mobile
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 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.