473,651 Members | 3,063 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1413
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

"ThunderMus ic" <No************ *************@N oSpAm.comschree f in bericht
news:um******** *****@TK2MSFTNG P05.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.c omwrote in message
news:u0******** ******@TK2MSFTN GP03.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

"ThunderMus ic" <No************ *************@N oSpAm.comschree f in bericht
news:um******** *****@TK2MSFTNG P05.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>
<legacyUnhandle dExceptionPolic y 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
2487
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 with a top level catch all for Exception. However, I would like to be able to catch most .net exceptions when they are generated. I would then be able to generate a valuable exception message and do something about it!!! Hence the question above....
15
426
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 have been asked on clc before so it is probably OK. I am a newbie to C++. BS 3rd edition states: % The throw transfers control to a handler for exceptions .... %
10
8557
by: Cool Guy | last post by:
Consider: void Start() { if (!TryToDoSomething()) ShowErrorMessage(); }
10
2037
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 an event (i.e. Click event), VS.Net will enter debug mode on the exact line that threw the exception in the UserControl. You can see the complete call stack up to the Click event, all local variables from the Click event, etc. However, if an...
10
1293
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 reference to B, B has a reference to C, and C to D. If an exception happens in class D, I would like class A to get a notification of this (all execution on classes B to D should be terminated). I am wondering how to do this. The following seems...
6
1710
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, creating an unhandled exception inside "theUI". Would anybody know why this is happening? I thought the general rule for exceptions handling was the exception is passed up the stack until the application handles it or the program terminates? ...
2
1302
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 permissions on a stored procedure, etc. I use this exception handler in all of my applications and it can be called as simply as follows try ... catch ex as sqlexception ExceptionHandler(ex, otherData1, otherData2)
8
2246
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 exception should be thrown only in exceptional situations. It turned out that each of my colleagues had their own interpretation about what an "exceptional situation" may actually be. First of all, myself I’m against using exceptions extensively,...
1
2377
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 look for when evaluating someone's code is a try/catch block. While it isn't a perfect indicator, exception handling is one of the few things that quickly speak about the quality of code. Within seconds you might discover that the code author...
0
8278
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8807
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8466
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8584
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7299
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5615
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4290
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2701
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1912
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.