diff --git a/src/Compiler/Utilities/FileSystem.fs b/src/Compiler/Utilities/FileSystem.fs index 791e829a36..722978e851 100644 --- a/src/Compiler/Utilities/FileSystem.fs +++ b/src/Compiler/Utilities/FileSystem.fs @@ -530,8 +530,6 @@ type DefaultFileSystem() as this = // We want to use mmaped files only when: // - Opening large binary files (no need to use for source or resource files really) - // - Running on mono, since its MemoryMappedFile implementation throws when "mapName" is not provided (is null). - // (See: https://github.com/mono/mono/issues/10245) if not useMemoryMappedFile then fileStream :> Stream @@ -542,12 +540,12 @@ type DefaultFileSystem() as this = MemoryMappedFile.CreateNew( null, length, - MemoryMappedFileAccess.Read, + MemoryMappedFileAccess.ReadWrite, MemoryMappedFileOptions.None, HandleInheritability.None ) - use stream = mmf.CreateViewStream(0L, length, MemoryMappedFileAccess.Read) + use stream = mmf.CreateViewStream(0L, length, MemoryMappedFileAccess.ReadWrite) fileStream.CopyTo(stream) fileStream.Dispose() mmf diff --git a/tests/projects/Sample_ConsoleApp_FileSystemTests/Program.fs b/tests/projects/Sample_ConsoleApp_FileSystemTests/Program.fs new file mode 100644 index 0000000000..75e0a053f4 --- /dev/null +++ b/tests/projects/Sample_ConsoleApp_FileSystemTests/Program.fs @@ -0,0 +1 @@ +[] let main _ = 0 diff --git a/tests/projects/Sample_ConsoleApp_FileSystemTests/Sample_ConsoleApp_net7.fsproj b/tests/projects/Sample_ConsoleApp_FileSystemTests/Sample_ConsoleApp_net7.fsproj new file mode 100644 index 0000000000..2b06247db9 --- /dev/null +++ b/tests/projects/Sample_ConsoleApp_FileSystemTests/Sample_ConsoleApp_net7.fsproj @@ -0,0 +1,24 @@ + + + + Exe + net6.0 + true + + + + $(MSBuildThisFileDirectory)../../../artifacts/bin/fsc/Debug/net6.0/fsc.dll + $(MSBuildThisFileDirectory)../../../artifacts/bin/fsc/Debug/net6.0/fsc.dll + False + True + + + + + + + + + + +