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 8544621
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T12:36:17+00:00 2026-06-11T12:36:17+00:00

I have a C# Windows UI program, with a Window1 : Window in whose

  • 0

I have a C# Windows UI program, with a Window1 : Window in whose constructor I start an asynchronous socket server that while (true) { /* BeginAccept */ } and streams data to any client that connects using BeginSend and EndSend.

If one of the clients is forcibly disconnected Socket.EndSend throws an exception (a bit surprisingly ObjectDisposedException instead of SocketException, but whatever).

That exception terminates my whole program (closing the window) but does not print a stack trace!

Instead, I only get an innocent

A first chance exception of type 'System.ObjectDisposedException' occurred in System.dll

message in the Ouput panel.

If exceptions are silenced like this but still crash my program without stack trace, how am I supposed to find where the exception is thrown?

  • 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. Editorial Team
    Editorial Team
    2026-06-11T12:36:18+00:00Added an answer on June 11, 2026 at 12:36 pm

    Well, it depends on what version of .NET you are using. But, that’s generally what’s documented will happen.

    If you don’t want that to happen, use top-level exception handlers in your thread entry points and “swallow” the exception–logging it or whatever else you want to do before exiting the thread.

    In terms of methods like BeginSend, the method given to BeginSend (or BeginAccept for that matter) is effectively the thread entry-point. e.g.

    listener.BeginAcceptTcpClient(OnAccept, null);
    //...
    
    private static void OnAccept(IAsyncResult ar)
    {
        try {
            var tcpClient = listener.EndAcceptTcpClient(ar);
            //...
        } catch(Exception ex)
        {
            Dump(ex);
            return;
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a c++/windows program that receives data from another c++ program via a
I have a Windows Mobile program that accesses an attached device through a third-party
I have an ASP.NET web service that I can access via a windows program
I have a CAB file that installs our program to Windows CE. I have
I have a Cocoa window, whose content view contains an NSScrollView that, in turns,
I have a program that heavily uses std::map . Under Windows, much more memory
I use a program (on Windows), whose name I won't disclose, that can be
Have a look at this very simple example WPF program: <Window x:Class=WpfApplication1.Window1 xmlns=http://schemas.microsoft.com/winfx/2006/xaml/presentation xmlns:x=http://schemas.microsoft.com/winfx/2006/xaml
I have an owner-drawn list control in my Windows program. I use CListCtrl::GetBkColor to
I have a Windows C++ console program, and if I don't call ReleaseDriver() at

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.