Skip to content

vscode-dotnet-auto-attach Mirror | Please open new issues in our issue tracker on GitLab.com

License

Notifications You must be signed in to change notification settings

dennismaxjung/vscode-dotnet-auto-attach

Repository files navigation


logo
VS Code - .NET Auto Attach

Enables a seamless debugging experience when working with dotnet-watch.

The ".NET Auto Attach" extension is created to enable a seamless debugging experience when working with dotnet-watch. While dotnet-watch will rebuild and launch your application every time you change and store a file, you have to manually restart the debugger each time.

This is where ".NET Auto Attach" comes in and shines. After dotnet-watch restarts your application, it will attach the debugger to enable a seamless debugging experience while changing files on the fly.

Features

Attach debugger if dotnet-watch reloads

Reload and Attach

Solutions and Workspaces with multiple projects

The extension supports solutions and workspaces with multi projects by letting you chose which project the auto-attacher should target.

Multiproject Support

Disconnection detection

The extension notices when a project is no longer debugged and offers to re-attache if desired.

Disconnect detected

Requirements

  • C# - C# for Visual Studio Code (powered by OmniSharp).

Getting Started

  1. Install the extension
  2. Restart VS Code and open the folder containing the project you want to work on.

Using the debugger

When your ".NET: Auto Attach Debug (dotnet-watch)" launch config is set up, you can debug your project. Pick the launch config from the dropdown on the Debug pane in Code. Press the play button or F5 to start.

Configuration

The extension currently operates in only one mode - it can launch your project you want to debug with dotnet-watch.

Just like when using the normal C# debugger, you configure the mode with a .vscode/launch.json file in the root directory of your project. You can create this file manually, or Code will create one for you if you try to run your project and it doesn't exist yet.

Sample launch config

    {
      "type": "DotNetAutoAttach",
      "request": "launch",
      "name": ".NET Core Watch",
      "args": [

      ],
      "env": {
        "ASPNETCORE_ENVIRONMENT": "Development"
      }
    },

Sample launch config for a specific project

The extension will normaly ask you which project should get launched when your workspace contains multiple projects. However, you can pre-set which project should get launched.

    {
      "type": "DotNetAutoAttach",
      "request": "launch",
      "name": ".NET Core Watch: dotnet-test.console",
      "project": "dotnet-test.console.csproj",
      "args": [

      ],
      "env": {
        "ASPNETCORE_ENVIRONMENT": "Development"
      }
    },

Project tree

Release Notes & Known Issues

See the CHANGELOG.md for the details of changes for each version and known issues.

Built With

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

Authors

See also the list of contributors who participated in this project. Or the list of members.

License

This project is licensed under the MIT License - see the LICENSE.md file for details.