KirillOsenkov / MSBuildStructuredLog

A logger for MSBuild that records a structured representation of executed targets, tasks, property and item values.
MIT License
1.41k stars 188 forks source link

0 ms is displayed for all analyzers under Analyzer Summary when using incompatible culture #687

Closed Korexio closed 1 year ago

Korexio commented 1 year ago

Found in version: 2.1.820

Steps to reproduce:

Use the 'en-US' culture:

Set-Culture 'en-US'

Create a new example project:

dotnet new console

Enable code analysis, build the example project and generate a msbuild.binlog file:

dotnet build -bl -p:ReportAnalyzer=true -p:AnalysisLevel=latest-all

Open the msbuild.binlog file in MSBuild Structured Log Viewer using the 'de-AT' culture:

Set-Culture 'de-AT'
./msbuild.binlog

Expected

Correct execution time is displayed for all analyzers under Analyzer Summary.

Actual

0 ms is displayed for all analyzers under Analyzer Summary.

Cause

No NumberFormat/CultureInfo is specified in Microsoft.Build.Logging.StructuredLogger.CscTaskAnalyzer.AnalyzerAssemblyData.FromFolder > ParseLine when parsing the execution time.

Workaround

Use Set-Culture 'en-US' or something similar before starting MSBuild Structured Log Viewer.

Suggested Fix

Use the culture (CurrentUICulture?) value from the log file to parse the execution time.