Browse Source

Fix cancellation.

Closes #303; closes #313.
pull/320/merge
Daniel Grunwald 13 years ago
parent
commit
ba80bb0089
  1. 2
      ILSpy.BamlDecompiler/BamlResourceEntryNode.cs
  2. 2
      ILSpy/Commands/DecompileAllCommand.cs
  3. 26
      ILSpy/TextView/DecompilerTextView.cs
  4. 2
      ILSpy/TreeNodes/ResourceNodes/XamlResourceNode.cs
  5. 2
      ILSpy/TreeNodes/ResourceNodes/XmlResourceNode.cs

2
ILSpy.BamlDecompiler/BamlResourceEntryNode.cs

@ -39,7 +39,7 @@ namespace ILSpy.BamlDecompiler @@ -39,7 +39,7 @@ namespace ILSpy.BamlDecompiler
output.Write(ex.ToString());
}
return output;
}),
}, token),
t => textView.ShowNode(t.Result, this, highlighting)
);
return true;

2
ILSpy/Commands/DecompileAllCommand.cs

@ -61,7 +61,7 @@ namespace ICSharpCode.ILSpy @@ -61,7 +61,7 @@ namespace ICSharpCode.ILSpy
}
});
return output;
}), task => MainWindow.Instance.TextView.ShowText(task.Result));
}, ct), task => MainWindow.Instance.TextView.ShowText(task.Result));
}
}
}

26
ILSpy/TextView/DecompilerTextView.cs

@ -261,7 +261,13 @@ namespace ICSharpCode.ILSpy.TextView @@ -261,7 +261,13 @@ namespace ICSharpCode.ILSpy.TextView
if (currentCancellationTokenSource == myCancellationTokenSource) {
currentCancellationTokenSource = null;
waitAdorner.Visibility = Visibility.Collapsed;
taskCompleted(task);
if (task.IsCanceled) {
AvalonEditTextOutput output = new AvalonEditTextOutput();
output.WriteLine("The operation was canceled.");
ShowOutput(output);
} else {
taskCompleted(task);
}
} else {
try {
task.Wait();
@ -480,8 +486,8 @@ namespace ICSharpCode.ILSpy.TextView @@ -480,8 +486,8 @@ namespace ICSharpCode.ILSpy.TextView
if (DebugInformation.CodeMappings == null || !DebugInformation.CodeMappings.ContainsKey(token))
return;
if (!DebugInformation.CodeMappings[token].GetInstructionByTokenAndOffset(ilOffset, out member, out line))
return;
if (!DebugInformation.CodeMappings[token].GetInstructionByTokenAndOffset(ilOffset, out member, out line))
return;
// update marker
DebuggerService.JumpToCurrentLine(member, line, 0, line, 0, ilOffset);
@ -520,10 +526,12 @@ namespace ICSharpCode.ILSpy.TextView @@ -520,10 +526,12 @@ namespace ICSharpCode.ILSpy.TextView
DecompileNodes(context, textOutput);
textOutput.PrepareDocument();
tcs.SetResult(textOutput);
} catch (AggregateException ex) {
} catch (OutputLengthExceededException ex) {
tcs.SetException(ex);
} catch (OperationCanceledException ex) {
} catch (AggregateException ex) {
tcs.SetException(ex);
} catch (OperationCanceledException) {
tcs.SetCanceled();
}
} else
#endif
@ -534,6 +542,8 @@ namespace ICSharpCode.ILSpy.TextView @@ -534,6 +542,8 @@ namespace ICSharpCode.ILSpy.TextView
DecompileNodes(context, textOutput);
textOutput.PrepareDocument();
tcs.SetResult(textOutput);
} catch (OperationCanceledException) {
tcs.SetCanceled();
} catch (Exception ex) {
tcs.SetException(ex);
}
@ -586,7 +596,7 @@ namespace ICSharpCode.ILSpy.TextView @@ -586,7 +596,7 @@ namespace ICSharpCode.ILSpy.TextView
output.WriteLine();
}
#endregion
#region JumpToReference
/// <summary>
/// Jumps to the definition referred to by the <see cref="ReferenceSegment"/>.
@ -717,9 +727,9 @@ namespace ICSharpCode.ILSpy.TextView @@ -717,9 +727,9 @@ namespace ICSharpCode.ILSpy.TextView
output.AddButton(null, "Open Explorer", delegate { Process.Start("explorer", "/select,\"" + fileName + "\""); });
output.WriteLine();
tcs.SetResult(output);
#if DEBUG
} catch (OperationCanceledException ex) {
tcs.SetException(ex);
tcs.SetCanceled();
#if DEBUG
} catch (AggregateException ex) {
tcs.SetException(ex);
#else

2
ILSpy/TreeNodes/ResourceNodes/XamlResourceNode.cs

@ -73,7 +73,7 @@ namespace ICSharpCode.ILSpy.Xaml @@ -73,7 +73,7 @@ namespace ICSharpCode.ILSpy.Xaml
output.Write(ex.ToString());
}
return output;
}),
}, token),
t => textView.ShowNode(t.Result, this, highlighting)
);
return true;

2
ILSpy/TreeNodes/ResourceNodes/XmlResourceNode.cs

@ -101,7 +101,7 @@ namespace ICSharpCode.ILSpy.Xaml @@ -101,7 +101,7 @@ namespace ICSharpCode.ILSpy.Xaml
output.Write(ex.ToString());
}
return output;
}),
}, token),
t => textView.ShowNode(t.Result, this, highlighting)
);
return true;

Loading…
Cancel
Save