As described in the title - I have a wpf app that uses serial port communication with my device via virtual COM port. The issue is that Visual Studio sometimes "blocks" the connection and my device won't connect. I have long searched for the reason my sommunication sometimes works and sometimes doesn't (especially that it worked 100% of the time using the same serial port code in my winform app), and after a lot of frustration I slowly found out what is causing the problem (the exceptions thrown by the SerialPort class were not helpful). First I noticed that restarting the PC helps with it most of the time. Then I noticed, that I started to have connection issues even on my old winform app that was runing from an exe. After a lot of trial and error it turns out it is Visual Studio that causes the problem - the second I close VS my winform app connects again. When I run my wpf app from the executable, the problem never occurs as well. So it only happens when having my wpf project open in VS (it doesn't have to be running at all, it makes no difference).
My programming experience is not very robust but I'd like to know what exactly causes the problem and if I can fix it - it is quite frustrating to work with my app when I never know if it will connect or not. I'm guessing that VS is running some of the code in the background even when the project is not running (after all the designer reacts to changes in code in real time).
Any advice on how to pinpoint the problem?