You've already forked linux-packaging-mono
Imported Upstream version 4.0.1
Former-commit-id: 6d37e02debfe41dd5c13ba6f6a2428c8b1ff5e28
This commit is contained in:
@@ -314,8 +314,10 @@ namespace System.ComponentModel {
|
||||
case "Config":
|
||||
return "PropertyCategoryConfig";
|
||||
}
|
||||
#endif
|
||||
return value;
|
||||
#else
|
||||
return (string)SR.GetObject("PropertyCategory" + value);
|
||||
#endif
|
||||
#else
|
||||
bool usedFallback;
|
||||
string localizedString = SR.GetString("PropertyCategory" + value, out usedFallback);
|
||||
|
@@ -4,6 +4,7 @@
|
||||
// </copyright>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#if CONFIGURATION_DEP
|
||||
using System.Configuration;
|
||||
|
||||
namespace System.Diagnostics {
|
||||
@@ -41,3 +42,4 @@ namespace System.Diagnostics {
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@@ -111,8 +111,10 @@ namespace System.Diagnostics {
|
||||
[ResourceConsumption(ResourceScope.Machine, ResourceScope.Machine)]
|
||||
private void InitializeSettings() {
|
||||
// don't use the property setters here to avoid infinite recursion.
|
||||
#if CONFIGURATION_DEP
|
||||
assertUIEnabled = DiagnosticsConfiguration.AssertUIEnabled;
|
||||
logFileName = DiagnosticsConfiguration.LogFileName;
|
||||
#endif
|
||||
settingsInitialized = true;
|
||||
}
|
||||
|
||||
|
@@ -4,6 +4,7 @@
|
||||
// </copyright>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#if CONFIGURATION_DEP
|
||||
namespace System.Diagnostics {
|
||||
using System;
|
||||
using System.Reflection;
|
||||
@@ -255,3 +256,4 @@ namespace System.Diagnostics {
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@@ -3,6 +3,7 @@
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// </copyright>
|
||||
//------------------------------------------------------------------------------
|
||||
#if CONFIGURATION_DEP
|
||||
using System.Configuration;
|
||||
using System;
|
||||
|
||||
@@ -29,4 +30,4 @@ namespace System.Diagnostics {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
@@ -3,6 +3,7 @@
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// </copyright>
|
||||
//------------------------------------------------------------------------------
|
||||
#if CONFIGURATION_DEP
|
||||
using System.Configuration;
|
||||
using System;
|
||||
using System.Reflection;
|
||||
@@ -372,3 +373,4 @@ namespace System.Diagnostics {
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@@ -4,6 +4,7 @@
|
||||
// </copyright>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#if CONFIGURATION_DEP
|
||||
using System.Configuration;
|
||||
|
||||
namespace System.Diagnostics {
|
||||
@@ -31,3 +32,4 @@ namespace System.Diagnostics {
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@@ -3,6 +3,8 @@
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// </copyright>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#if CONFIGURATION_DEP
|
||||
using System.Configuration;
|
||||
using System.Collections;
|
||||
using System.Collections.Specialized;
|
||||
@@ -185,3 +187,4 @@ namespace System.Diagnostics {
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@@ -6,6 +6,9 @@
|
||||
|
||||
/*
|
||||
*/
|
||||
#if !CONFIGURATION_DEP
|
||||
using SwitchElementsCollection = System.Object;
|
||||
#endif
|
||||
|
||||
namespace System.Diagnostics {
|
||||
using System;
|
||||
@@ -19,7 +22,9 @@ namespace System.Diagnostics {
|
||||
using System.Collections.Specialized;
|
||||
using System.Globalization;
|
||||
using System.Configuration;
|
||||
#if XML_DEP
|
||||
using System.Xml.Serialization;
|
||||
#endif
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
/// <devdoc>
|
||||
@@ -97,7 +102,9 @@ namespace System.Diagnostics {
|
||||
}
|
||||
}
|
||||
|
||||
#if XML_DEP
|
||||
[XmlIgnore]
|
||||
#endif
|
||||
public StringDictionary Attributes {
|
||||
get {
|
||||
Initialize();
|
||||
@@ -164,6 +171,7 @@ namespace System.Diagnostics {
|
||||
set {
|
||||
Initialize();
|
||||
switchValueString = value;
|
||||
#if CONFIGURATION_DEP
|
||||
try {
|
||||
OnValueChanged();
|
||||
}
|
||||
@@ -176,6 +184,9 @@ namespace System.Diagnostics {
|
||||
catch (OverflowException e) {
|
||||
throw new ConfigurationErrorsException(SR.GetString(SR.BadConfigSwitchValue, DisplayName), e);
|
||||
}
|
||||
#else
|
||||
OnValueChanged();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -204,6 +215,7 @@ namespace System.Diagnostics {
|
||||
}
|
||||
}
|
||||
|
||||
#if CONFIGURATION_DEP
|
||||
if (switchSettings != null) {
|
||||
SwitchElement mySettings = switchSettings[displayName];
|
||||
if (mySettings != null) {
|
||||
@@ -231,11 +243,14 @@ namespace System.Diagnostics {
|
||||
OnValueChanged();
|
||||
}
|
||||
} else {
|
||||
#endif
|
||||
// We don't use the property here because we don't want to catch exceptions
|
||||
// and rethrow them as ConfigurationException. In this case there's no config.
|
||||
switchValueString = defaultValue;
|
||||
OnValueChanged();
|
||||
#if CONFIGURATION_DEP
|
||||
}
|
||||
#endif
|
||||
|
||||
initialized = true;
|
||||
initializing = false;
|
||||
@@ -249,11 +264,13 @@ namespace System.Diagnostics {
|
||||
if (switchSettings != null)
|
||||
return true;
|
||||
|
||||
#if CONFIGURATION_DEP
|
||||
if (!DiagnosticsConfiguration.CanInitialize())
|
||||
return false;
|
||||
|
||||
// This hashtable is case-insensitive.
|
||||
switchSettings = DiagnosticsConfiguration.SwitchSettings;
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@@ -3,6 +3,8 @@
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// </copyright>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#if CONFIGURATION_DEP
|
||||
using System.Configuration;
|
||||
using System.Collections;
|
||||
using System.Collections.Specialized;
|
||||
@@ -136,3 +138,4 @@ namespace System.Diagnostics {
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@@ -3,6 +3,7 @@
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// </copyright>
|
||||
//------------------------------------------------------------------------------
|
||||
#if CONFIGURATION_DEP
|
||||
using System.Configuration;
|
||||
|
||||
namespace System.Diagnostics {
|
||||
@@ -79,3 +80,4 @@ namespace System.Diagnostics {
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@@ -163,7 +163,9 @@ namespace System.Diagnostics {
|
||||
}
|
||||
|
||||
public static void Refresh() {
|
||||
#if CONFIGURATION_DEP
|
||||
DiagnosticsConfiguration.Refresh();
|
||||
#endif
|
||||
Switch.RefreshAll();
|
||||
TraceSource.RefreshAll();
|
||||
TraceInternal.Refresh();
|
||||
|
@@ -34,11 +34,13 @@ namespace System.Diagnostics {
|
||||
if (listeners == null) {
|
||||
// We only need to check that the main section exists. Everything else will get
|
||||
// created for us if it doesn't exist already.
|
||||
#if CONFIGURATION_DEP
|
||||
SystemDiagnosticsSection configSectionSav = DiagnosticsConfiguration.SystemDiagnosticsSection;
|
||||
if (configSectionSav != null) {
|
||||
listeners = configSectionSav.Trace.Listeners.GetRuntimeObject();
|
||||
}
|
||||
else {
|
||||
#endif
|
||||
// If machine.config was deleted the code will get to here
|
||||
// supply at least something to prevent the world from coming to
|
||||
// an abrupt end.
|
||||
@@ -47,7 +49,9 @@ namespace System.Diagnostics {
|
||||
defaultListener.IndentLevel = indentLevel;
|
||||
defaultListener.IndentSize = indentSize;
|
||||
listeners.Add(defaultListener);
|
||||
#if CONFIGURATION_DEP
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -269,6 +273,7 @@ namespace System.Diagnostics {
|
||||
}
|
||||
|
||||
private static void InitializeSettings() {
|
||||
#if CONFIGURATION_DEP
|
||||
// we want to redo this logic exactly once if the last time we entered the config
|
||||
// system was still initializing. (ASURT 111941, VSWhidbey 149552)
|
||||
if (!settingsInitialized || (defaultInitialized && DiagnosticsConfiguration.IsInitialized())) {
|
||||
@@ -289,6 +294,7 @@ namespace System.Diagnostics {
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
// This method refreshes all the data from the configuration file, so that updated to the configuration file are mirrored
|
||||
|
@@ -4,6 +4,7 @@
|
||||
// </copyright>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#if CONFIGURATION_DEP
|
||||
using System.Configuration;
|
||||
|
||||
namespace System.Diagnostics {
|
||||
@@ -58,3 +59,4 @@ namespace System.Diagnostics {
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@@ -74,6 +74,7 @@ namespace System.Diagnostics {
|
||||
if (_initCalled)
|
||||
return;
|
||||
|
||||
#if CONFIGURATION_DEP
|
||||
SourceElementsCollection sourceElements = DiagnosticsConfiguration.Sources;
|
||||
|
||||
if (sourceElements != null) {
|
||||
@@ -99,6 +100,7 @@ namespace System.Diagnostics {
|
||||
NoConfigInit();
|
||||
}
|
||||
else
|
||||
#endif
|
||||
NoConfigInit();
|
||||
|
||||
_initCalled = true;
|
||||
@@ -173,6 +175,7 @@ namespace System.Diagnostics {
|
||||
return;
|
||||
}
|
||||
|
||||
#if CONFIGURATION_DEP
|
||||
SourceElementsCollection sources = DiagnosticsConfiguration.Sources;
|
||||
|
||||
if (sources != null) {
|
||||
@@ -233,6 +236,7 @@ namespace System.Diagnostics {
|
||||
attributes = null;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
[Conditional("TRACE")]
|
||||
|
@@ -3,6 +3,7 @@
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// </copyright>
|
||||
//------------------------------------------------------------------------------
|
||||
#if CONFIGURATION_DEP
|
||||
using System.Configuration;
|
||||
using System;
|
||||
using System.Reflection;
|
||||
@@ -10,7 +11,11 @@ using System.Globalization;
|
||||
|
||||
namespace System.Diagnostics {
|
||||
internal class TypedElement : ConfigurationElement {
|
||||
#if BOOTSTRAP_BASIC
|
||||
protected static readonly ConfigurationProperty _propTypeName = new ConfigurationProperty("type", typeof(string), String.Empty, ConfigurationPropertyOptions.IsRequired);
|
||||
#else
|
||||
protected static readonly ConfigurationProperty _propTypeName = new ConfigurationProperty("type", typeof(string), String.Empty, ConfigurationPropertyOptions.IsRequired | ConfigurationPropertyOptions.IsTypeStringTransformationRequired);
|
||||
#endif
|
||||
protected static readonly ConfigurationProperty _propInitData = new ConfigurationProperty("initializeData", typeof(string), String.Empty, ConfigurationPropertyOptions.None);
|
||||
|
||||
protected ConfigurationPropertyCollection _properties;
|
||||
@@ -62,3 +67,4 @@ namespace System.Diagnostics {
|
||||
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@@ -3,7 +3,7 @@
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// </copyright>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#if XML_DEP
|
||||
using System;
|
||||
using System.Text;
|
||||
using System.Xml;
|
||||
@@ -335,3 +335,4 @@ namespace System.Diagnostics {
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@@ -19,6 +19,7 @@ namespace System.Diagnostics {
|
||||
[ResourceConsumption(ResourceScope.Machine, ResourceScope.Machine)]
|
||||
internal static object GetRuntimeObject(string className, Type baseType, string initializeData) {
|
||||
Object newObject = null;
|
||||
#if CONFIGURATION_DEP
|
||||
Type objectType = null;
|
||||
|
||||
if (className.Length == 0) {
|
||||
@@ -106,20 +107,27 @@ namespace System.Diagnostics {
|
||||
else
|
||||
throw new ConfigurationErrorsException(SR.GetString(SR.Could_not_create_type_instance, className));
|
||||
}
|
||||
#endif
|
||||
|
||||
return newObject;
|
||||
}
|
||||
|
||||
#if !MOBILE
|
||||
// Our own tracelisteners that needs extra config validation
|
||||
internal static bool IsOwnedTL(Type type) {
|
||||
return (typeof(EventLogTraceListener) == type
|
||||
|| IsOwnedTextWriterTL(type));
|
||||
}
|
||||
internal static bool IsOwnedTextWriterTL(Type type) {
|
||||
#if XML_DEP
|
||||
return (typeof(XmlWriterTraceListener) == type)
|
||||
|| (typeof(DelimitedListTraceListener) == type)
|
||||
|| (typeof(TextWriterTraceListener) == type);
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
private static object ConvertToBaseTypeOrEnum(string value, Type type) {
|
||||
if (type.IsEnum)
|
||||
@@ -129,6 +137,7 @@ namespace System.Diagnostics {
|
||||
}
|
||||
|
||||
internal static void VerifyAttributes(IDictionary attributes, String[] supportedAttributes, object parent) {
|
||||
#if CONFIGURATION_DEP
|
||||
foreach (string key in attributes.Keys) {
|
||||
bool found = false;
|
||||
if (supportedAttributes != null) {
|
||||
@@ -140,6 +149,7 @@ namespace System.Diagnostics {
|
||||
if (!found)
|
||||
throw new ConfigurationErrorsException(SR.GetString(SR.AttributeNotSupported, key, parent.GetType().FullName));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -3,7 +3,7 @@
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// </copyright>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#if CONFIGURATION_DEP
|
||||
|
||||
namespace System.Configuration {
|
||||
|
||||
@@ -25,3 +25,4 @@ namespace System.Configuration {
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@@ -62,12 +62,7 @@ namespace System.Timers {
|
||||
if (interval <= 0)
|
||||
throw new ArgumentException(SR.GetString(SR.InvalidParameter, "interval", interval));
|
||||
|
||||
double roundedInterval = Math.Ceiling(interval);
|
||||
if (roundedInterval > Int32.MaxValue || roundedInterval <= 0) {
|
||||
throw new ArgumentException(SR.GetString(SR.InvalidParameter, "interval", interval));
|
||||
}
|
||||
|
||||
this.interval = (int) roundedInterval;
|
||||
this.interval = CalculateRoundedInterval(interval, true);
|
||||
}
|
||||
|
||||
/// <devdoc>
|
||||
@@ -128,7 +123,7 @@ namespace System.Timers {
|
||||
throw new ObjectDisposedException(GetType().Name);
|
||||
}
|
||||
|
||||
int i = (int)Math.Ceiling(interval);
|
||||
int i = CalculateRoundedInterval(interval);
|
||||
cookie = new Object();
|
||||
timer = new System.Threading.Timer(callback, cookie, i, autoReset? i:Timeout.Infinite);
|
||||
}
|
||||
@@ -141,9 +136,19 @@ namespace System.Timers {
|
||||
}
|
||||
}
|
||||
|
||||
private static int CalculateRoundedInterval(double interval, bool argumentCheck = false) {
|
||||
double roundedInterval = Math.Ceiling(interval);
|
||||
if (roundedInterval > Int32.MaxValue || roundedInterval <= 0) {
|
||||
if (argumentCheck)
|
||||
throw new ArgumentException(SR.GetString(SR.InvalidParameter, "interval", interval));
|
||||
|
||||
throw new ArgumentOutOfRangeException(SR.GetString(SR.InvalidParameter, "interval", interval));
|
||||
}
|
||||
return (int)roundedInterval;
|
||||
}
|
||||
|
||||
private void UpdateTimer() {
|
||||
int i = (int)Math.Ceiling(interval);
|
||||
int i = CalculateRoundedInterval(interval);
|
||||
timer.Change(i, autoReset? i :Timeout.Infinite );
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user