Skip to content

Commit

Permalink
Handle non-integer stack trace line numbers in .NET
Browse files Browse the repository at this point in the history
The .NET bindings assumed that the stack trace elements in the wire
protocol would have line numbers that were integers, as specified in the
OSS-dialect of the protocol. This is not necessarily the case, and we need
to be a little more forgiving.

Fixes issue #2774.
  • Loading branch information
jimevans committed Sep 15, 2016
1 parent 37c2630 commit 60766a0
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion dotnet/src/webdriver/Remote/StackTraceElement.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,11 @@ public StackTraceElement(Dictionary<string, object> elementAttributes)

if (elementAttributes.ContainsKey("lineNumber"))
{
this.lineNumber = Convert.ToInt32(elementAttributes["lineNumber"], CultureInfo.InvariantCulture);
int line = 0;
if (int.TryParse(elementAttributes["lineNumber"].ToString(), out line))
{
this.lineNumber = line;
}
}

if (elementAttributes.ContainsKey("fileName") && elementAttributes["fileName"] != null)
Expand Down

0 comments on commit 60766a0

Please sign in to comment.