{"record":{"id":"0367706b375f37c3","repo":"MaterialDesignInXAML/MaterialDesignInXamlToolkit","slug":"session-036770","errorCode":null,"errorMessage":"session","messagePattern":"session","errorType":"exception","errorClass":"ArgumentNullException","httpStatus":null,"severity":"error","filePath":"src/MaterialDesignThemes.Wpf/DialogOpenedEventArgs.cs","lineNumber":7,"sourceCode":"﻿namespace MaterialDesignThemes.Wpf;\n\npublic class DialogOpenedEventArgs : RoutedEventArgs\n{\n    public DialogOpenedEventArgs(DialogSession session, RoutedEvent routedEvent)\n    {\n        if (session == null) throw new ArgumentNullException(nameof(session));\n\n        Session = session;\n        RoutedEvent = routedEvent;\n    }\n\n    /// <summary>\n    /// Allows interaction with the current dialog session.\n    /// </summary>\n    public DialogSession Session { get; }\n}\n","sourceCodeStart":1,"sourceCodeEnd":18,"githubUrl":"https://github.com/MaterialDesignInXAML/MaterialDesignInXamlToolkit/blob/98edec3a0b96ef272c587b14bcd67ef5f928a7ed/src/MaterialDesignThemes.Wpf/DialogOpenedEventArgs.cs#L1-L18","documentation":"ArgumentNullException(nameof(session)) in DialogOpenedEventArgs constructor (DialogOpenedEventArgs.cs:7). The args expose Session for interaction during the opened callback, so a null session is illegal. Reachable only when library/user code constructs DialogOpenedEventArgs with null.","triggerScenarios":"Calling 'new DialogOpenedEventArgs(null, routedEvent)' directly, or a custom build raising DialogOpened with a null session.","commonSituations":"Test doubles/fakes; reflection instantiation; library forks raising the routed event manually.","solutions":["Pass a valid DialogSession when constructing DialogOpenedEventArgs; reuse DialogHost.CurrentSession.","Subscribe to DialogOpened instead of constructing the args yourself.","In tests, drive a real DialogHost so the library builds the args."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"DialogSession? session = dialogHost.CurrentSession;\nif (session is null)\n    throw new InvalidOperationException(\"Cannot build DialogOpenedEventArgs without a session.\");\n\nvar args = new DialogOpenedEventArgs(session, DialogHost.DialogOpenedEvent);","typeGuard":"static bool TryBuildOpenedArgs(DialogHost host, out DialogOpenedEventArgs args)\n{\n    args = null!;\n    if (host.CurrentSession is null) return false;\n    args = new DialogOpenedEventArgs(host.CurrentSession, DialogHost.DialogOpenedEvent);\n    return true;\n}","tryCatchPattern":null,"preventionTips":["Never construct DialogOpenedEventArgs with null; reuse DialogHost.CurrentSession.","Subscribe to DialogOpened rather than building args manually.","In tests, drive a real DialogHost lifecycle."],"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"}