Skip to content
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

Check in VS Code debug configurations #1769

Merged

Conversation

msafi
Copy link
Contributor

@msafi msafi commented Jul 24, 2020

When setting up BTCPay on VS Code IDE, VS Code will ask

image

When you click "Yes", you'll be presented with two options

image

If you select BTCPayServer.Tests, the C# extension will generate broken debug configurations. So pressing F5 will not work. At this point, to fix the issue, you have to delete .vscode/launch.json and .vscode/tasks.json then restart VS Code. It will prompt you again to add the missing assets and this time you can select BTCPayServer to get things to work.

To avoid this situation altogether, this PR checks-in the correct .vscode/launch.json and .vscode/tasks.json. With that, VS Code users would not be prompted to add missing assets. Pressing F5 should just work.

But I think there's some cruft in those files (see comments on the code below)

.vscode/launch.json Show resolved Hide resolved
.vscode/launch.json Show resolved Hide resolved
.vscode/tasks.json Show resolved Hide resolved
@Eskyee
Copy link
Contributor

Eskyee commented Jul 24, 2020

Links to documentation supporting these rule changes: https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-run

as a reminder!!

One reason that this might be done as a general practice is to keep secrets out of the repo.

If you're using environment variables to store DB passwords, API keys, and so on, you can configure those for your dev hosting environment under Project Properties -> Debug, as key-value pairs.

That configuration gets persisted locally in the project's launchSettings.json, so by keeping that file out of commits you avoid leaking privileged information into your repo.

Note though, that the current best practice is not to store secrets in this way at all during development, but to use the Secrets Manager instead.

found this extra Information in stack overflow.

@NicolasDorier
Copy link
Member

@msafi so with this, doing F5 under visual studio code just work?

Copy link
Member

@dennisreimann dennisreimann left a comment

Choose a reason for hiding this comment

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

Checked and for me it works. I can now cleanly start the app via the Debug menu and it comes up without warnings – this was different a while back, but I don't know if it's due to these changes that the warnings disappeared.
However, it works and once the changes @msafi and @Eskyee talked about are incorporated, this should help people getting started in VS Code more easily! Thanks 🍰

@msafi
Copy link
Contributor Author

msafi commented Jul 25, 2020

@NicolasDorier

@msafi so with this, doing F5 under visual studio code just work?

If they have the C# extension for VS Code installed, then yes, it should just work.

VS Code will prompt the user to install the C# extension when they open a cs file. Or we can also check-in .vscode/extensions.json with the following content so the user will be prompted to install the extension as soon as they open VS Code

{
  "recommendations": [
    "ms-dotnettools.csharp"
  ]
}

@rockstardev
Copy link
Member

rockstardev commented Jul 25, 2020

@msafi feel free to add extensions.json as well, that's a good suggestion.

@dennisreimann warnings are gone because of #1769 (comment)

@Eskyee
Copy link
Contributor

Eskyee commented Jul 25, 2020

just tested this latest pull request in visual studio code, and the builds are fine no problems detected,
ps now a much better UX on a Mac @NicolasDorier @msafi @rockstardev ;) thanks

@Eskyee
Copy link
Contributor

Eskyee commented Jul 25, 2020

@msafi once you finished here, could you test Visual Studio, and BTCPay Server, as a default, etc etc, because we had a few problems, with launch settings json, & developing easy on a Mac!! cheers

their are no problems developing with Rider IDE on a Mac. it checks out ok.

@msafi
Copy link
Contributor Author

msafi commented Jul 26, 2020

@Eskyee I just tested the configurations in VS Code and I was able to start the app and set a breakpoint. It seems to work.

I think this PR is ready to merge.

@Eskyee
Copy link
Contributor

Eskyee commented Jul 26, 2020

Cheers 🍻

@NicolasDorier NicolasDorier merged commit aeaaa2f into btcpayserver:master Jul 27, 2020
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.

None yet

5 participants