Windows Error system.io.directorynotfound c#

Hello,

I have a software tha uses serialport via a usb to serialport cable. I need to monito if the cable is disconnected. In a timer a check it with serialport.IsOpen and if case it is closed i open a new form for the com setting. If I save the new settings, the software save them in an xml file and restart the application where the new settings will be read from the xml.

If i manually call the setting page, every thing works fine, but if it's called by the serialport.IsOpen check, so when the cable is disconnected, I get a windows error at the restart and if I close the program it won't start again. Attached the error I get.

Thank you very much for the help.

P.S. I do not get any error in the debug, but only using the compilied file.
error.JPG
borntoflyAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
borntoflyConnect With a Mentor Author Commented:
I solved the problem....

It was a problem with the setup file.

Thank you
0
 
iHadiCommented:
Hi borntofly,

Can you post the stack trace of the error if its a .net exception.

Also can you post the code of the saving and loading of the settings xml file.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.