{"record":{"id":"2cc8cdf2a1c67444","repo":"HandyOrg/HandyControl","slug":"defaultresult","errorCode":null,"errorMessage":"defaultResult","messagePattern":"defaultResult","errorType":"exception","errorClass":"InvalidEnumArgumentException","httpStatus":null,"severity":"error","filePath":"src/Shared/HandyControl_Shared/Controls/Window/MessageBox.cs","lineNumber":492,"sourceCode":"        string caption,\n        MessageBoxButton button,\n        MessageBoxImage icon,\n        MessageBoxResult defaultResult\n    )\n    {\n        if (!IsValidMessageBoxButton(button))\n        {\n            throw new InvalidEnumArgumentException(nameof(button), (int) button, typeof(MessageBoxButton));\n        }\n\n        if (!IsValidMessageBoxImage(icon))\n        {\n            throw new InvalidEnumArgumentException(nameof(icon), (int) icon, typeof(MessageBoxImage));\n        }\n\n        if (!IsValidMessageBoxResult(defaultResult))\n        {\n            throw new InvalidEnumArgumentException(nameof(defaultResult), (int) defaultResult,\n                typeof(MessageBoxResult));\n        }\n\n        var ownerWindow = owner ?? WindowHelper.GetActiveWindow();\n        var ownerIsNull = ownerWindow is null;\n\n        return new MessageBox\n        {\n            Message = messageBoxText,\n            Owner = ownerWindow,\n            WindowStartupLocation =\n                ownerIsNull ? WindowStartupLocation.CenterScreen : WindowStartupLocation.CenterOwner,\n            ShowTitle = true,\n            Title = caption ?? string.Empty,\n            Topmost = ownerIsNull,\n            _messageBoxResult = defaultResult\n        };\n    }","sourceCodeStart":474,"sourceCodeEnd":510,"githubUrl":"https://github.com/HandyOrg/HandyControl/blob/2c0875ebd67326e0c67282967e3e809c69282fee/src/Shared/HandyControl_Shared/Controls/Window/MessageBox.cs#L474-L510","documentation":"Validation helper in MessageBox.CreateMessageBox: throws InvalidEnumArgumentException for 'defaultResult' when the MessageBoxResult default value is not a defined member (None, OK, Cancel, Yes, No). It fires when a caller passes an undefined default result, or one inconsistent with the button set.","triggerScenarios":"Thrown at src/Shared/HandyControl_Shared/Controls/Window/MessageBox.cs:492 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Only pass defined MessageBoxResult values that are compatible with the chosen MessageBoxButton combination","Validate with Enum.IsDefined(typeof(MessageBoxResult), defaultResult) before calling Show","Guard public wrappers so defaultResult defaults to OK when unspecified"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"2c0875ebd67326e0c67282967e3e809c69282fee","analyzedAt":"2026-09-14T14:45:29.754Z","contentChangedAt":"2026-09-14T14:45:29.754Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}