{"record":{"id":"e48258acb9a5238b","repo":"dotnet/wpf","slug":"system-notimplementedexception","errorCode":null,"errorMessage":"System.NotImplementedException()","messagePattern":"System\\.NotImplementedException\\(\\)","errorType":"exception","errorClass":"NotImplementedException","httpStatus":null,"severity":"error","filePath":"src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Input/InputScope.cs","lineNumber":142,"sourceCode":"        ///<summary>\n        /// Constructor that takes name\n        ///</summary>\n        public InputScopeName(InputScopeNameValue nameValue)\n        {\n            _nameValue = nameValue;\n        }\n\n\n#region implementation of IAddChild \n        ///<summary>\n        /// Called to Add the object as a Child. For InputScopePhrase tag this is ignored\n        ///</summary>\n        ///<param name=\"value\">\n        /// Object to add as a child\n        ///</param>\n        public void AddChild(object value) \n        {\n            throw new System.NotImplementedException();\n        }\n\n        /// <summary>\n        ///  if text is present between InputScopePhrase tags, the text is added as a phrase name \n        /// </summary>\n        ///<param name=\"name\">\n        /// Text string to add\n        ///</param>\n        public void AddText(string name)\n        {\n            // throw new System.NotImplementedException();\n        }\n\n#endregion IAddChild\n\n#endregion Public Methods\n\n#region class public properties","sourceCodeStart":124,"sourceCodeEnd":160,"githubUrl":"https://github.com/dotnet/wpf/blob/81131a70a4c573cd62748a5c36908fc4d662daa9/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Input/InputScope.cs#L124-L160","documentation":"InputScope.AddChild is part of the IAddChild infrastructure used by XAML parsers to add child content to an element. For InputScope the implementation was never written, so any call throws NotImplementedException unconditionally. This signals that InputScope does not support programmatic/XAML child-object addition.","triggerScenarios":"Calling InputScope.AddChild(object) directly, or a XAML processor invoking IAddChild.AddChild when parsing <InputScope> with child object elements.","commonSituations":"Migrating legacy XAML that declared child elements under InputScope; tools or custom markup writers that use IAddChild generically on any object.","solutions":["Do not add child objects to InputScope; set properties such as Names or Phrases collections directly instead","If building input scopes in code, use scope.Names.Add(new InputScopeName(...)) or scope.Phrases.Add(new InputScopePhrase(...))","Replace XAML child-element syntax under InputScope with property-element syntax for Names/Phrases"],"exampleFix":"// before\nscope.AddChild(new InputScopeName { NameValue = InputScopeNameValue.Number });\n// after\nscope.Names.Add(new InputScopeName { NameValue = InputScopeNameValue.Number });","handlingStrategy":"validation","validationCode":"bool canAddChild = obj is IAddChild ia && !(obj is System.Windows.Input.InputScope);","typeGuard":null,"tryCatchPattern":"try { scope.AddChild(child); } catch (NotImplementedException) { /* use scope.Names/Phrases instead */ }","preventionTips":["Never rely on IAddChild for InputScope; use its typed collections","Search XAML for child elements under InputScope tags and convert to property elements"],"tags":["wpf","not-implemented","xaml"],"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-22T01:17:13.364Z"}