[Mono-bugs] [Bug 77203][Maj] New - Process does not return from the Main() function

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Tue Jan 10 19:55:51 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 prakriti.goel at spirentcom.com.

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

--- shadow/77203	2006-01-10 19:55:51.000000000 -0500
+++ shadow/77203.tmp.10122	2006-01-10 19:55:51.000000000 -0500
@@ -0,0 +1,96 @@
+Bug#: 77203
+Product: Mono: Runtime
+Version: 1.1
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Major
+Component: misc
+AssignedTo: mono-bugs at ximian.com                            
+ReportedBy: prakriti.goel at spirentcom.com               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Process does not return from the Main() function
+
+Description of Problem:
+
+We have a simple Main function in which we are implementing a Command Line 
+Interface which accepts a user command and forwards the command to a DLL. 
+This is a do-while loop and if the user ebter's exit' it breaks from the 
+loop and should return from Main(). The problem is that on 'exit', the 
+program hangs and does not return from Main().
+
+static int Main(string[] args)
+{
+        string strInput = "";
+
+	objTHoT = new THoTLogicLayer();
+	obj = new TH_ProtLib();
+	THoTLogicLayer.strInterfaceType = "CLI";
+
+        // Create a new thread
+	Thread execThread = new Thread(new ThreadStart
+(XmlRpcServer.StartXmlRpcServer));
+	//StartXmlRpcServer
+	// Start the thread.
+	execThread.Start();
+
+	Console.WriteLine();
+
+	try
+	{
+	do
+	{
+	        Console.Write("THoT%");
+		strInput = Console.ReadLine();
+						
+		if(strInput != null)
+		{
+			string [] strCommand  = ParseCommand(strInput);
+				
+			if(strInput.Trim() == "")
+				continue;
+			else if(strCommand[0].ToLower() == "exit")
+				break;
+
+			ExecuteCommand(strCommand);
+		}
+		else
+		{
+	        	Console.ReadLine();
+			break;
+		}
+			
+	} while(true);
+        }
+	catch(Exception ex)
+	{
+		Console.WriteLine("Exception: " + ex.Message);
+		Console.ReadLine();
+	}
+
+	return 0;
+}
+
+Steps to reproduce the problem:
+1. Run the above code segment 
+2. type 'exit' at the command line prompt and hit ENTER
+
+
+Actual Results:
+    
+      Process hangs.
+
+Expected Results:
+
+      Program should exit gracefully.
+
+How often does this happen? 
+   
+      Everytime.
+
+Additional Information:


More information about the mono-bugs mailing list