Search code examples
c#.netcompact-frameworkpinvoke

.NET Framework: Argument type 'uint' is not CLS-compliant on P/Invoke


It is safe to ignore this warning?

Argument type 'uint' is not CLS-compliant

I'm developing a Compact Framework applicatin and I have a lot of P/Invoke and I have to use uint, ushort, etc. as parameter's types.

I've used [CLSCompliantAttribute(false)] to avoid the warning messages but I don't know it is safe.

Some help would be apreciated.

Thanks.


Solution

  • If you are not writing a component intended to be used by others in a different language, then you do not need to be CLS-compliant. Just declare that you are not (as you've already done).

    However, it is possible to use uint internally and still provide a CLS compliant interface. Writing CLS-Compliant Code.

    (link updated)