From 053ad3749cb6613aaff1b92e396bdbf1443eeb33 Mon Sep 17 00:00:00 2001 From: Tomas Grosup Date: Fri, 20 Feb 2026 16:09:43 +0100 Subject: [PATCH 01/16] Fix F# exception serialization to preserve fields Fixes #878 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../.FSharp.Compiler.Service/10.0.300.md | 2 + src/Compiler/CodeGen/IlxGen.fs | 102 +++++++++++++- .../CodeGenRegressions_Exceptions.fs | 107 ++++++++++++++ .../Nullness/ExceptionType.fs.il.netcore.bsl | 132 +++++++++++++++++- ...nternalSignatureOff.il.netcore.release.bsl | 61 +++++++- ...InternalSignatureOn.il.netcore.release.bsl | 61 +++++++- ...nternalSignatureOff.il.netcore.release.bsl | 91 +++++++++++- ...InternalSignatureOn.il.netcore.release.bsl | 91 +++++++++++- .../FSharp.Compiler.ComponentTests.fsproj | 1 + 9 files changed, 628 insertions(+), 20 deletions(-) create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/CodeGenRegressions/CodeGenRegressions_Exceptions.fs diff --git a/docs/release-notes/.FSharp.Compiler.Service/10.0.300.md b/docs/release-notes/.FSharp.Compiler.Service/10.0.300.md index 53802cc1153..11f161bffaf 100644 --- a/docs/release-notes/.FSharp.Compiler.Service/10.0.300.md +++ b/docs/release-notes/.FSharp.Compiler.Service/10.0.300.md @@ -49,4 +49,6 @@ * Symbols: safer qualified name getting ([PR #19298](https://github.com/dotnet/fsharp/pull/19298)) +* Fix F# exception serialization now preserves fields. (Issue [#878](https://github.com/dotnet/fsharp/issues/878), [PR #19342](https://github.com/dotnet/fsharp/pull/19342)) + ### Breaking Changes diff --git a/src/Compiler/CodeGen/IlxGen.fs b/src/Compiler/CodeGen/IlxGen.fs index b76cc30293f..c5741f8fff2 100644 --- a/src/Compiler/CodeGen/IlxGen.fs +++ b/src/Compiler/CodeGen/IlxGen.fs @@ -12203,6 +12203,49 @@ and GenExnDef cenv mgbuf eenv m (exnc: Tycon) : ILTypeRef option = match g.iltyp_SerializationInfo, g.iltyp_StreamingContext with | Some serializationInfoType, Some streamingContextType -> + let emitSerializationFieldIL emitPerField = + [ + for (ilPropName, ilFieldName, ilPropType, _) in fieldNamesAndTypes do + yield! emitPerField ilPropName ilFieldName ilPropType + ] + + let isILValueType (ty: ILType) = + ty.IsNominal && ty.Boxity = ILBoxity.AsValue + + let ilInstrsToRestoreFields = + emitSerializationFieldIL (fun ilPropName ilFieldName ilPropType -> + [ + mkLdarg0 + mkLdarg 1us + I_ldstr ilPropName + I_ldtoken(ILToken.ILType ilPropType) + + mkNormalCall ( + mkILNonGenericStaticMethSpecInTy ( + g.ilg.typ_Type, + "GetTypeFromHandle", + [ g.iltyp_RuntimeTypeHandle ], + g.ilg.typ_Type + ) + ) + + mkNormalCallvirt ( + mkILNonGenericInstanceMethSpecInTy ( + serializationInfoType, + "GetValue", + [ g.ilg.typ_String; g.ilg.typ_Type ], + g.ilg.typ_Object + ) + ) + + if isILValueType ilPropType then + I_unbox_any ilPropType + else + I_castclass ilPropType + + mkNormalStfld (mkILFieldSpecInTy (ilThisTy, ilFieldName, ilPropType)) + ]) + let ilInstrsForSerialization = [ mkLdarg0 @@ -12210,6 +12253,10 @@ and GenExnDef cenv mgbuf eenv m (exnc: Tycon) : ILTypeRef option = mkLdarg 2us mkNormalCall (mkILCtorMethSpecForTy (g.iltyp_Exception, [ serializationInfoType; streamingContextType ])) ] + @ (if fieldNamesAndTypes.IsEmpty then + [] + else + ilInstrsToRestoreFields) |> nonBranchingInstrsToCode let ilCtorDefForSerialization = @@ -12222,7 +12269,60 @@ and GenExnDef cenv mgbuf eenv m (exnc: Tycon) : ILTypeRef option = mkMethodBody (false, [], 8, ilInstrsForSerialization, None, eenv.imports) ) - [ ilCtorDefForSerialization ] + let ilInstrsToSaveFields = + emitSerializationFieldIL (fun ilPropName ilFieldName ilPropType -> + [ + mkLdarg 1us + I_ldstr ilPropName + mkLdarg0 + mkNormalLdfld (mkILFieldSpecInTy (ilThisTy, ilFieldName, ilPropType)) + + if isILValueType ilPropType then + I_box ilPropType + + mkNormalCallvirt ( + mkILNonGenericInstanceMethSpecInTy ( + serializationInfoType, + "AddValue", + [ g.ilg.typ_String; g.ilg.typ_Object ], + ILType.Void + ) + ) + ]) + + let ilInstrsForGetObjectData = + [ + mkLdarg0 + mkLdarg 1us + mkLdarg 2us + mkNormalCall ( + mkILNonGenericInstanceMethSpecInTy ( + g.iltyp_Exception, + "GetObjectData", + [ serializationInfoType; streamingContextType ], + ILType.Void + ) + ) + ] + @ ilInstrsToSaveFields + |> nonBranchingInstrsToCode + + let ilGetObjectDataDef = + mkILNonGenericVirtualInstanceMethod ( + "GetObjectData", + ILMemberAccess.Public, + [ + mkILParamNamed ("info", serializationInfoType) + mkILParamNamed ("context", streamingContextType) + ], + mkILReturn ILType.Void, + mkMethodBody (false, [], 8, ilInstrsForGetObjectData, None, eenv.imports) + ) + + if fieldNamesAndTypes.IsEmpty then + [ ilCtorDefForSerialization ] + else + [ ilCtorDefForSerialization; ilGetObjectDataDef ] | _ -> [] let ilTypeName = tref.Name diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/CodeGenRegressions/CodeGenRegressions_Exceptions.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/CodeGenRegressions/CodeGenRegressions_Exceptions.fs new file mode 100644 index 00000000000..bccea2b9a5c --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/CodeGenRegressions/CodeGenRegressions_Exceptions.fs @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. + +namespace EmittedIL + +open Xunit +open FSharp.Test +open FSharp.Test.Compiler +open FSharp.Test.Utilities + +module CodeGenRegressions_Exceptions = + + let private getActualIL (result: CompilationResult) = + match result with + | CompilationResult.Success s -> + match s.OutputPath with + | Some p -> + let (_, _, actualIL) = ILChecker.verifyILAndReturnActual [] p [ "// dummy" ] + actualIL + | None -> failwith "No output path" + | _ -> failwith "Compilation failed" + + // https://github.com/dotnet/fsharp/issues/878 + [] + let ``Issue_878_ExceptionSerialization`` () = + let source = """ +module Test + +exception Foo of x:string * y:int +""" + let result = + FSharp source + |> asLibrary + |> compile + |> shouldSucceed + + result + |> verifyIL [ + ".method public strict virtual instance void GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo info, valuetype [runtime]System.Runtime.Serialization.StreamingContext context) cil managed" + "call instance void [runtime]System.Exception::GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo," + ".method family specialname rtspecialname instance void .ctor(class [runtime]System.Runtime.Serialization.SerializationInfo info, valuetype [runtime]System.Runtime.Serialization.StreamingContext context) cil managed" + ] + |> ignore + + let actualIL = getActualIL result + Assert.Contains("AddValue", actualIL) + + // https://github.com/dotnet/fsharp/issues/878 + + [] + let ``Issue_878_ExceptionSerialization_Roundtrip`` () = + let source = """ +module Test +open System +open System.Runtime.Serialization + +#nowarn "44" // Serialization types are obsolete but needed for testing ISerializable +#nowarn "67" + +exception Foo of x:string * y:int + +let roundtrip (e: Exception) = + let info = SerializationInfo(e.GetType(), FormatterConverter()) + let ctx = StreamingContext(StreamingContextStates.All) + e.GetObjectData(info, ctx) + let ctor = + e.GetType().GetConstructor( + System.Reflection.BindingFlags.Instance ||| System.Reflection.BindingFlags.NonPublic ||| System.Reflection.BindingFlags.Public, + null, + [| typeof; typeof |], + null) + if ctor = null then failwith "Deserialization constructor not found" + ctor.Invoke([| info :> obj; ctx :> obj |]) :?> Exception + +[] +let main _ = + let original = Foo("value", 42) + // Check GetObjectData actually writes our fields + let info = SerializationInfo(original.GetType(), FormatterConverter()) + let ctx = StreamingContext(StreamingContextStates.All) + original.GetObjectData(info, ctx) + let xVal = info.GetString("x") + let yVal = info.GetInt32("y") + if xVal <> "value" then failwithf "GetObjectData: Expected x='value', got '%s'" xVal + if yVal <> 42 then failwithf "GetObjectData: Expected y=42, got %d" yVal + + // Check full roundtrip + let cloned = roundtrip original + // Access fields via internal backing fields using reflection + let xField = cloned.GetType().GetField("x@", System.Reflection.BindingFlags.Instance ||| System.Reflection.BindingFlags.NonPublic) + let yField = cloned.GetType().GetField("y@", System.Reflection.BindingFlags.Instance ||| System.Reflection.BindingFlags.NonPublic) + if xField = null then failwith "Field x@ not found" + if yField = null then failwith "Field y@ not found" + let xCloned = xField.GetValue(cloned) :?> string + let yCloned = yField.GetValue(cloned) :?> int + if xCloned <> "value" then failwithf "Roundtrip: Expected x='value', got '%s'" xCloned + if yCloned <> 42 then failwithf "Roundtrip: Expected y=42, got %d" yCloned + printfn "SUCCESS: Foo(value, 42) roundtripped correctly" + 0 +""" + FSharp source + |> asExe + |> ignoreWarnings + |> compile + |> shouldSucceed + |> run + |> shouldSucceed + |> ignore diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/ExceptionType.fs.il.netcore.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/ExceptionType.fs.il.netcore.bsl index 2a8a0c50d27..f2e6ff73712 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/ExceptionType.fs.il.netcore.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/ExceptionType.fs.il.netcore.bsl @@ -62,7 +62,34 @@ IL_0002: ldarg.2 IL_0003: call instance void [runtime]System.Exception::.ctor(class [runtime]System.Runtime.Serialization.SerializationInfo, valuetype [runtime]System.Runtime.Serialization.StreamingContext) - IL_0008: ret + IL_0008: ldarg.0 + IL_0009: ldarg.1 + IL_000a: ldstr "Data0" + IL_000f: ldtoken [runtime]System.String + IL_0014: call class [runtime]System.Type [runtime]System.Type::GetTypeFromHandle(valuetype [runtime]System.RuntimeTypeHandle) + IL_0019: callvirt instance object [runtime]System.Runtime.Serialization.SerializationInfo::GetValue(string, + class [runtime]System.Type) + IL_001e: castclass [runtime]System.String + IL_0023: stfld string MyLibrary/JustStringE::Data0@ + IL_0028: ret + } + + .method public strict virtual instance void GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo info, valuetype [runtime]System.Runtime.Serialization.StreamingContext context) cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldarg.1 + IL_0002: ldarg.2 + IL_0003: call instance void [runtime]System.Exception::GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo, + valuetype [runtime]System.Runtime.Serialization.StreamingContext) + IL_0008: ldarg.1 + IL_0009: ldstr "Data0" + IL_000e: ldarg.0 + IL_000f: ldfld string MyLibrary/JustStringE::Data0@ + IL_0014: callvirt instance void [runtime]System.Runtime.Serialization.SerializationInfo::AddValue(string, + object) + IL_0019: ret } .method public hidebysig specialname instance string get_Data0() cil managed @@ -137,7 +164,49 @@ IL_0002: ldarg.2 IL_0003: call instance void [runtime]System.Exception::.ctor(class [runtime]System.Runtime.Serialization.SerializationInfo, valuetype [runtime]System.Runtime.Serialization.StreamingContext) - IL_0008: ret + IL_0008: ldarg.0 + IL_0009: ldarg.1 + IL_000a: ldstr "M1" + IL_000f: ldtoken [runtime]System.String + IL_0014: call class [runtime]System.Type [runtime]System.Type::GetTypeFromHandle(valuetype [runtime]System.RuntimeTypeHandle) + IL_0019: callvirt instance object [runtime]System.Runtime.Serialization.SerializationInfo::GetValue(string, + class [runtime]System.Type) + IL_001e: castclass [runtime]System.String + IL_0023: stfld string MyLibrary/TwoStrings::M1@ + IL_0028: ldarg.0 + IL_0029: ldarg.1 + IL_002a: ldstr "M2" + IL_002f: ldtoken [runtime]System.String + IL_0034: call class [runtime]System.Type [runtime]System.Type::GetTypeFromHandle(valuetype [runtime]System.RuntimeTypeHandle) + IL_0039: callvirt instance object [runtime]System.Runtime.Serialization.SerializationInfo::GetValue(string, + class [runtime]System.Type) + IL_003e: castclass [runtime]System.String + IL_0043: stfld string MyLibrary/TwoStrings::M2@ + IL_0048: ret + } + + .method public strict virtual instance void GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo info, valuetype [runtime]System.Runtime.Serialization.StreamingContext context) cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldarg.1 + IL_0002: ldarg.2 + IL_0003: call instance void [runtime]System.Exception::GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo, + valuetype [runtime]System.Runtime.Serialization.StreamingContext) + IL_0008: ldarg.1 + IL_0009: ldstr "M1" + IL_000e: ldarg.0 + IL_000f: ldfld string MyLibrary/TwoStrings::M1@ + IL_0014: callvirt instance void [runtime]System.Runtime.Serialization.SerializationInfo::AddValue(string, + object) + IL_0019: ldarg.1 + IL_001a: ldstr "M2" + IL_001f: ldarg.0 + IL_0020: ldfld string MyLibrary/TwoStrings::M2@ + IL_0025: callvirt instance void [runtime]System.Runtime.Serialization.SerializationInfo::AddValue(string, + object) + IL_002a: ret } .method public hidebysig specialname instance string get_M1() cil managed @@ -226,7 +295,34 @@ IL_0002: ldarg.2 IL_0003: call instance void [runtime]System.Exception::.ctor(class [runtime]System.Runtime.Serialization.SerializationInfo, valuetype [runtime]System.Runtime.Serialization.StreamingContext) - IL_0008: ret + IL_0008: ldarg.0 + IL_0009: ldarg.1 + IL_000a: ldstr "Data0" + IL_000f: ldtoken [runtime]System.String + IL_0014: call class [runtime]System.Type [runtime]System.Type::GetTypeFromHandle(valuetype [runtime]System.RuntimeTypeHandle) + IL_0019: callvirt instance object [runtime]System.Runtime.Serialization.SerializationInfo::GetValue(string, + class [runtime]System.Type) + IL_001e: castclass [runtime]System.String + IL_0023: stfld string MyLibrary/NullableStringE::Data0@ + IL_0028: ret + } + + .method public strict virtual instance void GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo info, valuetype [runtime]System.Runtime.Serialization.StreamingContext context) cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldarg.1 + IL_0002: ldarg.2 + IL_0003: call instance void [runtime]System.Exception::GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo, + valuetype [runtime]System.Runtime.Serialization.StreamingContext) + IL_0008: ldarg.1 + IL_0009: ldstr "Data0" + IL_000e: ldarg.0 + IL_000f: ldfld string MyLibrary/NullableStringE::Data0@ + IL_0014: callvirt instance void [runtime]System.Runtime.Serialization.SerializationInfo::AddValue(string, + object) + IL_0019: ret } .method public hidebysig specialname instance string get_Data0() cil managed @@ -300,7 +396,34 @@ IL_0002: ldarg.2 IL_0003: call instance void [runtime]System.Exception::.ctor(class [runtime]System.Runtime.Serialization.SerializationInfo, valuetype [runtime]System.Runtime.Serialization.StreamingContext) - IL_0008: ret + IL_0008: ldarg.0 + IL_0009: ldarg.1 + IL_000a: ldstr "Message" + IL_000f: ldtoken [runtime]System.String + IL_0014: call class [runtime]System.Type [runtime]System.Type::GetTypeFromHandle(valuetype [runtime]System.RuntimeTypeHandle) + IL_0019: callvirt instance object [runtime]System.Runtime.Serialization.SerializationInfo::GetValue(string, + class [runtime]System.Type) + IL_001e: castclass [runtime]System.String + IL_0023: stfld string MyLibrary/NullableMessage::Message@ + IL_0028: ret + } + + .method public strict virtual instance void GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo info, valuetype [runtime]System.Runtime.Serialization.StreamingContext context) cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldarg.1 + IL_0002: ldarg.2 + IL_0003: call instance void [runtime]System.Exception::GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo, + valuetype [runtime]System.Runtime.Serialization.StreamingContext) + IL_0008: ldarg.1 + IL_0009: ldstr "Message" + IL_000e: ldarg.0 + IL_000f: ldfld string MyLibrary/NullableMessage::Message@ + IL_0014: callvirt instance void [runtime]System.Runtime.Serialization.SerializationInfo::AddValue(string, + object) + IL_0019: ret } .method public hidebysig specialname virtual instance string get_Message() cil managed @@ -334,4 +457,3 @@ - diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule.fs.RealInternalSignatureOff.il.netcore.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule.fs.RealInternalSignatureOff.il.netcore.release.bsl index 9c163b8ec4e..50410ebe0e5 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule.fs.RealInternalSignatureOff.il.netcore.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule.fs.RealInternalSignatureOff.il.netcore.release.bsl @@ -480,7 +480,35 @@ IL_0002: ldarg.2 IL_0003: call instance void [runtime]System.Exception::.ctor(class [runtime]System.Runtime.Serialization.SerializationInfo, valuetype [runtime]System.Runtime.Serialization.StreamingContext) - IL_0008: ret + IL_0008: ldarg.0 + IL_0009: ldarg.1 + IL_000a: ldstr "Data0" + IL_000f: ldtoken [runtime]System.Int32 + IL_0014: call class [runtime]System.Type [runtime]System.Type::GetTypeFromHandle(valuetype [runtime]System.RuntimeTypeHandle) + IL_0019: callvirt instance object [runtime]System.Runtime.Serialization.SerializationInfo::GetValue(string, + class [runtime]System.Type) + IL_001e: unbox.any [runtime]System.Int32 + IL_0023: stfld int32 ABC/MyExn::Data0@ + IL_0028: ret + } + + .method public strict virtual instance void GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo info, valuetype [runtime]System.Runtime.Serialization.StreamingContext context) cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldarg.1 + IL_0002: ldarg.2 + IL_0003: call instance void [runtime]System.Exception::GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo, + valuetype [runtime]System.Runtime.Serialization.StreamingContext) + IL_0008: ldarg.1 + IL_0009: ldstr "Data0" + IL_000e: ldarg.0 + IL_000f: ldfld int32 ABC/MyExn::Data0@ + IL_0014: box [runtime]System.Int32 + IL_0019: callvirt instance void [runtime]System.Runtime.Serialization.SerializationInfo::AddValue(string, + object) + IL_001e: ret } .method public hidebysig specialname instance int32 get_Data0() cil managed @@ -1180,7 +1208,35 @@ IL_0002: ldarg.2 IL_0003: call instance void [runtime]System.Exception::.ctor(class [runtime]System.Runtime.Serialization.SerializationInfo, valuetype [runtime]System.Runtime.Serialization.StreamingContext) - IL_0008: ret + IL_0008: ldarg.0 + IL_0009: ldarg.1 + IL_000a: ldstr "Data0" + IL_000f: ldtoken [runtime]System.Int32 + IL_0014: call class [runtime]System.Type [runtime]System.Type::GetTypeFromHandle(valuetype [runtime]System.RuntimeTypeHandle) + IL_0019: callvirt instance object [runtime]System.Runtime.Serialization.SerializationInfo::GetValue(string, + class [runtime]System.Type) + IL_001e: unbox.any [runtime]System.Int32 + IL_0023: stfld int32 ABC/ABC/MyExn::Data0@ + IL_0028: ret + } + + .method public strict virtual instance void GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo info, valuetype [runtime]System.Runtime.Serialization.StreamingContext context) cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldarg.1 + IL_0002: ldarg.2 + IL_0003: call instance void [runtime]System.Exception::GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo, + valuetype [runtime]System.Runtime.Serialization.StreamingContext) + IL_0008: ldarg.1 + IL_0009: ldstr "Data0" + IL_000e: ldarg.0 + IL_000f: ldfld int32 ABC/ABC/MyExn::Data0@ + IL_0014: box [runtime]System.Int32 + IL_0019: callvirt instance void [runtime]System.Runtime.Serialization.SerializationInfo::AddValue(string, + object) + IL_001e: ret } .method public hidebysig specialname instance int32 get_Data0() cil managed @@ -1512,4 +1568,3 @@ - diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule.fs.RealInternalSignatureOn.il.netcore.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule.fs.RealInternalSignatureOn.il.netcore.release.bsl index e9375f2d0f3..6adebd24f77 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule.fs.RealInternalSignatureOn.il.netcore.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule.fs.RealInternalSignatureOn.il.netcore.release.bsl @@ -480,7 +480,35 @@ IL_0002: ldarg.2 IL_0003: call instance void [runtime]System.Exception::.ctor(class [runtime]System.Runtime.Serialization.SerializationInfo, valuetype [runtime]System.Runtime.Serialization.StreamingContext) - IL_0008: ret + IL_0008: ldarg.0 + IL_0009: ldarg.1 + IL_000a: ldstr "Data0" + IL_000f: ldtoken [runtime]System.Int32 + IL_0014: call class [runtime]System.Type [runtime]System.Type::GetTypeFromHandle(valuetype [runtime]System.RuntimeTypeHandle) + IL_0019: callvirt instance object [runtime]System.Runtime.Serialization.SerializationInfo::GetValue(string, + class [runtime]System.Type) + IL_001e: unbox.any [runtime]System.Int32 + IL_0023: stfld int32 ABC/MyExn::Data0@ + IL_0028: ret + } + + .method public strict virtual instance void GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo info, valuetype [runtime]System.Runtime.Serialization.StreamingContext context) cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldarg.1 + IL_0002: ldarg.2 + IL_0003: call instance void [runtime]System.Exception::GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo, + valuetype [runtime]System.Runtime.Serialization.StreamingContext) + IL_0008: ldarg.1 + IL_0009: ldstr "Data0" + IL_000e: ldarg.0 + IL_000f: ldfld int32 ABC/MyExn::Data0@ + IL_0014: box [runtime]System.Int32 + IL_0019: callvirt instance void [runtime]System.Runtime.Serialization.SerializationInfo::AddValue(string, + object) + IL_001e: ret } .method public hidebysig specialname instance int32 get_Data0() cil managed @@ -1180,7 +1208,35 @@ IL_0002: ldarg.2 IL_0003: call instance void [runtime]System.Exception::.ctor(class [runtime]System.Runtime.Serialization.SerializationInfo, valuetype [runtime]System.Runtime.Serialization.StreamingContext) - IL_0008: ret + IL_0008: ldarg.0 + IL_0009: ldarg.1 + IL_000a: ldstr "Data0" + IL_000f: ldtoken [runtime]System.Int32 + IL_0014: call class [runtime]System.Type [runtime]System.Type::GetTypeFromHandle(valuetype [runtime]System.RuntimeTypeHandle) + IL_0019: callvirt instance object [runtime]System.Runtime.Serialization.SerializationInfo::GetValue(string, + class [runtime]System.Type) + IL_001e: unbox.any [runtime]System.Int32 + IL_0023: stfld int32 ABC/ABC/MyExn::Data0@ + IL_0028: ret + } + + .method public strict virtual instance void GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo info, valuetype [runtime]System.Runtime.Serialization.StreamingContext context) cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldarg.1 + IL_0002: ldarg.2 + IL_0003: call instance void [runtime]System.Exception::GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo, + valuetype [runtime]System.Runtime.Serialization.StreamingContext) + IL_0008: ldarg.1 + IL_0009: ldstr "Data0" + IL_000e: ldarg.0 + IL_000f: ldfld int32 ABC/ABC/MyExn::Data0@ + IL_0014: box [runtime]System.Int32 + IL_0019: callvirt instance void [runtime]System.Runtime.Serialization.SerializationInfo::AddValue(string, + object) + IL_001e: ret } .method public hidebysig specialname instance int32 get_Data0() cil managed @@ -1502,4 +1558,3 @@ - diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace.fs.RealInternalSignatureOff.il.netcore.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace.fs.RealInternalSignatureOff.il.netcore.release.bsl index 36d2089b286..f967c51988c 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace.fs.RealInternalSignatureOff.il.netcore.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace.fs.RealInternalSignatureOff.il.netcore.release.bsl @@ -476,7 +476,35 @@ IL_0002: ldarg.2 IL_0003: call instance void [runtime]System.Exception::.ctor(class [runtime]System.Runtime.Serialization.SerializationInfo, valuetype [runtime]System.Runtime.Serialization.StreamingContext) - IL_0008: ret + IL_0008: ldarg.0 + IL_0009: ldarg.1 + IL_000a: ldstr "Data0" + IL_000f: ldtoken [runtime]System.Int32 + IL_0014: call class [runtime]System.Type [runtime]System.Type::GetTypeFromHandle(valuetype [runtime]System.RuntimeTypeHandle) + IL_0019: callvirt instance object [runtime]System.Runtime.Serialization.SerializationInfo::GetValue(string, + class [runtime]System.Type) + IL_001e: unbox.any [runtime]System.Int32 + IL_0023: stfld int32 XYZ.MyExn::Data0@ + IL_0028: ret + } + + .method public strict virtual instance void GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo info, valuetype [runtime]System.Runtime.Serialization.StreamingContext context) cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldarg.1 + IL_0002: ldarg.2 + IL_0003: call instance void [runtime]System.Exception::GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo, + valuetype [runtime]System.Runtime.Serialization.StreamingContext) + IL_0008: ldarg.1 + IL_0009: ldstr "Data0" + IL_000e: ldarg.0 + IL_000f: ldfld int32 XYZ.MyExn::Data0@ + IL_0014: box [runtime]System.Int32 + IL_0019: callvirt instance void [runtime]System.Runtime.Serialization.SerializationInfo::AddValue(string, + object) + IL_001e: ret } .method public hidebysig specialname instance int32 get_Data0() cil managed @@ -1176,7 +1204,35 @@ IL_0002: ldarg.2 IL_0003: call instance void [runtime]System.Exception::.ctor(class [runtime]System.Runtime.Serialization.SerializationInfo, valuetype [runtime]System.Runtime.Serialization.StreamingContext) - IL_0008: ret + IL_0008: ldarg.0 + IL_0009: ldarg.1 + IL_000a: ldstr "Data0" + IL_000f: ldtoken [runtime]System.Int32 + IL_0014: call class [runtime]System.Type [runtime]System.Type::GetTypeFromHandle(valuetype [runtime]System.RuntimeTypeHandle) + IL_0019: callvirt instance object [runtime]System.Runtime.Serialization.SerializationInfo::GetValue(string, + class [runtime]System.Type) + IL_001e: unbox.any [runtime]System.Int32 + IL_0023: stfld int32 XYZ.ABC/MyExn::Data0@ + IL_0028: ret + } + + .method public strict virtual instance void GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo info, valuetype [runtime]System.Runtime.Serialization.StreamingContext context) cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldarg.1 + IL_0002: ldarg.2 + IL_0003: call instance void [runtime]System.Exception::GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo, + valuetype [runtime]System.Runtime.Serialization.StreamingContext) + IL_0008: ldarg.1 + IL_0009: ldstr "Data0" + IL_000e: ldarg.0 + IL_000f: ldfld int32 XYZ.ABC/MyExn::Data0@ + IL_0014: box [runtime]System.Int32 + IL_0019: callvirt instance void [runtime]System.Runtime.Serialization.SerializationInfo::AddValue(string, + object) + IL_001e: ret } .method public hidebysig specialname instance int32 get_Data0() cil managed @@ -1876,7 +1932,35 @@ IL_0002: ldarg.2 IL_0003: call instance void [runtime]System.Exception::.ctor(class [runtime]System.Runtime.Serialization.SerializationInfo, valuetype [runtime]System.Runtime.Serialization.StreamingContext) - IL_0008: ret + IL_0008: ldarg.0 + IL_0009: ldarg.1 + IL_000a: ldstr "Data0" + IL_000f: ldtoken [runtime]System.Int32 + IL_0014: call class [runtime]System.Type [runtime]System.Type::GetTypeFromHandle(valuetype [runtime]System.RuntimeTypeHandle) + IL_0019: callvirt instance object [runtime]System.Runtime.Serialization.SerializationInfo::GetValue(string, + class [runtime]System.Type) + IL_001e: unbox.any [runtime]System.Int32 + IL_0023: stfld int32 XYZ.ABC/ABC/MyExn::Data0@ + IL_0028: ret + } + + .method public strict virtual instance void GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo info, valuetype [runtime]System.Runtime.Serialization.StreamingContext context) cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldarg.1 + IL_0002: ldarg.2 + IL_0003: call instance void [runtime]System.Exception::GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo, + valuetype [runtime]System.Runtime.Serialization.StreamingContext) + IL_0008: ldarg.1 + IL_0009: ldstr "Data0" + IL_000e: ldarg.0 + IL_000f: ldfld int32 XYZ.ABC/ABC/MyExn::Data0@ + IL_0014: box [runtime]System.Int32 + IL_0019: callvirt instance void [runtime]System.Runtime.Serialization.SerializationInfo::AddValue(string, + object) + IL_001e: ret } .method public hidebysig specialname instance int32 get_Data0() cil managed @@ -2208,4 +2292,3 @@ - diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace.fs.RealInternalSignatureOn.il.netcore.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace.fs.RealInternalSignatureOn.il.netcore.release.bsl index d166fc2f2ff..5b8492fbd4b 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace.fs.RealInternalSignatureOn.il.netcore.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace.fs.RealInternalSignatureOn.il.netcore.release.bsl @@ -476,7 +476,35 @@ IL_0002: ldarg.2 IL_0003: call instance void [runtime]System.Exception::.ctor(class [runtime]System.Runtime.Serialization.SerializationInfo, valuetype [runtime]System.Runtime.Serialization.StreamingContext) - IL_0008: ret + IL_0008: ldarg.0 + IL_0009: ldarg.1 + IL_000a: ldstr "Data0" + IL_000f: ldtoken [runtime]System.Int32 + IL_0014: call class [runtime]System.Type [runtime]System.Type::GetTypeFromHandle(valuetype [runtime]System.RuntimeTypeHandle) + IL_0019: callvirt instance object [runtime]System.Runtime.Serialization.SerializationInfo::GetValue(string, + class [runtime]System.Type) + IL_001e: unbox.any [runtime]System.Int32 + IL_0023: stfld int32 XYZ.MyExn::Data0@ + IL_0028: ret + } + + .method public strict virtual instance void GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo info, valuetype [runtime]System.Runtime.Serialization.StreamingContext context) cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldarg.1 + IL_0002: ldarg.2 + IL_0003: call instance void [runtime]System.Exception::GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo, + valuetype [runtime]System.Runtime.Serialization.StreamingContext) + IL_0008: ldarg.1 + IL_0009: ldstr "Data0" + IL_000e: ldarg.0 + IL_000f: ldfld int32 XYZ.MyExn::Data0@ + IL_0014: box [runtime]System.Int32 + IL_0019: callvirt instance void [runtime]System.Runtime.Serialization.SerializationInfo::AddValue(string, + object) + IL_001e: ret } .method public hidebysig specialname instance int32 get_Data0() cil managed @@ -1176,7 +1204,35 @@ IL_0002: ldarg.2 IL_0003: call instance void [runtime]System.Exception::.ctor(class [runtime]System.Runtime.Serialization.SerializationInfo, valuetype [runtime]System.Runtime.Serialization.StreamingContext) - IL_0008: ret + IL_0008: ldarg.0 + IL_0009: ldarg.1 + IL_000a: ldstr "Data0" + IL_000f: ldtoken [runtime]System.Int32 + IL_0014: call class [runtime]System.Type [runtime]System.Type::GetTypeFromHandle(valuetype [runtime]System.RuntimeTypeHandle) + IL_0019: callvirt instance object [runtime]System.Runtime.Serialization.SerializationInfo::GetValue(string, + class [runtime]System.Type) + IL_001e: unbox.any [runtime]System.Int32 + IL_0023: stfld int32 XYZ.ABC/MyExn::Data0@ + IL_0028: ret + } + + .method public strict virtual instance void GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo info, valuetype [runtime]System.Runtime.Serialization.StreamingContext context) cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldarg.1 + IL_0002: ldarg.2 + IL_0003: call instance void [runtime]System.Exception::GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo, + valuetype [runtime]System.Runtime.Serialization.StreamingContext) + IL_0008: ldarg.1 + IL_0009: ldstr "Data0" + IL_000e: ldarg.0 + IL_000f: ldfld int32 XYZ.ABC/MyExn::Data0@ + IL_0014: box [runtime]System.Int32 + IL_0019: callvirt instance void [runtime]System.Runtime.Serialization.SerializationInfo::AddValue(string, + object) + IL_001e: ret } .method public hidebysig specialname instance int32 get_Data0() cil managed @@ -1876,7 +1932,35 @@ IL_0002: ldarg.2 IL_0003: call instance void [runtime]System.Exception::.ctor(class [runtime]System.Runtime.Serialization.SerializationInfo, valuetype [runtime]System.Runtime.Serialization.StreamingContext) - IL_0008: ret + IL_0008: ldarg.0 + IL_0009: ldarg.1 + IL_000a: ldstr "Data0" + IL_000f: ldtoken [runtime]System.Int32 + IL_0014: call class [runtime]System.Type [runtime]System.Type::GetTypeFromHandle(valuetype [runtime]System.RuntimeTypeHandle) + IL_0019: callvirt instance object [runtime]System.Runtime.Serialization.SerializationInfo::GetValue(string, + class [runtime]System.Type) + IL_001e: unbox.any [runtime]System.Int32 + IL_0023: stfld int32 XYZ.ABC/ABC/MyExn::Data0@ + IL_0028: ret + } + + .method public strict virtual instance void GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo info, valuetype [runtime]System.Runtime.Serialization.StreamingContext context) cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldarg.1 + IL_0002: ldarg.2 + IL_0003: call instance void [runtime]System.Exception::GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo, + valuetype [runtime]System.Runtime.Serialization.StreamingContext) + IL_0008: ldarg.1 + IL_0009: ldstr "Data0" + IL_000e: ldarg.0 + IL_000f: ldfld int32 XYZ.ABC/ABC/MyExn::Data0@ + IL_0014: box [runtime]System.Int32 + IL_0019: callvirt instance void [runtime]System.Runtime.Serialization.SerializationInfo::AddValue(string, + object) + IL_001e: ret } .method public hidebysig specialname instance int32 get_Data0() cil managed @@ -2198,4 +2282,3 @@ - diff --git a/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj b/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj index 2e892f803b0..ee08f70a649 100644 --- a/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj +++ b/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj @@ -284,6 +284,7 @@ + From d3e3722dd77f5dd0e257bab1072e85f037d60912 Mon Sep 17 00:00:00 2001 From: Tomas Grosup Date: Thu, 26 Feb 2026 16:08:19 +0100 Subject: [PATCH 02/16] Fix GetObjectData override with SecurityCritical attribute The generated GetObjectData override on F# exception types must have the [SecurityCritical] attribute to match the security accessibility of Exception.GetObjectData on .NET Framework. Without this, the CLR rejects the override with 'Inheritance security rules violated', causing FS0193 errors when any project references FSharp.Core (which contains MatchFailureException with the new GetObjectData override). Also update IL baselines and FSharp.Core surface area baseline. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- src/Compiler/CodeGen/IlxGen.fs | 27 ++++++++++++------- .../CodeGenRegressions_Exceptions.fs | 1 + .../Nullness/ExceptionType.fs.il.netcore.bsl | 4 +++ ...nternalSignatureOff.il.netcore.release.bsl | 2 ++ ...InternalSignatureOn.il.netcore.release.bsl | 2 ++ ...nternalSignatureOff.il.netcore.release.bsl | 3 +++ ...InternalSignatureOn.il.netcore.release.bsl | 3 +++ ...Core.SurfaceArea.netstandard21.release.bsl | 1 + 8 files changed, 33 insertions(+), 10 deletions(-) diff --git a/src/Compiler/CodeGen/IlxGen.fs b/src/Compiler/CodeGen/IlxGen.fs index c5741f8fff2..2be7ab88c42 100644 --- a/src/Compiler/CodeGen/IlxGen.fs +++ b/src/Compiler/CodeGen/IlxGen.fs @@ -12308,16 +12308,23 @@ and GenExnDef cenv mgbuf eenv m (exnc: Tycon) : ILTypeRef option = |> nonBranchingInstrsToCode let ilGetObjectDataDef = - mkILNonGenericVirtualInstanceMethod ( - "GetObjectData", - ILMemberAccess.Public, - [ - mkILParamNamed ("info", serializationInfoType) - mkILParamNamed ("context", streamingContextType) - ], - mkILReturn ILType.Void, - mkMethodBody (false, [], 8, ilInstrsForGetObjectData, None, eenv.imports) - ) + let mdef = + mkILNonGenericVirtualInstanceMethod ( + "GetObjectData", + ILMemberAccess.Public, + [ + mkILParamNamed ("info", serializationInfoType) + mkILParamNamed ("context", streamingContextType) + ], + mkILReturn ILType.Void, + mkMethodBody (false, [], 8, ilInstrsForGetObjectData, None, eenv.imports) + ) + + // SecurityCritical is required for .NET Framework where Exception.GetObjectData is security-critical + let securityCriticalAttr = + mkILCustomAttribute (g.attrib_SecurityCriticalAttribute.TypeRef, [], [], []) + + mdef.With(customAttrs = mkILCustomAttrs [ securityCriticalAttr ]) if fieldNamesAndTypes.IsEmpty then [ ilCtorDefForSerialization ] diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/CodeGenRegressions/CodeGenRegressions_Exceptions.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/CodeGenRegressions/CodeGenRegressions_Exceptions.fs index bccea2b9a5c..9ed85477320 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/CodeGenRegressions/CodeGenRegressions_Exceptions.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/CodeGenRegressions/CodeGenRegressions_Exceptions.fs @@ -36,6 +36,7 @@ exception Foo of x:string * y:int result |> verifyIL [ ".method public strict virtual instance void GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo info, valuetype [runtime]System.Runtime.Serialization.StreamingContext context) cil managed" + ".custom instance void [runtime]System.Security.SecurityCriticalAttribute::.ctor() = ( 01 00 00 00 )" "call instance void [runtime]System.Exception::GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo," ".method family specialname rtspecialname instance void .ctor(class [runtime]System.Runtime.Serialization.SerializationInfo info, valuetype [runtime]System.Runtime.Serialization.StreamingContext context) cil managed" ] diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/ExceptionType.fs.il.netcore.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/ExceptionType.fs.il.netcore.bsl index f2e6ff73712..0ff3392e278 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/ExceptionType.fs.il.netcore.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/ExceptionType.fs.il.netcore.bsl @@ -76,6 +76,7 @@ .method public strict virtual instance void GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo info, valuetype [runtime]System.Runtime.Serialization.StreamingContext context) cil managed { + .custom instance void [runtime]System.Security.SecurityCriticalAttribute::.ctor() = ( 01 00 00 00 ) .maxstack 8 IL_0000: ldarg.0 @@ -187,6 +188,7 @@ .method public strict virtual instance void GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo info, valuetype [runtime]System.Runtime.Serialization.StreamingContext context) cil managed { + .custom instance void [runtime]System.Security.SecurityCriticalAttribute::.ctor() = ( 01 00 00 00 ) .maxstack 8 IL_0000: ldarg.0 @@ -309,6 +311,7 @@ .method public strict virtual instance void GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo info, valuetype [runtime]System.Runtime.Serialization.StreamingContext context) cil managed { + .custom instance void [runtime]System.Security.SecurityCriticalAttribute::.ctor() = ( 01 00 00 00 ) .maxstack 8 IL_0000: ldarg.0 @@ -410,6 +413,7 @@ .method public strict virtual instance void GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo info, valuetype [runtime]System.Runtime.Serialization.StreamingContext context) cil managed { + .custom instance void [runtime]System.Security.SecurityCriticalAttribute::.ctor() = ( 01 00 00 00 ) .maxstack 8 IL_0000: ldarg.0 diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule.fs.RealInternalSignatureOff.il.netcore.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule.fs.RealInternalSignatureOff.il.netcore.release.bsl index 50410ebe0e5..e230897b4ff 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule.fs.RealInternalSignatureOff.il.netcore.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule.fs.RealInternalSignatureOff.il.netcore.release.bsl @@ -494,6 +494,7 @@ .method public strict virtual instance void GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo info, valuetype [runtime]System.Runtime.Serialization.StreamingContext context) cil managed { + .custom instance void [runtime]System.Security.SecurityCriticalAttribute::.ctor() = ( 01 00 00 00 ) .maxstack 8 IL_0000: ldarg.0 @@ -1222,6 +1223,7 @@ .method public strict virtual instance void GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo info, valuetype [runtime]System.Runtime.Serialization.StreamingContext context) cil managed { + .custom instance void [runtime]System.Security.SecurityCriticalAttribute::.ctor() = ( 01 00 00 00 ) .maxstack 8 IL_0000: ldarg.0 diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule.fs.RealInternalSignatureOn.il.netcore.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule.fs.RealInternalSignatureOn.il.netcore.release.bsl index 6adebd24f77..a0129f45485 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule.fs.RealInternalSignatureOn.il.netcore.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule.fs.RealInternalSignatureOn.il.netcore.release.bsl @@ -494,6 +494,7 @@ .method public strict virtual instance void GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo info, valuetype [runtime]System.Runtime.Serialization.StreamingContext context) cil managed { + .custom instance void [runtime]System.Security.SecurityCriticalAttribute::.ctor() = ( 01 00 00 00 ) .maxstack 8 IL_0000: ldarg.0 @@ -1222,6 +1223,7 @@ .method public strict virtual instance void GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo info, valuetype [runtime]System.Runtime.Serialization.StreamingContext context) cil managed { + .custom instance void [runtime]System.Security.SecurityCriticalAttribute::.ctor() = ( 01 00 00 00 ) .maxstack 8 IL_0000: ldarg.0 diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace.fs.RealInternalSignatureOff.il.netcore.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace.fs.RealInternalSignatureOff.il.netcore.release.bsl index f967c51988c..6f4b9051b97 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace.fs.RealInternalSignatureOff.il.netcore.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace.fs.RealInternalSignatureOff.il.netcore.release.bsl @@ -490,6 +490,7 @@ .method public strict virtual instance void GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo info, valuetype [runtime]System.Runtime.Serialization.StreamingContext context) cil managed { + .custom instance void [runtime]System.Security.SecurityCriticalAttribute::.ctor() = ( 01 00 00 00 ) .maxstack 8 IL_0000: ldarg.0 @@ -1218,6 +1219,7 @@ .method public strict virtual instance void GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo info, valuetype [runtime]System.Runtime.Serialization.StreamingContext context) cil managed { + .custom instance void [runtime]System.Security.SecurityCriticalAttribute::.ctor() = ( 01 00 00 00 ) .maxstack 8 IL_0000: ldarg.0 @@ -1946,6 +1948,7 @@ .method public strict virtual instance void GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo info, valuetype [runtime]System.Runtime.Serialization.StreamingContext context) cil managed { + .custom instance void [runtime]System.Security.SecurityCriticalAttribute::.ctor() = ( 01 00 00 00 ) .maxstack 8 IL_0000: ldarg.0 diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace.fs.RealInternalSignatureOn.il.netcore.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace.fs.RealInternalSignatureOn.il.netcore.release.bsl index 5b8492fbd4b..172f68c93c9 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace.fs.RealInternalSignatureOn.il.netcore.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace.fs.RealInternalSignatureOn.il.netcore.release.bsl @@ -490,6 +490,7 @@ .method public strict virtual instance void GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo info, valuetype [runtime]System.Runtime.Serialization.StreamingContext context) cil managed { + .custom instance void [runtime]System.Security.SecurityCriticalAttribute::.ctor() = ( 01 00 00 00 ) .maxstack 8 IL_0000: ldarg.0 @@ -1218,6 +1219,7 @@ .method public strict virtual instance void GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo info, valuetype [runtime]System.Runtime.Serialization.StreamingContext context) cil managed { + .custom instance void [runtime]System.Security.SecurityCriticalAttribute::.ctor() = ( 01 00 00 00 ) .maxstack 8 IL_0000: ldarg.0 @@ -1946,6 +1948,7 @@ .method public strict virtual instance void GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo info, valuetype [runtime]System.Runtime.Serialization.StreamingContext context) cil managed { + .custom instance void [runtime]System.Security.SecurityCriticalAttribute::.ctor() = ( 01 00 00 00 ) .maxstack 8 IL_0000: ldarg.0 diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core.SurfaceArea.netstandard21.release.bsl b/tests/FSharp.Core.UnitTests/FSharp.Core.SurfaceArea.netstandard21.release.bsl index ed913ea04d3..b338d7233a6 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core.SurfaceArea.netstandard21.release.bsl +++ b/tests/FSharp.Core.UnitTests/FSharp.Core.SurfaceArea.netstandard21.release.bsl @@ -1644,6 +1644,7 @@ Microsoft.FSharp.Core.MatchFailureException: System.String get_Data0() Microsoft.FSharp.Core.MatchFailureException: System.String get_Message() Microsoft.FSharp.Core.MatchFailureException: Void .ctor() Microsoft.FSharp.Core.MatchFailureException: Void .ctor(System.String, Int32, Int32) +Microsoft.FSharp.Core.MatchFailureException: Void GetObjectData(System.Runtime.Serialization.SerializationInfo, System.Runtime.Serialization.StreamingContext) Microsoft.FSharp.Core.MeasureAnnotatedAbbreviationAttribute: Void .ctor() Microsoft.FSharp.Core.MeasureAttribute: Void .ctor() Microsoft.FSharp.Core.NoComparisonAttribute: Void .ctor() From 8570967a6edff66b0a54c4d221a8dedd7b4a827f Mon Sep 17 00:00:00 2001 From: Tomas Grosup Date: Mon, 2 Mar 2026 14:08:07 +0100 Subject: [PATCH 03/16] Skip serialization members for FSharp.Core exceptions FSharp.Core has [assembly: SecurityTransparent] which makes all methods transparent. On .NET Framework, transparent methods cannot override SecurityCritical methods (Exception.GetObjectData) nor call SecurityCritical base constructors (Exception(SerializationInfo, StreamingContext)). Skip emitting serialization members for FSharp.Core exceptions. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- src/Compiler/CodeGen/IlxGen.fs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/Compiler/CodeGen/IlxGen.fs b/src/Compiler/CodeGen/IlxGen.fs index 2be7ab88c42..c9aa7628c1b 100644 --- a/src/Compiler/CodeGen/IlxGen.fs +++ b/src/Compiler/CodeGen/IlxGen.fs @@ -12326,7 +12326,14 @@ and GenExnDef cenv mgbuf eenv m (exnc: Tycon) : ILTypeRef option = mdef.With(customAttrs = mkILCustomAttrs [ securityCriticalAttr ]) - if fieldNamesAndTypes.IsEmpty then + // FSharp.Core has [assembly: SecurityTransparent], so all methods are transparent. + // On .NET Framework, transparent methods cannot override SecurityCritical methods + // like Exception.GetObjectData, nor call SecurityCritical base constructors like + // Exception(SerializationInfo, StreamingContext). Skip serialization members entirely + // for FSharp.Core exceptions. + if g.compilingFSharpCore then + [] + elif fieldNamesAndTypes.IsEmpty then [ ilCtorDefForSerialization ] else [ ilCtorDefForSerialization; ilGetObjectDataDef ] From 05ea6760ba44a8a75a748ae4313c5eed9972aabf Mon Sep 17 00:00:00 2001 From: Tomas Grosup Date: Mon, 2 Mar 2026 14:45:49 +0100 Subject: [PATCH 04/16] Refine FSharp.Core exception serialization: keep deserialization ctor, add test FSharp.Core has [assembly: SecurityTransparent]. On .NET Framework, transparent code cannot override SecurityCritical methods (GetObjectData). Without GetObjectData to write fields, the field-restoring ctor would crash. So for FSharp.Core exceptions: - Keep the base-call-only deserialization ctor (status quo, SecuritySafeCritical base) - Skip GetObjectData override (can't override SecurityCritical from transparent) For user exceptions (no SecurityTransparent): - Emit both GetObjectData and field-restoring ctor (full serialization) Add test verifying FSharp.Core MatchFailureException: - Loads without TypeLoadException - Has deserialization ctor - Does NOT have GetObjectData override Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- src/Compiler/CodeGen/IlxGen.fs | 32 ++++++++--- .../CodeGenRegressions_Exceptions.fs | 54 +++++++++++++++++++ 2 files changed, 80 insertions(+), 6 deletions(-) diff --git a/src/Compiler/CodeGen/IlxGen.fs b/src/Compiler/CodeGen/IlxGen.fs index c9aa7628c1b..c717f00f519 100644 --- a/src/Compiler/CodeGen/IlxGen.fs +++ b/src/Compiler/CodeGen/IlxGen.fs @@ -12326,13 +12326,33 @@ and GenExnDef cenv mgbuf eenv m (exnc: Tycon) : ILTypeRef option = mdef.With(customAttrs = mkILCustomAttrs [ securityCriticalAttr ]) - // FSharp.Core has [assembly: SecurityTransparent], so all methods are transparent. - // On .NET Framework, transparent methods cannot override SecurityCritical methods - // like Exception.GetObjectData, nor call SecurityCritical base constructors like - // Exception(SerializationInfo, StreamingContext). Skip serialization members entirely - // for FSharp.Core exceptions. + // FSharp.Core has [assembly: SecurityTransparent], making all code transparent. + // On .NET Framework, transparent code cannot override SecurityCritical virtual + // methods like Exception.GetObjectData. Without GetObjectData to write the fields, + // the field-restoring deserialization constructor would crash (fields not in + // SerializationInfo). So for FSharp.Core: emit only the base-call ctor (status quo). + // For user exceptions: emit both GetObjectData and the field-restoring ctor. if g.compilingFSharpCore then - [] + let ilBaseOnlyCtorInstrs = + [ + mkLdarg0 + mkLdarg 1us + mkLdarg 2us + mkNormalCall (mkILCtorMethSpecForTy (g.iltyp_Exception, [ serializationInfoType; streamingContextType ])) + ] + |> nonBranchingInstrsToCode + + let ilBaseOnlyCtor = + mkILCtor ( + ILMemberAccess.Family, + [ + mkILParamNamed ("info", serializationInfoType) + mkILParamNamed ("context", streamingContextType) + ], + mkMethodBody (false, [], 8, ilBaseOnlyCtorInstrs, None, eenv.imports) + ) + + [ ilBaseOnlyCtor ] elif fieldNamesAndTypes.IsEmpty then [ ilCtorDefForSerialization ] else diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/CodeGenRegressions/CodeGenRegressions_Exceptions.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/CodeGenRegressions/CodeGenRegressions_Exceptions.fs index 9ed85477320..6e3c95e54fb 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/CodeGenRegressions/CodeGenRegressions_Exceptions.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/CodeGenRegressions/CodeGenRegressions_Exceptions.fs @@ -97,6 +97,60 @@ let main _ = if yCloned <> 42 then failwithf "Roundtrip: Expected y=42, got %d" yCloned printfn "SUCCESS: Foo(value, 42) roundtripped correctly" 0 +""" + FSharp source + |> asExe + |> ignoreWarnings + |> compile + |> shouldSucceed + |> run + |> shouldSucceed + |> ignore + + // FSharp.Core has [assembly: SecurityTransparent] which prevents overriding + // SecurityCritical methods like Exception.GetObjectData on .NET Framework. + // Verify that FSharp.Core exceptions (MatchFailureException) still load and work, + // have the deserialization ctor, but do NOT have a GetObjectData override. + [] + let ``Issue_878_FSharpCoreExceptions_NoGetObjectDataOverride`` () = + let source = """ +module Test + +// Force MatchFailureException to be loaded by triggering an incomplete match +let triggerMatch x = + match x with + | 1 -> "one" + +// Verify FSharp.Core exceptions can be created and used without TypeLoadException +let test () = + try + triggerMatch 999 |> ignore + failwith "Expected MatchFailureException" + with + | :? MatchFailureException as e -> + // Verify the exception loaded successfully (no TypeLoadException from GetObjectData) + printfn "MatchFailureException loaded OK: %s" e.Message + + // Check that deserialization ctor exists (it should — base ctor is SecuritySafeCritical) + let ctorParams = [| typeof; typeof |] + let ctor = typeof.GetConstructor( + System.Reflection.BindingFlags.Instance ||| System.Reflection.BindingFlags.NonPublic, + null, ctorParams, null) + if ctor = null then failwith "Deserialization ctor missing on MatchFailureException" + printfn "Deserialization ctor present" + + // GetObjectData should NOT be overridden on MatchFailureException + // (FSharp.Core is SecurityTransparent, can't override SecurityCritical base) + let godMethod = typeof.GetMethod("GetObjectData", + System.Reflection.BindingFlags.Instance ||| System.Reflection.BindingFlags.Public, + null, ctorParams, null) + if godMethod <> null && godMethod.DeclaringType = typeof then + failwith "GetObjectData should NOT be overridden on FSharp.Core exceptions" + printfn "GetObjectData correctly not overridden" + 0 + +[] +let main _ = test () """ FSharp source |> asExe From 566a9a85908f532e18e630428fb020ccbe5c36b3 Mon Sep 17 00:00:00 2001 From: Tomas Grosup Date: Mon, 2 Mar 2026 15:48:50 +0100 Subject: [PATCH 05/16] Revert surface area baseline: no GetObjectData on FSharp.Core exceptions The compilingFSharpCore guard skips GetObjectData, so the surface area baseline should not include it for MatchFailureException. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../FSharp.Core.SurfaceArea.netstandard21.release.bsl | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core.SurfaceArea.netstandard21.release.bsl b/tests/FSharp.Core.UnitTests/FSharp.Core.SurfaceArea.netstandard21.release.bsl index b338d7233a6..ed913ea04d3 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core.SurfaceArea.netstandard21.release.bsl +++ b/tests/FSharp.Core.UnitTests/FSharp.Core.SurfaceArea.netstandard21.release.bsl @@ -1644,7 +1644,6 @@ Microsoft.FSharp.Core.MatchFailureException: System.String get_Data0() Microsoft.FSharp.Core.MatchFailureException: System.String get_Message() Microsoft.FSharp.Core.MatchFailureException: Void .ctor() Microsoft.FSharp.Core.MatchFailureException: Void .ctor(System.String, Int32, Int32) -Microsoft.FSharp.Core.MatchFailureException: Void GetObjectData(System.Runtime.Serialization.SerializationInfo, System.Runtime.Serialization.StreamingContext) Microsoft.FSharp.Core.MeasureAnnotatedAbbreviationAttribute: Void .ctor() Microsoft.FSharp.Core.MeasureAttribute: Void .ctor() Microsoft.FSharp.Core.NoComparisonAttribute: Void .ctor() From e43e9375d7728996a07118abb6bf92f5baafac51 Mon Sep 17 00:00:00 2001 From: Tomas Grosup Date: Fri, 6 Mar 2026 19:18:45 +0100 Subject: [PATCH 06/16] Move release notes to 11.0.100 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- docs/release-notes/.FSharp.Compiler.Service/10.0.300.md | 2 -- docs/release-notes/.FSharp.Compiler.Service/11.0.100.md | 1 + 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/docs/release-notes/.FSharp.Compiler.Service/10.0.300.md b/docs/release-notes/.FSharp.Compiler.Service/10.0.300.md index 11f161bffaf..53802cc1153 100644 --- a/docs/release-notes/.FSharp.Compiler.Service/10.0.300.md +++ b/docs/release-notes/.FSharp.Compiler.Service/10.0.300.md @@ -49,6 +49,4 @@ * Symbols: safer qualified name getting ([PR #19298](https://github.com/dotnet/fsharp/pull/19298)) -* Fix F# exception serialization now preserves fields. (Issue [#878](https://github.com/dotnet/fsharp/issues/878), [PR #19342](https://github.com/dotnet/fsharp/pull/19342)) - ### Breaking Changes diff --git a/docs/release-notes/.FSharp.Compiler.Service/11.0.100.md b/docs/release-notes/.FSharp.Compiler.Service/11.0.100.md index 6cc50c2822e..87f25ef0064 100644 --- a/docs/release-notes/.FSharp.Compiler.Service/11.0.100.md +++ b/docs/release-notes/.FSharp.Compiler.Service/11.0.100.md @@ -34,6 +34,7 @@ * Fix signature generation: backtick escaping for identifiers containing backticks. ([Issue #15389](https://github.com/dotnet/fsharp/issues/15389), [PR #19586](https://github.com/dotnet/fsharp/pull/19586)) * Fix signature generation: `private` keyword placement for prefix-style type abbreviations. ([Issue #15560](https://github.com/dotnet/fsharp/issues/15560), [PR #19586](https://github.com/dotnet/fsharp/pull/19586)) * Fix signature generation: missing `[]` attribute for types without visible constructors. ([Issue #16531](https://github.com/dotnet/fsharp/issues/16531), [PR #19586](https://github.com/dotnet/fsharp/pull/19586)) +* Fix F# exception serialization now preserves fields. (Issue [#878](https://github.com/dotnet/fsharp/issues/878), [PR #19342](https://github.com/dotnet/fsharp/pull/19342)) ### Added From 995a67ff82a587b2ac6345f1af021b60300ee24a Mon Sep 17 00:00:00 2001 From: Tomas Grosup Date: Fri, 6 Mar 2026 21:43:59 +0100 Subject: [PATCH 07/16] Update net472 EmittedIL baselines for exception serialization constructors Add deserialization constructor bodies (reading fields from SerializationInfo) and GetObjectData overrides to match the netcore baselines. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../Nullness/ExceptionType.fs.il.net472.bsl | 135 +++++++++++++++++- ...InternalSignatureOff.il.net472.release.bsl | 62 +++++++- ...lInternalSignatureOn.il.net472.release.bsl | 62 +++++++- ...InternalSignatureOff.il.net472.release.bsl | 93 +++++++++++- ...lInternalSignatureOn.il.net472.release.bsl | 93 +++++++++++- 5 files changed, 431 insertions(+), 14 deletions(-) diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/ExceptionType.fs.il.net472.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/ExceptionType.fs.il.net472.bsl index f2feb99321b..39d8616f94b 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/ExceptionType.fs.il.net472.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/ExceptionType.fs.il.net472.bsl @@ -62,7 +62,35 @@ IL_0002: ldarg.2 IL_0003: call instance void [runtime]System.Exception::.ctor(class [runtime]System.Runtime.Serialization.SerializationInfo, valuetype [runtime]System.Runtime.Serialization.StreamingContext) - IL_0008: ret + IL_0008: ldarg.0 + IL_0009: ldarg.1 + IL_000a: ldstr "Data0" + IL_000f: ldtoken [runtime]System.String + IL_0014: call class [runtime]System.Type [runtime]System.Type::GetTypeFromHandle(valuetype [runtime]System.RuntimeTypeHandle) + IL_0019: callvirt instance object [runtime]System.Runtime.Serialization.SerializationInfo::GetValue(string, + class [runtime]System.Type) + IL_001e: castclass [runtime]System.String + IL_0023: stfld string MyLibrary/JustStringE::Data0@ + IL_0028: ret + } + + .method public strict virtual instance void GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo info, valuetype [runtime]System.Runtime.Serialization.StreamingContext context) cil managed + { + .custom instance void [runtime]System.Security.SecurityCriticalAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldarg.1 + IL_0002: ldarg.2 + IL_0003: call instance void [runtime]System.Exception::GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo, + valuetype [runtime]System.Runtime.Serialization.StreamingContext) + IL_0008: ldarg.1 + IL_0009: ldstr "Data0" + IL_000e: ldarg.0 + IL_000f: ldfld string MyLibrary/JustStringE::Data0@ + IL_0014: callvirt instance void [runtime]System.Runtime.Serialization.SerializationInfo::AddValue(string, + object) + IL_0019: ret } .method public hidebysig specialname instance string get_Data0() cil managed @@ -137,7 +165,50 @@ IL_0002: ldarg.2 IL_0003: call instance void [runtime]System.Exception::.ctor(class [runtime]System.Runtime.Serialization.SerializationInfo, valuetype [runtime]System.Runtime.Serialization.StreamingContext) - IL_0008: ret + IL_0008: ldarg.0 + IL_0009: ldarg.1 + IL_000a: ldstr "M1" + IL_000f: ldtoken [runtime]System.String + IL_0014: call class [runtime]System.Type [runtime]System.Type::GetTypeFromHandle(valuetype [runtime]System.RuntimeTypeHandle) + IL_0019: callvirt instance object [runtime]System.Runtime.Serialization.SerializationInfo::GetValue(string, + class [runtime]System.Type) + IL_001e: castclass [runtime]System.String + IL_0023: stfld string MyLibrary/TwoStrings::M1@ + IL_0028: ldarg.0 + IL_0029: ldarg.1 + IL_002a: ldstr "M2" + IL_002f: ldtoken [runtime]System.String + IL_0034: call class [runtime]System.Type [runtime]System.Type::GetTypeFromHandle(valuetype [runtime]System.RuntimeTypeHandle) + IL_0039: callvirt instance object [runtime]System.Runtime.Serialization.SerializationInfo::GetValue(string, + class [runtime]System.Type) + IL_003e: castclass [runtime]System.String + IL_0043: stfld string MyLibrary/TwoStrings::M2@ + IL_0048: ret + } + + .method public strict virtual instance void GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo info, valuetype [runtime]System.Runtime.Serialization.StreamingContext context) cil managed + { + .custom instance void [runtime]System.Security.SecurityCriticalAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldarg.1 + IL_0002: ldarg.2 + IL_0003: call instance void [runtime]System.Exception::GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo, + valuetype [runtime]System.Runtime.Serialization.StreamingContext) + IL_0008: ldarg.1 + IL_0009: ldstr "M1" + IL_000e: ldarg.0 + IL_000f: ldfld string MyLibrary/TwoStrings::M1@ + IL_0014: callvirt instance void [runtime]System.Runtime.Serialization.SerializationInfo::AddValue(string, + object) + IL_0019: ldarg.1 + IL_001a: ldstr "M2" + IL_001f: ldarg.0 + IL_0020: ldfld string MyLibrary/TwoStrings::M2@ + IL_0025: callvirt instance void [runtime]System.Runtime.Serialization.SerializationInfo::AddValue(string, + object) + IL_002a: ret } .method public hidebysig specialname instance string get_M1() cil managed @@ -226,7 +297,35 @@ IL_0002: ldarg.2 IL_0003: call instance void [runtime]System.Exception::.ctor(class [runtime]System.Runtime.Serialization.SerializationInfo, valuetype [runtime]System.Runtime.Serialization.StreamingContext) - IL_0008: ret + IL_0008: ldarg.0 + IL_0009: ldarg.1 + IL_000a: ldstr "Data0" + IL_000f: ldtoken [runtime]System.String + IL_0014: call class [runtime]System.Type [runtime]System.Type::GetTypeFromHandle(valuetype [runtime]System.RuntimeTypeHandle) + IL_0019: callvirt instance object [runtime]System.Runtime.Serialization.SerializationInfo::GetValue(string, + class [runtime]System.Type) + IL_001e: castclass [runtime]System.String + IL_0023: stfld string MyLibrary/NullableStringE::Data0@ + IL_0028: ret + } + + .method public strict virtual instance void GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo info, valuetype [runtime]System.Runtime.Serialization.StreamingContext context) cil managed + { + .custom instance void [runtime]System.Security.SecurityCriticalAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldarg.1 + IL_0002: ldarg.2 + IL_0003: call instance void [runtime]System.Exception::GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo, + valuetype [runtime]System.Runtime.Serialization.StreamingContext) + IL_0008: ldarg.1 + IL_0009: ldstr "Data0" + IL_000e: ldarg.0 + IL_000f: ldfld string MyLibrary/NullableStringE::Data0@ + IL_0014: callvirt instance void [runtime]System.Runtime.Serialization.SerializationInfo::AddValue(string, + object) + IL_0019: ret } .method public hidebysig specialname instance string get_Data0() cil managed @@ -300,7 +399,35 @@ IL_0002: ldarg.2 IL_0003: call instance void [runtime]System.Exception::.ctor(class [runtime]System.Runtime.Serialization.SerializationInfo, valuetype [runtime]System.Runtime.Serialization.StreamingContext) - IL_0008: ret + IL_0008: ldarg.0 + IL_0009: ldarg.1 + IL_000a: ldstr "Message" + IL_000f: ldtoken [runtime]System.String + IL_0014: call class [runtime]System.Type [runtime]System.Type::GetTypeFromHandle(valuetype [runtime]System.RuntimeTypeHandle) + IL_0019: callvirt instance object [runtime]System.Runtime.Serialization.SerializationInfo::GetValue(string, + class [runtime]System.Type) + IL_001e: castclass [runtime]System.String + IL_0023: stfld string MyLibrary/NullableMessage::Message@ + IL_0028: ret + } + + .method public strict virtual instance void GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo info, valuetype [runtime]System.Runtime.Serialization.StreamingContext context) cil managed + { + .custom instance void [runtime]System.Security.SecurityCriticalAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldarg.1 + IL_0002: ldarg.2 + IL_0003: call instance void [runtime]System.Exception::GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo, + valuetype [runtime]System.Runtime.Serialization.StreamingContext) + IL_0008: ldarg.1 + IL_0009: ldstr "Message" + IL_000e: ldarg.0 + IL_000f: ldfld string MyLibrary/NullableMessage::Message@ + IL_0014: callvirt instance void [runtime]System.Runtime.Serialization.SerializationInfo::AddValue(string, + object) + IL_0019: ret } .method public hidebysig specialname virtual instance string get_Message() cil managed diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule.fs.RealInternalSignatureOff.il.net472.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule.fs.RealInternalSignatureOff.il.net472.release.bsl index bc1e702435d..3e50fbe8595 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule.fs.RealInternalSignatureOff.il.net472.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule.fs.RealInternalSignatureOff.il.net472.release.bsl @@ -480,7 +480,36 @@ IL_0002: ldarg.2 IL_0003: call instance void [runtime]System.Exception::.ctor(class [runtime]System.Runtime.Serialization.SerializationInfo, valuetype [runtime]System.Runtime.Serialization.StreamingContext) - IL_0008: ret + IL_0008: ldarg.0 + IL_0009: ldarg.1 + IL_000a: ldstr "Data0" + IL_000f: ldtoken [runtime]System.Int32 + IL_0014: call class [runtime]System.Type [runtime]System.Type::GetTypeFromHandle(valuetype [runtime]System.RuntimeTypeHandle) + IL_0019: callvirt instance object [runtime]System.Runtime.Serialization.SerializationInfo::GetValue(string, + class [runtime]System.Type) + IL_001e: unbox.any [runtime]System.Int32 + IL_0023: stfld int32 ABC/MyExn::Data0@ + IL_0028: ret + } + + .method public strict virtual instance void GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo info, valuetype [runtime]System.Runtime.Serialization.StreamingContext context) cil managed + { + .custom instance void [runtime]System.Security.SecurityCriticalAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldarg.1 + IL_0002: ldarg.2 + IL_0003: call instance void [runtime]System.Exception::GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo, + valuetype [runtime]System.Runtime.Serialization.StreamingContext) + IL_0008: ldarg.1 + IL_0009: ldstr "Data0" + IL_000e: ldarg.0 + IL_000f: ldfld int32 ABC/MyExn::Data0@ + IL_0014: box [runtime]System.Int32 + IL_0019: callvirt instance void [runtime]System.Runtime.Serialization.SerializationInfo::AddValue(string, + object) + IL_001e: ret } .method public hidebysig specialname instance int32 get_Data0() cil managed @@ -1180,7 +1209,36 @@ IL_0002: ldarg.2 IL_0003: call instance void [runtime]System.Exception::.ctor(class [runtime]System.Runtime.Serialization.SerializationInfo, valuetype [runtime]System.Runtime.Serialization.StreamingContext) - IL_0008: ret + IL_0008: ldarg.0 + IL_0009: ldarg.1 + IL_000a: ldstr "Data0" + IL_000f: ldtoken [runtime]System.Int32 + IL_0014: call class [runtime]System.Type [runtime]System.Type::GetTypeFromHandle(valuetype [runtime]System.RuntimeTypeHandle) + IL_0019: callvirt instance object [runtime]System.Runtime.Serialization.SerializationInfo::GetValue(string, + class [runtime]System.Type) + IL_001e: unbox.any [runtime]System.Int32 + IL_0023: stfld int32 ABC/ABC/MyExn::Data0@ + IL_0028: ret + } + + .method public strict virtual instance void GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo info, valuetype [runtime]System.Runtime.Serialization.StreamingContext context) cil managed + { + .custom instance void [runtime]System.Security.SecurityCriticalAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldarg.1 + IL_0002: ldarg.2 + IL_0003: call instance void [runtime]System.Exception::GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo, + valuetype [runtime]System.Runtime.Serialization.StreamingContext) + IL_0008: ldarg.1 + IL_0009: ldstr "Data0" + IL_000e: ldarg.0 + IL_000f: ldfld int32 ABC/ABC/MyExn::Data0@ + IL_0014: box [runtime]System.Int32 + IL_0019: callvirt instance void [runtime]System.Runtime.Serialization.SerializationInfo::AddValue(string, + object) + IL_001e: ret } .method public hidebysig specialname instance int32 get_Data0() cil managed diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule.fs.RealInternalSignatureOn.il.net472.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule.fs.RealInternalSignatureOn.il.net472.release.bsl index c2c806ca394..73f2fdc3aac 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule.fs.RealInternalSignatureOn.il.net472.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule.fs.RealInternalSignatureOn.il.net472.release.bsl @@ -480,7 +480,36 @@ IL_0002: ldarg.2 IL_0003: call instance void [runtime]System.Exception::.ctor(class [runtime]System.Runtime.Serialization.SerializationInfo, valuetype [runtime]System.Runtime.Serialization.StreamingContext) - IL_0008: ret + IL_0008: ldarg.0 + IL_0009: ldarg.1 + IL_000a: ldstr "Data0" + IL_000f: ldtoken [runtime]System.Int32 + IL_0014: call class [runtime]System.Type [runtime]System.Type::GetTypeFromHandle(valuetype [runtime]System.RuntimeTypeHandle) + IL_0019: callvirt instance object [runtime]System.Runtime.Serialization.SerializationInfo::GetValue(string, + class [runtime]System.Type) + IL_001e: unbox.any [runtime]System.Int32 + IL_0023: stfld int32 ABC/MyExn::Data0@ + IL_0028: ret + } + + .method public strict virtual instance void GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo info, valuetype [runtime]System.Runtime.Serialization.StreamingContext context) cil managed + { + .custom instance void [runtime]System.Security.SecurityCriticalAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldarg.1 + IL_0002: ldarg.2 + IL_0003: call instance void [runtime]System.Exception::GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo, + valuetype [runtime]System.Runtime.Serialization.StreamingContext) + IL_0008: ldarg.1 + IL_0009: ldstr "Data0" + IL_000e: ldarg.0 + IL_000f: ldfld int32 ABC/MyExn::Data0@ + IL_0014: box [runtime]System.Int32 + IL_0019: callvirt instance void [runtime]System.Runtime.Serialization.SerializationInfo::AddValue(string, + object) + IL_001e: ret } .method public hidebysig specialname instance int32 get_Data0() cil managed @@ -1180,7 +1209,36 @@ IL_0002: ldarg.2 IL_0003: call instance void [runtime]System.Exception::.ctor(class [runtime]System.Runtime.Serialization.SerializationInfo, valuetype [runtime]System.Runtime.Serialization.StreamingContext) - IL_0008: ret + IL_0008: ldarg.0 + IL_0009: ldarg.1 + IL_000a: ldstr "Data0" + IL_000f: ldtoken [runtime]System.Int32 + IL_0014: call class [runtime]System.Type [runtime]System.Type::GetTypeFromHandle(valuetype [runtime]System.RuntimeTypeHandle) + IL_0019: callvirt instance object [runtime]System.Runtime.Serialization.SerializationInfo::GetValue(string, + class [runtime]System.Type) + IL_001e: unbox.any [runtime]System.Int32 + IL_0023: stfld int32 ABC/ABC/MyExn::Data0@ + IL_0028: ret + } + + .method public strict virtual instance void GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo info, valuetype [runtime]System.Runtime.Serialization.StreamingContext context) cil managed + { + .custom instance void [runtime]System.Security.SecurityCriticalAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldarg.1 + IL_0002: ldarg.2 + IL_0003: call instance void [runtime]System.Exception::GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo, + valuetype [runtime]System.Runtime.Serialization.StreamingContext) + IL_0008: ldarg.1 + IL_0009: ldstr "Data0" + IL_000e: ldarg.0 + IL_000f: ldfld int32 ABC/ABC/MyExn::Data0@ + IL_0014: box [runtime]System.Int32 + IL_0019: callvirt instance void [runtime]System.Runtime.Serialization.SerializationInfo::AddValue(string, + object) + IL_001e: ret } .method public hidebysig specialname instance int32 get_Data0() cil managed diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace.fs.RealInternalSignatureOff.il.net472.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace.fs.RealInternalSignatureOff.il.net472.release.bsl index 2124b122fce..ecc195810c5 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace.fs.RealInternalSignatureOff.il.net472.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace.fs.RealInternalSignatureOff.il.net472.release.bsl @@ -476,7 +476,36 @@ IL_0002: ldarg.2 IL_0003: call instance void [runtime]System.Exception::.ctor(class [runtime]System.Runtime.Serialization.SerializationInfo, valuetype [runtime]System.Runtime.Serialization.StreamingContext) - IL_0008: ret + IL_0008: ldarg.0 + IL_0009: ldarg.1 + IL_000a: ldstr "Data0" + IL_000f: ldtoken [runtime]System.Int32 + IL_0014: call class [runtime]System.Type [runtime]System.Type::GetTypeFromHandle(valuetype [runtime]System.RuntimeTypeHandle) + IL_0019: callvirt instance object [runtime]System.Runtime.Serialization.SerializationInfo::GetValue(string, + class [runtime]System.Type) + IL_001e: unbox.any [runtime]System.Int32 + IL_0023: stfld int32 XYZ.MyExn::Data0@ + IL_0028: ret + } + + .method public strict virtual instance void GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo info, valuetype [runtime]System.Runtime.Serialization.StreamingContext context) cil managed + { + .custom instance void [runtime]System.Security.SecurityCriticalAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldarg.1 + IL_0002: ldarg.2 + IL_0003: call instance void [runtime]System.Exception::GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo, + valuetype [runtime]System.Runtime.Serialization.StreamingContext) + IL_0008: ldarg.1 + IL_0009: ldstr "Data0" + IL_000e: ldarg.0 + IL_000f: ldfld int32 XYZ.MyExn::Data0@ + IL_0014: box [runtime]System.Int32 + IL_0019: callvirt instance void [runtime]System.Runtime.Serialization.SerializationInfo::AddValue(string, + object) + IL_001e: ret } .method public hidebysig specialname instance int32 get_Data0() cil managed @@ -1176,7 +1205,36 @@ IL_0002: ldarg.2 IL_0003: call instance void [runtime]System.Exception::.ctor(class [runtime]System.Runtime.Serialization.SerializationInfo, valuetype [runtime]System.Runtime.Serialization.StreamingContext) - IL_0008: ret + IL_0008: ldarg.0 + IL_0009: ldarg.1 + IL_000a: ldstr "Data0" + IL_000f: ldtoken [runtime]System.Int32 + IL_0014: call class [runtime]System.Type [runtime]System.Type::GetTypeFromHandle(valuetype [runtime]System.RuntimeTypeHandle) + IL_0019: callvirt instance object [runtime]System.Runtime.Serialization.SerializationInfo::GetValue(string, + class [runtime]System.Type) + IL_001e: unbox.any [runtime]System.Int32 + IL_0023: stfld int32 XYZ.ABC/MyExn::Data0@ + IL_0028: ret + } + + .method public strict virtual instance void GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo info, valuetype [runtime]System.Runtime.Serialization.StreamingContext context) cil managed + { + .custom instance void [runtime]System.Security.SecurityCriticalAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldarg.1 + IL_0002: ldarg.2 + IL_0003: call instance void [runtime]System.Exception::GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo, + valuetype [runtime]System.Runtime.Serialization.StreamingContext) + IL_0008: ldarg.1 + IL_0009: ldstr "Data0" + IL_000e: ldarg.0 + IL_000f: ldfld int32 XYZ.ABC/MyExn::Data0@ + IL_0014: box [runtime]System.Int32 + IL_0019: callvirt instance void [runtime]System.Runtime.Serialization.SerializationInfo::AddValue(string, + object) + IL_001e: ret } .method public hidebysig specialname instance int32 get_Data0() cil managed @@ -1876,7 +1934,36 @@ IL_0002: ldarg.2 IL_0003: call instance void [runtime]System.Exception::.ctor(class [runtime]System.Runtime.Serialization.SerializationInfo, valuetype [runtime]System.Runtime.Serialization.StreamingContext) - IL_0008: ret + IL_0008: ldarg.0 + IL_0009: ldarg.1 + IL_000a: ldstr "Data0" + IL_000f: ldtoken [runtime]System.Int32 + IL_0014: call class [runtime]System.Type [runtime]System.Type::GetTypeFromHandle(valuetype [runtime]System.RuntimeTypeHandle) + IL_0019: callvirt instance object [runtime]System.Runtime.Serialization.SerializationInfo::GetValue(string, + class [runtime]System.Type) + IL_001e: unbox.any [runtime]System.Int32 + IL_0023: stfld int32 XYZ.ABC/ABC/MyExn::Data0@ + IL_0028: ret + } + + .method public strict virtual instance void GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo info, valuetype [runtime]System.Runtime.Serialization.StreamingContext context) cil managed + { + .custom instance void [runtime]System.Security.SecurityCriticalAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldarg.1 + IL_0002: ldarg.2 + IL_0003: call instance void [runtime]System.Exception::GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo, + valuetype [runtime]System.Runtime.Serialization.StreamingContext) + IL_0008: ldarg.1 + IL_0009: ldstr "Data0" + IL_000e: ldarg.0 + IL_000f: ldfld int32 XYZ.ABC/ABC/MyExn::Data0@ + IL_0014: box [runtime]System.Int32 + IL_0019: callvirt instance void [runtime]System.Runtime.Serialization.SerializationInfo::AddValue(string, + object) + IL_001e: ret } .method public hidebysig specialname instance int32 get_Data0() cil managed diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace.fs.RealInternalSignatureOn.il.net472.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace.fs.RealInternalSignatureOn.il.net472.release.bsl index f51bf1231fc..592d7d686be 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace.fs.RealInternalSignatureOn.il.net472.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace.fs.RealInternalSignatureOn.il.net472.release.bsl @@ -476,7 +476,36 @@ IL_0002: ldarg.2 IL_0003: call instance void [runtime]System.Exception::.ctor(class [runtime]System.Runtime.Serialization.SerializationInfo, valuetype [runtime]System.Runtime.Serialization.StreamingContext) - IL_0008: ret + IL_0008: ldarg.0 + IL_0009: ldarg.1 + IL_000a: ldstr "Data0" + IL_000f: ldtoken [runtime]System.Int32 + IL_0014: call class [runtime]System.Type [runtime]System.Type::GetTypeFromHandle(valuetype [runtime]System.RuntimeTypeHandle) + IL_0019: callvirt instance object [runtime]System.Runtime.Serialization.SerializationInfo::GetValue(string, + class [runtime]System.Type) + IL_001e: unbox.any [runtime]System.Int32 + IL_0023: stfld int32 XYZ.MyExn::Data0@ + IL_0028: ret + } + + .method public strict virtual instance void GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo info, valuetype [runtime]System.Runtime.Serialization.StreamingContext context) cil managed + { + .custom instance void [runtime]System.Security.SecurityCriticalAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldarg.1 + IL_0002: ldarg.2 + IL_0003: call instance void [runtime]System.Exception::GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo, + valuetype [runtime]System.Runtime.Serialization.StreamingContext) + IL_0008: ldarg.1 + IL_0009: ldstr "Data0" + IL_000e: ldarg.0 + IL_000f: ldfld int32 XYZ.MyExn::Data0@ + IL_0014: box [runtime]System.Int32 + IL_0019: callvirt instance void [runtime]System.Runtime.Serialization.SerializationInfo::AddValue(string, + object) + IL_001e: ret } .method public hidebysig specialname instance int32 get_Data0() cil managed @@ -1176,7 +1205,36 @@ IL_0002: ldarg.2 IL_0003: call instance void [runtime]System.Exception::.ctor(class [runtime]System.Runtime.Serialization.SerializationInfo, valuetype [runtime]System.Runtime.Serialization.StreamingContext) - IL_0008: ret + IL_0008: ldarg.0 + IL_0009: ldarg.1 + IL_000a: ldstr "Data0" + IL_000f: ldtoken [runtime]System.Int32 + IL_0014: call class [runtime]System.Type [runtime]System.Type::GetTypeFromHandle(valuetype [runtime]System.RuntimeTypeHandle) + IL_0019: callvirt instance object [runtime]System.Runtime.Serialization.SerializationInfo::GetValue(string, + class [runtime]System.Type) + IL_001e: unbox.any [runtime]System.Int32 + IL_0023: stfld int32 XYZ.ABC/MyExn::Data0@ + IL_0028: ret + } + + .method public strict virtual instance void GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo info, valuetype [runtime]System.Runtime.Serialization.StreamingContext context) cil managed + { + .custom instance void [runtime]System.Security.SecurityCriticalAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldarg.1 + IL_0002: ldarg.2 + IL_0003: call instance void [runtime]System.Exception::GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo, + valuetype [runtime]System.Runtime.Serialization.StreamingContext) + IL_0008: ldarg.1 + IL_0009: ldstr "Data0" + IL_000e: ldarg.0 + IL_000f: ldfld int32 XYZ.ABC/MyExn::Data0@ + IL_0014: box [runtime]System.Int32 + IL_0019: callvirt instance void [runtime]System.Runtime.Serialization.SerializationInfo::AddValue(string, + object) + IL_001e: ret } .method public hidebysig specialname instance int32 get_Data0() cil managed @@ -1876,7 +1934,36 @@ IL_0002: ldarg.2 IL_0003: call instance void [runtime]System.Exception::.ctor(class [runtime]System.Runtime.Serialization.SerializationInfo, valuetype [runtime]System.Runtime.Serialization.StreamingContext) - IL_0008: ret + IL_0008: ldarg.0 + IL_0009: ldarg.1 + IL_000a: ldstr "Data0" + IL_000f: ldtoken [runtime]System.Int32 + IL_0014: call class [runtime]System.Type [runtime]System.Type::GetTypeFromHandle(valuetype [runtime]System.RuntimeTypeHandle) + IL_0019: callvirt instance object [runtime]System.Runtime.Serialization.SerializationInfo::GetValue(string, + class [runtime]System.Type) + IL_001e: unbox.any [runtime]System.Int32 + IL_0023: stfld int32 XYZ.ABC/ABC/MyExn::Data0@ + IL_0028: ret + } + + .method public strict virtual instance void GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo info, valuetype [runtime]System.Runtime.Serialization.StreamingContext context) cil managed + { + .custom instance void [runtime]System.Security.SecurityCriticalAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldarg.1 + IL_0002: ldarg.2 + IL_0003: call instance void [runtime]System.Exception::GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo, + valuetype [runtime]System.Runtime.Serialization.StreamingContext) + IL_0008: ldarg.1 + IL_0009: ldstr "Data0" + IL_000e: ldarg.0 + IL_000f: ldfld int32 XYZ.ABC/ABC/MyExn::Data0@ + IL_0014: box [runtime]System.Int32 + IL_0019: callvirt instance void [runtime]System.Runtime.Serialization.SerializationInfo::AddValue(string, + object) + IL_001e: ret } .method public hidebysig specialname instance int32 get_Data0() cil managed From c00553fdf4c67901f040871cbb14db7a00b957b7 Mon Sep 17 00:00:00 2001 From: Tomas Grosup Date: Tue, 17 Mar 2026 18:31:08 +0100 Subject: [PATCH 08/16] Fix flaky AsyncMemoize test: wait for all cancellations before asserting Changed eventsWhen condition in 'Cancel running jobs with the same key' test to wait until all 10 outdated jobs are canceled and the new job finishes, instead of stopping at the first Finished event. This prevents race conditions where assertions run before all cancellations complete. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../CompilerService/AsyncMemoize.fs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/tests/FSharp.Compiler.ComponentTests/CompilerService/AsyncMemoize.fs b/tests/FSharp.Compiler.ComponentTests/CompilerService/AsyncMemoize.fs index 3b50cd9fe25..e6f63ce5280 100644 --- a/tests/FSharp.Compiler.ComponentTests/CompilerService/AsyncMemoize.fs +++ b/tests/FSharp.Compiler.ComponentTests/CompilerService/AsyncMemoize.fs @@ -439,13 +439,11 @@ let ``Cancel running jobs with the same key`` () = job.Wait() - let events = eventsWhen events (received Finished) + // Wait for all 10 outdated jobs to be canceled and the new one to finish. + let events = eventsWhen events (fun e -> countOf Canceled e = 10 && countOf Finished e = 1) Assert.Equal(0, events |> countOf Failed) - - // All outdated jobs should have been canceled by now. Assert.Equal(10, events |> countOf Canceled) - Assert.Equal(1, events |> countOf Finished) type DummyException(msg) = From 39923aed38770b0d2f53f4ad2a932bf35e874ad8 Mon Sep 17 00:00:00 2001 From: Tomas Grosup Date: Tue, 17 Mar 2026 18:31:47 +0100 Subject: [PATCH 09/16] Retrigger CI: sole failure was known flaky test AsyncMemoize.Cancel (issue #18411) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> From bfb366ab170bf353a88fe424ca857fa310aefacc Mon Sep 17 00:00:00 2001 From: Tomas Grosup Date: Thu, 26 Mar 2026 22:59:26 +0100 Subject: [PATCH 10/16] Fix serialization key collision in exception types Use IL backing field name (with @ suffix) as the serialization key instead of the property name. This prevents duplicate key crashes when an F# exception field name collides with a key already used by Exception.GetObjectData (e.g., 'exception Foo of Message:string'). The backing field name (e.g., 'Message@', 'Data0@') is guaranteed to not collide with base Exception serialization keys. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- src/Compiler/CodeGen/IlxGen.fs | 8 ++++---- .../CodeGenRegressions_Exceptions.fs | 4 ++-- .../Nullness/ExceptionType.fs.il.net472.bsl | 20 +++++++++---------- .../Nullness/ExceptionType.fs.il.netcore.bsl | 20 +++++++++---------- ...InternalSignatureOff.il.net472.release.bsl | 8 ++++---- ...nternalSignatureOff.il.netcore.release.bsl | 8 ++++---- ...lInternalSignatureOn.il.net472.release.bsl | 8 ++++---- ...InternalSignatureOn.il.netcore.release.bsl | 8 ++++---- ...InternalSignatureOff.il.net472.release.bsl | 12 +++++------ ...nternalSignatureOff.il.netcore.release.bsl | 12 +++++------ ...lInternalSignatureOn.il.net472.release.bsl | 12 +++++------ ...InternalSignatureOn.il.netcore.release.bsl | 12 +++++------ 12 files changed, 66 insertions(+), 66 deletions(-) diff --git a/src/Compiler/CodeGen/IlxGen.fs b/src/Compiler/CodeGen/IlxGen.fs index c717f00f519..8cef2a97970 100644 --- a/src/Compiler/CodeGen/IlxGen.fs +++ b/src/Compiler/CodeGen/IlxGen.fs @@ -12213,11 +12213,11 @@ and GenExnDef cenv mgbuf eenv m (exnc: Tycon) : ILTypeRef option = ty.IsNominal && ty.Boxity = ILBoxity.AsValue let ilInstrsToRestoreFields = - emitSerializationFieldIL (fun ilPropName ilFieldName ilPropType -> + emitSerializationFieldIL (fun _ilPropName ilFieldName ilPropType -> [ mkLdarg0 mkLdarg 1us - I_ldstr ilPropName + I_ldstr ilFieldName I_ldtoken(ILToken.ILType ilPropType) mkNormalCall ( @@ -12270,10 +12270,10 @@ and GenExnDef cenv mgbuf eenv m (exnc: Tycon) : ILTypeRef option = ) let ilInstrsToSaveFields = - emitSerializationFieldIL (fun ilPropName ilFieldName ilPropType -> + emitSerializationFieldIL (fun _ilPropName ilFieldName ilPropType -> [ mkLdarg 1us - I_ldstr ilPropName + I_ldstr ilFieldName mkLdarg0 mkNormalLdfld (mkILFieldSpecInTy (ilThisTy, ilFieldName, ilPropType)) diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/CodeGenRegressions/CodeGenRegressions_Exceptions.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/CodeGenRegressions/CodeGenRegressions_Exceptions.fs index 6e3c95e54fb..f47d2f96337 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/CodeGenRegressions/CodeGenRegressions_Exceptions.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/CodeGenRegressions/CodeGenRegressions_Exceptions.fs @@ -79,8 +79,8 @@ let main _ = let info = SerializationInfo(original.GetType(), FormatterConverter()) let ctx = StreamingContext(StreamingContextStates.All) original.GetObjectData(info, ctx) - let xVal = info.GetString("x") - let yVal = info.GetInt32("y") + let xVal = info.GetString("x@") + let yVal = info.GetInt32("y@") if xVal <> "value" then failwithf "GetObjectData: Expected x='value', got '%s'" xVal if yVal <> 42 then failwithf "GetObjectData: Expected y=42, got %d" yVal diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/ExceptionType.fs.il.net472.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/ExceptionType.fs.il.net472.bsl index 39d8616f94b..411632c6816 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/ExceptionType.fs.il.net472.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/ExceptionType.fs.il.net472.bsl @@ -64,7 +64,7 @@ valuetype [runtime]System.Runtime.Serialization.StreamingContext) IL_0008: ldarg.0 IL_0009: ldarg.1 - IL_000a: ldstr "Data0" + IL_000a: ldstr "Data0@" IL_000f: ldtoken [runtime]System.String IL_0014: call class [runtime]System.Type [runtime]System.Type::GetTypeFromHandle(valuetype [runtime]System.RuntimeTypeHandle) IL_0019: callvirt instance object [runtime]System.Runtime.Serialization.SerializationInfo::GetValue(string, @@ -85,7 +85,7 @@ IL_0003: call instance void [runtime]System.Exception::GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo, valuetype [runtime]System.Runtime.Serialization.StreamingContext) IL_0008: ldarg.1 - IL_0009: ldstr "Data0" + IL_0009: ldstr "Data0@" IL_000e: ldarg.0 IL_000f: ldfld string MyLibrary/JustStringE::Data0@ IL_0014: callvirt instance void [runtime]System.Runtime.Serialization.SerializationInfo::AddValue(string, @@ -167,7 +167,7 @@ valuetype [runtime]System.Runtime.Serialization.StreamingContext) IL_0008: ldarg.0 IL_0009: ldarg.1 - IL_000a: ldstr "M1" + IL_000a: ldstr "M1@" IL_000f: ldtoken [runtime]System.String IL_0014: call class [runtime]System.Type [runtime]System.Type::GetTypeFromHandle(valuetype [runtime]System.RuntimeTypeHandle) IL_0019: callvirt instance object [runtime]System.Runtime.Serialization.SerializationInfo::GetValue(string, @@ -176,7 +176,7 @@ IL_0023: stfld string MyLibrary/TwoStrings::M1@ IL_0028: ldarg.0 IL_0029: ldarg.1 - IL_002a: ldstr "M2" + IL_002a: ldstr "M2@" IL_002f: ldtoken [runtime]System.String IL_0034: call class [runtime]System.Type [runtime]System.Type::GetTypeFromHandle(valuetype [runtime]System.RuntimeTypeHandle) IL_0039: callvirt instance object [runtime]System.Runtime.Serialization.SerializationInfo::GetValue(string, @@ -197,13 +197,13 @@ IL_0003: call instance void [runtime]System.Exception::GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo, valuetype [runtime]System.Runtime.Serialization.StreamingContext) IL_0008: ldarg.1 - IL_0009: ldstr "M1" + IL_0009: ldstr "M1@" IL_000e: ldarg.0 IL_000f: ldfld string MyLibrary/TwoStrings::M1@ IL_0014: callvirt instance void [runtime]System.Runtime.Serialization.SerializationInfo::AddValue(string, object) IL_0019: ldarg.1 - IL_001a: ldstr "M2" + IL_001a: ldstr "M2@" IL_001f: ldarg.0 IL_0020: ldfld string MyLibrary/TwoStrings::M2@ IL_0025: callvirt instance void [runtime]System.Runtime.Serialization.SerializationInfo::AddValue(string, @@ -299,7 +299,7 @@ valuetype [runtime]System.Runtime.Serialization.StreamingContext) IL_0008: ldarg.0 IL_0009: ldarg.1 - IL_000a: ldstr "Data0" + IL_000a: ldstr "Data0@" IL_000f: ldtoken [runtime]System.String IL_0014: call class [runtime]System.Type [runtime]System.Type::GetTypeFromHandle(valuetype [runtime]System.RuntimeTypeHandle) IL_0019: callvirt instance object [runtime]System.Runtime.Serialization.SerializationInfo::GetValue(string, @@ -320,7 +320,7 @@ IL_0003: call instance void [runtime]System.Exception::GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo, valuetype [runtime]System.Runtime.Serialization.StreamingContext) IL_0008: ldarg.1 - IL_0009: ldstr "Data0" + IL_0009: ldstr "Data0@" IL_000e: ldarg.0 IL_000f: ldfld string MyLibrary/NullableStringE::Data0@ IL_0014: callvirt instance void [runtime]System.Runtime.Serialization.SerializationInfo::AddValue(string, @@ -401,7 +401,7 @@ valuetype [runtime]System.Runtime.Serialization.StreamingContext) IL_0008: ldarg.0 IL_0009: ldarg.1 - IL_000a: ldstr "Message" + IL_000a: ldstr "Message@" IL_000f: ldtoken [runtime]System.String IL_0014: call class [runtime]System.Type [runtime]System.Type::GetTypeFromHandle(valuetype [runtime]System.RuntimeTypeHandle) IL_0019: callvirt instance object [runtime]System.Runtime.Serialization.SerializationInfo::GetValue(string, @@ -422,7 +422,7 @@ IL_0003: call instance void [runtime]System.Exception::GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo, valuetype [runtime]System.Runtime.Serialization.StreamingContext) IL_0008: ldarg.1 - IL_0009: ldstr "Message" + IL_0009: ldstr "Message@" IL_000e: ldarg.0 IL_000f: ldfld string MyLibrary/NullableMessage::Message@ IL_0014: callvirt instance void [runtime]System.Runtime.Serialization.SerializationInfo::AddValue(string, diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/ExceptionType.fs.il.netcore.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/ExceptionType.fs.il.netcore.bsl index 0ff3392e278..476d96e1a4a 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/ExceptionType.fs.il.netcore.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/ExceptionType.fs.il.netcore.bsl @@ -64,7 +64,7 @@ valuetype [runtime]System.Runtime.Serialization.StreamingContext) IL_0008: ldarg.0 IL_0009: ldarg.1 - IL_000a: ldstr "Data0" + IL_000a: ldstr "Data0@" IL_000f: ldtoken [runtime]System.String IL_0014: call class [runtime]System.Type [runtime]System.Type::GetTypeFromHandle(valuetype [runtime]System.RuntimeTypeHandle) IL_0019: callvirt instance object [runtime]System.Runtime.Serialization.SerializationInfo::GetValue(string, @@ -85,7 +85,7 @@ IL_0003: call instance void [runtime]System.Exception::GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo, valuetype [runtime]System.Runtime.Serialization.StreamingContext) IL_0008: ldarg.1 - IL_0009: ldstr "Data0" + IL_0009: ldstr "Data0@" IL_000e: ldarg.0 IL_000f: ldfld string MyLibrary/JustStringE::Data0@ IL_0014: callvirt instance void [runtime]System.Runtime.Serialization.SerializationInfo::AddValue(string, @@ -167,7 +167,7 @@ valuetype [runtime]System.Runtime.Serialization.StreamingContext) IL_0008: ldarg.0 IL_0009: ldarg.1 - IL_000a: ldstr "M1" + IL_000a: ldstr "M1@" IL_000f: ldtoken [runtime]System.String IL_0014: call class [runtime]System.Type [runtime]System.Type::GetTypeFromHandle(valuetype [runtime]System.RuntimeTypeHandle) IL_0019: callvirt instance object [runtime]System.Runtime.Serialization.SerializationInfo::GetValue(string, @@ -176,7 +176,7 @@ IL_0023: stfld string MyLibrary/TwoStrings::M1@ IL_0028: ldarg.0 IL_0029: ldarg.1 - IL_002a: ldstr "M2" + IL_002a: ldstr "M2@" IL_002f: ldtoken [runtime]System.String IL_0034: call class [runtime]System.Type [runtime]System.Type::GetTypeFromHandle(valuetype [runtime]System.RuntimeTypeHandle) IL_0039: callvirt instance object [runtime]System.Runtime.Serialization.SerializationInfo::GetValue(string, @@ -197,13 +197,13 @@ IL_0003: call instance void [runtime]System.Exception::GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo, valuetype [runtime]System.Runtime.Serialization.StreamingContext) IL_0008: ldarg.1 - IL_0009: ldstr "M1" + IL_0009: ldstr "M1@" IL_000e: ldarg.0 IL_000f: ldfld string MyLibrary/TwoStrings::M1@ IL_0014: callvirt instance void [runtime]System.Runtime.Serialization.SerializationInfo::AddValue(string, object) IL_0019: ldarg.1 - IL_001a: ldstr "M2" + IL_001a: ldstr "M2@" IL_001f: ldarg.0 IL_0020: ldfld string MyLibrary/TwoStrings::M2@ IL_0025: callvirt instance void [runtime]System.Runtime.Serialization.SerializationInfo::AddValue(string, @@ -299,7 +299,7 @@ valuetype [runtime]System.Runtime.Serialization.StreamingContext) IL_0008: ldarg.0 IL_0009: ldarg.1 - IL_000a: ldstr "Data0" + IL_000a: ldstr "Data0@" IL_000f: ldtoken [runtime]System.String IL_0014: call class [runtime]System.Type [runtime]System.Type::GetTypeFromHandle(valuetype [runtime]System.RuntimeTypeHandle) IL_0019: callvirt instance object [runtime]System.Runtime.Serialization.SerializationInfo::GetValue(string, @@ -320,7 +320,7 @@ IL_0003: call instance void [runtime]System.Exception::GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo, valuetype [runtime]System.Runtime.Serialization.StreamingContext) IL_0008: ldarg.1 - IL_0009: ldstr "Data0" + IL_0009: ldstr "Data0@" IL_000e: ldarg.0 IL_000f: ldfld string MyLibrary/NullableStringE::Data0@ IL_0014: callvirt instance void [runtime]System.Runtime.Serialization.SerializationInfo::AddValue(string, @@ -401,7 +401,7 @@ valuetype [runtime]System.Runtime.Serialization.StreamingContext) IL_0008: ldarg.0 IL_0009: ldarg.1 - IL_000a: ldstr "Message" + IL_000a: ldstr "Message@" IL_000f: ldtoken [runtime]System.String IL_0014: call class [runtime]System.Type [runtime]System.Type::GetTypeFromHandle(valuetype [runtime]System.RuntimeTypeHandle) IL_0019: callvirt instance object [runtime]System.Runtime.Serialization.SerializationInfo::GetValue(string, @@ -422,7 +422,7 @@ IL_0003: call instance void [runtime]System.Exception::GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo, valuetype [runtime]System.Runtime.Serialization.StreamingContext) IL_0008: ldarg.1 - IL_0009: ldstr "Message" + IL_0009: ldstr "Message@" IL_000e: ldarg.0 IL_000f: ldfld string MyLibrary/NullableMessage::Message@ IL_0014: callvirt instance void [runtime]System.Runtime.Serialization.SerializationInfo::AddValue(string, diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule.fs.RealInternalSignatureOff.il.net472.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule.fs.RealInternalSignatureOff.il.net472.release.bsl index 3e50fbe8595..2ff565e9d85 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule.fs.RealInternalSignatureOff.il.net472.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule.fs.RealInternalSignatureOff.il.net472.release.bsl @@ -482,7 +482,7 @@ valuetype [runtime]System.Runtime.Serialization.StreamingContext) IL_0008: ldarg.0 IL_0009: ldarg.1 - IL_000a: ldstr "Data0" + IL_000a: ldstr "Data0@" IL_000f: ldtoken [runtime]System.Int32 IL_0014: call class [runtime]System.Type [runtime]System.Type::GetTypeFromHandle(valuetype [runtime]System.RuntimeTypeHandle) IL_0019: callvirt instance object [runtime]System.Runtime.Serialization.SerializationInfo::GetValue(string, @@ -503,7 +503,7 @@ IL_0003: call instance void [runtime]System.Exception::GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo, valuetype [runtime]System.Runtime.Serialization.StreamingContext) IL_0008: ldarg.1 - IL_0009: ldstr "Data0" + IL_0009: ldstr "Data0@" IL_000e: ldarg.0 IL_000f: ldfld int32 ABC/MyExn::Data0@ IL_0014: box [runtime]System.Int32 @@ -1211,7 +1211,7 @@ valuetype [runtime]System.Runtime.Serialization.StreamingContext) IL_0008: ldarg.0 IL_0009: ldarg.1 - IL_000a: ldstr "Data0" + IL_000a: ldstr "Data0@" IL_000f: ldtoken [runtime]System.Int32 IL_0014: call class [runtime]System.Type [runtime]System.Type::GetTypeFromHandle(valuetype [runtime]System.RuntimeTypeHandle) IL_0019: callvirt instance object [runtime]System.Runtime.Serialization.SerializationInfo::GetValue(string, @@ -1232,7 +1232,7 @@ IL_0003: call instance void [runtime]System.Exception::GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo, valuetype [runtime]System.Runtime.Serialization.StreamingContext) IL_0008: ldarg.1 - IL_0009: ldstr "Data0" + IL_0009: ldstr "Data0@" IL_000e: ldarg.0 IL_000f: ldfld int32 ABC/ABC/MyExn::Data0@ IL_0014: box [runtime]System.Int32 diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule.fs.RealInternalSignatureOff.il.netcore.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule.fs.RealInternalSignatureOff.il.netcore.release.bsl index e230897b4ff..9204d5bbad9 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule.fs.RealInternalSignatureOff.il.netcore.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule.fs.RealInternalSignatureOff.il.netcore.release.bsl @@ -482,7 +482,7 @@ valuetype [runtime]System.Runtime.Serialization.StreamingContext) IL_0008: ldarg.0 IL_0009: ldarg.1 - IL_000a: ldstr "Data0" + IL_000a: ldstr "Data0@" IL_000f: ldtoken [runtime]System.Int32 IL_0014: call class [runtime]System.Type [runtime]System.Type::GetTypeFromHandle(valuetype [runtime]System.RuntimeTypeHandle) IL_0019: callvirt instance object [runtime]System.Runtime.Serialization.SerializationInfo::GetValue(string, @@ -503,7 +503,7 @@ IL_0003: call instance void [runtime]System.Exception::GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo, valuetype [runtime]System.Runtime.Serialization.StreamingContext) IL_0008: ldarg.1 - IL_0009: ldstr "Data0" + IL_0009: ldstr "Data0@" IL_000e: ldarg.0 IL_000f: ldfld int32 ABC/MyExn::Data0@ IL_0014: box [runtime]System.Int32 @@ -1211,7 +1211,7 @@ valuetype [runtime]System.Runtime.Serialization.StreamingContext) IL_0008: ldarg.0 IL_0009: ldarg.1 - IL_000a: ldstr "Data0" + IL_000a: ldstr "Data0@" IL_000f: ldtoken [runtime]System.Int32 IL_0014: call class [runtime]System.Type [runtime]System.Type::GetTypeFromHandle(valuetype [runtime]System.RuntimeTypeHandle) IL_0019: callvirt instance object [runtime]System.Runtime.Serialization.SerializationInfo::GetValue(string, @@ -1232,7 +1232,7 @@ IL_0003: call instance void [runtime]System.Exception::GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo, valuetype [runtime]System.Runtime.Serialization.StreamingContext) IL_0008: ldarg.1 - IL_0009: ldstr "Data0" + IL_0009: ldstr "Data0@" IL_000e: ldarg.0 IL_000f: ldfld int32 ABC/ABC/MyExn::Data0@ IL_0014: box [runtime]System.Int32 diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule.fs.RealInternalSignatureOn.il.net472.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule.fs.RealInternalSignatureOn.il.net472.release.bsl index 73f2fdc3aac..8647b764b0a 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule.fs.RealInternalSignatureOn.il.net472.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule.fs.RealInternalSignatureOn.il.net472.release.bsl @@ -482,7 +482,7 @@ valuetype [runtime]System.Runtime.Serialization.StreamingContext) IL_0008: ldarg.0 IL_0009: ldarg.1 - IL_000a: ldstr "Data0" + IL_000a: ldstr "Data0@" IL_000f: ldtoken [runtime]System.Int32 IL_0014: call class [runtime]System.Type [runtime]System.Type::GetTypeFromHandle(valuetype [runtime]System.RuntimeTypeHandle) IL_0019: callvirt instance object [runtime]System.Runtime.Serialization.SerializationInfo::GetValue(string, @@ -503,7 +503,7 @@ IL_0003: call instance void [runtime]System.Exception::GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo, valuetype [runtime]System.Runtime.Serialization.StreamingContext) IL_0008: ldarg.1 - IL_0009: ldstr "Data0" + IL_0009: ldstr "Data0@" IL_000e: ldarg.0 IL_000f: ldfld int32 ABC/MyExn::Data0@ IL_0014: box [runtime]System.Int32 @@ -1211,7 +1211,7 @@ valuetype [runtime]System.Runtime.Serialization.StreamingContext) IL_0008: ldarg.0 IL_0009: ldarg.1 - IL_000a: ldstr "Data0" + IL_000a: ldstr "Data0@" IL_000f: ldtoken [runtime]System.Int32 IL_0014: call class [runtime]System.Type [runtime]System.Type::GetTypeFromHandle(valuetype [runtime]System.RuntimeTypeHandle) IL_0019: callvirt instance object [runtime]System.Runtime.Serialization.SerializationInfo::GetValue(string, @@ -1232,7 +1232,7 @@ IL_0003: call instance void [runtime]System.Exception::GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo, valuetype [runtime]System.Runtime.Serialization.StreamingContext) IL_0008: ldarg.1 - IL_0009: ldstr "Data0" + IL_0009: ldstr "Data0@" IL_000e: ldarg.0 IL_000f: ldfld int32 ABC/ABC/MyExn::Data0@ IL_0014: box [runtime]System.Int32 diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule.fs.RealInternalSignatureOn.il.netcore.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule.fs.RealInternalSignatureOn.il.netcore.release.bsl index a0129f45485..8cace78ab41 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule.fs.RealInternalSignatureOn.il.netcore.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule.fs.RealInternalSignatureOn.il.netcore.release.bsl @@ -482,7 +482,7 @@ valuetype [runtime]System.Runtime.Serialization.StreamingContext) IL_0008: ldarg.0 IL_0009: ldarg.1 - IL_000a: ldstr "Data0" + IL_000a: ldstr "Data0@" IL_000f: ldtoken [runtime]System.Int32 IL_0014: call class [runtime]System.Type [runtime]System.Type::GetTypeFromHandle(valuetype [runtime]System.RuntimeTypeHandle) IL_0019: callvirt instance object [runtime]System.Runtime.Serialization.SerializationInfo::GetValue(string, @@ -503,7 +503,7 @@ IL_0003: call instance void [runtime]System.Exception::GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo, valuetype [runtime]System.Runtime.Serialization.StreamingContext) IL_0008: ldarg.1 - IL_0009: ldstr "Data0" + IL_0009: ldstr "Data0@" IL_000e: ldarg.0 IL_000f: ldfld int32 ABC/MyExn::Data0@ IL_0014: box [runtime]System.Int32 @@ -1211,7 +1211,7 @@ valuetype [runtime]System.Runtime.Serialization.StreamingContext) IL_0008: ldarg.0 IL_0009: ldarg.1 - IL_000a: ldstr "Data0" + IL_000a: ldstr "Data0@" IL_000f: ldtoken [runtime]System.Int32 IL_0014: call class [runtime]System.Type [runtime]System.Type::GetTypeFromHandle(valuetype [runtime]System.RuntimeTypeHandle) IL_0019: callvirt instance object [runtime]System.Runtime.Serialization.SerializationInfo::GetValue(string, @@ -1232,7 +1232,7 @@ IL_0003: call instance void [runtime]System.Exception::GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo, valuetype [runtime]System.Runtime.Serialization.StreamingContext) IL_0008: ldarg.1 - IL_0009: ldstr "Data0" + IL_0009: ldstr "Data0@" IL_000e: ldarg.0 IL_000f: ldfld int32 ABC/ABC/MyExn::Data0@ IL_0014: box [runtime]System.Int32 diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace.fs.RealInternalSignatureOff.il.net472.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace.fs.RealInternalSignatureOff.il.net472.release.bsl index ecc195810c5..1889ccc93b1 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace.fs.RealInternalSignatureOff.il.net472.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace.fs.RealInternalSignatureOff.il.net472.release.bsl @@ -478,7 +478,7 @@ valuetype [runtime]System.Runtime.Serialization.StreamingContext) IL_0008: ldarg.0 IL_0009: ldarg.1 - IL_000a: ldstr "Data0" + IL_000a: ldstr "Data0@" IL_000f: ldtoken [runtime]System.Int32 IL_0014: call class [runtime]System.Type [runtime]System.Type::GetTypeFromHandle(valuetype [runtime]System.RuntimeTypeHandle) IL_0019: callvirt instance object [runtime]System.Runtime.Serialization.SerializationInfo::GetValue(string, @@ -499,7 +499,7 @@ IL_0003: call instance void [runtime]System.Exception::GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo, valuetype [runtime]System.Runtime.Serialization.StreamingContext) IL_0008: ldarg.1 - IL_0009: ldstr "Data0" + IL_0009: ldstr "Data0@" IL_000e: ldarg.0 IL_000f: ldfld int32 XYZ.MyExn::Data0@ IL_0014: box [runtime]System.Int32 @@ -1207,7 +1207,7 @@ valuetype [runtime]System.Runtime.Serialization.StreamingContext) IL_0008: ldarg.0 IL_0009: ldarg.1 - IL_000a: ldstr "Data0" + IL_000a: ldstr "Data0@" IL_000f: ldtoken [runtime]System.Int32 IL_0014: call class [runtime]System.Type [runtime]System.Type::GetTypeFromHandle(valuetype [runtime]System.RuntimeTypeHandle) IL_0019: callvirt instance object [runtime]System.Runtime.Serialization.SerializationInfo::GetValue(string, @@ -1228,7 +1228,7 @@ IL_0003: call instance void [runtime]System.Exception::GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo, valuetype [runtime]System.Runtime.Serialization.StreamingContext) IL_0008: ldarg.1 - IL_0009: ldstr "Data0" + IL_0009: ldstr "Data0@" IL_000e: ldarg.0 IL_000f: ldfld int32 XYZ.ABC/MyExn::Data0@ IL_0014: box [runtime]System.Int32 @@ -1936,7 +1936,7 @@ valuetype [runtime]System.Runtime.Serialization.StreamingContext) IL_0008: ldarg.0 IL_0009: ldarg.1 - IL_000a: ldstr "Data0" + IL_000a: ldstr "Data0@" IL_000f: ldtoken [runtime]System.Int32 IL_0014: call class [runtime]System.Type [runtime]System.Type::GetTypeFromHandle(valuetype [runtime]System.RuntimeTypeHandle) IL_0019: callvirt instance object [runtime]System.Runtime.Serialization.SerializationInfo::GetValue(string, @@ -1957,7 +1957,7 @@ IL_0003: call instance void [runtime]System.Exception::GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo, valuetype [runtime]System.Runtime.Serialization.StreamingContext) IL_0008: ldarg.1 - IL_0009: ldstr "Data0" + IL_0009: ldstr "Data0@" IL_000e: ldarg.0 IL_000f: ldfld int32 XYZ.ABC/ABC/MyExn::Data0@ IL_0014: box [runtime]System.Int32 diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace.fs.RealInternalSignatureOff.il.netcore.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace.fs.RealInternalSignatureOff.il.netcore.release.bsl index 6f4b9051b97..f239f4b5f40 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace.fs.RealInternalSignatureOff.il.netcore.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace.fs.RealInternalSignatureOff.il.netcore.release.bsl @@ -478,7 +478,7 @@ valuetype [runtime]System.Runtime.Serialization.StreamingContext) IL_0008: ldarg.0 IL_0009: ldarg.1 - IL_000a: ldstr "Data0" + IL_000a: ldstr "Data0@" IL_000f: ldtoken [runtime]System.Int32 IL_0014: call class [runtime]System.Type [runtime]System.Type::GetTypeFromHandle(valuetype [runtime]System.RuntimeTypeHandle) IL_0019: callvirt instance object [runtime]System.Runtime.Serialization.SerializationInfo::GetValue(string, @@ -499,7 +499,7 @@ IL_0003: call instance void [runtime]System.Exception::GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo, valuetype [runtime]System.Runtime.Serialization.StreamingContext) IL_0008: ldarg.1 - IL_0009: ldstr "Data0" + IL_0009: ldstr "Data0@" IL_000e: ldarg.0 IL_000f: ldfld int32 XYZ.MyExn::Data0@ IL_0014: box [runtime]System.Int32 @@ -1207,7 +1207,7 @@ valuetype [runtime]System.Runtime.Serialization.StreamingContext) IL_0008: ldarg.0 IL_0009: ldarg.1 - IL_000a: ldstr "Data0" + IL_000a: ldstr "Data0@" IL_000f: ldtoken [runtime]System.Int32 IL_0014: call class [runtime]System.Type [runtime]System.Type::GetTypeFromHandle(valuetype [runtime]System.RuntimeTypeHandle) IL_0019: callvirt instance object [runtime]System.Runtime.Serialization.SerializationInfo::GetValue(string, @@ -1228,7 +1228,7 @@ IL_0003: call instance void [runtime]System.Exception::GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo, valuetype [runtime]System.Runtime.Serialization.StreamingContext) IL_0008: ldarg.1 - IL_0009: ldstr "Data0" + IL_0009: ldstr "Data0@" IL_000e: ldarg.0 IL_000f: ldfld int32 XYZ.ABC/MyExn::Data0@ IL_0014: box [runtime]System.Int32 @@ -1936,7 +1936,7 @@ valuetype [runtime]System.Runtime.Serialization.StreamingContext) IL_0008: ldarg.0 IL_0009: ldarg.1 - IL_000a: ldstr "Data0" + IL_000a: ldstr "Data0@" IL_000f: ldtoken [runtime]System.Int32 IL_0014: call class [runtime]System.Type [runtime]System.Type::GetTypeFromHandle(valuetype [runtime]System.RuntimeTypeHandle) IL_0019: callvirt instance object [runtime]System.Runtime.Serialization.SerializationInfo::GetValue(string, @@ -1957,7 +1957,7 @@ IL_0003: call instance void [runtime]System.Exception::GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo, valuetype [runtime]System.Runtime.Serialization.StreamingContext) IL_0008: ldarg.1 - IL_0009: ldstr "Data0" + IL_0009: ldstr "Data0@" IL_000e: ldarg.0 IL_000f: ldfld int32 XYZ.ABC/ABC/MyExn::Data0@ IL_0014: box [runtime]System.Int32 diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace.fs.RealInternalSignatureOn.il.net472.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace.fs.RealInternalSignatureOn.il.net472.release.bsl index 592d7d686be..dc900862d41 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace.fs.RealInternalSignatureOn.il.net472.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace.fs.RealInternalSignatureOn.il.net472.release.bsl @@ -478,7 +478,7 @@ valuetype [runtime]System.Runtime.Serialization.StreamingContext) IL_0008: ldarg.0 IL_0009: ldarg.1 - IL_000a: ldstr "Data0" + IL_000a: ldstr "Data0@" IL_000f: ldtoken [runtime]System.Int32 IL_0014: call class [runtime]System.Type [runtime]System.Type::GetTypeFromHandle(valuetype [runtime]System.RuntimeTypeHandle) IL_0019: callvirt instance object [runtime]System.Runtime.Serialization.SerializationInfo::GetValue(string, @@ -499,7 +499,7 @@ IL_0003: call instance void [runtime]System.Exception::GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo, valuetype [runtime]System.Runtime.Serialization.StreamingContext) IL_0008: ldarg.1 - IL_0009: ldstr "Data0" + IL_0009: ldstr "Data0@" IL_000e: ldarg.0 IL_000f: ldfld int32 XYZ.MyExn::Data0@ IL_0014: box [runtime]System.Int32 @@ -1207,7 +1207,7 @@ valuetype [runtime]System.Runtime.Serialization.StreamingContext) IL_0008: ldarg.0 IL_0009: ldarg.1 - IL_000a: ldstr "Data0" + IL_000a: ldstr "Data0@" IL_000f: ldtoken [runtime]System.Int32 IL_0014: call class [runtime]System.Type [runtime]System.Type::GetTypeFromHandle(valuetype [runtime]System.RuntimeTypeHandle) IL_0019: callvirt instance object [runtime]System.Runtime.Serialization.SerializationInfo::GetValue(string, @@ -1228,7 +1228,7 @@ IL_0003: call instance void [runtime]System.Exception::GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo, valuetype [runtime]System.Runtime.Serialization.StreamingContext) IL_0008: ldarg.1 - IL_0009: ldstr "Data0" + IL_0009: ldstr "Data0@" IL_000e: ldarg.0 IL_000f: ldfld int32 XYZ.ABC/MyExn::Data0@ IL_0014: box [runtime]System.Int32 @@ -1936,7 +1936,7 @@ valuetype [runtime]System.Runtime.Serialization.StreamingContext) IL_0008: ldarg.0 IL_0009: ldarg.1 - IL_000a: ldstr "Data0" + IL_000a: ldstr "Data0@" IL_000f: ldtoken [runtime]System.Int32 IL_0014: call class [runtime]System.Type [runtime]System.Type::GetTypeFromHandle(valuetype [runtime]System.RuntimeTypeHandle) IL_0019: callvirt instance object [runtime]System.Runtime.Serialization.SerializationInfo::GetValue(string, @@ -1957,7 +1957,7 @@ IL_0003: call instance void [runtime]System.Exception::GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo, valuetype [runtime]System.Runtime.Serialization.StreamingContext) IL_0008: ldarg.1 - IL_0009: ldstr "Data0" + IL_0009: ldstr "Data0@" IL_000e: ldarg.0 IL_000f: ldfld int32 XYZ.ABC/ABC/MyExn::Data0@ IL_0014: box [runtime]System.Int32 diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace.fs.RealInternalSignatureOn.il.netcore.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace.fs.RealInternalSignatureOn.il.netcore.release.bsl index 172f68c93c9..65e239faaad 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace.fs.RealInternalSignatureOn.il.netcore.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace.fs.RealInternalSignatureOn.il.netcore.release.bsl @@ -478,7 +478,7 @@ valuetype [runtime]System.Runtime.Serialization.StreamingContext) IL_0008: ldarg.0 IL_0009: ldarg.1 - IL_000a: ldstr "Data0" + IL_000a: ldstr "Data0@" IL_000f: ldtoken [runtime]System.Int32 IL_0014: call class [runtime]System.Type [runtime]System.Type::GetTypeFromHandle(valuetype [runtime]System.RuntimeTypeHandle) IL_0019: callvirt instance object [runtime]System.Runtime.Serialization.SerializationInfo::GetValue(string, @@ -499,7 +499,7 @@ IL_0003: call instance void [runtime]System.Exception::GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo, valuetype [runtime]System.Runtime.Serialization.StreamingContext) IL_0008: ldarg.1 - IL_0009: ldstr "Data0" + IL_0009: ldstr "Data0@" IL_000e: ldarg.0 IL_000f: ldfld int32 XYZ.MyExn::Data0@ IL_0014: box [runtime]System.Int32 @@ -1207,7 +1207,7 @@ valuetype [runtime]System.Runtime.Serialization.StreamingContext) IL_0008: ldarg.0 IL_0009: ldarg.1 - IL_000a: ldstr "Data0" + IL_000a: ldstr "Data0@" IL_000f: ldtoken [runtime]System.Int32 IL_0014: call class [runtime]System.Type [runtime]System.Type::GetTypeFromHandle(valuetype [runtime]System.RuntimeTypeHandle) IL_0019: callvirt instance object [runtime]System.Runtime.Serialization.SerializationInfo::GetValue(string, @@ -1228,7 +1228,7 @@ IL_0003: call instance void [runtime]System.Exception::GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo, valuetype [runtime]System.Runtime.Serialization.StreamingContext) IL_0008: ldarg.1 - IL_0009: ldstr "Data0" + IL_0009: ldstr "Data0@" IL_000e: ldarg.0 IL_000f: ldfld int32 XYZ.ABC/MyExn::Data0@ IL_0014: box [runtime]System.Int32 @@ -1936,7 +1936,7 @@ valuetype [runtime]System.Runtime.Serialization.StreamingContext) IL_0008: ldarg.0 IL_0009: ldarg.1 - IL_000a: ldstr "Data0" + IL_000a: ldstr "Data0@" IL_000f: ldtoken [runtime]System.Int32 IL_0014: call class [runtime]System.Type [runtime]System.Type::GetTypeFromHandle(valuetype [runtime]System.RuntimeTypeHandle) IL_0019: callvirt instance object [runtime]System.Runtime.Serialization.SerializationInfo::GetValue(string, @@ -1957,7 +1957,7 @@ IL_0003: call instance void [runtime]System.Exception::GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo, valuetype [runtime]System.Runtime.Serialization.StreamingContext) IL_0008: ldarg.1 - IL_0009: ldstr "Data0" + IL_0009: ldstr "Data0@" IL_000e: ldarg.0 IL_000f: ldfld int32 XYZ.ABC/ABC/MyExn::Data0@ IL_0014: box [runtime]System.Int32 From 79367997861bf9b822483512b22555ad20b2faa9 Mon Sep 17 00:00:00 2001 From: Tomas Grosup Date: Fri, 27 Mar 2026 00:04:28 +0100 Subject: [PATCH 11/16] Add exception serialization Message field collision test Add Issue_878_ExceptionSerialization_MessageFieldCollision test that reproduces the exact edge case where an F# exception field named 'Message' collides with Exception.GetObjectData's 'Message' key. The test verifies: - GetObjectData does not throw with duplicate key - F# field is serialized under backing field name 'Message@' - Base Exception's 'Message' key remains accessible - Full serialization roundtrip preserves the field value Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../CodeGenRegressions_Exceptions.fs | 56 +++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/CodeGenRegressions/CodeGenRegressions_Exceptions.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/CodeGenRegressions/CodeGenRegressions_Exceptions.fs index f47d2f96337..c1199e03583 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/CodeGenRegressions/CodeGenRegressions_Exceptions.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/CodeGenRegressions/CodeGenRegressions_Exceptions.fs @@ -107,6 +107,62 @@ let main _ = |> shouldSucceed |> ignore + // Regression test: exception field named "Message" must not collide with Exception.GetObjectData's "Message" key + // See: https://github.com/dotnet/fsharp/pull/19342#issuecomment-4112137398 + [] + let ``Issue_878_ExceptionSerialization_MessageFieldCollision`` () = + let source = """ +module Test +open System +open System.Runtime.Serialization + +#nowarn "44" +#nowarn "67" + +exception Foo of Message:string + +[] +let main _ = + let original = Foo("hello") + let info = SerializationInfo(original.GetType(), FormatterConverter()) + let ctx = StreamingContext(StreamingContextStates.All) + // This must not throw — previously crashed with duplicate key "Message" + original.GetObjectData(info, ctx) + + // Verify the F# field is serialized under its backing field name + let msgVal = info.GetString("Message@") + if msgVal <> "hello" then failwithf "Expected Message@='hello', got '%s'" msgVal + + // Verify base Exception's Message is also present (from base.GetObjectData) + let baseMsg = info.GetString("Message") + printfn "Base Message: %s" baseMsg + printfn "F# field Message@: %s" msgVal + + // Full roundtrip + let ctor = + original.GetType().GetConstructor( + System.Reflection.BindingFlags.Instance ||| System.Reflection.BindingFlags.NonPublic ||| System.Reflection.BindingFlags.Public, + null, + [| typeof; typeof |], + null) + if ctor = null then failwith "Deserialization constructor not found" + let cloned = ctor.Invoke([| info :> obj; ctx :> obj |]) :?> Exception + let field = cloned.GetType().GetField("Message@", System.Reflection.BindingFlags.Instance ||| System.Reflection.BindingFlags.NonPublic) + if field = null then failwith "Field Message@ not found" + let clonedVal = field.GetValue(cloned) :?> string + if clonedVal <> "hello" then failwithf "Roundtrip: Expected 'hello', got '%s'" clonedVal + printfn "SUCCESS: exception Foo of Message:string roundtripped correctly" + 0 +""" + FSharp source + |> asExe + |> ignoreWarnings + |> compile + |> shouldSucceed + |> run + |> shouldSucceed + |> ignore + // FSharp.Core has [assembly: SecurityTransparent] which prevents overriding // SecurityCritical methods like Exception.GetObjectData on .NET Framework. // Verify that FSharp.Core exceptions (MatchFailureException) still load and work, From ed24e3cd8c2e9f84826631c8e1caa87661aa882c Mon Sep 17 00:00:00 2001 From: Tomas Grosup Date: Fri, 27 Mar 2026 02:11:57 +0100 Subject: [PATCH 12/16] Cleanup GenExnDef: remove duplicated ctor logic, dead parameter - Eliminate ilBaseOnlyCtorInstrs/ilBaseOnlyCtor block that duplicated ilInstrsForSerialization/ilCtorDefForSerialization by introducing shouldRestoreFields flag - Simplify 3-branch if/elif/else to 2-branch conditional - Remove unused ilPropName parameter from emitSerializationFieldIL callback Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- src/Compiler/CodeGen/IlxGen.fs | 42 +++++++++++----------------------- 1 file changed, 13 insertions(+), 29 deletions(-) diff --git a/src/Compiler/CodeGen/IlxGen.fs b/src/Compiler/CodeGen/IlxGen.fs index 8cef2a97970..5f865324c26 100644 --- a/src/Compiler/CodeGen/IlxGen.fs +++ b/src/Compiler/CodeGen/IlxGen.fs @@ -12205,15 +12205,15 @@ and GenExnDef cenv mgbuf eenv m (exnc: Tycon) : ILTypeRef option = let emitSerializationFieldIL emitPerField = [ - for (ilPropName, ilFieldName, ilPropType, _) in fieldNamesAndTypes do - yield! emitPerField ilPropName ilFieldName ilPropType + for (_, ilFieldName, ilPropType, _) in fieldNamesAndTypes do + yield! emitPerField ilFieldName ilPropType ] let isILValueType (ty: ILType) = ty.IsNominal && ty.Boxity = ILBoxity.AsValue let ilInstrsToRestoreFields = - emitSerializationFieldIL (fun _ilPropName ilFieldName ilPropType -> + emitSerializationFieldIL (fun ilFieldName ilPropType -> [ mkLdarg0 mkLdarg 1us @@ -12246,6 +12246,11 @@ and GenExnDef cenv mgbuf eenv m (exnc: Tycon) : ILTypeRef option = mkNormalStfld (mkILFieldSpecInTy (ilThisTy, ilFieldName, ilPropType)) ]) + // FSharp.Core is SecurityTransparent and cannot override SecurityCritical + // Exception.GetObjectData, so field restoration would be unbalanced — skip it. + let shouldRestoreFields = + not g.compilingFSharpCore && not fieldNamesAndTypes.IsEmpty + let ilInstrsForSerialization = [ mkLdarg0 @@ -12253,10 +12258,10 @@ and GenExnDef cenv mgbuf eenv m (exnc: Tycon) : ILTypeRef option = mkLdarg 2us mkNormalCall (mkILCtorMethSpecForTy (g.iltyp_Exception, [ serializationInfoType; streamingContextType ])) ] - @ (if fieldNamesAndTypes.IsEmpty then - [] + @ (if shouldRestoreFields then + ilInstrsToRestoreFields else - ilInstrsToRestoreFields) + []) |> nonBranchingInstrsToCode let ilCtorDefForSerialization = @@ -12270,7 +12275,7 @@ and GenExnDef cenv mgbuf eenv m (exnc: Tycon) : ILTypeRef option = ) let ilInstrsToSaveFields = - emitSerializationFieldIL (fun _ilPropName ilFieldName ilPropType -> + emitSerializationFieldIL (fun ilFieldName ilPropType -> [ mkLdarg 1us I_ldstr ilFieldName @@ -12332,28 +12337,7 @@ and GenExnDef cenv mgbuf eenv m (exnc: Tycon) : ILTypeRef option = // the field-restoring deserialization constructor would crash (fields not in // SerializationInfo). So for FSharp.Core: emit only the base-call ctor (status quo). // For user exceptions: emit both GetObjectData and the field-restoring ctor. - if g.compilingFSharpCore then - let ilBaseOnlyCtorInstrs = - [ - mkLdarg0 - mkLdarg 1us - mkLdarg 2us - mkNormalCall (mkILCtorMethSpecForTy (g.iltyp_Exception, [ serializationInfoType; streamingContextType ])) - ] - |> nonBranchingInstrsToCode - - let ilBaseOnlyCtor = - mkILCtor ( - ILMemberAccess.Family, - [ - mkILParamNamed ("info", serializationInfoType) - mkILParamNamed ("context", streamingContextType) - ], - mkMethodBody (false, [], 8, ilBaseOnlyCtorInstrs, None, eenv.imports) - ) - - [ ilBaseOnlyCtor ] - elif fieldNamesAndTypes.IsEmpty then + if g.compilingFSharpCore || fieldNamesAndTypes.IsEmpty then [ ilCtorDefForSerialization ] else [ ilCtorDefForSerialization; ilGetObjectDataDef ] From a95e61c1a5d19a305b5de4d273ef2b03bed47a37 Mon Sep 17 00:00:00 2001 From: Tomas Grosup Date: Fri, 27 Mar 2026 03:39:47 +0100 Subject: [PATCH 13/16] Fix Fantomas formatting in GenExnDef serialization ctor Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- src/Compiler/CodeGen/IlxGen.fs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/Compiler/CodeGen/IlxGen.fs b/src/Compiler/CodeGen/IlxGen.fs index 5f865324c26..f3d374fdb2f 100644 --- a/src/Compiler/CodeGen/IlxGen.fs +++ b/src/Compiler/CodeGen/IlxGen.fs @@ -12258,10 +12258,7 @@ and GenExnDef cenv mgbuf eenv m (exnc: Tycon) : ILTypeRef option = mkLdarg 2us mkNormalCall (mkILCtorMethSpecForTy (g.iltyp_Exception, [ serializationInfoType; streamingContextType ])) ] - @ (if shouldRestoreFields then - ilInstrsToRestoreFields - else - []) + @ (if shouldRestoreFields then ilInstrsToRestoreFields else []) |> nonBranchingInstrsToCode let ilCtorDefForSerialization = From 163b7b6e2421309803c0d786352a8b979e2fd381 Mon Sep 17 00:00:00 2001 From: Tomas Grosup Date: Fri, 27 Mar 2026 08:20:11 +0100 Subject: [PATCH 14/16] Remove duplicate getActualIL helper, inline AddValue check into verifyIL list Replace the duplicated getActualIL helper and Assert.Contains call with a proper IL fragment in the verifyIL list, verifying the AddValue callvirt instruction is emitted in the GetObjectData method. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../CodeGenRegressions_Exceptions.fs | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/CodeGenRegressions/CodeGenRegressions_Exceptions.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/CodeGenRegressions/CodeGenRegressions_Exceptions.fs index c1199e03583..7b0a03d28f6 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/CodeGenRegressions/CodeGenRegressions_Exceptions.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/CodeGenRegressions/CodeGenRegressions_Exceptions.fs @@ -5,20 +5,9 @@ namespace EmittedIL open Xunit open FSharp.Test open FSharp.Test.Compiler -open FSharp.Test.Utilities module CodeGenRegressions_Exceptions = - let private getActualIL (result: CompilationResult) = - match result with - | CompilationResult.Success s -> - match s.OutputPath with - | Some p -> - let (_, _, actualIL) = ILChecker.verifyILAndReturnActual [] p [ "// dummy" ] - actualIL - | None -> failwith "No output path" - | _ -> failwith "Compilation failed" - // https://github.com/dotnet/fsharp/issues/878 [] let ``Issue_878_ExceptionSerialization`` () = @@ -39,12 +28,11 @@ exception Foo of x:string * y:int ".custom instance void [runtime]System.Security.SecurityCriticalAttribute::.ctor() = ( 01 00 00 00 )" "call instance void [runtime]System.Exception::GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo," ".method family specialname rtspecialname instance void .ctor(class [runtime]System.Runtime.Serialization.SerializationInfo info, valuetype [runtime]System.Runtime.Serialization.StreamingContext context) cil managed" + """callvirt instance void [runtime]System.Runtime.Serialization.SerializationInfo::AddValue(string, + object)""" ] |> ignore - let actualIL = getActualIL result - Assert.Contains("AddValue", actualIL) - // https://github.com/dotnet/fsharp/issues/878 [] From bb46647c6b6e0d40f35354baa04649bff21c0034 Mon Sep 17 00:00:00 2001 From: Tomas Grosup Date: Tue, 14 Apr 2026 10:43:18 +0200 Subject: [PATCH 15/16] Address review: add CompilerGenerated/DebuggerNonUserCode attrs, revert unrelated AsyncMemoize fix - Add [CompilerGenerated] and [DebuggerNonUserCode] attributes to the generated serialization constructor and GetObjectData override on exception types, matching the pattern used by other compiler-generated methods in IlxGen. - Update verifyIL test to check for the new attributes. - Update all EmittedIL baselines (Nullness, SerializableAttribute) for both netcore and net472, debug and release configurations. - Revert unrelated AsyncMemoize flaky test fix (not part of this PR scope). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- src/Compiler/CodeGen/IlxGen.fs | 2 ++ .../CompilerService/AsyncMemoize.fs | 6 ++++-- .../CodeGenRegressions_Exceptions.fs | 2 ++ .../Nullness/ExceptionType.fs.il.net472.bsl | 16 ++++++++++++++++ .../Nullness/ExceptionType.fs.il.netcore.bsl | 16 ++++++++++++++++ ....RealInternalSignatureOff.il.net472.debug.bsl | 4 ++++ ...ealInternalSignatureOff.il.net472.release.bsl | 8 ++++++++ ...RealInternalSignatureOff.il.netcore.debug.bsl | 4 ++++ ...alInternalSignatureOff.il.netcore.release.bsl | 8 ++++++++ ...s.RealInternalSignatureOn.il.net472.debug.bsl | 4 ++++ ...RealInternalSignatureOn.il.net472.release.bsl | 8 ++++++++ ....RealInternalSignatureOn.il.netcore.debug.bsl | 4 ++++ ...ealInternalSignatureOn.il.netcore.release.bsl | 8 ++++++++ ....RealInternalSignatureOff.il.net472.debug.bsl | 6 ++++++ ...ealInternalSignatureOff.il.net472.release.bsl | 12 ++++++++++++ ...RealInternalSignatureOff.il.netcore.debug.bsl | 6 ++++++ ...alInternalSignatureOff.il.netcore.release.bsl | 12 ++++++++++++ ...s.RealInternalSignatureOn.il.net472.debug.bsl | 6 ++++++ ...RealInternalSignatureOn.il.net472.release.bsl | 12 ++++++++++++ ....RealInternalSignatureOn.il.netcore.debug.bsl | 6 ++++++ ...ealInternalSignatureOn.il.netcore.release.bsl | 12 ++++++++++++ 21 files changed, 160 insertions(+), 2 deletions(-) diff --git a/src/Compiler/CodeGen/IlxGen.fs b/src/Compiler/CodeGen/IlxGen.fs index f3d374fdb2f..499e360e85e 100644 --- a/src/Compiler/CodeGen/IlxGen.fs +++ b/src/Compiler/CodeGen/IlxGen.fs @@ -12270,6 +12270,7 @@ and GenExnDef cenv mgbuf eenv m (exnc: Tycon) : ILTypeRef option = ], mkMethodBody (false, [], 8, ilInstrsForSerialization, None, eenv.imports) ) + |> AddNonUserCompilerGeneratedAttribs g let ilInstrsToSaveFields = emitSerializationFieldIL (fun ilFieldName ilPropType -> @@ -12327,6 +12328,7 @@ and GenExnDef cenv mgbuf eenv m (exnc: Tycon) : ILTypeRef option = mkILCustomAttribute (g.attrib_SecurityCriticalAttribute.TypeRef, [], [], []) mdef.With(customAttrs = mkILCustomAttrs [ securityCriticalAttr ]) + |> AddNonUserCompilerGeneratedAttribs g // FSharp.Core has [assembly: SecurityTransparent], making all code transparent. // On .NET Framework, transparent code cannot override SecurityCritical virtual diff --git a/tests/FSharp.Compiler.ComponentTests/CompilerService/AsyncMemoize.fs b/tests/FSharp.Compiler.ComponentTests/CompilerService/AsyncMemoize.fs index e6f63ce5280..3b50cd9fe25 100644 --- a/tests/FSharp.Compiler.ComponentTests/CompilerService/AsyncMemoize.fs +++ b/tests/FSharp.Compiler.ComponentTests/CompilerService/AsyncMemoize.fs @@ -439,11 +439,13 @@ let ``Cancel running jobs with the same key`` () = job.Wait() - // Wait for all 10 outdated jobs to be canceled and the new one to finish. - let events = eventsWhen events (fun e -> countOf Canceled e = 10 && countOf Finished e = 1) + let events = eventsWhen events (received Finished) Assert.Equal(0, events |> countOf Failed) + + // All outdated jobs should have been canceled by now. Assert.Equal(10, events |> countOf Canceled) + Assert.Equal(1, events |> countOf Finished) type DummyException(msg) = diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/CodeGenRegressions/CodeGenRegressions_Exceptions.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/CodeGenRegressions/CodeGenRegressions_Exceptions.fs index 7b0a03d28f6..6370526e9b7 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/CodeGenRegressions/CodeGenRegressions_Exceptions.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/CodeGenRegressions/CodeGenRegressions_Exceptions.fs @@ -26,6 +26,8 @@ exception Foo of x:string * y:int |> verifyIL [ ".method public strict virtual instance void GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo info, valuetype [runtime]System.Runtime.Serialization.StreamingContext context) cil managed" ".custom instance void [runtime]System.Security.SecurityCriticalAttribute::.ctor() = ( 01 00 00 00 )" + ".custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 )" + ".custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 )" "call instance void [runtime]System.Exception::GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo," ".method family specialname rtspecialname instance void .ctor(class [runtime]System.Runtime.Serialization.SerializationInfo info, valuetype [runtime]System.Runtime.Serialization.StreamingContext context) cil managed" """callvirt instance void [runtime]System.Runtime.Serialization.SerializationInfo::AddValue(string, diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/ExceptionType.fs.il.net472.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/ExceptionType.fs.il.net472.bsl index 411632c6816..37a4301ab0d 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/ExceptionType.fs.il.net472.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/ExceptionType.fs.il.net472.bsl @@ -55,6 +55,8 @@ .method family specialname rtspecialname instance void .ctor(class [runtime]System.Runtime.Serialization.SerializationInfo info, valuetype [runtime]System.Runtime.Serialization.StreamingContext context) cil managed { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) .maxstack 8 IL_0000: ldarg.0 @@ -77,6 +79,8 @@ .method public strict virtual instance void GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo info, valuetype [runtime]System.Runtime.Serialization.StreamingContext context) cil managed { .custom instance void [runtime]System.Security.SecurityCriticalAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) .maxstack 8 IL_0000: ldarg.0 @@ -158,6 +162,8 @@ .method family specialname rtspecialname instance void .ctor(class [runtime]System.Runtime.Serialization.SerializationInfo info, valuetype [runtime]System.Runtime.Serialization.StreamingContext context) cil managed { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) .maxstack 8 IL_0000: ldarg.0 @@ -189,6 +195,8 @@ .method public strict virtual instance void GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo info, valuetype [runtime]System.Runtime.Serialization.StreamingContext context) cil managed { .custom instance void [runtime]System.Security.SecurityCriticalAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) .maxstack 8 IL_0000: ldarg.0 @@ -290,6 +298,8 @@ .method family specialname rtspecialname instance void .ctor(class [runtime]System.Runtime.Serialization.SerializationInfo info, valuetype [runtime]System.Runtime.Serialization.StreamingContext context) cil managed { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) .maxstack 8 IL_0000: ldarg.0 @@ -312,6 +322,8 @@ .method public strict virtual instance void GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo info, valuetype [runtime]System.Runtime.Serialization.StreamingContext context) cil managed { .custom instance void [runtime]System.Security.SecurityCriticalAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) .maxstack 8 IL_0000: ldarg.0 @@ -392,6 +404,8 @@ .method family specialname rtspecialname instance void .ctor(class [runtime]System.Runtime.Serialization.SerializationInfo info, valuetype [runtime]System.Runtime.Serialization.StreamingContext context) cil managed { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) .maxstack 8 IL_0000: ldarg.0 @@ -414,6 +428,8 @@ .method public strict virtual instance void GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo info, valuetype [runtime]System.Runtime.Serialization.StreamingContext context) cil managed { .custom instance void [runtime]System.Security.SecurityCriticalAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) .maxstack 8 IL_0000: ldarg.0 diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/ExceptionType.fs.il.netcore.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/ExceptionType.fs.il.netcore.bsl index 476d96e1a4a..d2c58c493bd 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/ExceptionType.fs.il.netcore.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/ExceptionType.fs.il.netcore.bsl @@ -55,6 +55,8 @@ .method family specialname rtspecialname instance void .ctor(class [runtime]System.Runtime.Serialization.SerializationInfo info, valuetype [runtime]System.Runtime.Serialization.StreamingContext context) cil managed { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) .maxstack 8 IL_0000: ldarg.0 @@ -77,6 +79,8 @@ .method public strict virtual instance void GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo info, valuetype [runtime]System.Runtime.Serialization.StreamingContext context) cil managed { .custom instance void [runtime]System.Security.SecurityCriticalAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) .maxstack 8 IL_0000: ldarg.0 @@ -158,6 +162,8 @@ .method family specialname rtspecialname instance void .ctor(class [runtime]System.Runtime.Serialization.SerializationInfo info, valuetype [runtime]System.Runtime.Serialization.StreamingContext context) cil managed { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) .maxstack 8 IL_0000: ldarg.0 @@ -189,6 +195,8 @@ .method public strict virtual instance void GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo info, valuetype [runtime]System.Runtime.Serialization.StreamingContext context) cil managed { .custom instance void [runtime]System.Security.SecurityCriticalAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) .maxstack 8 IL_0000: ldarg.0 @@ -290,6 +298,8 @@ .method family specialname rtspecialname instance void .ctor(class [runtime]System.Runtime.Serialization.SerializationInfo info, valuetype [runtime]System.Runtime.Serialization.StreamingContext context) cil managed { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) .maxstack 8 IL_0000: ldarg.0 @@ -312,6 +322,8 @@ .method public strict virtual instance void GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo info, valuetype [runtime]System.Runtime.Serialization.StreamingContext context) cil managed { .custom instance void [runtime]System.Security.SecurityCriticalAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) .maxstack 8 IL_0000: ldarg.0 @@ -392,6 +404,8 @@ .method family specialname rtspecialname instance void .ctor(class [runtime]System.Runtime.Serialization.SerializationInfo info, valuetype [runtime]System.Runtime.Serialization.StreamingContext context) cil managed { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) .maxstack 8 IL_0000: ldarg.0 @@ -414,6 +428,8 @@ .method public strict virtual instance void GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo info, valuetype [runtime]System.Runtime.Serialization.StreamingContext context) cil managed { .custom instance void [runtime]System.Security.SecurityCriticalAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) .maxstack 8 IL_0000: ldarg.0 diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule.fs.RealInternalSignatureOff.il.net472.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule.fs.RealInternalSignatureOff.il.net472.debug.bsl index 05a71cd6c89..55a69fad282 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule.fs.RealInternalSignatureOff.il.net472.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule.fs.RealInternalSignatureOff.il.net472.debug.bsl @@ -506,6 +506,8 @@ .method family specialname rtspecialname instance void .ctor(class [runtime]System.Runtime.Serialization.SerializationInfo info, valuetype [runtime]System.Runtime.Serialization.StreamingContext context) cil managed { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) .maxstack 8 IL_0000: ldarg.0 @@ -1254,6 +1256,8 @@ .method family specialname rtspecialname instance void .ctor(class [runtime]System.Runtime.Serialization.SerializationInfo info, valuetype [runtime]System.Runtime.Serialization.StreamingContext context) cil managed { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) .maxstack 8 IL_0000: ldarg.0 diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule.fs.RealInternalSignatureOff.il.net472.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule.fs.RealInternalSignatureOff.il.net472.release.bsl index 2ff565e9d85..c2e13b6eac0 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule.fs.RealInternalSignatureOff.il.net472.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule.fs.RealInternalSignatureOff.il.net472.release.bsl @@ -473,6 +473,8 @@ .method family specialname rtspecialname instance void .ctor(class [runtime]System.Runtime.Serialization.SerializationInfo info, valuetype [runtime]System.Runtime.Serialization.StreamingContext context) cil managed { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) .maxstack 8 IL_0000: ldarg.0 @@ -495,6 +497,8 @@ .method public strict virtual instance void GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo info, valuetype [runtime]System.Runtime.Serialization.StreamingContext context) cil managed { .custom instance void [runtime]System.Security.SecurityCriticalAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) .maxstack 8 IL_0000: ldarg.0 @@ -1202,6 +1206,8 @@ .method family specialname rtspecialname instance void .ctor(class [runtime]System.Runtime.Serialization.SerializationInfo info, valuetype [runtime]System.Runtime.Serialization.StreamingContext context) cil managed { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) .maxstack 8 IL_0000: ldarg.0 @@ -1224,6 +1230,8 @@ .method public strict virtual instance void GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo info, valuetype [runtime]System.Runtime.Serialization.StreamingContext context) cil managed { .custom instance void [runtime]System.Security.SecurityCriticalAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) .maxstack 8 IL_0000: ldarg.0 diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule.fs.RealInternalSignatureOff.il.netcore.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule.fs.RealInternalSignatureOff.il.netcore.debug.bsl index 9c163b8ec4e..b7561691f06 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule.fs.RealInternalSignatureOff.il.netcore.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule.fs.RealInternalSignatureOff.il.netcore.debug.bsl @@ -473,6 +473,8 @@ .method family specialname rtspecialname instance void .ctor(class [runtime]System.Runtime.Serialization.SerializationInfo info, valuetype [runtime]System.Runtime.Serialization.StreamingContext context) cil managed { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) .maxstack 8 IL_0000: ldarg.0 @@ -1173,6 +1175,8 @@ .method family specialname rtspecialname instance void .ctor(class [runtime]System.Runtime.Serialization.SerializationInfo info, valuetype [runtime]System.Runtime.Serialization.StreamingContext context) cil managed { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) .maxstack 8 IL_0000: ldarg.0 diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule.fs.RealInternalSignatureOff.il.netcore.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule.fs.RealInternalSignatureOff.il.netcore.release.bsl index 9204d5bbad9..a7990202e4b 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule.fs.RealInternalSignatureOff.il.netcore.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule.fs.RealInternalSignatureOff.il.netcore.release.bsl @@ -473,6 +473,8 @@ .method family specialname rtspecialname instance void .ctor(class [runtime]System.Runtime.Serialization.SerializationInfo info, valuetype [runtime]System.Runtime.Serialization.StreamingContext context) cil managed { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) .maxstack 8 IL_0000: ldarg.0 @@ -495,6 +497,8 @@ .method public strict virtual instance void GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo info, valuetype [runtime]System.Runtime.Serialization.StreamingContext context) cil managed { .custom instance void [runtime]System.Security.SecurityCriticalAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) .maxstack 8 IL_0000: ldarg.0 @@ -1202,6 +1206,8 @@ .method family specialname rtspecialname instance void .ctor(class [runtime]System.Runtime.Serialization.SerializationInfo info, valuetype [runtime]System.Runtime.Serialization.StreamingContext context) cil managed { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) .maxstack 8 IL_0000: ldarg.0 @@ -1224,6 +1230,8 @@ .method public strict virtual instance void GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo info, valuetype [runtime]System.Runtime.Serialization.StreamingContext context) cil managed { .custom instance void [runtime]System.Security.SecurityCriticalAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) .maxstack 8 IL_0000: ldarg.0 diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule.fs.RealInternalSignatureOn.il.net472.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule.fs.RealInternalSignatureOn.il.net472.debug.bsl index 582ba287eef..d4e93acb0b5 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule.fs.RealInternalSignatureOn.il.net472.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule.fs.RealInternalSignatureOn.il.net472.debug.bsl @@ -506,6 +506,8 @@ .method family specialname rtspecialname instance void .ctor(class [runtime]System.Runtime.Serialization.SerializationInfo info, valuetype [runtime]System.Runtime.Serialization.StreamingContext context) cil managed { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) .maxstack 8 IL_0000: ldarg.0 @@ -1254,6 +1256,8 @@ .method family specialname rtspecialname instance void .ctor(class [runtime]System.Runtime.Serialization.SerializationInfo info, valuetype [runtime]System.Runtime.Serialization.StreamingContext context) cil managed { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) .maxstack 8 IL_0000: ldarg.0 diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule.fs.RealInternalSignatureOn.il.net472.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule.fs.RealInternalSignatureOn.il.net472.release.bsl index 8647b764b0a..6144e9f3271 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule.fs.RealInternalSignatureOn.il.net472.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule.fs.RealInternalSignatureOn.il.net472.release.bsl @@ -473,6 +473,8 @@ .method family specialname rtspecialname instance void .ctor(class [runtime]System.Runtime.Serialization.SerializationInfo info, valuetype [runtime]System.Runtime.Serialization.StreamingContext context) cil managed { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) .maxstack 8 IL_0000: ldarg.0 @@ -495,6 +497,8 @@ .method public strict virtual instance void GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo info, valuetype [runtime]System.Runtime.Serialization.StreamingContext context) cil managed { .custom instance void [runtime]System.Security.SecurityCriticalAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) .maxstack 8 IL_0000: ldarg.0 @@ -1202,6 +1206,8 @@ .method family specialname rtspecialname instance void .ctor(class [runtime]System.Runtime.Serialization.SerializationInfo info, valuetype [runtime]System.Runtime.Serialization.StreamingContext context) cil managed { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) .maxstack 8 IL_0000: ldarg.0 @@ -1224,6 +1230,8 @@ .method public strict virtual instance void GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo info, valuetype [runtime]System.Runtime.Serialization.StreamingContext context) cil managed { .custom instance void [runtime]System.Security.SecurityCriticalAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) .maxstack 8 IL_0000: ldarg.0 diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule.fs.RealInternalSignatureOn.il.netcore.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule.fs.RealInternalSignatureOn.il.netcore.debug.bsl index e9375f2d0f3..2ab5d5d5114 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule.fs.RealInternalSignatureOn.il.netcore.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule.fs.RealInternalSignatureOn.il.netcore.debug.bsl @@ -473,6 +473,8 @@ .method family specialname rtspecialname instance void .ctor(class [runtime]System.Runtime.Serialization.SerializationInfo info, valuetype [runtime]System.Runtime.Serialization.StreamingContext context) cil managed { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) .maxstack 8 IL_0000: ldarg.0 @@ -1173,6 +1175,8 @@ .method family specialname rtspecialname instance void .ctor(class [runtime]System.Runtime.Serialization.SerializationInfo info, valuetype [runtime]System.Runtime.Serialization.StreamingContext context) cil managed { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) .maxstack 8 IL_0000: ldarg.0 diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule.fs.RealInternalSignatureOn.il.netcore.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule.fs.RealInternalSignatureOn.il.netcore.release.bsl index 8cace78ab41..59948f6ba69 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule.fs.RealInternalSignatureOn.il.netcore.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule.fs.RealInternalSignatureOn.il.netcore.release.bsl @@ -473,6 +473,8 @@ .method family specialname rtspecialname instance void .ctor(class [runtime]System.Runtime.Serialization.SerializationInfo info, valuetype [runtime]System.Runtime.Serialization.StreamingContext context) cil managed { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) .maxstack 8 IL_0000: ldarg.0 @@ -495,6 +497,8 @@ .method public strict virtual instance void GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo info, valuetype [runtime]System.Runtime.Serialization.StreamingContext context) cil managed { .custom instance void [runtime]System.Security.SecurityCriticalAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) .maxstack 8 IL_0000: ldarg.0 @@ -1202,6 +1206,8 @@ .method family specialname rtspecialname instance void .ctor(class [runtime]System.Runtime.Serialization.SerializationInfo info, valuetype [runtime]System.Runtime.Serialization.StreamingContext context) cil managed { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) .maxstack 8 IL_0000: ldarg.0 @@ -1224,6 +1230,8 @@ .method public strict virtual instance void GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo info, valuetype [runtime]System.Runtime.Serialization.StreamingContext context) cil managed { .custom instance void [runtime]System.Security.SecurityCriticalAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) .maxstack 8 IL_0000: ldarg.0 diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace.fs.RealInternalSignatureOff.il.net472.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace.fs.RealInternalSignatureOff.il.net472.debug.bsl index 2c6bfb49ab0..bfa54cb359a 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace.fs.RealInternalSignatureOff.il.net472.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace.fs.RealInternalSignatureOff.il.net472.debug.bsl @@ -502,6 +502,8 @@ .method family specialname rtspecialname instance void .ctor(class [runtime]System.Runtime.Serialization.SerializationInfo info, valuetype [runtime]System.Runtime.Serialization.StreamingContext context) cil managed { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) .maxstack 8 IL_0000: ldarg.0 @@ -1250,6 +1252,8 @@ .method family specialname rtspecialname instance void .ctor(class [runtime]System.Runtime.Serialization.SerializationInfo info, valuetype [runtime]System.Runtime.Serialization.StreamingContext context) cil managed { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) .maxstack 8 IL_0000: ldarg.0 @@ -1998,6 +2002,8 @@ .method family specialname rtspecialname instance void .ctor(class [runtime]System.Runtime.Serialization.SerializationInfo info, valuetype [runtime]System.Runtime.Serialization.StreamingContext context) cil managed { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) .maxstack 8 IL_0000: ldarg.0 diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace.fs.RealInternalSignatureOff.il.net472.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace.fs.RealInternalSignatureOff.il.net472.release.bsl index 1889ccc93b1..dc13fbaaa41 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace.fs.RealInternalSignatureOff.il.net472.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace.fs.RealInternalSignatureOff.il.net472.release.bsl @@ -469,6 +469,8 @@ .method family specialname rtspecialname instance void .ctor(class [runtime]System.Runtime.Serialization.SerializationInfo info, valuetype [runtime]System.Runtime.Serialization.StreamingContext context) cil managed { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) .maxstack 8 IL_0000: ldarg.0 @@ -491,6 +493,8 @@ .method public strict virtual instance void GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo info, valuetype [runtime]System.Runtime.Serialization.StreamingContext context) cil managed { .custom instance void [runtime]System.Security.SecurityCriticalAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) .maxstack 8 IL_0000: ldarg.0 @@ -1198,6 +1202,8 @@ .method family specialname rtspecialname instance void .ctor(class [runtime]System.Runtime.Serialization.SerializationInfo info, valuetype [runtime]System.Runtime.Serialization.StreamingContext context) cil managed { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) .maxstack 8 IL_0000: ldarg.0 @@ -1220,6 +1226,8 @@ .method public strict virtual instance void GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo info, valuetype [runtime]System.Runtime.Serialization.StreamingContext context) cil managed { .custom instance void [runtime]System.Security.SecurityCriticalAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) .maxstack 8 IL_0000: ldarg.0 @@ -1927,6 +1935,8 @@ .method family specialname rtspecialname instance void .ctor(class [runtime]System.Runtime.Serialization.SerializationInfo info, valuetype [runtime]System.Runtime.Serialization.StreamingContext context) cil managed { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) .maxstack 8 IL_0000: ldarg.0 @@ -1949,6 +1959,8 @@ .method public strict virtual instance void GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo info, valuetype [runtime]System.Runtime.Serialization.StreamingContext context) cil managed { .custom instance void [runtime]System.Security.SecurityCriticalAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) .maxstack 8 IL_0000: ldarg.0 diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace.fs.RealInternalSignatureOff.il.netcore.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace.fs.RealInternalSignatureOff.il.netcore.debug.bsl index 36d2089b286..2670d0577dc 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace.fs.RealInternalSignatureOff.il.netcore.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace.fs.RealInternalSignatureOff.il.netcore.debug.bsl @@ -469,6 +469,8 @@ .method family specialname rtspecialname instance void .ctor(class [runtime]System.Runtime.Serialization.SerializationInfo info, valuetype [runtime]System.Runtime.Serialization.StreamingContext context) cil managed { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) .maxstack 8 IL_0000: ldarg.0 @@ -1169,6 +1171,8 @@ .method family specialname rtspecialname instance void .ctor(class [runtime]System.Runtime.Serialization.SerializationInfo info, valuetype [runtime]System.Runtime.Serialization.StreamingContext context) cil managed { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) .maxstack 8 IL_0000: ldarg.0 @@ -1869,6 +1873,8 @@ .method family specialname rtspecialname instance void .ctor(class [runtime]System.Runtime.Serialization.SerializationInfo info, valuetype [runtime]System.Runtime.Serialization.StreamingContext context) cil managed { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) .maxstack 8 IL_0000: ldarg.0 diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace.fs.RealInternalSignatureOff.il.netcore.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace.fs.RealInternalSignatureOff.il.netcore.release.bsl index f239f4b5f40..7d2ba7bb626 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace.fs.RealInternalSignatureOff.il.netcore.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace.fs.RealInternalSignatureOff.il.netcore.release.bsl @@ -469,6 +469,8 @@ .method family specialname rtspecialname instance void .ctor(class [runtime]System.Runtime.Serialization.SerializationInfo info, valuetype [runtime]System.Runtime.Serialization.StreamingContext context) cil managed { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) .maxstack 8 IL_0000: ldarg.0 @@ -491,6 +493,8 @@ .method public strict virtual instance void GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo info, valuetype [runtime]System.Runtime.Serialization.StreamingContext context) cil managed { .custom instance void [runtime]System.Security.SecurityCriticalAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) .maxstack 8 IL_0000: ldarg.0 @@ -1198,6 +1202,8 @@ .method family specialname rtspecialname instance void .ctor(class [runtime]System.Runtime.Serialization.SerializationInfo info, valuetype [runtime]System.Runtime.Serialization.StreamingContext context) cil managed { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) .maxstack 8 IL_0000: ldarg.0 @@ -1220,6 +1226,8 @@ .method public strict virtual instance void GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo info, valuetype [runtime]System.Runtime.Serialization.StreamingContext context) cil managed { .custom instance void [runtime]System.Security.SecurityCriticalAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) .maxstack 8 IL_0000: ldarg.0 @@ -1927,6 +1935,8 @@ .method family specialname rtspecialname instance void .ctor(class [runtime]System.Runtime.Serialization.SerializationInfo info, valuetype [runtime]System.Runtime.Serialization.StreamingContext context) cil managed { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) .maxstack 8 IL_0000: ldarg.0 @@ -1949,6 +1959,8 @@ .method public strict virtual instance void GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo info, valuetype [runtime]System.Runtime.Serialization.StreamingContext context) cil managed { .custom instance void [runtime]System.Security.SecurityCriticalAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) .maxstack 8 IL_0000: ldarg.0 diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace.fs.RealInternalSignatureOn.il.net472.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace.fs.RealInternalSignatureOn.il.net472.debug.bsl index ad580eaae2c..20c8831e557 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace.fs.RealInternalSignatureOn.il.net472.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace.fs.RealInternalSignatureOn.il.net472.debug.bsl @@ -502,6 +502,8 @@ .method family specialname rtspecialname instance void .ctor(class [runtime]System.Runtime.Serialization.SerializationInfo info, valuetype [runtime]System.Runtime.Serialization.StreamingContext context) cil managed { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) .maxstack 8 IL_0000: ldarg.0 @@ -1250,6 +1252,8 @@ .method family specialname rtspecialname instance void .ctor(class [runtime]System.Runtime.Serialization.SerializationInfo info, valuetype [runtime]System.Runtime.Serialization.StreamingContext context) cil managed { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) .maxstack 8 IL_0000: ldarg.0 @@ -1998,6 +2002,8 @@ .method family specialname rtspecialname instance void .ctor(class [runtime]System.Runtime.Serialization.SerializationInfo info, valuetype [runtime]System.Runtime.Serialization.StreamingContext context) cil managed { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) .maxstack 8 IL_0000: ldarg.0 diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace.fs.RealInternalSignatureOn.il.net472.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace.fs.RealInternalSignatureOn.il.net472.release.bsl index dc900862d41..58700ab4d6f 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace.fs.RealInternalSignatureOn.il.net472.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace.fs.RealInternalSignatureOn.il.net472.release.bsl @@ -469,6 +469,8 @@ .method family specialname rtspecialname instance void .ctor(class [runtime]System.Runtime.Serialization.SerializationInfo info, valuetype [runtime]System.Runtime.Serialization.StreamingContext context) cil managed { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) .maxstack 8 IL_0000: ldarg.0 @@ -491,6 +493,8 @@ .method public strict virtual instance void GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo info, valuetype [runtime]System.Runtime.Serialization.StreamingContext context) cil managed { .custom instance void [runtime]System.Security.SecurityCriticalAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) .maxstack 8 IL_0000: ldarg.0 @@ -1198,6 +1202,8 @@ .method family specialname rtspecialname instance void .ctor(class [runtime]System.Runtime.Serialization.SerializationInfo info, valuetype [runtime]System.Runtime.Serialization.StreamingContext context) cil managed { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) .maxstack 8 IL_0000: ldarg.0 @@ -1220,6 +1226,8 @@ .method public strict virtual instance void GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo info, valuetype [runtime]System.Runtime.Serialization.StreamingContext context) cil managed { .custom instance void [runtime]System.Security.SecurityCriticalAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) .maxstack 8 IL_0000: ldarg.0 @@ -1927,6 +1935,8 @@ .method family specialname rtspecialname instance void .ctor(class [runtime]System.Runtime.Serialization.SerializationInfo info, valuetype [runtime]System.Runtime.Serialization.StreamingContext context) cil managed { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) .maxstack 8 IL_0000: ldarg.0 @@ -1949,6 +1959,8 @@ .method public strict virtual instance void GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo info, valuetype [runtime]System.Runtime.Serialization.StreamingContext context) cil managed { .custom instance void [runtime]System.Security.SecurityCriticalAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) .maxstack 8 IL_0000: ldarg.0 diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace.fs.RealInternalSignatureOn.il.netcore.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace.fs.RealInternalSignatureOn.il.netcore.debug.bsl index d166fc2f2ff..768c75fd03b 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace.fs.RealInternalSignatureOn.il.netcore.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace.fs.RealInternalSignatureOn.il.netcore.debug.bsl @@ -469,6 +469,8 @@ .method family specialname rtspecialname instance void .ctor(class [runtime]System.Runtime.Serialization.SerializationInfo info, valuetype [runtime]System.Runtime.Serialization.StreamingContext context) cil managed { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) .maxstack 8 IL_0000: ldarg.0 @@ -1169,6 +1171,8 @@ .method family specialname rtspecialname instance void .ctor(class [runtime]System.Runtime.Serialization.SerializationInfo info, valuetype [runtime]System.Runtime.Serialization.StreamingContext context) cil managed { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) .maxstack 8 IL_0000: ldarg.0 @@ -1869,6 +1873,8 @@ .method family specialname rtspecialname instance void .ctor(class [runtime]System.Runtime.Serialization.SerializationInfo info, valuetype [runtime]System.Runtime.Serialization.StreamingContext context) cil managed { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) .maxstack 8 IL_0000: ldarg.0 diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace.fs.RealInternalSignatureOn.il.netcore.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace.fs.RealInternalSignatureOn.il.netcore.release.bsl index 65e239faaad..45b365342d0 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace.fs.RealInternalSignatureOn.il.netcore.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace.fs.RealInternalSignatureOn.il.netcore.release.bsl @@ -469,6 +469,8 @@ .method family specialname rtspecialname instance void .ctor(class [runtime]System.Runtime.Serialization.SerializationInfo info, valuetype [runtime]System.Runtime.Serialization.StreamingContext context) cil managed { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) .maxstack 8 IL_0000: ldarg.0 @@ -491,6 +493,8 @@ .method public strict virtual instance void GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo info, valuetype [runtime]System.Runtime.Serialization.StreamingContext context) cil managed { .custom instance void [runtime]System.Security.SecurityCriticalAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) .maxstack 8 IL_0000: ldarg.0 @@ -1198,6 +1202,8 @@ .method family specialname rtspecialname instance void .ctor(class [runtime]System.Runtime.Serialization.SerializationInfo info, valuetype [runtime]System.Runtime.Serialization.StreamingContext context) cil managed { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) .maxstack 8 IL_0000: ldarg.0 @@ -1220,6 +1226,8 @@ .method public strict virtual instance void GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo info, valuetype [runtime]System.Runtime.Serialization.StreamingContext context) cil managed { .custom instance void [runtime]System.Security.SecurityCriticalAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) .maxstack 8 IL_0000: ldarg.0 @@ -1927,6 +1935,8 @@ .method family specialname rtspecialname instance void .ctor(class [runtime]System.Runtime.Serialization.SerializationInfo info, valuetype [runtime]System.Runtime.Serialization.StreamingContext context) cil managed { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) .maxstack 8 IL_0000: ldarg.0 @@ -1949,6 +1959,8 @@ .method public strict virtual instance void GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo info, valuetype [runtime]System.Runtime.Serialization.StreamingContext context) cil managed { .custom instance void [runtime]System.Security.SecurityCriticalAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) .maxstack 8 IL_0000: ldarg.0 From dc48c820fdd9ffc0b7abe8d028cc6b4ba1293f24 Mon Sep 17 00:00:00 2001 From: Tomas Grosup Date: Thu, 14 May 2026 12:13:19 +0200 Subject: [PATCH 16/16] Regenerate unified netcore baselines with serialization methods After merging main (which eliminated debug/release baseline duality in PR #19611), regenerate the unified .netcore.bsl baselines to include the GetObjectData overrides and field-restoring deserialization constructors from this PR. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- ...fs.RealInternalSignatureOff.il.netcore.bsl | 66 ++++++++++++- ....fs.RealInternalSignatureOn.il.netcore.bsl | 66 ++++++++++++- ...fs.RealInternalSignatureOff.il.netcore.bsl | 99 ++++++++++++++++++- ....fs.RealInternalSignatureOn.il.netcore.bsl | 99 ++++++++++++++++++- 4 files changed, 320 insertions(+), 10 deletions(-) diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule.fs.RealInternalSignatureOff.il.netcore.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule.fs.RealInternalSignatureOff.il.netcore.bsl index b7561691f06..8fd29f928dd 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule.fs.RealInternalSignatureOff.il.netcore.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule.fs.RealInternalSignatureOff.il.netcore.bsl @@ -482,7 +482,38 @@ IL_0002: ldarg.2 IL_0003: call instance void [runtime]System.Exception::.ctor(class [runtime]System.Runtime.Serialization.SerializationInfo, valuetype [runtime]System.Runtime.Serialization.StreamingContext) - IL_0008: ret + IL_0008: ldarg.0 + IL_0009: ldarg.1 + IL_000a: ldstr "Data0@" + IL_000f: ldtoken [runtime]System.Int32 + IL_0014: call class [runtime]System.Type [runtime]System.Type::GetTypeFromHandle(valuetype [runtime]System.RuntimeTypeHandle) + IL_0019: callvirt instance object [runtime]System.Runtime.Serialization.SerializationInfo::GetValue(string, + class [runtime]System.Type) + IL_001e: unbox.any [runtime]System.Int32 + IL_0023: stfld int32 ABC/MyExn::Data0@ + IL_0028: ret + } + + .method public strict virtual instance void GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo info, valuetype [runtime]System.Runtime.Serialization.StreamingContext context) cil managed + { + .custom instance void [runtime]System.Security.SecurityCriticalAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldarg.1 + IL_0002: ldarg.2 + IL_0003: call instance void [runtime]System.Exception::GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo, + valuetype [runtime]System.Runtime.Serialization.StreamingContext) + IL_0008: ldarg.1 + IL_0009: ldstr "Data0@" + IL_000e: ldarg.0 + IL_000f: ldfld int32 ABC/MyExn::Data0@ + IL_0014: box [runtime]System.Int32 + IL_0019: callvirt instance void [runtime]System.Runtime.Serialization.SerializationInfo::AddValue(string, + object) + IL_001e: ret } .method public hidebysig specialname instance int32 get_Data0() cil managed @@ -1184,7 +1215,38 @@ IL_0002: ldarg.2 IL_0003: call instance void [runtime]System.Exception::.ctor(class [runtime]System.Runtime.Serialization.SerializationInfo, valuetype [runtime]System.Runtime.Serialization.StreamingContext) - IL_0008: ret + IL_0008: ldarg.0 + IL_0009: ldarg.1 + IL_000a: ldstr "Data0@" + IL_000f: ldtoken [runtime]System.Int32 + IL_0014: call class [runtime]System.Type [runtime]System.Type::GetTypeFromHandle(valuetype [runtime]System.RuntimeTypeHandle) + IL_0019: callvirt instance object [runtime]System.Runtime.Serialization.SerializationInfo::GetValue(string, + class [runtime]System.Type) + IL_001e: unbox.any [runtime]System.Int32 + IL_0023: stfld int32 ABC/ABC/MyExn::Data0@ + IL_0028: ret + } + + .method public strict virtual instance void GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo info, valuetype [runtime]System.Runtime.Serialization.StreamingContext context) cil managed + { + .custom instance void [runtime]System.Security.SecurityCriticalAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldarg.1 + IL_0002: ldarg.2 + IL_0003: call instance void [runtime]System.Exception::GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo, + valuetype [runtime]System.Runtime.Serialization.StreamingContext) + IL_0008: ldarg.1 + IL_0009: ldstr "Data0@" + IL_000e: ldarg.0 + IL_000f: ldfld int32 ABC/ABC/MyExn::Data0@ + IL_0014: box [runtime]System.Int32 + IL_0019: callvirt instance void [runtime]System.Runtime.Serialization.SerializationInfo::AddValue(string, + object) + IL_001e: ret } .method public hidebysig specialname instance int32 get_Data0() cil managed diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule.fs.RealInternalSignatureOn.il.netcore.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule.fs.RealInternalSignatureOn.il.netcore.bsl index 2ab5d5d5114..81bdaf3c1d4 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule.fs.RealInternalSignatureOn.il.netcore.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule.fs.RealInternalSignatureOn.il.netcore.bsl @@ -482,7 +482,38 @@ IL_0002: ldarg.2 IL_0003: call instance void [runtime]System.Exception::.ctor(class [runtime]System.Runtime.Serialization.SerializationInfo, valuetype [runtime]System.Runtime.Serialization.StreamingContext) - IL_0008: ret + IL_0008: ldarg.0 + IL_0009: ldarg.1 + IL_000a: ldstr "Data0@" + IL_000f: ldtoken [runtime]System.Int32 + IL_0014: call class [runtime]System.Type [runtime]System.Type::GetTypeFromHandle(valuetype [runtime]System.RuntimeTypeHandle) + IL_0019: callvirt instance object [runtime]System.Runtime.Serialization.SerializationInfo::GetValue(string, + class [runtime]System.Type) + IL_001e: unbox.any [runtime]System.Int32 + IL_0023: stfld int32 ABC/MyExn::Data0@ + IL_0028: ret + } + + .method public strict virtual instance void GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo info, valuetype [runtime]System.Runtime.Serialization.StreamingContext context) cil managed + { + .custom instance void [runtime]System.Security.SecurityCriticalAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldarg.1 + IL_0002: ldarg.2 + IL_0003: call instance void [runtime]System.Exception::GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo, + valuetype [runtime]System.Runtime.Serialization.StreamingContext) + IL_0008: ldarg.1 + IL_0009: ldstr "Data0@" + IL_000e: ldarg.0 + IL_000f: ldfld int32 ABC/MyExn::Data0@ + IL_0014: box [runtime]System.Int32 + IL_0019: callvirt instance void [runtime]System.Runtime.Serialization.SerializationInfo::AddValue(string, + object) + IL_001e: ret } .method public hidebysig specialname instance int32 get_Data0() cil managed @@ -1184,7 +1215,38 @@ IL_0002: ldarg.2 IL_0003: call instance void [runtime]System.Exception::.ctor(class [runtime]System.Runtime.Serialization.SerializationInfo, valuetype [runtime]System.Runtime.Serialization.StreamingContext) - IL_0008: ret + IL_0008: ldarg.0 + IL_0009: ldarg.1 + IL_000a: ldstr "Data0@" + IL_000f: ldtoken [runtime]System.Int32 + IL_0014: call class [runtime]System.Type [runtime]System.Type::GetTypeFromHandle(valuetype [runtime]System.RuntimeTypeHandle) + IL_0019: callvirt instance object [runtime]System.Runtime.Serialization.SerializationInfo::GetValue(string, + class [runtime]System.Type) + IL_001e: unbox.any [runtime]System.Int32 + IL_0023: stfld int32 ABC/ABC/MyExn::Data0@ + IL_0028: ret + } + + .method public strict virtual instance void GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo info, valuetype [runtime]System.Runtime.Serialization.StreamingContext context) cil managed + { + .custom instance void [runtime]System.Security.SecurityCriticalAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldarg.1 + IL_0002: ldarg.2 + IL_0003: call instance void [runtime]System.Exception::GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo, + valuetype [runtime]System.Runtime.Serialization.StreamingContext) + IL_0008: ldarg.1 + IL_0009: ldstr "Data0@" + IL_000e: ldarg.0 + IL_000f: ldfld int32 ABC/ABC/MyExn::Data0@ + IL_0014: box [runtime]System.Int32 + IL_0019: callvirt instance void [runtime]System.Runtime.Serialization.SerializationInfo::AddValue(string, + object) + IL_001e: ret } .method public hidebysig specialname instance int32 get_Data0() cil managed diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace.fs.RealInternalSignatureOff.il.netcore.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace.fs.RealInternalSignatureOff.il.netcore.bsl index 2670d0577dc..c8255f7cb0e 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace.fs.RealInternalSignatureOff.il.netcore.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace.fs.RealInternalSignatureOff.il.netcore.bsl @@ -478,7 +478,38 @@ IL_0002: ldarg.2 IL_0003: call instance void [runtime]System.Exception::.ctor(class [runtime]System.Runtime.Serialization.SerializationInfo, valuetype [runtime]System.Runtime.Serialization.StreamingContext) - IL_0008: ret + IL_0008: ldarg.0 + IL_0009: ldarg.1 + IL_000a: ldstr "Data0@" + IL_000f: ldtoken [runtime]System.Int32 + IL_0014: call class [runtime]System.Type [runtime]System.Type::GetTypeFromHandle(valuetype [runtime]System.RuntimeTypeHandle) + IL_0019: callvirt instance object [runtime]System.Runtime.Serialization.SerializationInfo::GetValue(string, + class [runtime]System.Type) + IL_001e: unbox.any [runtime]System.Int32 + IL_0023: stfld int32 XYZ.MyExn::Data0@ + IL_0028: ret + } + + .method public strict virtual instance void GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo info, valuetype [runtime]System.Runtime.Serialization.StreamingContext context) cil managed + { + .custom instance void [runtime]System.Security.SecurityCriticalAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldarg.1 + IL_0002: ldarg.2 + IL_0003: call instance void [runtime]System.Exception::GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo, + valuetype [runtime]System.Runtime.Serialization.StreamingContext) + IL_0008: ldarg.1 + IL_0009: ldstr "Data0@" + IL_000e: ldarg.0 + IL_000f: ldfld int32 XYZ.MyExn::Data0@ + IL_0014: box [runtime]System.Int32 + IL_0019: callvirt instance void [runtime]System.Runtime.Serialization.SerializationInfo::AddValue(string, + object) + IL_001e: ret } .method public hidebysig specialname instance int32 get_Data0() cil managed @@ -1180,7 +1211,38 @@ IL_0002: ldarg.2 IL_0003: call instance void [runtime]System.Exception::.ctor(class [runtime]System.Runtime.Serialization.SerializationInfo, valuetype [runtime]System.Runtime.Serialization.StreamingContext) - IL_0008: ret + IL_0008: ldarg.0 + IL_0009: ldarg.1 + IL_000a: ldstr "Data0@" + IL_000f: ldtoken [runtime]System.Int32 + IL_0014: call class [runtime]System.Type [runtime]System.Type::GetTypeFromHandle(valuetype [runtime]System.RuntimeTypeHandle) + IL_0019: callvirt instance object [runtime]System.Runtime.Serialization.SerializationInfo::GetValue(string, + class [runtime]System.Type) + IL_001e: unbox.any [runtime]System.Int32 + IL_0023: stfld int32 XYZ.ABC/MyExn::Data0@ + IL_0028: ret + } + + .method public strict virtual instance void GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo info, valuetype [runtime]System.Runtime.Serialization.StreamingContext context) cil managed + { + .custom instance void [runtime]System.Security.SecurityCriticalAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldarg.1 + IL_0002: ldarg.2 + IL_0003: call instance void [runtime]System.Exception::GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo, + valuetype [runtime]System.Runtime.Serialization.StreamingContext) + IL_0008: ldarg.1 + IL_0009: ldstr "Data0@" + IL_000e: ldarg.0 + IL_000f: ldfld int32 XYZ.ABC/MyExn::Data0@ + IL_0014: box [runtime]System.Int32 + IL_0019: callvirt instance void [runtime]System.Runtime.Serialization.SerializationInfo::AddValue(string, + object) + IL_001e: ret } .method public hidebysig specialname instance int32 get_Data0() cil managed @@ -1882,7 +1944,38 @@ IL_0002: ldarg.2 IL_0003: call instance void [runtime]System.Exception::.ctor(class [runtime]System.Runtime.Serialization.SerializationInfo, valuetype [runtime]System.Runtime.Serialization.StreamingContext) - IL_0008: ret + IL_0008: ldarg.0 + IL_0009: ldarg.1 + IL_000a: ldstr "Data0@" + IL_000f: ldtoken [runtime]System.Int32 + IL_0014: call class [runtime]System.Type [runtime]System.Type::GetTypeFromHandle(valuetype [runtime]System.RuntimeTypeHandle) + IL_0019: callvirt instance object [runtime]System.Runtime.Serialization.SerializationInfo::GetValue(string, + class [runtime]System.Type) + IL_001e: unbox.any [runtime]System.Int32 + IL_0023: stfld int32 XYZ.ABC/ABC/MyExn::Data0@ + IL_0028: ret + } + + .method public strict virtual instance void GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo info, valuetype [runtime]System.Runtime.Serialization.StreamingContext context) cil managed + { + .custom instance void [runtime]System.Security.SecurityCriticalAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldarg.1 + IL_0002: ldarg.2 + IL_0003: call instance void [runtime]System.Exception::GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo, + valuetype [runtime]System.Runtime.Serialization.StreamingContext) + IL_0008: ldarg.1 + IL_0009: ldstr "Data0@" + IL_000e: ldarg.0 + IL_000f: ldfld int32 XYZ.ABC/ABC/MyExn::Data0@ + IL_0014: box [runtime]System.Int32 + IL_0019: callvirt instance void [runtime]System.Runtime.Serialization.SerializationInfo::AddValue(string, + object) + IL_001e: ret } .method public hidebysig specialname instance int32 get_Data0() cil managed diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace.fs.RealInternalSignatureOn.il.netcore.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace.fs.RealInternalSignatureOn.il.netcore.bsl index 768c75fd03b..400e8fa88c9 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace.fs.RealInternalSignatureOn.il.netcore.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace.fs.RealInternalSignatureOn.il.netcore.bsl @@ -478,7 +478,38 @@ IL_0002: ldarg.2 IL_0003: call instance void [runtime]System.Exception::.ctor(class [runtime]System.Runtime.Serialization.SerializationInfo, valuetype [runtime]System.Runtime.Serialization.StreamingContext) - IL_0008: ret + IL_0008: ldarg.0 + IL_0009: ldarg.1 + IL_000a: ldstr "Data0@" + IL_000f: ldtoken [runtime]System.Int32 + IL_0014: call class [runtime]System.Type [runtime]System.Type::GetTypeFromHandle(valuetype [runtime]System.RuntimeTypeHandle) + IL_0019: callvirt instance object [runtime]System.Runtime.Serialization.SerializationInfo::GetValue(string, + class [runtime]System.Type) + IL_001e: unbox.any [runtime]System.Int32 + IL_0023: stfld int32 XYZ.MyExn::Data0@ + IL_0028: ret + } + + .method public strict virtual instance void GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo info, valuetype [runtime]System.Runtime.Serialization.StreamingContext context) cil managed + { + .custom instance void [runtime]System.Security.SecurityCriticalAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldarg.1 + IL_0002: ldarg.2 + IL_0003: call instance void [runtime]System.Exception::GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo, + valuetype [runtime]System.Runtime.Serialization.StreamingContext) + IL_0008: ldarg.1 + IL_0009: ldstr "Data0@" + IL_000e: ldarg.0 + IL_000f: ldfld int32 XYZ.MyExn::Data0@ + IL_0014: box [runtime]System.Int32 + IL_0019: callvirt instance void [runtime]System.Runtime.Serialization.SerializationInfo::AddValue(string, + object) + IL_001e: ret } .method public hidebysig specialname instance int32 get_Data0() cil managed @@ -1180,7 +1211,38 @@ IL_0002: ldarg.2 IL_0003: call instance void [runtime]System.Exception::.ctor(class [runtime]System.Runtime.Serialization.SerializationInfo, valuetype [runtime]System.Runtime.Serialization.StreamingContext) - IL_0008: ret + IL_0008: ldarg.0 + IL_0009: ldarg.1 + IL_000a: ldstr "Data0@" + IL_000f: ldtoken [runtime]System.Int32 + IL_0014: call class [runtime]System.Type [runtime]System.Type::GetTypeFromHandle(valuetype [runtime]System.RuntimeTypeHandle) + IL_0019: callvirt instance object [runtime]System.Runtime.Serialization.SerializationInfo::GetValue(string, + class [runtime]System.Type) + IL_001e: unbox.any [runtime]System.Int32 + IL_0023: stfld int32 XYZ.ABC/MyExn::Data0@ + IL_0028: ret + } + + .method public strict virtual instance void GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo info, valuetype [runtime]System.Runtime.Serialization.StreamingContext context) cil managed + { + .custom instance void [runtime]System.Security.SecurityCriticalAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldarg.1 + IL_0002: ldarg.2 + IL_0003: call instance void [runtime]System.Exception::GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo, + valuetype [runtime]System.Runtime.Serialization.StreamingContext) + IL_0008: ldarg.1 + IL_0009: ldstr "Data0@" + IL_000e: ldarg.0 + IL_000f: ldfld int32 XYZ.ABC/MyExn::Data0@ + IL_0014: box [runtime]System.Int32 + IL_0019: callvirt instance void [runtime]System.Runtime.Serialization.SerializationInfo::AddValue(string, + object) + IL_001e: ret } .method public hidebysig specialname instance int32 get_Data0() cil managed @@ -1882,7 +1944,38 @@ IL_0002: ldarg.2 IL_0003: call instance void [runtime]System.Exception::.ctor(class [runtime]System.Runtime.Serialization.SerializationInfo, valuetype [runtime]System.Runtime.Serialization.StreamingContext) - IL_0008: ret + IL_0008: ldarg.0 + IL_0009: ldarg.1 + IL_000a: ldstr "Data0@" + IL_000f: ldtoken [runtime]System.Int32 + IL_0014: call class [runtime]System.Type [runtime]System.Type::GetTypeFromHandle(valuetype [runtime]System.RuntimeTypeHandle) + IL_0019: callvirt instance object [runtime]System.Runtime.Serialization.SerializationInfo::GetValue(string, + class [runtime]System.Type) + IL_001e: unbox.any [runtime]System.Int32 + IL_0023: stfld int32 XYZ.ABC/ABC/MyExn::Data0@ + IL_0028: ret + } + + .method public strict virtual instance void GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo info, valuetype [runtime]System.Runtime.Serialization.StreamingContext context) cil managed + { + .custom instance void [runtime]System.Security.SecurityCriticalAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldarg.1 + IL_0002: ldarg.2 + IL_0003: call instance void [runtime]System.Exception::GetObjectData(class [runtime]System.Runtime.Serialization.SerializationInfo, + valuetype [runtime]System.Runtime.Serialization.StreamingContext) + IL_0008: ldarg.1 + IL_0009: ldstr "Data0@" + IL_000e: ldarg.0 + IL_000f: ldfld int32 XYZ.ABC/ABC/MyExn::Data0@ + IL_0014: box [runtime]System.Int32 + IL_0019: callvirt instance void [runtime]System.Runtime.Serialization.SerializationInfo::AddValue(string, + object) + IL_001e: ret } .method public hidebysig specialname instance int32 get_Data0() cil managed