Browse Source

Throw exceptions when something goes wrong.

Some renames.
pull/191/merge
Eusebiu Marcu 15 years ago
parent
commit
887aa424c4
  1. 6
      Debugger/ILSpy.Debugger/Services/Debugger/WindowsDebugger.cs
  2. 12
      ICSharpCode.Decompiler/CodeMappings.cs
  3. 8
      ILSpy/Commands/DebuggerCommands.cs

6
Debugger/ILSpy.Debugger/Services/Debugger/WindowsDebugger.cs

@ -858,7 +858,7 @@ namespace ILSpy.Debugger.Services @@ -858,7 +858,7 @@ namespace ILSpy.Debugger.Services
string fullName = debugType.FullNameWithoutGenericArguments;
fullName = fullName.Replace("+", "/");
if (DebugData.LoadedAssemblies == null)
Continue();
throw new NullReferenceException("No DebugData assemblies!");
else {
// search for type in the current assembly list
TypeDefinition typeDef = null;
@ -896,11 +896,11 @@ namespace ILSpy.Debugger.Services @@ -896,11 +896,11 @@ namespace ILSpy.Debugger.Services
DebuggerService.JumpToCurrentLine(typeDef, line, 0, line, 0);
} else {
// continue since we cannot find the debugged type
StepOver();
throw new InvalidOperationException(string.Format("No mapping for {0} for token {1} and offset {2}!", fullName, token, ilOffset));
}
} else {
// continue since we cannot find the debugged type
Continue();
throw new NullReferenceException(string.Format("The type {0} was not found!", fullName));
}
}
}

12
ICSharpCode.Decompiler/CodeMappings.cs

@ -250,7 +250,7 @@ namespace ICSharpCode.Decompiler @@ -250,7 +250,7 @@ namespace ICSharpCode.Decompiler
/// Gets the source code and type name from metadata token and offset.
/// </summary>
/// <param name="codeMappings">Code mappings storage.</param>
/// <param name="currentTypeFullName">Current type name.</param>
/// <param name="typeName">Current type name.</param>
/// <param name="token">Metadata token.</param>
/// <param name="ilOffset">IL offset.</param>
/// <param name="typeName">Type definition.</param>
@ -258,7 +258,7 @@ namespace ICSharpCode.Decompiler @@ -258,7 +258,7 @@ namespace ICSharpCode.Decompiler
/// <remarks>It is possible to exist to different types from different assemblies with the same metadata token.</remarks>
public static bool GetSourceCodeFromMetadataTokenAndOffset(
this ConcurrentDictionary<string, List<MemberMapping>> codeMappings,
string currentTypeFullName,
string typeName,
uint token,
int ilOffset,
out TypeDefinition type,
@ -267,10 +267,14 @@ namespace ICSharpCode.Decompiler @@ -267,10 +267,14 @@ namespace ICSharpCode.Decompiler
type = null;
line = 0;
if (!codeMappings.ContainsKey(currentTypeFullName))
if (codeMappings == null)
throw new ArgumentNullException("CodeMappings storage must be valid!");
typeName = typeName.Replace("+", "/");
if (!codeMappings.ContainsKey(typeName))
return false;
var mapping = codeMappings[currentTypeFullName].Find(m => m.MetadataToken == token);
var mapping = codeMappings[typeName].Find(m => m.MetadataToken == token);
if (mapping == null)
return false;

8
ILSpy/Commands/DebuggerCommands.cs

@ -242,10 +242,12 @@ namespace ICSharpCode.ILSpy.Commands @@ -242,10 +242,12 @@ namespace ICSharpCode.ILSpy.Commands
{
public override void Execute(object parameter)
{
if (CurrentDebugger.IsDebugging && !CurrentDebugger.IsProcessRunning)
if (CurrentDebugger.IsDebugging && !CurrentDebugger.IsProcessRunning) {
base.Execute(null);
CurrentDebugger.StepOver();
}
}
}
[ExportMainMenuCommand(Menu = "_Debugger",
MenuIcon = "ILSpy.Debugger;component/Images/StepOut.png",
@ -257,10 +259,12 @@ namespace ICSharpCode.ILSpy.Commands @@ -257,10 +259,12 @@ namespace ICSharpCode.ILSpy.Commands
{
public override void Execute(object parameter)
{
if (CurrentDebugger.IsDebugging && !CurrentDebugger.IsProcessRunning)
if (CurrentDebugger.IsDebugging && !CurrentDebugger.IsProcessRunning) {
base.Execute(null);
CurrentDebugger.StepOut();
}
}
}
[ExportMainMenuCommand(Menu = "_Debugger",
MenuCategory = "Debugger1",

Loading…
Cancel
Save