-
Notifications
You must be signed in to change notification settings - Fork 293
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
Add | Adding Net6 support and dropping netcoreapp3.1 #1704
Conversation
.../AzureKeyVaultProvider/Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider.csproj
Outdated
Show resolved
Hide resolved
Fingers crossed this gets in soon! |
I will do my best to add net6 to our pipelines to see if the tests are passing fine. |
Codecov ReportBase: 71.49% // Head: 65.38% // Decreases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## main #1704 +/- ##
==========================================
- Coverage 71.49% 65.38% -6.11%
==========================================
Files 290 290
Lines 61109 61236 +127
==========================================
- Hits 43692 40042 -3650
- Misses 17417 21194 +3777
Flags with carried forward coverage won't be shown. Click here to find out more.
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
<dependency id="System.Text.Encoding.CodePages" version="6.0.0" exclude="Compile" /> | ||
<dependency id="System.Text.Encodings.Web" version="6.0.0" /> | ||
<dependency id="System.Resources.ResourceManager" version="4.3.0" /> | ||
<dependency id="System.Security.Cryptography.Cng" version="5.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.
Please reflect dependency version updates in this file, for all groups.
tools/specs/add-ons/Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider.nuspec
Outdated
Show resolved
Hide resolved
src/Microsoft.Data.SqlClient/src/Microsoft/Data/Common/AdapterUtil.Windows.cs
Outdated
Show resolved
Hide resolved
@@ -140,6 +140,8 @@ dotnet_diagnostic.CA1063.severity = silent | |||
# CA2100: Review SQL queries for security vulnerabilities | |||
dotnet_diagnostic.CA2100.severity = silent | |||
|
|||
dotnet_diagnostic.CA1416.severity = silent |
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.
.NET 5.0 added new attributes, SupportedOSPlatformAttribute and UnsupportedOSPlatformAttribute, to annotate platform-specific APIs. Both attributes can be instantiated with or without version numbers as part of the platform name. They can also be applied multiple times with different platforms. However, SqlClient currently is following a different structure for adding related files for different platforms.
src/Microsoft.Data.SqlClient/netcore/ref/Microsoft.Data.SqlClient.cs
Outdated
Show resolved
Hide resolved
#elif NETCOREAPP | ||
public override void Rollback(string transactionName) | ||
#endif | ||
{ } |
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.
after net5.0 System.Data.Common.DbTransaction
added Rollback(string)
and Save(string)
. NetStandard
does not support that change.
</PropertyGroup> | ||
<PropertyGroup Condition="'$(TargetGroup)' == 'netstandard'"> | ||
<DefineConstants>$(DefineConstants);NETSTANDARD;</DefineConstants> | ||
</PropertyGroup> |
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.
using bult-in constants instead of creating new ones.
#else | ||
keySizeInBytes= RSAPublicKey.KeySize / 8; | ||
#endif | ||
|
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.
PublicKey.Key is obsolete. Currently GetRSAPublicKey is being used but using DSAKey might be added in future.
src/Microsoft.Data.SqlClient/src/Microsoft/Data/Common/AdapterUtil.Windows.cs
Outdated
Show resolved
Hide resolved
@@ -223,7 +223,7 @@ public static void Test_WithDecimalValue_ShouldReturnDecimal() | |||
var cmd = new SqlCommand("select @foo", conn); | |||
cmd.Parameters.AddWithValue("@foo", new SqlDecimal(0.5)); | |||
var result = (decimal)cmd.ExecuteScalar(); | |||
Assert.Equal(result, (decimal)0.5); | |||
Assert.Equal((decimal)0.5, result); |
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.
upgrading xunit to 2.4.2 discovered these mistakes. expected values needs to be the first and actual value has to come second.
@@ -1,7 +1,7 @@ | |||
<Project Sdk="Microsoft.NET.Sdk"> | |||
<PropertyGroup> | |||
<OutputType>Exe</OutputType> | |||
<TargetFrameworks>netcoreapp3.1;net5.0</TargetFrameworks> | |||
<TargetFrameworks>net6.0</TargetFrameworks> |
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 could be changed to <TargetFramework>
and it will eliminate the need to specifying framework on build time on test pipelines.
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.
using TargetFramework would mean that we don't build this for netfx, is that correct? and if so is it not being needed for netfx intentional?
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.
Correct, This is for tests builds on Unix,. Currently when you try to build the database for the test suit, Northwind, you need to run this project by specifying the dotnet run -f net6.0
, by doing so the need to specifying the TFM in dotnet command goes away.
@@ -48,7 +48,7 @@ | |||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="$(MicrosoftNETTestSdkVersion)" /> | |||
<PackageReference Include="System.Runtime.InteropServices.RuntimeInformation" Version="$(SystemRuntimeInteropServicesRuntimeInformationVersion)" /> | |||
<PackageReference Include="xunit" Version="$(XunitVersion)" /> | |||
<PackageReference Include="xunit.runner.visualstudio" Version="$(XunitVersion)" /> | |||
<PackageReference Include="xunit.runner.visualstudio" Version="$(xunitrunnervisualstudioVersion)" /> |
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.
xunit.runner.visualstudio
now has a different version than xunit itself.
@@ -3,7 +3,7 @@ | |||
<PropertyGroup Condition="'$(GeneratePlatformNotSupportedAssembly)' == 'true' OR '$(GeneratePlatformNotSupportedAssemblyMessage)' != ''"> | |||
<!-- Tell ResolveMatchingContract to run and resolve contract to project reference --> | |||
<ResolveMatchingContract>true</ResolveMatchingContract> | |||
<NotSupportedSourceFile>$(IntermediateOutputPath)$(AssemblyName).notsupported.cs</NotSupportedSourceFile> | |||
<NotSupportedSourceFile>$(IntermediateOutputPath)\$(TargetFramework)\$(AssemblyName).notsupported.cs</NotSupportedSourceFile> |
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.
Since System.Data.Common.DbTransaction
is changed for net5 by adding RollBack(string)
and Save(string)
we cannot have one file for netcore and netstandard. It will complain that there is no suitable method to be overridden for netstandard. Taking the notsupported file inside each framework solves that issue. I would appreciate all other ideas regarding the impact of this change.
@cheenamalhotra @David-Engel
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.
One notsupported.cs file for each build target is the safe way to do this.
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 may not be understanding the problem, but in Npgsql this is just a tiny #ifdef:
#if NET5_0_OR_GREATER
public override void Save(string name)
#else
public void Save(string name)
#endif
{
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.
@roji I noticed I did not provide more input on the question. As you have mentioned we have done the same in the code. The problem/question starts when generating notsupported files using GenAPI. Previously there was one Microsoft.Data.SqlClient.notSupported file for netcore and netstandards and one for netfx. By this change GenAPI complains that there is no suitable method to override for these 2 methods. I made the pattern so each TFM gets a not supported
file and I was wondering if that will cause some issues in future.
LGTM |
228 changed files?? |
Looks good to me in general. It's a complex set of changes so I'm sure we'll find runtime things that need to be fixed once we've got this merged but i think we just need to get on and track those down as we find them. |
that was a mistake I did while addressing some conflicts. The PR has been opened for a very long time and there were several conflicts. I had to force push a new clone to fix that issue. it is 38 files. |
@JRahnama yeah. I realised. Looking forward to getting this in so work on DateOnly and TimeOnly can get done before EF Core 8. |
If you want to do Date and Time i'll work on SqlBatch |
@Wraith2 Sure, willing to give it a try. |
Yay! |
Amazing! |
I think a reference got missed somewhere around the functional tests. If I try to build locally I get this:
build script i use is
|
Interesting. Can you try building the test with -p:TF=net6.0 or as you have been doing /p:TF=net6.0 instead of TargetNetCoreVersion to see if that solves the issue? |
Using TF works for netfx. for net6.0 it seems to mostly work but then can't find the output functional tests.
|
@Wraith2 I was not able to reproduce the issue you mentioned, and pipelines are working well. I saw that error while I was working on the pipeline. It was because TargetGroup was not defined properly. Can you make a fresh clone and test the scenario again please? |
This PR is ready for review. The tests are passing on a parallel pipeline built for net6.
There are two major changes in this PR:
I have left comments inside the changes wherever I was not sure, or change needed some explanation.