System.UnauthorizedAccessException was unhandled<[email protected]

  • Thread starter Thread starter Steve Floyd
  • Start date Start date
S

Steve Floyd

I'm having exactly the same error. Issue is reproducable if unplug and replug USB cable and stop my application (crash happens during application rundown).

It appears to be a subtle interaction between FTDI's drivers and Microsoft's SerialPort object.

Can you check to see if you are using FTDI device drivers to give you the virtual COM port? Support at FTDIchip.com told me the stuff below. Haven't tried because don't know where to put their code. I suppose I'd have to override the Dispose method for the Serial Port object and do something there.

How did you fix your problem?


vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
You could use D2XX APIs to check the device presence and if it is not present close the USB handle or reload the device.

Code snippets are given in D2XX programmer's guide.

Please refer following APIs

FT_OpenEx and FT_Relaod. If FT_OpenEx return False you may call FT_Reload and try opening the handle again.

http://www.ftdichip.com/Documents/ProgramGuides/D2XX_Programmer's_Guide(FT_000071).pdf
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
Back
Top