stride3d/stride · error · InvalidOperationException
Simulated PointerDevice does not exist
Error message
Simulated PointerDevice does not exist
What it means
InputSourceSimulated.RemovePointer requires the PointerSimulated instance to be in the source's pointers collection. If the pointer was never created by this source or has already been removed, the check fails and InvalidOperationException is thrown.
Solutions
- Only remove PointerSimulated instances created by this source
- Check membership or track removed pointers before removal
- Use RemoveAllPointers for complete cleanup
- Clear references after removal to prevent stale calls
Example fix
// before source.RemovePointer(pointer); source.RemovePointer(pointer); // throws // after if (pointers.Contains(pointer)) source.RemovePointer(pointer);
Defensive patterns
Strategy: validation
Validate before calling
if (createdPointers.Contains(pointer)) source.RemovePointer(pointer);
Try / catch
try { source.RemovePointer(pointer); } catch (InvalidOperationException) { /* already removed */ } Prevention
- Only remove pointers created by this source instance
- Clear references after removal
- Use RemoveAllPointers for teardown
When it happens
Trigger: Calling RemovePointer with a pointer not obtained from this source's CreatePointer, or a duplicate RemovePointer call for the same instance.
Common situations: Double teardown of test fixtures; pointers removed via RemoveAllPointers then removed individually; passing pointers between separate InputSourceSimulated instances.
Understand the failure class
Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.
Related errors
- Simulated GamePad does not exist
- Simulated Mouse does not exist
- Simulated Keyboard does not exist
- Can not set more than one button at a time
- The given does not correspond to any existing part.
AI-assisted analysis of stride3d/stride@96fad776d2 (2026-09-14).
Data as JSON: /api/errors/009f8091ed0b2234.
Report an issue: GitHub.
Appendix: source
Thrown at sources/engine/Stride.Input/Simulated/InputSourceSimulated.cs:118
public void RemoveAllKeyboards()
{
foreach (var keyboard in keyboards)
UnregisterDevice(keyboard);
keyboards.Clear();
}
public PointerSimulated AddPointer()
{
var pointer = new PointerSimulated(this);
pointers.Add(pointer);
RegisterDevice(pointer);
return pointer;
}
public void RemovePointer(PointerSimulated pointer)
{
if (!pointers.Contains(pointer))
throw new InvalidOperationException("Simulated PointerDevice does not exist");
UnregisterDevice(pointer);
pointers.Remove(pointer);
}
public void RemoveAllPointers()
{
foreach (var pointer in pointers)
UnregisterDevice(pointer);
pointers.Clear();
}
}
}
View on GitHub (pinned to 96fad776d2)