Skip to content

Commit 1af023b

Browse files
authored
Fixes #16359 - correctly handle imports with 0 length public key tokens (#16363)
1 parent fb767e9 commit 1af023b

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
- Miscellaneous fixes to parens analysis - https://github.com/dotnet/fsharp/pull/16262
1+
- Miscellaneous fixes to parens analysis - https://github.com/dotnet/fsharp/pull/16262
2+
- Fixes #16359 - correctly handle imports with 0 length public key tokens - https://github.com/dotnet/fsharp/pull/16363

src/Compiler/AbstractIL/ilread.fs

+6-1
Original file line numberDiff line numberDiff line change
@@ -1946,7 +1946,12 @@ and seekReadAssemblyManifest (ctxt: ILMetadataReader) pectxt idx =
19461946
Name = name
19471947
AuxModuleHashAlgorithm = hash
19481948
SecurityDeclsStored = ctxt.securityDeclsReader_Assembly
1949-
PublicKey = pubkey
1949+
PublicKey =
1950+
// The runtime and C# treat a 0 length publicKey as an unsigned assembly, so if a public record exists with a length of 0
1951+
// treat it as unsigned
1952+
match pubkey with
1953+
| Some pkBytes when pkBytes.Length > 0 -> pubkey
1954+
| _ -> None
19501955
Version = Some(ILVersionInfo(v1, v2, v3, v4))
19511956
Locale = readStringHeapOption ctxt localeIdx
19521957
CustomAttrsStored = ctxt.customAttrsReader_Assembly

0 commit comments

Comments
 (0)