locked
Asynchronous plugin not working with EarlyBound RRS feed

  • Question

  • HI,

    I am using crm 2013, and trying to write a asynchronous plugin which uses EarlyBound classes.

    No cast operations are working it throws cast exceptions, but works when registered as synchronous.

    I have merged early bound to plugin assembly.

    Also tried to use Early Bound generated crm service context but with it i got another exception "The specified type 'Crm.EarlyBound.AnyEntity' is not a known entity type".

    What i am missing?

    I also tried to insert this code in base class:

    if (this.PluginExecutionContext is IProxyTypesAssemblyProvider)
                        ((IProxyTypesAssemblyProvider)this.PluginExecutionContext).ProxyTypesAssembly = typeof(Crm.EarlyBound.CmrServiceContext).Assembly; 

    which did not helped.

    Anyone? Please help : )


    • Edited by Żym Friday, July 4, 2014 9:42 AM typo
    Friday, July 4, 2014 9:42 AM

All replies

  • If the error during runtime or compile time? Also, does an entity with the name 'AnyEntity' actually exist?

    Admin QuikView Solution for CRM 2013

    Friday, July 4, 2014 9:48 AM
  • Sorry for not being specific. Error happens during runtime. And yes, the entity with the name "AnyEntity" actually exists, for basic testing i have disabled all the logic, only left one "retrieve function" on which error occurs.

    i tried through _orgService.Retrieve(AnyEntity.logicalName, ...).ToEntity<EarlyBound.AnyEntity>

    and through 

     using (var xrmContext = new EarlyBound.CrmServiceContext(_orgService))

    {
    EarlyBound.CampaignResponse campaignResponse = null;
            specifiEntity= xrmContext.CampaignResponseSet.FirstOrDefault(x => x.Id == recordId);

    }

    update:

    As mentioned before, it only happens during async ,when it is registered through synchronous way there is no problem with either way of usage.

    if you use _orgService.Retrieve(...).ToEntity<Lead>();

    async plugin results in error Attempt by method 'Microsoft.Xrm.Sdk.Entity.ToEntity<System.__Canon>()' to access method 'Crm.EarlyBound.Lead..ctor()' failed.


    • Edited by Żym Friday, July 4, 2014 10:56 AM
    Friday, July 4, 2014 10:03 AM
  • No one? really?
    Thursday, July 17, 2014 10:47 AM
  • Well then thank you very much for your worthless effort and support.
    Monday, August 18, 2014 9:56 AM
  • Well then thank you very much for your worthless effort and support.

    well, you know, no one here is paid to provide answers, everybody try to help this community in their spare time with the best effort, can happen that a question doesn't get a successful answer.

    Now back to your question.

    did you try to use late bound and check if your logic works also asynchronously?

    did you try to generate an early bound class with only the entities you need? you can use this tool: https://xrmearlyboundgenerator.codeplex.com/

    under which message is registered your plugin? it is registered only against one entity? pre or post?

    can you describe the logic of the plugin? (for example create new records, update records, etc etc)


    My blog: www.crmanswers.net - Rockstar 365 Profile

    Monday, August 18, 2014 10:26 AM