Skip to content
Open
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
14 changes: 12 additions & 2 deletions ILSpy/Commands/FileCommands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ namespace ICSharpCode.ILSpy.Commands
[method: ImportingConstructor]
sealed class OpenCommand(AssemblyTreeModel assemblyTreeModel) : SimpleCommand
{
public override async void Execute(object? parameter)
public override void Execute(object? parameter)
{
// Tests / scripted callers can pass paths directly and bypass the file picker.
if (parameter is string singlePath)
Expand All @@ -59,6 +59,11 @@ public override async void Execute(object? parameter)
return;
}

ExecuteAsync().HandleExceptions();
}

async Task ExecuteAsync()
{
var owner = UiContext.MainWindow;
if (owner == null)
return;
Expand Down Expand Up @@ -236,7 +241,12 @@ internal sealed class SaveCommand(
public override bool CanExecute(object? parameter)
=> assemblyTreeModel.SelectedItem is ILSpyTreeNode;

public override async void Execute(object? parameter)
public override void Execute(object? parameter)
{
ExecuteAsync().HandleExceptions();
}

async Task ExecuteAsync()
{
// Several selected assemblies export a Visual Studio solution (one project each),
// matching the Save Code context-menu entry.
Expand Down
7 changes: 6 additions & 1 deletion ILSpy/TreeNodes/AssemblyTreeNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -675,7 +675,12 @@ public bool IsVisible(TextViewContext context)

public bool IsEnabled(TextViewContext context) => true;

public async void Execute(TextViewContext context)
public void Execute(TextViewContext context)
{
ExecuteAsync(context).HandleExceptions();
}

async Task ExecuteAsync(TextViewContext context)
{
if (context.SelectedTreeNodes == null)
return;
Expand Down