Skip to content

Commit 60766a0

Browse files
committed
Handle non-integer stack trace line numbers in .NET
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.
1 parent 37c2630 commit 60766a0

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

dotnet/src/webdriver/Remote/StackTraceElement.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,11 @@ public StackTraceElement(Dictionary<string, object> elementAttributes)
6060

6161
if (elementAttributes.ContainsKey("lineNumber"))
6262
{
63-
this.lineNumber = Convert.ToInt32(elementAttributes["lineNumber"], CultureInfo.InvariantCulture);
63+
int line = 0;
64+
if (int.TryParse(elementAttributes["lineNumber"].ToString(), out line))
65+
{
66+
this.lineNumber = line;
67+
}
6468
}
6569

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

0 commit comments

Comments
 (0)