Exception not coming back to the client

Exception not coming back to the client

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


skagen00 posted on Thursday, July 18, 2013

INCLUDING REPRO AT END OF THREAD

I vaguely remember seeing a post on this before but I couldn't locate it and I didn't see anything in the change log to indicate this was addressed.

We're using version 4.5.10.  If I do something like this, my exceptions are not bubbling up to the client.  

protected override void DataPortal_Update() { throw new Exception("BOOM!"); }

I can put breakpoints in my OnSaved & OnError viewmodel methods, and they don't get hit.  This previously worked.  While I cannot say definitively it was the upgrade to 4.5.10 that caused it (from like 4.2 I think) I believe it is the case.

Is there anything that could have changed in CSLA that would have perhaps introduced an issue?  It's a fairly decent sized problem for us (it's not in production - next release though)

Edit: It's coming back to my CompressedWcfProxy (which inherits WcfProxy) and gets to CompressedWcfProxy.ConvertResponse but then fails... I can't seem to debug the Silverlight CSLA code so still trying to determine where it's failing.

skagen00 replied on Thursday, July 18, 2013

At this point, I can see that it gets to this line in SaveAsync (I overrode it and pasted it in because I can't seem to debug the CSLA SL code which would really help right now!). - it doesn't make it past that line (as expected).

result = await DataPortal.UpdateAsync<Contact>((Contact)this);

 

 

 

 

 

skagen00 replied on Thursday, July 18, 2013

In BeginSave of Csla.Xaml.ViewModelBase towards the bottom - BeginSave() is invoked when saving... basically just trying to save a business object that is designed to throw an error in the dataportal method.

        Error = null;
        IsBusy = true;
        savable.BeginSave();  <-- this ends up throwing a DataPortalException
      }
      catch (Exception ex)  <-- it doesn't seem to catch!
      {
        IsBusy = false;
        Error = ex;
        OnSaved();
      }
    }

So I was looking at what BeginSave should end up doing, which ends up going into SaveAsync, and  I _think_ the same sort of equivalent code with 4.0 would have returned a DataPortalResult with an error rather than an exception if something went wrong.  When using 4.5, it's catching a dataportal exception.  (This is effectively within SaveAsync of BusinessBase)

             try
            {
                result = await DataPortal.UpdateAsync<Contact>((Contact)this);
            }
            catch (Exception ex)
            {
                throw;
            }

 

skagen00 replied on Thursday, July 18, 2013

One last followup and then hopefully someone can chime in...

If I change my BusinessBase's SaveAsync to do the following, it fixes my problem.  I obviously don't want to just use my own workaround if I'm doing something incorrect - so if anyone has anything elightening to add it would be appreciated.

             try
            {
                result = await DataPortal.UpdateAsync<Contact>((Contact)this);
            }
            catch (Exception ex)
            {
                OnSaved(null, ex, userState);
                return null;
            }

Killian35 replied on Thursday, July 18, 2013

You may be referring this post a while ago. It sounds exactly like the issue I had and still have. Once I moved to 4.5.10 the BeginSave would fail as you described. I've tested all the way through 4.5.30 and the bug still exists.

skagen00 replied on Thursday, July 18, 2013

Bingo, that was the post I was referring to. 

I'm glad I'm not alone.  Seems like a pretty major issue.

skagen00 replied on Sunday, July 21, 2013

I'm hoping this doesn't just slide off the board as it is a fairly decent issue - I think it should be pretty clear as to what the issue is but would anything in particular help / i.e. a reproducible app or what have you?  I think it should be fairly easy to reproduce but would be happy to help with a repro if the above posts aren't sufficiently clear.

 

skagen00 replied on Friday, July 26, 2013

I'm really hoping someone on the CSLA team can address this - I have a super-simple reproducable - just fire up the app and click the button and it'll be apparent that after the BeginSave(), there is no OnError, no OnSaved - for a save operation that throws an exception.

We release a next version of our product in a few months and I would *really* like to avoid hacky workarounds.

The upload attachment doesn't seem to be working for me - I would happy to email the reproducable to anyone on the CSLA team.

JonnyBee replied on Friday, July 26, 2013

Hi,

You may send the attachment to me on jonny.bekkum(a)gmail.com. 

I am on vacation now and until 12. august and not sure if I am able to do much until I get back home.

AFAIK anyone that has signed a contribution agreement with Rocky may submit push requests to the CSLA repository.
Then either Rocky or me (as backup) can accept the push request and update the base repository.   

skagen00 replied on Friday, July 26, 2013

Sent, thank you.

skagen00 replied on Monday, August 19, 2013

just fyi, I noticed the fix for this has been checked in over at GitHub - thanks Jonny!

Copyright (c) Marimer LLC