EDN Admin
Well-known member
I have an application that has a serial to USB connector. When I connect to a port and pulls the plug from the USB and then reconnect the application itself works fine but when I close the application, I get UnauthorizedAccessException and I cannot figure out where it is thrown. I tried to run it in debugger but still no lead on where it is. I even tried to do<br/> <br/>
<div style="color:Black;background-color:White
<pre><span style="color:Blue try
{
Application.Run(<span style="color:Blue new
MyApplication());
}
<span style="color:Blue catch
(UnauthorizedAccessException e)
{
<span style="color:Green //Do something here
}
[/code]
and still, this exception was not caught anywhere.<br/> <br/> What I want to achieve is to be able to handle the case when the application is connected to a port and then the plug the pulled or reconnected, the application should be able to handle it. Right now it crashes with that exception. I wonder if there is anyway to recover a lost COM port.<br/> <br/> Thanks
View the full article
<div style="color:Black;background-color:White
<pre><span style="color:Blue try
{
Application.Run(<span style="color:Blue new
MyApplication());
}
<span style="color:Blue catch
(UnauthorizedAccessException e)
{
<span style="color:Green //Do something here
}
[/code]
and still, this exception was not caught anywhere.<br/> <br/> What I want to achieve is to be able to handle the case when the application is connected to a port and then the plug the pulled or reconnected, the application should be able to handle it. Right now it crashes with that exception. I wonder if there is anyway to recover a lost COM port.<br/> <br/> Thanks
View the full article