Possible bug: Silverlight "Delete" factory throws null reference exception with "Value cannot be null. Parameter name: key" message

Possible bug: Silverlight "Delete" factory throws null reference exception with "Value cannot be null. Parameter name: key" message

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


Jaans posted on Tuesday, September 28, 2010

Strangely I haven't called the delete factory in any of my previous Silverlight projects. Usually I just fetch the business object, call Delete() on the instance and Save it.

That actually works with this business object, but when I instead do the delete with a call to the Delete factory, I get an null reference exception with a message value of "Value cannot be null. Parameter name: key"

Here is the call stack (Silverlight side):

   at System.Collections.Generic.Dictionary`2.FindEntry(TKey key)
   at System.Collections.Generic.Dictionary`2.TryGetValue(TKey key, TValue& value)
   at Csla.Security.ObjectAuthorizationRules.GetRoles(Type objectType)
   at Csla.Security.AuthorizationRules.GetAllowDeleteRoles(Type objectType)
   at Csla.Security.AuthorizationRules.CanDeleteObject(Type objectType)
   at Csla.DataPortal.Delete(Type objectType, Object criteria)
   at Csla.DataPortal.Delete(Object criteria)
   at Csla.Server.Hosts.Silverlight.SilverlightRequestProcessor.Delete(SilverlightCriteriaRequest request)

From the above it looks to be related to the authorization rules, but my business object has none (neither Instance nor Factory).

Is this a Bug in CSLA or am I missing something?

PS: Based on CSLA 3.8.4 and Silverlight 4.

Thanks,
Jaans

Jaans replied on Saturday, October 02, 2010

Does CSLA 4 also throw this exception when calling the Delete factory in Silverlight ?

Jaans replied on Wednesday, December 22, 2010

I can confirm that this does not happen with CSLA 4.1.0 BETA.

Copyright (c) Marimer LLC