In System.Diagnostics:
authorRobert Jordan <robertj@gmx.net>
Mon, 23 Jun 2008 19:09:22 +0000 (19:09 -0000)
committerRobert Jordan <robertj@gmx.net>
Mon, 23 Jun 2008 19:09:22 +0000 (19:09 -0000)
2008-06-21  Robert Jordan  <robertj@gmx.net>

* Process.cs (Start_common): UserName may be null or empty.
Fixes bug  #350543.

In Test/System.Diagnostics:
2008-06-21  Robert Jordan  <robertj@gmx.net>

* ProcessTest.cs (Start_UseShellExecuteWithEmptyUserName):
add test for bug #350543.

svn path=/trunk/mcs/; revision=106452

mcs/class/System/System.Diagnostics/ChangeLog
mcs/class/System/System.Diagnostics/Process.cs
mcs/class/System/Test/System.Diagnostics/ChangeLog
mcs/class/System/Test/System.Diagnostics/ProcessTest.cs

index 396955cebad3bac060f498db8b2c9d3246d1d2f2..da061432ef24a58c5f891b15ebcd75ba9a652e50 100644 (file)
@@ -1,3 +1,8 @@
+2008-06-21  Robert Jordan  <robertj@gmx.net>
+
+       * Process.cs (Start_common): UserName may be null or empty.
+       Fixes bug  #350543.
+
 2008-06-19  Dick Porter  <dick@ximian.com>
 
        * Process.cs: Match the buffer sizes of StreamReader and
index fa28855f54287309b02961670c6830946d8542d9..01bf816904861d2e41a47b56d8637385d1a6d5da 100644 (file)
@@ -1132,7 +1132,7 @@ namespace System.Diagnostics {
                        
                        if (startInfo.UseShellExecute) {
 #if NET_2_0
-                               if (startInfo.UserName != null)
+                               if (!String.IsNullOrEmpty (startInfo.UserName))
                                        throw new InvalidOperationException ("UserShellExecute must be false if an explicit UserName is specified when starting a process");
 #endif
                                return (Start_shell (startInfo, process));
index 34723b09cd96f51b411c66a4e236150ae744fc08..a9839147b18200f10339e4f8737283628056bf74 100644 (file)
@@ -1,3 +1,8 @@
+2008-06-21  Robert Jordan  <robertj@gmx.net>
+
+       * ProcessTest.cs (Start_UseShellExecuteWithEmptyUserName):
+       add test for bug #350543.
+
 2008-06-11  Atsushi Enomoto  <atsushi@ximian.com>
 
        * FileVersionInfoTest.cs : disabled all English-Windows-dependent
index 3cbb80e2fd55e35310f998ea0728d60b66f1c860..16f38019f13c3cb5c416a18c497ca54408ddd449 100644 (file)
@@ -592,6 +592,44 @@ namespace MonoTests.System.Diagnostics
                        }
                }
 
+#if NET_2_0            
+               [Test]
+               public void Start_UseShellExecuteWithEmptyUserName ()
+               {
+                       if (RunningOnUnix)
+                               Assert.Ignore ("On Unix and Mac OS X, we try " +
+                                       "to open any file (using xdg-open, ...)" +
+                                       " and we do not report an exception " +
+                                       "if this fails.");
+
+                       string exe = @"c:\shouldnoteverexist.exe";
+
+                       try {
+                               Process p = new Process ();
+                               p.StartInfo.FileName = exe;
+                               p.StartInfo.UseShellExecute = true;
+                               p.StartInfo.UserName = "";
+                               p.Start ();
+                               Assert.Fail ("#1");
+                       } catch (InvalidOperationException) {
+                               Assert.Fail ("#2");
+                       } catch (Win32Exception) {
+                       }
+
+                       try {
+                               Process p = new Process ();
+                               p.StartInfo.FileName = exe;
+                               p.StartInfo.UseShellExecute = true;
+                               p.StartInfo.UserName = null;
+                               p.Start ();
+                               Assert.Fail ("#3");                             
+                       } catch (InvalidOperationException) {
+                               Assert.Fail ("#4");
+                       } catch (Win32Exception) {
+                       }
+               }
+#endif
+               
                [Test] // Start (string, string)
                public void Start4_FileName_Null ()
                {