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 da89cec27a2..469788d5f6c 100644 --- a/docs/release-notes/.FSharp.Compiler.Service/11.0.100.md +++ b/docs/release-notes/.FSharp.Compiler.Service/11.0.100.md @@ -1,4 +1,5 @@ ### Fixed +* 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 diff --git a/src/Compiler/CodeGen/IlxGen.fs b/src/Compiler/CodeGen/IlxGen.fs index 290bba23e4d..0f9de0d73da 100644 --- a/src/Compiler/CodeGen/IlxGen.fs +++ b/src/Compiler/CodeGen/IlxGen.fs @@ -11925,6 +11925,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 @@ -11932,6 +11975,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 = @@ -11944,7 +11991,94 @@ 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 = + 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 ]) + + // 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 + [ 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..6e3c95e54fb --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/CodeGenRegressions/CodeGenRegressions_Exceptions.fs @@ -0,0 +1,162 @@ +// 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" + ".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" + ] + |> 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 + + // 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 + |> ignoreWarnings + |> compile + |> shouldSucceed + |> run + |> shouldSucceed + |> ignore 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/Nullness/ExceptionType.fs.il.netcore.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/ExceptionType.fs.il.netcore.bsl index 2a8a0c50d27..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 @@ -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 @@ -334,4 +461,3 @@ - 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.RealInternalSignatureOff.il.netcore.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule.fs.RealInternalSignatureOff.il.netcore.release.bsl index 9c163b8ec4e..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 @@ -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 @@ -1512,4 +1570,3 @@ - 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/ToplevelModule.fs.RealInternalSignatureOn.il.netcore.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule.fs.RealInternalSignatureOn.il.netcore.release.bsl index e9375f2d0f3..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 @@ -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 @@ -1502,4 +1560,3 @@ - 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.RealInternalSignatureOff.il.netcore.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace.fs.RealInternalSignatureOff.il.netcore.release.bsl index 36d2089b286..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 @@ -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 @@ -2208,4 +2295,3 @@ - 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 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..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 @@ -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 @@ -2198,4 +2285,3 @@ - diff --git a/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj b/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj index 41848cbf2f0..f8ebf53a174 100644 --- a/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj +++ b/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj @@ -280,6 +280,7 @@ +