-
Notifications
You must be signed in to change notification settings - Fork 105
Fix bug caused by System.Threading.Tasks
v4.7.1
#892
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix bug caused by System.Threading.Tasks
v4.7.1
#892
Conversation
@@ -14,7 +14,6 @@ | |||
<PackageReference Include="JetBrains.ReSharper.CommandLineTools" ExcludeAssets="All" /> | |||
<PackageReference Include="GitVersion.Tool" ExcludeAssets="All" /> | |||
<PackageReference Include="ReportGenerator" ExcludeAssets="All" /> | |||
<PackageReference Include="JetBrains.ReSharper.CommandLineTools" ExcludeAssets="All" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed this because it was a duplicate line and the build tools complained about it. (See line 14.)
@@ -10,7 +10,7 @@ | |||
|
|||
<ItemGroup> | |||
<ProjectReference Include="../../src/Server/Server.csproj" /> | |||
<PackageReference Include="Microsoft.Extensions.Logging" VersionOverride="3.0.0" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The sample project was failing to restore because its dependencies updated to 6.0.0, but it was not.
…ence This line was a duplicate and the build tools complained about it.
In order to allow it to restore since this dependency was updated upstream, and that was causing it to fail to restore due to the detected forced downgrade.
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.
0d864f4
to
6c695e3
Compare
@david-driscoll I split the changes into three commits in case you decide to release v0.19.6 with just a backported patch, since I'm not sure how ready it is for a full release. |
I've also confirmed with @prpercival that the dev build I produced with the updated O# package fixed the issue on their machine too 😄 |
@david-driscoll the bot added the "mysterious" label and that is so freaking apt! |
Unfortunately
System.Threading.Tasks
v4.7.1 is broken. Its package manifest states that it depends onSystem.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, aSystem.MissingMethodException
is thrown! Specifically the methodChannelReader.ReadAsync
(fromSystem.Threading.Tasks
) on the typeTasks.ValueTask
(provided bySystem.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. UpgradingSystem.Threading.Tasks
to v6.0.0 is confirmed to solve the problem, since the newer package correctly requestsSystem.Threading.Tasks.Extensions
v4.2.0.1.I tested this and it sure seems to fix PowerShell/vscode-powershell#4175.