38 Commits
Author SHA1 Message Date
Atsushi Eno d6bd25591b import System.Diagnostics.Trace etc. from referencesource. 2015-02-25 00:54:38 +08:00
Alexander Köplinger d77664ceb0 [System] Add performanceCounters element to System.Diagnostics app.config configuration section
See http://msdn.microsoft.com/en-us/library/ms229387(v=vs.110).aspx for details about the element.
The value that is set by the element isn't currently used in Mono, but applications using it in their app.config crash otherwise (e.g. http://stackoverflow.com/questions/25741651).
2014-09-14 07:45:11 +02:00
Alexander Köplinger 48e112d652 [Cleanup] Removed TARGET_JVM
It was once part of a special Java target profile, but this is no longer used today.
2014-08-08 03:28:34 +02: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
Jonathan Pryor 9f264b8748 Don't load app.config when we're processing app.config
Fixes #605033.

'cause stack overflow is back, mkay?

  at System.Diagnostics.TraceImpl.InitOnce () <0x0005b>
  at System.Diagnostics.TraceImpl.get_IndentLevel () <0x0000b>
  at System.Diagnostics.TraceListenerCollection.InitializeListener (System.Diagnostics.TraceListener) <0x0000f>
  at System.Diagnostics.TraceListenerCollection.Add (System.Diagnostics.TraceListener) <0x00017>
  at System.Diagnostics.TraceListenerCollection..ctor (bool) <0x0007f>
  at System.Diagnostics.TraceListenerCollection..ctor () <0x00013>
  at System.Diagnostics.DiagnosticsConfigurationHandler.GetSharedListeners (System.Collections.IDictionary) <0x00083>
  at System.Diagnostics.DiagnosticsConfigurationHandler.Create (object,object,System.Xml.XmlNode) <0x003cf>
  at System.Configuration.ConfigurationSection.GetRuntimeObject () <0x0033d>
  at System.Configuration.ClientConfigurationSystem.System.Configuration.Internal.IInternalConfigSystem.GetSection (string) <0x00041>
  at System.Configuration.ConfigurationManager.GetSection (string) <0x00030>
  at System.Configuration.ConfigurationSettings.GetConfig (string) <0x0000f>
  at System.Diagnostics.DiagnosticsConfiguration.get_Settings () <0x00043>
  at System.Diagnostics.TraceImpl.InitOnce () <0x0005b>

Thus, when we're getting the <sharedListeners/> element, we shouldn't call
the TraceListenerCollection default constructor, as that will attempt to add
the DefaultTraceListener (which isn't needed anyway, as the
DefaultTraceListener is explicitly added by TraceImplSettings).
2010-10-18 16:57:53 -04:00
Jonathan Pryor 3b6088ff92 * System.Diagnostics/DiagnosticsConfigurationHandler.cs: Use the new
TraceSourceInfo(string, SourceLevels, TraceImplSettings) constructor.
	* System.Diagnostics/TraceSourceInfo.cs: Add a new constructor, 
	  TraceSourceInfo(string, SourceLevels, TraceImplSettings), which adds
	  the DefaultTraceListener w/o depending upon (the possibly still
	  initializing) TraceImpl members.  Fixes #502944.
	* Test/test-config-file: Add a /configuration/system.diagnostics/source
	  section to elicit the buggy behavior found in #502944.

svn path=/trunk/mcs/; revision=133981
2009-05-12 18:53:16 +00:00
Jonathan Pryor f80c179df7 * DiagnosticsConfigurationHandler.cs: Don't refer to TraceImpl member
while reading the .config file, instead cache the values and refer
	  to the cached values during initialization.  This prevents recursive
	  initialization calls (Trace.OnInit() ... Trace.Listeners.Add() ...
	  Trace.OnInit() ...), and associated duplicate parsing of .config file
	  sections.  Fixes bnc#499442.
	* TraceImpl.cs: Cope with DiagnosticsConfigurationHandler changes.
	* TraceListenerCollection.cs: Add internal 
	  Add(TraceListener,TraceImplSettings) method for adding
	  TraceListeners during DiagnosticsConfigurationHandler initialization
	  (which can't access TraceImpl, as we may still be reading the
	  .config file to determine the TraceImpl values).

svn path=/trunk/mcs/; revision=133291
2009-05-01 20:21:50 +00:00
Gonzalo Paniagua Javier e4d01de353 2009-04-28 Gonzalo Paniagua Javier <[email protected]>
* ConsoleTraceListener.cs: add an internal constructor that takes a
	string argument. Used when 'initializeData' is set.
	* DiagnosticsConfigurationHandler.cs: try internal constructors when
	the assembly is System.
	Fixes bug #498853.


svn path=/trunk/mcs/; revision=132868
2009-04-28 17:47:15 +00:00
Gert Driesen a21deeae6a * DiagnosticsConfigurationHandler.cs (AddTraceAttributes): Avoid
wrapping configuration errors thrown during initialization of
TraceImpl. Fixed line endings.

svn path=/trunk/mcs/; revision=113629
2008-09-20 11:41:12 +00:00
Gert Driesen 0b2a27db70 * TraceListenerTest.cs: Added test for GetSupportedAttributes.
* DelimitedTraceListener.cs: Changed accessibility of
GetSupportedAttributes to protected internal.
* DiagnosticsConfigurationHandler.cs: Use GetSupportedAttributes to
allow custom attributes on tracelisteners. Fixes bug #413203.
* TraceListener.cs: Changed accessibility of GetSupportedAttributes
to protected internal. Removed MonoTODO on GetSupportedAttributes and
Attributes. Fixed line endings.

svn path=/trunk/mcs/; revision=109500
2008-08-02 20:06:21 +00:00
Atsushi Eno bbd60d7cfe 2008-06-27 Atsushi Enomoto <[email protected]>
* DiagnosticsConfigurationHandler.cs: quick build fix (hopefully).


svn path=/trunk/mcs/; revision=106649
2008-06-26 16:49:15 +00:00
Gert Driesen 3ff3823088 * DiagnosticsConfigurationHandler.cs: On 2.0 profile, throw
ConfigurationErrorsException when any attribute other than 'Name'
is found when referencing a shared listener. Fixes bug #404054.
Added support for the traceOutputOptions attribute on 2.0 profile.
Fixes bug #403583.
* ConfigXmlDocument.cs: Implement IConfigErrorInfo on all Node classes.

svn path=/trunk/mcs/; revision=106628
2008-06-26 10:54:00 +00:00
Jb Evain 042f7dfb03 replace
svn path=/trunk/mcs/; revision=101930
2008-04-26 16:02:28 +00:00
Marek Safar e61dde083e Warnings cleanup
svn path=/trunk/mcs/; revision=89678
2007-11-15 14:14:49 +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 4ecf370fff 2007-08-02 Atsushi Enomoto <[email protected]>
* EventLogImpl.cs
	  EventLog.cs
	  LocalFileEventLog.cs : Implemented EntryWritten event support.
	* Win32EventLog.cs, NullEventLog.cs : they need stub overrides.
	* EventLogEntry.cs : [MonitoringDescription].
	* DiagnosticsConfigurationHandler.cs : [Obsolete]


svn path=/trunk/mcs/; revision=83277
2007-08-02 12:32:07 +00:00
Atsushi Eno 2528ab0258 2007-05-18 Atsushi Enomoto <[email protected]>
* TraceSourceInfo.cs : new class for storing configuration data.
	* TraceSource.cs : TraceEventCache arguments should be null (they are
	  nullable). Use TraceSourceInfo above.
	* DiagnosticsConfigurationHandler.cs : removed hack to store listeners
	  in named sources, not traceimpl. Create TraceSource objects from
	  configuration data.

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


svn path=/trunk/mcs/; revision=77640
2007-05-18 13:52:06 +00:00
Marek Safar 600771b439 2007-05-18 Marek Safar <[email protected]>
* flowanalysis.cs, statement.cs: Put back improved error handling.


svn path=/trunk/mcs/; revision=77631
2007-05-18 11:46:47 +00:00
Atsushi Eno 03a8c0e969 2007-05-19 Atsushi Enomoto <[email protected]>
* XmlWriterTraceListener.cs : open file in shared r/w mode.
	* DiagnosticsConfigurationHandler.cs : process <sharedListeners>
	  elements first, so that named listeners work fine.
	* EventLogTraceListener.cs : added 2.0 stubs.
	* CorrelationManager.cs : removed todo.


svn path=/trunk/mcs/; revision=77625
2007-05-18 11:10:36 +00:00
Atsushi Eno 1428fe4b97 2007-05-14 Atsushi Enomoto <[email protected]>
* EventTypeFilter.cs
	  TraceFilter.cs
	  SourceFilter.cs
	  SwitchLevelAttribute.cs
	  DelimitedListTraceListener.cs
	  SwitchAttribute.cs : new files in 2.0.
	* DiagnosticsConfigurationHandler.cs : partial support for named
	  shared listeners.
	* XmlWriterTraceListener.cs : cosmetic corcompare fixes. Added
	  missing todos.
	* TraceListener.cs : added missing 2.0 stuff. Implemented Filter.
	* DefaultTraceListener.cs : trivial ComVisible fix.

	* DiagnosticsConfigurationHandlerTest.cs : in 2.0 configuration item
	  listeners/add/@type is optional (for named shared listener support).

	* System.dll.sources :
	  Added EventTypeFilter.cs, TraceFilter.cs, SourceFilter.cs, 
	  DelimitedListTraceListener.cs, SwitchAttribute.cs and
	  SwitchLevelAttribute.cs in sys.diagnostics.


svn path=/trunk/mcs/; revision=77331
2007-05-14 08:02:36 +00:00
Vladimir Krasnov 4cfa5d0582 * DiagnosticsConfigurationHandler.cs: removed configuration init in TARGET_JVM since not supported
svn path=/trunk/mcs/; revision=73682
2007-03-04 14:30:22 +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
Atsushi Eno 83cc8c3fbf 2006-10-13 Atsushi Enomoto <[email protected]>
* DiagnosticsConfigurationHandler.cs : be more skeptic on
          broken configuration file.


svn path=/trunk/mcs/; revision=66638
2006-10-12 22:36:24 +00:00
Gonzalo Paniagua Javier 1d9c9e2441 Fix warnings
svn path=/trunk/mcs/; revision=43368
2005-04-21 00:47:25 +00:00
Jonathan Pryor 976e1157c7 * DiagnosticsConfigurationHandler.cs (DiagnosticsConfiguration):
Use a lock-free algorithm for creating the settings information.
  * TraceImpl.cs (InitOnce): Use a lock-free algorithm for creating the
    listeners collection and initializing the world.

svn path=/trunk/mcs/; revision=39098
2005-01-18 15:52:48 +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 9af2dd51ca Bring unit tests & mono up-to-date with .NET 1.1. The <system.diagnostics/>
configuration element /switches/add/@value attribute is now *required*, not
optional (as it was under .NET 1.0).

* System/System.Diagnostics/DiagnosticsConfigurationHandler.cs:
  The /switch/add/@value attribute isn't optional under .NET 1.1, so make 
  sure it exists.

* System/Test/test-config-file: Remove <add/> elements lacking a value 
  attribute.  .NET 1.1 doesn't support this anymore, and neither does Mono.

* System/Test/System.Diagnostics/DiagnosticsConfigurationHandlerTest.cs:
  .NET 1.1 doesn't permit <add/> elements without a value attribute.  
  Assert the same under Mono.


svn path=/trunk/mcs/; revision=39046
2005-01-17 20:42:06 +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
Gonzalo Paniagua Javier 8886aab23f Fix ChangeLog entry to tell the truth
svn path=/trunk/mcs/; revision=27708
2004-05-19 19:43:16 +00:00
Lluis Sanchez 14c59cfad1 * DiagnosticsConfigurationHandler.cs: If initializeData is provided, use the
constructor that only takes one string as parameter to construct the
	listener. The name is set using the Name property, not the constructor.

	* TextWriterTraceListener.cs: In Write*, do nothing if no writer was
	provided.

svn path=/trunk/mcs/; revision=25105
2004-04-06 19:05:13 +00:00
Marek Safar 69e8f23c41 2004-02-04 Marek Safar <[email protected]>
* Makefile: Build System.dll in two steps. Because of the circular
        dependency with System.XML.dll.

svn path=/trunk/mcs/; revision=22761
2004-02-04 08:30:20 +00:00
Andreas N 78dc7ab616 2003-07-13 Andreas Nahr <[email protected]>
* DiagnosticsConfigurationHandler.cs: Removed a never used variable
	* EventLog.cs: Small update to prevent a warning
	* EventLogPermission.cs: Implemented or implementation added
	* EventLogPermissionAttribute.cs: Implemented or implementation added
	* EventLogPermissionEntry.cs: Implemented or implementation added
	* EventLogPermissionEntryCollection.cs: Implemented or implementation added
	* EventLogTraceListener.cs: Implemented or implementation added
	* PerformanceCounterManager.cs: Implemented or implementation added
	* PerformanceCounterInstaller.cs: Made internal
	* PerformanceCounterCategory.cs: Implemented few members
	* PerformanceCounterPermission.cs: Implemented or implementation added
	* PerformanceCounterPermissionAttribute.cs: Implemented or implementation added
	* PerformanceCounterPermissionEntry.cs: Implemented or implementation added
	* PerformanceCounterPermissionEntryCollection.cs: Implemented or implementation added

svn path=/trunk/mcs/; revision=16177
2003-07-13 22:09:12 +00:00
Jonathan Pryor f69bd81f97 DiagnosticsConfigurationHandler.cs:
Don't assume that optional attributes are always present
  <assert/> can't have any child nodes
  Change in semantics: if the attribute isn't present, GetAttribute()
    returns null, not "".  This allows us to differentiate between an attribute
    not being present and an attribute with an empty value.
  Translate exceptions if a TraceListener type is invalid

ChangeLog: Update for the previous changes I forgot to record

svn path=/trunk/mcs/; revision=9806
2002-12-21 03:38:12 +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 b843881827 Implement DiagnosticsConfigurationHandler, so that .config files can contain
<system.diagnostics/> configuration sections.

svn path=/trunk/mcs/; revision=9733
2002-12-17 21:42:08 +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
John R. Hicks 8b06fe39dc Added DiagnosticsConfigurationHandler.cs to the build.
svn path=/trunk/mcs/; revision=1810
2002-01-04 11:30:03 +00:00