How to ignore an exception AND complete the try

前端 未结 3 644
抹茶落季
抹茶落季 2021-01-27 06:57

So I\'ve been battling this issue for about a week now and think I know the issue but I don\'t want to report an answer there until I have it pegged down.

In a nutshell,

3条回答
  •  一生所求
    2021-01-27 07:28

    serialPort1.Open();

    is what is throwing the exception. Normally when you code, if an exception happens you do clean up of the connections.

    As others mentioned, if you keep calling this same method, you'll keep getting exception unless things about the call change.

    So understanding that, my suggestion would be that you look for other ways to open the serial port, other than the serialPort1.Open(); call. There may or may not be built in ways in C#. So you might have to be creative :)

提交回复
热议问题