{"record":{"id":"665e7fbe84275222","repo":"dotnet/wpf","slug":"new-notimplementedexception","errorCode":null,"errorMessage":"new NotImplementedException()","messagePattern":"new NotImplementedException\\(\\)","errorType":"exception","errorClass":"NotImplementedException","httpStatus":null,"severity":"error","filePath":"src/Microsoft.DotNet.Wpf/src/System.Windows.Controls.Ribbon/Microsoft/Windows/Controls/Ribbon/Primitives/RibbonWindowSmallIconConverter.cs","lineNumber":43,"sourceCode":"        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)\n        {\n            ImageSource imageSource = value as ImageSource;\n            ImageSource returnImageSource = null;\n            if (imageSource != null)\n            {\n                returnImageSource = GetSmallIconImageSource(imageSource);\n\n                if (returnImageSource == null)\n                {\n                    returnImageSource = imageSource;\n                }\n            }\n            return returnImageSource;\n        }\n\n        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)\n        {\n            throw new NotImplementedException();\n        }\n\n        #endregion\n\n        #region Helper Methods\n\n        private ImageSource GetSmallIconImageSource(ImageSource imageSource)\n        {\n#if RIBBON_IN_FRAMEWORK\n            Size size = new Size(SystemParameters.SmallIconWidth, SystemParameters.SmallIconHeight);\n#else\n            Size size = Microsoft.Windows.Shell.SystemParameters2.Current.SmallIconSize;\n#endif\n            bool asGoodAsItGets = false;\n\n            var bf = imageSource as BitmapFrame;\n            if (bf != null && bf.Decoder != null && bf.Decoder.Frames != null && bf.Decoder.Frames.Count > 0)\n            {","sourceCodeStart":25,"sourceCodeEnd":61,"githubUrl":"https://github.com/dotnet/wpf/blob/81131a70a4c573cd62748a5c36908fc4d662daa9/src/Microsoft.DotNet.Wpf/src/System.Windows.Controls.Ribbon/Microsoft/Windows/Controls/Ribbon/Primitives/RibbonWindowSmallIconConverter.cs#L25-L61","documentation":"RibbonWindowSmallIconConverter is a one-way value converter: only Convert is implemented. ConvertBack always throws NotImplementedException because converting an icon ImageSource back to the source object is not meaningful for the ribbon window's small-icon binding.","triggerScenarios":"Using RibbonWindowSmallIconConverter in a TwoWay or OneWayToSource binding (Binding with Mode=TwoWay, or UpdateSourceTrigger firing on the bound property), so WPF calls ConvertBack.","commonSituations":"Developers reusing the converter in their own bindings (e.g. Icon bound TwoWay by default in some scenarios) instead of one-way icon display bindings.","solutions":["Change the binding to Mode=OneWay (or OneTime) so ConvertBack is never invoked.","Use a different/custom converter with a real ConvertBack if reverse conversion is needed.","Write a custom converter class for your scenario rather than reusing this internal-purpose converter."],"exampleFix":"// before\n<Image Source=\"{Binding Icon, Converter={StaticResource RibbonWindowSmallIconConverter}, Mode=TwoWay}\"/>\n// after\n<Image Source=\"{Binding Icon, Converter={StaticResource RibbonWindowSmallIconConverter}, Mode=OneWay}\"/>","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { value = converter.ConvertBack(v, typeof(object), null, CultureInfo.CurrentCulture); }\ncatch (NotImplementedException) { value = Binding.DoNothing; }","preventionTips":["Only use RibbonWindowSmallIconConverter in one-way bindings.","Set Mode=OneWay explicitly on reusing bindings.","Never attach it to editable/two-way controls."],"tags":["wpf","ribbon","converter","notimplemented"],"backgroundTag":"method-not-implemented","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"}