{"record":{"id":"a1418540f7b35773","repo":"dotnet/wpf","slug":"microsoft-windows-controls-sr-format-microsoft-windows-a14185","errorCode":null,"errorMessage":"Microsoft.Windows.Controls.SR.Format(Microsoft.Windows.Controls.SR.InvalidCtorParameterUnknownRibbonControlLengthUnitType, \"type\")","messagePattern":"Microsoft\\.Windows\\.Controls\\.SR\\.Format\\(Microsoft\\.Windows\\.Controls\\.SR\\.InvalidCtorParameterUnknownRibbonControlLengthUnitType, \"type\"\\)","errorType":"exception","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"src/Microsoft.DotNet.Wpf/src/System.Windows.Controls.Ribbon/Microsoft/Windows/Controls/Ribbon/RibbonControlLength.cs","lineNumber":63,"sourceCode":"        /// </summary>\n        public RibbonControlLength(double value, RibbonControlLengthUnitType type)\n        {\n            if (double.IsNaN(value))\n            {\n                throw new ArgumentException(Microsoft.Windows.Controls.SR.Format(Microsoft.Windows.Controls.SR.InvalidCtorParameterNoNaN, \"value\"));\n            }\n\n            if (type == RibbonControlLengthUnitType.Star && double.IsInfinity(value))\n            {\n                throw new ArgumentException(Microsoft.Windows.Controls.SR.Format(Microsoft.Windows.Controls.SR.InvalidCtorParameterNoInfinityForStarSize, \"value\"));\n            }\n\n            if (type != RibbonControlLengthUnitType.Auto\n                && type != RibbonControlLengthUnitType.Pixel\n                && type != RibbonControlLengthUnitType.Item\n                && type != RibbonControlLengthUnitType.Star)\n            {\n                throw new ArgumentException(Microsoft.Windows.Controls.SR.Format(Microsoft.Windows.Controls.SR.InvalidCtorParameterUnknownRibbonControlLengthUnitType, \"type\"));\n            }\n\n            _unitValue = (type == RibbonControlLengthUnitType.Auto) ? 0.0 : value;\n            _unitType = type;\n        }\n\n        #endregion\n\n        #region Public Methods\n\n        /// <summary>\n        ///   Overloaded operator, compares 2 RibbonControlLengths.\n        /// </summary>\n        public static bool operator ==(RibbonControlLength length1, RibbonControlLength length2)\n        {\n            return (length1.RibbonControlLengthUnitType == length2.RibbonControlLengthUnitType &&\n                length1.Value == length2.Value);\n        }","sourceCodeStart":45,"sourceCodeEnd":81,"githubUrl":"https://github.com/dotnet/wpf/blob/81131a70a4c573cd62748a5c36908fc4d662daa9/src/Microsoft.DotNet.Wpf/src/System.Windows.Controls.Ribbon/Microsoft/Windows/Controls/Ribbon/RibbonControlLength.cs#L45-L81","documentation":"The RibbonControlLength(value, type) constructor throws this ArgumentException when type is not a recognized RibbonControlLengthUnitType value (Auto, Pixel, Star or the sentinel). An undefined enum value passed to the constructor is rejected immediately, signaling a programming error.","triggerScenarios":"Thrown at src/Microsoft.DotNet.Wpf/src/System.Windows.Controls.Ribbon/Microsoft/Windows/Controls/Ribbon/RibbonControlLength.cs:63 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use one of the defined RibbonControlLengthUnitType values (Auto, Pixel, Star)","Ensure the type argument is not an uninitialized or cast-invalid enum value","Default to RibbonControlLengthUnitType.Pixel when the type is unknown"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"81131a70a4c573cd62748a5c36908fc4d662daa9","analyzedAt":"2026-09-14T10:12:48.479Z","contentChangedAt":"2026-09-14T10:12:48.479Z","schemaVersion":2},"datasetVersion":"2026-09-21T21:30:21.729Z"}