-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Description
Description
MemoryMappedFile.CreateNew throws a
System.IO.PathTooLongException: The specified file name or path is too long, or a component of the specified path is too long.
exception when passing in null as the map name (null mapName is required on
unix as noted in #21863).
Program.cs:
using System.IO.MemoryMappedFiles;
// Passing null as mapNames are not supported for mmf on unix
using var mmf = MemoryMappedFile.CreateNew(null, 1);When run, will throw:
dotnet run --project MemoryMapIssue
Unhandled exception. System.IO.PathTooLongException: The specified file name or path is too long, or a component of the specified path is too long.
at System.IO.MemoryMappedFiles.MemoryMappedFile.CreateSharedBackingObjectUsingMemory(MemoryMappedProtections protections, Int64 capacity, HandleInheritability inheritability)
at System.IO.MemoryMappedFiles.MemoryMappedFile.CreateSharedBackingObject(MemoryMappedProtections protections, Int64 capacity, HandleInheritability inheritability)
at System.IO.MemoryMappedFiles.MemoryMappedFile.CreateCore(FileStream fileStream, String mapName, HandleInheritability inheritability, MemoryMappedFileAccess access, MemoryMappedFileOptions options, Int64 capacity)
at System.IO.MemoryMappedFiles.MemoryMappedFile.CreateNew(String mapName, Int64 capacity, MemoryMappedFileAccess access, MemoryMappedFileOptions options, HandleInheritability inheritability)
at System.IO.MemoryMappedFiles.MemoryMappedFile.CreateNew(String mapName, Int64 capacity)
at Program.<Main>$(String[] args) in /Users/aida/workspace/MemoryMapIssue/Program.cs:line 5
Configuration
- OS: macOS 12.1
- Arch: ARM64
dotnet --version
6.0.101
dotnet --list-runtimes
Microsoft.AspNetCore.App 6.0.1 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 6.0.1 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
dotnet --list-sdks
6.0.101 [/usr/local/share/dotnet/sdk]
Regression?
Unknown
Other information
Following guidance from #21863 which
says unix systems do not support named mmf; so passing in null as name.