|
-
Oct 13th, 2008, 09:30 AM
#1
[RESOLVED] [2008] UnauthorizedAccessException - SerialPort - USB
UnauthorizedAccessException happens when a USB connected SerialPort is disconnected(physically) and the form is closed.
There does not appear to be a way to Catch the exception and it is not handled with
Private Sub MyApplication_UnhandledException(ByVal sender As Object, ByVal e As Microsoft.VisualBasic.ApplicationServices.UnhandledExceptionEventArgs) Handles Me.UnhandledException
How can this exception be captured. BTW - the Call Stack shows [ExternalCode]
-
Oct 14th, 2008, 06:42 AM
#2
Re: [2008] UnauthorizedAccessException - SerialPort - USB
 Originally Posted by dbasnett
How can this exception be captured. BTW - the Call Stack shows [ExternalCode]
This would lead me to believe that the exception is thrown within the Win32 API but I don't know for sure.
Will a regular System.Exception catch not catch the Exception? If that nor the Unhandled Exception event cannot catch the exception then... well, I don't know.
-
Oct 14th, 2008, 12:29 PM
#3
Re: [2008] UnauthorizedAccessException - SerialPort - USB
there is not "a" line that is pointed to when the error occurs.
a lot of people have the problem, and it is posted and being ignored for the most part on MSDN.
of course the answer is for the user not to pull the adapter before closing the application, but until PC's have a built-in TASER users do what users want
-
Oct 14th, 2008, 05:36 PM
#4
Re: [2008] UnauthorizedAccessException - SerialPort - USB
 Originally Posted by dbasnett
there is not "a" line that is pointed to when the error occurs.
Put the entry point of the application in a Try and see if it catches it. Other than that I have no idea. Good luck!
-
Oct 15th, 2008, 06:12 AM
#5
Re: [2008] UnauthorizedAccessException - SerialPort - USB
There is a bug for this (resolved of course).
https://connect.microsoft.com/Visual...dbackID=140018
It says add this as a work around to the app.config.
<configuration>
<runtime>
<legacyUnhandledExceptionPolicy enabled="1"/>
</runtime>
</configuration>
I have no idea where that(app.config) is.
-
Oct 15th, 2008, 08:35 AM
#6
Re: [2008] UnauthorizedAccessException - SerialPort - USB
That's your application config. All web applications have a web.config and all windows forms applications have an app.config file.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|