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

chore: Avoid duplicated logs and prevent error bubbling (backport #18746) #18756

Closed
Closed
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
56 changes: 54 additions & 2 deletions src/Uno.UI.RemoteControl.VS/EntryPoint.cs
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,7 @@ async Task RestartAsync()
}
}

<<<<<<< HEAD
private async Task OnMessageReceivedAsync(object? sender, NotificationRequestIdeMessage message)
{
try
Expand Down Expand Up @@ -476,12 +477,63 @@ private async Task OnAddMenuItemRequestIdeMessageAsync(object? sender, AddMenuIt
else
{
_unoMenuCommand = await UnoMenuCommand.InitializeAsync(_asyncPackage, _ideChannelClient, cr);
=======
private async Task OnMessageReceivedAsync(object? sender, IdeMessage devServerMessage)
{
try
{
switch (devServerMessage)
{
case AddMenuItemRequestIdeMessage amir:
await OnAddMenuItemRequestedAsync(sender, amir);
break;
case ForceHotReloadIdeMessage fhr:
await OnForceHotReloadRequestedAsync(sender, fhr);
break;
case NotificationRequestIdeMessage nr:
await OnNotificationRequestedAsync(sender, nr);
break;
default:
_debugAction?.Invoke($"Unknown message type {devServerMessage?.GetType()} from DevServer");
break;
>>>>>>> 9e38c7a321 (chore: Avoid duplicated logs and prevent error bubbling)
}
}
catch (Exception e)
{
_debugAction?.Invoke($"Using AddMenuItem Ide Message Requested fail {e.Message}");
throw;
_debugAction?.Invoke($"Failed to handle IdeMessage with message {e.Message}");
}
}

private async Task OnNotificationRequestedAsync(object? sender, NotificationRequestIdeMessage message)
{
await _asyncPackage.JoinableTaskFactory.SwitchToMainThreadAsync();

if (await _asyncPackage.GetServiceAsync(typeof(SVsShell)) is IVsShell shell &&
await _asyncPackage.GetServiceAsync(typeof(SVsInfoBarUIFactory)) is IVsInfoBarUIFactory infoBarFactory)
{
await CreateInfoBarAsync(message, shell, infoBarFactory);
}
}

private async Task OnAddMenuItemRequestedAsync(object? sender, AddMenuItemRequestIdeMessage cr)
{
if (_ideChannelClient == null)
{
return;
}

if (_unoMenuCommand is not null)
{
//ignore when duplicated
if (!_unoMenuCommand.CommandList.Contains(cr))
{
_unoMenuCommand.CommandList.Add(cr);
}
}
else
{
_unoMenuCommand = await UnoMenuCommand.InitializeAsync(_asyncPackage, _ideChannelClient, cr);
}
}

Expand Down
Loading