dotnet/reactive · error · InvalidOperationException

Settings are invalid: {rxPackagesValidationResult.Message}

Error message

Settings are invalid: {rxPackagesValidationResult.Message}

What it means

RxSourceSettings lazy-parses its package properties; when the parsed package cache is still unset it runs Validate() and throws InvalidOperationException if validation reported a failure (e.g. bad package spec). The message embeds the validation result message so you see the underlying reason. It guards the invariant that parsed Rx/UI framework packages exist before returning them.

Solutions

  1. Fix the package specification passed via command line to '<PackageId>,<Version>' format, e.g. System.Reactive,6.0.1
  2. Run the settings through Validate() or Spectre.Console's own validation before use to get the failure message early
  3. Ensure RxSourceSettings is only constructed/populated through the Spectre.Console command pipeline that guarantees non-null properties

Example fix

// before
dotnet run -- --rx-main-package System.Reactive
// after
dotnet run -- --rx-main-package System.Reactive,6.0.1
Defensive patterns

Strategy: validation

Validate before calling

var result = settings.Validate();
if (!result.Successful) { Console.WriteLine($"Fix settings first: {result.Message}"); return 1; }

Type guard

if (settings.RxMainPackage is not string main || string.IsNullOrEmpty(main) || !main.Contains(',')) { /* reject before use */ }

Try / catch

try { var parsed = settings.RxPackagesParsed; }
catch (InvalidOperationException ex) when (ex.Message.StartsWith("Settings are invalid")) { logger.LogError(ex.Message); }

Prevention

When it happens

Trigger: Accessing the parsed Rx UI framework packages getter (RxPackagesParsed path) when Validate() returned unsuccessful — typically because RxMainPackage or RxUiFrameworkPackages was set to a malformed value like 'System.Reactive' without the required '<PackageId>,<Version>' format.

Common situations: Command-line wiring of the Rx Gauntlet tool with a mistyped --rx-main-package argument, missing version part in a package spec, or Spectre.Console settings used outside the normal command parsing path so defaults were never applied.

Understand the failure class

Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.

Related errors


AI-assisted analysis of dotnet/reactive@94b5d5ab91 (2026-09-15). Data as JSON: /api/errors/574cb7eb3f579fa7. Report an issue: GitHub.

Appendix: source

Thrown at Rx.NET/Test/Gauntlet/RxGauntlet.Common/CommandLine/RxSourceSettings.cs:60

    public PackageIdAndVersion[] RxUiFrameworkPackagesParsed
    {
        get
        {
            if (_parsedRxUiFrameworkPackages is not null)
            {
                return _parsedRxUiFrameworkPackages;
            }

            if (RxUiFrameworkPackages.Length == 0)
            {
                _parsedRxUiFrameworkPackages = [];
            }
            else
            {
                var rxPackagesValidationResult = Validate();
                if (!rxPackagesValidationResult.Successful)
                {
                    throw new InvalidOperationException($"Settings are invalid: {rxPackagesValidationResult.Message}");
                }

                Debug.Assert(_parsedRxUiFrameworkPackages is not null, "RxPackagesParsed should have been set by ValidateRxPackages.");
            }

            return _parsedRxUiFrameworkPackages;
        }
    }

    /// <summary>
    /// Gets all of the Rx packages, starting with the one in <see cref="RxMainPackageParsed"/>, and then,
    /// if present, <see cref="RxLegacyPackageParsed"/>, followed by <see cref="RxUiFrameworkPackagesParsed"/>.
    /// </summary>
    /// <returns></returns>
    public PackageIdAndVersion[] GetAllParsedPackages() =>
        [
            RxMainPackageParsed,

View on GitHub (pinned to 94b5d5ab91)