Repository navigation
[iOS & Mac] Fix NullReferenceException in CollectionViewHandler2 after handler restore when property changes - #36073
Merged
Conversation
…r handler restore when ItemsLayout property changes
SubhikshaSf4851
temporarily deployed
to
gh-aw-agents
June 23, 2026 06:29 — with
GitHub Actions
Inactive
SubhikshaSf4851
temporarily deployed
to
gh-aw-agents
June 23, 2026 06:29 — with
GitHub Actions
Inactive
sheiksyedm
marked this pull request as ready for review
June 25, 2026 04:55
kubaflo
pushed a commit
that referenced
this pull request
Jun 25, 2026
…r handler restore when property changes (#36073) <!-- Please keep the note below for people who find this PR --> > [!NOTE] > Are you waiting for the changes in this PR to be merged? > It would be very helpful if you could [test the resulting artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment whether this change resolves your issue. Thank you! <!-- !!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING MAIN. !!!!!!! --> This pull request addresses a regression issue where `CollectionViewHandler2` could throw a `NullReferenceException` if a layout property changed after the handler was disconnected and then reconnected. The fix ensures the internal cache is properly reinitialized, and new tests are added to verify the handler's stability in these scenarios. ### Description of Change **Bug fix:** - Ensured `_layoutPropertyCache` is reinitialized when subscribing to a new items layout in `CollectionViewHandler2`, preventing `NullReferenceException` after handler disconnect/reconnect cycles. **Testing improvements:** - Added regression tests to confirm that changing properties on `GridItemsLayout` and `LinearItemsLayout` after a disconnect/restore cycle does not cause crashes in `CollectionViewHandler2`. These tests cover various property changes and validate the fix <!-- Enter description of the fix in this section --> ### Issues Fixed <!-- Please make sure that there is a bug logged for the issue being fixed. The bug should describe the problem and how to reproduce it. --> Fixes #36010 ### Tested the behavior in the following platforms - [ ] Windows - [ ] Android - [x] iOS - [x] Mac | Before Issue Fix | After Issue Fix | |----------|----------| | <img width="954" height="693" alt="BeforeFix36010" src="https://github.com/user-attachments/assets/fb32509b-ce7c-497c-9fa4-3170181e9475" /> | <img width="947" height="689" alt="AfterFix36010" src="https://github.com/user-attachments/assets/188f6e3b-6b72-4ead-9af0-342d5d8d7c20" /> | <!-- Are you targeting main? All PRs should target the main branch unless otherwise noted. -->
kubaflo
pushed a commit
that referenced
this pull request
Jul 3, 2026
…r handler restore when property changes (#36073) <!-- Please keep the note below for people who find this PR --> > [!NOTE] > Are you waiting for the changes in this PR to be merged? > It would be very helpful if you could [test the resulting artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment whether this change resolves your issue. Thank you! <!-- !!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING MAIN. !!!!!!! --> This pull request addresses a regression issue where `CollectionViewHandler2` could throw a `NullReferenceException` if a layout property changed after the handler was disconnected and then reconnected. The fix ensures the internal cache is properly reinitialized, and new tests are added to verify the handler's stability in these scenarios. ### Description of Change **Bug fix:** - Ensured `_layoutPropertyCache` is reinitialized when subscribing to a new items layout in `CollectionViewHandler2`, preventing `NullReferenceException` after handler disconnect/reconnect cycles. **Testing improvements:** - Added regression tests to confirm that changing properties on `GridItemsLayout` and `LinearItemsLayout` after a disconnect/restore cycle does not cause crashes in `CollectionViewHandler2`. These tests cover various property changes and validate the fix <!-- Enter description of the fix in this section --> ### Issues Fixed <!-- Please make sure that there is a bug logged for the issue being fixed. The bug should describe the problem and how to reproduce it. --> Fixes #36010 ### Tested the behavior in the following platforms - [ ] Windows - [ ] Android - [x] iOS - [x] Mac | Before Issue Fix | After Issue Fix | |----------|----------| | <img width="954" height="693" alt="BeforeFix36010" src="https://github.com/user-attachments/assets/fb32509b-ce7c-497c-9fa4-3170181e9475" /> | <img width="947" height="689" alt="AfterFix36010" src="https://github.com/user-attachments/assets/188f6e3b-6b72-4ead-9af0-342d5d8d7c20" /> | <!-- Are you targeting main? All PRs should target the main branch unless otherwise noted. -->
Merged
kubaflo
pushed a commit
that referenced
this pull request
Jul 6, 2026
…r handler restore when property changes (#36073) <!-- Please keep the note below for people who find this PR --> > [!NOTE] > Are you waiting for the changes in this PR to be merged? > It would be very helpful if you could [test the resulting artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment whether this change resolves your issue. Thank you! <!-- !!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING MAIN. !!!!!!! --> This pull request addresses a regression issue where `CollectionViewHandler2` could throw a `NullReferenceException` if a layout property changed after the handler was disconnected and then reconnected. The fix ensures the internal cache is properly reinitialized, and new tests are added to verify the handler's stability in these scenarios. ### Description of Change **Bug fix:** - Ensured `_layoutPropertyCache` is reinitialized when subscribing to a new items layout in `CollectionViewHandler2`, preventing `NullReferenceException` after handler disconnect/reconnect cycles. **Testing improvements:** - Added regression tests to confirm that changing properties on `GridItemsLayout` and `LinearItemsLayout` after a disconnect/restore cycle does not cause crashes in `CollectionViewHandler2`. These tests cover various property changes and validate the fix <!-- Enter description of the fix in this section --> ### Issues Fixed <!-- Please make sure that there is a bug logged for the issue being fixed. The bug should describe the problem and how to reproduce it. --> Fixes #36010 ### Tested the behavior in the following platforms - [ ] Windows - [ ] Android - [x] iOS - [x] Mac | Before Issue Fix | After Issue Fix | |----------|----------| | <img width="954" height="693" alt="BeforeFix36010" src="https://github.com/user-attachments/assets/fb32509b-ce7c-497c-9fa4-3170181e9475" /> | <img width="947" height="689" alt="AfterFix36010" src="https://github.com/user-attachments/assets/188f6e3b-6b72-4ead-9af0-342d5d8d7c20" /> | <!-- Are you targeting main? All PRs should target the main branch unless otherwise noted. -->
PureWeen
pushed a commit
that referenced
this pull request
Jul 7, 2026
…r handler restore when property changes (#36073) <!-- Please keep the note below for people who find this PR --> > [!NOTE] > Are you waiting for the changes in this PR to be merged? > It would be very helpful if you could [test the resulting artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment whether this change resolves your issue. Thank you! <!-- !!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING MAIN. !!!!!!! --> This pull request addresses a regression issue where `CollectionViewHandler2` could throw a `NullReferenceException` if a layout property changed after the handler was disconnected and then reconnected. The fix ensures the internal cache is properly reinitialized, and new tests are added to verify the handler's stability in these scenarios. ### Description of Change **Bug fix:** - Ensured `_layoutPropertyCache` is reinitialized when subscribing to a new items layout in `CollectionViewHandler2`, preventing `NullReferenceException` after handler disconnect/reconnect cycles. **Testing improvements:** - Added regression tests to confirm that changing properties on `GridItemsLayout` and `LinearItemsLayout` after a disconnect/restore cycle does not cause crashes in `CollectionViewHandler2`. These tests cover various property changes and validate the fix <!-- Enter description of the fix in this section --> ### Issues Fixed <!-- Please make sure that there is a bug logged for the issue being fixed. The bug should describe the problem and how to reproduce it. --> Fixes #36010 ### Tested the behavior in the following platforms - [ ] Windows - [ ] Android - [x] iOS - [x] Mac | Before Issue Fix | After Issue Fix | |----------|----------| | <img width="954" height="693" alt="BeforeFix36010" src="https://github.com/user-attachments/assets/fb32509b-ce7c-497c-9fa4-3170181e9475" /> | <img width="947" height="689" alt="AfterFix36010" src="https://github.com/user-attachments/assets/188f6e3b-6b72-4ead-9af0-342d5d8d7c20" /> | <!-- Are you targeting main? All PRs should target the main branch unless otherwise noted. -->
PureWeen
pushed a commit
that referenced
this pull request
Jul 7, 2026
…r handler restore when property changes (#36073) <!-- Please keep the note below for people who find this PR --> > [!NOTE] > Are you waiting for the changes in this PR to be merged? > It would be very helpful if you could [test the resulting artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment whether this change resolves your issue. Thank you! <!-- !!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING MAIN. !!!!!!! --> This pull request addresses a regression issue where `CollectionViewHandler2` could throw a `NullReferenceException` if a layout property changed after the handler was disconnected and then reconnected. The fix ensures the internal cache is properly reinitialized, and new tests are added to verify the handler's stability in these scenarios. ### Description of Change **Bug fix:** - Ensured `_layoutPropertyCache` is reinitialized when subscribing to a new items layout in `CollectionViewHandler2`, preventing `NullReferenceException` after handler disconnect/reconnect cycles. **Testing improvements:** - Added regression tests to confirm that changing properties on `GridItemsLayout` and `LinearItemsLayout` after a disconnect/restore cycle does not cause crashes in `CollectionViewHandler2`. These tests cover various property changes and validate the fix <!-- Enter description of the fix in this section --> ### Issues Fixed <!-- Please make sure that there is a bug logged for the issue being fixed. The bug should describe the problem and how to reproduce it. --> Fixes #36010 ### Tested the behavior in the following platforms - [ ] Windows - [ ] Android - [x] iOS - [x] Mac | Before Issue Fix | After Issue Fix | |----------|----------| | <img width="954" height="693" alt="BeforeFix36010" src="https://github.com/user-attachments/assets/fb32509b-ce7c-497c-9fa4-3170181e9475" /> | <img width="947" height="689" alt="AfterFix36010" src="https://github.com/user-attachments/assets/188f6e3b-6b72-4ead-9af0-342d5d8d7c20" /> | <!-- Are you targeting main? All PRs should target the main branch unless otherwise noted. -->
kubaflo
pushed a commit
that referenced
this pull request
Jul 10, 2026
…r handler restore when property changes (#36073) <!-- Please keep the note below for people who find this PR --> > [!NOTE] > Are you waiting for the changes in this PR to be merged? > It would be very helpful if you could [test the resulting artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment whether this change resolves your issue. Thank you! <!-- !!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING MAIN. !!!!!!! --> This pull request addresses a regression issue where `CollectionViewHandler2` could throw a `NullReferenceException` if a layout property changed after the handler was disconnected and then reconnected. The fix ensures the internal cache is properly reinitialized, and new tests are added to verify the handler's stability in these scenarios. ### Description of Change **Bug fix:** - Ensured `_layoutPropertyCache` is reinitialized when subscribing to a new items layout in `CollectionViewHandler2`, preventing `NullReferenceException` after handler disconnect/reconnect cycles. **Testing improvements:** - Added regression tests to confirm that changing properties on `GridItemsLayout` and `LinearItemsLayout` after a disconnect/restore cycle does not cause crashes in `CollectionViewHandler2`. These tests cover various property changes and validate the fix <!-- Enter description of the fix in this section --> ### Issues Fixed <!-- Please make sure that there is a bug logged for the issue being fixed. The bug should describe the problem and how to reproduce it. --> Fixes #36010 ### Tested the behavior in the following platforms - [ ] Windows - [ ] Android - [x] iOS - [x] Mac | Before Issue Fix | After Issue Fix | |----------|----------| | <img width="954" height="693" alt="BeforeFix36010" src="https://github.com/user-attachments/assets/fb32509b-ce7c-497c-9fa4-3170181e9475" /> | <img width="947" height="689" alt="AfterFix36010" src="https://github.com/user-attachments/assets/188f6e3b-6b72-4ead-9af0-342d5d8d7c20" /> | <!-- Are you targeting main? All PRs should target the main branch unless otherwise noted. -->
kubaflo
pushed a commit
that referenced
this pull request
Jul 15, 2026
…r handler restore when property changes (#36073) <!-- Please keep the note below for people who find this PR --> > [!NOTE] > Are you waiting for the changes in this PR to be merged? > It would be very helpful if you could [test the resulting artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment whether this change resolves your issue. Thank you! <!-- !!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING MAIN. !!!!!!! --> This pull request addresses a regression issue where `CollectionViewHandler2` could throw a `NullReferenceException` if a layout property changed after the handler was disconnected and then reconnected. The fix ensures the internal cache is properly reinitialized, and new tests are added to verify the handler's stability in these scenarios. ### Description of Change **Bug fix:** - Ensured `_layoutPropertyCache` is reinitialized when subscribing to a new items layout in `CollectionViewHandler2`, preventing `NullReferenceException` after handler disconnect/reconnect cycles. **Testing improvements:** - Added regression tests to confirm that changing properties on `GridItemsLayout` and `LinearItemsLayout` after a disconnect/restore cycle does not cause crashes in `CollectionViewHandler2`. These tests cover various property changes and validate the fix <!-- Enter description of the fix in this section --> ### Issues Fixed <!-- Please make sure that there is a bug logged for the issue being fixed. The bug should describe the problem and how to reproduce it. --> Fixes #36010 ### Tested the behavior in the following platforms - [ ] Windows - [ ] Android - [x] iOS - [x] Mac | Before Issue Fix | After Issue Fix | |----------|----------| | <img width="954" height="693" alt="BeforeFix36010" src="https://github.com/user-attachments/assets/fb32509b-ce7c-497c-9fa4-3170181e9475" /> | <img width="947" height="689" alt="AfterFix36010" src="https://github.com/user-attachments/assets/188f6e3b-6b72-4ead-9af0-342d5d8d7c20" /> | <!-- Are you targeting main? All PRs should target the main branch unless otherwise noted. -->
kubaflo
pushed a commit
that referenced
this pull request
Jul 22, 2026
…r handler restore when property changes (#36073) <!-- Please keep the note below for people who find this PR --> > [!NOTE] > Are you waiting for the changes in this PR to be merged? > It would be very helpful if you could [test the resulting artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment whether this change resolves your issue. Thank you! <!-- !!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING MAIN. !!!!!!! --> This pull request addresses a regression issue where `CollectionViewHandler2` could throw a `NullReferenceException` if a layout property changed after the handler was disconnected and then reconnected. The fix ensures the internal cache is properly reinitialized, and new tests are added to verify the handler's stability in these scenarios. ### Description of Change **Bug fix:** - Ensured `_layoutPropertyCache` is reinitialized when subscribing to a new items layout in `CollectionViewHandler2`, preventing `NullReferenceException` after handler disconnect/reconnect cycles. **Testing improvements:** - Added regression tests to confirm that changing properties on `GridItemsLayout` and `LinearItemsLayout` after a disconnect/restore cycle does not cause crashes in `CollectionViewHandler2`. These tests cover various property changes and validate the fix <!-- Enter description of the fix in this section --> ### Issues Fixed <!-- Please make sure that there is a bug logged for the issue being fixed. The bug should describe the problem and how to reproduce it. --> Fixes #36010 ### Tested the behavior in the following platforms - [ ] Windows - [ ] Android - [x] iOS - [x] Mac | Before Issue Fix | After Issue Fix | |----------|----------| | <img width="954" height="693" alt="BeforeFix36010" src="https://github.com/user-attachments/assets/fb32509b-ce7c-497c-9fa4-3170181e9475" /> | <img width="947" height="689" alt="AfterFix36010" src="https://github.com/user-attachments/assets/188f6e3b-6b72-4ead-9af0-342d5d8d7c20" /> | <!-- Are you targeting main? All PRs should target the main branch unless otherwise noted. -->
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Note
Are you waiting for the changes in this PR to be merged?
It would be very helpful if you could test the resulting artifacts from this PR and let us know in a comment whether this change resolves your issue. Thank you!
This pull request addresses a regression issue where
CollectionViewHandler2could throw aNullReferenceExceptionif a layout property changed after the handler was disconnected and then reconnected. The fix ensures the internal cache is properly reinitialized, and new tests are added to verify the handler's stability in these scenarios.Description of Change
Bug fix:
_layoutPropertyCacheis reinitialized when subscribing to a new items layout inCollectionViewHandler2, preventingNullReferenceExceptionafter handler disconnect/reconnect cycles.Testing improvements:
GridItemsLayoutandLinearItemsLayoutafter a disconnect/restore cycle does not cause crashes inCollectionViewHandler2. These tests cover various property changes and validate the fixIssues Fixed
Fixes #36010
Tested the behavior in the following platforms