Commit Graph
19 Commits
Author SHA1 Message Date
Alexander Köplinger 29abf6790d [System] Fixed Diagnostics.Switch ctor behavior for null parameters
Passing null to the displayName or description ctor parameter on MS.NET makes them equal to an empty string.
Fixed the Mono behavior to match .NET.
2014-09-10 19:09:34 +02:00
Jonathan Pryor 5543285e68 Add System.Diagnostics.Switch/etc. to the MOBILE profile.
Followup to:

	http://forums.xamarin.com/discussion/comment/11823/#Comment_11823

These are Switches with a labotomy: the MOBILE profile does not
support System.Configuration.dll, so there is no support for
.exe.config files or
System.Diagnostics.DiagnosticsConfigurationHandler.

Consequently these Switches are largely a compatibility/portability
aid: they DO NOT have the full functionality that the desktop
profile affords. Specifically, there is no way to provide an XML
config file that contains the Switch values to use. If you need to set
the Switch values, this MUST be done manually, e.g. through a Switch
constructor's `defaultSwitchValue` parameter or through a property,
e.g. for SourceSwitch:

	http://msdn.microsoft.com/en-us/library/w65awck1.aspx
	http://msdn.microsoft.com/en-us/library/system.diagnostics.sourceswitch.level.aspx
2013-04-29 14:38:53 -04:00
Miguel de Icaza f48ceb9860 [System] Removal of the NET_2_0 in the source code
Modulo the GUID in the assembly and the GUID embedded in some
field initializers that use the assembly GUID for their name, the
assemblies are idential before and after the patch.
2012-06-02 13:16:40 -04:00
Marek Safar e61dde083e Warnings cleanup
svn path=/trunk/mcs/; revision=89678
2007-11-15 14:14:49 +00:00
Gert Driesen d476d382cb * DiagnosticsConfigurationHandlerTest.cs: No longer derive from
deprecated Assertion class. Code formatting. On 2.0 profile, allow
non-integral values for switches.     
* BooleanSwitch.cs: Use base ctor for default value.
* Switch.cs: On 2.0 profile, store default value and use it if no
value is set in config file.
* SourceSwitch.cs: Use null to signal that there's no default value.

svn path=/trunk/mcs/; revision=86220
2007-09-22 17:54:03 +00:00
Gert Driesen cbad6d566a * DiagnosticsConfigurationHandler.cs: Rename ValidateIntegralValue
to GetSwitchValue. On 2.0 profile, leave the type conversion to
Switch implementations. Minor corrections to exception messages to
match MS.
* Switch.cs: Avoid unnecessary inits. On 2.0 profile, catch and
rethrow exceptions in setter for Value. Do not hide exceptions thrown
in GetConfigFileSetting. Only set value from config file if switch is
actually defined.
* SourceSwitch.cs: Use SwitchSetting for getting/storing value instead
of new field. In OnValueChanged, parse enum value.
* TraceSwitch.cs: If SwitchSetting is changed to value > 4, then set
it to Verbose. In OnValueChanged, parse value case-insensitively, and
assign it to SwitchSetting (to allow other integral values).

svn path=/trunk/mcs/; revision=86141
2007-09-21 12:37:04 +00:00
Atsushi Eno 720ddca1bd 2007-05-17 Atsushi Enomoto <[email protected]>
* TraceOptions.cs : new enum.
	* TraceListener.cs : support TraceOutputOptions. Fixed missing
	  NET_2_0 condition in TARGET_JVM section.
	* TraceSwitch.cs, BooleanSwitch.cs :
	  Added missing constructors and OnValueChanged().
	* Trace.cs, TraceImpl.cs :
	  Added CorrelationManager and UseGlobalLock.
	* TraceEventCache.cs : initialize property values at construction.
	* Switch.cs : added XmlIgnore on Attributes.

	* SwitchesTest.cs : added tests for BooleanSwitch Value.
	* TraceListenerTest.cs : added test for TraceOutputOptions.

	* System.dll.sources : added TraceOptions.cs.


svn path=/trunk/mcs/; revision=77581
2007-05-17 17:10:25 +00:00
Atsushi Eno e9156bb4b8 2007-01-18 Atsushi Enomoto <[email protected]>
* System.dll.sources: added new sources:
	  TraceSource.cs, SourceLevels.cs, CorrelationManager.cs,
	  TraceEventCache.cs, TraceEventType.cs and SourceSwitch.cs.
	* System_test.dll.sources: added new tests:
	  TraceSourceTest.cs and SourceSwitchTest.cs.

	* Switch.cs : added missing .ctor(), Attributes, Value, 
	  GetSupportedAttributes() and OnValueChanged().
	* DiagnosticsConfigurationHandler.cs : added some hacky handler for
	  new "sources" element. Don't wrap another ConfigurationException.
	* TraceListener.cs : added missing trace methods.
	* TraceSource.cs, SourceLevels.cs, CorrelationManager.cs,
	  TraceEventCache.cs, TraceEventType.cs, SourceSwitch.cs:
	  added missing 2.0 stuff, mostly just stubs.

	* TraceSourceTest.cs, SourceSwitchTest.cs : new tests.
	* SwitchesTest.cs : added test for GetSupportedAttributes().


svn path=/trunk/mcs/; revision=71238
2007-01-18 04:17:22 +00:00
Ben Maurer 0e8decdb37 remove svn:executable from .cs files
svn path=/trunk/mcs/; revision=46562
2005-06-27 15:51:40 +00:00
Jonathan Pryor 998e1fc3c9 Implement the .NET 1.1 requirement that the
/system.diagnostics/switch/add/@value attribute only contain numeric data and 
some other fixes (thread-safety in the Debug- and Trace-related classes).

  * System/System.Diagnostics/DiagnosticsConfigurationHandler.cs
    (DiagnosticsConfiguration): Don't read the .config file from the 
    static ctor (again), as if it fails we'll get a TypeLoadException -- bad!       Instead, lazy-read the .config file.
  * System/System.Diagnostics/DiagnosticsConfigurationHandler.cs
    (DiagnosticsConfigurationHandler): Require that the /switch/add/@value 
    attribute contains only numeric values.
  * System/System.Diagnostics/DiagnosticsConfigurationHandler.cs: 
  * System/System.Diagnostics/TraceImpl.cs: Don't initialize everything in 
    the static ctor, as if it fails (due to an invalid .confg file) we get a 
    TypeLoadException, while .NET generates a ConfigurationException.  
    Instead, initialize everything the first time the Listeners property is 
    accessed, which allows the static ctor to run without chance of failure, 
    avoiding the TypeLoadException.
  * System/System.Diagnostics/TraceListenerCollection.cs: This should be 
    thread-safe, as it's accessible from a static member of TraceImpl 
    (available through the public Debug and Trace classes).
  * System/System.Diagnostics/Switch.cs: Leave the original switch value alone.
    If it isn't valid (i.e. numeric), the DiagnosticsConfigurationHandler 
    will catch it.
  * System/Test/test-config-file: Remove "string-value" switch, as it causes 
    ConfigurationExceptions under .NET 1.1 (the value attribute can't be 
    non-numeric), and Mono now follows this behavior.  Add a "custom-switch" 
    value, which is used in the regression tests.
  * System/Test/System.Diagnostics/DiagnosticsConfigurationHandlerTest.cs: 
    .NET 1.1 requires that the value attribute be a numeric value; check for 
    that and update the success test so that they'll actually pass.
  * System/Test/System.Diagnostics/SwitchesTest.cs: TestNewSwitch reads 
    "custom-switch" now, and the switches value is now "42", not "0".  
    Remove warning about unused variable.


svn path=/trunk/mcs/; revision=39090
2005-01-18 13:25:34 +00:00
Jonathan Pryor d4bfe42607 * DiagnosticsConfigurationHandler.cs: Make DiagnosticsConfiguration.Settings
thread-safe (double-checked locking isn't thread safe on .NET without
    using a volatile variable, and setting the variable in the static
    constructor is easier anyway).
  * Switch.cs (GetConfigFileSetting): If the setting is non-numeric, set the
    attribute value to the string "0".  This is apparently what .NET 1.1 does,
    and allows the SwitchTest NUnit test to work w/o failures.

svn path=/trunk/mcs/; revision=38902
2005-01-13 22:00:27 +00:00
Duncan Mak 24f5ef2c44 Add MIT license to System.dll
svn path=/trunk/mcs/; revision=30054
2004-06-21 18:02:11 +00:00
Ben Maurer a68914c645 2004-03-23 Ben Maurer <[email protected]>
* Switch.cs: Don't throw when there is no switches section.

svn path=/trunk/mcs/; revision=24502
2004-03-23 20:57:13 +00:00
Jonathan Pryor 60d72a0f50 Switches (Boolean & Trace) should be working now. Behavior of user-provided
Switch derived classes should match that of .NET.

Go forth and use Swiches! ;-)

ChangeLog:
  * BooleanSwitch.cs: Complete re-write.  It works now.
  * DefaultTraceListener.cs:
    - Use `const' strings, so I don't worry about copy/paste errors
    - Give `AssertUiEnabled' an actual backing member
  * DiagnosticsConfigurationHandler.cs: To avoid race conditions, let the
    configuration handler set .config-specified properties on
    DefaultTraceListener (AssertUiEnabled, LogFileName) and TraceImpl
    (AutoFlush, IndentSize).
  * Switch.cs: Near complete re-write.  Actually works, and is (should be)
    comformant with .NET behavior.  Changed member names because they were
    confusing me.  (Yes, that doesn't say much about my memory.)
  * TextWriterTraceListener.cs: Append text to already existing files, don't
    overwrite them.
  * TraceImpl.cs:
    - Added private destructor, to ensure no instances are created.
    - Move members declarations to be closer to each other.
  * TraceSwitch.cs: Complete re-write.  It works now.

svn path=/trunk/mcs/; revision=9747
2002-12-18 16:01:09 +00:00
Jonathan Pryor 7187b5f041 Reformat to comply with Mono coding standards.
svn path=/trunk/mcs/; revision=9735
2002-12-17 22:10:50 +00:00
Jonathan Pryor d3e0f61969 Moved public API documentation from the source files into the
/mcs/docs/apidocs/xml/en/System.Diagnostics/<class>.xml files.

svn path=/trunk/mcs/; revision=4974
2002-05-27 22:00:30 +00:00
Ravi Pratap M 87576192c0 2002-01-06 Ravi Pratap <[email protected]>
* Switch.cs, TraceListenerCollection.cs : Decorate incomplete bits
	with the MonoTODO attribute.

svn path=/trunk/mcs/; revision=1867
2002-01-06 10:48:33 +00:00
Nick Drochak 578624f79e 2001-09-09 Nick Drochak <[email protected]>
* ChangeLog: added this file

	* Switch.cs: call OnSwitchSettingChanged() when the switch setting is,
		yes you gessed it, changed.

svn path=/trunk/mcs/; revision=773
2001-09-09 10:07:15 +00:00
Miguel de Icaza 67c693c673 Add System.Diagnostics to System assembly
svn path=/trunk/mcs/; revision=712
2001-09-04 14:37:55 +00:00