[System] Remove Process.Start and related API from TvOS/WatchOS.
authorRolf Bjarne Kvinge <rolf@xamarin.com>
Tue, 6 Oct 2015 12:56:38 +0000 (14:56 +0200)
committerRolf Bjarne Kvinge <rolf@xamarin.com>
Wed, 25 Nov 2015 11:55:58 +0000 (12:55 +0100)
mcs/build/profiles/monotouch_tv.make
mcs/build/profiles/monotouch_tv_runtime.make
mcs/build/profiles/monotouch_watch.make
mcs/build/profiles/monotouch_watch_runtime.make
mcs/class/System/Makefile
mcs/class/System/System.Diagnostics/Process.cs
mcs/class/System/System.Net.NetworkInformation/Ping.cs
mcs/class/System/Test/System.Diagnostics/ProcessStartInfoTest.cs
mcs/class/System/Test/System.Diagnostics/ProcessTest.cs
mcs/mcs/Makefile
mcs/mcs/driver.cs

index 084af615caaa1c8545b7fe4c808c76cb929458f7..2a36da9c2032ce1918ab7042c33d0a42731096e9 100644 (file)
@@ -5,3 +5,4 @@ PROFILE_MCS_FLAGS += \
 
 NO_THREAD_ABORT=1
 NO_THREAD_SUSPEND_RESUME=1
+NO_PROCESS_START=1
index 6ea1b4ab2d6f7437bfa75a9ba37c586f7eda3e67..552442ac1291fdef30447ebd231f37d1ed133c20 100644 (file)
@@ -5,3 +5,6 @@ PROFILE_MCS_FLAGS += \
 
 NO_THREAD_ABORT=1
 NO_THREAD_SUSPEND_RESUME=1
+# The binding generator (btv) still needs to execute processes,
+# so we need a System.dll that can do that.
+#NO_PROCESS_START=1
index 9a68dcf9eb59a795eae74630dde54523f33fc7cf..8534aaf1f7750a334d83bb265da4b26af1e22def 100644 (file)
@@ -5,3 +5,4 @@ PROFILE_MCS_FLAGS += \
 
 NO_THREAD_ABORT=1
 NO_THREAD_SUSPEND_RESUME=1
+NO_PROCESS_START=1
index 920042750ddf45493abe94bcf26dd15d013b9193..7b3eb80a551dc7325b9cfde0edc5728899696bf2 100644 (file)
@@ -5,3 +5,6 @@ PROFILE_MCS_FLAGS += \
 
 NO_THREAD_ABORT=1
 NO_THREAD_SUSPEND_RESUME=1
+# The binding generator (bwatch) still needs to execute processes,
+# so we need a System.dll that can do that.
+#NO_PROCESS_START=1
index aef9e5f2b468b068198384282d7672acd2bf369e..b734c75c85064ee2c726ef5db51a17aebfabe4cc 100644 (file)
@@ -23,6 +23,11 @@ TEST_MCS_FLAGS = -r:System.Drawing.dll -r:Mono.Security.dll -r:System.Data -r:Sy
        $(foreach f, $(TEST_RESOURCES), -resource:$(f),$(notdir $(f)))
 
 REFERENCE_SOURCES_FLAGS = -d:FEATURE_PAL,SYSTEM_NAMESPACE,MONO,PLATFORM_UNIX
+ifndef NO_PROCESS_START
+REFERENCE_SOURCES_FLAGS += -d:MONO_FEATURE_PROCESS_START
+TEST_MCS_FLAGS += -d:MONO_FEATURE_PROCESS_START
+endif
+
 LIB_MCS_FLAGS = -nowarn:618 -d:CONFIGURATION_2_0 $(REFERENCE_SOURCES_FLAGS) -unsafe $(RESOURCE_FILES:%=-resource:%)
 TEST_MCS_FLAGS += -r:System.Configuration
 
index 76f2a7fc1a6ab69c601858faa71724530c122d29..75228caad852acda4fbdf415d1216216af94aad2 100644 (file)
@@ -577,6 +577,7 @@ namespace System.Diagnostics {
                        }
                }
 
+#if MONO_FEATURE_PROCESS_START
                private StreamReader error_stream=null;
                bool error_stream_exposed;
 
@@ -648,6 +649,28 @@ namespace System.Diagnostics {
                                start_info = value;
                        }
                }
+#else
+               [Obsolete ("Process.StandardError is not supported on the current platform.", true)]
+               public StreamReader StandardError {
+                       get { throw new NotSupportedException ("Process.StandardError is not supported on the current platform."); }
+               }
+
+               [Obsolete ("Process.StandardInput is not supported on the current platform.", true)]
+               public StreamWriter StandardInput {
+                       get { throw new NotSupportedException ("Process.StandardInput is not supported on the current platform."); }
+               }
+
+               [Obsolete ("Process.StandardOutput is not supported on the current platform.", true)]
+               public StreamReader StandardOutput {
+                       get { throw new NotSupportedException ("Process.StandardOutput is not supported on the current platform."); }
+               }
+
+               [Obsolete ("Process.StartInfo is not supported on the current platform.", true)]
+               public ProcessStartInfo StartInfo {
+                       get { throw new NotSupportedException ("Process.StartInfo is not supported on the current platform."); }
+                       set { throw new NotSupportedException ("Process.StartInfo is not supported on the current platform."); }
+               }
+#endif // MONO_FEATURE_PROCESS_START
 
                /* Returns the process start time in Windows file
                 * times (ticks from DateTime(1/1/1601 00:00 GMT))
@@ -895,6 +918,7 @@ namespace System.Diagnostics {
                        // the process (currently we have none).
                }
 
+#if MONO_FEATURE_PROCESS_START
                [MethodImplAttribute(MethodImplOptions.InternalCall)]
                private extern static bool ShellExecuteEx_internal(ProcessStartInfo startInfo,
                                                                   ref ProcInfo proc_info);
@@ -1191,6 +1215,43 @@ namespace System.Diagnostics {
                        psi.UseShellExecute = false;
                        return Start(psi);
                }
+#else
+               [Obsolete ("Process.Start is not supported on the current platform.", true)]
+               public bool Start ()
+               {
+                       throw new NotSupportedException ("Process.Start is not supported on the current platform.");
+               }
+
+               [Obsolete ("Process.Start is not supported on the current platform.", true)]
+               public static Process Start (ProcessStartInfo startInfo)
+               {
+                       throw new NotSupportedException ("Process.Start is not supported on the current platform.");
+               }
+
+               [Obsolete ("Process.Start is not supported on the current platform.", true)]
+               public static Process Start (string fileName)
+               {
+                       throw new NotSupportedException ("Process.Start is not supported on the current platform.");
+               }
+
+               [Obsolete ("Process.Start is not supported on the current platform.", true)]
+               public static Process Start(string fileName, string arguments)
+               {
+                       throw new NotSupportedException ("Process.Start is not supported on the current platform.");
+               }
+
+               [Obsolete ("Process.Start is not supported on the current platform.", true)]
+               public static Process Start(string fileName, string username, SecureString password, string domain)
+               {
+                       throw new NotSupportedException ("Process.Start is not supported on the current platform.");
+               }
+
+               [Obsolete ("Process.Start is not supported on the current platform.", true)]
+               public static Process Start(string fileName, string arguments, string username, SecureString password, string domain)
+               {
+                       throw new NotSupportedException ("Process.Start is not supported on the current platform.");
+               }
+#endif // MONO_FEATURE_PROCESS_START
 
                public override string ToString()
                {
@@ -1219,11 +1280,13 @@ namespace System.Diagnostics {
                        if (!WaitForExit_internal (process_handle, ms))
                                return false;
 
+#if MONO_FEATURE_PROCESS_START
                        if (async_output != null && !async_output.IsCompleted)
                                async_output.AsyncWaitHandle.WaitOne ();
 
                        if (async_error != null && !async_error.IsCompleted)
                                async_error.AsyncWaitHandle.WaitOne ();
+#endif // MONO_FEATURE_PROCESS_START
 
                        OnExited ();
 
@@ -1277,6 +1340,7 @@ namespace System.Diagnostics {
                                cb (this, new DataReceivedEventArgs (str));
                }
 
+#if MONO_FEATURE_PROCESS_START
                [Flags]
                enum AsyncModes {
                        NoneYet = 0,
@@ -1465,6 +1529,31 @@ namespace System.Diagnostics {
 
                        error_canceled = true;
                }
+#else
+               [Obsolete ("Process.BeginOutputReadLine is not supported on the current platform.", true)]
+               public void BeginOutputReadLine ()
+               {
+                       throw new NotSupportedException ("Process.BeginOutputReadLine is not supported on the current platform.");
+               }
+
+               [Obsolete ("Process.BeginOutputReadLine is not supported on the current platform.", true)]
+               public void CancelOutputRead ()
+               {
+                       throw new NotSupportedException ("Process.BeginOutputReadLine is not supported on the current platform.");
+               }
+
+               [Obsolete ("Process.BeginOutputReadLine is not supported on the current platform.", true)]
+               public void BeginErrorReadLine ()
+               {
+                       throw new NotSupportedException ("Process.BeginOutputReadLine is not supported on the current platform.");
+               }
+
+               [Obsolete ("Process.BeginOutputReadLine is not supported on the current platform.", true)]
+               public void CancelErrorRead ()
+               {
+                       throw new NotSupportedException ("Process.BeginOutputReadLine is not supported on the current platform.");
+               }
+#endif // MONO_FEATURE_PROCESS_START
 
                [Category ("Behavior")]
                [MonitoringDescription ("Raised when this process exits.")]
@@ -1497,6 +1586,7 @@ namespace System.Diagnostics {
                        // If this is a call to Dispose,
                        // dispose all managed resources.
                        if (disposing) {
+#if MONO_FEATURE_PROCESS_START
                                /* These have open FileStreams on the pipes we are about to close */
                                if (async_output != null)
                                        async_output.Close ();
@@ -1518,6 +1608,7 @@ namespace System.Diagnostics {
                                                error_stream.Close ();
                                        error_stream = null;
                                }
+#endif // MONO_FEATURE_PROCESS_START
                        }
 
                        // Release unmanaged resources
index 157b888871d4ff1b4b5f90e456bef5d7da26b217..abb6d5d6bce4f5fcae3d6a2a5b1e705925971278 100644 (file)
@@ -26,6 +26,7 @@
 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
+
 using System;
 using System.IO;
 using System.Text;
@@ -286,6 +287,7 @@ namespace System.Net.NetworkInformation {
 
                private PingReply SendUnprivileged (IPAddress address, int timeout, byte [] buffer, PingOptions options)
                {
+#if MONO_FEATURE_PROCESS_START
                        DateTime sentTime = DateTime.UtcNow;
 
                        Process ping = new Process ();
@@ -325,6 +327,9 @@ namespace System.Net.NetworkInformation {
                        }
 
                        return new PingReply (address, buffer, options, trip_time, status);
+#else
+                       throw new NotSupportedException ("Ping is not supported on this platform.");
+#endif // MONO_FEATURE_PROCESS_START
                }
 
                // Async
@@ -592,4 +597,3 @@ namespace System.Net.NetworkInformation {
                }
        }
 }
-
index 53de1f66db4342d6e78e2e942d9beed4d76220b1..7612efae6ccbea26e24cf58f4eaa6d8193444022 100644 (file)
@@ -8,6 +8,8 @@
 // (c) 2007 Novell, Inc. (http://www.novell.com)
 // 
 
+#if MONO_FEATURE_PROCESS_START
+
 using System;
 using System.Diagnostics;
 using System.Text;
@@ -62,3 +64,5 @@ namespace MonoTests.System.Diagnostics
                }
        }
 }
+
+#endif // MONO_FEATURE_PROCESS_START
index d4372a1ddddc76083a6022ab54d46aa4212ec533..615b0aed3e694e59c12d6de98f0c83272b707672 100644 (file)
@@ -104,6 +104,7 @@ namespace MonoTests.System.Diagnostics
                        }
                }
 
+#if MONO_FEATURE_PROCESS_START
                [Test] // Start ()
                public void Start1_FileName_Empty ()
                {
@@ -841,7 +842,6 @@ namespace MonoTests.System.Diagnostics
                        Assert.AreEqual (1, exitedCalledCounter);
                }
 
-               
                ProcessStartInfo GetCrossPlatformStartInfo ()
                {
                        if (RunningOnUnix) {
@@ -855,6 +855,7 @@ namespace MonoTests.System.Diagnostics
                        } else
                                return new ProcessStartInfo ("help", "");
                }
+#endif // MONO_FEATURE_PROCESS_START
 
                [Test]
                public void ProcessName_NotStarted ()
@@ -876,6 +877,7 @@ namespace MonoTests.System.Diagnostics
                        Assert.IsNull (e.InnerException, "IOE inner exception should be null");
                }
                
+#if MONO_FEATURE_PROCESS_START
                [Test]
                [NUnit.Framework.Category ("MobileNotWorking")]
                public void ProcessName_AfterExit ()
@@ -906,6 +908,7 @@ namespace MonoTests.System.Diagnostics
                        
                        Assert.IsNull (e.InnerException, "IOE inner exception should be null");
                }
+#endif // MONO_FEATURE_PROCESS_START
 
                [Test]
                public void Handle_ThrowsOnNotStarted ()
@@ -923,6 +926,7 @@ namespace MonoTests.System.Diagnostics
                        Assert.IsFalse (Process.GetCurrentProcess ().HasExited);
                }
 
+#if MONO_FEATURE_PROCESS_START
                [Test]
                [NUnit.Framework.Category ("MobileNotWorking")]
                public void DisposeWithDisposedStreams ()
@@ -952,6 +956,7 @@ namespace MonoTests.System.Diagnostics
                                        p.StandardInput.Write ('x');
                        }
                }
+#endif // MONO_FEATURE_PROCESS_START
 
                [Test]
                public void Modules () {
index ef4f3e3c9172875db2711161333e38856f372bad..8b93d720fa1dca32835d6eb4b0480b222eb91bac 100644 (file)
@@ -30,6 +30,10 @@ ifndef NO_THREAD_ABORT
 REFERENCE_SOURCES_FLAGS += -d:MONO_FEATURE_THREAD_ABORT
 endif
 
+ifndef NO_PROCESS_START
+REFERENCE_SOURCES_FLAGS += -d:MONO_FEATURE_PROCESS_START
+endif
+
 LOCAL_MCS_FLAGS += $(REFERENCE_SOURCES_FLAGS)
 
 PROGRAM_INSTALL_DIR = $(mono_libdir)/mono/4.5
index 994fdb8afd54bae3e36c1a69098dec28ce132305..0a11914328ae79629b356b78bd879de1942f3b69 100644 (file)
@@ -201,6 +201,7 @@ namespace Mono.CSharp
 
                public static string GetPackageFlags (string packages, Report report)
                {
+#if MONO_FEATURE_PROCESS_START
                        ProcessStartInfo pi = new ProcessStartInfo ();
                        pi.FileName = "pkg-config";
                        pi.RedirectStandardOutput = true;
@@ -239,6 +240,9 @@ namespace Mono.CSharp
 
                        p.Close ();
                        return pkgout;
+#else
+                       throw new NotSupportedException ("Process.Start is not supported on this platform.");
+#endif // MONO_FEATURE_PROCESS_START
                }
 
                //