My target framework is .NET 5 and type of application is Console. I am using Visual Studio 2019 version 16.10.1 as an IDE. I wanted to see if I indeed get a warning if I use CLSCompliant hint in my C# code and purposely violate CLS compliance. The violation is achieved by referring to a variable of type UInt32 since is not specified in the CLS. But it appears I am not getting any error or warning whatsoever.
Here is the code:-
using System;
[assembly: CLSCompliant(true)]
namespace Demo
{
class Program
{
static void Main(string[] args)
{
UInt32 x = 12;
Console.WriteLine(Convert.ToString(x));
}
}
}
Do I have to change some IDE settings for this to show me CLS related warnings?