You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[XSG] OnIdiom nested inside OnPlatform throws "Cannot determine property to provide the value for" on Android #39341
A property set to {OnPlatform Android={OnIdiom ...}} crashes on launch on Android when the XAML is compiled by the source generator. The same XAML works with <MauiXamlInflator>XamlC</MauiXamlInflator> and worked on .NET 8.
The reverse nesting fails the same way with the same exception:
<LabelText="{OnIdiom Phone={OnPlatform Android=PhoneAndroid, Default=PhoneOther}, Default=Other}" />
### Steps to Reproduce
1. `dotnet new maui`, keep only the `net11.0-android` target.
2. Replace the content of `MainPage.xaml` with:
```xml
<ContentPagexmlns="http://schemas.microsoft.com/dotnet/2021/maui"xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"x:Class="NestedOnIdiomRepro.MainPage">
<LabelText="{OnPlatform Android={OnIdiom Phone=Phone, Default=Other}, Default=Other}" />
</ContentPage>
Expected Behavior
The app starts and the label shows "Phone" on a phone and "Other" elsewhere.
Actual Behavior
The app crashes on launch:
FATAL EXCEPTION: main
android.runtime.JavaProxyThrowable: [System.InvalidOperationException]: Cannot determine property to provide the value for.
at Microsoft.Maui.Controls.Xaml.OnIdiomExtension.ProvideValue(/_/src/Controls/src/Xaml/MarkupExtensions/OnIdiomExtension.cs:90)
at NestedOnIdiomRepro.MainPage.InitializeComponent(obj/Debug/net11.0-android/generated/Microsoft.Maui.Controls.SourceGen/Microsoft.Maui.Controls.SourceGen.XamlGenerator/MainPage.xaml.xsg.cs)
at NestedOnIdiomRepro.MainPage..ctor(MainPage.xaml.cs:7)
Link to public reproduction project repository
No response
Version with bug
11.0.0-rc.1
Is this a regression from previous behavior?
No, this is something new
Last version that worked well
Unknown/Other
Affected platforms
Android
Affected platform versions
Android
Did you find any workaround?
Disable XSG with <MauiXamlInflator>XamlC</MauiXamlInflator> in the csproj
This issue has been validated in Visual Studio Code 1.141.0 with .NET MAUI versions 10.0.110, 11.0.0-preview1 and 11.0.0-rc1. It is reproducible on the Android platform from 11.0.0-preview1. I have attached the sample and output below.
Sample: Issue34391.zip
Closed by #39373 (merged to net11.0). GitHub only auto-closes for PRs merged to the default branch; this issue was fixed by a PR merged to a non-default branch.
Activity
HarishKumarSF4517 commentedon Oct 13, 2026
This issue has been validated in Visual Studio Code 1.141.0 with .NET MAUI versions 10.0.110, 11.0.0-preview1 and 11.0.0-rc1. It is reproducible on the Android platform from 11.0.0-preview1. I have attached the sample and output below.
Sample: Issue34391.zip
Output
Fix nested OnPlatform and OnIdiom source generation (#39373)
github-actions commentedon Oct 14, 2026
Closed by #39373 (merged to
net11.0). GitHub only auto-closes for PRs merged to the default branch; this issue was fixed by a PR merged to a non-default branch.