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

Add JsonRpcTargetOptions.DisposeOnDisconnect #450

Merged
merged 2 commits into from
Apr 7, 2020
Merged

Conversation

AArnott
Copy link
Member

@AArnott AArnott commented Apr 6, 2020

Closes #448

@AArnott AArnott added this to the v2.4 milestone Apr 6, 2020
@AArnott AArnott self-assigned this Apr 6, 2020
@codecov-io
Copy link

codecov-io commented Apr 6, 2020

Codecov Report

Merging #450 into v2.4 will decrease coverage by 0.02%.
The diff coverage is 88.37%.

Impacted file tree graph

@@            Coverage Diff             @@
##             v2.4     #450      +/-   ##
==========================================
- Coverage   90.54%   90.51%   -0.03%     
==========================================
  Files          49       49              
  Lines        3732     3752      +20     
==========================================
+ Hits         3379     3396      +17     
- Misses        353      356       +3     
Impacted Files Coverage Δ
src/StreamJsonRpc/JsonRpc.cs 92.78% <88.09%> (-0.20%) ⬇️
src/StreamJsonRpc/JsonRpcTargetOptions.cs 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1f7179f...cabb80f. Read the comment docs.

}
else if (target is IDisposable disposableTarget)
{
this.Disconnected += (s, e) => disposableTarget.Dispose();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we forget the async tasks, does it change the exception behavior between sync/async dispose cases? I don't remember what happens if you have a Task returning async method but don't await the task.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They just get dropped on the floor. However in retrospect I guess we could report any exceptions in the JsonRpc.Completion Task.

Also invoke target.Dispose on its SynchronizationContext.
@AArnott AArnott merged commit 4f2f3ac into microsoft:v2.4 Apr 7, 2020
@AArnott AArnott deleted the fix448 branch April 7, 2020 00:00
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.

5 participants