web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

plugins always crash

(0) ShareShare
ReportReport
Posted on by 112

I am trying to write a plugin but I seem to be unable to even get a basic one to run. 

few things:

the class is public,

It is signed,

version sdk is 8.2.1.1

Also the profiler will not help do to its own issue (Unexpected exception from plug-in). I have tried to copy and paste the sample code in and get the same error every time.

I am now just try to get a shell that does not do any thing to run. Here is the code 

using Microsoft.Xrm.Sdk;
using System;

namespace basicPlugin
{
public class basicPlugin : IPlugin
{
#region Secure/Unsecure Configuration Setup
private string _secureConfig = null;
private string _unsecureConfig = null;

public basicPlugin(string unsecureConfig, string secureConfig)
{
_secureConfig = secureConfig;
_unsecureConfig = unsecureConfig;
}
#endregion
public void Execute(IServiceProvider serviceProvider)
{
ITracingService tracer = (ITracingService)serviceProvider.GetService(typeof(ITracingService));

IPluginExecutionContext context = (IPluginExecutionContext)serviceProvider.GetService(typeof(IPluginExecutionContext));

IOrganizationServiceFactory factory = (IOrganizationServiceFactory)serviceProvider.GetService(typeof(IOrganizationServiceFactory));

IOrganizationService service = factory.CreateOrganizationService(context.UserId);

try
{
Entity entity = (Entity)context.InputParameters["Target"];

//TODO: Do stuff
}
catch (Exception e)
{
throw new InvalidPluginExecutionException(e.Message);
}
}
}
}

*This post is locked for comments

I have the same question (0)
  • Community Member Profile Picture
    on at

    Try comment this part to see if it works:

    public basicPlugin(string unsecureConfig, string secureConfig)

    {

    _secureConfig = secureConfig;

    _unsecureConfig = unsecureConfig;

    }

    if it does, the error happens in class constructor, either value passed in is wrong type or the values are not provided.

  • Community Member Profile Picture
    on at

    Try comment this part to see if it works:

    public basicPlugin(string unsecureConfig, string secureConfig)

    {

    _secureConfig = secureConfig;

    _unsecureConfig = unsecureConfig;

    }

    if it does, the error happens in class constructor, either value passed in is wrong type or the values are not provided.

  • Rscroggins Profile Picture
    112 on at

    I commented that part out

           /*public basicPlugin(string unsecureConfig, string secureConfig)

           {

               //_secureConfig = secureConfig;

               //_unsecureConfig = unsecureConfig;

           }*/

    but it still crashes I am at a loss

    *also the profiler error is "unexpected Exception in the Plug-in Profiler".

  • Community Member Profile Picture
    on at

    Did you pass strings through Plugin reg tool?

    Maybe insert try .. catch in constructor and checking for passed in values using if (!String.IsNullOrWhiteSpace(secureConfig)) to see what is going on:

    public basicPlugin(string unsecureConfig, string secureConfig)

          {

    try{

    if(!String.IsNullOrWhiteSpace(secureConfig)){

    _secureConfig = secureConfig;

    }

    if(!String.IsNullOrWhiteSpace(unsecureConfig)){

    _unsecureConfig = unsecureConfig;

    }

      }

      catch(Exception ex){

    throw new InvalidPluginExecutionException(ex.ToString());

      }

          }

  • ashlega Profile Picture
    34,477 on at

    How do you know it crashes? Is there an error message/a log file/a screenshot you could share?

  • prasannakumar Profile Picture
    80 on at

    Hi,

    Can you share more information on the plugin with details on the registration steps, the triggering message. how you have registered the plugin and how to concluded that the plugin is always crashing. May be a screenshot of the plugin registration tool and also the log information. 

  • Rscroggins Profile Picture
    112 on at

    I have downsized the code to the bare skeleton

    using Microsoft.Xrm.Sdk;

    using System;

    namespace CRMPluginProject1

    {

       public class Class1 : IPlugin

       {

           public void Execute(IServiceProvider serviceProvider)

           {

               //throw new NotImplementedException();

           }

       }

    }

    [View:[URL=http://s1347.photobucket.com/user/ITRS/media/code_zpso7eetgvn.png.html][IMG]i1347.photobucket.com/.../code_zpso7eetgvn.png[/IMG][/URL]:320:240]

    [View:[URL=http://s1347.photobucket.com/user/ITRS/media/regSkeleton_zps7ugriymy.png.html][IMG]i1347.photobucket.com/.../regSkeleton_zps7ugriymy.png[/IMG][/URL]:320:240]

    [View:[URL=http://s1347.photobucket.com/user/ITRS/media/regNewStepSkeleton_zpsnapwlynf.png.html][IMG]i1347.photobucket.com/.../regNewStepSkeleton_zpsnapwlynf.png[/IMG][/URL]:320:240]

    [View:[URL=http://s1347.photobucket.com/user/ITRS/media/errorSkeleton_zpsnb6kvfzg.png.html][IMG]i1347.photobucket.com/.../errorSkeleton_zpsnb6kvfzg.png[/IMG][/URL]:320:240]

    Unhandled Exception: System.ServiceModel.FaultException`1[[Microsoft.Xrm.Sdk.OrganizationServiceFault, Microsoft.Xrm.Sdk, Version=8.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]: System.ArgumentNullException: Value cannot be null.
    Parameter name: SandboxAppDomainHelper.Execute: The plug-in type could not be found in the plug-in assembly: CRMPluginProject1.Class1Detail:
    <OrganizationServiceFault xmlns:i="www.w3.org/.../XMLSchema-instance" xmlns="schemas.microsoft.com/.../Contracts">
    <ActivityId>6515a93c-4a47-4339-84f3-fe2e65284c6f</ActivityId>
    <ErrorCode>-2147220970</ErrorCode>
    <ErrorDetails xmlns:d2p1="schemas.datacontract.org/.../System.Collections.Generic" />
    <Message>System.ArgumentNullException: Value cannot be null.
    Parameter name: SandboxAppDomainHelper.Execute: The plug-in type could not be found in the plug-in assembly: CRMPluginProject1.Class1</Message>
    <Timestamp>2017-10-13T14:53:58.4541054Z</Timestamp>
    <ExceptionRetriable>false</ExceptionRetriable>
    <ExceptionSource i:nil="true" />
    <InnerFault i:nil="true" />
    <OriginalException i:nil="true" />
    <TraceText>

    [CRMPluginProject1: CRMPluginProject1.Class1]
    [32884a3c-26b0-e711-8115-e0071b7285c1: CRMPluginProject1.Class1: Create of account]


    </TraceText>
    </OrganizationServiceFault>

    If you need any thing else let me know.

    Thank you.

  • ashlega Profile Picture
    34,477 on at

    Hm.. Just wondering - are you using the latest version of the SDK assemblies for the project references?

  • Rscroggins Profile Picture
    112 on at

    As I said in my first post my SDK version is version sdk is 8.2.1.1.

  • ashlega Profile Picture
    34,477 on at

    Maybe that's the problem, then? What version of CRM do you have there? In the error message, it's mentioning 8.0

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans