473,749 Members | 2,665 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to avoid first time exceptions when calling a webmethod ?

Hello,

VB.NET 1.1
IIS 6

I'm developping a winform client app of a web service of mine.

I used to set the IDE with "halt in debugger" on "common language runtime
exceptions".
Every time i call a method of my service if have 2 first time exceptions
"System.ObjectD isposedExceptio n" and "System.IO.IOEx ception" in system.dll.
I'm on a french system so my translations of theses 2 messages is
"unable to access a deleted object named 'System.Net.Tls Stream'" for the
first and "unabled to read transport connection datas" for the second.
After my calls, if i wait so time doing nothing i also have a
"System.Net.Soc ketsException" again in system.dll ("a remote connnection
have been closed by remote host").

These exceptions are handled somewhere in the framework and everything works
fine for my client app but they are terribly annoying me in my debugging
process.

What are theses exceptions : i think (hope ?) they are not "dangerous" since
they are caught and my app seems ok ?
Is there a way to code a ws client to have no "false" exceptions by doing
the work "properly" ?

Thanks in advance for your reply and sorry for my english

Olivier

Jul 30 '07 #1
8 2439
"Olivier BESSON" <o.******@commu nity.nospamwrot e in message
news:eM******** ******@TK2MSFTN GP02.phx.gbl...
Hello,

VB.NET 1.1
IIS 6

I'm developping a winform client app of a web service of mine.

I used to set the IDE with "halt in debugger" on "common language runtime
exceptions".
Every time i call a method of my service if have 2 first time exceptions
"System.ObjectD isposedExceptio n" and "System.IO.IOEx ception" in
system.dll.
I'm on a french system so my translations of theses 2 messages is
"unable to access a deleted object named 'System.Net.Tls Stream'" for the
first and "unabled to read transport connection datas" for the second.
After my calls, if i wait so time doing nothing i also have a
"System.Net.Soc ketsException" again in system.dll ("a remote connnection
have been closed by remote host").

These exceptions are handled somewhere in the framework and everything
works fine for my client app but they are terribly annoying me in my
debugging process.

What are theses exceptions : i think (hope ?) they are not "dangerous"
since they are caught and my app seems ok ?
Is there a way to code a ws client to have no "false" exceptions by doing
the work "properly" ?

Thanks in advance for your reply and sorry for my english
I would suggest that you not halt in the debugger when exceptions are
thrown, but only when they are not caught. If the framework is catching
these exceptions, then why do you care about that?
--
John Saunders [MVP]

Jul 30 '07 #2

"John Saunders [MVP]" <john.saunder s at trizetto.coma écrit dans le
message de news: eE************* *@TK2MSFTNGP03. phx.gbl...
"Olivier BESSON" <o.******@commu nity.nospamwrot e in message
news:eM******** ******@TK2MSFTN GP02.phx.gbl...
>Hello,

VB.NET 1.1
IIS 6

I'm developping a winform client app of a web service of mine.

I used to set the IDE with "halt in debugger" on "common language runtime
exceptions".
Every time i call a method of my service if have 2 first time exceptions
"System.Object DisposedExcepti on" and "System.IO.IOEx ception" in
system.dll.
I'm on a french system so my translations of theses 2 messages is
"unable to access a deleted object named 'System.Net.Tls Stream'" for the
first and "unabled to read transport connection datas" for the second.
After my calls, if i wait so time doing nothing i also have a
"System.Net.So cketsException" again in system.dll ("a remote connnection
have been closed by remote host").

These exceptions are handled somewhere in the framework and everything
works fine for my client app but they are terribly annoying me in my
debugging process.

What are theses exceptions : i think (hope ?) they are not "dangerous"
since they are caught and my app seems ok ?
Is there a way to code a ws client to have no "false" exceptions by doing
the work "properly" ?

Thanks in advance for your reply and sorry for my english

I would suggest that you not halt in the debugger when exceptions are
thrown, but only when they are not caught. If the framework is catching
these exceptions, then why do you care about that?
--
John Saunders [MVP]
First and most important reason : because i want to halt on all exceptions
raised by my code, and even if they are in a dll class library of mine, just
to make sure that i handle it correctly.
Second, because sometimes seeing an unhandled exception makes me modifying
my code to do a "better way" the same thing (even if it's work) like when
you do a lot of databindings but here, i'm very knew to web services and i
don't know where to put "better" code to have no exceptions (if it is
possible).

Thansk

Olivier

Jul 30 '07 #3
"Olivier BESSON" <o.******@commu nity.nospamwrot e in message
news:Ok******** ******@TK2MSFTN GP04.phx.gbl...
>
"John Saunders [MVP]" <john.saunder s at trizetto.coma écrit dans le
message de news: eE************* *@TK2MSFTNGP03. phx.gbl...
>"Olivier BESSON" <o.******@commu nity.nospamwrot e in message
news:eM******* *******@TK2MSFT NGP02.phx.gbl.. .
>>Hello,

VB.NET 1.1
IIS 6

I'm developping a winform client app of a web service of mine.

I used to set the IDE with "halt in debugger" on "common language
runtime exceptions".
Every time i call a method of my service if have 2 first time exceptions
"System.Objec tDisposedExcept ion" and "System.IO.IOEx ception" in
system.dll.
I'm on a french system so my translations of theses 2 messages is
"unable to access a deleted object named 'System.Net.Tls Stream'" for the
first and "unabled to read transport connection datas" for the second.
After my calls, if i wait so time doing nothing i also have a
"System.Net.S ocketsException " again in system.dll ("a remote connnection
have been closed by remote host").

These exceptions are handled somewhere in the framework and everything
works fine for my client app but they are terribly annoying me in my
debugging process.

What are theses exceptions : i think (hope ?) they are not "dangerous"
since they are caught and my app seems ok ?
Is there a way to code a ws client to have no "false" exceptions by
doing the work "properly" ?

Thanks in advance for your reply and sorry for my english

I would suggest that you not halt in the debugger when exceptions are
thrown, but only when they are not caught. If the framework is catching
these exceptions, then why do you care about that?
--
John Saunders [MVP]

First and most important reason : because i want to halt on all exceptions
raised by my code, and even if they are in a dll class library of mine,
just to make sure that i handle it correctly.
Second, because sometimes seeing an unhandled exception makes me modifying
my code to do a "better way" the same thing (even if it's work) like when
you do a lot of databindings but here, i'm very knew to web services and i
don't know where to put "better" code to have no exceptions (if it is
possible).
I didn't say to not break on unhandled exceptions. I said to stop breaking
on _all_ exceptions, handled or not. You're finding that some code,
including Framework code, throws exceptions. That's totally irrelevant to
you unless the exception is not caught.
--
John Saunders [MVP]

Jul 30 '07 #4
Hi Olivier,

Regarding on the first chance exception you got, it indicate that there
occur some problem at network layer. Have you used https/ssl for your
webservice communiation here as the exception include tlsstream? For such
webservice communication, the underlying network library will monitor any
connection timeout or secure channel refresh, and these operations may
depend on some exceptions to trigger them.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead

This posting is provided "AS IS" with no warranties, and confers no rights.
Jul 31 '07 #5
Hello,

Yes i use https with NTLM auth but i have also runtime exceptions with http.
I also noted first chance runtime exceptions when running the web service in
debug mode :
"System.Argumen tException" in mscorlib.dll "link error with destination
method".

Is there a way (preferably simple) to do myself what is done hidden by the
runtime to be sure of why theses exceptions are raised and that i'm doing
the job properly.
I'm sure theses exceptions are well handled since all client and server
works but to much times i had to put my hands in old code that worked during
years to repair just a small bad coding, so i prefer to do all things right
the first (and only ?) time.

Thanks,

Olivier
"Steven Cheng[MSFT]" <st*****@online .microsoft.coma écrit dans le message
de news: 3j************* *@TK2MSFTNGHUB0 2.phx.gbl...
Hi Olivier,

Regarding on the first chance exception you got, it indicate that there
occur some problem at network layer. Have you used https/ssl for your
webservice communiation here as the exception include tlsstream? For such
webservice communication, the underlying network library will monitor any
connection timeout or secure channel refresh, and these operations may
depend on some exceptions to trigger them.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead

This posting is provided "AS IS" with no warranties, and confers no
rights.

Jul 31 '07 #6
"Olivier BESSON" <o.******@commu nity.nospamwrot e in message
news:eM******** *****@TK2MSFTNG P02.phx.gbl...
Hello,

Yes i use https with NTLM auth but i have also runtime exceptions with
http.
I also noted first chance runtime exceptions when running the web service
in debug mode :
"System.Argumen tException" in mscorlib.dll "link error with destination
method".

Is there a way (preferably simple) to do myself what is done hidden by the
runtime to be sure of why theses exceptions are raised and that i'm doing
the job properly.
I'm sure theses exceptions are well handled since all client and server
works but to much times i had to put my hands in old code that worked
during years to repair just a small bad coding, so i prefer to do all
things right the first (and only ?) time.
These exceptions have nothing to do with you or your code.

Here's an analogy. What if you had another class, with a method like this:

try
{
throw new Exception("Retu rn zero anyway");
}
catch (Exception ex)
{
return 0;
}

Code that calls this method has no need to know that an exception is thrown
inside of the method. The calling code will always receive the same answer.

What you've set in the debugger says that you need to know that some other
piece of code throws an exception as part of its normal, successful
functioning. That makes no sense at all.

These exceptions aren't being _hidden_ by the runtime. They are being thrown
by, and _handled_ by the runtime. Ignore them.
--
John Saunders [MVP]

Jul 31 '07 #7
I'm sorry, but you've made a very serious mistake. You should NOT be
concerned with how any other piece of code implements itself. This is the
basic principal of encapsulation in OO. In particular, if some piece of
code happens to implement its logic by throwing and catching exceptions,
it's NOT YOUR CONCERN.
OK for other piece of code but not for my pieces of code.
>
I have never heard of anybody using your methodology, and I think it's one
of the worse techniques I've ever heard of. I have to assume that it's due
to a fundamental misunderstandin g of exception handling.
It's my methodoly, maybe it's the worst technique of the world, but the fact
and my concern is this one :
I have to make applications for my company internal user.
Theses applications must have no bugs, must NEVER NEVER crash in production
and must do all the work or no work and inform user.
You'll say : "the same things are requested for all applications".
I'll respond : Yes but i know can you tell how many you know in this case ?
Personnaly, i think you can count it on one hand fingers (french expression
may not the same in english).
My results today is that all my company apps respect 99.999999999999 999999%
of theses requests and they are really living things with not less than one
version a week.
>
Frankly, I don't even see how it would be possible to solve this problem.
How do you want to distinguish between the exceptions you want to stop at,
and the exceptions you don't want to stop at?
--
In fact my question is very simple :
Is there a way to halt on all exceptions that are raised directly in my code
even if they are in a try catch :
Ex :
try
connection.open '===I want to stop here if an exception is raised but i
don't want before the 3 previous runtimes exception that are catched and
reraised before in the runtime code.
catch ex
end try
John Saunders [MVP]

Aug 9 '07 #8
Thanks for your followup Olivier,

I can understand your concerns here that you want to make sure your
application services 100% secure and stable. I think John just want to mean
that normally for those exceptions that have been catched the runtime
framework, the framework should has been taken care of them and we do not
need to deal with them directly. Our .net framework application should
focus on any unhandled exceptions in our application scope. If you do need
to capture all the exceptions (no matter first chance or second chance), I
think it should be more like the jobs of a debugging tools rather than
application service. For such scenario, you can try looking for some
reference about debugging API (most of them are unmanaged interface as I
know).

Anyway, within the managed application's process itself(other than another
debuger process), I don't think it is quite supported to do so.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.
Aug 10 '07 #9

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

Similar topics

77
4596
by: Charles Law | last post by:
Hi guys I have a time critical process, running on a worker thread. By "time critical", I mean that certain parts of the process must be completed in a specific time frame. The time when the process starts is not especially important, but it must be complete within a small number of seconds. The operations I am performing do not take a long time (hundreds of milliseconds), but as each part of the process is complete, my worker thread...
13
2757
by: Steve Jorgensen | last post by:
== On Error Resume next, and Err.Number == If you want to call one of your procedures from another procedure, and check for errors afterward, you mayimagine that you should write code something like this... On Error Resuse Next MyFoo 123 lngErrNum = Err.Number On Error Goto 0
4
8520
by: asanford | last post by:
http://msdn2.microsoft.com/en-us/library/ds492xtk.aspx Is this the following excerpt from the above page incorrect, or is there a bug in the .net 2.0 implementation? Or perhaps I have something configured wrong. Basically, the doc says that when a custom exception type is thrown from a web method, that the web service client app will receive a soapexception with the soapexception.InnerException property set to reference the custom...
0
851
by: Sanjaya | last post by:
Hi all, I have following scenario to be implemented. I'm using .Net 1.1 and WSE2.0 a) 2 Applications running 2 "One way" web services (Let's call it App1,App2 and WS1, WS2 respectively) b) App1 sends a message to App2 by calling a webservice method in WS2 (WS2 is run by App2) c) App2 sends a reply to App1 by calling a webservice method in WS1 (WS1 is run by App1)
7
15672
by: illegal.prime | last post by:
Hi all, I've got a client/server application and just wanted to ensure that this is expected behavior. I recently set the following configuration in Visual Studio: Debug->Exceptions->Break Into Debugger for the CLR Exceptions And when my debugger hits the TcpClient.Connect statement and the server is not available - I get the following three first chance exceptions: A first chance exception of type 'System.Net.Sockets.SocketException'
4
1837
by: Tony | last post by:
Well the subject says it all. Do I have to have it if I use classes in C++? Tony
6
1624
by: Bruce | last post by:
I have a reference assembly that I wrote. The assembly can throw exceptions. I am handling these exceptions but, when running my code from VB, VB still insists on setting a breakpoint where the exception is being thrown inside the assembly. Is there anyway to avoid this? If so how?
1
3568
by: mmacrobert | last post by:
Hi Everyone, I've created a 'C' dll that is accessed via ctypes library containing a bunch of functions. I've successfully been able to use the functions. However, I would like to throw python exceptions from some of them. I throw them using: ::PyErr_SetString(::PyExc_RuntimeError, theErrorString); I crash the console when this function is invoked in the 'C' domain. I
22
2600
by: ben mitch | last post by:
Hi I hope you'll see this cross-post (c/c++) as appropriate. I also admit immediately that the question *may* turn out to be compiler-/os-specific, in which case I apologize. But I wonder if there's an underlying truth. We are writing a (cross-platform) 'framework' application (in C++, as it happens) that allows users to author 'plugins' (as shared library modules). Since the lifetime of plugins is expected to be long, and the
0
8997
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8833
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
9568
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
9335
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,...
1
6801
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4709
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3320
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
2
2794
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2218
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.