Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue Report: Transaction Conflict in EF Core Migration Process #2536

Open
Buutyful opened this issue Feb 2, 2025 · 0 comments
Open

Issue Report: Transaction Conflict in EF Core Migration Process #2536

Buutyful opened this issue Feb 2, 2025 · 0 comments
Labels
⌚ Not Triaged Not triaged

Comments

@Buutyful
Copy link

Buutyful commented Feb 2, 2025

Describe the issue or suggestion

https://github.com/dotnet/docs-aspire/blob/d94e59ddf76e1cc5f3e7b1b025f809a4de823a25/docs/database/ef-core-migrations.md
Exception:
System.NotSupportedException: 'User transaction is not supported with a TransactionSuppressed migrations or a retrying execution strategy.'

Context:
Attempting to apply database migrations using a worker service in a .NET Aspire application with PostgreSQL and EF Core 9.0.1.

Problem Summary
The error occurred due to a conflict between two transaction management mechanisms:

Manual Transaction
Explicit transaction created via BeginTransactionAsync

EF Core Execution Strategy
Retry mechanism enabled via CreateExecutionStrategy()

These two approaches cannot coexist when performing migrations, as they create conflicting transaction contexts.

The way I run the code on my application:

Image

@dotnetrepoman dotnetrepoman bot added the ⌚ Not Triaged Not triaged label Feb 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
⌚ Not Triaged Not triaged
Projects
None yet
Development

No branches or pull requests

1 participant