{"record":{"id":"f32991669d5992ab","repo":"dotnet/wpf","slug":"transform-identifier-type-is-not-supported","errorCode":null,"errorMessage":"Transform identifier type is not supported.","messagePattern":"Transform identifier type is not supported\\.","errorType":"exception","errorClass":"NotSupportedException","httpStatus":null,"severity":"error","filePath":"src/Microsoft.DotNet.Wpf/src/WindowsBase/System/IO/Packaging/CompoundFile/DataSpaceManager.cs","lineNumber":719,"sourceCode":"            timeSeed++;\n            generatedName = timeSeed.ToString(CultureInfo.InvariantCulture);\n        }\n\n        // Submit the definition\n        DefineDataSpace( transformStack, generatedName );\n\n        return generatedName;\n    }\n\n    /// <summary>\n    /// Tranform object is created. We are no longer using reflection to do this. We are supporting limited data transforms.\n    /// </summary>\n    private IDataTransform InstantiateDataTransformObject(int transformClassType,  string transformClassName, TransformEnvironment transformEnvironment )\n    {\n        object transformInstance = null;\n\n        if (transformClassType != (int) TransformIdentifierTypes_PredefinedTransformName)\n            throw new NotSupportedException(SR.TransformTypeUnsupported);\n\n        // Transform Identifier: we preserve casing, but do case-insensitive comparison\n        if (string.Equals(transformClassName, RightsManagementEncryptionTransform.ClassTransformIdentifier, StringComparison.OrdinalIgnoreCase))\n        {\n            transformInstance = new RightsManagementEncryptionTransform( transformEnvironment);\n        }\n        else if (string.Equals(transformClassName, CompressionTransform.ClassTransformIdentifier, StringComparison.OrdinalIgnoreCase))\n        {\n             transformInstance = new CompressionTransform( transformEnvironment );\n        }\n        else\n        {\n            //this transform class is not supported. Need to change this to appropriate error.\n            throw new ArgumentException(\n                    SR.TransformLabelUndefined);\n        }\n\n        if (null != transformInstance)","sourceCodeStart":701,"sourceCodeEnd":737,"githubUrl":"https://github.com/dotnet/wpf/blob/81131a70a4c573cd62748a5c36908fc4d662daa9/src/Microsoft.DotNet.Wpf/src/WindowsBase/System/IO/Packaging/CompoundFile/DataSpaceManager.cs#L701-L737","documentation":"DataSpaceManager.InstantiateDataTransformObject only supports transform identifier types equal to TransformIdentifierTypes_PredefinedTransformName. When deserializing a stored transform definition whose transformClassType field has any other value, a NotSupportedException with SR.TransformTypeUnsupported is thrown. The library deliberately supports no reflection-based construction of arbitrary transform classes, only a small set of predefined transforms.","triggerScenarios":"Reading a compound file whose data space definition block stores a transform identifier type other than the predefined-transform-name type (e.g. a GUID/CLSID-based or class-name-based identifier written by another producer), causing InstantiateDataTransformObject to be called with transformClassType != TransformIdentifierTypes_PredefinedTransformName during file load.","commonSituations":"Opening a package written by legacy Windows RM/DRM tooling or third-party compound-file writers that used non-predefined transform identifier types; hand-edited or corrupted data space info streams; porting files across WPF/WindowsBase versions where supported identifier types were reduced.","solutions":["Rewrite the file so its transforms are stored with the predefined-transform-name identifier type (e.g. re-save the package without the exotic transform).","Strip the unsupported transform from the package using a tool that rewrites the data space info, then reopen the file.","Pre-check the transform identifier type bytes in the DataSpaceInfo stream before loading and reject the file with a clear custom message.","Catch NotSupportedException during package open and fall back to a read-only/no-transform handling path or surface 'file uses unsupported transform' to the user."],"exampleFix":"// before\nvar package = Package.Open(path); // throws NotSupportedException on odd transform id type\n// after\ntry { var package = Package.Open(path); }\ncatch (NotSupportedException)\n{\n    throw new InvalidDataException(\"Package uses a transform identifier type not supported by this runtime.\");\n}","handlingStrategy":"try-catch","validationCode":"// inspect transform identifier type bytes in the DataSpaceInfo stream before loading\nint idType = ReadInt32At(transformInfoOffset);\nif (idType != 0 /* PredefinedTransformName */) warn(\"file uses unsupported transform identifier type\");","typeGuard":null,"tryCatchPattern":"try { package = Package.Open(path); }\ncatch (NotSupportedException)\n{\n    throw new InvalidDataException(\"Package stores a transform identifier type unsupported by this runtime.\");\n}","preventionTips":["Only write packages using predefined transform name identifiers.","Screen third-party packages for exotic transform identifier types before distribution."],"tags":["unsupported","packaging","compound-file","transform"],"backgroundTag":"unsupported-operation","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"}