This is a probably an embarasing question as no doubt the answer is blindingly obvious.
I\'ve used Visual Studio for years, but this is the first time I\'ve done any
Currently there is no way to do this with apps running in WSL2. However there are two work-arounds:
The debug window retains the contents of the WSL shell window that closed.
The window remains open if your application returns a non-zero return code, so you could return non-zero in debug builds for example.