{"record":{"id":"c41b0445512bc763","repo":"stride3d/stride","slug":"don-t-know-button","errorCode":null,"errorMessage":"Don't know button: ","messagePattern":"Don't know button: ","errorType":"exception","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"sources/engine/Stride.VirtualReality/OpenXR/OpenXRInput.cs","lineNumber":149,"sourceCode":"                case TouchControllerButton.A:\n                    return MappedActions[(int)hand, (int)HAND_PATHS.ButtonXA];\n                case TouchControllerButton.Y:\n                case TouchControllerButton.B:\n                    return MappedActions[(int)hand, (int)HAND_PATHS.ButtonYB];\n                case TouchControllerButton.Grip:\n                    return wantBoolean ? MappedActions[(int)hand, (int)HAND_PATHS.GripClick] : MappedActions[(int)hand, (int)HAND_PATHS.GripValue];\n                case TouchControllerButton.Menu:\n                    return MappedActions[(int)hand, (int)HAND_PATHS.Menu];\n                //case TouchControllerButton.System:\n                //    return MappedActions[(int)hand, (int)HAND_PATHS.System];\n                case TouchControllerButton.Trigger:\n                    return wantBoolean ? MappedActions[(int)hand, (int)HAND_PATHS.TriggerClick] : MappedActions[(int)hand, (int)HAND_PATHS.TriggerValue];\n                case TouchControllerButton.Thumbstick:\n                    return wantBoolean ? MappedActions[(int)hand, (int)HAND_PATHS.ThumbstickClick] : MappedActions[(int)hand, YAxis ? (int)HAND_PATHS.ThumbstickY : (int)HAND_PATHS.ThumbstickX];\n                case TouchControllerButton.Touchpad:\n                    return wantBoolean ? MappedActions[(int)hand, (int)HAND_PATHS.TrackpadClick] : MappedActions[(int)hand, YAxis ? (int)HAND_PATHS.TrackpadY : (int)HAND_PATHS.TrackpadX];\n                default:\n                    throw new ArgumentException(\"Don't know button: \" + button);\n            }\n        }\n\n        public bool GetActionBool(TouchControllerHand hand, TouchControllerButton button, out bool wasChangedSinceLast, bool fallback = false)\n        {\n            ActionStateGetInfo getbool = new ActionStateGetInfo()\n            {\n                Action = GetAction(hand, button, false, true),\n                Type = StructureType.ActionStateGetInfo\n            };\n\n            ActionStateBoolean boolresult = new ActionStateBoolean()\n            {\n                Type = StructureType.ActionStateBoolean\n            };\n\n            hmd.Xr.GetActionStateBoolean(hmd.globalSession, in getbool, ref boolresult);\n","sourceCodeStart":131,"sourceCodeEnd":167,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/engine/Stride.VirtualReality/OpenXR/OpenXRInput.cs#L131-L167","documentation":"OpenXRInput.GetAction maps a TouchControllerButton enum value to an OpenXR action using a switch over known buttons; the default branch throws ArgumentException because the button value is not handled by the mapping table. This happens when an enum value is passed that has no corresponding HAND_PATHS entry. The exception fires during GetActionBool or GetActionFloat calls.","triggerScenarios":"Calling GetActionBool/GetActionFloat with a TouchControllerButton value that the switch statement does not cover (e.g. newly added or cast-in enum values like (TouchControllerButton)99).","commonSituations":"Casting raw ints or values from config/UI into TouchControllerButton; a Stride version mismatch where code passes a newer enum member than the input mapping supports; iterating all enum values assuming each is mapped.","solutions":["Pass only TouchControllerButton values the input mapping supports (Trigger, Thumbstick, Touchpad, etc.).","Validate the button value before calling and fall back for unmapped buttons.","Upgrade Stride if the button you need was added in a newer version's mapping table."],"exampleFix":"// before\nvar pressed = input.GetActionBool(hand, (TouchControllerButton)rawValue);\n// after\nif (Enum.IsDefined(typeof(TouchControllerButton), rawValue) &&\n    rawValue is TouchControllerButton.Trigger or TouchControllerButton.Thumbstick or TouchControllerButton.Touchpad)\n{\n    var pressed = input.GetActionBool(hand, (TouchControllerButton)rawValue);\n}","handlingStrategy":"validation","validationCode":"if (!Enum.IsDefined(typeof(TouchControllerButton), button)) return fallback;\nvar state = input.GetActionBool(hand, button, out var changed, fallback);","typeGuard":"bool IsMappedButton(TouchControllerButton b) =>\n    b is TouchControllerButton.Trigger or TouchControllerButton.Thumbstick or TouchControllerButton.Touchpad;","tryCatchPattern":"try { state = input.GetActionBool(hand, button, out changed); }\ncatch (ArgumentException) { state = fallback; }","preventionTips":["Only pass TouchControllerButton values supported by the Stride version's input mapping.","Never cast unchecked ints into TouchControllerButton without Enum.IsDefined.","Update Stride when new buttons are needed."],"tags":["openxr","vr","input","invalid-enum"],"backgroundTag":"invalid-enum-value","analyzedSha":"96fad776d210c221682aac1ccdf4c79dc046fc38","analyzedAt":"2026-09-14T02:59:31.279Z","contentChangedAt":"2026-09-14T02:59:31.279Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}