justinstenning / SharedMemory

C# shared memory classes for sharing data between processes (Array, Buffer and Circular Buffer)
https://www.nuget.org/packages/SharedMemory
Other
566 stars 118 forks source link

Cannot create a file when it already exists when use MemoryMappedFile.CreateNew #56

Open happysammy opened 3 years ago

happysammy commented 3 years ago

I start two processes, one writes data continuously, and another reads data, when i kill the write process and restart, it throws an exception "Cannot create a file when it already exists" , so i look into the library source code, change the "MemoryMappedFile.CreateNew" function in SharedBuffer class to "MemoryMappedFile.CreateOrOpen", the bug doesn't appear and worked very well.