Problem description:

While working on an issue recently, we found that build completion alerts does not show static analysis warnings.


There is a difference between compilation warnings and static analysis warnings.

When the build gets completely, in UI, it will show you both type of warnings combined like below:

Solution and troubleshooting Steps:

 So on the above result basis, when you configure buildcompletionevent alerts, you will expect that it should show the same warning.

But what we found in email alert was 19 errors and 0 warnings and that’s where catch was and it had to be diagnosed thoroughly as provided below:

Step 1:

So first tbl_buildinformation table was queried and it was having this xml:

<Fields><Field Name="CompilationErrors"><Value>19</Value></Field>

<Field Name="CompilationWarnings"><Value>0</Value></Field>

<Field Name="FinishTime"><Value>2014-04-17T14:59:19.7013138Z</Value></Field>

<Field Name="Flavor"><Value>Release</Value></Field>

<Field Name="LocalPath"><Value>C:\Builds\AgentBuild\abc.sln</Value></Field>

<Field Name="Platform"><Value>Any CPU</Value></Field>

<Field Name="ServerPath"><Value>$/abc/abc.sln</Value></Field>

<Field Name="StartTime"><Value>2014-04-17T14:59:03.9802421Z</Value></Field>

<Field Name="StaticAnalysisErrors"><Value>0</Value></Field>

<Field Name="StaticAnalysisWarnings"><Value>123</Value></Field>

<Field Name="TargetNames"><Value/></Field></Fields>

Step 2:

 Then looking at BuildCompletedEvent.xsl, led us to find following lines:

<xsl:value-of select="tb:Fields/tb:InformationField[@Name = 'TotalCompilationErrors']/@Value"/> error(s),

<xsl:value-of select="tb:Fields/tb:InformationField[@Name = 'TotalCompilationWarnings']/@Value"/> compilation warnings(s),

 Add digging deep into that led us to find one more line in it:

 <xsl:value-of select="tb:Fields/tb:InformationField[@Name = 'TotalStaticAnalysisWarnings']/@Value"/> static analysis warning(s)

 After that you will have alerts with both type of warnings separately visible like below, hence issue solved!!


  Written by: Deepak Mittal, Support Escalation Engineer

  Reviewed by: George Archer(Senior Escalation Engineer), Nitish Nagpal(Support Escalation Engineer)