Please do not reply to this email- if you want to comment on the bug, go to the URL shown below and enter your comments there.
Changed by [EMAIL PROTECTED] http://bugzilla.ximian.com/show_bug.cgi?id=82025 --- shadow/82025 2007-07-06 19:42:43.000000000 -0400 +++ shadow/82025.tmp.2790 2007-07-06 19:42:43.000000000 -0400 @@ -0,0 +1,162 @@ +Bug#: 82025 +Product: Mono: Class Libraries +Version: 1.2 +OS: +OS Details: Linux 2.6.20-15-generic #2 SMP x86_64 GNU/Linux + +Status: NEW +Resolution: +Severity: +Priority: Normal +Component: Sys.Core +AssignedTo: [EMAIL PROTECTED] +ReportedBy: [EMAIL PROTECTED] +QAContact: [EMAIL PROTECTED] +TargetMilestone: --- +URL: +Cc: +Summary: The StackTrace.FrameCount returns 0 when called since another thread + +Description of Problem: + +The StackTrace.FrameCount getter returns 0 when it is being called from a +thread distinct from the application's main thread. + + +Steps to reproduce the problem: + Execute this code: + + +/***************************************************** + * Start code */ + +using System; +using System.Diagnostics; +using System.Threading; + + +namespace StackTraceTest +{ + public class StackTraceTest + { + public StackTraceTest() + { + MethodA(); + } + + private void MethodA() + { + MethodB(); + } + + private void MethodB() + { + StackTrace stackTrace = new StackTrace(); + Console.WriteLine("StackTrace.FrameCount: [{0}]", +stackTrace.FrameCount); + int count = stackTrace.FrameCount; + for (int i = 0; i < count; i++) + { + StackFrame auxFrame = +stackTrace.GetFrame(i); + Console.WriteLine("StackFrame: [{0}: +{1}]", i, auxFrame); + } + } + + + public static void RunTest() + { + RunFirstTest(); +Console.WriteLine("***************"); + RunSecondTest(); + } + + private static void RunFirstTest() + { + Console.WriteLine("Running first test"); + new StackTraceTest(); + } + + private static void RunSecondTest() + { + Thread thread = new Thread(new +ThreadStart(ProcessSecondTestThread)); + thread.Start(); + } + + private static void ProcessSecondTestThread() + { + Console.WriteLine("Running second test"); + new StackTraceTest(); + } + } +} + +/* End code * + ****************************************************/ + + +Actual Results: + +This is the output: + +Running first test +StackTrace.FrameCount: [6] +StackFrame: [0: MethodB at offset 0 in file:line:column <filename +unknown>:0:0] +StackFrame: [1: MethodA at offset 0 in file:line:column <filename +unknown>:0:0] +StackFrame: [2: .ctor at offset 6 in file:line:column <filename +unknown>:0:0] +StackFrame: [3: RunFirstTest at offset 10 in file:line:column <filename +unknown>:0:0] +StackFrame: [4: RunTest at offset 0 in file:line:column <filename +unknown>:0:0] +StackFrame: [5: Main at offset 0 in file:line:column <filename +unknown>:0:0] +****************************** +Running second test +StackTrace.FrameCount: [0] + +//As you can see, the code execute from the Thread, does not fill the +StackTrace. + +Expected Results: + +Running first test +StackTrace.FrameCount: [6] +StackFrame: [0: MethodB at offset 0 in file:line:column <filename +unknown>:0:0] +StackFrame: [1: MethodA at offset 0 in file:line:column <filename +unknown>:0:0] +StackFrame: [2: .ctor at offset 6 in file:line:column <filename +unknown>:0:0] +StackFrame: [3: RunFirstTest at offset 10 in file:line:column <filename +unknown>:0:0] +StackFrame: [4: RunTest at offset 0 in file:line:column <filename +unknown>:0:0] +StackFrame: [5: Main at offset 0 in file:line:column <filename +unknown>:0:0] +****************************** +Running second test +StackTrace.FrameCount: [6] +StackFrame: [0: MethodB at offset 0 in file:line:column <filename +unknown>:0:0] +StackFrame: [1: MethodA at offset 0 in file:line:column <filename +unknown>:0:0] +StackFrame: [2: .ctor at offset 6 in file:line:column <filename +unknown>:0:0] +StackFrame: [3: RunFirstTest at offset 10 in file:line:column <filename +unknown>:0:0] +StackFrame: [4: RunTest at offset 0 in file:line:column <filename +unknown>:0:0] +StackFrame: [5: Main at offset 0 in file:line:column <filename +unknown>:0:0] + + +How often does this happen? + Always + +Additional Information: + My machine is amd64 _______________________________________________ mono-bugs maillist - [email protected] http://lists.ximian.com/mailman/listinfo/mono-bugs
