{"record":{"id":"afa7c0ec75b81dc3","repo":"MaterialDesignInXAML/MaterialDesignInXamlToolkit","slug":"textbox","errorCode":null,"errorMessage":"textBox","messagePattern":"textBox","errorType":"exception","errorClass":"ArgumentNullException","httpStatus":null,"severity":"info","filePath":"src/MaterialDesignThemes.Wpf/HintProxyFabric.RichTextBox.cs","lineNumber":35,"sourceCode":"            var textRange = new TextRange(\n                _richTextBox.Document.ContentStart,\n                _richTextBox.Document.ContentEnd\n            );\n\n            return string.IsNullOrEmpty(textRange.Text) ||\n                textRange.Text == Environment.NewLine;\n        }\n\n        public bool IsFocused() => _richTextBox.IsKeyboardFocused;\n\n        public event EventHandler? ContentChanged;\n        public event EventHandler? IsVisibleChanged;\n        public event EventHandler? Loaded;\n        public event EventHandler? FocusedChanged;\n\n        public RichTextBoxHintProxy(RichTextBox textBox)\n        {\n            _richTextBox = textBox ?? throw new ArgumentNullException(nameof(textBox));\n            _richTextBox.TextChanged += TextBoxTextChanged;\n            _richTextBox.Loaded += TextBoxLoaded;\n            _richTextBox.IsVisibleChanged += TextBoxIsVisibleChanged;\n            _richTextBox.IsKeyboardFocusedChanged += TextBoxIsKeyboardFocusedChanged;\n        }\n\n        private void TextBoxIsKeyboardFocusedChanged(object sender, DependencyPropertyChangedEventArgs e)\n        {\n            FocusedChanged?.Invoke(sender, EventArgs.Empty);\n        }\n\n        private void TextBoxIsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e)\n        {\n            IsVisibleChanged?.Invoke(sender, EventArgs.Empty);\n        }\n\n        private void TextBoxLoaded(object sender, RoutedEventArgs e)\n        {","sourceCodeStart":17,"sourceCodeEnd":53,"githubUrl":"https://github.com/MaterialDesignInXAML/MaterialDesignInXamlToolkit/blob/98edec3a0b96ef272c587b14bcd67ef5f928a7ed/src/MaterialDesignThemes.Wpf/HintProxyFabric.RichTextBox.cs#L17-L53","documentation":"RichTextBoxHintProxy is a private adapter that wires a WPF RichTextBox into MaterialDesign's SmartHint. Its constructor guards against a null RichTextBox by throwing ArgumentNullException(nameof(textBox)). Because the class is private and only ever created by HintProxyFabric.Get() (which already returns null for a null control), this guard is defensive and effectively unreachable through the public API.","triggerScenarios":"Only reachable by instantiating RichTextBoxHintProxy through reflection, or by an internal change to HintProxyFabric that drops its null guard before casting the control to RichTextBox. Normal XAML/SmarlHint usage never calls this constructor directly.","commonSituations":"A developer forking the fabric or reflecting over MaterialDesign internals to add a custom hint control; never seen during ordinary control usage.","solutions":["Do not construct RichTextBoxHintProxy directly; obtain a proxy via HintProxyFabric.Get(control), which null-checks its argument.","If registering a custom builder through HintProxyFabric.RegisterBuilder, return null from the build delegate when the control is null instead of constructing a proxy with a null control."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// These proxies are private; prefer the public fabric entry point.\nif (control is null) return null;\nvar proxy = HintProxyFabric.Get(control);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never reach for the private RichTextBoxHintProxy constructor; use HintProxyFabric.Get().","Register custom builders via HintProxyFabric.RegisterBuilder and let Get() handle null controls."],"tags":["wpf","smarthint","defensive-code","argument-null"],"backgroundTag":null,"analyzedSha":"98edec3a0b96ef272c587b14bcd67ef5f928a7ed","analyzedAt":"2026-08-13T14:31:19.111Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}