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#:
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
Tomas Petricek (
Blog), C# MVP
My book:
Real-world Functional Programming in .NET