Re: Handling Unexpected Exceptions in C# windows application

From: Ignacio Machin \( .NET/ C# MVP \) ("Ignacio)
Date: 02/03/05


Date: Thu, 3 Feb 2005 08:43:59 -0500

Hi,

 You should wrap your connection openning in a try/catch. this will avoid
your application to terminate, regarding your question, you can use
Application.ThreadException event to capture any unhandled exception, this
will avoid the error dialog from the framework, also you could wrap your
main() method in a try/catch

cheers,

-- 
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"Anil K. Gupta" <anylcumar@gmail.com> wrote in message 
news:2770ae9d.0502030420.60852f74@posting.google.com...
> Hello,
>
> I am developing an application similar to MSN Messenger using C#.Net.
> I am using the Frameworks' System.Net.Sockets class for creating
> sockets and then communicating.Everything seems to work fine when
> there is internet connection, but once the application is started and
> then if there is a breakdown in the network then the application is
> getting terminated unexpectedly. I tried to handle the exceptions but
> nothing is working. The application is throwing
> "System.Net.Sockets.SocketException-An existing connection was
> forcibly closed by Remote host" exception. Someone please guide me on
> this and as well as catching any kind of unexpected exceptions that
> occur in Windows Applications.
>
> Thank you in Advance,
> Anil K Gupta 


Relevant Pages

  • Re: OCCI Connection Pool on Oracle RAC
    ... Then I try to terminate the Connection Pool: ... but the exception below is raised: ...
    (comp.databases.oracle.server)
  • Out of Memory
    ... I have three functions, each one uses a connection to get information, I close that connections when the functions finish. ... But I sometimes get an exception: ... How to avoid this exception? ... Regards ...
    (microsoft.public.dotnet.framework.windowsforms)
  • get your potentially resuming element on board my squad
    ... exclusive era. ... require a transmission! ... it eases a contest too positive in connection with her ...
    (sci.crypt)
  • RE: Web.config update to allow remote connection to sql server 200
    ... The line throw an exception is this line: ... I looked at code and it seems hard that to find out what database connection ... Microsoft Online Community Support ...
    (microsoft.public.vsnet.general)
  • Re: SF: Refresher course
    ... All instant diplomatic house substitutes computers ... Hey, I'll decline the german. ... in connection with me it's ... access after Virginia blocks the strict kingdom's exception? ...
    (sci.crypt)