Skip to content

Fix DataTrigger/BindingCondition for null initial values - #39953

Merged
kubaflo merged 3 commits into
dotnet:candidate/11.0.1xx-sr2from
fmazzant:fix-6847-datatrigger-null-initial-value
Nov 11, 2026
Merged

kubaflo merged 3 commits into
dotnet:candidate/11.0.1xx-sr2from
fmazzant:fix-6847-datatrigger-null-initial-value

Conversation

@fmazzant

@fmazzant fmazzant commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Refactor BindingCondition to track state via a new attached property, ensuring triggers apply correctly when the bound value is initially null. Update property change logic to only raise ConditionChanged on actual state changes. Add unit tests to verify correct behavior with null values and MultiTrigger scenarios, addressing issue #6847.

Fixes #6847

@fmazzant
fmazzant temporarily deployed to copilot-pat-pool November 6, 2026 06:21 — with GitHub Actions Inactive
@github-actions

github-actions Bot commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

🚀 Dogfood this PR with:

⚠️ WARNING: Do not do this without first carefully reviewing the code of this PR to satisfy yourself it is safe.

curl -fsSL https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.sh | bash -s -- 39953

Or

  • Run remotely in PowerShell:
iex "& { $(irm https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.ps1) } 39953"

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

@fmazzant
fmazzant temporarily deployed to copilot-pat-pool November 6, 2026 06:21 — with GitHub Actions Inactive
@dotnet-policy-service dotnet-policy-service Bot added the community ✨ Community Contribution label Nov 6, 2026
@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Hey there @@fmazzant! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed.

@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Hey there @fmazzant! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed.

@fmazzant

fmazzant commented Nov 6, 2026 via email

Copy link
Copy Markdown
Contributor Author

Refactor BindingCondition to track state via a new attached property, ensuring triggers apply correctly when the bound value is initially null. Update property change logic to only raise ConditionChanged on actual state changes. Add unit tests to verify correct behavior with null values and MultiTrigger scenarios, addressing issue dotnet#6847.
@fmazzant
fmazzant force-pushed the fix-6847-datatrigger-null-initial-value branch from 270d307 to 470ae59 Compare November 6, 2026 07:11
@kubaflo

This comment has been minimized.

@github-actions github-actions Bot added the s/agent-review-in-progress AI review is currently running for this PR label Nov 6, 2026
@kubaflo

This comment has been minimized.

@azure-pipelines

This comment has been minimized.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Expert Review — 2 findings

Reviewed commit 470ae59.

See inline comments for details.

@MauiBot

This comment has been minimized.

@MauiBot MauiBot added s/agent-gate-passed AI verified tests catch the bug (fail without fix, pass with fix) and removed s/agent-review-in-progress AI review is currently running for this PR labels Nov 6, 2026
Refactor BindingCondition to track state via a new attached property, ensuring triggers apply correctly when the bound value is initially null. Update property change logic to only raise ConditionChanged on actual state changes. Add unit tests to verify correct behavior with null values and MultiTrigger scenarios, addressing issue dotnet#6847.
@kubaflo

This comment has been minimized.

@github-actions github-actions Bot added the s/agent-review-in-progress AI review is currently running for this PR label Nov 6, 2026
@kubaflo

This comment has been minimized.

@azure-pipelines

This comment has been minimized.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Expert Review — 0 findings

Reviewed commit 402dc87.

@MauiBot

This comment has been minimized.

@MauiBot MauiBot removed the s/agent-review-in-progress AI review is currently running for this PR label Nov 9, 2026

@fmazzant fmazzant left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I've reviewed it, thanks

@kubaflo

This comment has been minimized.

@github-actions github-actions Bot added the s/agent-review-in-progress AI review is currently running for this PR label Nov 9, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Expert Review — 0 findings

Reviewed commit 402dc87.

@MauiBot

MauiBot commented Nov 9, 2026

Copy link
Copy Markdown
Collaborator

PR Test Gate

@fmazzant — existing-test verification for commit 402dc879.

Result PASSED Platform Android Commit 402dc879


🧪 Gate analysis — click to expand

✅ Passed. The selected verification satisfied the gate's passing conditions. Unmatched, skipped, or inconclusive groups are not passing evidence.

🧪 Unit tests
Test group Without fix With fix
DataTriggerTests ✅ Failed as expected (73s) ✅ Passed (45s)
Execution log excerpts

Without fix DataTriggerTests

     at Microsoft.Maui.Controls.Core.UnitTests.DataTriggerTests.SettersAppliedOnAttachIfBoundValueIsInitiallyNull() in /_/src/Controls/tests/Core.UnitTests/DataTriggerTests.cs:line 172
   at System.Reflection.MethodBaseInvoker.InterpretedInvoke_Method(Object obj, IntPtr* args)
   at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)
     at Microsoft.Maui.Controls.Core.UnitTests.DataTriggerTests.RemovingNullValueTriggerWhileBoundValueIsNonNullDoesNotReapply() in /_/src/Controls/tests/Core.UnitTests/DataTriggerTests.cs:line 259

With fix DataTriggerTests

.Controls.Core.UnitTests.dll (.NETCoreApp,Version=v11.0)
A total of 1 test files matched the specified pattern.
[xUnit.net 00:00:00.00] xUnit.net VSTest Adapter v2.8.2+699d445a1a (64-bit .NET 11.0.0)
[xUnit.net 00:00:00.37]   Discovering: Microsoft.Maui.Controls.Core.UnitTests
[xUnit.net 00:00:05.09]   Discovered:  Microsoft.Maui.Controls.Core.UnitTests
[xUnit.net 00:00:05.13]   Starting:    Microsoft.Maui.Controls.Core.UnitTests
  Passed AllTriggersUnappliedBeforeApplying [95 ms]
  Passed SettersUnappliedOnDetach [5 ms]
  Passed SettersAppliedOnAttachIfConditionIsTrue [< 1 ms]
  Passed MultiTriggerWithNullBindingConditionAppliedOnAttach [2 ms]
  Passed SettersAppliedOnAttachIfBoundValueIsInitiallyNull [< 1 ms]
  Passed TriggersAppliedOnMultipleElements [< 1 ms]
  Passed ReentrantBindingChangesFromEnterActionKeepFinalState [1 ms]
  Passed SettersNotUnappliedWhenNullValueTriggerNeverMatched [< 1 ms]
  Passed SettersAppliedOnConditionChanged [< 1 ms]
[xUnit.net 00:00:05.42]   Finished:    Microsoft.Maui.Controls.Core.UnitTests
  Passed RemovingNullValueTriggerWhileBoundValueIsNonNullDoesNotReapply [4 ms]
Test Run Successful.
Total tests: 10
     Passed: 10
 Total time: 6.2855 Seconds

PR head: 402dc879.

Without-fix baseline: 0167a060.

@MauiBot MauiBot removed the s/agent-review-in-progress AI review is currently running for this PR label Nov 9, 2026
@kubaflo
kubaflo changed the base branch from inflight/11.0.1xx-sr2 to candidate/11.0.1xx-sr2 November 11, 2026 00:43
@kubaflo
kubaflo merged commit c1d6bfd into dotnet:candidate/11.0.1xx-sr2 Nov 11, 2026
144 of 176 checks passed
kubaflo added a commit that referenced this pull request Nov 11, 2026
Refactor BindingCondition to track state via a new attached property,
ensuring triggers apply correctly when the bound value is initially
null. Update property change logic to only raise ConditionChanged on
actual state changes. Add unit tests to verify correct behavior with
null values and MultiTrigger scenarios, addressing issue #6847.

Fixes #6847

Co-authored-by: Jakub Florkowski <42434498+kubaflo@users.noreply.github.com>
kubaflo added a commit that referenced this pull request Nov 13, 2026
Refactor BindingCondition to track state via a new attached property,
ensuring triggers apply correctly when the bound value is initially
null. Update property change logic to only raise ConditionChanged on
actual state changes. Add unit tests to verify correct behavior with
null values and MultiTrigger scenarios, addressing issue #6847.

Fixes #6847

Co-authored-by: Jakub Florkowski <42434498+kubaflo@users.noreply.github.com>
kubaflo added a commit that referenced this pull request Nov 16, 2026
Refactor BindingCondition to track state via a new attached property,
ensuring triggers apply correctly when the bound value is initially
null. Update property change logic to only raise ConditionChanged on
actual state changes. Add unit tests to verify correct behavior with
null values and MultiTrigger scenarios, addressing issue #6847.

Fixes #6847

Co-authored-by: Jakub Florkowski <42434498+kubaflo@users.noreply.github.com>
kubaflo added a commit that referenced this pull request Nov 16, 2026
Refactor BindingCondition to track state via a new attached property,
ensuring triggers apply correctly when the bound value is initially
null. Update property change logic to only raise ConditionChanged on
actual state changes. Add unit tests to verify correct behavior with
null values and MultiTrigger scenarios, addressing issue #6847.

Fixes #6847

Co-authored-by: Jakub Florkowski <42434498+kubaflo@users.noreply.github.com>
kubaflo added a commit that referenced this pull request Nov 17, 2026
Refactor BindingCondition to track state via a new attached property,
ensuring triggers apply correctly when the bound value is initially
null. Update property change logic to only raise ConditionChanged on
actual state changes. Add unit tests to verify correct behavior with
null values and MultiTrigger scenarios, addressing issue #6847.

Fixes #6847

Co-authored-by: Jakub Florkowski <42434498+kubaflo@users.noreply.github.com>
kubaflo added a commit that referenced this pull request Nov 18, 2026
Refactor BindingCondition to track state via a new attached property,
ensuring triggers apply correctly when the bound value is initially
null. Update property change logic to only raise ConditionChanged on
actual state changes. Add unit tests to verify correct behavior with
null values and MultiTrigger scenarios, addressing issue #6847.

Fixes #6847

Co-authored-by: Jakub Florkowski <42434498+kubaflo@users.noreply.github.com>
kubaflo added a commit that referenced this pull request Nov 18, 2026
Refactor BindingCondition to track state via a new attached property,
ensuring triggers apply correctly when the bound value is initially
null. Update property change logic to only raise ConditionChanged on
actual state changes. Add unit tests to verify correct behavior with
null values and MultiTrigger scenarios, addressing issue #6847.

Fixes #6847

Co-authored-by: Jakub Florkowski <42434498+kubaflo@users.noreply.github.com>
kubaflo added a commit that referenced this pull request Nov 18, 2026
Refactor BindingCondition to track state via a new attached property,
ensuring triggers apply correctly when the bound value is initially
null. Update property change logic to only raise ConditionChanged on
actual state changes. Add unit tests to verify correct behavior with
null values and MultiTrigger scenarios, addressing issue #6847.

Fixes #6847

Co-authored-by: Jakub Florkowski <42434498+kubaflo@users.noreply.github.com>
kubaflo added a commit that referenced this pull request Nov 19, 2026
Refactor BindingCondition to track state via a new attached property,
ensuring triggers apply correctly when the bound value is initially
null. Update property change logic to only raise ConditionChanged on
actual state changes. Add unit tests to verify correct behavior with
null values and MultiTrigger scenarios, addressing issue #6847.

Fixes #6847

Co-authored-by: Jakub Florkowski <42434498+kubaflo@users.noreply.github.com>
kubaflo added a commit that referenced this pull request Nov 22, 2026
Refactor BindingCondition to track state via a new attached property,
ensuring triggers apply correctly when the bound value is initially
null. Update property change logic to only raise ConditionChanged on
actual state changes. Add unit tests to verify correct behavior with
null values and MultiTrigger scenarios, addressing issue #6847.

Fixes #6847

Co-authored-by: Jakub Florkowski <42434498+kubaflo@users.noreply.github.com>
kubaflo added a commit that referenced this pull request Nov 23, 2026
Refactor BindingCondition to track state via a new attached property,
ensuring triggers apply correctly when the bound value is initially
null. Update property change logic to only raise ConditionChanged on
actual state changes. Add unit tests to verify correct behavior with
null values and MultiTrigger scenarios, addressing issue #6847.

Fixes #6847

Co-authored-by: Jakub Florkowski <42434498+kubaflo@users.noreply.github.com>
@kubaflo kubaflo added this to the .NET 11 SR2 milestone Nov 24, 2026
KarthikRajaKalaimani pushed a commit to KarthikRajaKalaimani/maui that referenced this pull request Nov 26, 2026
Refactor BindingCondition to track state via a new attached property,
ensuring triggers apply correctly when the bound value is initially
null. Update property change logic to only raise ConditionChanged on
actual state changes. Add unit tests to verify correct behavior with
null values and MultiTrigger scenarios, addressing issue dotnet#6847.

Fixes dotnet#6847

Co-authored-by: Jakub Florkowski <42434498+kubaflo@users.noreply.github.com>
@fmazzant
fmazzant deleted the fix-6847-datatrigger-null-initial-value branch December 2, 2026 15:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community ✨ Community Contribution s/agent-gate-passed AI verified tests catch the bug (fail without fix, pass with fix)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] DataTrigger not applied when null at initial

3 participants