diff options
author | Martin Baulig <mabaul@microsoft.com> | 2019-08-02 01:46:15 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-08-02 01:46:15 +0300 |
commit | 455b051ce525cc1ca48c33cd4e5c6ae7f1a51a9e (patch) | |
tree | 8e8a3b4ed22ba5c5cf0c4514a4654057b11ba53b /mcs/class/referencesource | |
parent | fcfd3e54a5bbf0b2e0bcab3074af39021bffb206 (diff) |
Fix compiler warnings in System.dll. (#15971)
* Merge the `System.Diagnostics/ProcessStartInfo.cs` part into the referencesource file to avoid CS0282.
* Remove duplicate `using`.
* Fix unreachable code warning that got introduced in my last PR.
Diffstat (limited to 'mcs/class/referencesource')
-rw-r--r-- | mcs/class/referencesource/System/services/monitoring/system/diagnosticts/Process.cs | 1 | ||||
-rw-r--r-- | mcs/class/referencesource/System/services/monitoring/system/diagnosticts/ProcessStartInfo.cs | 59 |
2 files changed, 58 insertions, 2 deletions
diff --git a/mcs/class/referencesource/System/services/monitoring/system/diagnosticts/Process.cs b/mcs/class/referencesource/System/services/monitoring/system/diagnosticts/Process.cs index e1527546950..7e5b7402c56 100644 --- a/mcs/class/referencesource/System/services/monitoring/system/diagnosticts/Process.cs +++ b/mcs/class/referencesource/System/services/monitoring/system/diagnosticts/Process.cs @@ -23,7 +23,6 @@ namespace System.Diagnostics { using Microsoft.Win32; using Microsoft.Win32.SafeHandles; using System.Collections.Specialized; - using System.Collections; using System.Collections.Generic; using System.Globalization; using System.Security; diff --git a/mcs/class/referencesource/System/services/monitoring/system/diagnosticts/ProcessStartInfo.cs b/mcs/class/referencesource/System/services/monitoring/system/diagnosticts/ProcessStartInfo.cs index c10d140ef5c..2836f17a3e3 100644 --- a/mcs/class/referencesource/System/services/monitoring/system/diagnosticts/ProcessStartInfo.cs +++ b/mcs/class/referencesource/System/services/monitoring/system/diagnosticts/ProcessStartInfo.cs @@ -20,6 +20,7 @@ namespace System.Diagnostics { using System.IO; using System.ComponentModel.Design; using System.Collections.Specialized; + using System.Collections.ObjectModel; using System.Collections; using System.Collections.Generic; using System.Globalization; @@ -38,7 +39,8 @@ namespace System.Diagnostics { PermissionSet(SecurityAction.LinkDemand, Name="FullTrust"), HostProtection(SharedState=true, SelfAffectingProcessMgmt=true) ] - public sealed partial class ProcessStartInfo { + [StructLayout (LayoutKind.Sequential)] + public sealed class ProcessStartInfo { string fileName; string arguments; string directory; @@ -66,6 +68,8 @@ namespace System.Diagnostics { WeakReference weakParentProcess; internal StringDictionary environmentVariables; + static readonly string [] empty = new string [0]; + /// <devdoc> /// Default constructor. At least the <see cref='System.Diagnostics.ProcessStartInfo.FileName'/> /// property must be set before starting the process. @@ -95,6 +99,17 @@ namespace System.Diagnostics { this.arguments = arguments; } + Collection<string> _argumentList; + + public Collection<string> ArgumentList { + get { + if (_argumentList == null) { + _argumentList = new Collection<string>(); + } + return _argumentList; + } + } + /// <devdoc> /// <para> /// Specifies the verb to use when opening the filename. For example, the "print" @@ -459,5 +474,47 @@ namespace System.Diagnostics { windowStyle = value; } } + + internal bool HaveEnvVars { + get { return (environmentVariables != null); } + } + + public Encoding StandardInputEncoding { get; set; } + + [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden), Browsable (false)] + public string[] Verbs { + get { +#if MOBILE + return empty; +#else + switch (System.Environment.OSVersion.Platform) { + case (PlatformID)4: + case (PlatformID)6: + case (PlatformID)128: + return empty; // no verb on non-Windows + default: + string ext = String.IsNullOrEmpty (fileName) ? null : Path.GetExtension (fileName); + if (ext == null) + return empty; + + RegistryKey rk = null, rk2 = null, rk3 = null; + try { + rk = Registry.ClassesRoot.OpenSubKey (ext); + string k = rk != null ? rk.GetValue (null) as string : null; + rk2 = k != null ? Registry.ClassesRoot.OpenSubKey (k) : null; + rk3 = rk2 != null ? rk2.OpenSubKey ("shell") : null; + return rk3 != null ? rk3.GetSubKeyNames () : null; + } finally { + if (rk3 != null) + rk3.Close (); + if (rk2 != null) + rk2.Close (); + if (rk != null) + rk.Close (); + } + } +#endif + } + } } } |