diff --git a/src/absil/bytes.fs b/src/absil/bytes.fs index 99f3f4b483..89556fc968 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 = 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 0000000000..bbdd1d9e0a --- /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 0000000000..d47c2dfe41 --- /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 + + + + + + + + + + +