Skip to content

[XSG] OnIdiom nested inside OnPlatform throws "Cannot determine property to provide the value for" on Android #39341

Closed

Description

@id1sm

Description

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:

<Label Text="{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
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             x:Class="NestedOnIdiomRepro.MainPage">
	<Label Text="{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

Relevant log output

Activity

  1. added
    t/bug
    on Oct 12, 2026
  2. added
    area-xaml
    on Oct 12, 2026
  3. HarishKumarSF4517 commented on Oct 13, 2026

    @HarishKumarSF4517
    Contributor

    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

    10.0.110(Issue not reproduced) 11.0.0-preview1(Issue reproduced)
    Image Image
  4. added
    s/verified
    s/triaged
    on Oct 13, 2026
  5. added
    partner/syncfusion
    on Oct 14, 2026
  6. added a commit that references this issue on Oct 14, 2026
    ae1ffe3
  7. github-actions commented on Oct 14, 2026

    @github-actions
    Contributor

    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.

  8. added this to the .NET 11.0-rc2 milestone on Oct 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-xamlpartner/syncfusionplatform/androids/triageds/verifiedt/bug

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions