Base type is not CLS-compliant, what reasons of this warning?

DarkDeny picture DarkDeny · Oct 25, 2010 · Viewed 28.6k times · Source

I have got warning from subject on one of my classes. Actually class is very simple, just an inheritor of my generic base type. Also I have some other inheritors from that generic class across the solution, and there are no such warnings.

What could be the reason(s) of this? Compiler does not give any clues of why base type is not CLS-compliant

Answer

Pieter van Ginkel picture Pieter van Ginkel · Oct 25, 2010

You probably have [assembly:CLSCompliant(true)] somewhere in that specific project. This triggers the compiler to check all types to be CLS compliant. You can override this for a type or method or something with [CLSCompliant(false)].