From 58bf34d93f6c7aff423d70071e01490ccd1c66f2 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 31 Mar 2026 00:46:48 +0000 Subject: [PATCH 1/2] Fix decodeILCustomAttribData: resolve System.Type custom attribute arguments Previously, when decoding custom attribute blobs containing System.Type arguments, the type name string was parsed but then discarded, returning null for every Type argument. This fixes two TODO comments (lines 6751 and 6756 in the original) by: 1. Adding a 'resolveILType: ILType -> Type' parameter to decodeILCustomAttribData so callers can provide a type resolver. 2. Using ILTypeSigParser to parse the stored type name string into an ILType, then resolving it via the provided resolver. 3. Falling back to null gracefully if resolution fails (e.g. the type is not available in the target context). 4. Passing 'txILType ([||], [||])' at the call site so types are resolved via the existing target-assembly translation layer. This means that attributes like DebuggerTypeProxyAttribute, which pass a System.Type to their constructor, now decode correctly when read from binary assemblies via the target assembly reader. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- src/ProvidedTypes.fs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/ProvidedTypes.fs b/src/ProvidedTypes.fs index f39fa85..250e48b 100644 --- a/src/ProvidedTypes.fs +++ b/src/ProvidedTypes.fs @@ -6695,7 +6695,7 @@ module internal AssemblyReader = let s, sigptr = sigptr_get_string len bytes sigptr Some(s), sigptr - let decodeILCustomAttribData ilg (resolveEnumUnderlyingILType: ILType -> ILType) (ca: ILCustomAttribute) = + let decodeILCustomAttribData ilg (resolveEnumUnderlyingILType: ILType -> ILType) (resolveILType: ILType -> Type) (ca: ILCustomAttribute) = let bytes = ca.Data let sigptr = 0 let bb0, sigptr = sigptr_get_byte bytes sigptr @@ -6748,12 +6748,13 @@ module internal AssemblyReader = | ILType.Boxed tspec when tspec.Namespace = USome "System" && tspec.Name = "Type" -> let nOpt, sigptr = sigptr_get_serstring_possibly_null bytes sigptr match nOpt with - | None -> (argty, box null) , sigptr // TODO: read System.Type attrs + | None -> (argty, box null), sigptr | Some n -> try let parser = ILTypeSigParser(n) - parser.ParseType() |> ignore - (argty, box null) , sigptr // TODO: read System.Type attributes + let ilty = parser.ParseType() + let resolvedType = try resolveILType ilty with _ -> null + (argty, box resolvedType), sigptr with e -> failwithf "decodeILCustomAttribData: error parsing type in custom attribute blob: %s" e.Message | ILType.Boxed tspec when tspec.Namespace = USome "System" && tspec.Name = "Object" -> @@ -7697,7 +7698,7 @@ namespace ProviderImplementation.ProvidedTypes else ilGlobals.typ_Int32 with _ -> ilGlobals.typ_Int32 | _ -> ilGlobals.typ_Int32 - let args, namedArgs = decodeILCustomAttribData ilGlobals resolveEnumUnderlyingILType inp + let args, namedArgs = decodeILCustomAttribData ilGlobals resolveEnumUnderlyingILType (txILType ([| |], [| |])) inp { new CustomAttributeData () with member __.Constructor = txILConstructorRef inp.Method.MethodRef member __.ConstructorArguments = [| for arg in args -> txCustomAttributesArg arg |] :> IList<_> From 72642adc90ab4ce793efbb2c2af863457780c3b1 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Tue, 31 Mar 2026 00:46:51 +0000 Subject: [PATCH 2/2] ci: trigger checks