Skip to content

Commit 0d864f4

Browse files
committed
Fix bug caused by System.Threading.Tasks v4.7.1
Unfortunately `System.Threading.Tasks` v4.7.1 is broken. Its package manifest states that it depends on `System.Threading.Tasks.Extensions` >= v4.5.4 (assembly version v4.2.0.1); however, for some reason it actually requests v4.2.0.0. While neither OmniSharp nor PowerShell Editor Services, the downstream library where this bug appeared, ship that version of the library, it can sometimes be found in the Global Assembly Cache on Windows. When present (due to an installation by some other program), it gets loaded, and then other dependencies (correctly) request v4.2.0.1 which also gets loaded. When both are loaded, a `System.MissingMethodException` is thrown! Specifically the method `ChannelReader.ReadAsync` (from `System.Threading.Tasks`) on the type `Tasks.ValueTask` (provided by `System.Threading.Tasks.Extensions`) can no longer be resolved. I do not know enough about the intricacies of method/type resolution in the full .NET Framework as to explain precisely why the presence of v4.2.0.0 causes this resolution to fail, but it certainly does. Upgrading `System.Threading.Tasks` to v6.0.0 is confirmed to solve the problem, since the newer package correctly requests `System.Threading.Tasks.Extensions` v4.2.0.1.
1 parent ce5dadc commit 0d864f4

File tree

3 files changed

+2
-3
lines changed

3 files changed

+2
-3
lines changed

.build/.build.csproj

-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
<PackageReference Include="JetBrains.ReSharper.CommandLineTools" ExcludeAssets="All" />
1515
<PackageReference Include="GitVersion.Tool" ExcludeAssets="All" />
1616
<PackageReference Include="ReportGenerator" ExcludeAssets="All" />
17-
<PackageReference Include="JetBrains.ReSharper.CommandLineTools" ExcludeAssets="All" />
1817
<PackageReference Include="Rocket.Surgery.Nuke" />
1918
</ItemGroup>
2019

Directory.Packages.props

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
<PackageVersion Include="coverlet.msbuild" Version="3.1.2" />
5050
<PackageVersion Include="System.Reactive" Version="5.0.0" />
5151
<PackageVersion Include="System.Collections.Immutable" Version="5.0.0" />
52-
<PackageVersion Include="System.Threading.Channels" Version="4.7.1" />
52+
<PackageVersion Include="System.Threading.Channels" Version="6.0.0" />
5353
<PackageVersion Include="Microsoft.Reactive.Testing" Version="5.0.0" />
5454
<PackageVersion Include="MediatR" Version="8.1.0" />
5555
<PackageVersion Include="Bogus" Version="34.0.2" />

sample/SampleServer/SampleServer.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
<ItemGroup>
1212
<ProjectReference Include="../../src/Server/Server.csproj" />
13-
<PackageReference Include="Microsoft.Extensions.Logging" VersionOverride="3.0.0" />
13+
<PackageReference Include="Microsoft.Extensions.Logging" VersionOverride="6.0.0" />
1414
<PackageReference Include="Serilog.Extensions.Logging" VersionOverride="3.1.0" />
1515
<PackageReference Include="Serilog.Sinks.File" VersionOverride="5.0.0" />
1616
<PackageReference Include="Serilog.Sinks.Debug" VersionOverride="2.0.0" />

0 commit comments

Comments
 (0)