Skip to content

Conversation

@StephaneDelcroix
Copy link
Contributor

Description of Change

fixes 3 failing tests related to OnPlatform

fixes 3 failing tests related to OnPlatform
Copilot AI review requested due to automatic review settings August 27, 2025 14:23
@StephaneDelcroix StephaneDelcroix requested a review from a team as a code owner August 27, 2025 14:23
Copy link
Contributor

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 fixes a code generation issue in the XAML source generator related to double casting when adding items to collections. The fix addresses 3 failing tests that were experiencing issues with OnPlatform functionality by properly handling intermediate implicit conversions during collection item addition.

  • Removes conditional compilation directives from test methods that were limiting test parameter values
  • Adds logic to detect and handle double implicit conversions in the source generator's Add method
  • Ensures proper casting chain when adding items to collections that require intermediate type conversions

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
src/Controls/tests/Xaml.UnitTests/Issues/Maui4509.xaml.cs Removes conditional compilation blocks from OnPlatform test methods
src/Controls/tests/Xaml.UnitTests/Issues/Maui24900.xaml.cs Removes conditional compilation blocks from OnPlatform test method
src/Controls/src/SourceGen/Visitors/SetPropertiesVisitor.cs Adds double implicit conversion detection and intermediate casting logic

Comment on lines +621 to +624
//look for intermediate implicit casts
string cast = string.Empty;
if (HasDoubleImplicitConversion(context.Variables[valueNode].Type, itemType, context, out var conv))
cast = "(" + conv!.ReturnType.ToFQDisplayString() + ")";
Copy link

Copilot AI Aug 27, 2025

Choose a reason for hiding this comment

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

The method HasDoubleImplicitConversion is called but not defined in this file or visible in the diff. This will cause a compilation error unless this method exists elsewhere in the class or is imported.

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

get out, Copilot, you're drunk

//look for intermediate implicit casts
string cast = string.Empty;
if (HasDoubleImplicitConversion(context.Variables[valueNode].Type, itemType, context, out var conv))
cast = "(" + conv!.ReturnType.ToFQDisplayString() + ")";
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
cast = "(" + conv!.ReturnType.ToFQDisplayString() + ")";
cast = $"({conv!.ReturnType.ToFQDisplayString()})";

@StephaneDelcroix StephaneDelcroix merged commit 037ae97 into net10.0 Aug 28, 2025
150 checks passed
@StephaneDelcroix StephaneDelcroix deleted the dev/stdelc/xsg/doublecastOnAdd branch August 28, 2025 08:01
@github-actions github-actions bot locked and limited conversation to collaborators Sep 27, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants