WcfProxy - NullReferenceException - Csla 4.5.10

WcfProxy - NullReferenceException - Csla 4.5.10

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

Fabiano posted on Friday, November 23, 2012

Hi all,

If error occurs in the WcfService the SL client throws a NullReferenceException.

Following the WcfProxy code at line number 645 is the code below:







WcfResponse response = null;



if (e.Error == null)

response = ConvertResponse(e.Result);



var globalContext = (ContextDictionary)MobileFormatter.Deserialize(response.GlobalContext); ----> if e.Error != null response is always null

so the NullReferenceException is raised.

May I use the work around below?

var globalContext = response == null ? ApplicationContext.GlobalContext : (ContextDictionary)MobileFormatter.Deserialize(response.GlobalContext);


Best regards,

Fabiano Rezende

RockfordLhotka replied on Saturday, November 24, 2012

This is a known bug that will be fixed in the next release.

g.beraudo@castsoftware.com replied on Monday, December 03, 2012

Same problem for me, my service was misconfigured:

In case this help someone else until the fix is released, I personally updated (take care to update all Create/Fetch/Update/Delete):

if (e.Error == null)

   response = ConvertResponse(e.Result);

var globalContext = (ContextDictionary)MobileFormatter.Deserialize(response.GlobalContext);


ContextDictionary globalContext = null;



if (e.Error == null) {  

   response = ConvertResponse(e.Result);

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





RockfordLhotka replied on Thursday, December 06, 2012

Fix is in svn now


Copyright (c) Marimer LLC