-
Notifications
You must be signed in to change notification settings - Fork 197
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
Upgrade npgsql (Postgres) to the very latest version #196
Conversation
…ion because the latest minor/patch in the current major version doesn't support CancellationToken in PrepareAsync()
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.
Open Question 1: In 78f3386, @madelson you built using the Release
configuration and there were some changes in packages.lock.json
files. This is because we have this Condition
on line 8. The is the only Condition
in Directory.Packages.props
that doesn't use TargetFramework
. Therefore, a normal build can cause a difference in packages.lock.json
files based on the Configuration
used for the build. Should we just get rid of this Condition
?
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.
Should we just get rid of this Condition?
I think this will cause other problems, unfortunately. If there was a way that we could install the analyzer every time and then use a condition to disable it for DEBUG that would be ideal
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.
@madelson I did a little more research, which suggests that my proposed solution is actually a typical practice.
https://www.nuget.org/packages/Microsoft.CodeAnalysis.PublicApiAnalyzers/#usedby-body-tab lists 5 GitHub repositories that use this NuGet package:
- https://github.com/search?q=repo%3Adotnet%2Fmaui+Microsoft.CodeAnalysis.PublicApiAnalyzers&type=code
- https://github.com/search?q=repo%3ADapperLib%2FDapper%20Microsoft.CodeAnalysis.PublicApiAnalyzers&type=code
- https://github.com/search?q=repo%3AApp-vNext%2FPolly%20Microsoft.CodeAnalysis.PublicApiAnalyzers&type=code
- https://github.com/search?q=repo%3AStackExchange%2FStackExchange.Redis%20Microsoft.CodeAnalysis.PublicApiAnalyzers&type=code
- https://github.com/search?q=repo%3AMessagePack-CSharp%2FMessagePack-CSharp%20Microsoft.CodeAnalysis.PublicApiAnalyzers&type=code
None of the top 5 has a Condition
on Configuration
(including the ItemGroup
s that contain the PackageReference
elements).
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.
Normally I'd have no issue with this in DEBUG, the problem is that this particular package does something weird in DistributedLock.Core to manage the pseudo-public dependencies (see for example this file). Because of that, if you run this analyzer in DEBUG it gets upset that those methods are not in the public API but they shouldn't be.
So this project is an atypical situation. Every project except DistributedLock.Core should be able to run this package in DEBUG with no issues.
If you're not convinced, you can try it and report back (put the package on in all configurations, then try command line and VS builds in both DEBUG and RELEASE configurations).
Like I said, one alternative would be to do the above, and then just conditionally suppress the warnings in DEBUG for DistributedLock.Core. That would be a nice solution if it can be made to work.
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.
Given that we multi-target TFMs in the test project based on Configuration
, we're bound to have some lock files changes based on Configuration
. Therefore, I think e559c5c looks best to me. With this, the only differences between dotnet build -c Release
and dotnet build -c Debug
are lock files for DistributedLock.Core
and DistributedLock.Tests
, allowing us to minimize churns.
src/Directory.Packages.props
Outdated
@@ -23,7 +23,7 @@ | |||
<PackageVersion Include="System.Threading.AccessControl" Version="5.0.0" Condition="'$(TargetFramework)' != 'net461'" /> | |||
<PackageVersion Include="ZooKeeperNetEx" Version="3.4.12.4" /> | |||
<PackageVersion Include="IsExternalInit" Version="1.0.3" /> | |||
<PackageVersion Include="Microsoft.Bcl.AsyncInterfaces" Version="5.0.0" Condition="'$(TargetFramework)' == 'netstandard2.0' OR '$(TargetFramework)' == 'net461'" /> | |||
<PackageVersion Include="Microsoft.Bcl.AsyncInterfaces" Version="8.0.0" Condition="'$(TargetFramework)' == 'netstandard2.0' OR '$(TargetFramework)' == 'net461'" /> |
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.
Open Question 2: There's this chain of transitive dependency: Npgsql
8.0.2 -> System.Text.Json
8.0.0 -> Microsoft.Bcl.AsyncInterfaces
8.0.0. However, we have Microsoft.Bcl.AsyncInterfaces
5.0.0 here, so we're getting error NU1109: Detected package downgrade: Microsoft.Bcl.AsyncInterfaces from 8.0.0 to centrally defined 5.0.0. Update the centrally managed package version to a higher version.
. Therefore, I made this change, but now we see this warning: warning : Microsoft.Bcl.AsyncInterfaces 8.0.0 doesn't support net461 and has not been tested with it. Consider upgrading your TargetFramework to net462 or later. You may also set <SuppressTfmSupportBuildWarnings>true</SuppressTfmSupportBuildWarnings> in the project file to ignore this warning and attempt to run in this unsupported configuration at your own risk. [DistributedLock\src\DistributedLock.ZooKeeper\DistributedLock.ZooKeeper.csproj::TargetFramework=net461]
This brings us back to madelson/MedallionShell#113; should we continue to support net461
and other versions which already reached end of support?
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.
Let's go to net462 throughout and see if everything is happy. My main goal is to keep supporting .NET framework for the time being, and not to drop support for specific framework versions without a reason (but this is a reason!).
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.
@madelson AppVeyor seems happy! 🎉
Note that I didn't update any versions or release notes.
@@ -18,15 +18,6 @@ | |||
"resolved": "3.3.4", | |||
"contentHash": "kNLTfXtXUWDHVt5iaPkkiPuyHYlMgLI6SOFT4w88bfeI2vqSeGgHunFkdvlaCM8RDfcY0t2+jnesQtidRJJ/DA==" | |||
}, | |||
"Microsoft.NETFramework.ReferenceAssemblies": { |
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.
This was added in 78f3386, but I'm not sure why this was a direct dependency. Maybe your VS is set up in a certain way?
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.
Yeah not sure. This came in when I built. I'm OK with some thrash here.
// Note: for now we cannot pass cancellationToken to PrepareAsync() because this will break on Postgres which | ||
// is the only db we currently support that needs Prepare currently. See https://github.com/npgsql/npgsql/issues/4209 | ||
await this.PrepareIfNeededAsync(CancellationToken.None).ConfigureAwait(false); | ||
await this.PrepareIfNeededAsync(cancellationToken).ConfigureAwait(false); |
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.
This is the only code change. I didn't add any comments because this is the expected behavior and the original behavior was an exception.
@@ -53,7 +53,7 @@ | |||
<ProjectReference Include="..\DistributedLock.Redis\DistributedLock.Redis.csproj" /> | |||
<ProjectReference Include="..\DistributedLock.ZooKeeper\DistributedLock.ZooKeeper.csproj" /> | |||
<ProjectReference Include="..\DistributedLock.MySql\DistributedLock.MySql.csproj" /> | |||
<ProjectReference Include="..\DistributedLock.Oracle\DistributedLock.Oracle.csproj" Condition="'$(TargetFramework)' != 'netstandard2.0' AND '$(TargetFramework)' != 'net461'" /> |
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.
TargetFrameworks
is netstandard2.0;netstandard2.1;net462 in this project and
netstandard2.1;net462in
DistributedLock.Oracle. Therefore, we only need to filter out
netstandard2.0`.
This looks good to go. By my count the only outstanding small comments are:
|
Leaving a comment so @madelson can assign me. |
Context
Per the discussion in #111, this PR upgrades
Npgsql
from 5.0.4 to 8.0.2, the latest version at the time of filing.Considerations
Breaking Changes
I don't think there are breaking changes that affect
DistributedLock
, but please take some time to go over the breaking changes:Usage of the Recent Versions
As you can see in https://www.nuget.org/packages/Npgsql/8.0.2#versions-body-tab, 8.0.0 has the most number of downloads, but both 8.0.1 and 8.0.2 have over a million downloads. Given that these are bug patches, I think 8.0.2 is better than the previous 8.0.* versions.
Open Questions