MockFileStream.InternalFlush is not thread-safe #784
Labels
area: testinghelpers
Issues that address the testing helpers
state: ready to pick
Issues that are ready for being worked on
type: bug
Issues that describe misbehaving functionality
System.IO.Abstractions/src/System.IO.Abstractions.TestingHelpers/MockFileStream.cs
Lines 93 to 107 in 05486f7
If Thread1 invokes this method, but Thread2 deletes the same file while Thread1 is at line 96, then Thread1 will throw a NullReferenceException at line 107.
I'm not sure what the desired behavior would be, but at a minimum lines 95-97 should be folded into an atomic
mockFileDataAccessor.TryGetFile(path, out var mockFileData)
. I imagine it would look essentially like this, but without the ternary condition:System.IO.Abstractions/src/System.IO.Abstractions.TestingHelpers/MockFileSystem.cs
Lines 383 to 389 in 05486f7
The text was updated successfully, but these errors were encountered: