Skip to content

System.AccessViolationException when using GazeInput.GetGazePointer(null).Click() and GazePointer.IsSwitchEnabled  #3007

@DLamb-MagicLeap

Description

@DLamb-MagicLeap

Describe the bug

A clear and concise description of what the bug is.

When using the switch support built into the gaze interaction library the call inside the keydown event handler in client code to GazeInput.GetGazePointer(null).Click() occasionally, but frequently, throws the following error:

System.AccessViolationException: 'Attempted to read or write protected memory. This is often an indication that other memory is corrupt.'

Exception thrown at 0x00007FFD41CA0A17 (Microsoft.Toolkit.Uwp.Input.GazeInteraction.dll) in ---------.exe: 0xC0000005 Access violation reading location 0x000000000000000. occurred.

Stepping through the error it originates in GazeTargetItem.cpp on line 44:

auto provider = GetPattern(peer);

which in turn calls line 31:

auto pattern = peer->GetPattern(P);

  • [ no] Is this bug a regression in the toolkit? If so, what toolkit version did you last see it work:

Steps to Reproduce

Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

In an app that leverages the GazeInteraction Library add the necessary code for switch support.

  • CoreWindow.Keydown handler
    that triggers GazeInput.GetGazePointer(null).Click() similar to:

          CoreWindow.GetForCurrentThread().KeyDown += new Windows.Foundation.TypedEventHandler<CoreWindow, KeyEventArgs>(delegate (CoreWindow sender, KeyEventArgs args) {                
              if (!args.KeyStatus.WasKeyDown)
              {
                  GazeInput.GetGazePointer(null).Click();
              }                
          });
    

and set the IsSwitchEnabled property to true for switch support.

With a switch device attached to you machine, run the application, look at one of the eye gaze enabled controls and click the switch repeatedly trigging the button click.
After a dozen or so clicks the AccessViolationException is typically thrown.

Expected behavior

A clear and concise description of what you expected to happen.

IsSwitchEnabled should reliably trigger the button click event via switch when enabled as the dwell event does when not.

Screenshots

If applicable, add screenshots to help explain your problem.

Environment

NuGet Package(s): 

Package Version(s): 

Windows 10 Build Number:
- [ ] Fall Creators Update (16299)
- [X ] April 2018 Update (17134)
- [ ] October 2018 Update (17763)
- [ ] May 2019 Update (18362)
- [ ] Insider Build (build number: )

App min and target version:
- [ ] Fall Creators Update (16299)
- [X ] April 2018 Update (17134)
- [ ] October 2018 Update (17763)
- [ ] May 2019 Update (18362)
- [ ] Insider Build (xxxxx)

Device form factor:
- [X] Desktop
- [ ] Xbox
- [ ] Surface Hub
- [ ] IoT

Visual Studio 
- [X ] 2017 (version: )
- [ ] 2019 (version: ) 
- [ ] 2019 Preview (version: )

Additional context

Add any other context about the problem here.

Metadata

Metadata

Assignees

Labels

bug 🐛An unexpected issue that highlights incorrect behaviorgaze 👀help wantedIssues identified as good community contribution opportunities

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions