[Mono-dev] System.Diagnostics.Trace.Write(Line) doesn't seem to work

Sorin Peste neaorin at gmail.com
Sun Oct 15 18:41:15 EDT 2006


Well that makes a little more sense for me ;)
So should I go ahead and file a bug report for Boo?


Thanks,
Sorin

Cedric Vivier wrote:
> Well actually you just have to compile with /d:TRACE for mcs to emit
> calls to Trace.* methods! :)
>
> So in fact you just helped me to spot a Boo bug ;)
>
> 2006/10/16, Cedric Vivier < cedricv at neonux.com
> <mailto:cedricv at neonux.com>>:
>
>     Hi!
>
>     I just tried on Mono 1.1.17.1 <http://1.1.17.1> on Linux and no
>     more luck.
>     The weird thing is that the same code in Boo does work!
>
>     C# version :
>     using System;
>
>     class MainClass
>        {
>            public static void Main()
>            {
>                    System.Diagnostics.Trace.Listeners.Add(new
>     System.Diagnostics.TextWriterTraceListener(Console.Out));
>                    System.Diagnostics.Trace.WriteLine ("Hello world!");
>            }
>        }
>
>     Outputs: nothing!
>
>
>     Boo version :
>
>     import System
>
>     System.Diagnostics.Trace.Listeners.Add(System.Diagnostics.TextWriterTraceListen$
>
>     System.Diagnostics.Trace.WriteLine ("Hello world!")
>
>     Outputs: Hello world!
>
>
>     If you run monodis on the C#-compiled version you will find that
>     there is no call to Trace.WriteLine at all... so it seems to be
>     more a mcs/gmcs bug than a runtime/classlib bug.
>
>
>     Regards,
>
>
>     2006/10/16, Sorin Peste <neaorin at gmail.com
>     <mailto:neaorin at gmail.com>>:
>
>         Hello,
>
>         I'm having a problem trying to use Trace to output messages
>         from my
>         console application. Basically nothing gets sent out to the trace
>         listeners; I've tried using both a file and Console.Out and no
>         luck.
>
>         This is what I did:
>
>         1. created a file Trace.cs and put the following code in it:
>
>         using System;
>
>         class MainClass
>             {
>                 public static void Main(string[] args)
>                 {
>                     using ( System.IO.StreamWriter file =
>         System.IO.File.CreateText("output.txt")) {
>                         System.Diagnostics.Trace.Listeners.Add(new
>         System.Diagnostics.TextWriterTraceListener(Console.Out));
>                          System.Diagnostics.Trace.Listeners.Add(new
>         System.Diagnostics.TextWriterTraceListener(file));
>                         System.Diagnostics.Trace.WriteLine("Hello
>         world!");
>                     }
>                 }
>             }
>
>         2. compiled with
>             mcs -out:Trace.exe Trace.cs
>         3. ran with
>             mono Trace.exe
>
>         No output was sent to the console and the output.txt file is
>         empty. The
>         same program compiled on Windows .NET produces the correct
>         results.
>         I'm running mono 1.1.18 installed via SUSE RPMs. I have SUSE
>         10.1 i386
>         kernel 2.6.16.
>         I looked a bit at the relevant source files in SVN HEAD, but i was
>         unable to spot any problems.
>         This is my first mail on this list, so I apologize if this has
>         been
>         posted before. Thank you for any help. If I can provide more
>         information, or file a bug report, please let me know.
>
>         Sorin
>         _______________________________________________
>         Mono-devel-list mailing list
>         Mono-devel-list at lists.ximian.com
>         <mailto:Mono-devel-list at lists.ximian.com>
>         http://lists.ximian.com/mailman/listinfo/mono-devel-list
>
>
>




More information about the Mono-devel-list mailing list