error handling - byref params not modified if an exception is thro

From: Luis Fajardo (LuisFajardo_at_discussions.microsoft.com)
Date: 09/02/04


Date: Wed, 1 Sep 2004 18:33:14 -0700

I noticed the byref parameters doesn't get changed if during the execution of
the web service an exception is thrown.

Sample code:

-->Client
public class WSClient{
  public void Execute(){
    int i = 0;
    try{
      WSServer server = new WSServer();
      server.Execute(ref i);
    }
    catch(Exception e){
      Console.WriteLine(i.ToString());
    }
  }
}

-->Server
public class WSServer : System.Web.Services.WebService{
  [WebMethod]
  public void Execute(ref int i){
    i = 100;
    throw new Exception("i does't change!!!, too bad!!!");
  }
}

Why? I'm having the same problem with .NET Remoting, but local calls
obviously works fine. Work arounds? How should I do it?

Thanks in advance.

Luis Fajardo



Relevant Pages

  • Re: A question about order of execution?
    ... > I have a question about what I think is a problem with order of execution ... > Public Class Page ... > Public Sub Fill_Datagrid ... > When I execute code LIKE this, I often get a SQL error because the ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: A question about order of execution?
    ... >> I have a question about what I think is a problem with order of execution ... >> Public Class Page ... >> End Sub ... > sense that if I now set a label to the variable in the button code it ...
    (microsoft.public.dotnet.framework.aspnet)
  • very new to java
    ... public class Welcome ... // main method begins execution of Java application ... public static void main(String args[]) ...
    (comp.lang.java.help)
  • Re: How to use generics?
    ... getting rid of the ACollection and BCollection and just having Collectionwould be a good start towards using generics to the full extent. ... public void AddCollection() ... public bool ContainsKey ...
    (microsoft.public.dotnet.languages.csharp)
  • program challenge
    ... public void setName{ ... the salaried class that extends Employee ... public class Salaried extends Employee ... // Programmer.java: the programmer class that extends from Hourly ...
    (comp.lang.java.help)