{"record":{"id":"84f35adda17e3049","repo":"dotnet/wpf","slug":"file-contains-data-in-format-version-0-but-the-software-can-84f35a","errorCode":null,"errorMessage":"File contains data in format version {0}, but the software can only update that data in format version {1} or lower.","messagePattern":"File contains data in format version (.+?), but the software can only update that data in format version (.+?) or lower\\.","errorType":"exception","errorClass":"FileFormatException","httpStatus":null,"severity":"error","filePath":"src/Microsoft.DotNet.Wpf/src/WindowsBase/System/IO/Packaging/CompoundFile/DataSpaceManager.cs","lineNumber":1662,"sourceCode":"                            );\n        }\n    }\n\n    /// <summary>\n    /// Verify that the current version of this class can update the DataSpace information in\n    /// this file.\n    /// </summary>\n    /// <exception cref=\"FileFormatException\">\n    /// If the current version of this class cannot update the DataSpace information in this file,\n    /// or if the header information in the stream is corrupt.\n    /// </exception>\n    private void ThrowIfIncorrectUpdaterVersion()\n    {\n        EnsureDataSpaceVersionInformation();\n\n        if (!_fileFormatVersion.IsUpdatableBy(DataSpaceCurrentUpdaterVersion))\n        {\n            throw new FileFormatException(\n                            SR.Format(\n                                SR.UpdaterVersionError,\n                                _fileFormatVersion.UpdaterVersion,\n                                DataSpaceCurrentUpdaterVersion\n                                )\n                            );\n        }\n    }\n\n    #endregion Version Methods\n}\n\n/// <summary>\n/// Interface to be implemented by all data transform objects\n/// </summary>\ninternal interface IDataTransform\n{\n    /// <summary>","sourceCodeStart":1644,"sourceCodeEnd":1680,"githubUrl":"https://github.com/dotnet/wpf/blob/81131a70a4c573cd62748a5c36908fc4d662daa9/src/Microsoft.DotNet.Wpf/src/WindowsBase/System/IO/Packaging/CompoundFile/DataSpaceManager.cs#L1644-L1680","documentation":"FileFormatException thrown by DataSpaceManager.ThrowIfIncorrectUpdaterVersion when the compound file's DataSpace format version block records an updater version newer than the version this library supports (currently 1.0). The library can read older data but refuses to open a file that would require upgrade logic it does not implement. This guards against silently corrupting files written by future versions of the format.","triggerScenarios":"Opening (Package.Open or direct CompoundFileContainer access) a compound file whose DataSpace version stream contains an updaterVersion greater than 1.0, i.e. written by a newer implementation that bumped the updater version.","commonSituations":"Files produced by newer .NET/WPF versions or third-party writers that advanced the DataSpace updater version; copying packages between machines with different framework versions; attempting to read a file saved by an upgraded tool with an older runtime.","solutions":["Open/write the file with the same or newer .NET runtime version that produced it","Re-save the file with a tool/runtime whose DataSpace updater version is 1.0 or lower","Inspect the DataSpace version info stream to confirm the updaterVersion recorded in the file","If you own the writer code, do not bump the DataSpace updater version unless the reader is also updated"],"exampleFix":"// before\nvar pkg = Package.Open(path, FileMode.Open); // fails if updaterVersion > 1.0\n// after\nvar pkg = Package.Open(path, FileMode.Open, FileAccess.Read); // same failure possible; instead ensure runtime matches writer, e.g. re-save:\n// using (var newPkg = Package.Open(repairedPath, FileMode.Create)) { /* copy parts from a file written by a compatible runtime */ }","handlingStrategy":"try-catch","validationCode":"// Caller-side: you cannot read the DataSpace version via public API before opening,\n// but you can guard the open call and classify the failure.\ntry {\n    using var pkg = Package.Open(path, FileMode.Open, FileAccess.Read);\n} catch (FileFormatException ex) when (ex.Message.Contains(\"update\")) {\n    // file's DataSpace updater version > 1.0: use the runtime that wrote it\n}","typeGuard":null,"tryCatchPattern":"catch (FileFormatException ex) when (ex.InnerException == null && ex.Message.Contains(\"updater\")) { /* fall back to writer runtime or re-save */ }","preventionTips":["Keep the runtime that reads a package at the same or newer version than the one that wrote it","Do not hand-edit or upgrade DataSpace version streams in compound files","Test cross-version file exchange in CI when upgrading the framework"],"tags":["wpf","packaging","compound-file","version-mismatch"],"backgroundTag":"incompatible-source-type","analyzedSha":"81131a70a4c573cd62748a5c36908fc4d662daa9","analyzedAt":"2026-09-14T10:12:48.479Z","contentChangedAt":"2026-09-14T10:12:48.479Z","schemaVersion":2},"datasetVersion":"2026-09-21T21:30:21.729Z"}