{"record":{"id":"69736ed48044c28c","repo":"dotnet/wpf","slug":"sr-invalidsubtreeprocessor","errorCode":null,"errorMessage":"SR.InvalidSubTreeProcessor","messagePattern":"SR\\.InvalidSubTreeProcessor","errorType":"exception","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"src/Microsoft.DotNet.Wpf/src/PresentationFramework/MS/Internal/Annotations/Anchoring/LocatorManager.cs","lineNumber":133,"sourceCode":"        /// on this node, or an instance of the DataIdProcessor if none is specified</returns>\n        /// <exception cref=\"ArgumentNullException\">node is null</exception>\n        public SubTreeProcessor GetSubTreeProcessor(DependencyObject node)\n        {\n            VerifyAccess();\n\n            ArgumentNullException.ThrowIfNull(node);\n\n            // This property should contain one or more (comma-delimited) \n            // registered string IDs for subtree processors.\n            string processorString = node.GetValue(SubTreeProcessorIdProperty) as string;\n            if (!String.IsNullOrEmpty(processorString))\n            {\n                SubTreeProcessor processor = (SubTreeProcessor)_subtreeProcessors[processorString];\n\n                if (processor != null)\n                    return processor;\n                else\n                    throw new ArgumentException(SR.Format(SR.InvalidSubTreeProcessor, processorString));\n            }\n            else\n            {\n                return _subtreeProcessors[DataIdProcessor.Id] as SubTreeProcessor;\n            }\n        }\n\n        /// <summary>\n        ///     Returns the subtree processor registered to handle the locator \n        ///     part's type.  If none is registered, null is returned.\n        /// </summary>\n        /// <param name=\"locatorPart\">locator part for which a subtree processor\n        /// is being retreived</param>\n        /// <returns>a subtree processor registered to handle the locator part's\n        /// type; null if no such processor is registred</returns>\n        /// <exception cref=\"ArgumentNullException\">locatorPart is null</exception>\n        public SubTreeProcessor GetSubTreeProcessorForLocatorPart(ContentLocatorPart locatorPart)\n        {","sourceCodeStart":115,"sourceCodeEnd":151,"githubUrl":"https://github.com/dotnet/wpf/blob/81131a70a4c573cd62748a5c36908fc4d662daa9/src/Microsoft.DotNet.Wpf/src/PresentationFramework/MS/Internal/Annotations/Anchoring/LocatorManager.cs#L115-L151","documentation":"LocatorManager.GetSubTreeProcessor looks up the processor registered for a given processor string (locator base Id). If the key exists but holds no processor it throws ArgumentException(SR.InvalidSubTreeProcessor, processorString) — the annotation references a subtree processor that is not registered/known to this LocatorManager.","triggerScenarios":"Resolving annotations whose ContentLocatorBase lists a processor Id (e.g. 'ProcessId' attribute) that is not registered in LocatorManager._subtreeProcessors, or after a registration was cleared.","commonSituations":"Loading annotation stores produced by other apps/custom processors; namespace/type renames across .NET versions; constructing ContentLocator with a ProcessId that was never registered via AddSubTreeProcessor-equivalent path.","solutions":["Use processor Ids registered with the LocatorManager (e.g. DataIdProcessor.Id) when authoring locators.","Register any custom subtree processor before processing annotations.","Validate stored annotations' processor strings against the known set at load time."],"exampleFix":"// before\nlocator.Add(new ContentLocatorPart(new XmlQualifiedName(\"CustomPart\", \"http://my/ns\"))); // unknown processor string\n// after\nlocator.Add(new ContentLocatorPart(FixedTextSelectionProcessor.FixedTextElementName)); // known/registered processor","handlingStrategy":"try-catch","validationCode":"if (!_knownProcessorIds.Contains(processorString)) throw new InvalidOperationException($\"Processor '{processorString}' not registered\");","typeGuard":null,"tryCatchPattern":"try { var p = manager.GetSubTreeProcessor(locatorBase); } catch (ArgumentException ex) { /* unknown processor string — fall back to DataIdProcessor or skip */ }","preventionTips":["Only author locators with built-in processor Ids (e.g. DataIdProcessor.Id)","Register custom processors before loading their annotations","Validate processor strings when importing annotation stores"],"tags":["wpf","annotations","locator-manager"],"backgroundTag":"resource-not-found","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"}