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

Unobserved task exception bugfix #254

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

darxis
Copy link

@darxis darxis commented Oct 24, 2024

This PR fixes issue #253

When calling SqlTableDependency<T>.Stop() method an UnobservedTaskException event is raised, which is not supposed to happen as an application with ThrowUnobservedTaskExceptions set to true would crash when this happens.

This PR removes the redundant call to .WithException(cancellationToken) inside the SqlTableDependency<T>.WaitForNotifications method. It is not needed because the cancellationToken is already passed to the sqlCommand.ExecuteReaderAsync method. When .WithException(cancellationToken) is called and the Stop() method requests a cancellation then the internal task returned from the sqlCommand.ExecuteReaderAsync is not awaited at all (because the internal task created within .WithException(cancellationToken) executes (fails due to cancellation) first.

A test case is also included.

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

Successfully merging this pull request may close these issues.

1 participant