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

Fixes #613. #614

Merged
merged 1 commit into from
Oct 31, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ public void ConnectTo(string url)
{
Url = url;

if (url == null)
Copy link
Member

Choose a reason for hiding this comment

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

Would it be better to throw an exception in this case? I guess we're fixing the problem at the call site below?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Don't think so. This is called on application start as well which means if an exception is thrown the app will crash.

Copy link
Member

Choose a reason for hiding this comment

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

The only usages I see are

The code smell I'm detecting is the setting of the Url property to null and then avoiding the clearing of controls, refreshing etc. when that is the case. I guess the overall question is: does the behaviour of this method make sense when the passed in URL is null, in the context of the expectation of all consumers of this type?

{
return;
}

AsyncPump.Run(async () =>
{
await serviceControl.ClearServiceControls();
Expand Down
2 changes: 1 addition & 1 deletion src/ServiceInsight/Shell/ShellViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ protected override void OnInitialize()
using (workNotifer.NotifyOfWork("Trying to connect to ServiceControl"))
{
connectionProvider.ConnectTo(configuredConnection);
if (!serviceControl.IsAlive())
if (!serviceControl.IsAlive() && existingConnection != null)
{
connectionProvider.ConnectTo(existingConnection);
}
Expand Down