dotnet / dotnet/dotnet-api-docs

Clarification of exception thrown in transaction scope.

Aperta
#984 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
area-System.Transactions dotnet-api/prod Pri2 untriaged
Lingua principale
C#
Stelle
949
Fork
1.7k
Merge medio
2g 19h
PR unite (30g)
52

Descrizione

"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**

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Inizia da xml/System.Transactions/TransactionScope.xml e dalla documentazione collegata di TransactionScope Class. Esamina la formulazione relativa all'ambito della transazione e la documentazione circostante per il comportamento quando un'eccezione viene gestita e Complete() non viene chiamato. Il lavoro è completato quando la documentazione risponde chiaramente all'ambiguità segnalata senza modificare il comportamento dell'API.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
csharp
Ambito
documentation
Tipo di issue
Documentazione
Difficoltà
2/5
Tempo stimato
1-3 ore
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
38/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.