{"record":{"id":"02e8bd86e8348f25","repo":"AvaloniaUI/Avalonia","slug":"stack","errorCode":null,"errorMessage":"stack","messagePattern":"stack","errorType":"exception","errorClass":"ArgumentNullException","httpStatus":null,"severity":"info","filePath":"src/Avalonia.Base/Collections/Pooled/StackDebugView.cs","lineNumber":16,"sourceCode":"﻿// Licensed to the .NET Foundation under one or more agreements.\n// The .NET Foundation licenses this file to you under the MIT license.\n// See the LICENSE file in the project root for more information.\n\nusing System;\nusing System.Diagnostics;\n\nnamespace Avalonia.Collections.Pooled\n{\n    internal sealed class StackDebugView<T>\n    {\n        private readonly PooledStack<T> _stack;\n\n        public StackDebugView(PooledStack<T> stack)\n        {\n            _stack = stack ?? throw new ArgumentNullException(nameof(stack));\n        }\n\n        [DebuggerBrowsable(DebuggerBrowsableState.RootHidden)]\n        public T[] Items\n        {\n            get\n            {\n                return _stack.ToArray();\n            }\n        }\n    }\n}\n","sourceCodeStart":1,"sourceCodeEnd":29,"githubUrl":"https://github.com/AvaloniaUI/Avalonia/blob/11c542726898ae954a1ef668c65ec79ec92ab17d/src/Avalonia.Base/Collections/Pooled/StackDebugView.cs#L1-L29","documentation":"Constructor null guard in the internal StackDebugView<T> debugger proxy: `stack ?? throw new ArgumentNullException(nameof(stack))`. Like ICollectionDebugView, this is a DebuggerTypeProxy used by the IDE to render a PooledStack; it is not part of the user-facing runtime API. It only fires when the proxy is constructed for a null stack.","triggerScenarios":"The debugger instantiates StackDebugView for a PooledStack field/variable that is null while browsing Locals/Watch, or direct construction `new StackDebugView<T>(null)` in a test.","commonSituations":"Inspecting an uninitialized/null PooledStack field in the debugger; a debug session showing a stack before assignment. The throw is debugger-scoped and does not occur in a normal run.","solutions":["Initialize the stack field so it is non-null before inspection.","Ignore it — this originates from the debugger proxy, not your executed code path.","In a test that builds the proxy directly, pass a non-null PooledStack."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Debugger-only proxy; ensure PooledStack fields are non-null before inspection.\n// No runtime validation path in product code.","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Initialize PooledStack fields at declaration.","Recognize StackDebugView throws are debugger-scoped, not runtime.","Do not construct this internal proxy in product code."],"tags":["csharp","debug","debugger-type-proxy","null-argument","pooled"],"backgroundTag":null,"analyzedSha":"11c542726898ae954a1ef668c65ec79ec92ab17d","analyzedAt":"2026-08-13T11:57:40.261Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}