Home > Forum > Plugins > Plugin error: Could not load file or assembly ... because of wrong version

Plugin error: Could not load file or assembly ... because of wrong version
0

MVP

Hi everyone,

there's something I really don't understand.
I'm currently using BPSExt-Signing-DocuSign extension
https://github.com/WEBCON-BPS/BPSExt-Signing-DocuSign/releases/tag/2022.1

When I clone the branch and build it, the build folder contains another (older) "System.ComponentModel.Annotations.dll" assembly than the release.
The reason for this is, that the plugin action CheckAllDocumentsStatus, which should be run in a cyclical action, fails due to an exception

Could not load file or assembly 'System.ComponentModel.Annotations.dll, Version=4.2.0.0, ...

The plugin uses the version 4.2.1.0, so I can understand why this fails. But I what don't understand is what artifact requires a 4.2.0.0 version.
I searched all .json, .config and .txt files in the directories WEBCON BPS Designer Studio, WEBCON BPS Portal and WEBCON BPS WorkFlow Service
The only hits for the filename I got were in the Portal directory. Which is of no importance as the cyclical action is run by the Workflow Service.

I also made sure that no other plugins in any content database used this file with another version. There was actually only this plugin which used the file
SELECT
[PLF_FullName]
,[PLF_Guid]
,[PLF_Extension]
,[PLF_PLPID]
FROM [DEV01_BPS_Content].[dbo].[PluginFiles]
where PLF_FullName like '%Annotation%'

I'm really lost here because I have no idea:
- Why an older version is requested,
- How I should know this in advance, up to now I added all assemblies to the plugin.zip which are not already "used" by the workflow service and bps portal.
- Get the assembly of the required version and assume that using another version will actually work. After all the plugin was not build with this version.

The other actions I tested so far worked fine, but than these are executed in the Portal process.

Best regards,
Daniel

WEBCON

Hello Daniel

We reproduced the reported problem.
The error is due to an incorrectly created nuget package for DocuSing:
- The file docusing.esign.dll (version 5.9.0) was built with a reference to System.ComponentModel.Annotations.dll version 4.2.0
- The DocuSing nuget package in version 5.9 has a dependency on the System.ComponentModel.Annotations nuget package in version 4.5
- System.ComponentModel.Annotations nuget package version 4.5 contains System.ComponentModel.Annotations.dll version 4.2.1

In Visual Studio, the DocuSing 5.9 nuget package and dependent packages are loaded:
System.ComponentModel.Annotations package in version 4.5 containing System.ComponentModel.Annotations.dll version 4.2.1 (this is why there is version 4.2.1 in the build output and the plugins zip file)

When running the code in the BPS Service (running in the .net framework), docusing.esign.dll version 5.9 and its dependent dlls are loaded. One of them is System.ComponentModel.Annotations.dll version 4.2.0 - thats the dll loading error :)
The solution is to manually add System.ComponentModel.Annotations.dll version 4.2.0 to the plugins package.


In the BPS portal, this error does not occur because the process is run in .net 6 and there is no dependent dll versioning check

MVP
In reply to: Tomasz Batko

Hello Daniel

We reproduced the reported problem.
The error is due to an incorrectly created nuget package for DocuSing:
- The file docusing.esign.dll (version 5.9.0) was built with a reference to System.ComponentModel.Annotations.dll version 4.2.0
- The DocuSing nuget package in version 5.9 has a dependency on the System.ComponentModel.Annotations nuget package in version 4.5
- System.ComponentModel.Annotations nuget package version 4.5 contains System.ComponentModel.Annotations.dll version 4.2.1

In Visual Studio, the DocuSing 5.9 nuget package and dependent packages are loaded:
System.ComponentModel.Annotations package in version 4.5 containing System.ComponentModel.Annotations.dll version 4.2.1 (this is why there is version 4.2.1 in the build output and the plugins zip file)

When running the code in the BPS Service (running in the .net framework), docusing.esign.dll version 5.9 and its dependent dlls are loaded. One of them is System.ComponentModel.Annotations.dll version 4.2.0 - thats the dll loading error :)
The solution is to manually add System.ComponentModel.Annotations.dll version 4.2.0 to the plugins package.


In the BPS portal, this error does not occur because the process is run in .net 6 and there is no dependent dll versioning check

Hi Tomasz,

thanks for the explanation. :)

This seems also to be true for DocuSign 6.2.

I'm really glad that most of the time there's no need to work / create plugins. :)

For anyone else who searches the forum:
The cyclical action shows the last error, in my case this was
The type initializer for 'System.IdentityModel.Tokens.Jwt.JsonExtensions'

You can find more information in the plugin log of the action itself.
The type initializer for 'System.IdentityModel.Tokens.Jwt.JsonExtensions' threw an exception. ---> System.IO.FileLoadException: Could not load file or assembly 'Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies.


Best regards,
Daniel