{"record":{"id":"7b5cef40912292e6","repo":"MaterialDesignInXAML/MaterialDesignInXamlToolkit","slug":"owner","errorCode":null,"errorMessage":"owner","messagePattern":"owner","errorType":"exception","errorClass":"ArgumentNullException","httpStatus":null,"severity":"error","filePath":"src/MaterialDesignThemes.Wpf/DialogSession.cs","lineNumber":13,"sourceCode":"using System.Windows.Threading;\n\nnamespace MaterialDesignThemes.Wpf;\n\n/// <summary>\n/// Allows an open dialog to be managed. Use is only permitted during a single display operation.\n/// </summary>\npublic class DialogSession\n{\n    private readonly DialogHost _owner;\n\n    internal DialogSession(DialogHost owner)\n        => _owner = owner ?? throw new ArgumentNullException(nameof(owner));\n\n    /// <summary>\n    /// Indicates if the dialog session has ended.  Once ended no further method calls will be permitted.\n    /// </summary>\n    /// <remarks>\n    /// Client code cannot set this directly, this is internally managed.  To end the dialog session use <see cref=\"Close()\"/>.\n    /// </remarks>\n    public bool IsEnded { get; internal set; }\n\n    /// <summary>\n    /// The parameter passed to the <see cref=\"DialogHost.CloseDialogCommand\" /> and return by <see cref=\"DialogHost.Show(object)\"/>\n    /// </summary>\n    internal object? CloseParameter { get; set; }\n\n    /// <summary>\n    /// Gets the <see cref=\"DialogHost.DialogContent\"/> which is currently displayed, so this could be a view model or a UI element.\n    /// </summary>\n    public object? Content => _owner.DialogContent;","sourceCodeStart":1,"sourceCodeEnd":31,"githubUrl":"https://github.com/MaterialDesignInXAML/MaterialDesignInXamlToolkit/blob/98edec3a0b96ef272c587b14bcd67ef5f928a7ed/src/MaterialDesignThemes.Wpf/DialogSession.cs#L1-L31","documentation":"ArgumentNullException(nameof(owner)) in DialogSession's internal constructor (DialogSession.cs:13). A DialogSession must reference the DialogHost that owns it; constructing one without an owner is illegal. Not reachable via public API since the constructor is internal and the host always supplies itself.","triggerScenarios":"Forks/reflection/test doubles invoking 'new DialogSession(null)'; the shipped host always passes 'this'.","commonSituations":"Unit-test fakes of DialogSession; reflection; modified library builds.","solutions":["Do not construct DialogSession directly; obtain it from DialogHost.CurrentSession or the DialogOpened/Closing event args.","If a fake is required, wrap a real DialogHost instance instead of passing null.","Avoid reflection-based construction of internal types."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"DialogSession? session = dialogHost.CurrentSession;\nif (session is null)\n    throw new InvalidOperationException(\"No active session to reference.\");\n\n// Use 'session'; never construct DialogSession manually.","typeGuard":"static bool TryGetSession(DialogHost host, out DialogSession session)\n{\n    session = host.CurrentSession!;\n    return session is not null;\n}","tryCatchPattern":null,"preventionTips":["Obtain DialogSession from DialogHost.CurrentSession or event args; never construct it directly.","Avoid reflection on internal types.","In tests, wrap a real DialogHost rather than faking DialogSession."],"tags":["wpf","materialdesigninxaml","argument-null","internal","dialog"],"backgroundTag":null,"analyzedSha":"98edec3a0b96ef272c587b14bcd67ef5f928a7ed","analyzedAt":"2026-08-13T14:31:19.111Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}