Compilation succeeded even though there were some errors from Diagnostic Analyzer

Topics: APIs
Sep 29, 2014 at 2:40 PM
Edited Sep 29, 2014 at 3:05 PM
Why is that I'm able to compile a code which is showing an error in the error list. It seems like the compilation ignored the diagnostic errors.
What should I do to prevent the project from compiling when there are errors associated with custom diagnostic analyzer, which are some in-house code quality diagnostic analyzers.
Sep 29, 2014 at 3:59 PM
Is it one of your own diagnostic analyzer?
Could you provide a screenshot?

Are you sure it is an error, as a diagnostic can report back 4 basic types of message.
  • Error
    Prevents successful compilation (eg syntax error)
  • Warning
    Potentially something wrong but continues.
  • Info
    Not an error / warning just informative.
  • Hidden
    I don't know about this one.
Sep 29, 2014 at 5:48 PM
Yes it is my own diagnostic analyzer with the following DiagnosticDescriptor
internal static DiagnosticDescriptor Rule = new DiagnosticDescriptor(DiagnosticId, Description, MessageFormat, Category, DiagnosticSeverity.Error);
I'm using the default DiagnosticCodeFix template of Roslyn, and as you can see the code compiles perfectly.