scottdurow / SparkleXrm

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

Nullable object must have a value error #454

Open bwmodular opened 2 years ago

bwmodular commented 2 years ago

Hi, running instrument-plugin-code.bat on an environment which I've not run it against for a long time and I'm getting a 'Nullable object must have a value' error.

spkl v1.0.640 Dynamics 365 online 2022 release wave 1

Here are the logs: Downloading Plugin/Workflow Activity Metadata Searching for classes in 'C:\blah\Plugins\spkl..' Found Plugin Type Registration blah.Plugins.AccountPlugin Found Plugin Type Registration blah.Plugins.Account_CreateTMExtractRecord The application terminated with an error. Nullable object must have a value. at System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource resource) at SparkleXrm.Tasks.DownloadPluginMetadataTask.AddPluginAttributes(OrganizationServiceContext ctx, CodeParser parser, String pluginType) at SparkleXrm.Tasks.DownloadPluginMetadataTask.ExecuteInternal(String filePath, 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

I have run deploy-plugins.bat previously and that works ok.

Any ideas what might be causing this?

I can't see any issue with the plugin/step that it seems to be failing on.

Thanks as ever....

scottdurow commented 2 years ago

I'll take a look into this!

ALRobilliard commented 2 years ago

I can't figure out why, but it's something to do with the Async/Sync mode of the step. I'm getting the same error as @bwmodular when instrumenting async plugins, but it works fine with sync.

To progress I'm:

  1. Converting all my async plugin steps to sync
  2. Running instrument-plugin-code.bat
  3. Updating the generated CrmPluginRegistration back from sync to async
  4. Run deploy-plugins.bat to fix all the steps in my environment
samalex1701 commented 1 year ago

I'm getting the same error. VS 2019 with spkl Task Runner v1.0.640.1. I've tested both with On Prem CRM v8.2.28.11 and Online v9.2.22071.176 both with same results. As @ALRobilliard suggested I can change already deployed plugins to Synchronous and the Instrument-plugin-code.bat runs, but being set to Async gives the error. Thus far I've had mixed results deploying plugins set to Sync or ASync, but it seems to work with the online 9.2 more consistently.

Downloading Plugin/Workflow Activity Metadata Searching for classes in 'C:\Users*\source\repos*\spkl..' Found Plugin Type Registration The application terminated with an error. Nullable object must have a value. at System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource resource) at SparkleXrm.Tasks.DownloadPluginMetadataTask.AddPluginAttributes(OrganizationServiceContext ctx, CodeParser parser, String pluginType) at SparkleXrm.Tasks.DownloadPluginMetadataTask.ExecuteInternal(String filePath, 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