Skip to content
This repository was archived by the owner on Apr 16, 2020. It is now read-only.
This repository was archived by the owner on Apr 16, 2020. It is now read-only.

sourcelink test does not match URLs correctly #386

Description

@tmat

This function does not handle multiple source link entries correctly: https://github.com/ctaggart/SourceLink/blob/master/dotnet-sourcelink/Program.cs#L477

Consider, for example, the following source link JSON:

{
  "documents":
  {
    "/_/*":"https://raw.githubusercontent.com/aspnet/AspNetCore/0049c5899ca78e8fef7d77b355b555b793bf6616/*",
    "/_/src/submodules/googletest/*":"https://raw.githubusercontent.com/google/googletest/4e4df226fc197c0dda6e37f5c8c3845ca1e73a49/*",
    "/_/src/submodules/MessagePack-CSharp/*":"https://raw.githubusercontent.com/aspnet/MessagePack-CSharp/8861abdde93a3b97180ac3b2eafa33459ad52392/*"
  }
}

and a document path in the PDB:

/_/src/submodules/MessagePack-CSharp/src/MessagePack/SequencePool.cs

This path should match the last pattern /_/src/submodules/MessagePack-CSharp/* but it matches the first one.

The longest matching patter should be used.

See https://github.com/dotnet/designs/blob/master/accepted/diagnostics/source-link.md:

Source Link JSON may contain multiple relative and/or absolute mappings in any order. They will be resolved in order from most specific to least specific. Here is an example of a valid Source Link JSON for an arbitrary project structure

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions