dotnet/wpf · error · ArgumentNullException

Value cannot be null. (Parameter 'updaterVersion')

Error message

Value cannot be null. (Parameter 'updaterVersion')

What it means

ArgumentNullException from the FormatVersion constructor when updaterVersion is null. The updater version records the minimum version able to update the data and, like the other two versions, must be present for a valid DataSpace version entry.

Solutions

  1. Pass a valid VersionPair for updaterVersion (e.g. new VersionPair(1, 0))
  2. Verify all three version arguments before invoking the constructor
  3. Use the DataSpaceCurrentUpdaterVersion equivalent (1.0) as a default

Example fix

// before
var fv = new FormatVersion(id, writer, reader, null);
// after
var updater = new VersionPair(1, 0);
var fv = new FormatVersion(id, writer, reader, updater);
Defensive patterns

Strategy: validation

Validate before calling

if (updaterVersion == null) throw new ArgumentException("updaterVersion is required");
var fv = new FormatVersion(featureId, writerVersion, readerVersion, updaterVersion);

Type guard

static bool IsValidVersion(VersionPair v) => v != null;

Prevention

When it happens

Trigger: new FormatVersion(featureId, writerVersion, readerVersion, null) — passing a null updater VersionPair.

Common situations: Constructing version blocks in tooling that only tracks writer/reader versions; uninitialized fields after refactoring.

Related errors


AI-assisted analysis of dotnet/wpf@81131a70a4 (2026-09-14). Data as JSON: /api/errors/9c2baf90afc716cc. Report an issue: GitHub.

Appendix: source

Thrown at src/Microsoft.DotNet.Wpf/src/WindowsBase/System/IO/Packaging/CompoundFile/FormatVersion.cs:73

        /// and writer version
        /// </summary>
        /// <param name="featureId">feature identifier</param>
        /// <param name="writerVersion">Writer Version</param>
        /// <param name="readerVersion">Reader Version</param>
        /// <param name="updaterVersion">Updater Version</param>
        public FormatVersion(String featureId,
                                VersionPair writerVersion,
                                VersionPair readerVersion,
                                VersionPair updaterVersion)
        {
            if (featureId == null)
                throw new ArgumentNullException(nameof(featureId));
            if (writerVersion == null)
                throw new ArgumentNullException(nameof(writerVersion));
            if (readerVersion == null)
                throw new ArgumentNullException(nameof(readerVersion));
            if (updaterVersion == null)
                throw new ArgumentNullException(nameof(updaterVersion));

            if (featureId.Length == 0)
            {
                throw new ArgumentException(SR.ZeroLengthFeatureID);
            }

            _featureIdentifier = featureId;
            _reader = readerVersion;
            _updater = updaterVersion;
            _writer = writerVersion;
        }

        #endregion Constructors

        //------------------------------------------------------
        //
        //  Public Properties
        //

View on GitHub (pinned to 81131a70a4)