473,324 Members | 1,856 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

Exceptions break the application even within try...catch... Why?

Hi,
I use remoting in a Windows app... this remoting call a ServerA and using
ServerA get an object (marshaled) from ServerB... if I call a method on the
object gotten from ServerB and this ServerB has shut down it's service, I
get an exception and this exception stop the application event if it's
inside a try-catch structure... I mean, it does exactly the same as if it
was not in a try-catch structure. Is there a reason it's behaving this way?

I could send a code snippet, but it would not be useful... I get the ServerA
object, I get the ServerB object by calling a method on ServerA's object, I
open a try structure (try { ), I call a method on ServerB's object... if
the ServerB is running, everything is fine, if ServerB is not running, the
exception is thrown exactly the same way as if it were not in a try-catch
structure...

Why? and Is there a way around it?

Thanks

ThunderMusic
Jul 27 '06 #1
3 1393
I solved this with a messaging structure ,,,,, if the server is shutting
down it will broadcast a message to the clients and vice versa .
maybe this is an idea for you to ??
regards

Michel Posseth

"ThunderMusic" <No*************************@NoSpAm.comschreef in bericht
news:um*************@TK2MSFTNGP05.phx.gbl...
Hi,
I use remoting in a Windows app... this remoting call a ServerA and using
ServerA get an object (marshaled) from ServerB... if I call a method on
the object gotten from ServerB and this ServerB has shut down it's
service, I get an exception and this exception stop the application event
if it's inside a try-catch structure... I mean, it does exactly the same
as if it was not in a try-catch structure. Is there a reason it's
behaving this way?

I could send a code snippet, but it would not be useful... I get the
ServerA object, I get the ServerB object by calling a method on ServerA's
object, I open a try structure (try { ), I call a method on ServerB's
object... if the ServerB is running, everything is fine, if ServerB is
not running, the exception is thrown exactly the same way as if it were
not in a try-catch structure...

Why? and Is there a way around it?

Thanks

ThunderMusic

Jul 28 '06 #2
ok, so I'm not the only one to get this behavior... Is this by design? I
mean, is it normal behavior?

Thanks for the messaging suggestion, I'll probably try to use it... ;)

ThunderMusic

"Michel Posseth [MCP]" <MS**@posseth.comwrote in message
news:u0**************@TK2MSFTNGP03.phx.gbl...
>I solved this with a messaging structure ,,,,, if the server is shutting
down it will broadcast a message to the clients and vice versa .
maybe this is an idea for you to ??
regards

Michel Posseth

"ThunderMusic" <No*************************@NoSpAm.comschreef in bericht
news:um*************@TK2MSFTNGP05.phx.gbl...
>Hi,
I use remoting in a Windows app... this remoting call a ServerA and
using ServerA get an object (marshaled) from ServerB... if I call a
method on the object gotten from ServerB and this ServerB has shut down
it's service, I get an exception and this exception stop the application
event if it's inside a try-catch structure... I mean, it does exactly
the same as if it was not in a try-catch structure. Is there a reason
it's behaving this way?

I could send a code snippet, but it would not be useful... I get the
ServerA object, I get the ServerB object by calling a method on ServerA's
object, I open a try structure (try { ), I call a method on ServerB's
object... if the ServerB is running, everything is fine, if ServerB is
not running, the exception is thrown exactly the same way as if it were
not in a try-catch structure...

Why? and Is there a way around it?

Thanks

ThunderMusic


Jul 31 '06 #3
Hello,

I am also experiencing this problem, although I would describe it as
follows:
- if you have a server application that experiences any kind of error,
you'd expect the error to be prolonged to the caller AppDomain, e.g.
back to the client. This *does* occur actually, however the server is
then terminated even if the client calls within try/catch brackets. Is
this what you see?

Further investigations brought me to a (not very elegant) solution. This
behaviour was introduced with .NET 2.0 due to a policy change for
unhandled exceptions in different threads than main (e.g. if you create
new objects on the server rather than using existing ones). If your
intention is to keep the service running, you have to open
machine.config and add this to the "runtime" tag:
<runtime>
<legacyUnhandledExceptionPolicy enabled="true" />
</runtime>

This will keep the server running.

However, if any experts know more about this phenomenon or could supply
a more elegant way to solve this (like telling *only* the server to
behave like this), this would be very helpful.

I think this behaviour is generally positive as it points e.g. to
Windows Forms threading errors rather than just ignoring them and
possibly leading to an undefined application state. With remoting, I
always wondered why there were so few articles discussing this.
Best regards,
Helge

ThunderMusic schrieb am 27.07.2006 22:14:
Hi,
I use remoting in a Windows app... this remoting call a ServerA and using
ServerA get an object (marshaled) from ServerB... if I call a method on the
object gotten from ServerB and this ServerB has shut down it's service, I
get an exception and this exception stop the application event if it's
inside a try-catch structure... I mean, it does exactly the same as if it
was not in a try-catch structure. Is there a reason it's behaving this way?

I could send a code snippet, but it would not be useful... I get the ServerA
object, I get the ServerB object by calling a method on ServerA's object, I
open a try structure (try { ), I call a method on ServerB's object... if
the ServerB is running, everything is fine, if ServerB is not running, the
exception is thrown exactly the same way as if it were not in a try-catch
structure...

Why? and Is there a way around it?

Thanks

ThunderMusic

Aug 6 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

24
by: mag31 | last post by:
Is there any way to find out if a particular .net function will throw an exception without first generating the exception? I am using structured exception handling i.e. try catch finally blocks...
15
by: Bernard | last post by:
Hi All, I am not sure if I should be asking this question on clc or clc++. Let me try on both. I hope that this is not too trivial for the brilliant minds over here. I know that OOP questions...
10
by: Cool Guy | last post by:
Consider: void Start() { if (!TryToDoSomething()) ShowErrorMessage(); }
10
by: Jeff | last post by:
I'm just starting to work with UserControls and have a question on the behavoir of exceptions within UserControls and VS.Net 2003. I have noticed that when a UserControl throws an exception from...
10
by: Razzie | last post by:
Hi all, The title of this post may sound a bit weird, but I was wondering about the following nonetheless. I have a class libray containing, say, 4 classes: A, B, C, D. Class A somehow has a...
6
by: Nick Reeves | last post by:
While developing the below code I noticed that exceptions were not working as expected. An exception is thrown inside an XML import DLL and not being caught inside the Main() code fragment,...
2
by: Eric Sabine | last post by:
I built a generic exception handler form which allows the user to get information from it, print it, email it, etc. for exceptions for which I explicitly didn't handle in code, such as missing...
8
by: cat | last post by:
I had a long and heated discussion with other developers on my team on when it makes sense to throw an exception and when to use an alternate solution. The .NET documentation recommends that an...
1
by: Anonieko | last post by:
Understanding and Using Exceptions (this is a really long post...only read it if you (a) don't know what try/catch is OR (b) actually write catch(Exception ex) or catch{ }) The first thing I...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.