none
Cannot use the generated entity statuses in the SDK (from crmsvcutil.exe) in Sandbox: Serialization Exception

    Question

  • Hi,

     

    This looks more like a bug to me but if anyone has any experience with this please shed some light. I am querying some workflows in my plugin using the following code:

     

    QueryExpression query = new QueryExpression(AsyncOperation.EntityLogicalName);
    query.Criteria.AddCondition(new ConditionExpression("statecode", ConditionOperator.NotEqual, AsyncOperationState.Completed));
    query.Criteria.AddCondition("regardingobjectid", ConditionOperator.Equal, eventId);
    query.Criteria.AddCondition("operationtype", ConditionOperator.Equal, 10); // Workflows only
    
    EntityCollection workflows = service.RetrieveMultiple(query);
    

    When this code executes without isolation there is no problem, but if it executes within sandbox I get a SerializtionException: System.Runtime.Serialization.SerializationException: Microsoft Dynamics CRM has experienced an error. Reference number for administrators or support: #01E45E75

    Very weird, I am deploying to CRM Online so I ust use sandbox...

     


    Gonzalo | gonzaloruizcrm.blogspot.com

    Monday, August 15, 2011 10:54 PM
    Moderator

All replies

  • we are seeing these errors as well - did you find any resolution?
    .NET MVP / Microsoft Regional Director / http://blog.davidyack.com / http://crm.davidyack.com
    Sunday, August 21, 2011 4:05 PM
  • Can you try the following:

    query.Criteria.AddCondition(new ConditionExpression("statecode", ConditionOperator.NotEqual, AsyncOperationState.Completed.ToString()));

    This should use the string value "Completed" for the condition and the sandbox serializer should be able to work with that.


    Patrick Verbeeten

    W: www.wavextend.com
    W: www.patrickverbeeten.com
    Monday, August 22, 2011 8:06 AM
  • Hi David,

    I think this is a bug, the workaround I have used is to use  this:

    query.Criteria.AddCondition(new ConditionExpression("statecode", ConditionOperator.NotEqual, (int)AsyncOperationState.Completed));

     

    a bit annoying since I have to change existing code in order to re-deploy to sandbox...


    Gonzalo | gonzaloruizcrm.blogspot.com

    Monday, August 22, 2011 12:44 PM
    Moderator