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

respect csharp.debug.console in all cases #7878

Closed
wants to merge 1 commit into from
Closed

Conversation

zacuke
Copy link
Contributor

@zacuke zacuke commented Dec 14, 2024

Please see issue microsoft/vscode-dotnettools#1473 for more info.

The documentation doesn't say that "csharp.debug.console": "externalTerminal" is only valid for Console Apps.

I've created this PR to fix the issue of "csharp.debug.console": "externalTerminal" being silently ignored in many cases when combined with "type":"dotnet".

This was previously working as expected with "type": "coreclr".

@zacuke zacuke marked this pull request as ready for review December 14, 2024 05:23
@zacuke zacuke requested review from a team as code owners December 14, 2024 05:23
@JoeRobich
Copy link
Member

@zacuke Just to let you know, we are working through some issues with our CI. Once we have it straightened out, I will rerun the checks for you.

@zacuke
Copy link
Contributor Author

zacuke commented Dec 14, 2024

After review I do see the documentation says the setting is for console projects, but I think it's important to call out that all dotnet projects have a console.

I think people will stumble into this issue because csharp.debug.console is mysteriously ignored. Their app's console output continues to show up in the built-in debug console. Besides the output, the debug console has known limitations including ReadLine.

Even with web apps, there are cases during debugging we might want to handle ctrl-c or take user input as part of debugging exercise. We might also have web apps that need to handle termination a specific way, or ask for input if a parameter is not passed in on command line. With the debug console it's difficult to debug these edge cases.

I also want to reiterate that opening an external console worked before with type=coreclr regardless of project type (and when using traditional Visual Studio).

I appreciate the consideration of merging this pull request. If nothing else I had fun digging through the extension's code, and I like the direction Microsoft is going with enhancing the C# experience inside vscode.

@gregg-miskelly
Copy link
Contributor

Hi @zacuke,

Thanks for taking the time to investigate this and open a PR! However, I am going to have to decline this because, as you probably are now aware, it is very much intentional that "csharp.debug.console" is only for console apps. There is a feature request issue to support console for web projects (#7165) a fix for this is much more involved that just what you have here because what you have here would break automatic web browser launch.

Note that the ReadLine limitation no longer applies (see documentation). Ctrl-C still does, so if that is an important feature for you, please open an issue.

In terms of better documenting "csharp.debug.console", that does seem like something worth improving. I opened microsoft/vscode-docs#7871 to try and do that. Let me know if there is anything else you feel like is missing for the documentation.

In VS Code itself, there was already a message to this effect:
image

But again, let me know if there is something you think is worth improving there.

@zacuke
Copy link
Contributor Author

zacuke commented Dec 17, 2024

My changes don't seem to break automatic web browser launch in my testing, as the message is duplicated in both Debugger console and External terminal. That seems like an improvement over silently ignoring the setting.

If there's still a known regression, please elaborate and I can try to update my PR changes with further work to satisfy all requirements. If it's just the browser not opening, that doesn't seem to be an issue assuming the content is duplicated on both external window and debug console (which it seems to). Is there some specific condition where the message isn't duplicated thus leading to a browser not opening? Maybe something in vscode changed and that reasoning can be re-evaluated to allow this PR, or something like it, to be merged in.

I opened a ticket for Ctrl+C and to try to clarify my story #7882

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants