scottdurow / SparkleXrm

An open-source library for building Dynamics CRM XRM solutions using Script#, jQuery & Knockoutjs.
MIT License
267 stars 197 forks source link

Object reference not set to an instance of an object when registering a plugin #440

Open AleksandrRogov opened 3 years ago

AleksandrRogov commented 3 years ago

spkl version: 1.0.640.

When registering a new plugin I am getting the following error:

The application terminated with an error.
Object reference not set to an instance of an object.
   at SparkleXrm.Tasks.PluginRegistraton.normaliseCommaSeparatedString(String input)
   at SparkleXrm.Tasks.PluginRegistraton.RegisterStep(PluginType sdkPluginType, List`1 existingSteps, CrmPluginRegistrationAttribute pluginStep)
   at SparkleXrm.Tasks.PluginRegistraton.RegisterPluginSteps(IEnumerable`1 pluginTypes, PluginAssembly plugin)
   at SparkleXrm.Tasks.PluginRegistraton.RegisterPlugin(String file, Boolean excludePluginSteps)
   at SparkleXrm.Tasks.DeployPluginsTask.DeployPlugins(OrganizationServiceContext ctx, ConfigFile config)
   at SparkleXrm.Tasks.DeployPluginsTask.ExecuteInternal(String folder, OrganizationServiceContext ctx)
   at SparkleXrm.Tasks.BaseTask.Execute(String folder)
   at SparkleXrmTask.Program.RunTask(CommandLineArgs arguments, IOrganizationService service, ITrace trace)
   at SparkleXrmTask.Program.Run(CommandLineArgs arguments)
   at SparkleXrmTask.Program.Main(String[] args)
Error Code=1

The plugin assembly gets deployed but it does not have any registered steps, so I think it happens when a new step gets registered.

I've got the following Plugin Registration attribute:

[CrmPluginRegistration(MessageNameEnum.Create, Incident.EntityLogicalName, StageEnum.PreOperation, ExecutionModeEnum.Synchronous,
    filteringAttributes: null, stepName: "My.Plugins - Create of Case", executionOrder: 1,
    isolationModel: IsolationModeEnum.Sandbox, Id = "6D8F5EEF-072A-4D39-B707-8C0C858550D0"
)]

I am guessing the error happens because this method - it does not have a null check for an input parameter, that's the only line in there.

OliverFlint commented 3 years ago

Hi @AleksandrRogov We have also experienced this ourselves when switching from v1.0.440 to v1.0.640. For now our fix has been to specify the filtering attributes as "" (empty string)