Skip to content

Question: VSTest/MTP debugger integration #7321

@GustavEikaas

Description

@GustavEikaas

Hello,

Description

I got such good help last time in #5487 and #3725. I was wondering if there are any examples/docs on how to make vstest and MTP request a debugger?

For context I am building a neovim plugin for dotnet development. This is accompanied by a JSON-RPC C# "IDE" server which handles the more complex features. I am able to programatically discover and run tests both in VSTest and MTP using Translation layer and RPC. But for both I am confused on how to make them request a debugger

VSTest

internal sealed class TestRunHandler() : ITestRunEventsHandler
{
  public List<TestResult> Results = [];

  public void HandleLogMessage(TestMessageLevel level, string? message) { }

  public void HandleRawMessage(string rawMessage) { }

  public void HandleTestRunComplete(TestRunCompleteEventArgs testRunCompleteArgs, TestRunChangedEventArgs? lastChunkArgs, ICollection<AttachmentSet>? runContextAttachments, ICollection<string>? executorUris) { }
  public void HandleTestRunStatsChange(TestRunChangedEventArgs? testRunChangedArgs)
  {
    if (testRunChangedArgs?.NewTestResults is not null)
    {
      Results.AddRange(testRunChangedArgs.NewTestResults);
    }
  }

// How to make vstest call this so i can hook in my debugger?
  public int LaunchProcessWithDebuggerAttached(TestProcessStartInfo testProcessStartInfo) => throw new NotImplementedException();
}

MTP

I start the server with these flags
--server --client-host localhost --client-port {port} --diagnostic --diagnostic-verbosity trace

internal class MtpRpc
{
  //how to make server call this?
  [JsonRpcMethod("client/attachDebugger", UseSingleObjectParameterDeserialization = true)]
  public static Task AttachDebuggerAsync(AttachDebuggerInfo attachDebuggerInfo) => throw new NotImplementedException();

  [JsonRpcMethod("testing/testUpdates/tests")]
  public Task TestsUpdateAsync(Guid runId, TestNodeUpdate[]? changes)
  {
//....
  }
}

Hopefully my question is both in right repo and makes sense

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions