Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 91709
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T23:04:21+00:00 2026-05-10T23:04:21+00:00

Vista SP1 Visual Studio 2008 SP1 .NET 3.5 SP1 C# I have a winforms

  • 0

Vista SP1 Visual Studio 2008 SP1 .NET 3.5 SP1 C#

I have a winforms app I’m playing with that uses a SerialPort object as a private variable. When the application is compiled and executed, it works great. It also works running in debug mode wihtout any breakpoints. 90% of the time when I stop at a breakpoint and try to step through code I get an ‘unhandled exception ocurred’ dialog with these details:

System.ObjectDisposedException was unhandled Message=’Safe handle has been closed’ Source=’mscorlib’ ObjectName=” StackTrace: at Microsoft.Win32.Win32Native.SetEvent(SafeWaitHandle handle) at System.Threading.EventWaitHandle.Set() at System.IO.Ports.SerialStream.AsyncFSCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* pOverlapped) at System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* pOVERLAP) InnerException:

The frustrating thing is, I do not have to be stepping over serial-related code! I just have to have done something with the port. So I might read a string, manipulate the string, add two numbers together, whatever, and then BANG.

Again, this works just fine when NOT debugging, or when debugging wihtout any breakpoints. There seems to be something about stopping at a breakpoint that makes the CLR dispose the SerialStream on a different thread.

There is a lot of chatter online about problems with renoving USB devices causing this. But I’m using the build-in motherboard port on COM1.

I don’t think I had this issue in .NET 2.0 so I may have to go back to that…

I need to simplify the application quite a bit before I can post code – but has anyone seen behavior like this in the debugger before?

Thanks so much!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T23:04:21+00:00Added an answer on May 10, 2026 at 11:04 pm

    I had the same problem just this morning. Surprisingly, it simply has gone away when I DISABLED the following options in VS2008 Tools->Options->Debugging->General:

    • ‘Enable the exception assistant’
    • ‘Enable .NET Framework source stepping’
    • ‘Step over properties and operators’
    • ‘Enable property evaluation and other implicit function calls’

    I have no idea why, but it worked for me.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Having a strange issue with Visual Studio 2010 Professional (running Windows Vista Home Premium
I have installed MinGW in Windows Vista, so I can use gcc but it
In Windows 7 (and I think Vista) the Explorer has a preview pane that
HttpWebRequest always throws time out exception then run in mono 2.10 under Windows Vista
I have a really weird problem with background worker. Code is too complicated so
I am on Vista and After updating the Android SDK through 'Android.bat update sdk'
I had a windows vista machine with much lower specs and Netbeans6.8+Scala2.8 worked fine.
First of all I'm using Vista as my OS. Second, I'm using Google Chrome
The following code example fails randomly on some PC's. On other PC's the problem
I was successfully able to register a DWM thumbnail and display it in my

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.