Bug 12001 - System.Diagnostics.TraceSource constructor does not set defaultLevel correctly.
Summary: System.Diagnostics.TraceSource constructor does not set defaultLevel correctly.
Status: RESOLVED FIXED
Alias: None
Product: Class Libraries
Classification: Mono
Component: System ()
Version: unspecified
Hardware: Other Linux
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2013-04-27 08:38 UTC by Jack Murray
Modified: 2013-05-09 08:53 UTC (History)
4 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description Jack Murray 2013-04-27 08:38:24 UTC
When using the 2-argument constructor of TraceSource to set the default trace level, it does not get set correctly. Repro code:

using System;
using System.Diagnostics;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            TraceSource s = new TraceSource("Source1");
            Console.WriteLine(s.Switch.Level.ToString());

            s = new TraceSource("Source2", SourceLevels.All);
            Console.WriteLine(s.Switch.Level.ToString());

            s = new TraceSource("Source3");
            s.Switch.Level = SourceLevels.All;
            Console.WriteLine(s.Switch.Level.ToString());
        }
    }
}

Output from Microsoft .NET on Windows 7:

Off
All
All

Output from Mono 2.10.8.1-5 running on a Raspberry Pi (ARM):

Off
Off
All

Setting the value after constructing the object works (3rd line of output), but setting it from the constructor fails (2nd line).
Comment 1 Marek Safar 2013-05-09 08:53:48 UTC
Fixed in master