Intermittent failure to Save Model from Silverlight Client

Intermittent failure to Save Model from Silverlight Client

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


gautamh posted on Thursday, February 02, 2012

This is a really strange issue that I have not been able to reproduce on my development machinem but one that our QA team is regularly able to reproduce.

I have collection that is bound to a grid in silverlight. The user inserts a couple of new entries and update a few and clicks save. Sometimes, "nothing" happens. The button gets clicked but no request is reaching the server.

I have put debug statements on the silverlight client and can see that the collection is dirty and is savable. The Model is also savable.

However, the call fails to reach the data portal on the server side.

I have enabled wcf tracing on the server. But the data generated is huge and I'm not sure what to look for. Is there anything in the IIS logs that I can look for or any area in the CSLA framework that I can put additional tracing to figure out why the call is failing to reach the server.

Thanks.

RockfordLhotka replied on Thursday, February 02, 2012

The first place I'd put log/trace code is in the client-side callback code. I'm assuming you always check e.Error, or in your viewmodel you override OnError?

There are (generally) three options:

  1. The button click event binding got disconnected and save wasn't called at all
  2. Save was called and there was an error (e.Error or OnError will tell you what)
  3. Save was called and WCF never returned the call (rare, and something I haven't seen since some beta of Silverlight long ago)

 

gautamh replied on Thursday, February 02, 2012

Hi Rocky,

Thank you for the speedy reply.

I had already verified that:

(1) The button click event binding was connected and that Save was called.

(2) The Model was Dirty and Saveable.

(3) I do override the OnError and display the error messages on the screen.

However, I will put in additional tracing on the client callbacks to see if flow of control reaches the callback code. I will also put in a trace to check if the wcf proxy is being created.

Any other suggestions would be appreciated.

gautamh replied on Friday, February 03, 2012

An update here. I managed to capture the exception that is being thrown. It is the dreaded "Csla.Core.UndoException: Edit level mismatch in AcceptChanges".

However, I'm at a complete loss to understand why this occurs only on the QA machine and not on any of the developers or end users machines. I cannot ignore this as any QA issue is a potential production issue.

Any help or suggestions here will be hugely appreciated.

ViewModelBase<T>.BeginSave().Catch -- Csla.Core.UndoException: Edit level mismatch in AcceptChanges    
00000025    19.30083275    [3904]    at Csla.Rules.BusinessRules.Csla.Core.IUndoableObject.AcceptChanges(Int32 parentEditLevel, Boolean parentBindingEdit)    
00000026    19.30083275    [3904]    at Csla.Core.BusinessBase.AcceptingChanges()    
00000027    19.30083275    [3904]    at Csla.Core.UndoableBase.AcceptChanges(Int32 parentEditLevel)    
00000028    19.30083275    [3904]    at Csla.Core.UndoableBase.Csla.Core.IUndoableObject.AcceptChanges(Int32 parentEditLevel, Boolean parentBindingEdit)    
00000029    19.30083275    [3904]    at Csla.Core.UndoableBase.ResetChildEditLevel(IUndoableObject child, Int32 parentEditLevel, Boolean bindingEdit)    
00000030    19.30083275    [3904]    at Csla.BusinessListBase`2.InsertItem(Int32 index, C item)    
00000031    19.30083275    [3904]    at System.Collections.ObjectModel.Collection`1.Add(T item)    
00000032    19.30083275    [3904]    at Csla.Core.MobileBindingList`1.OnSetChildren(SerializationInfo info, MobileFormatter formatter)    
00000033    19.30083275    [3904]    at Csla.BusinessListBase`2.OnSetChildren(SerializationInfo info, MobileFormatter formatter)    
00000034    19.30083275    [3904]    at Csla.Core.MobileBindingList`1.Csla.Serialization.Mobile.IMobileObject.SetChildren(SerializationInfo info, MobileFormatter formatter)    
00000035    19.30083275    [3904]    at Csla.Serialization.Mobile.MobileFormatter.DeserializeAsDTO(List`1 deserialized)    
00000036    19.30083275    [3904]    at Csla.Serialization.Mobile.MobileFormatter.Deserialize(List`1 data)    
00000037    19.30083275    [3904]    at Csla.Serialization.Mobile.MobileFormatter.Deserialize(XmlReader reader)    
00000038    19.30083275    [3904]    at Csla.Serialization.Mobile.MobileFormatter.Deserialize(Stream serializationStream)    
00000039    19.30083275    [3904]    at Csla.Core.ObjectCloner.Clone(Object obj)    
00000040    19.30083275    [3904]    at Csla.BusinessListBase`2.GetClone()    
00000041    19.30083275    [3904]    at Csla.BusinessListBase`2.Csla.ICloneable.Clone()    
00000042    19.30083275    [3904]    at Csla.Xaml.ViewModelBase`1.BeginSave()

RockfordLhotka replied on Friday, February 03, 2012

The QA people must be following some steps that other people aren't following. This may be down to keystroke or mouse gesture level actions that somehow leaves focus on some control that keeps some edit level elevated or something.

Copyright (c) Marimer LLC