{"record":{"id":"868ff9bf6ae5d2bf","repo":"microsoft/ailab","slug":"invalid-magnifierposition","errorCode":null,"errorMessage":"invalid MagnifierPosition","messagePattern":"invalid MagnifierPosition","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"Snip-Insights/SnipInsight/ImageCapture/ImageCaptureWindow.xaml.cs","lineNumber":352,"sourceCode":"                    break;\n                case MagnifierPosition.UpperLeft:\n                    left = p.X - MagnifierWidth;\n                    top = p.Y - MagnifierHeight;\n                    break;\n                case MagnifierPosition.UpperRight:\n                    left = p.X + MagnifierHorizonSpace;\n                    top = p.Y - MagnifierHeight;\n                    break;\n                case MagnifierPosition.LowerRight:\n                    left = p.X + MagnifierHorizonSpace;\n                    top = p.Y + MagnifierVerticalSpace;\n                    break;\n                case MagnifierPosition.Center:\n                    left = p.X - MagnifierRadius;\n                    top = p.Y - MagnifierRadius;\n                    break;\n                default:\n                    throw new InvalidOperationException(\"invalid MagnifierPosition\");\n            }\n\n            MagnifierTransform.X = left;\n            MagnifierTransform.Y = top;\n            MagnifierScale.CenterX = p.X;\n            MagnifierScale.CenterY = p.Y;\n            MagnifierScale.ScaleX = monitorScalingX;\n            MagnifierScale.ScaleY = monitorScalingY;\n        }\n#endregion\n    }\n}\n","sourceCodeStart":334,"sourceCodeEnd":365,"githubUrl":"https://github.com/microsoft/ailab/blob/89fe2fc62081145ec5408d42059cbcb7c4a033c8/Snip-Insights/SnipInsight/ImageCapture/ImageCaptureWindow.xaml.cs#L334-L365","documentation":"ImageCaptureWindow positions a magnifier overlay from a MagnifierPosition enum via a switch; when the supplied position value does not match any handled case (UpperLeft, UpperRight, LowerRight, ...), the computed left/top coordinates are indeterminate, so the code throws this sentinel error. It fires only when an unhandled enum member is passed — a bug in the magnifier positioning logic, not user input.","triggerScenarios":"Thrown at Snip-Insights/SnipInsight/ImageCapture/ImageCaptureWindow.xaml.cs:352 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Add a default case to the switch that throws ArgumentOutOfRangeException with the actual value for better diagnostics","Verify MagnifierPosition is set only from known UI locations (e.g. corners around the cursor)","If a new enum member was added, implement its left/top computation in this switch"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"89fe2fc62081145ec5408d42059cbcb7c4a033c8","analyzedAt":"2026-09-13T20:10:53.835Z","contentChangedAt":"2026-09-13T20:10:53.835Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}