alphaleonis / AlphaFS

AlphaFS is a .NET library providing more complete Win32 file system functionality to the .NET platform than the standard System.IO classes.
http://alphafs.alphaleonis.com/
MIT License
558 stars 99 forks source link

System.IO.IOException: (6801) Transaction support within the specified resource manager is not started or was shut down due to an error #527

Open galdenny opened 2 years ago

galdenny commented 2 years ago

Hello,

I have a special case with transactional writing a file on a USB storage formated to NTFS. If the storage is plugged, it will be mounted in another NTFS folder: D:\SomeFolder\Mount\USB1

I want to write a file on this storage with the following line:

using (var ts = new Alphaleonis.Win32.Filesystem.KernelTransaction())
            {
                Alphaleonis.Win32.Filesystem.File.WriteAllTextTransacted(ts, path, content);

                ts.Commit();
            }

The problem is, that at least 10% of all cases the resource manager for the Tx support is not present, and I get this error message: System.IO.IOException: (6801) Transaction support within the specified resource manager is not started or was shut down due to an error.

After removing and re-plugging the USB stick the problem disappears in most of the cases.

Can someone please point me to the right direction?

Thank you in advance