Windows Terminal Preview does not work with Visual Studio 2019. #14896

Closed
opened 2026-01-31 04:22:36 +00:00 by claunia · 13 comments
Owner

Originally created by @TomsProject on GitHub (Aug 18, 2021).

Originally assigned to: @miniksa on GitHub.

Windows Terminal version (or Windows build number)

1.10.1933.0

Other Software

Microsoft Visual Studio Enterprise 2019 16.10.3

Steps to reproduce

Create a new VS C++ Console project.
image Click the Local Windows Debugger Button.
image
Close the tab with the X.
image
Click the Local Windows Debugger Button again.
Then VS will show this message box.
image
In the output field, it says.
已退出,返回值为 -1073741502 (0xc0000142) 'DLL Initialization Failed'。
If I click the Local Windows Debugger Button again, this message keeps showing.

Expected Behavior

Normally run the app again.

Actual Behavior

An alert message box was shown.

Originally created by @TomsProject on GitHub (Aug 18, 2021). Originally assigned to: @miniksa on GitHub. ### Windows Terminal version (or Windows build number) 1.10.1933.0 ### Other Software Microsoft Visual Studio Enterprise 2019 16.10.3 ### Steps to reproduce Create a new VS C++ Console project. ![image](https://user-images.githubusercontent.com/44722363/129904100-b49b8090-afca-4ec1-a5e9-7b553704875e.png) Click the Local Windows Debugger Button. ![image](https://user-images.githubusercontent.com/44722363/129906620-543db5d5-4d5a-4e05-87a2-3e496cfbacfd.png) Close the tab with the X. ![image](https://user-images.githubusercontent.com/44722363/129906717-f5578656-fe42-43b2-bd43-6244631bbe09.png) Click the Local Windows Debugger Button again. Then VS will show this message box. ![image](https://user-images.githubusercontent.com/44722363/129906834-0c2efc5f-80cf-43d8-864a-c7430b056e5d.png) In the output field, it says. 已退出,返回值为 -1073741502 (0xc0000142) 'DLL Initialization Failed'。 If I click the Local Windows Debugger Button again, this message keeps showing. ### Expected Behavior Normally run the app again. ### Actual Behavior An alert message box was shown.
Author
Owner

@arsdever commented on GitHub (Oct 17, 2021):

Hi. I just faced the same issue. More details about what happened. In my case, I installed the Preview version of the terminal today (it's version 1.11.2731.0). Then I set the Default terminal application to Windows Terminal Preview and started debugging in the Visual Studio 2022 (not sure if the version matters, I'm using Community edition). In the beginning it opened a new terminal window and started debugging there, which is fine, but I wanted it to open a new tab in the already open window. So I head over to the settings and set the New instance behavior to Attach to the most recently used window and then tried to debug in VS and it started failing to start a terminal with an error code 0xc0000142. I tried to switch back the New instance behavior to Create a new window, but the error message remains there.

I did some experiments, and my findings are the following. Once you log in you have 1 possibility to get the debug action work in the windows terminal. No matter what option you have chosen for the New instance behavior. Once you close the tab, debugging from VS won't work for terminal. Signing-out/in helps, but again, only for the first time.

Edit

After changing the Default terminal application to Windows Console Host, VS still fails to start debug with the exact same error.

@arsdever commented on GitHub (Oct 17, 2021): Hi. I just faced the same issue. More details about what happened. In my case, I installed the `Preview` version of the terminal today (it's version `1.11.2731.0`). Then I set the `Default terminal application` to `Windows Terminal Preview` and started debugging in the `Visual Studio 2022` (not sure if the version matters, I'm using `Community` edition). In the beginning it opened a new terminal window and started debugging there, which is fine, but I wanted it to open a new tab in the already open window. So I head over to the settings and set the `New instance behavior` to `Attach to the most recently used window` and then tried to debug in VS and it started failing to start a terminal with an error code `0xc0000142`. I tried to switch back the `New instance behavior` to `Create a new window`, but the error message remains there. I did some experiments, and my findings are the following. Once you log in you have 1 possibility to get the debug action work in the windows terminal. No matter what option you have chosen for the `New instance behavior`. Once you close the tab, debugging from VS won't work for terminal. Signing-out/in helps, but again, only for the first time. # Edit After changing the `Default terminal application` to `Windows Console Host`, VS still fails to start debug with the exact same error.
Author
Owner

@arsdever commented on GitHub (Oct 17, 2021):

Seems like a duplicate of https://github.com/microsoft/terminal/issues/10453

@arsdever commented on GitHub (Oct 17, 2021): Seems like a duplicate of https://github.com/microsoft/terminal/issues/10453
Author
Owner

@sfiruch commented on GitHub (Oct 21, 2021):

I can repro the issue with VIsual Studio 2022, and Terminal 1.11.2921.0 as well. Out of the box, only by changing the default terminal app to Terminal, and without changing any other configuration options.

@arsdever Might be, but that problem is the other way round. Here, the first launch works but subsequent launches fail.

@sfiruch commented on GitHub (Oct 21, 2021): I can repro the issue with VIsual Studio 2022, and Terminal 1.11.2921.0 as well. Out of the box, only by changing the default terminal app to Terminal, and without changing any other configuration options. @arsdever Might be, but that problem is the other way round. Here, the first launch works but subsequent launches fail.
Author
Owner

@arsdever commented on GitHub (Oct 22, 2021):

@deiruch Maybe my comment was misunderstood or somewhat inaccurate. I meant the same. The first launch works but subsequent launches don't. Have you also tried to log out/in and try again? Does it work for you?

@arsdever commented on GitHub (Oct 22, 2021): @deiruch Maybe my comment was misunderstood or somewhat inaccurate. I meant the same. The first launch works but subsequent launches don't. Have you also tried to log out/in and try again? Does it work for you?
Author
Owner

@arsdever commented on GitHub (Oct 22, 2021):

Tested on Terminal Preview 1.12.2931.0, still the same issue.

@arsdever commented on GitHub (Oct 22, 2021): Tested on Terminal Preview `1.12.2931.0`, still the same issue.
Author
Owner

@miniksa commented on GitHub (Oct 22, 2021):

I have seen this. I just haven't had a chance to debug further yet.

@miniksa commented on GitHub (Oct 22, 2021): I have seen this. I just haven't had a chance to debug further yet.
Author
Owner

@arsdever commented on GitHub (Oct 22, 2021):

I was just playing around and found something interesting. So when you close the console window after the debugging session was finished (either you pressed stop in the VS, or you closed the separate GUI window which terminates the process, or your program finished) you are able to rerun. But once you close the terminal window while debugger is running, the issue appears. This might be helpful when debugging.

@arsdever commented on GitHub (Oct 22, 2021): I was just playing around and found something interesting. So when you close the console window after the debugging session was finished (either you pressed stop in the VS, or you closed the separate GUI window which terminates the process, or your program finished) you are able to rerun. But once you close the terminal window while debugger is running, the issue appears. This might be helpful when debugging.
Author
Owner

@miniksa commented on GitHub (Nov 3, 2021):

I was just playing around and found something interesting. So when you close the console window after the debugging session was finished (either you pressed stop in the VS, or you closed the separate GUI window which terminates the process, or your program finished) you are able to rerun. But once you close the terminal window while debugger is running, the issue appears. This might be helpful when debugging.

That should be very helpful indeed. Sorry, still swamped with other tasks. I took a week off as vacation and I've been behind ever since.

@miniksa commented on GitHub (Nov 3, 2021): > I was just playing around and found something interesting. So when you close the console window after the debugging session was finished (either you pressed stop in the VS, or you closed the separate GUI window which terminates the process, or your program finished) you are able to rerun. But once you close the terminal window while debugger is running, the issue appears. This might be helpful when debugging. That should be very helpful indeed. Sorry, still swamped with other tasks. I took a week off as vacation and I've been behind ever since.
Author
Owner

@arsdever commented on GitHub (Nov 10, 2021):

Since the feature this bug is referring to is included in the Terminal v1 doesn't it make sense to deliver this bugfix for v1 as well? I'm asking since this task is put into v2 milestone.

@arsdever commented on GitHub (Nov 10, 2021): Since the feature this bug is referring to is included in the `Terminal v1` doesn't it make sense to deliver this bugfix for `v1` as well? I'm asking since this task is put into `v2` milestone.
Author
Owner

@zadjii-msft commented on GitHub (Nov 10, 2021):

@arsdever Our milestone naming is perhaps a tad bit confusing - "Terminal v2" means "everything before we call the Terminal v2". It's also another way of saying "Everything we'll do in the v1.x" timeframe. Something I'm working on ☺️

@zadjii-msft commented on GitHub (Nov 10, 2021): @arsdever Our milestone naming is perhaps a tad bit confusing - "Terminal v2" means "everything before we call the Terminal v2". It's also another way of saying "Everything we'll do in the v1.x" timeframe. Something I'm working on ☺️
Author
Owner

@Dimension4 commented on GitHub (Dec 14, 2021):

Just ran into the same problem with VS 2019 (16.11.7) and Terminal Preview 1.12.2931.0. I ran into this without having a debugger attached. I opened my C++ project and hit ctrl+F5 (start without debugging). The first time it worked but after that I have to restart VS to get it working again.

I have quake mode running in the background, maybe it's related to that?

@Dimension4 commented on GitHub (Dec 14, 2021): Just ran into the same problem with VS 2019 (16.11.7) and Terminal Preview 1.12.2931.0. I ran into this without having a debugger attached. I opened my C++ project and hit ctrl+F5 (start without debugging). The first time it worked but after that I have to restart VS to get it working again. I have quake mode running in the background, maybe it's related to that?
Author
Owner

@egortech commented on GitHub (Dec 24, 2021):

Yes, I can also reproduce. I noticed that when problems occur, the VsDebugConsole process still exists and may spin one CPU core:
image

If you kill that process, debug start normally without needing VS restart

When spinning no conhost associated processed exist alongside this process:
image

Maybe another problem but also looks like MSBUILD and Roslyn process cannot exit.

image

@egortech commented on GitHub (Dec 24, 2021): Yes, I can also reproduce. I noticed that when problems occur, the VsDebugConsole process still exists and may spin one CPU core: ![image](https://user-images.githubusercontent.com/13813684/147307005-3a4d4df3-80bc-40af-8e32-9023f9c8b5e1.png) If you kill that process, debug start normally without needing VS restart When spinning no conhost associated processed exist alongside this process: ![image](https://user-images.githubusercontent.com/13813684/147307096-4e8b8ea3-0a12-467f-88ca-2389f758f299.png) Maybe another problem but also looks like MSBUILD and Roslyn process cannot exit. ![image](https://user-images.githubusercontent.com/13813684/147307029-2300e550-bfe6-4a34-aeaf-22b41a1a62ea.png)
Author
Owner

@zadjii-msft commented on GitHub (Jan 31, 2022):

Good news everyone!

I think this was actually fixed on the VS side!

https://docs.microsoft.com/en-us/visualstudio/releases/2019/release-notes#release-notes-icon-visual-studio-2019-version-16119-newestreleaseicon

Fixed an issue with being unable to debug applications multiple times when Windows Terminal is used as the default terminal.

From internal notes:

This fix was also included in 16.7.24, 16.9.16 and 15.9.43.

This should be fixed, with a VS update. Thanks everyone!

@zadjii-msft commented on GitHub (Jan 31, 2022): Good news everyone! I think this was actually fixed on the VS side! https://docs.microsoft.com/en-us/visualstudio/releases/2019/release-notes#release-notes-icon-visual-studio-2019-version-16119-newestreleaseicon > Fixed an issue with being unable to debug applications multiple times when Windows Terminal is used as the default terminal. From internal notes: > This fix was also included in 16.7.24, 16.9.16 and 15.9.43. This should be fixed, with a VS update. Thanks everyone!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#14896