You need to resolve this problem

You create a collection of serviced components that performs bank transfers. All the components are marked with the Transaction(TransactionOption.Required) attribute. All the methods in the components are marked with the AutoComplete() attribute. You discover that incorrect balance amounts are being transferred. You decide to debug the components. During debugging, a System.Runtime.InteropServices.COMException is thrown. The HRESULT for the exception is 0x8004E002. The exception includes the following message: “The root transaction wanted to commit, but transaction aborted.” You find that this exception occurs only during the debugging session, and not when the components run outside of the debugger. This exception is preventing you from continuing to debug the components. You need to resolve this problem. What should you do?

You create a collection of serviced components that performs bank transfers. All the components are marked with the Transaction(TransactionOption.Required) attribute. All the methods in the components are marked with the AutoComplete() attribute. You discover that incorrect balance amounts are being transferred. You decide to debug the components. During debugging, a System.Runtime.InteropServices.COMException is thrown. The HRESULT for the exception is 0x8004E002. The exception includes the following message: “The root transaction wanted to commit, but transaction aborted.” You find that this exception occurs only during the debugging session, and not when the components run outside of the debugger. This exception is preventing you from continuing to debug the components. You need to resolve this problem. What should you do?

A.
Remove the AutoComplete attribute from each method. Within each method implementation, add calls to
the ContextUtil.SetComplete() and
ContextUtil.SetAbort() methods.

B.
Remove the AutoComplete attribute from each method. Within each method implementation, add calls to the ContextUtil.MyTransactionVote
and ContextUtil.DeactivateOnReturn properties.

C.
Increase the transaction timeout in the Component Services tool by using the Properties dialog box for My Computer.

D.
Replace each method implementation with the following code segment:
try {
// Existing method body goes here.
}
finally {
ContextUtil.SetComplete();
}



Leave a Reply 0

Your email address will not be published. Required fields are marked *