-
Notifications
You must be signed in to change notification settings - Fork 357
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 DiagnosticsClientConnector to support creating a DiagnosticsClient from a diagnostic port #5073
base: main
Are you sure you want to change the base?
Conversation
I will try to add a test if this fix is accepted. Question: Where should I add it in |
This introduces a breaking change at compile time for those that have the CA2000 or CA2213 rules enabled. These are commonly enabled. This change would force everyone who have these rules enabled to dispose the client, regardless of if the disposal is really necessary. This also will be problematic for tools that use the ReverseDiagnosticServer for more than one connection or more than one process at the same time e.g. dotnet-monitor. IIRC, the original intent of the client is for it to be transiently used and should not manage the state of other components. It should be useable and then "tossable" without affecting the state of the server component. Finally, I'm not a proponent of having unused files within classes like this because it creates ambiguity throughout the class as to whether it being null or not is valid for invocations of any of the methods. It will potentially lead to other bugs down the road as more changes are added that may depend on the field. I would recommend revisiting the design of the convenience method that was added rather than changing the behavior of the client. I'm not on the .NET Diagnostics team, so I don't have the ultimate say on these changes. However, I do work on a partner team that relies heavily on this library for the tools that we build e.g. dotnet-monitor. |
So, with your knowledge, based on your usage, and if you didn't have access to the internals, what would you propose? 🙂 |
6a918b2
to
b5046ef
Compare
I have changed the design from the original PR and added an entire new class |
@jander-msft What do you think of his last changes? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This makes more sense to me. It decouples reverse server lifetime from the client as @jander-msft had requested.
@jander-msft do you have any more feedback? Otherwise I'll get this in this week |
Followup of #5070 that introduced a non-viable approach (Comment #5070 (comment))
This PR adds
DiagnosticsClientConnector
that isIAsyncDisposable
and offers the methodFromDiagnosticPort
.