dotnet / dotnet/dotnet-api-docs

Clarification of exception thrown in transaction scope.

Offen
#984 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
area-System.Transactions dotnet-api/prod Pri2 untriaged
Vorherrschende Sprache
C#
Sterne
949
Forks
1.7k
Ø Merge
2 T. 19 Std.
Gemergte PRs (30 T.)
52

Beschreibung

"If no exception occurs within the transaction scope (that is, between the initialization of the TransactionScope object and the calling of its Dispose method), then the transaction in which the scope participates is allowed to proceed. If an exception does occur within the transaction scope, the transaction in which it participates will be rolled back."

Is this intended to mean to rollback you need to exit the transaction scope by an exception and not call scope.Complete()? What about handling the exception within the scope, choosing not to rethrow the exception, and then choosing not to call scope.Complete()? I would expect the transaction to rollback in this case since scope.Complete() was not called but it sounds like it might complete anyway. Which would explain the weird behavior I am having.

---
#### Document Details

⚠ *Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.*

* ID: 039bbc8a-f665-3797-ff12-96cd21682bf3
* Version Independent ID: bbae7fa8-00f9-08dd-d816-ba21092f9df8
* Content: [TransactionScope Class (System.Transactions)](https://docs.microsoft.com/en-us/dotnet/api/system.transactions.transactionscope?view=netframework-4.7.2)
* Content Source: [xml/System.Transactions/TransactionScope.xml](https://github.com/dotnet/dotnet-api-docs/blob/master/xml/System.Transactions/TransactionScope.xml)
* Product: **dotnet-api**
* GitHub Login: @dotnet-bot
* Microsoft Alias: **dotnetcontent**

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Beginne mit xml/System.Transactions/TransactionScope.xml und der verknüpften Dokumentation zur TransactionScope Class. Überprüfe die Formulierung zum Transaktionsbereich und die umgebende Dokumentation hinsichtlich des Verhaltens, wenn eine Ausnahme behandelt wird und Complete() nicht aufgerufen wird. Als abgeschlossen gilt die Aufgabe, wenn die Dokumentation die gemeldete Unklarheit eindeutig beantwortet, ohne das API-Verhalten zu ändern.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
csharp
Bereich
documentation
Issue-Typ
Dokumentation
Schwierigkeit
2/5
Geschätzter Aufwand
1-3 Stunden
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
38/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.