microsoft/sarif-visualstudio-extension

Double clicking an error list item when the start of message is the same causes order to scramble

edkazcarlson-ms opened this issue · 0 comments

If the first line in the message.text field is the same across multiple results, double clicking an error list row can cause the order to scramble.
Repro steps:

  1. Open https://github.com/microsoft/sarif-testing/blob/webgoat/src/WebGoat.NET/AddNewUser.aspx.cs in visual studio
    image
  2. Copy paste the following sarif data into a file, drag and drop it into VS
{
  "$schema": "https://schemastore.azurewebsites.net/schemas/json/sarif-2.1.0-rtm.5.json",
  "version": "2.1.0",
  "runs": [
    {
      "tool": {
        "driver": {
          "guid": "00000000-0000-4000-9000-000000000000",
          "name": "Demo",
          "shortDescription": {
            "text": "Random description"
          },
          "fullName": "Demo Insight",
          "version": "1.0.0.0",
          "rules": [
            {
              "id": "Rule-0",
              "shortDescription": {
                "text": "Random rule"
              }
            }
          ]
        }
      },
      "results": [
          {
              "ruleId": "Demo-0",
              "level": "note",
              "message": {
                "text": "Text example\n123"
              },
              "locations": [
                {
                  "physicalLocation": {
                    "artifactLocation": {
                      "uri": "src/WebGoat.NET/AddNewUser.aspx.cs"
                    },
                    "region": {
                      "startLine": 56,
                      "snippet": {
                        "text": "case MembershipCreateStatus.InvalidAnswer:"
                      }
                    }
                  },
                  "logicalLocations": [
                    {
                      "fullyQualifiedName": "CreateAccountButton_Click"
                    }
                  ]
                }
              ]
            },
            {
              "ruleId": "Demo-0",
              "level": "warning",
              "message": {
                "text": "Text example\n456"
              },
              "locations": [
                {
                  "physicalLocation": {
                    "artifactLocation": {
                      "uri": "src/WebGoat.NET/AddNewUser.aspx.cs"
                    },
                    "region": {
                      "startLine": 70,
                      "snippet": {
                        "text": "protected void RegisterUser_CreatingUser(object sender, LoginCancelEventArgs e)"
                      }
                    }
                  },
                  "logicalLocations": [
                    {
                      "fullyQualifiedName": "RegisterUser_CreatingUser"
                    }
                  ]
                }
              ]
            },
            {
              "ruleId": "Demo-0",
              "level": "warning",
              "message": {
                "text": "Text example\n789"
              },
              "locations": [
                {
                  "physicalLocation": {
                    "artifactLocation": {
                      "uri": "src/WebGoat.NET/AddNewUser.aspx.cs"
                    },
                    "region": {
                      "startLine": 56,
                      "snippet": {
                        "text": "case MembershipCreateStatus.InvalidAnswer:"
                      }
                    }
                  },
                  "logicalLocations": [
                    {
                      "fullyQualifiedName": "CreateAccountButton_Click"
                    }
                  ]
                }
              ]
            },
            {
              "ruleId": "Demo-0",
              "level": "note",
              "message": {
                "text": "Text example\nabc"
              },
              "locations": [
                {
                  "physicalLocation": {
                    "artifactLocation": {
                      "uri": "src/WebGoat.NET/AddNewUser.aspx.cs"
                    },
                    "region": {
                      "startLine": 33,
                      "snippet": {
                        "text": "case MembershipCreateStatus.InvalidAnswer:"
                      }
                    }
                  },
                  "logicalLocations": [
                    {
                      "fullyQualifiedName": "CreateAccountButton_Click"
                    }
                  ]
                }
              ]
            },
            {
              "ruleId": "Demo-0",
              "level": "note",
              "message": {
                "text": "Text example\ndef"
              },
              "locations": [
                {
                  "physicalLocation": {
                    "artifactLocation": {
                      "uri": "src/WebGoat.NET/AddNewUser.aspx.cs"
                    },
                    "region": {
                      "startLine": 56,
                      "snippet": {
                        "text": "case MembershipCreateStatus.InvalidAnswer:"
                      }
                    }
                  },
                  "logicalLocations": [
                    {
                      "fullyQualifiedName": "CreateAccountButton_Click"
                    }
                  ]
                }
              ]
            },
            {
              "ruleId": "Demo-0",
              "level": "note",
              "message": {
                "text": "Text example\nghi"
              },
              "locations": [
                {
                  "physicalLocation": {
                    "artifactLocation": {
                      "uri": "src/WebGoat.NET/AddNewUser.aspx.cs"
                    },
                    "region": {
                      "startLine": 22,
                      "snippet": {
                        "text": "SecurityQuestion.Text = passwordQuestion;"
                      }
                    }
                  },
                  "logicalLocations": [
                    {
                      "fullyQualifiedName": "CreateAccountButton_Click"
                    }
                  ]
                }
              ]
            },
            {
              "ruleId": "Demo-0",
              "level": "note",
              "message": {
                "text": "Text example\njkl"
              },
              "locations": [
                {
                  "physicalLocation": {
                    "artifactLocation": {
                      "uri": "src/WebGoat.NET/AddNewUser.aspx.cs"
                    },
                    "region": {
                      "startLine": 56,
                      "snippet": {
                        "text": "case MembershipCreateStatus.InvalidAnswer:"
                      }
                    }
                  },
                  "logicalLocations": [
                    {
                      "fullyQualifiedName": "CreateAccountButton_Click"
                    }
                  ]
                }
              ]
            },
            {
              "ruleId": "Demo-0",
              "level": "error",
              "message": {
                "text": "Text example\nmno"
              },
              "locations": [
                {
                  "physicalLocation": {
                    "artifactLocation": {
                      "uri": "src/WebGoat.NET/AddNewUser.aspx.cs"
                    },
                    "region": {
                      "startLine": 21,
                      "snippet": {
                        "text": "if (!Page.IsPostBack)"
                      }
                    }
                  },
                  "logicalLocations": [
                    {
                      "fullyQualifiedName": "Page_Load"
                    }
                  ]
                }
              ]
            }
          ]
        }
  ]
}
  1. Double click one of the error list items. Seems to only happen with the ones that are not the first in the list for a certain failure level.
  2. The list order will get scrambled, with the item moving around as such
    image
    image