FxCop and CLS Compliance
After finding out that VB.NET does not enforce CLS compliance (even with the CLSCompliant attribute set to True), I thought I could use FxCop to check this. Although ServerGeek said that FxCop complains about non-CLS compliance, I did not see such behavior. I created a simple, non-CLS compliant VB.NET assembly:
Namespace TestCls Public Class BadStuff Public Function CheckThis() As UInt32 Return UInt32.Parse("5") End Function End Class End Namespace
And got no complaints from FxCop (1.21) about it not being CLS compliant -- which it isn't since it exposes a non-CLS datatype (UInt32). Further research showed Peter Drayton mentioning FxCop as a possible use for this. Sam Gentile also commented that a tool to verify CLS compliance would be nice. I'm surprised there is no standalone tool for checking CLS compliance. Anyone working on a custom rules engine for FxCop for this purpose?
And please don't send me emails saying "csc.exe" is the tool you use to enforce CLS compliance! :)