[Mono-bugs] [Bug 641439] New: System.Diagnostics.StackFrame.GetFileLineNumber is returning the incorrect line number
bugzilla_noreply at novell.com
bugzilla_noreply at novell.com
Thu Sep 23 13:16:43 EDT 2010
https://bugzilla.novell.com/show_bug.cgi?id=641439
https://bugzilla.novell.com/show_bug.cgi?id=641439#c0
Summary: System.Diagnostics.StackFrame.GetFileLineNumber is
returning the incorrect line number
Classification: Mono
Product: Mono: Class Libraries
Version: 2.6.x
Platform: x86-64
OS/Version: Ubuntu
Status: NEW
Severity: Normal
Priority: P5 - None
Component: Sys.Core
AssignedTo: jbevain at novell.com
ReportedBy: dale.ragan at sinesignal.com
QAContact: mono-bugs at lists.ximian.com
Found By: ---
Blocker: ---
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US)
AppleWebKit/534.3 (KHTML, like Gecko) Chrome/6.0.472.62 Safari/534.3
I have a case where System.Diagnostics.StackFrame.GetFileLineNumber is
returning the incorrect line number. The value is off by one.
You can use my fork of the project as a test case:
http://github.com/sinesignal/shouldly
Reproducible: Always
Steps to Reproduce:
1. Clone the project I listed in the details. Commit:
8552fb5d30eee69b7fc90e7fac1dde03d58486dd
2. Compile and Run the tests.
3. Tests.ShoudlyMessageTests.CanGenerateErrorMessage will fail.
Actual Results:
Tests.ShoudlyMessageTests.CanGenerateErrorMessage failed due to
System.Diagnostics.StackFrame.GetFileLineNumber returning the wrong line
number. Under .NET the test passes and a line number of 13 is returned by the
call. Under Mono the test fails and a line number of 14 is returned by the
call.
The call stack is as follows:
new ShouldlyMessage("expected", "actual")
ShouldlyMessage.ToString()
ShouldlyMessage.GenerateShouldMessage(actual, expected)
ShouldlyMessage.GetStackFrameForOriginatingTestMethod() <- Inside this method
is the call to System.Diagnostics.StackFrame.GetFileLineNumber
Expected Results:
The test to pass without any modifications.
For a work around, I am changing the
Tests.ShoudlyMessageTests.CanGenerateErrorMessage test to this:
var result = new ShouldlyMessage("expected", "actual").ToString();
result.ShouldBe(@" var result = new
ShouldlyMessage(""expected"", ""actual"").ToString();
can generate error message
""expected""
but was
""actual""");
--
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
More information about the mono-bugs
mailing list