Roslyn Analyzer Rule does not fail the build
<p>Following on from <a href="https://msdn.microsoft.com/en-us/magazine/dn879356.aspx" rel="noreferrer">this</a> tutorial from MS, I have created an analyzer for Roslyn.</p>

<p>According to the page, you can mark the rule as <code>DiagnosticSeverity.Error</code>, and this will cause the build to break:</p>

<blockquote>
  <p>In the line declaring the Rule field, you can also update the severity of the diagnostics you’ll be producing to be errors rather than warnings. If the regex string doesn’t parse, the Match method will definitely throw an exception at run time, and you should block the build as you would for a C# compiler error. Change the rule’s severity to DiagnosticSeverity.Error:</p>
  
  <p>internal static DiagnosticDescriptor Rule =
  new DiagnosticDescriptor(DiagnosticId, Title, MessageFormat,
  Category, DiagnosticSeverity.Error, isEnabledByDefault: true, description: Description);</p>
</blockquote>

<p>In my code, I have created the rule more or less as detailed here:</p>

<pre><code>private static readonly DiagnosticDescriptor Rule = 
  new DiagnosticDescriptor(DiagnosticId, Title, MessageFormat, Category,
  DiagnosticSeverity.Error, true, helpLinkUri: HelpUrl);
</code></pre>

<p>This rule works fine. It throws up the red lines, it displays the message in the errors list. However, the build succeeds, and I am able to successfully run the application.</p>

<p><strong>NB:</strong> I've created this rule to capture <code>Thread.Sleep</code> for this example.</p>

<p><a href="https://i.stack.imgur.com/7yPxF.png" rel="noreferrer"><img src="https://i.stack.imgur.com/7yPxF.png" alt="Code Capture"></a></p>

<p>Is there additional setup required to ensure a rule breaks the build?</p>