{"record":{"id":"50acdfba8a104a8c","repo":"dotnet/reactive","slug":"rxuiframeworkpackages-must-not-be-null","errorCode":null,"errorMessage":"RxUiFrameworkPackages  must not be null.","messagePattern":"RxUiFrameworkPackages  must not be null\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"Rx.NET/Test/Gauntlet/RxGauntlet.Common/CommandLine/RxSourceSettings.cs","lineNumber":105,"sourceCode":"    /// </summary>\n    /// <returns>A value indicating whether the settings are valid.</returns>\n    /// <exception cref=\"InvalidOperationException\">\n    /// Thrown if this object's properties are set in a way that we do not expect from Spectre Console CLI.\n    /// </exception>\n    public override ValidationResult Validate()\n    {\n        // Spectre Console will never make the following properties null, so this can only mean that we're being used\n        // in an unsupported way (probably not via Spectre.Console) so we throw instead of reporting a validation\n        // failure.\n\n        if (RxMainPackage is not string rxMainPackage)\n        {\n            throw new InvalidOperationException($\"{nameof(RxMainPackage)} must not be null.\");\n        }\n\n        if (RxUiFrameworkPackages is not string[] rxUiPackages)\n        {\n            throw new InvalidOperationException($\"{nameof(RxUiFrameworkPackages)}  must not be null.\");\n        }\n\n        if (!PackageIdAndVersion.TryParse(rxMainPackage, out _parsedRxMainPackage))\n        {\n            return ValidationResult.Error($\"Invalid package specification: {RxMainPackage}. Must be <PackageId>,<Version>\");\n        }\n\n        if (RxLegacyPackage is string rxLegacyPackage &&\n            !PackageIdAndVersion.TryParse(rxLegacyPackage, out _parsedRxLegacyPackage))\n        {\n            return ValidationResult.Error($\"Invalid package specification: {rxLegacyPackage}. Must be <PackageId>,<Version>\");\n        }\n\n        HashSet<string> uiPackageIdsSeen = new(capacity: rxUiPackages.Length);\n        var uiPackageIdsAndVersions = new PackageIdAndVersion[rxUiPackages.Length];\n        for (var i = 0; i < rxUiPackages.Length; i++)\n        {\n            if (!PackageIdAndVersion.TryParse(rxUiPackages[i], out var packageIdAndVersion))","sourceCodeStart":87,"sourceCodeEnd":123,"githubUrl":"https://github.com/dotnet/reactive/blob/94b5d5ab912789f5abe9a72138a25bbd716fe59c/Rx.NET/Test/Gauntlet/RxGauntlet.Common/CommandLine/RxSourceSettings.cs#L87-L123","documentation":"Same guard as the RxMainPackage check, applied to RxUiFrameworkPackages: it must be a non-null string[]. Spectre.Console would never bind null, so null signals use outside the supported command pipeline. Note the message contains a double space ('RxUiFrameworkPackages  must not be null.') due to a typo in the source.","triggerScenarios":"Calling Validate() on an RxSourceSettings where RxMainPackage is set but RxUiFrameworkPackages was never assigned (is null or not a string[]), outside Spectre.Console binding.","commonSituations":"Manual construction in tests or tooling that sets only RxMainPackage; refactoring that renamed/removed the RxUiFrameworkPackages assignment.","solutions":["Assign RxUiFrameworkPackages to a non-null string[] of '<PackageId>,<Version>' entries before validating","Use the Spectre.Console command pipeline so both properties are always bound","Search for the double-space in the message if you are matching it in tests — the literal text has two spaces"],"exampleFix":"// before\nvar settings = new RxSourceSettings { RxMainPackage = \"System.Reactive,6.0.1\" };\n// after\nvar settings = new RxSourceSettings { RxMainPackage = \"System.Reactive,6.0.1\", RxUiFrameworkPackages = new[] { \"Rx.WPF,1.0.0\", \"Rx.Maui,1.0.0\" } };","handlingStrategy":"validation","validationCode":"if (settings.RxUiFrameworkPackages is not string[] pkgs || pkgs.Length == 0) { throw new ArgumentException(\"RxUiFrameworkPackages must be a non-empty string[]\"); }","typeGuard":"bool usable = settings.RxUiFrameworkPackages is string[] p && p.All(x => x.Contains(','));","tryCatchPattern":"try { settings.Validate(); }\ncatch (InvalidOperationException ex) when (ex.Message.Contains(\"RxUiFrameworkPackages\")) { /* supply the packages array */ }","preventionTips":["Set RxUiFrameworkPackages alongside RxMainPackage in any manual construction","Remember the error message has a double space; match it exactly in tests","Prefer Spectre.Console binding so the array is always populated"],"tags":["csharp","null-argument","api-misuse","spectre-console"],"backgroundTag":"null-argument","analyzedSha":"94b5d5ab912789f5abe9a72138a25bbd716fe59c","analyzedAt":"2026-09-15T02:26:24.759Z","contentChangedAt":"2026-09-15T02:26:24.759Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}