[UWP] Using the navigation buttons on a mouse while the cursor is over a toucheffect control will throw a null reference exception
See original GitHub issueOn UWP, you can have navigation buttons on your mouse. This means that while you press them, it’ll trigger the pressed events, which will navigate to a different page but also attempt to do things like animate the background color of the affected control. However, as the app has since navigated to a different page, the control it is trying to act upon no longer exists and a null reference exception is thrown at
TouchVisualManager.cs line 195
new Animation{
{0, 1, new Animation(v => sender.Control.BackgroundColor = new Color(v, sender.Control.BackgroundColor.G, sender.Control.BackgroundColor.B, sender.Control.BackgroundColor.A), sender.Control.BackgroundColor.R, color.R) },
{0, 1, new Animation(v => sender.Control.BackgroundColor = new Color(sender.Control.BackgroundColor.R, v, sender.Control.BackgroundColor.B, sender.Control.BackgroundColor.A), sender.Control.BackgroundColor.G, color.G) },
{0, 1, new Animation(v => sender.Control.BackgroundColor = new Color(sender.Control.BackgroundColor.R, sender.Control.BackgroundColor.G, v, sender.Control.BackgroundColor.A), sender.Control.BackgroundColor.B, color.B) },
{0, 1, new Animation(v => sender.Control.BackgroundColor = new Color(sender.Control.BackgroundColor.R, sender.Control.BackgroundColor.G, sender.Control.BackgroundColor.B, v), sender.Control.BackgroundColor.A, color.A) },
}.Commit(sender.Control, ChangeBackgroundColorAnimationName, 16, (uint)duration, easing, (d, b) => animationCompletionSource.SetResult(true));
sender.Control is null so it’ll fail.
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (7 by maintainers)
Top Results From Across the Web
NullReferenceException while navigating to a UserControl ...
UI.Xaml.Controls.Frame with a parameter that is not a type that inherits from Page, a NullReferenceException is thrown. The exception message is ...
Read more >CoreWindow.PointerPosition returns nullReference
I'm trying to set the position of the mouse cursor inside of a UWP, but I keep getting a null reference exception that...
Read more >OnMouseEnter() throwing NullReferenceException
The button is big and part of it is off the game tiles over empty space. I'm thinking that it's trying to call...
Read more >How to remove cursor and use the gamepad in a UWP app?
When I run my application on XBOX using Visual Studio I'm getting a cursor by default which I wanted to remove and use...
Read more >Null Reference Exception using Mouse.current on a laptop ...
I've been working on a game for a couple days now and have run into a snafu while using Mouse.current.position to read the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yes, first impression is that it is working fine 😉
@MitchBomcanhao does it work?)