Skip to content
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

Update net461 TFM to net462 #1275

Merged
merged 3 commits into from
Jan 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net461;netstandard2.0</TargetFrameworks>
<TargetFrameworks>net462;netstandard2.0</TargetFrameworks>
<Title>MySqlConnector Ed25519 Authentication Plugin</Title>
<Description>Implements the client_ed25519 authentication plugin for MariaDB.</Description>
<Copyright>Copyright 2019–2022 Bradley Grainger</Copyright>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="6.0.3" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="7.0.0" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net461;netstandard2.0</TargetFrameworks>
<TargetFrameworks>net462;netstandard2.0</TargetFrameworks>
<Title>MySqlConnector Logging Adapter for NLog</Title>
<Description>Writes lightly-structured MySqlConnector logging output to NLog.</Description>
<Copyright>Copyright 2018–2022 Bradley Grainger</Copyright>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net461;netstandard2.0</TargetFrameworks>
<TargetFrameworks>net462;netstandard2.0</TargetFrameworks>
<Title>MySqlConnector Logging Adapter for Serilog</Title>
<Description>Writes lightly-structured MySqlConnector logging output to Serilog.</Description>
<Copyright>Copyright 2017–2022 Bradley Grainger</Copyright>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net461;netstandard2.0</TargetFrameworks>
<TargetFrameworks>net462;netstandard2.0</TargetFrameworks>
<Title>MySqlConnector Logging Adapter for log4net</Title>
<Description>Writes MySqlConnector logging output to log4net with one line of code.</Description>
<Copyright>Copyright 2017–2022 Bradley Grainger</Copyright>
Expand Down
15 changes: 14 additions & 1 deletion src/MySqlConnector/CompatibilitySuppressions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,24 @@
<Left>lib/net461/MySqlConnector.dll</Left>
<Right>lib/net471/MySqlConnector.dll</Right>
</Suppression>
<Suppression>
<DiagnosticId>CP0001</DiagnosticId>
<Target>T:System.Data.Common.DbColumn</Target>
<Left>lib/net461/MySqlConnector.dll</Left>
<Right>lib/netstandard2.0/MySqlConnector.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0001</DiagnosticId>
<Target>T:System.Data.Common.DbColumn</Target>
<Left>lib/net462/MySqlConnector.dll</Left>
<Right>lib/net471/MySqlConnector.dll</Right>
</Suppression>
<Suppression>
<DiagnosticId>CP0008</DiagnosticId>
<Target>T:MySqlConnector.MySqlDataReader</Target>
<Left>lib/netstandard2.0/MySqlConnector.dll</Left>
<Right>lib/net461/MySqlConnector.dll</Right>
<Right>lib/net462/MySqlConnector.dll</Right>
</Suppression>
<Suppression>
<DiagnosticId>PKV006</DiagnosticId>
Expand Down
2 changes: 1 addition & 1 deletion src/MySqlConnector/Core/ServerSession.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1597,7 +1597,7 @@ X509CertificateCollection LoadCertificate(string sslKeyFile, string sslCertifica
}
rsa.ImportParameters(rsaParameters);

#if NET461 || NET471
#if NET462 || NET471
var certificate = new X509Certificate2(sslCertificateFile, "", X509KeyStorageFlags.MachineKeySet)
{
PrivateKey = rsa,
Expand Down
4 changes: 3 additions & 1 deletion src/MySqlConnector/Logging/MySqlConnectorLogManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ private sealed class MySqlConnectorLogger : ILogger
public MySqlConnectorLogger(IMySqlConnectorLogger logger) =>
m_logger = logger;

public IDisposable BeginScope<TState>(TState state) => throw new NotSupportedException();
public IDisposable BeginScope<TState>(TState state)
where TState : notnull
=> throw new NotSupportedException();

public bool IsEnabled(LogLevel logLevel) => m_logger.IsEnabled(ConvertLogLevel(logLevel));

Expand Down
12 changes: 6 additions & 6 deletions src/MySqlConnector/MySqlConnector.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net461;net471;netstandard2.0;netstandard2.1;net6.0;net7.0</TargetFrameworks>
<TargetFrameworks>net462;net471;netstandard2.0;netstandard2.1;net6.0;net7.0</TargetFrameworks>
<Description>A truly async MySQL ADO.NET provider, supporting MySQL Server, MariaDB, Percona Server, Amazon Aurora, Azure Database for MySQL and more.</Description>
<Copyright>Copyright 2016–2022 Bradley Grainger</Copyright>
<Authors>Bradley Grainger</Authors>
Expand All @@ -16,23 +16,23 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="6.0.3" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="7.0.0" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net461' OR '$(TargetFramework)' == 'net471' ">
<ItemGroup Condition=" '$(TargetFramework)' == 'net462' OR '$(TargetFramework)' == 'net471' ">
<Reference Include="System.Transactions" />
<Using Remove="System.Net.Http" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net461' OR '$(TargetFramework)' == 'net471' OR '$(TargetFramework)' == 'netstandard2.0' ">
<ItemGroup Condition=" '$(TargetFramework)' == 'net462' OR '$(TargetFramework)' == 'net471' OR '$(TargetFramework)' == 'netstandard2.0' ">
<PackageReference Include="IndexRange" Version="1.0.2" PrivateAssets="All" />
<PackageReference Include="System.Buffers" Version="4.5.1" />
<PackageReference Include="System.Memory" Version="4.5.5" />
<PackageReference Include="System.Threading.Tasks.Extensions" Version="4.5.4" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net461' OR '$(TargetFramework)' == 'net471' OR '$(TargetFramework)' == 'netstandard2.0' OR '$(TargetFramework)' == 'netstandard2.1' ">
<PackageReference Include="System.Diagnostics.DiagnosticSource" Version="6.0.0" />
<ItemGroup Condition=" '$(TargetFramework)' == 'net462' OR '$(TargetFramework)' == 'net471' OR '$(TargetFramework)' == 'netstandard2.0' OR '$(TargetFramework)' == 'netstandard2.1' ">

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: it looks like you only want to bring this in for non .NETCoreApp. You can achieve that via the following condition:

'$(TargetFrameworkIdentifier)' != '.NETCoreApp'. That avoids the hardcoded tfms.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

2733cd2

<PackageReference Include="System.Diagnostics.DiagnosticSource" Version="7.0.0" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/MySqlConnector/MySqlDataReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace MySqlConnector;

#pragma warning disable CA1010 // Generic interface should also be implemented

#if NET461
#if NET462
public sealed class MySqlDataReader : DbDataReader
#else
public sealed class MySqlDataReader : DbDataReader, IDbColumnSchemaGenerator
Expand Down
2 changes: 1 addition & 1 deletion src/MySqlConnector/Shims/DbColumn.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#if NET461
#if NET462
#pragma warning disable CA1716 // Don't use reserved language keywords
namespace System.Data.Common;

Expand Down
2 changes: 1 addition & 1 deletion src/MySqlConnector/Utilities/NullableAttributes.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Supports using nullable attributes on older frameworks.
// Copied from https://github.com/dotnet/corefx/blob/master/src/Common/src/CoreLib/System/Diagnostics/CodeAnalysis/NullableAttributes.cs

#if NET461 || NET471 || NETSTANDARD2_0 || NETCOREAPP2_1
#if NET462 || NET471 || NETSTANDARD2_0 || NETCOREAPP2_1
namespace System.Diagnostics.CodeAnalysis;

/// <summary>Specifies that null is allowed as an input even if the corresponding type disallows it.</summary>
Expand Down
6 changes: 3 additions & 3 deletions src/MySqlConnector/Utilities/Utility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,7 @@ public static void SwapBytes(byte[] bytes, int offset1, int offset2)
bytes[offset2] = swap;
}

#if NET461
#if NET462
public static bool IsWindows() => Environment.OSVersion.Platform == PlatformID.Win32NT;

public static void GetOSDetails(out string? os, out string osDescription, out string architecture)
Expand Down Expand Up @@ -557,13 +557,13 @@ public static void GetOSDetails(out string? os, out string osDescription, out st
}
#endif

#if NET461
#if NET462
public static SslProtocols GetDefaultSslProtocols()
{
if (!s_defaultSslProtocols.HasValue)
{
// Prior to .NET Framework 4.7, SslProtocols.None is not a valid argument to SslStream.AuthenticateAsClientAsync.
// If the NET461 build is loaded by an application that targets .NET 4.7 (or later), or if app.config has set
// If the NET462 build is loaded by an application that targets .NET 4.7 (or later), or if app.config has set
// Switch.System.Net.DontEnableSystemDefaultTlsVersions to false, then SslProtocols.None will work; otherwise,
// if the application targets .NET 4.6.2 or earlier and hasn't changed the AppContext switch, then it will
// fail at runtime. We attempt to determine if it will fail by accessing the internal static
Expand Down