Skip to content

Violation of pairing using methods "BeginTransaction()" & "CommitTransaction()" / "RollbackTransaction()" (PairingBrokenTransaction)

Type Scope Severity Activated
by default
Minutes
to fix
Tags
Error BSL
OS
Major Yes 15 standard

Description

Beginning of transaction and it's committing (rollback) have to be executed withing context of the same method.

Examples

Correct

Procedure WriteDataToIB()

    StartTransaction();

    Try
        ... // read or write data
        DocumentObject.Write()
        CommitTransaction();
    Raise
        RollbackTransaction();
        ... // additional steps to handle the exception
    EndTry;

EndProcedure

Incorrect

Procedure WriteDataToIB()

    StartTransaction();
    WriteDocument();

EndProcedure;

Procedure WriteDocument()

    Try
        ... // read or write data
        DocumentObject.Write()
        CommitTransaction();
    Raise
        RollbackTransaction();
        ... // additional steps to handle the exception
    EndTry;

EndProcedure

Sources

Snippets

Diagnostic ignorance in code

// BSLLS:PairingBrokenTransaction-off
// BSLLS:PairingBrokenTransaction-on

Parameter for config

"PairingBrokenTransaction": false