Skip to content

Variant Analysis Results fails to show results if query message contains placeholder which is not part of source #2622

Closed
@Marcono1234

Description

@Marcono1234

Describe the bug
When a query contains a placeholder in the query message ($@), and the results of a Variant Analysis run have a value for that placeholder which is not part of the source of a project, then the Variant Analysis Results view fails to show results.

Additionally the following is logged in the extension log:

Error when processing SARIF result: TypeError: Cannot read properties of undefined (reading 'startLine')

Version
Extension version

CodeQL extension version: 1.8.8 
CodeQL CLI version: 2.14.0 
Platform: win32 x64

VS Code version

Version: 1.80.1 (user setup)
Commit: 74f6148eb9ea00507ec113ec51c489d6ffb4b771
Date: 2023-07-12T17:22:07.651Z
Electron: 22.3.14
ElectronBuildId: 21893604
Chromium: 108.0.5359.215
Node.js: 16.17.1
V8: 10.8.168.25-electron.0
OS: Windows_NT x64 10.0.19045

To reproduce

  1. Open Quick Query and paste the following query
    /**
     * @kind problem
     */
    
    import java
    
    // Pick arbitrary element which is part of source; chose EnumType here because projects
    // likely don't have that many enum types
    // TypeString comes from the JDK and is not part of the source of the project
    from EnumType t, TypeString notPartOfSource
    where t.fromSource()
    select t, "message $@", notPartOfSource, notPartOfSource.getName()
  2. Run Variant Analysis, for example on the top 10 repositories
  3. On the Variant Analysis Results view click the triangle to expand the results
    ❌ Bug: No results are shown and an error is logged

Expected behavior
Results should be shown, but if the placeholder value is not part of the source, there should simply not be a link.

(Also: Maybe in general if an error while processing the SARIF result happens, the complete stack trace should be printed to the log to make debugging easier?)

Metadata

Metadata

Assignees

No one assigned

    Labels

    VSCodebugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions