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

[C#] fix: When streaming operation failed the exception is suppressed. #2122

Merged
merged 11 commits into from
Oct 17, 2024

Conversation

singhk97
Copy link
Collaborator

@singhk97 singhk97 commented Oct 17, 2024

Linked issues

closes: #minor

Details

Exceptions thrown in DrainQueue() are being supressed as the method runs on a worker thread and the corresponding Task is never resolved by the main thread.

With the fix, when this._queueSync is awaited in EndStream(), an exception will be thrown if the corresponding Task is faulted (i.e. an exception is thrown from DrainQueue().

Change details

  • Removed code that sets this._queueSync to null when queue is empty. This means that this._queueSync can be either null or assigned a Task at any given time.
  • If this._queueSync is not null then an additional check this._queueSync.isTaskCompleted is made to check whether DrainQueue Task has completed or not.

If streaming operation fails, the exception will be thrown:

image

Attestation Checklist

  • My code follows the style guidelines of this project

  • I have checked for/fixed spelling, linting, and other errors

  • I have commented my code for clarity

  • I have made corresponding changes to the documentation (updating the doc strings in the code is sufficient)

  • My changes generate no new warnings

  • I have added tests that validates my changes, and provides sufficient test coverage. I have tested with:

    • Local testing
    • E2E testing in Teams
  • New and existing unit tests pass locally with my changes

@singhk97 singhk97 changed the title [C#] bug: When streaming operation failed the exception is suppressed. [C#] Bug: When streaming operation failed the exception is suppressed. Oct 17, 2024
@singhk97 singhk97 changed the title [C#] Bug: When streaming operation failed the exception is suppressed. [C#] fix: When streaming operation failed the exception is suppressed. Oct 17, 2024
@singhk97 singhk97 merged commit a56fec2 into dotnet-dev Oct 17, 2024
16 of 18 checks passed
@singhk97 singhk97 deleted the kavin/c#-o1 branch October 17, 2024 21:37
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.

2 participants