delegateas/Daxif

[Plugin Sync] Failed to fetch custom api configuration from assembly since v5.3.*

Opened this issue · 3 comments

Describe the bug
Sinc DAXIF v5.3.0 and up I can't synchronize my plugin(s), I'm now getting an exception about custom api. My C# project and the solution in Dynamics doesn't have any Customer API (but it has an endpoint to Azure ServiceBus), so I don't know where this error is suddenly coming from and/or how to solve this.

I went back to v.5.2.0 and with that version I can deploy!

If you need more info to help with this bug, please let me know.

To Reproduce
Steps to reproduce the behavior:

  1. Call DG.Daxif.Plugin.Sync from DAXIF 5.3.0 and up
  2. Fails with to error in the logging below.

I got the following logging/stacktrace:

(2022-05-22 10:17:19Z) [Info]: Environment: "Source" (Some https://XXX.crm4.dynamics.com/)
(2022-05-22 10:17:19Z) [Info]: DAXIF# v.1.0.0.0
(2022-05-22 10:17:19Z) [Info]: Action: Plugin synchronization
(2022-05-22 10:17:19Z) [Info]: Comparing plugins registered in CRM versus those found in your local code
(2022-05-22 10:17:19Z) [Verbose]: Connection timeout set to 0 hour, 59 minutes, 0 seconds
(2022-05-22 10:17:19Z) [Verbose]: Loading local assembly and it's plugins
10:17:19 [ERR] Target PushCustomizations has thrown an exception
System.Exception: Failed to fetch custom api configuration from assembly. This error can be caused if an old version of CustomAPI.cs is used.\nFull Exception: The input array was empty.
Parameter name: array
   at Microsoft.FSharp.Core.PrintfModule.PrintFormatToStringThenFail@1439.Invoke(String message)
   at DG.Daxif.Modules.Plugin.PluginDetection.getCustomAPIsFromAssembly(Assembly asm)
   at DG.Daxif.Modules.Plugin.PluginDetection.getAssemblyContextFromDll(String projectPath, String dllPath, AssemblyIsolationMode isolationMode, Boolean ignoreOutdatedAssembly)
   at DG.Daxif.Modules.Plugin.MainHelper.loadAndValidateAssembly(IOrganizationService proxy, String projectPath, String dllPath, AssemblyIsolationMode isolationMode, Boolean ignoreOutdatedAssembly)
   at DG.Daxif.Modules.Plugin.MainHelper.analyze[a](FSharpFunc`2 proxyGen, String projectPath, String dllPath, String solutionName, AssemblyIsolationMode isolationMode, Boolean ignoreOutdatedAssembly)
   at DG.Daxif.Modules.Plugin.Main.syncSolution[a](FSharpFunc`2 proxyGen, String projectPath, String dllPath, String solutionName, AssemblyIsolationMode isolationMode, Boolean ignoreOutdatedAssembly, Boolean dryRun)
   at DG.Daxif.Plugin.Sync(Environment env, String assemblyPath, String projectPath, String solutionName, FSharpOption`1 dryRun, FSharpOption`1 isolationMode, FSharpOption`1 ignoreOutdatedAssembly, FSharpOption`1 logLevel
)
   at Build.<get_PushCustomizations>b__40_3() in C:\Users\XXX\build\Build.cs:line 180
   at Nuke.Common.Utilities.Collections.EnumerableExtensions.ForEach[T](IEnumerable`1 enumerable, Action`1 action)
   at Nuke.Common.Execution.BuildExecutor.Execute(NukeBuild build, ExecutableTarget target, IReadOnlyCollection`1 previouslyExecutedTargets, Boolean failureMode)

Expected behavior
I expect plugin dll to be deployed and plugin steps to be registered.

Environment

  • CRM/D365/CDS version: Online 9.2.22044.142
  • Tool version: 5.3.0 and up
  • Other applicable environments

Additional context
To be clear call DAXIF from C# using NUKE BUILD, like this:

    Target PushCustomizations => _ => _
        .Requires(() => SourceUrl != null)
        .Requires(() => Authentication)
        .DependsOn(Compile)
        .Executes(() =>
        {
            Log.Information("Sync Plugins");
            DG.Daxif.Plugin.Sync(
                env: SourceEnvironment,
                assemblyPath: SourceDirectory / "Plugins" / "bin" / Configuration / "net462" / $"{SolutionInfo.baseNamespace}.Plugins.dll",
                projectPath: SourceDirectory / "Plugins" / "Plugins.csproj",
                solutionName: SolutionInfo.name,
                dryRun: false,
                isolationMode: null,
                ignoreOutdatedAssembly: null,
                logLevel: null);
        }

Thank you for reporting the issue.

We are experiencing multiple issues with versions 5.3.0 and 5.3.1, and have therefore decided to deprecate those versions of the nuget package.

For now we recommend using 5.2.0.

@RemyDuijkeren : Please try again with latest 5.5.1.
CustomAPIs have been improved in this version as well as several other enhancements and bugfixes.

Let us know if the latest version works for you and then we may close this issue.

5.5.1 is working now for me 👌

Thanks!