{"record":{"id":"ac2867efcb36a7de","repo":"dotnet/wpf","slug":"value-cannot-be-null-parameter-featureid","errorCode":null,"errorMessage":"Value cannot be null. (Parameter 'featureId')","messagePattern":"Value cannot be null\\. \\(Parameter 'featureId'\\)","errorType":"validation","errorClass":"ArgumentNullException","httpStatus":null,"severity":"error","filePath":"src/Microsoft.DotNet.Wpf/src/WindowsBase/System/IO/Packaging/CompoundFile/FormatVersion.cs","lineNumber":67,"sourceCode":"            : this(featureId, version, version, version)\n        {\n        }\n\n        /// <summary>\n        /// Constructor for FormatVersion with given featureId and reader, updater,\n        /// and writer version\n        /// </summary>\n        /// <param name=\"featureId\">feature identifier</param>\n        /// <param name=\"writerVersion\">Writer Version</param>\n        /// <param name=\"readerVersion\">Reader Version</param>\n        /// <param name=\"updaterVersion\">Updater Version</param>\n        public FormatVersion(String featureId,\n                                VersionPair writerVersion,\n                                VersionPair readerVersion,\n                                VersionPair updaterVersion)\n        {\n            if (featureId == null)\n                throw new ArgumentNullException(nameof(featureId));\n            if (writerVersion == null)\n                throw new ArgumentNullException(nameof(writerVersion));\n            if (readerVersion == null)\n                throw new ArgumentNullException(nameof(readerVersion));\n            if (updaterVersion == null)\n                throw new ArgumentNullException(nameof(updaterVersion));\n\n            if (featureId.Length == 0)\n            {\n                throw new ArgumentException(SR.ZeroLengthFeatureID);\n            }\n\n            _featureIdentifier = featureId;\n            _reader = readerVersion;\n            _updater = updaterVersion;\n            _writer = writerVersion;\n        }\n","sourceCodeStart":49,"sourceCodeEnd":85,"githubUrl":"https://github.com/dotnet/wpf/blob/81131a70a4c573cd62748a5c36908fc4d662daa9/src/Microsoft.DotNet.Wpf/src/WindowsBase/System/IO/Packaging/CompoundFile/FormatVersion.cs#L49-L85","documentation":"ArgumentNullException from the FormatVersion constructor: a FormatVersion describes one feature's writer/reader/updater versions in the compound-file DataSpace version block, and a null featureId string cannot identify the feature, so construction fails fast.","triggerScenarios":"Calling new FormatVersion(null, writerVersion, readerVersion, updaterVersion) directly, or indirectly through code that builds version records with an uninitialized feature ID.","commonSituations":"Custom DataSpace/transform tooling constructing FormatVersion records; deserializing version blocks where the feature-id field was empty or missing.","solutions":["Pass a non-null, non-empty feature ID string (e.g. \"DataSpace\")","Initialize the featureId variable before constructing FormatVersion","When parsing files, reject or skip version records with missing feature IDs before constructing"],"exampleFix":"// before\nvar fv = new FormatVersion(featureId, w, r, u); // featureId was null\n// after\nif (string.IsNullOrEmpty(featureId)) featureId = \"DataSpace\";\nvar fv = new FormatVersion(featureId, w, r, u);","handlingStrategy":"validation","validationCode":"if (featureId == null) throw new ArgumentException(\"featureId is required\");\nvar fv = new FormatVersion(featureId, writerVersion, readerVersion, updaterVersion);","typeGuard":"static bool IsValidFeatureId(string s) => !string.IsNullOrEmpty(s);","tryCatchPattern":null,"preventionTips":["Validate constructor arguments before building FormatVersion instances","Initialize feature IDs from constants rather than possibly-null variables","When parsing, reject records with missing feature IDs early"],"tags":["null-argument","wpf","packaging"],"backgroundTag":"null-argument","analyzedSha":"81131a70a4c573cd62748a5c36908fc4d662daa9","analyzedAt":"2026-09-14T10:12:48.479Z","contentChangedAt":"2026-09-14T10:12:48.479Z","schemaVersion":2},"datasetVersion":"2026-09-22T01:17:13.364Z"}