unable to handle system.dll

  • Thread starter Thread starter alexia
  • Start date Start date
A

alexia

Hi all,

This issue is beyond my understanding. I searched the web but failed
to find the solution.

I wrote an application which uses serial to USB device. The problem
occurs if the user unplugs the device before I close the port. The
exception is not in serialport.close but when the application exits. I
can't even catch the exception in main becuase it doesn't happen in
main but in system.dll. i believe that system.dll tires to release the
USB/com resource and fails.

Is there any way to handle this kind of exception?

TIA.
 
And yet, you don't indicate what kind of exception is being thrown?
 
    And yet, you don't indicate what kind of exception is being thrown?

--
          - Nicholas Paldino [.NET/C# MVP]
          - (e-mail address removed)




This issue is beyond my understanding. I searched the web but failed
to find the solution.
I wrote an application which uses serial to USB device. The problem
occurs if the user unplugs the device before I close the port. The
exception is not in serialport.close but when the application exits. I
can't even catch the exception in main becuase it doesn't happen in
main but in system.dll. i believe that system.dll tires to release the
USB/com resource and fails.
Is there any way to handle this kind of exception?
TIA.- Hide quoted text -

- Show quoted text -

Hi,

This is the exception I get:

"An unhandled exception of type 'System.UnauthorizedAccessException'
occurred in System.dll

Additional information: Access to the port is denied."

There is no way to catch this exception and prevent the OS from
displaying it to the user.
 
This is a bug in the CLR. The bug was reported and Microsoft submitted a
workarround for this (which *doen't* work). I am still waiting for a solution.
BTW it also happens in VISTA.

alexia said:
And yet, you don't indicate what kind of exception is being thrown?

--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)




This issue is beyond my understanding. I searched the web but failed
to find the solution.
I wrote an application which uses serial to USB device. The problem
occurs if the user unplugs the device before I close the port. The
exception is not in serialport.close but when the application exits. I
can't even catch the exception in main becuase it doesn't happen in
main but in system.dll. i believe that system.dll tires to release the
USB/com resource and fails.
Is there any way to handle this kind of exception?
TIA.- Hide quoted text -

- Show quoted text -

Hi,

This is the exception I get:

"An unhandled exception of type 'System.UnauthorizedAccessException'
occurred in System.dll

Additional information: Access to the port is denied."

There is no way to catch this exception and prevent the OS from
displaying it to the user.
 
Back
Top