tags:

views:

252

answers:

3

Is there a tool out there that anyone knows of that can analyse my .net code (C# and vb.net) and tell me why things are not CLS Compliant?

Visual Studio is happy to tell me a parameter is not CLS compliant, but it gets me no closer to fixing the problem as i don't know the cause.

Example VS Error:

parameter 'xyz' is not CLS-Compliant
A: 

Preemptive rebuttal: to my knowledge, FxCop does not support CLS compliance checks. Perhaps code analysis in VS does but I cannot check at work.

You could just google the warning message you get.

HTH, Kent

Kent Boogaart
the problem being is VS just says 'parameter 'xyz' is not CLS-Compliant'...
Pondidum
+1  A: 

From memory it's not too hard to do. I'm not aware of a tool, but this page here describes what you need to change.

The big ones are using type specific structs (think uint32 instead of uint) and using an "_" in your public members.

Spence
+3  A: 

Can't say I know of a tool and I tend to use this page:

http://msdn.microsoft.com/en-us/library/12a7a7h3.aspx

to check if the type of the parameter/variable is CLS compliant. See the section of the table named 'Types'. You maybe do this already but I thought I'd pop it in an answer for those that don't.

There was also a fair bit of discussion about this some time ago:

http://weblogs.asp.net/psteele/archive/2003/07/21/10358.aspx

HTH
Kev

Kev