Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Serial exception on Sleep and Disconnect. #29

Open
pandabear41 opened this issue Aug 10, 2017 · 0 comments
Open

Serial exception on Sleep and Disconnect. #29

pandabear41 opened this issue Aug 10, 2017 · 0 comments

Comments

@pandabear41
Copy link

pandabear41 commented Aug 10, 2017

So I am using cmdMessenger on a USB serial connection using the watchdog. Every time I sleep my computer and pull my desktop off the docking station. Once when the laptop wakes up I will get the following error and the app crashes.

System.ObjectDisposedException was unhandled Message: An unhandled exception of type 'System.ObjectDisposedException' occurred in mscorlib.dll Additional information: Safe handle has been closed

looking at a similar problem I found this.
https://stackoverflow.com/questions/3230311/problem-with-serialport/7471010#7471010

I will do some more research and see if I can find a solution.

EDIT:
BTW using .NET 4.5.2 on x64 Windows 10. It crashes with debugging on and off.

EDIT 2:
Also found this.
https://stackoverflow.com/questions/8927410/objectdisposedexception-when-closing-serialport-in-net-2-0
http://zachsaw.blogspot.com/2010/07/net-serialport-woes.html

EDIT 3:
Couldn't find a trace within the code but enabling traces for native windows code I get this.
Stack trace for SampleWatchdog

mscorlib.dll!System.StubHelpers.StubHelpers.SafeHandleAddRef(System.Runtime.InteropServices.SafeHandle pHandle, ref bool success)
System.dll!System.IO.Ports.SerialStream.EventLoopRunner.WaitForCommEvent()
mscorlib.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx)	
mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx)	
mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state)
mscorlib.dll!System.Threading.ThreadHelper.ThreadStart()	
@pandabear41 pandabear41 changed the title Serial issues on Sleep and Disconnect. Serial exception on Sleep and Disconnect. Aug 10, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant