[Mono-bugs] [Bug 77145][Wis] New - Process.GetCurrentProcess().Threads is null

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Tue Jan 3 13:08:00 EST 2006


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 awaddell at fnfr.com.

http://bugzilla.ximian.com/show_bug.cgi?id=77145

--- shadow/77145	2006-01-03 13:08:00.000000000 -0500
+++ shadow/77145.tmp.17152	2006-01-03 13:08:00.000000000 -0500
@@ -0,0 +1,105 @@
+Bug#: 77145
+Product: Mono: Class Libraries
+Version: unspecified
+OS: All
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Wishlist
+Component: System
+AssignedTo: mono-bugs at ximian.com                            
+ReportedBy: awaddell at fnfr.com               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Process.GetCurrentProcess().Threads is null
+
+Please fill in this template when reporting a bug, unless you know what you
+are doing.
+Description of Problem:
+
+
+Steps to reproduce the problem:
+1. 
+using System.Threading;
+using System.Text;
+
+namespace ThreadBug
+{
+    class Program
+    {
+        static void Main(string[] args)
+        {
+         
+            Thread ThreadOne = new Thread(Work.DoWork);
+            ThreadOne.Start();
+            Thread.Sleep(2000);
+            Thread ThreadTwo = new Thread(Work.DoWork);
+            ThreadTwo.Start();
+            Thread.Sleep(2000);
+            Thread ThreadThree = new Thread(Work.DoWork);
+            ThreadThree.Start();
+            Thread.Sleep(2000);
+//            Process thisProc = Process.GetCurrentProcess();
+            Console.WriteLine("Process name: " +
+Process.GetCurrentProcess().ProcessName);
+            if (Process.GetCurrentProcess().Threads != null)
+                Console.WriteLine("this process has " +
+Process.GetCurrentProcess().Threads.Count + " threads");
+            else
+                Console.WriteLine("Process.GetCurrentProcess().Threads is
+null");
+            Thread.Sleep(5000);
+            
+
+        }
+        /// <summary>
+        /// method that thread calls
+        /// </summary>
+        public class Work
+        {
+            public static void DoWork()
+            {
+                Console.WriteLine("thread is running");
+                
+            }
+        }
+    }
+}
+
+2. 
+gmcs -target:exe -optimize- -noconfig -nowarn:1691,67  -out:ThreadBug.exe
+-define:DEBUG -define:TRACE -define:FIXME -define:MONO -define:HEADLESS
+-define:LINUX   -reference:System -reference:System.Data
+-reference:System.Xml
+-reference:/opt/latest/lib/mono/1.0/nunit.framework.dll  Program.cs
+Properties/AssemblyInfo.cs
+[awaddell at EngRegLinux Threads]$ 
+3. 
+
+Actual Results:
+[awaddell at EngRegLinux Threads]$ mono ThreadBug.exe 
+thread is running
+thread is running
+thread is running
+Process name: ThreadBug
+Process.GetCurrentProcess().Threads is null
+
+
+Expected Results:
+
+C:\svt\main\MonoBugs\Threads>bin\Debug\ThreadBug.exe
+thread is running
+thread is running
+thread is running
+Process name: ThreadBug
+this process has 3 threads
+
+How often does this happen? 
+
+always
+
+Additional Information:
+ProcessName used to return "mono", but that now appears to have been fixed.


More information about the mono-bugs mailing list