Pergunta

I'm using Transactional NTFS to read and write to files on the filesystem and I've noticed that the application encounters intermittent faults which as only solved by an app restart. The stack trace for the error is:

System.Runtime.InteropServices.COMException (0xD0190052): Exception from HRESULT: 0xD0190052
   at ...KtmTransactionHandle.IKernelTransaction.GetHandle(IntPtr& handle)
   at ...KtmTransactionHandle.CreateKtmTransactionHandle(Transaction managedTransaction)
   at ...KtmTransactionHandle.CreateKtmTransactionHandle()
   at ...TransactedFile.Open(String path, FileMode mode, FileAccess access, FileShare share)
   at ...TransactedFile.ReadAllText(String path)

IKernelTransaction is a COM Interface that I get a handle to:

    [ComImport]
    [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
    [Guid("79427A2B-F895-40e0-BE79-B57DC82ED231")]
    private interface IKernelTransaction
    {
        void GetHandle([Out] out IntPtr handle);
    }

here

IKernelTransaction tx = (IKernelTransaction)TransactionInterop.GetDtcTransaction(Transaction.Current);

My code is very similar to http://msdn.microsoft.com/en-us/library/cc303707.aspx

The problem is that I cannot find any information of this COM error 0xD0190052. Just knowing what this error code is would be hugely helpful.

Thanks

Foi útil?

Solução

Pure speculation
The HRESULT 0xD0190052 is very similar to STATUS_TRANSACTIONMANAGER_NOT_ONLINE which is 0xC0190052... the difference is in the "N"-Bit which indicates whether the code is a so-called NTSTATUS (see http://msdn.microsoft.com/en-us/library/0642cb2f-2075-4469-918c-4441e69c548a%28PROT.10%29.aspx and http://msdn.microsoft.com/en-us/library/cc231200%28v=PROT.10%29.aspx and http://msdn.microsoft.com/en-us/library/cc704588%28v=PROT.10%29.aspx )...

From what you describe it seems either your application sometimes looses the connection to the transaction manager or the transaction manager is unstable/restarted or similar...

Also definig PreserveSig(true) on your COM import could help getting some HRESULT description...

Hope this makes any sense in your case...

EDIT:

I am not sure that the code you linked to is taking into account all possibilities... in the method TransactedFile.Open there is a call to scope.Complete(); which is good and necessary BUT if some code before this call within the using-block throws some exception it does not get called which is bad according to http://msdn.microsoft.com/en-us/library/ms172152.aspx

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top