Skip to content

Conversation

@IsmailHassani
Copy link
Contributor

@IsmailHassani IsmailHassani commented Nov 30, 2025

The Release mode build was failing with error MAUIG1001: "Value cannot be null. (Parameter 'key')" on iOS, Android, and macCatalyst platforms.

Root cause: The MAUI XAML source generator cannot parse nested markup extensions when a custom markup extension ({m:GetString}) is used inside another markup extension ({OnPlatform}).

Fix: Changed the RefreshButtonStyle's Text property from inline nested syntax:
Value="{OnPlatform WinUI={m:GetString Refresh}}"

To expanded element syntax:


This allows the source generator to properly parse and defer the custom markup extension evaluation to runtime.

Summary by CodeRabbit

  • Style
    • Updated internal styling structure for improved consistency and maintainability.

Note: This release contains no user-facing changes.

✏️ Tip: You can customize this high-level summary in your review settings.

The Release mode build was failing with error MAUIG1001: "Value cannot be null.
(Parameter 'key')" on iOS, Android, and macCatalyst platforms.

Root cause: The MAUI XAML source generator cannot parse nested markup extensions
when a custom markup extension ({m:GetString}) is used inside another markup
extension ({OnPlatform}).

Fix: Changed the RefreshButtonStyle's Text property from inline nested syntax:
  Value="{OnPlatform WinUI={m:GetString Refresh}}"

To expanded element syntax:
  <OnPlatform x:TypeArguments="x:String">
    <On Platform="WinUI" Value="{m:GetString Refresh}" />
  </OnPlatform>

This allows the source generator to properly parse and defer the custom markup
extension evaluation to runtime.
Copilot AI review requested due to automatic review settings November 30, 2025 20:33
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR resolves a MAUI XAML source generator error (MAUIG1001) that occurred during Release mode builds on iOS, Android, and macCatalyst platforms. The error was caused by nested markup extensions in the RefreshButtonStyle where a custom markup extension was used inside an OnPlatform markup extension.

Key Changes:

  • Converted inline nested markup extension syntax to expanded element syntax for the RefreshButtonStyle's Text property
  • This change enables proper parsing by the MAUI XAML source generator while maintaining identical runtime functionality

You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 30, 2025

Walkthrough

A XAML style definition was modified in the RefreshButtonStyle to restructure how the Text setter's platform-specific value is defined. The OnPlatform expression was moved from directly within the Value attribute to an explicit OnPlatform element nested inside a Setter.Value block, altering the XML structure without changing functional behavior.

Changes

Cohort / File(s) Summary
RefreshButtonStyle restructuring
samples/Sample.Maui/Resources/Styles/Style.xaml
Modified Text setter definition from direct OnPlatform expression to explicit Setter.Value wrapping with nested OnPlatform element

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

  • Verify XAML syntax correctness and proper nesting of OnPlatform element
  • Confirm the style compiles and applies the intended platform-specific text values
  • Check that the restructured setter maintains functional equivalence across iOS and Android platforms

Poem

🐰 Hops through XAML files with care,
Restructuring setters here and there,
OnPlatform nested, tidy and bright,
Platform-specific styles get it right!
Styles refined with a bunny's delight ✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title appears to have a typo ('esolve' instead of 'Resolve'), but clearly relates to fixing a MAUI XAML source generator error caused by nested markup extensions, which matches the PR objectives.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch development/nuget

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
samples/Sample.Maui/Resources/Styles/Style.xaml (1)

957-968: Expanded Setter.Value with OnPlatform cleanly works around the source‑generator bug

Switching from the inline Value="{OnPlatform WinUI={m:GetString Refresh}}" to the Setter.Value + <OnPlatform x:TypeArguments="x:String"> element syntax is correct here and should avoid the MAUIG1001 issue while preserving behavior (only WinUI gets the localized Refresh string; other platforms still get the default value as before).

If you intend to show a text label on non‑WinUI platforms as well, you could optionally add an additional <On Platform="Default" ... />, but that’s outside the scope of this fix.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 843e4b8 and 2d61d6d.

📒 Files selected for processing (1)
  • samples/Sample.Maui/Resources/Styles/Style.xaml (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: I-Synergy.Framework PR (Build Build, test and pack assemblies)

@IsmailHassani IsmailHassani merged commit b388018 into main Nov 30, 2025
6 checks passed
@IsmailHassani IsmailHassani deleted the development/nuget branch November 30, 2025 21:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants