You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
SwipeView inside Popup crashes on Windows with System.AccessViolationException #1904
On Windows, opening a Popup containing a SwipeView crashes with "System.AccessViolationException: 'Attempted to read or write protected memory. This is often an indication that other memory is corrupt.'"
The same code works on Android.
Expected Behavior
Should not crash on Windows.
Steps To Reproduce
Build and run the repro app on Windows.
Press the button to open the popup. The app crashes.
The crash happens in the call to FrameworkElement.Measure() on the SwipeView. It may be a bug in MAUI, but I am posting it here because it only happens in a Popup.
Could be related to dotnet/maui#16735 ; the repro app is modified from that issue. However I can no longer reproduce the original issue.
If the Popup size is not specified, the Popup size is measured using the Measure method, but this problem occurred at that time.
In the PR above, the target SwipeControl determines whether it is the right time to call the Measure method and then calls the Measure method.
If SwipeControl is included in the popup's Content hierarchy, you need to call the Measure method when it can be called, and avoid calling the Measure method when it is not possible.
By the way, SwipeControl's Measure method can be called when SwipeControl's IsLoaded property is true.
If you can confirm the expected result, you can create a PR, but if the Popup's content includes SwipeControl, you will have to perform your own processing, and it is doubtful whether this will be accepted as a modification to the Popup.
Activity
cat0363 commentedon Aug 1, 2024
@nshtinkov , Is the result you are expecting below?
2024-08-01.16-53-39.mp4
In my modified code, AccessViolationException is not occurring.
I tried writing the modified code with reference to the PR below.
dotnet/maui#6220
If the Popup size is not specified, the Popup size is measured using the Measure method, but this problem occurred at that time.
In the PR above, the target SwipeControl determines whether it is the right time to call the Measure method and then calls the Measure method.
If SwipeControl is included in the popup's Content hierarchy, you need to call the Measure method when it can be called, and avoid calling the Measure method when it is not possible.
By the way, SwipeControl's Measure method can be called when SwipeControl's IsLoaded property is true.
If you can confirm the expected result, you can create a PR, but if the Popup's content includes SwipeControl, you will have to perform your own processing, and it is doubtful whether this will be accepted as a modification to the Popup.
nshtinkov commentedon Aug 1, 2024
Yes this is it. Thank you for the detailed explanation.
ne0rrmatrix commentedon Jan 27, 2025
If you look here
SwipeViewsuppport forWindowshas been removed and is makedNot Plannedby the Maui team. dotnet/maui#6152TheCodeTraveler commentedon May 29, 2025
Resolved in #1581