{"record":{"id":"a2152da7f7740ead","repo":"dotnet/wpf","slug":"unrecognized-float-type-in-baml-file","errorCode":null,"errorMessage":"Unrecognized float type in BAML file.","messagePattern":"Unrecognized float type in BAML file\\.","errorType":"exception","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/Media/XamlSerializationHelper.cs","lineNumber":345,"sourceCode":"            switch( type ) \n            {\n                case SerializationFloatType.Zero :\n                    return 0.0 ; \n\n                case SerializationFloatType.One :\n                    return 1.0 ; \n\n                case SerializationFloatType.MinusOne :\n                    return -1.0 ; \n\n                case SerializationFloatType.ScaledInteger : \n                    return ReadScaledInteger( reader ); \n\n                case SerializationFloatType.Double :\n                    return reader.ReadDouble(); \n\n                default: \n                    throw new ArgumentException(SR.FloatUnknownBamlType);                 \n            }\n}\n\n        internal static double ReadScaledInteger(BinaryReader reader )\n        {\n            double value = (double) reader.ReadInt32(); \n            value *= inverseScaleFactor ; \n\n            return value ; \n        }\n        \n#endif                     \n\n#if PBTCOMPILER\n\n        \n        /// <summary>\n        /// Parse - returns an instance converted from the provided string.","sourceCodeStart":327,"sourceCodeEnd":363,"githubUrl":"https://github.com/dotnet/wpf/blob/81131a70a4c573cd62748a5c36908fc4d662daa9/src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/Media/XamlSerializationHelper.cs#L327-L363","documentation":"XamlSerializationHelper.ReadDouble throws ArgumentException ('Unrecognized float type in BAML file.') when the SerializationFloatType discriminant read from a BAML stream is not one of the known cases (e.g. scaled-integer or Double). The BAML binary format encodes doubles with a type tag, and an unknown tag means the stream is corrupt or was produced by an incompatible writer version.","triggerScenarios":"Loading BAML whose float type byte is undefined in the current reader — typically a BAML file from a newer .NET/WPF version being read by an older runtime, or a corrupted resource stream.","commonSituations":"Version mismatch after retargeting an application; partially deployed or corrupted assemblies/resource streams; manually edited or third-party-generated BAML.","solutions":["Rebuild the application so BAML is regenerated by the same .NET/WPF version that runs it","Ensure the runtime .NET version is >= the version used to compile the XAML","Repair/redistribute the corrupted assembly or resource file"],"exampleFix":"// before\n// running app built with net6.0 BAML on a legacy WPF runtime\n// after\n// rebuild with matching TargetFramework, or:\n// dotnet build -c Release  (then redeploy all DLLs together)","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { bamlReader.Read(); }\ncatch (ArgumentException ex) when (ex.Message.Contains(\"Unrecognized float type\")) { /* rebuild/redeploy BAML resources */ }","preventionTips":["Match build-time and runtime .NET/WPF versions","Rebuild XAML after retargeting frameworks","Verify assembly integrity on deployment"],"tags":["baml","deserialization","wpf"],"backgroundTag":"internal-invariant-violation","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"}