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

[vNext] Manually attach to process using sudo/root #39

Open
thomasgalliker opened this issue Oct 13, 2022 · 5 comments
Open

[vNext] Manually attach to process using sudo/root #39

thomasgalliker opened this issue Oct 13, 2022 · 5 comments
Assignees
Labels
enhancement Approved new feature or enhancement v2.2 v3.0
Milestone

Comments

@thomasgalliker
Copy link

Unfortunately, I cannot use VsLinuxDebug to build, deploy and attach. Build and deploy works fine but it does not attach automatically and it's quite frustrating since I don't see any error message in the output window.

Your help is very much appreciated. I have to run several commands in my C# console app under administrative rights, e.g. modify the wpa_supplicant configuration etc... Therefore, I have to launch my console app using "sudo dotnet consoleapp.dll". Whenever I want to attach the debugger, It complains it also requires root previleges in order to attach.

@DamianSuess DamianSuess added the bug Something isn't working label Oct 15, 2022
@DamianSuess DamianSuess added this to the v2.x milestone Oct 15, 2022
@DamianSuess DamianSuess self-assigned this Oct 15, 2022
@DamianSuess DamianSuess added feedback-requested Further information is requested and removed bug Something isn't working labels Oct 15, 2022
@DamianSuess
Copy link
Collaborator

DamianSuess commented Oct 15, 2022

Thank you @thomasgalliker for reaching out. To assist:

  • Which distribution/version of Linux are you using?
  • Which version of .NET are you using?

In the meantime, as a test, could you try the following? And since this is a console app, Step 1 is just needed to assist with allowing the app to start and wait for the remaining manual steps.

  1. Add a Console.ReadLine(); at the beginning of Main()
  2. Set a breakpoint on a line of code right after the ReadLine()
  3. Follow the Wiki article, Debugging Manually to deploy and Attach to Process.
  4. Are you able to attach to the process and does it hit your breakpoint?

In version 2.0, the main drive is debugging stability. It's known that some distributions or configurations can be troublesome for a fully automated debugging process. Though you're having an issue, your assistance is greatly appreciated to ensure project stability.

Thank you!

@thomasgalliker
Copy link
Author

Thanks for your help, @DamianSuess. I found the problem by manually issuing the commands I found in launch.json. The problem was, that putty (and plink) complained about an updated fingerprint. This is probably an edge case scenario but it can happen if I setup my linux (raspian) image several times and try to commect to it with the same IP.

Maybe there is a way to omit or accept this fingerprint change in plink.exe?

I noted some steps in a word doc how I got it up and running. I try to re-setup my raspi again and then I can send you my step-by-step guide. It also contains some manual steps to run vsdbg with sudo. Pretty cool stuff.

@DamianSuess
Copy link
Collaborator

DamianSuess commented Oct 17, 2022

@thomasgalliker, the fingerprint issue you're referring to, is this the one where the %UserProfile%\.ssh\known_hosts file still has the previous entry of your IP and Hash?

I just want to make sure for reproducibility and getting some kind of error catching into backlog for 2.0.

@thomasgalliker
Copy link
Author

thomasgalliker commented Oct 17, 2022

@DamianSuess no, that's what I' was thinking too. I cleared the old fingerprint from known_hosts but the problem still exists. Next, I tried to run the plink.exe with all the arguments from launch.json in a new command line window.
Putty/plink store the fingerprints in registry keys... HKEY_CURRENT_USER\Software\SimonTatham\PuTTY\SshHostKeys.

Ideally, VsLinuxDebug should be able to react on errors related to mismatching fingerprints. I have no idea how this could be done? At least it would be helpful to see the original error message of plink.exe in the Output window of Visual Studio.

@DamianSuess DamianSuess added the vNext Marked for an upcoming release label Oct 24, 2022
@DamianSuess
Copy link
Collaborator

Thank you for the feedback, Thomas.

I'm with you, the extension should be able to react to this kind of error informing the user. It's assigned to the backlog for the next release. If you're feeling ambitious, PRs are always welcome.

Thanks again for supporting the extension. 👍 Hope you have a wonderful week ahead!

@DamianSuess DamianSuess added enhancement Approved new feature or enhancement and removed feedback-requested Further information is requested labels Oct 24, 2022
@DamianSuess DamianSuess changed the title Manually attach to process using sudo/root [vNext] Manually attach to process using sudo/root Dec 11, 2022
@DamianSuess DamianSuess modified the milestones: v2.0, v2.1 Dec 23, 2022
@DamianSuess DamianSuess modified the milestones: v2.1, v2.2 Mar 7, 2024
@DamianSuess DamianSuess added v2.2 v3.0 and removed vNext Marked for an upcoming release labels Mar 7, 2024
@DamianSuess DamianSuess modified the milestones: v2.2, v3.0 Mar 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Approved new feature or enhancement v2.2 v3.0
Projects
Status: Backlog
Development

No branches or pull requests

2 participants