To the Gendarme gurus, I don't know if the GC is smart enough to Dispose of resources for us, but I will assume that it does not hurt to help it. There are two patterns that Gendarme could look for.
class Foo { Foo() { IDisposable resource = new Resource(); throw new System.Exception(); resource.Dispose(); } } This should either be remedied with a try finally or with the using construct which encapsulates try finally (I vote for the latter as a suggested fix). Another related rule should be to check if resource.Dispose() is never called anywhere in scope. An unrelated pattern which is not too important to me: class Foo { Foo() { System.Console.WriteLine(string.Format("hello {9}", "world")); } } Note that I missed the zero and typed nine. Is it possible to promote Gendarme rules to compiler errors/warnings or would that somehow break compatibility with csc? Is it worth it if it means better code is produced? I realize that it won't matter as much once there is a nice Gendarme Plugin for MonoDevelop but even then, we could ask for severe flaws to be compiler warnings at least. Many thanks, Vlad Giszpenc
_______________________________________________ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list