I found two errors in WcfPortal

I found two errors in WcfPortal

Old forum URL: forums.lhotka.net/forums/t/9444.aspx


itracker posted on Friday, August 27, 2010

Hello!

My englishis bad. Sorry. I like CSLA and your book. I buy it and read. Your framework help me save our time.

CSLA 4.0.1 beta.  I found 2 Mistakes in class WcfPortal:

 

1.  Method proxy_DeleteCompleted and others (UpdateCompleted, ExecuteCompleted ...) fails on e.Result when we have CommunicationException. 

    private void proxy_DeleteCompleted(object sender, Csla.WcfPortal.DeleteCompletedEventArgs e)

    {

      var response = ConvertResponse(e.Result);

      try

      {

        if (e.Error == null && response.ErrorData == null)

        {

          _globalContext = (ContextDictionary)MobileFormatter.Deserialize(response.GlobalContext);

          OnDeleteCompleted(new DataPortalResult<T>(default(T), null, e.UserState));

        }

        else if (response.ErrorData != null)

        {

          var ex = new DataPortalException(response.ErrorData);

          OnDeleteCompleted(new DataPortalResult<T>(default(T), ex, e.UserState));

        }

        else

        {

          OnDeleteCompleted(new DataPortalResult<T>(default(T), e.Error, e.UserState));

        }

      }

      catch (Exception ex)

      {

        OnUpdateCompleted(new DataPortalResult<T>(default(T), ex, e.UserState));

      }

    }

 

Because:

 

        public Csla.WcfPortal.WcfResponse Result {

            get {

                base.RaiseExceptionIfNecessary();

                return ((Csla.WcfPortal.WcfResponse)(this.results[0]));

            }

        }

 

And i dont have DeleteCompleted event :( My ProgressWindow still open and i dont know when close him :(

Because DeleteCompleted does not raises.

 

 

2. 

        OnUpdateCompleted(new DataPortalResult<T>(default(T), ex, e.UserState));

 

Why OnUpdateCompleted when this is in proxy_DeleteCompleted() method?

 

RockfordLhotka replied on Friday, August 27, 2010

1. You are saying that this line:

var response = ConvertResponse(e.Result);

should be inside the try block? That is probably correct.

 

2. This looks like a bug.

itracker replied on Friday, August 27, 2010

Why try catch? I think just check e.Error for null.

RockfordLhotka replied on Friday, August 27, 2010

Maybe like this:

        Csla.WcfPortal.WcfResponse response = null;
        if (e.Error == null)
          response = ConvertResponse(e.Result);
        if (e.Error == null && response != null && response.ErrorData == null)

itracker replied on Friday, August 27, 2010

I need something like this:

if (e.Error != null)

OnDeleteCompleted(new DataPortalResult<T>(default(T), e.Error, e.UserState));

return;

}

itracker replied on Friday, August 27, 2010

In last your checkin if e.Error != null i have never gain DeleteCompleted event :( I need know if CommunicationException or something else is occured.

itracker replied on Friday, August 27, 2010

Sorry. I view code. All right. That it was i need. thanks

Copyright (c) Marimer LLC