Skip to content

Commit 86a2b7b

Browse files
committed
Readded async symbol loading.
1 parent a1311c5 commit 86a2b7b

File tree

8 files changed

+158
-277
lines changed

8 files changed

+158
-277
lines changed

Forms/MainForm.cs

Lines changed: 52 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System;
2+
using System.Collections.Generic;
23
using System.Diagnostics.Contracts;
34
using System.Drawing;
45
using System.IO;
@@ -108,14 +109,29 @@ private async void MainForm_FormClosing(object sender, FormClosingEventArgs e)
108109
if (loadSymbolsTask != null)
109110
{
110111
loadSymbolsTaskToken.Cancel();
111-
await loadSymbolsTask;
112+
113+
try
114+
{
115+
await loadSymbolsTask;
116+
}
117+
catch
118+
{
119+
120+
}
112121

113122
loadSymbolsTask = null;
114123
}
115124

116125
if (updateProcessInformationsTask != null)
117126
{
118-
await updateProcessInformationsTask;
127+
try
128+
{
129+
await updateProcessInformationsTask;
130+
}
131+
catch
132+
{
133+
134+
}
119135

120136
updateProcessInformationsTask = null;
121137
}
@@ -436,11 +452,20 @@ private void MainForm_DragDrop(object sender, DragEventArgs e)
436452
}
437453
}
438454

439-
private void processUpdateTimer_Tick(object sender, EventArgs e)
455+
private async void processUpdateTimer_Tick(object sender, EventArgs e)
440456
{
441457
if (updateProcessInformationsTask == null || updateProcessInformationsTask.IsCompleted)
442458
{
443-
updateProcessInformationsTask = remoteProcess.UpdateProcessInformationsAsync();
459+
try
460+
{
461+
updateProcessInformationsTask = remoteProcess.UpdateProcessInformationsAsync();
462+
463+
await updateProcessInformationsTask;
464+
}
465+
catch
466+
{
467+
468+
}
444469
}
445470
}
446471

@@ -626,29 +651,38 @@ private void LoadFileFromPath(string filePath, ref ReClassNetProject project)
626651
}
627652
}
628653

629-
private void LoadAllSymbolsForCurrentProcess()
654+
/// <summary>Loads all symbols for the current process and displays the progress status.</summary>
655+
private async void LoadAllSymbolsForCurrentProcess()
630656
{
631-
var progressDialog = new SymbolReaderProgressForm();
632-
progressDialog.Show(this);
657+
if (loadSymbolsTask != null && !loadSymbolsTask.IsCompleted)
658+
{
659+
return;
660+
}
633661

634-
Enabled = false;
662+
infoToolStripStatusLabel.Visible = true;
635663

636664
int index = 0;
637-
remoteProcess.LoadAllSymbols((current, modules) =>
638-
{
639-
progressDialog.ProgressMaximum = modules.Count();
640-
progressDialog.ProgressValue = ++index;
641665

642-
progressDialog.ProgressText = $"[{progressDialog.ProgressValue}/{progressDialog.ProgressMaximum}] {current.Name}";
666+
var progress = new Progress<Tuple<RemoteProcess.Module, IEnumerable<RemoteProcess.Module>>>(
667+
report =>
668+
{
669+
infoToolStripStatusLabel.Text = $"[{++index}/{report.Item2.Count()}] Loading symbols for module: {report.Item1.Name}";
670+
}
671+
);
643672

644-
Application.DoEvents();
673+
loadSymbolsTaskToken = new CancellationTokenSource();
674+
loadSymbolsTask = remoteProcess.LoadAllSymbolsAsync(progress, loadSymbolsTaskToken.Token);
645675

646-
return true;
647-
});
676+
try
677+
{
678+
await loadSymbolsTask;
679+
}
680+
catch
681+
{
648682

649-
Enabled = true;
683+
}
650684

651-
progressDialog.Close();
685+
infoToolStripStatusLabel.Visible = false;
652686
}
653687
}
654688
}

Forms/SymbolReaderProgressForm.Designer.cs

Lines changed: 0 additions & 75 deletions
This file was deleted.

Forms/SymbolReaderProgressForm.cs

Lines changed: 0 additions & 30 deletions
This file was deleted.

Forms/SymbolReaderProgressForm.resx

Lines changed: 0 additions & 120 deletions
This file was deleted.

0 commit comments

Comments
 (0)