locked
Why is localContext.ServiceProvider null RRS feed

  • Question

  • I have created a plugin in 2011 using  the SDK Development Kit Plugin project and the CRM Package project to deploy the plugins.

    The Plugin project, when one creates a plugin via the CRM Explorer, creates a class that inherits from Plugin.CS

    In the class is a method created OOTB

    protected void ExecuteMyPlugin(LocalPluginContext localContext)
    But when I try to access localContext.ServiceProvider the ServiceProvider object is always null

    Why is this?


    Maz


    • Edited by MazP Sunday, October 12, 2014 9:57 AM
    Sunday, October 12, 2014 8:12 AM

Answers

  • Hi Maz,

    There is actually a bug in Plugin.cs - you need to add the following line to the LocalPluginContext constructor

    this.ServiceProvider = serviceProvider;

    Hope this helps,

    Scott


    Scott Durow
    Blog www.develop1.net    Follow Me
    Rockstar365
    If this post answers your question, please click "Mark As Answer" on the post and "Mark as Helpful"

    Monday, October 13, 2014 6:01 PM
    Answerer

All replies

  • Hi Maz,

    There is actually a bug in Plugin.cs - you need to add the following line to the LocalPluginContext constructor

    this.ServiceProvider = serviceProvider;

    Hope this helps,

    Scott


    Scott Durow
    Blog www.develop1.net    Follow Me
    Rockstar365
    If this post answers your question, please click "Mark As Answer" on the post and "Mark as Helpful"

    Monday, October 13, 2014 6:01 PM
    Answerer
  • Thank you Scott!

    Maz

    Tuesday, October 14, 2014 7:05 AM