Imported Upstream version 4.0.0~alpha1

Former-commit-id: 806294f5ded97629b74c85c09952f2a74fe182d9
This commit is contained in:
Jo Shields
2015-04-07 09:35:12 +01:00
parent 283343f570
commit 3c1f479b9d
22469 changed files with 2931443 additions and 869343 deletions

View File

@@ -76,16 +76,18 @@ namespace System.Diagnostics {
TraceImpl.Assert (condition, message, detailMessage);
}
#if NET_4_0
[Conditional ("DEBUG")]
public static void Assert (bool condition, string message,
string detailMessageFormat, params object [] args)
{
if (condition)
// Return early to avoid the string formatting
return;
TraceImpl.Assert (condition,
message,
string.Format (detailMessageFormat, args));
}
#endif
[Conditional("DEBUG")]
public static void Close ()
@@ -185,13 +187,11 @@ namespace System.Diagnostics {
TraceImpl.WriteLine (message);
}
#if NET_4_0
[Conditional("DEBUG")]
public static void WriteLine (string format, params object [] args)
{
TraceImpl.WriteLine (string.Format (format, args));
}
#endif
[Conditional("DEBUG")]
public static void WriteLine (object value, string category)

View File

@@ -346,23 +346,21 @@ namespace System.Diagnostics {
}
}
[MonoTODO]
[Obsolete ("Use PagedMemorySize64")]
[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
[MonitoringDescription ("The number of bytes that are paged.")]
public int PagedMemorySize {
get {
return(0);
return(int)PagedMemorySize64;
}
}
[MonoTODO]
[Obsolete ("Use PagedSystemMemorySize64")]
[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
[MonitoringDescription ("The amount of paged system memory in bytes.")]
public int PagedSystemMemorySize {
get {
return(0);
return(int)PagedMemorySize64;
}
}
@@ -406,23 +404,22 @@ namespace System.Diagnostics {
}
}
[MonoTODO]
[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
[MonitoringDescription ("The number of bytes that are paged.")]
[ComVisible (false)]
public long PagedMemorySize64 {
get {
return(0);
int error;
return GetProcessData (pid, 12, out error);
}
}
[MonoTODO]
[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
[MonitoringDescription ("The amount of paged system memory in bytes.")]
[ComVisible (false)]
public long PagedSystemMemorySize64 {
get {
return(0);
return PagedMemorySize64;
}
}
@@ -1136,7 +1133,7 @@ namespace System.Diagnostics {
// Note that ProcInfo.Password must be freed.
private static void FillUserInfo (ProcessStartInfo startInfo, ref ProcInfo proc_info)
{
if (startInfo.UserName != null) {
if (startInfo.UserName.Length != 0) {
proc_info.UserName = startInfo.UserName;
proc_info.Domain = startInfo.Domain;
if (startInfo.Password != null)
@@ -1150,7 +1147,7 @@ namespace System.Diagnostics {
private static bool Start_common (ProcessStartInfo startInfo,
Process process)
{
if (startInfo.FileName == null || startInfo.FileName.Length == 0)
if (startInfo.FileName.Length == 0)
throw new InvalidOperationException("File name has not been set");
if (startInfo.StandardErrorEncoding != null && !startInfo.RedirectStandardError)
@@ -1159,7 +1156,7 @@ namespace System.Diagnostics {
throw new InvalidOperationException ("StandardOutputEncoding is only supported when standard output is redirected");
if (startInfo.UseShellExecute) {
if (!String.IsNullOrEmpty (startInfo.UserName))
if (startInfo.UserName.Length != 0)
throw new InvalidOperationException ("UseShellExecute must be false if an explicit UserName is specified when starting a process");
return (Start_shell (startInfo, process));
} else {

View File

@@ -47,12 +47,12 @@ namespace System.Diagnostics
public sealed class ProcessStartInfo
{
/* keep these fields in this order and in sync with metadata/process.h */
private string arguments = "";
private string arguments;
private IntPtr error_dialog_parent_handle = (IntPtr)0;
private string filename = "";
private string verb = "";
private string working_directory = "";
private ProcessStringDictionary envVars;
private string filename;
private string verb;
private string working_directory;
private StringDictionary envVars;
private bool create_no_window = false;
private bool error_dialog = false;
private bool redirect_standard_error = false;
@@ -87,7 +87,7 @@ namespace System.Diagnostics
[NotifyParentPropertyAttribute (true)]
public string Arguments {
get {
return(arguments);
return arguments ?? string.Empty;
}
set {
arguments = value;
@@ -113,7 +113,15 @@ namespace System.Diagnostics
public StringDictionary EnvironmentVariables {
get {
if (envVars == null) {
envVars = new ProcessStringDictionary ();
// check for non-Unix platforms - see FAQ for more details
// http://www.mono-project.com/FAQ:_Technical#How_to_detect_the_execution_platform_.3F
int platform = (int) Environment.OSVersion.Platform;
if ((platform != 4) && (platform != 128)) {
envVars = new StringDictionary ();
} else {
envVars = new CaseSensitiveStringDictionary ();
}
foreach (DictionaryEntry entry in Environment.GetEnvironmentVariables ())
envVars.Add ((string) entry.Key, (string) entry.Value);
}
@@ -155,7 +163,7 @@ namespace System.Diagnostics
[NotifyParentPropertyAttribute (true)]
public string FileName {
get {
return(filename);
return filename ?? string.Empty;
}
set {
filename = value;
@@ -187,7 +195,7 @@ namespace System.Diagnostics
}
[DefaultValue (false)]
[MonitoringDescription ("Standart output of this process is redirected.")]
[MonitoringDescription ("Standard output of this process is redirected.")]
[NotifyParentPropertyAttribute (true)]
public bool RedirectStandardOutput {
get {
@@ -226,7 +234,7 @@ namespace System.Diagnostics
[NotifyParentPropertyAttribute (true)]
public string Verb {
get {
return(verb);
return verb ?? string.Empty;
}
set {
verb = value;
@@ -238,21 +246,20 @@ namespace System.Diagnostics
[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden), Browsable (false)]
public string[] Verbs {
get {
string ext = filename == null | filename.Length == 0 ?
null : Path.GetExtension (filename);
if (ext == null)
return empty;
#if MOBILE
return empty;
#else
switch (Environment.OSVersion.Platform) {
case (PlatformID)4:
case (PlatformID)6:
case (PlatformID)128:
return empty; // no verb on non-Windows
default:
string ext = filename == null | filename.Length == 0 ?
null : Path.GetExtension (filename);
if (ext == null)
return empty;
RegistryKey rk = null, rk2 = null, rk3 = null;
try {
rk = Registry.ClassesRoot.OpenSubKey (ext);
@@ -292,10 +299,10 @@ namespace System.Diagnostics
[NotifyParentPropertyAttribute (true)]
public string WorkingDirectory {
get {
return(working_directory);
return working_directory ?? string.Empty;
}
set {
working_directory = value == null ? String.Empty : value;
working_directory = value;
}
}
@@ -307,13 +314,13 @@ namespace System.Diagnostics
[NotifyParentPropertyAttribute (true)]
public string UserName {
get { return username; }
get { return username ?? string.Empty; }
set { username = value; }
}
[NotifyParentPropertyAttribute (true)]
public string Domain {
get { return domain; }
get { return domain ?? string.Empty; }
set { domain = value; }
}

View File

@@ -116,14 +116,12 @@ namespace System.Diagnostics
is_running = false;
}
#if NET_4_0
public void Restart ()
{
started = GetTimestamp ();
elapsed = 0;
is_running = true;
}
#endif
}
}

View File

@@ -185,7 +185,7 @@ namespace System.Diagnostics
}
}
protected virtual string [] GetSupportedAttributes ()
protected internal virtual string [] GetSupportedAttributes ()
{
return null;
}