Hi,
There is one change in the latest versio (1.9.4.17) - it reflects .NET "Conditional" attribute, so calls to Trace.Write are ignored unless you define symbol "TRACE" (by adding "--define TRACE" in the arguments). After addig this it worked for me. It reports the warning FS0070 and prints 'test' which is what I'd expect.

The warning should IMHO just inform you that the overriding may be tricky. F# doesn't directly support overloading and TraceListener has Write(s:string) and Write(o:object), so when overriding the method you need to be more cautious to make sure that you override the on which you wanted (e.g. by specifying type annotations as you did). If you wanted to override both of them, you'd have to use OverloadID attribute, which is a trick for overloads in F#:

1
2
3
4
5
6
7
8
9
10
11
12
13
type LogTraceListener = 
  class 
    inherit TraceListener 
    new() as x = {} 
    [<OverloadID("WriteStr")>]
    override x.Write(s: String) = 
      Console.Write(s) 
    [<OverloadID("WriteObj")>]
    override x.Write(s: obj) = 
      Console.Write(s) 
    override x.WriteLine(s: string) = 
      Console.WriteLine(s) 
  end 
By on 5/26/2008 4:49 PM ()

Thanks!

By on 5/26/2008 10:41 PM ()
IntelliFactory Offices Copyright (c) 2011-2012 IntelliFactory. All rights reserved.
Home | Products | Consulting | Trainings | Blogs | Jobs | Contact Us | Terms of Use | Privacy Policy | Cookie Policy
Built with WebSharper