Imported Upstream version 3.12.0

Former-commit-id: cf92446697332992ec36726e78eb8703e1f259d7
This commit is contained in:
Jo Shields
2015-01-13 10:44:36 +00:00
parent 8b9b85e7f5
commit 181b81b4a4
659 changed files with 12743 additions and 16300 deletions

View File

@@ -94,6 +94,7 @@ namespace System.Diagnostics
public DiagnosticsConfigurationHandler ()
{
elementHandlers ["assert"] = new ElementHandler (AddAssertNode);
elementHandlers ["performanceCounters"] = new ElementHandler (AddPerformanceCountersNode);
elementHandlers ["switches"] = new ElementHandler (AddSwitchesNode);
elementHandlers ["trace"] = new ElementHandler (AddTraceNode);
elementHandlers ["sources"] = new ElementHandler (AddSourcesNode);
@@ -181,6 +182,25 @@ namespace System.Diagnostics
ThrowUnrecognizedElement (node.ChildNodes[0]);
}
private void AddPerformanceCountersNode (IDictionary d, XmlNode node)
{
XmlAttributeCollection c = node.Attributes;
string filemappingsize = GetAttribute (c, "filemappingsize", false, node);
ValidateInvalidAttributes (c, node);
if (filemappingsize != null) {
try {
d ["filemappingsize"] = int.Parse (filemappingsize);
}
catch (Exception e) {
throw new ConfigurationException ("The `filemappingsize' attribute must be an integral value.",
e, node);
}
}
if (node.ChildNodes.Count > 0)
ThrowUnrecognizedElement (node.ChildNodes[0]);
}
// name and value attributes are required
// Docs do not define "remove" or "clear" elements, but .NET recognizes
// them

View File

@@ -29,7 +29,7 @@
//
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Globalization;
@@ -227,7 +227,7 @@ namespace System.Diagnostics
DateFormat, CultureInfo.InvariantCulture);
DateTime timeWritten = File.GetLastWriteTime (file);
int stringNums = int.Parse (tr.ReadLine ().Substring (20));
ArrayList replacementTemp = new ArrayList ();
var replacementTemp = new List<string> ();
StringBuilder sb = new StringBuilder ();
while (replacementTemp.Count < stringNums) {
char c = (char) tr.Read ();
@@ -238,8 +238,7 @@ namespace System.Diagnostics
sb.Append (c);
}
}
string [] replacementStrings = new string [replacementTemp.Count];
replacementTemp.CopyTo (replacementStrings, 0);
string [] replacementStrings = replacementTemp.ToArray ();
string message = FormatMessage (source, instanceID, replacementStrings);
int eventID = EventLog.GetEventID (instanceID);

View File

@@ -39,7 +39,7 @@ using System.ComponentModel.Design;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Security.Permissions;
using System.Collections;
using System.Collections.Generic;
using System.Security;
using System.Threading;
@@ -832,13 +832,13 @@ namespace System.Diagnostics {
[MethodImplAttribute(MethodImplOptions.InternalCall)]
private extern static int[] GetProcesses_internal();
public static Process[] GetProcesses()
public static Process[] GetProcesses ()
{
int [] pids = GetProcesses_internal ();
if (pids == null)
return new Process [0];
ArrayList proclist = new ArrayList (pids.Length);
var proclist = new List<Process> (pids.Length);
for (int i = 0; i < pids.Length; i++) {
try {
proclist.Add (GetProcessById (pids [i]));
@@ -851,7 +851,7 @@ namespace System.Diagnostics {
}
}
return ((Process []) proclist.ToArray (typeof (Process)));
return proclist.ToArray ();
}
[MonoTODO ("There is no support for retrieving process information from a remote machine")]
@@ -871,7 +871,7 @@ namespace System.Diagnostics {
if (pids == null)
return new Process [0];
ArrayList proclist = new ArrayList (pids.Length);
var proclist = new List<Process> (pids.Length);
for (int i = 0; i < pids.Length; i++) {
try {
Process p = GetProcessById (pids [i]);
@@ -886,7 +886,7 @@ namespace System.Diagnostics {
}
}
return ((Process []) proclist.ToArray (typeof (Process)));
return proclist.ToArray ();
}
[MonoTODO]
@@ -940,7 +940,7 @@ namespace System.Diagnostics {
ref proc_info);
} finally {
if (proc_info.Password != IntPtr.Zero)
Marshal.FreeBSTR (proc_info.Password);
Marshal.ZeroFreeBSTR (proc_info.Password);
proc_info.Password = IntPtr.Zero;
}
if (!ret) {
@@ -1080,7 +1080,7 @@ namespace System.Diagnostics {
ref proc_info);
} finally {
if (proc_info.Password != IntPtr.Zero)
Marshal.FreeBSTR (proc_info.Password);
Marshal.ZeroFreeBSTR (proc_info.Password);
proc_info.Password = IntPtr.Zero;
}
if (!ret) {

View File

@@ -59,15 +59,11 @@ namespace System.Diagnostics
{
switch (eventType) {
case TraceEventType.Critical:
return (Level & SourceLevels.Critical) != 0;
case TraceEventType.Error:
return (Level & SourceLevels.Error) != 0;
case TraceEventType.Warning:
return (Level & SourceLevels.Warning) != 0;
case TraceEventType.Information:
return (Level & SourceLevels.Information) != 0;
case TraceEventType.Verbose:
return (Level & SourceLevels.Verbose) != 0;
return (Level & (SourceLevels)eventType) != 0;
case TraceEventType.Start:
case TraceEventType.Stop:
case TraceEventType.Suspend:
@@ -78,6 +74,7 @@ namespace System.Diagnostics
}
}
protected override void OnValueChanged ()
{
SwitchSetting = (int) Enum.Parse (typeof (SourceLevels),

View File

@@ -64,8 +64,8 @@ namespace System.Diagnostics
protected Switch(string displayName, string description)
{
this.name = displayName;
this.description = description;
this.name = displayName ?? string.Empty;
this.description = description ?? string.Empty;
}
protected Switch(string displayName, string description, string defaultSwitchValue)

View File

@@ -28,7 +28,7 @@
//
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Globalization;
@@ -177,12 +177,11 @@ namespace System.Diagnostics
string [] sources = (string []) logKey.GetValue ("Sources");
if (sources != null) {
ArrayList temp = new ArrayList ();
var temp = new List<string> ();
for (int i = 0; i < sources.Length; i++)
if (sources [i] != source)
temp.Add (sources [i]);
string [] newSources = new string [temp.Count];
temp.CopyTo (newSources, 0);
string [] newSources = temp.ToArray ();
logKey.SetValue ("Sources", newSources);
}
}