microsoft / sarif-visualstudio-extension

SARIF Microsoft Visual Studio Viewer Extension
MIT License
46 stars 19 forks source link

Error loading several SARIF logs #584

Closed Rinn closed 1 year ago

Rinn commented 1 year ago

I've come across two issues when trying to load .sarif logs generated with VS2022 by passing /experimental:log <path> to cl.exe when I was experimenting on the UnrealEngine code base. (Xiang from https://devblogs.microsoft.com/cppblog/the-future-of-c-compiler-diagnostics-in-msvc-and-visual-studio/ sent me this argument to test out)

This was with VS2022 17.5 and the Microsoft SARIF Viewer 2022 3.0.115.33558. The compiler used was from 17.4 msvc v14.34.31942.

The first was when I tried to open a .sarif compiled with /Wall (just so it would contain many warnings so I could see how that looked)

Processing the SARIF log file `D:\FN\Engine\Intermediate\Build\Win64\UnrealGame\Development\Core\Module.Core.1_of_16.cpp.sarif`.
An error occurred while processing SARIF log file `D:\FN\Engine\Intermediate\Build\Win64\UnrealGame\Development\Core\Module.Core.1_of_16.cpp.sarif` due to error: `JSON integer 18446744073709551615 is too large or small for an Int32. Path 'runs[0].results[662].relatedLocations[0].physicalLocation.region.startColumn', line 23339, position 71.`.
Opening file: D:\FN\Engine\Intermediate\Build\Win64\UnrealGame\Development\Core\Module.Core.1_of_16.cpp.sarif content type: SARIF

Module.Core.1_of_16.cpp.sarif.log

The second is when I tried to open a .sarif that contained no errors or warnings:

Processing the SARIF log file `D:\FN\Engine\Intermediate\Build\Win64\UnrealGame\Development\BuildSettings\Module.BuildSettings.cpp.sarif`.
An error occurred while processing SARIF log file `D:\FN\Engine\Intermediate\Build\Win64\UnrealGame\Development\BuildSettings\Module.BuildSettings.cpp.sarif` due to error: `Required property 'driver' not found in JSON. Path 'runs[0].tool', line 7, position 22.`.
Opening file: D:\FN\Engine\Intermediate\Build\Win64\UnrealGame\Development\BuildSettings\Module.BuildSettings.cpp.sarif content type: SARIF

Module.BuildSettings.cpp.sarif.log

I'll note that an empty .sarif generated with /analyze:log <path> does not have this issue:

Processing the SARIF log file `D:\FN\Engine\Intermediate\Build\Win64\UnrealGame\Development\BuildSettings\Module.BuildSettings.cpp.sa.sarif`.
0 results loaded from SARIF log file D:\FN\Engine\Intermediate\Build\Win64\UnrealGame\Development\BuildSettings\Module.BuildSettings.cpp.sa.sarif
The SARIF log file `D:\FN\Engine\Intermediate\Build\Win64\UnrealGame\Development\BuildSettings\Module.BuildSettings.cpp.sa.sarif` processed.
Opening file: D:\FN\Engine\Intermediate\Build\Win64\UnrealGame\Development\BuildSettings\Module.BuildSettings.cpp.sa.sarif content type: SARIF

Module.BuildSettings.cpp.sa.sarif.log

Rinn commented 1 year ago

Ah sorry, I just checked and the JSON integer 18446744073709551615 is too large or small for an Int32. error is already fixed with VS2022 17.6 Preview 1.