Elad Benda
Elad Benda

Reputation: 36654

System.Exception._COMPlusExceptionCode when running within transactionScope

I'm trying to call a DB sp I wrote

from within c# transactionScope

public static void RunInTransaction(Action logic)
{
    var options = new TransactionOptions { IsolationLevel = IsolationLevel.ReadCommitted };
    using (var transaction = new TransactionScope(TransactionScopeOption.RequiresNew, options))
    {
        logic();
        transaction.Complete();
    }
}

where logic is actually calling the sp from c#.

And I get the following error:

System.Exception._COMPlusExceptionCode

Upvotes: 1

Views: 21766

Answers (2)

erdal tosun
erdal tosun

Reputation: 11

Sql Servis kapalı. bilgisayar hizmetler bölümünde Sql service > start etmelisiniz

google translate:Sql service is off. Sql service> in the computer services section should start

Upvotes: 0

ruspava
ruspava

Reputation: 46

Seems weird but might be related: If you have the following piece of code:

private static readonly RegexPattern = "...";

and that pattern is invalid (mine was missing a parenthesis), then you generate COMPlusExceptionCode-exceptions when the containing class if initially loaded. (I managed this and I'm not even touching a database)

Upvotes: 3

Related Questions