vscode-docs icon indicating copy to clipboard operation
vscode-docs copied to clipboard

Add Documentation for Debugging C# Console Applications with Input Arguments

Open asilverman opened this issue 1 year ago • 3 comments

As a C# developer, I often need to debug console applications that take input arguments. However, the current Visual Studio Code documentation does not provide clear guidance on how to set up debugging for such applications.

When I attempt to debug a C# console application with arguments, the dynamically generated debug configuration doesn’t support providing arguments and also doesn't actually save any launch.json files in my VSCode workspace. After some trial and error, I discovered that the command ".NET: Generate Assets for Build and Debug" that actually adds the launch.json configuration, which I could then modify to include command line arguments.

image

Request:

I would like to request that the documentation be updated to include instructions for debugging C# console applications with input arguments. This should ideally cover:

  1. How to use the ".NET: Generate assets for debugging" command to create the necessary launch.json configuration.
  2. How to modify the generated launch.json to specify input arguments for the application.

Adding this information would help other developers who face similar challenges and make the process of debugging C# applications in Visual Studio Code more straightforward.

Relevant Documentation Page: Please update this information on the Visual Studio Code documentation page for C# debugging.

Thank you for considering this improvement!

asilverman avatar Sep 23 '24 21:09 asilverman

Thanks for sharing your input, @asilverman

Looping in @webreidi

ntrogh avatar Sep 24 '24 16:09 ntrogh

@asilverman are you using C# Dev Kit? If so, the out-of-the-box debugging (just F5) will run your console app in the terminal and you can interact with it right there in the terminal. No launch.json needed, no special configuration or any other assets. It should just work.

webreidi avatar Sep 26 '24 20:09 webreidi

@webreidi - I am using C# devkit, the program I am looking to debug requires an input argument, the 'dynamically generated debug context' doesn't allow me to specify the argument and this is the problem I needed solved for which I found a workaround.

Running a program in debug with command line arguments is a very common thing and so what I am asking here is that it's made simple and for it to be documented for the benefit of the community.

In other words, to debug my program (console application) I must specify an input. The c# devkit f5 doesn't support any way to configure this input, this should be fixed

asilverman avatar Sep 29 '24 16:09 asilverman

@webreidi should this one be now closed as the docs now show the info?

asilverman avatar Aug 03 '25 08:08 asilverman

Yes, this can be closed now.

webreidi avatar Aug 04 '25 15:08 webreidi