Browse Source

Help UDC identifying the location of the bug for AvalonEdit ArgumentOutOfRangeExceptions.

pull/14/head
Daniel Grunwald 15 years ago
parent
commit
73ea786721
  1. 14
      src/Main/Base/Project/Src/Editor/AvalonEdit/AvalonEditDocumentAdapter.cs

14
src/Main/Base/Project/Src/Editor/AvalonEdit/AvalonEditDocumentAdapter.cs

@ -112,12 +112,22 @@ namespace ICSharpCode.SharpDevelop.Editor.AvalonEdit
public int PositionToOffset(int line, int column) public int PositionToOffset(int line, int column)
{ {
return document.GetOffset(new TextLocation(line, column)); try {
return document.GetOffset(new TextLocation(line, column));
} catch (ArgumentOutOfRangeException e) {
// for UDC: re-throw exception so that stack trace identifies the caller (instead of the adapter)
throw new ArgumentOutOfRangeException(e.ParamName, e.ActualValue, e.Message);
}
} }
public Location OffsetToPosition(int offset) public Location OffsetToPosition(int offset)
{ {
return ToLocation(document.GetLocation(offset)); try {
return ToLocation(document.GetLocation(offset));
} catch (ArgumentOutOfRangeException e) {
// for UDC: re-throw exception so that stack trace identifies the caller (instead of the adapter)
throw new ArgumentOutOfRangeException(e.ParamName, e.ActualValue, e.Message);
}
} }
public static Location ToLocation(TextLocation position) public static Location ToLocation(TextLocation position)

Loading…
Cancel
Save