473,379 Members | 1,326 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,379 software developers and data experts.

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.ObjectDisposedException" and "System.IO.IOException" 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.TlsStream'" 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.SocketsException" 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 2424
"Olivier BESSON" <o.******@community.nospamwrote in message
news:eM**************@TK2MSFTNGP02.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.ObjectDisposedException" and "System.IO.IOException" 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.TlsStream'" 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.SocketsException" 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.saunders at trizetto.coma écrit dans le
message de news: eE**************@TK2MSFTNGP03.phx.gbl...
"Olivier BESSON" <o.******@community.nospamwrote in message
news:eM**************@TK2MSFTNGP02.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.ObjectDisposedException" and "System.IO.IOException" 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.TlsStream'" 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.SocketsException" 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.******@community.nospamwrote in message
news:Ok**************@TK2MSFTNGP04.phx.gbl...
>
"John Saunders [MVP]" <john.saunders at trizetto.coma écrit dans le
message de news: eE**************@TK2MSFTNGP03.phx.gbl...
>"Olivier BESSON" <o.******@community.nospamwrote in message
news:eM**************@TK2MSFTNGP02.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.ObjectDisposedException" and "System.IO.IOException" 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.TlsStream'" 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.SocketsException" 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.ArgumentException" 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**************@TK2MSFTNGHUB02.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.******@community.nospamwrote in message
news:eM*************@TK2MSFTNGP02.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.ArgumentException" 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("Return 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 misunderstanding 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.999999999999999999%
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
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...
13
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...
4
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...
0
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)...
7
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...
4
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
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...
1
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...
22
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...
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...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.