Sharpcompress – library version conflict

I use in my project Sharpcompress library to extract files from RAR.
The process was okay until recently, I suspect the update to 2019.10 version caused this.

I use Invoice Code to extract files:
image

and it fails with following error:
Invoke Code: Method ‘UiPathCodeRunner_bd84b7993e7d4c0a96e9ac23305e77c7.Run’ not found.

When loading the project in Studio I am getting following warning:
NU3034: Package ‘SharpCompress 0.22.0’ from source ‘https://www.nuget.org/api/v2’: This package is signed but not by a trusted signer.

I tried to reinstall the Sharpcompress package and now I have the package in error
image

After package reinstall I could run this process from Studio but when I attempt to run it unattended it fails with same error.

I tried to revert to 2019.9.2 but the problem persists.

1 Like

I tried change the code as follows - using generic Object type and cast it to RarArchiveEntry
image

And I got following error:
RemoteException wrapping System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. —> RemoteException wrapping System.InvalidCastException: [A]SharpCompress.Archives.Rar.RarArchiveEntry cannot be cast to [B]SharpCompress.Archives.Rar.RarArchiveEntry. Type A originates from ‘SharpCompress, Version=0.22.0.0, Culture=neutral, PublicKeyToken=afb0a02973931d96’ in the context ‘LoadFrom’ at location ‘C:\Users\svc_rpa01.nuget\packages\sharpcompress\0.22.0\lib\net45\SharpCompress.dll’. Type B originates from ‘SharpCompress, Version=0.22.0.0, Culture=neutral, PublicKeyToken=afb0a02973931d96’ in the context ‘Default’ at location ‘c:\ProgramData\svc_rpa01\UiPath\app-19.8.0\SharpCompress.dll’.
at UiPathCodeRunner_3c908eeedd454b93a7063182f647cb59.Run(Object item, String strOutputFolder)

This implies that there is conflict between two instances of SharpCompress.dll

Anybody knows how to resolve this?

@loginerror @Pablito
Gents, could you advise?

Thx

Hi @J0ska

Could you make sure that your Robot service is running on the latest 2019.10 version?

It looks like it is trying to fetch the file from the directory of the previous version:
c:\ProgramData\svc_rpa01\UiPath\app-19.8.0\SharpCompress.dll

Are you by chance using Studio CE with Robot service converted to machine wide service?
If so, it did not auto-update on your unattended machine which is what is most likely causing the issue.

It is a wild guess though, as that trick is not documented (but I think I recall you trying to do it some time ago :slight_smile: )

My suggestion here would be to first make sure all services and both Studio/Robot run with the latest 2019.10 stable version.

Well, the robot is running 19.8 CE both Studio and UiPath.Service.Host. Still there is this error.

On my workstation I have 19.10 CE - it auto updated and I did not realized it is updated as there is no notification about update :frowning: . Seems the problem started once I deployed to robot updated process (updated in 19.10 CE). Strange thing is that after restoring to previous version the problems still persists.

On my workstation (v19.10 CE) process works okay when launched from Studio but fails with same error when launched from Agent :frowning:

The only way to get rid of this problem is remove SharpCompress from Dependencies but keep it in Imports.

I would expect that process and robot should not interfere and use own set of libraries, right?

Cheers

I think for the first scenario (running 19.10 process on 19.8) it is expected to not work (you can’t rely on an older robot to run process created in new versions).

The other thing, that the process works from Studio but not from the Agent. This might be due to the package files being a bit corrupted.
Could you try clearing these locations to let Studio / Robot to re-download the packages again?

%userprofile%\.nuget\packages\
%userprofile%\AppData\Local\UiPath
and any from C:\ProgramData\UiPath\

Of course feel free to make backups first :slight_smile:

Lastly:

as there is no notification about update

It is something we will try to improve in the future :slight_smile:

Returning to this topic after some time… This seems to be some glitch in Package Manager

I found on another test machine that SharpCompress installed without any error:
image

While on my machine the error persists:

image

Both use current version 19.10.1

But the difference is in spelling. So I overwrote the name in project.json from “sharpcompress” to “SharpCompress” and voila! Problem solved.

Obviously after removing/adding the package the same problem appears so it seems that Package Manager takes it from some cache…

Below adding Studio log

11/18/2019 17:24:30 => [Debug] Restoring packages for .NETFramework,Version=v4.6.1...
11/18/2019 17:24:30 => [Info]   GET https://www.myget.org/F/workflow/FindPackagesById()?id='sharpcompress'&semVerLevel=2.0.0
11/18/2019 17:24:30 => [Info]   GET https://gallery.uipath.com/api/v2/FindPackagesById()?id='sharpcompress'&semVerLevel=2.0.0
11/18/2019 17:24:30 => [Info]   GET https://www.nuget.org/api/v2/FindPackagesById()?id='sharpcompress'&semVerLevel=2.0.0
11/18/2019 17:24:31 => [Info]   OK https://www.myget.org/F/workflow/FindPackagesById()?id='sharpcompress'&semVerLevel=2.0.0 538ms
11/18/2019 17:24:31 => [Info]   CACHE https://www.myget.org/F/workflow/FindPackagesById()?id='sharpcompress'&semVerLevel=2.0.0
11/18/2019 17:24:31 => [Info]   OK https://www.nuget.org/api/v2/FindPackagesById()?id='sharpcompress'&semVerLevel=2.0.0 841ms
11/18/2019 17:24:32 => [Info]   CACHE https://www.nuget.org/api/v2/FindPackagesById()?id='sharpcompress'&semVerLevel=2.0.0
11/18/2019 17:24:32 => [Info]   GET https://www.nuget.org/api/v2/package/sharpcompress/0.24.0
11/18/2019 17:24:32 => [Info]   OK https://gallery.uipath.com/api/v2/FindPackagesById()?id='sharpcompress'&semVerLevel=2.0.0 1471ms
11/18/2019 17:24:32 => [Info]   OK https://www.nuget.org/api/v2/package/sharpcompress/0.24.0 389ms
11/18/2019 17:24:32 => [Info]   CACHE https://gallery.uipath.com/api/v2/FindPackagesById()?id='sharpcompress'&semVerLevel=2.0.0
11/18/2019 17:24:32 => [Debug] Resolving conflicts for .NETFramework,Version=v4.6.1...
11/18/2019 17:24:32 => [Debug] Acquiring lock for the installation of SharpCompress 0.24.0
11/18/2019 17:24:32 => [Debug] Acquired lock for the installation of SharpCompress 0.24.0
11/18/2019 17:24:32 => [Info] Installing SharpCompress 0.24.0.
11/18/2019 17:24:33 => [Debug] PackageSignatureVerificationLog: PackageIdentity: SharpCompress.0.24.0 Source: https://www.nuget.org/api/v2 PackageSignatureValidity: True
11/18/2019 17:24:33 => [Warning] NU3034: Package 'SharpCompress 0.24.0' from source 'https://www.nuget.org/api/v2': This package is signed but not by a trusted signer.
11/18/2019 17:24:34 => [Debug] Completed installation of SharpCompress 0.24.0

Cheers

Hi @J0ska

It can clear these folders to reduce that possibility:

%userprofile%\.nuget\packages
%userprofile%\AppData\Local\UiPath\.cache

Trying to extract a .tar file I found that I need that library to be used. How did you downloaded it?

From nuget.org, you need to define it in package sources in Package Manager

image

Note there are several “SharpCompress” libraries. I use this one
image

Cheers

1 Like