Closed bhaskarsoni-ai closed 6 months ago
Hi @bhaskarsoni-ai can you try installing System.Threading.Tasks.Extensions (= 4.5.2). Basically, that's the one direct dependency of System.Threading.Channels as per https://www.nuget.org/packages/System.Threading.Channels/4.6.0#dependencies-body-tab. Also, I am skeptical about nuget package manager in your system, since it's not installing dependents for given packages.
Also you can try editing your csproj
file for assembly binding as per https://learn.microsoft.com/en-us/dotnet/framework/configure-apps/redirect-assembly-versions
If issue still persists, it will be useful if you can post steps to reproduce above issue !
@sacOO7 Steps to reproduce are very simple. You create a .net framework 4.7.2 project. Use ably nuget package and try to create the AblyRealTime instance. The exception is thrown.
We have tried this on multiple machines and it seems not to be a nuget package manager issue. We also using multiple nuget packages on same environment and we didn't face any such issues with other nuget packages.
Of course we can use this workaround https://learn.microsoft.com/en-us/dotnet/framework/configure-apps/redirect-assembly-versions. But we have other nuget packages which might using different versions of System.Threading.Tasks.Extensions (= 4.5.2) and i suspect it might start giving errors somewhere else.
@bhaskarsoni-ai understood. We will take a look at it and will post an update once we are able to reproduce it from our side.
Meanwhile you might like to take a look at https://nickcraver.com/blog/2020/02/11/binding-redirects/
I strongly believe this is caused by other transitive dependencies in the project. So, using proper binding-redirects
should be a viable fix for now. Hopefully, this is addressed in the future versions of dotnet-framework
.
@bhaskarsoni-ai let me know if the fix is working for you. Just to be sure, you can try installing ably-dotnet
in a plain netframework project where there are no transient dependency conflicts.
Found one more useful link if you are interested -> https://davidsekar.com/asp-net/fixing-assembly-redirects-issue-quickly#!#google_vignette
@sacOO7 Thanks for sharing the link and multiple solutions. Ours wrapper on Ably will be a standalone class library where Assembly redirect will difficult to use, as Assembly redirect can only be added inside App.Config. In a standalone library we don't have a app.config file.
Okay, one final solution I can suggest is to add reference DLL's
as a part of the project. You can follow https://stackoverflow.com/a/50716032. We are doing the same in case of unity
-> https://github.com/ably/ably-dotnet/tree/main/unity/Assets/Ably/Plugins. You can see 3 different DLLs present
Nuget
, ideally shouldn't generate conflicts. If there are conflict warnings, you should disable them. So, at runtime right version of assembly is resolved. Note - Being a netframework project, I am skeptical about not being able to add assembly redirects. I think you should be able to add it via some different configuration ( maybe editing .csproj or .sln file etc ). Also, since you are publishing it as a library, you might have to add those redirects in the project where it's being used. e.g. test netframework project
@sacOO7 Please suggest what specific version of the dll I should be referring, suggested by you above
You should visit https://www.nuget.org/packages/ably.io/1.2.15#dependencies-body-tab. under dependencies tab, you should be able to see the dependency with respective version. You need to download that dependency and use dll for the same. Also, you can click on the dependency to find out it's dependency, download it again till you finally download compiler.unsafe dll
@bhaskarsoni-ai let me know if the mentioned fix is working for you !
Hi @sacOO7 We are in the process of verifying the fix by using the workaround suggested. Will update once done.
Found one more useful article you might like to take a look at https://learn.microsoft.com/en-us/dotnet/framework/deployment/how-the-runtime-locates-assemblies?source=recommendations. It does mention various methods to add support for assembly redirects.
Hi @bhaskarsoni-ai do we have any update on the above?
With using Assembly redirect we are not seeing any issues for now. Will keep you posted if something new observed @sacOO7
Thanks for the update @bhaskarsoni-ai . I will be closing this issue for now. You can open a new issue in the future if needed !
I am receiving following error when tried to use Ably NuGet package 1.2.14 with a .NET Framework 4.7.2 project.
Could not load file or assembly 'System.Threading.Channels, Version=4.0.1.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The system cannot find the file specified. Please see following image.
After a discussion with Ably Support team, the recommendation was to add a nuget reference of System.Threading.Channels=4.6.0 Even though we are getting following exception
Could not load file or assembly 'System.Threading.Tasks.Extensions, Version=4.2.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
┆Issue is synchronized with this Jira Task by Unito