This is indeed odd. As you said it appears an initial connection is possible but then suddenly the connection fails. This doesn’t seem to be a known issue as far as I’m aware.
Can you reliably reproduce this issue? What happens if you remove the device from the list and re-add it does it still occur?
Could you also try the following suggestions:
What happens if you add the device after opening/creating the project? By the way what kind of project are you working with?
I noticed you’re using the stable release of the extension. Could you try the early access version. This version has a number of fixes that may address the issue you’re seeing.
If none of the above helps could you provide a step by step of everything you’re doing leading up to the error.
What happens if you remove the device from the list and re-add it does it still occur?
Removing and re-adding a device does not change anything
What happens if you add the device after opening/creating the project?
Attempting to add a device after opening the project fails:
[07-29 05:28:55.308] Error (534) - OS error: [Errno None] Unable to connect to port 22 on 10.0.0.149
[07-29 05:28:55.308] OS error.
[07-29 05:30:52.676] Error (536) - Serial port error: [Errno 2] could not open port COM3: [Errno 2] No such file or directory: ‘COM3’
[07-29 05:30:52.676] Serial port error.
It seems that adding a device after opening a project is not working.
Could you try the early access version.
Both versions of the extension behave identically.
…could you provide a step by step of everything you’re doing leading up to the error.
I was unable to reproduce this on my side. So I don’t think this is an issue with the extension itself.
My first guess is that usually some firewall/network restrictions that are interfering with the connection. However it’s odd since you are able to connect to the device, initially at least.
Can you SSH to the device normally from that development PC with no issues?
If yes then it may be the case that perhaps some security/firewall on the system is blocking communications that come from the extension itself. The backend for the extension is called moses. Could you make sure this isn’t being blocked in anyways on your machine.
I’ll also bring this up with our IDE team perhaps they have further ideas.
After further thought I think I know why the discrepancy between the initial connection and the later connections.
With C/C++ based projects it all runs inside a development container that uses WSL 2 on Windows machines. You might have a firewall/configuration issues that is preventing the SSH connection from WSL 2. This may be why you’re only seeing the issue after project creation, since the initial SSH is handled by Windows instead of WSL 2.
Please check your network configuration regarding WSL 2 and make sure you can communicate to the target device from there.