Skip to content

Component-level debugging support (dotnet) #567

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

EronWright
Copy link
Contributor

Extends debugging support to components via RunPlugin.

@@ -1064,8 +1075,31 @@ func (host *dotnetLanguageHost) RunPlugin(
return err
}

// Now run from source without re-building.
args = append(args, "run", "--no-build", "--project", project, "--")
Copy link
Contributor Author

@EronWright EronWright Apr 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here's a brief explanation for what's happening here, which is a small change to how the pre-built executable is run.

As before, the plugin builds the project before running it, to capture build output for display purposes. Then it runs the pre-built executable. Previously, we used dotnet run --no-build --project ... to do that. The dotnet run sub-command automatically locates and executes the pre-built executable (e.g. <project>/bin/Debug/net8.0/dotnet-components.dll).

The issue with that approach is that it runs the executable as a sub-process that is impractical to attach to. The new approach is to run the executable directly using dotnet <assembly-name>, which one may attach to directly and is how the Run RPC is implemented.

To use dotnet <assembly-name>, one must locate the assembly by hand. The Run code uses an awkward approach (see code), so here I'm trying a different way that is based on interrogating msbuild for information about the build outputs:

// dotnet msbuild -getProperty:OutputPath -getProperty:AssemblyName
{
  "Properties": {
    "OutputPath": "bin/Debug/net8.0/",
    "AssemblyName": "dotnet-components"
  }
}

I do think that dotnet msbuild -getProperty is a portable command; anyone disagree? (ref)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant