Skip to content

Commit ffd7853

Browse files
committed
Fixing binary reader on xplat
1 parent efe549d commit ffd7853

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/absil/ilread.fs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3946,15 +3946,15 @@ let ClosePdbReader pdb =
39463946

39473947
let OpenILModuleReader infile opts =
39483948

3949-
if not runningOnMono then
3949+
try
39503950
let mmap = MemoryMappedFile.Create infile
39513951
let modul,ilAssemblyRefs,pdb = genOpenBinaryReader infile mmap opts
39523952
{ modul = modul
39533953
ilAssemblyRefs=ilAssemblyRefs
39543954
dispose = (fun () ->
39553955
mmap.Close()
39563956
ClosePdbReader pdb) }
3957-
else
3957+
with _ ->
39583958
let mc = ByteFile(infile |> FileSystem.ReadAllBytesShim)
39593959
let modul,ilAssemblyRefs,pdb = genOpenBinaryReader infile mc opts
39603960
{ modul = modul

src/fsharp/CompileOps.fs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2602,8 +2602,8 @@ type TcConfig private (data : TcConfigBuilder,validate:bool) =
26022602
clrRoot, (int v1, sprintf "v%d.%d" v1 v2), (v1=5us && v2=0us && v3=5us) // SL5 mscorlib is 5.0.5.0
26032603
| _ ->
26042604
failwith (FSComp.SR.buildCouldNotReadVersionInfoFromMscorlib())
2605-
with _ ->
2606-
error(Error(FSComp.SR.buildCannotReadAssembly(filename),rangeStartup))
2605+
with e ->
2606+
error(Error(FSComp.SR.buildErrorOpeningBinaryFile(filename, e.Message), rangeStartup))
26072607
| _ ->
26082608
None, MSBuildResolver.HighestInstalledNetFrameworkVersionMajorMinor(), false
26092609

@@ -2657,8 +2657,8 @@ type TcConfig private (data : TcConfigBuilder,validate:bool) =
26572657
checkFSharpBinaryCompatWithMscorlib filename ilReader.ILAssemblyRefs ilReader.ILModuleDef.ManifestOfAssembly.Version rangeStartup;
26582658
let fslibRoot = Path.GetDirectoryName(FileSystem.GetFullPathShim(filename))
26592659
fslibRoot (* , sprintf "v%d.%d" v1 v2 *)
2660-
with _ ->
2661-
error(Error(FSComp.SR.buildCannotReadAssembly(filename),rangeStartup))
2660+
with e ->
2661+
error(Error(FSComp.SR.buildErrorOpeningBinaryFile(filename, e.Message), rangeStartup))
26622662
| _ ->
26632663
data.defaultFSharpBinariesDir
26642664

0 commit comments

Comments
 (0)