"John Saunders [MVP]" <john.saunders at trizetto.com> a écrit dans le
message de news: u3BduZ50HHA.1336@TK2MSFTNGP04.phx.gbl...
[quoted text, click to view] > "Olivier BESSON" <o.besson@community.nospam> wrote in message
> news:eMQcvO00HHA.464@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]
>
Ok, thanks for the response.
When i sayed "hidden" i wanted to say what you say.
I think i can best explain what i want to do (if possible ???) with an
example :
I suppose that when you build a web service (client or server) there is a
lot of inheritance and a lot of code that use reflexion to get information.
Maybe for example with the client :
Client opens a tcp connection with the server
Client use the tcp to do a post in anonymous mod
If there is an exception that say "authent = windows" Client catchs it
Client use the tcp to do a post in with NTML auth
If ok Client return ok
Else Client return new exception(not authentified)
Else Client return ok
In this case i'll always have an exception if server is in "authent =
windows".
What i wanted was :
Is there a way to have access to all these code (auto generated base
sources, delegates on certains objects, ohter ???) to tell it not to try
anonymous because i know i must use NTLM ?
OrElse is there a documentation on how to "make from scratch" a web service
client using the xsd generated code only for the soap serial/deserial.
If i insist so it's because i have one of my most important "best practices"
from years that is :
In a normal conditions if your code is correct you must have NO exceptions
and one of the first rules for me and my team is :
Do all your coding and tests in debug mode with halt on all exceptions (vb6
and vb.net) : you must never halt, only from real exceptions (network
failure, no more space on hd, etc ...).
The ErrorHandlers or Try Catches are here only to prevent opened resources
and application crach if bad things appears, if you use carefully objects
and properties you can have no exceptions.
So theses runtime exceptions makes my life very hard to debug code because
you always have to click on prompt and not looking carefully at message i
can click continue not seeing the exception comes from my code and so
loosing the ability to modify source to prevent it (not sure you will
anderstood this phrase because it's very hard to explain it in english).
Thanks for your response
Regards,
Olivier