Conflicting dependency with System.Threading.Tasks.Extensions causes MissingMethodException
- Dominant language
- C#
- Stars
- 7.2k
- Forks
- 798
- PR merge metrics
- No merged PRs in 30d
Description
#### Bug
> Which library version?
5.0.0
> What are the platform(s), environment(s) and related component version(s)?
Windows, .NET Framework
> What is the use case or problem?
If I refererence System.Linq.Async package version 5.0.0, it references Microsoft.Bcl.AsyncInterfaces package version 1.1.0. However, Microsoft.Bcl.AsyncInterfaces 1.1.0 references System.Threading.Tasks.Extensions 4.5.2. But System.Linq.Async 5.0.0 somehow references System.Threading.Tasks.Extensions 4.5.4.

But Microsoft.Bcl.AsyncInterfaces has a runtime dependency on System.Threading.Tasks.Extensions 4.2.0.0

When you have an EXE that loads a DLL as a plug-in, meaning it has no compile time dependency, you get a MissingMethodException if your DLL is referencing Microsoft.Bcl.AsyncInterfaces and doesn't have binding redirects.
```
MissingMethodException: Method not found: 'System.Collections.Generic.IAsyncEnumerable`1 System.Linq.AsyncEnumerable.Concat(System.Collections.Generic.IAsyncEnumerable`1, System.Collections.Generic.IAsyncEnumerable`1)'
```
It looks like the dependency was already updated in https://github.com/dotnet/reactive/pull/1420 so I think we just need a new release.
> What is the expected outcome?
Dependent assemblies are loaded side-by-side, System.Linq.Async does not have conflicting dependencies
> What is the actual outcome?
MissingMethodException due to conflicting types
> What is the stacktrace of the exception(s) if any?
> Do you have a code snippet or project that reproduces the problem?
Create a console app that references Microsoft.Bcl.AsyncInterfaces 1.1.0 and has no binding redirects:
```
Exe
net472
Latest
```
Create a class library that references System.Linq.Async 5.0.0:
```
net472
latest
```
Load the class library as a plug-in and try to execute it (I'm using `IDisposable` here as just a way to simplify the plug-in interface):
```C#
Assembly assembly = Assembly.UnsafeLoadFrom(@"D:\Temp\SystemLinqAsyncTask\MyTask\bin\Debug\net472\MyTaskLibrary.dll");
IDisposable obj = assembly.CreateInstance("MyTask.MyTask") as IDisposable;
obj.Dispose();
```
The only workaround is to add binding redirects to the EXE. But if System.Linq.Async didn't have conflicting dependencies that wouldn't be needed.
```xml
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.