Consider this code from ASP.NET MVC\'s source code:
public static IApplicationBuilder UseMvc(
[NotNull] this IApplicationBuilder app,
[No
The only attribute that can cause the compiler to generate an error is the ObsoleteAttribute. It is because this attribute's behavior is hard-coded into the compiler.
Attributes like the NotNull
attribute are generally meant for tools (like ReSharper) to generate warnings or errors while writing code. Please read about this particular attribute here.
You can also use tools like PostSharp to issue additional build-time errors.