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

CsvWriter.WriteRecordsAsync does not dispose e.g. EF Core AsyncEnumerators #2264

Open
CaringDev opened this issue Jun 11, 2024 · 1 comment · May be fixed by #2265 or #2297
Open

CsvWriter.WriteRecordsAsync does not dispose e.g. EF Core AsyncEnumerators #2264

CaringDev opened this issue Jun 11, 2024 · 1 comment · May be fixed by #2265 or #2297
Labels

Comments

@CaringDev
Copy link

The CsvWriter.WriteRecordsAsync overload for IAsyncEnumerable<T> creates an IAsyncEnumerator but does not dispose implementations not implementing IDisposable. When using EF Core with streaming results this leads to concurrent queries on the same DbContext. As this is not allowed e.g. for Postgres a Npgsql.NpgsqlOperationInProgressException is thrown on subsequent operations.
As IAsyncEnumerator implements IAsyncDisposable we should unconditionally await DisposeAsync.

@CaringDev CaringDev added the bug label Jun 11, 2024
@CaringDev CaringDev linked a pull request Jun 11, 2024 that will close this issue
@vchirikov
Copy link

Oh, didn't see the issue, my PR for this is #2297

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
2 participants