dotnet / dotnet/project-system

Add ability to suppress token substitution in launch settings strings

Open
#8,906 1 comment 0 reactions 0 assignees View on GitHub
Feature-Debugging Triage-Investigate
Dominant language
C#
Stars
1k
Forks
415
PR merge metrics
No merged PRs in 30d

Description

(Reported via email.)

When launching the debugger, some values in launch profiles have tokens substituted. There are two forms of this:

1. Environment variables which appear as `%MY_ENV_VAR%`.
2. MSBuild properties which appear as `$(MyProperty)`.

It's currently not possible to suppress this behaviour, if you want the value to be passed through unmodified.

---

For example, the following launch profile:

```json
{
"profiles": {
"MyProject": {
"commandName": "Project",
"commandLineArgs": "$(foo.bar)"
}
}
}
```

If you want the literal value `$(foo.bar)` to be passed verbatim to the launched executable, there is no way to achieve that today.

---

The class [`DebugTokenReplacer`](https://github.com/dotnet/project-system/blob/eb4e01a2d65fae7b0d466718356e7b9c5a175dcd/src/Microsoft.VisualStudio.ProjectSystem.Managed/ProjectSystem/Debug/DebugTokenReplacer.cs) is responsible for this substitution. Any fix to this issue is likely to apply to that class.

Contributor guide

Open the contributing guide

Research direction

Start with src/Microsoft.VisualStudio.ProjectSystem.Managed/ProjectSystem/Debug/DebugTokenReplacer.cs, which handles substitution for launch profile strings. Trace how %MY_ENV_VAR% and $(MyProperty) values are processed, then define a way for a launch profile value such as $(foo.bar) to be passed verbatim to the launched executable.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
tooling
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.