Sorry I am an *absolute* newbie to serial comm. so my question may be dumb...
I compiled the Test program within the solution package and I received this message:
An unhandled exception of type 'System.UnauthorizedAccessException' occurred in serialport.dll
Additional information: Attempted to perform an unauthorized operation.
The weired thing is that it is coming and going, i.e. it works, (re-run) doesn't work, (re-run) works, (re-run) doesn't work....
any help would be greatly appreciated!
I've been using this library for a month now.
This exception usually occurs when the port is in use already. Frustratingly at present there appears to be no way to detect if the ports in use by another program. It can even be the same program but with more than one instance of the SerialPort class.
From what your saying working not working working etc it sounds like you are not closing the port correctly when you've finished with it.
Make sure you do a serialCommsHandler.Close();
before disposing of the objects.
Hope this helps
(Passer by) :-)
Thanks ChirZ for your help!
I think I ran into the same problem like you did, that I couldnt tell what other programs are using the port...have you ever discovered a way to detect that?
All I've done at the moment is put a
block around the .open method.
If it catches something then it probably means ports not aquired.
This is annoying in the debug enviroment however as it flags this exception every time i start!
It would be good if the author could leave someway of detecting whether the port can be aquired, preferably before opening it, such as