-
Notifications
You must be signed in to change notification settings - Fork 706
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't set ProtectedCursor in DependencyProperty PropertyChangedCallback - Access Violation #7062
Comments
I think the issue is that it can only be called when it's in the live tree, so OnApplyTemplate or the Loaded event handler are workarounds. |
@MikeHillberg thanks, If I ignore the first change from the DependencyProperty being set in XAML, I can still grab the value and call to set it in OnApplyTemplate. Will see how that holds up with some more testing and when dynamically changing the property at runtime which is trying to update this. Opened a doc bug to add a note about this for now. |
Looks like the doc issue is still open, so bumping based on #8638 |
This crash is fixed in 1.4-preview1 and was also serviced to 1.3 in 1.3.230602002. |
Fix winui3 cursor bug(microsoft/microsoft-ui-xaml#7062)
Describe the bug
Tested on both latest 1.1.0-preview3 (not an option in dropdown below) and 1.0.1,
I'm hitting a
0xC0000005: Access violation reading location 0x0000000000000000.
error when trying to set theProtectedCursor
on my derived control. I'm trying to update our new refactor ofGridSplitter
and related controls in the Toolkit to work with WinUI 3 from this PR here CommunityToolkit/WindowsCommunityToolkit#4083 (related to issue #4509 here as well).We'd like to showcase this component in our new Labs setup. Seems more severe of an issue than previously reported #6058.
Interesting to note is that if I change this value within
OnApplyTemplate
it seems to work fine. However, when being called as a result of the XAML DependencyProperty PropertyChangedCallback - updating it fails with this error.I tried to use a
DispatcherQueue
within the callback, but that resulted in the same error. (Even though this should already be still on the UI thread, so I wouldn't expect to have to do this here.)Steps to reproduce the bug
Derive a control and try and set the ProtectedCursor property:
Move this to a DependencyPropertyChanged callback, see error.
Happy to add someone to our repo and point them to the commit where we can reproduce this in Labs.
Expected behavior
Should not crash and set the cursor to the specified value.
Screenshots
No response
NuGet package version
WinUI 3 - Windows App SDK 1.1 Preview 2: 1.1.0-preview3
Windows app type
Device form factor
Desktop
Windows version
Windows 10 (21H2): Build 19044
Additional context
Working stack:
Related microsoft/WindowsAppSDK#1816
The text was updated successfully, but these errors were encountered: