From 46d1c5999ff60eb6d4617be03be7a2bdb08e1ecc Mon Sep 17 00:00:00 2001 From: Will Smith Date: Thu, 16 Jan 2020 18:19:33 -0800 Subject: [PATCH 1/2] Fixed exception that prevented creating a memory mapped file that shadow copies a file on-disk (#8238) * Fixed exception that prevented creating a memory mapped file that is shadow copied * Update bytes.fs --- src/absil/bytes.fs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/absil/bytes.fs b/src/absil/bytes.fs index 99f3f4b4834..89556fc9683 100644 --- a/src/absil/bytes.fs +++ b/src/absil/bytes.fs @@ -306,10 +306,11 @@ type ByteMemory with leaveOpen=false) mmf, mmf.CreateViewAccessor(0L, length, memoryMappedFileAccess), length + // Validate MMF with the access that was intended. match access with - | FileAccess.Read when not accessor.CanRead -> failwith "Cannot read file" - | FileAccess.Write when not accessor.CanWrite -> failwith "Cannot write file" - | _ when not accessor.CanRead || not accessor.CanWrite -> failwith "Cannot read or write file" + | FileAccess.Read when not accessor.CanRead -> invalidOp "Cannot read file" + | FileAccess.Write when not accessor.CanWrite -> invalidOp "Cannot write file" + | FileAccess.ReadWrite when not accessor.CanRead || not accessor.CanWrite -> invalidOp "Cannot read or write file" | _ -> () let safeHolder = From b0a76e7cee9842cd47b5e42d879966dc6207a401 Mon Sep 17 00:00:00 2001 From: Will Smith Date: Wed, 18 Mar 2020 12:25:49 -0700 Subject: [PATCH 2/2] Added test for old fsharp core project --- .../Program.fs | 9 +++++++++ ...Sharp_ConsoleApp_net35_old_fsharp_core.fsproj | 16 ++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 tests/projects/Sample_VS2017_FSharp_ConsoleApp_net35_old_fsharp_core/Program.fs create mode 100644 tests/projects/Sample_VS2017_FSharp_ConsoleApp_net35_old_fsharp_core/Sample_VS2017_FSharp_ConsoleApp_net35_old_fsharp_core.fsproj diff --git a/tests/projects/Sample_VS2017_FSharp_ConsoleApp_net35_old_fsharp_core/Program.fs b/tests/projects/Sample_VS2017_FSharp_ConsoleApp_net35_old_fsharp_core/Program.fs new file mode 100644 index 00000000000..bbdd1d9e0a0 --- /dev/null +++ b/tests/projects/Sample_VS2017_FSharp_ConsoleApp_net35_old_fsharp_core/Program.fs @@ -0,0 +1,9 @@ +// Learn more about F# at http://fsharp.org + +open System + + +[] +let main argv = + printfn "Hello World from F#!" + 0 // return an integer exit code diff --git a/tests/projects/Sample_VS2017_FSharp_ConsoleApp_net35_old_fsharp_core/Sample_VS2017_FSharp_ConsoleApp_net35_old_fsharp_core.fsproj b/tests/projects/Sample_VS2017_FSharp_ConsoleApp_net35_old_fsharp_core/Sample_VS2017_FSharp_ConsoleApp_net35_old_fsharp_core.fsproj new file mode 100644 index 00000000000..d47c2dfe412 --- /dev/null +++ b/tests/projects/Sample_VS2017_FSharp_ConsoleApp_net35_old_fsharp_core/Sample_VS2017_FSharp_ConsoleApp_net35_old_fsharp_core.fsproj @@ -0,0 +1,16 @@ + + + + Exe + net35 + + + + + + + + + + +