单声道上的MemoryMappedFiles

时间:2012-12-07 16:16:56

标签: c# mono fedora

我已经成功地在windows和visual studio中使用了内存映射文件,但是,我正在尝试将项目迁移到mono和fedora 17,我的代码就像这样简单:

Var file = MemoryMappedFile.CreateNew(@"/home/xxx/xxx/filename", 1024*1024);

与visual studio不同,在文件名中您必须放置现有文件。否则,你得到一个File NofoundException,我得到了“容量异常”但是调用具有确切文件大小的方法我现在得到一个新的异常:

Mono.Unix.UnixIOException: File exists [EEXIST].
at Mono.Unix.UnixMarshal.ThrowExceptionForLastError () [0x00000]
    in /builddir/build/BUILD/mono-2.10.8/mcs/class/Mono.Posix/Mono.Unix/UnixMarshal.cs:456
at System.IO.MemoryMappedFiles.MemoryMapImpl.Open (System.String path, FileMode mode, Int64 capacity, MemoryMappedFileAccess access) [0x0006b]
    in /builddir/build/BUILD/mono-2.10.8/mcs/class/System.Core/System.IO.MemoryMappedFiles/MemoryMappedFile.cs:133
at System.IO.MemoryMappedFiles.MemoryMappedFile.CreateFromFile (System.String path, FileMode mode, System.String mapName, Int64 capacity, MemoryMappedFileAccess access) [0x00055]
    in /builddir/build/BUILD/mono-2.10.8/mcs/class/System.Core/System.IO.MemoryMappedFiles/MemoryMappedFile.cs:475
at System.IO.MemoryMappedFiles.MemoryMappedFile.CreateNew (System.String mapName, Int64 capacity, MemoryMappedFileAccess access, MemoryMappedFileOptions options, System.IO.MemoryMappedFiles.MemoryMappedFileSecurity memoryMappedFileSecurity, HandleInheritability handleInheritability) [0x00000]
    in /builddir/build/BUILD/mono-2.10.8/mcs/class/System.Core/System.IO.MemoryMappedFiles/MemoryMappedFile.cs:525
at Unixtest.MainClass.Inicialize () [0x00009] 
    in /home/xxx/xxx/Unixtest/Main.cs:50 }

我被困在这里,有什么想法吗?

0 个答案:

没有答案
相关问题