Skip to content

Commit

Permalink
Fix crashes introduced by d15808. (#71)
Browse files Browse the repository at this point in the history
This adds a simple title to every dialog to prevent crashes.
  • Loading branch information
AaronDewes authored Jun 15, 2021
1 parent cca54c4 commit 3cc092b
Show file tree
Hide file tree
Showing 13 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions ILSpy.Core/Commands/GeneratePdbContextMenuEntry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ internal static async void GeneratePdbForAssembly(LoadedAssembly assembly)
return;
}
SaveFileDialog dlg = new SaveFileDialog();
dlg.Title = "Save file";
dlg.InitialFileName = DecompilerTextView.CleanUpName(assembly.ShortName) + ".pdb";
dlg.Filters = new List<FileDialogFilter> { new FileDialogFilter { Name = "Portable PDB", Extensions = { "pdb" } }, new FileDialogFilter { Name = "All files", Extensions = { "*" } } };
dlg.Directory = Path.GetDirectoryName(assembly.FileName);
Expand Down
1 change: 1 addition & 0 deletions ILSpy.Core/Commands/OpenFromNuGetCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ sealed class OpenFromNuGetCommand : SimpleCommand
public override async void Execute(object parameter)
{
OpenFileDialog dlg = new OpenFileDialog();
dlg.Title = "Open file";
dlg.Directory = NuGetEnvironment.GetFolderPath(NuGetFolderPath.NuGetHome);
dlg.Filters = new List<FileDialogFilter>()
{
Expand Down
1 change: 1 addition & 0 deletions ILSpy.Core/Commands/OpenListCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ sealed class OpenListCommand : SimpleCommand
public override async void Execute(object parameter)
{
OpenListDialog dlg = new OpenListDialog();
dlg.Title = "Open List";
if (await dlg.ShowDialog<bool>(MainWindow.Instance) == true)
MainWindow.Instance.ShowAssemblyList(dlg.SelectedListName);
}
Expand Down
1 change: 1 addition & 0 deletions ILSpy.Core/Commands/SaveCodeContextMenuEntry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ public static async Task Execute(IReadOnlyList<SharpTreeNode> selectedNodes)
static async Task<string> SelectSolutionFile()
{
SaveFileDialog dlg = new SaveFileDialog();
dlg.Title = "Save file";
dlg.InitialFileName = "Solution.sln";
dlg.Filters = new List<FileDialogFilter>()
{
Expand Down
1 change: 1 addition & 0 deletions ILSpy.Core/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1094,6 +1094,7 @@ async void OpenCommandExecuted(object sender, ExecutedRoutedEventArgs e)
{
e.Handled = true;
OpenFileDialog dlg = new OpenFileDialog();
dlg.Title = "Open file";
dlg.Filters = new List<FileDialogFilter>()
{
new FileDialogFilter() { Name = ".NET assemblies", Extensions = {"dll","exe", "winmd" }},
Expand Down
1 change: 1 addition & 0 deletions ILSpy.Core/OpenListDialog.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ private void AddToList(AssemblyList list, string name)
private async void CreateButton_Click(object sender, RoutedEventArgs e)
{
CreateListDialog dlg = new CreateListDialog();
dlg.Title = "Create List";
dlg.Closing += (s, args) =>
{
if (dlg.DialogResult == true)
Expand Down
1 change: 1 addition & 0 deletions ILSpy.Core/Options/OptionsDialog.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ sealed class ShowOptionsCommand : SimpleCommand
public override async void Execute(object parameter)
{
OptionsDialog dlg = new OptionsDialog();
dlg.Title = "Options";
if (await dlg.ShowDialog<bool>(MainWindow.Instance) == true) {
new RefreshCommand().Execute(parameter);
}
Expand Down
1 change: 1 addition & 0 deletions ILSpy.Core/TextView/DecompilerTextView.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -686,6 +686,7 @@ public async void SaveToDisk(Language language, IEnumerable<ILSpyTreeNode> treeN
return;

SaveFileDialog dlg = new SaveFileDialog();
dlg.Title = "Save file";
dlg.DefaultExtension = language.FileExtension;
dlg.Filters = new List<FileDialogFilter>()
{
Expand Down
1 change: 1 addition & 0 deletions ILSpy.Core/TreeNodes/AssemblyTreeNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,7 @@ public override async Task<bool> Save(DecompilerTextView textView)
if (string.IsNullOrEmpty(language.ProjectFileExtension))
return false;
SaveFileDialog dlg = new SaveFileDialog();
dlg.Title = "Save file";
dlg.InitialFileName = DecompilerTextView.CleanUpName(LoadedAssembly.ShortName);
dlg.Filters = new List<FileDialogFilter>()
{
Expand Down
1 change: 1 addition & 0 deletions ILSpy.Core/TreeNodes/ResourceNodes/ResourceEntryNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ public override void Decompile(Language language, ITextOutput output, Decompilat
public override async Task<bool> Save(DecompilerTextView textView)
{
SaveFileDialog dlg = new SaveFileDialog();
dlg.Title = "Save file";
dlg.InitialFileName = Path.GetFileName(DecompilerTextView.CleanUpName(key));
var filename = await dlg.ShowAsync(App.Current.GetMainWindow());
if (!string.IsNullOrEmpty(filename)) {
Expand Down
1 change: 1 addition & 0 deletions ILSpy.Core/TreeNodes/ResourceNodes/ResourceTreeNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ public override async Task<bool> Save(DecompilerTextView textView)
if (s == null)
return false;
SaveFileDialog dlg = new SaveFileDialog();
dlg.Title = "Save file";
dlg.InitialFileName = DecompilerTextView.CleanUpName(Resource.Name);
var filename = await dlg.ShowAsync(App.Current.GetMainWindow());
if (!string.IsNullOrEmpty(filename))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ public override async Task<bool> Save(DecompilerTextView textView)
Stream s = Resource.TryOpenStream();
if (s == null) return false;
SaveFileDialog dlg = new SaveFileDialog();
dlg.Title = "Save file";
dlg.InitialFileName = DecompilerTextView.CleanUpName(Resource.Name);
dlg.Filters = new List<FileDialogFilter>()
{
Expand Down
1 change: 1 addition & 0 deletions TestPlugin/ContextMenuCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public void Execute(TextViewContext context)
var asm = node.LoadedAssembly.GetPEFileOrNull();
if (asm != null) {
/*SaveFileDialog dlg = new SaveFileDialog();
dlg.Title = "Save file";
dlg.FileName = node.LoadedAssembly.FileName;
dlg.Filter = "Assembly|*.dll;*.exe";
if (dlg.ShowDialog(MainWindow.Instance) == true) {
Expand Down

0 comments on commit 3cc092b

Please sign in to comment.