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

I'm using Visual Studio 2008 SP1 on .NET 3.5 SP1 on Vista Any time
I'm using Windows Vista Ultimate and today I've installed the Visual Studio 2008 SP1,
I have a Dynamic Data website built in Visual Studio 2008 using .NET 3.5
Visual Studio 2008 w/Sp1 To reproduce my problem I simply create a new .Net
I've got a minimal app I just created, using VS 2008 SP1 on Vista
I have a WPF app that uses DispatcherTimer to update a clock tick. However,
I'm using VS2008 SP1 under Vista SP1. My .Net-program uses a COM reference to
I run windows vista business and want to try MS Visual Studio Express 2012.
I've created a Vista sidebar widget that uses jQuery to fetch XML and display
Between Windows XP and Vista (and server 2003 and 2008) Microsoft have removed the

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.