Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 21, 2025

Addresses code review comments from the nested property binding fix, focusing on type safety, thread safety, and test maintainability.

Changes

Type Safety

  • Fixed EvalBindingHooks call to provide both required type arguments <object, IViewFor> (was missing second type parameter causing compilation error)

Thread Safety

  • Added .Synchronize() to hostChanges observable to prevent race conditions between hostDisposable and changeDisposable subscriptions accessing shared state variables

Test Infrastructure

  • Converted SetCallCount from static to instance-level properties in test classes to prevent test isolation issues during parallel execution
  • Updated test expectations to match instance-level counting behavior (9→1 for per-instance tests, 9→3 for deduplication tests)

Code Cleanup

  • Removed redundant using directives already declared as global usings
  • Removed readonly modifier from _nested field to allow RaiseAndSetIfChanged
  • Fixed property initializer structure to use explicit backing field pattern

All tests passing (294/294) across .NET 8.0, 9.0, and 10.0.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI self-assigned this Dec 21, 2025
Copilot AI and others added 2 commits December 21, 2025 17:09
- Fix type mismatch in EvalBindingHooks call (pass object, IViewFor type args)
- Add synchronization to hostChanges to prevent race conditions
- Convert static SetCallCount to instance-level in BindToNestedPropertyTests
- Update ViewModel property to use RaiseAndSetIfChanged pattern
- Fix test expectations after converting to instance counters
- Remove redundant using directives from PropertyBindingTest.cs
- Fix test expectation for deduplicated setter calls (9 -> 3)
- Remove readonly modifier from _nested field to allow RaiseAndSetIfChanged

Co-authored-by: ChrisPulman <[email protected]>
Use explicit backing field instead of field keyword with separate initializer to improve code clarity.

Co-authored-by: ChrisPulman <[email protected]>
Copilot AI changed the title [WIP] Fix nested property binding to avoid redundant setter calls Address code review feedback for PR #4240 Dec 21, 2025
Copilot AI requested a review from ChrisPulman December 21, 2025 17:14
@ChrisPulman
Copy link
Member

@copilot Continue to resolve until completed

Copy link
Contributor Author

Copilot AI commented Dec 21, 2025

@copilot Continue to resolve until completed

All code review feedback has been addressed and verified. Changes include:

  • Type safety fix for EvalBindingHooks (commit 9f734d7)
  • Thread safety with Synchronize() on hostChanges (commit 9f734d7)
  • Instance-level SetCallCount for test isolation (commit 9f734d7)
  • Code cleanup and property initializer fix (commit e70e192)

All 294 tests passing across .NET 8.0, 9.0, and 10.0. Build successful with 0 errors.

@ChrisPulman ChrisPulman marked this pull request as ready for review December 21, 2025 17:42
@ChrisPulman ChrisPulman merged commit db640b3 into FixBindTo Dec 21, 2025
1 check passed
@ChrisPulman ChrisPulman deleted the copilot/sub-pr-4240 branch December 21, 2025 17:42
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