Skip to content

Commit

Permalink
Bump versions of maintenance-packages dependencies consumed in runtime (
Browse files Browse the repository at this point in the history
dotnet#108806)

* Bump dependency versions of packages that now ship out of maintenance-packages (preview)

- Microsoft.Bcl.HashCode
- System.Buffers
- System.Memory
- System.Threading.Tasks.Extensions
- System.Runtime.CompilerServices.Unsafe

* Workaround name conflict for MathF: See dotnet/roslyn#71442 We refer to MathF from
a comment which hits this bug problem in Roslyn where it thinks it's
ambiguous because visibility is not considered when resolving cref's in
doc comments.
* Permit maintenance-packages prebuilts
* Suppress CS0618 on site in System.Data.Common.Tests - 'Sql*' is obsolete: 'Use the Microsoft.Data.SqlClient package instead.
---------
Co-authored-by: Eric StJohn <[email protected]>
Co-authored-by: Viktor Hofer <[email protected]>
Co-authored-by: Alexander Köplinger <[email protected]>
  • Loading branch information
carlossanlop authored and mikelle-rogers committed Dec 4, 2024
1 parent 922eb28 commit d9e1e95
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 8 deletions.
13 changes: 7 additions & 6 deletions eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -111,16 +111,17 @@
<MicrosoftNETCoreILAsmVersion>10.0.0-alpha.1.24565.3</MicrosoftNETCoreILAsmVersion>
<!-- Libraries dependencies -->
<MicrosoftBclAsyncInterfacesVersion>6.0.0</MicrosoftBclAsyncInterfacesVersion>
<MicrosoftBclHashCodeVersion>1.1.1</MicrosoftBclHashCodeVersion>
<MicrosoftBclHashCodeVersion>6.0.0</MicrosoftBclHashCodeVersion>
<MicrosoftWin32RegistryVersion>5.0.0</MicrosoftWin32RegistryVersion>
<StyleCopAnalyzersVersion>1.2.0-beta.507</StyleCopAnalyzersVersion>
<SystemBuffersVersion>4.5.1</SystemBuffersVersion>
<SystemBuffersVersion>4.6.0</SystemBuffersVersion>
<SystemComponentModelAnnotationsVersion>5.0.0</SystemComponentModelAnnotationsVersion>
<SystemDataSqlClientVersion>4.8.6</SystemDataSqlClientVersion>
<SystemDataSqlClientVersion>4.9.0</SystemDataSqlClientVersion>
<SystemDrawingCommonVersion>8.0.0</SystemDrawingCommonVersion>
<SystemFormatsAsn1Version>8.0.1</SystemFormatsAsn1Version>
<SystemIOFileSystemAccessControlVersion>5.0.0</SystemIOFileSystemAccessControlVersion>
<SystemMemoryVersion>4.5.5</SystemMemoryVersion>
<SystemMemoryVersion>4.6.0</SystemMemoryVersion>
<SystemNumericsVectorsVersion>4.6.0</SystemNumericsVectorsVersion>
<SystemReflectionMetadataVersion>10.0.0-alpha.1.24565.3</SystemReflectionMetadataVersion>
<SystemReflectionMetadataLoadContextVersion>10.0.0-alpha.1.24565.3</SystemReflectionMetadataLoadContextVersion>
<SystemSecurityAccessControlVersion>6.0.0</SystemSecurityAccessControlVersion>
Expand All @@ -129,9 +130,9 @@
<SystemSecurityPrincipalWindowsVersion>5.0.0</SystemSecurityPrincipalWindowsVersion>
<SystemSecurityPermissionsVersion>7.0.0</SystemSecurityPermissionsVersion>
<SystemTextJsonVersion>10.0.0-alpha.1.24565.3</SystemTextJsonVersion>
<SystemRuntimeCompilerServicesUnsafeVersion>6.0.0</SystemRuntimeCompilerServicesUnsafeVersion>
<SystemRuntimeCompilerServicesUnsafeVersion>6.1.0</SystemRuntimeCompilerServicesUnsafeVersion>
<SystemThreadingAccessControlVersion>7.0.0</SystemThreadingAccessControlVersion>
<SystemThreadingTasksExtensionsVersion>4.5.4</SystemThreadingTasksExtensionsVersion>
<SystemThreadingTasksExtensionsVersion>4.6.0</SystemThreadingTasksExtensionsVersion>
<SystemValueTupleVersion>4.5.0</SystemValueTupleVersion>
<runtimenativeSystemIOPortsVersion>10.0.0-alpha.1.24565.3</runtimenativeSystemIOPortsVersion>
<!-- Keep toolset versions in sync with dotnet/msbuild and dotnet/sdk -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,73 +41,91 @@ public void GetFactoryNoRegistrationTest()
public void GetFactoryWithInvariantNameTest()
{
ClearRegisteredFactories();
#pragma warning disable CS0618 // 'SqlClientFactory' is obsolete: 'Use the Microsoft.Data.SqlClient package instead.
RegisterSqlClientAndTestRegistration(()=>DbProviderFactories.RegisterFactory("System.Data.SqlClient", typeof(System.Data.SqlClient.SqlClientFactory)));
DbProviderFactory factory = DbProviderFactories.GetFactory("System.Data.SqlClient");
Assert.NotNull(factory);
Assert.Equal(typeof(System.Data.SqlClient.SqlClientFactory), factory.GetType());
Assert.Equal(System.Data.SqlClient.SqlClientFactory.Instance, factory);
#pragma warning restore CS0618 // 'SqlClientFactory' is obsolete: 'Use the Microsoft.Data.SqlClient package instead.
}

[Fact]
public void GetFactoryWithDbConnectionTest()
{
ClearRegisteredFactories();
#pragma warning disable CS0618 // 'SqlClientFactory' and 'SqlConnection' are obsolete: 'Use the Microsoft.Data.SqlClient package instead.
RegisterSqlClientAndTestRegistration(()=>DbProviderFactories.RegisterFactory("System.Data.SqlClient", typeof(System.Data.SqlClient.SqlClientFactory)));
DbProviderFactory factory = DbProviderFactories.GetFactory(new System.Data.SqlClient.SqlConnection());
Assert.NotNull(factory);
Assert.Equal(typeof(System.Data.SqlClient.SqlClientFactory), factory.GetType());
Assert.Equal(System.Data.SqlClient.SqlClientFactory.Instance, factory);
#pragma warning restore CS0618 // 'SqlClientFactory' and 'SqlConnection' are obsolete: 'Use the Microsoft.Data.SqlClient package instead.
}

[Fact]
public void GetFactoryWithDataRowTest()
{
ClearRegisteredFactories();
#pragma warning disable CS0618 // 'SqlClientFactory' is obsolete: 'Use the Microsoft.Data.SqlClient package instead.
RegisterSqlClientAndTestRegistration(()=> DbProviderFactories.RegisterFactory("System.Data.SqlClient", typeof(System.Data.SqlClient.SqlClientFactory)));
#pragma warning restore CS0618 // 'SqlClientFactory' is obsolete: 'Use the Microsoft.Data.SqlClient package instead.
}

[Fact]
public void RegisterFactoryWithTypeNameTest()
{
ClearRegisteredFactories();
#pragma warning disable CS0618 // 'SqlClientFactory' is obsolete: 'Use the Microsoft.Data.SqlClient package instead.
RegisterSqlClientAndTestRegistration(()=>DbProviderFactories.RegisterFactory("System.Data.SqlClient", typeof(System.Data.SqlClient.SqlClientFactory).AssemblyQualifiedName));
#pragma warning restore CS0618 // 'SqlClientFactory' is obsolete: 'Use the Microsoft.Data.SqlClient package instead.
}

[Fact]
public void RegisterFactoryWithTypeTest()
{
ClearRegisteredFactories();
#pragma warning disable CS0618 // 'SqlClientFactory' is obsolete: 'Use the Microsoft.Data.SqlClient package instead.
RegisterSqlClientAndTestRegistration(()=>DbProviderFactories.RegisterFactory("System.Data.SqlClient", typeof(System.Data.SqlClient.SqlClientFactory)));
#pragma warning restore CS0618 // 'SqlClientFactory' is obsolete: 'Use the Microsoft.Data.SqlClient package instead.
}

[Fact]
public void RegisterFactoryWithInstanceTest()
{
ClearRegisteredFactories();
#pragma warning disable CS0618 // 'SqlClientFactory' is obsolete: 'Use the Microsoft.Data.SqlClient package instead.
RegisterSqlClientAndTestRegistration(()=>DbProviderFactories.RegisterFactory("System.Data.SqlClient", System.Data.SqlClient.SqlClientFactory.Instance));
#pragma warning restore CS0618 // 'SqlClientFactory' is obsolete: 'Use the Microsoft.Data.SqlClient package instead.
}

[Fact]
public void RegisterFactoryWithWrongTypeTest()
{
ClearRegisteredFactories();
Assert.Throws<ArgumentException>(() => DbProviderFactories.GetFactory("System.Data.SqlClient"));
#pragma warning disable CS0618 // 'SqlConnection' is obsolete: 'Use the Microsoft.Data.SqlClient package instead.
Assert.Throws<ArgumentException>(() => DbProviderFactories.RegisterFactory("System.Data.SqlClient", typeof(System.Data.SqlClient.SqlConnection)));
#pragma warning restore CS0618 // 'SqlConnection' is obsolete: 'Use the Microsoft.Data.SqlClient package instead.
}

[Fact]
public void RegisterFactoryWithBadInvariantNameTest()
{
ClearRegisteredFactories();
Assert.Throws<ArgumentException>(() => DbProviderFactories.GetFactory("System.Data.SqlClient"));
#pragma warning disable CS0618 // 'SqlClientFactory' is obsolete: 'Use the Microsoft.Data.SqlClient package instead.
Assert.Throws<ArgumentException>(() => DbProviderFactories.RegisterFactory(string.Empty, typeof(System.Data.SqlClient.SqlClientFactory)));
#pragma warning restore CS0618 // 'SqlClientFactory' is obsolete: 'Use the Microsoft.Data.SqlClient package instead.
}

[Fact]
public void RegisterFactoryWithAssemblyQualifiedNameTest()
{
ClearRegisteredFactories();
#pragma warning disable CS0618 // 'SqlClientFactory' is obsolete: 'Use the Microsoft.Data.SqlClient package instead.
RegisterSqlClientAndTestRegistration(()=>DbProviderFactories.RegisterFactory("System.Data.SqlClient", typeof(System.Data.SqlClient.SqlClientFactory).AssemblyQualifiedName));
#pragma warning restore CS0618 // 'SqlClientFactory' is obsolete: 'Use the Microsoft.Data.SqlClient package instead.
}

[Fact]
Expand All @@ -118,7 +136,9 @@ public void RegisterFactoryWithWrongAssemblyQualifiedNameTest()
DataTable providerTable = DbProviderFactories.GetFactoryClasses();
Assert.Equal(0, providerTable.Rows.Count);
// register the connection type which is the wrong type. Registraton should succeed, as type registration/checking is deferred.
#pragma warning disable CS0618 // 'SqlConnection' is obsolete: 'Use the Microsoft.Data.SqlClient package instead.
DbProviderFactories.RegisterFactory("System.Data.SqlClient", typeof(System.Data.SqlClient.SqlConnection).AssemblyQualifiedName);
#pragma warning restore CS0618 // 'SqlConnection' is obsolete: 'Use the Microsoft.Data.SqlClient package instead.
providerTable = DbProviderFactories.GetFactoryClasses();
Assert.Equal(1, providerTable.Rows.Count);
// obtaining the factory will kick in the checks of the registered type name, which will cause exceptions. The checks were deferred till the GetFactory() call.
Expand All @@ -130,7 +150,9 @@ public void RegisterFactoryWithWrongAssemblyQualifiedNameTest()
public void UnregisterFactoryTest()
{
ClearRegisteredFactories();
#pragma warning disable CS0618 // 'SqlClientFactory' is obsolete: 'Use the Microsoft.Data.SqlClient package instead.
RegisterSqlClientAndTestRegistration(()=>DbProviderFactories.RegisterFactory("System.Data.SqlClient", System.Data.SqlClient.SqlClientFactory.Instance));
#pragma warning restore CS0618 // 'SqlClientFactory' is obsolete: 'Use the Microsoft.Data.SqlClient package instead.
Assert.True(DbProviderFactories.UnregisterFactory("System.Data.SqlClient"));
DataTable providerTable = DbProviderFactories.GetFactoryClasses();
Assert.Equal(0, providerTable.Rows.Count);
Expand All @@ -141,18 +163,22 @@ public void TryGetFactoryTest()
{
ClearRegisteredFactories();
Assert.False(DbProviderFactories.TryGetFactory("System.Data.SqlClient", out DbProviderFactory f));
#pragma warning disable CS0618 // 'SqlClientFactory' is obsolete: 'Use the Microsoft.Data.SqlClient package instead.
RegisterSqlClientAndTestRegistration(() => DbProviderFactories.RegisterFactory("System.Data.SqlClient", System.Data.SqlClient.SqlClientFactory.Instance));
Assert.True(DbProviderFactories.TryGetFactory("System.Data.SqlClient", out DbProviderFactory factory));
Assert.NotNull(factory);
Assert.Equal(typeof(System.Data.SqlClient.SqlClientFactory), factory.GetType());
Assert.Equal(System.Data.SqlClient.SqlClientFactory.Instance, factory);
#pragma warning restore CS0618 // 'SqlClientFactory' is obsolete: 'Use the Microsoft.Data.SqlClient package instead.
}

[Fact]
public void ReplaceFactoryWithRegisterFactoryWithTypeTest()
{
ClearRegisteredFactories();
#pragma warning disable CS0618 // 'SqlClientFactory' is obsolete: 'Use the Microsoft.Data.SqlClient package instead.
RegisterSqlClientAndTestRegistration(()=>DbProviderFactories.RegisterFactory("System.Data.SqlClient", typeof(System.Data.SqlClient.SqlClientFactory)));
#pragma warning restore CS0618 // 'SqlClientFactory' is obsolete: 'Use the Microsoft.Data.SqlClient package instead.
DbProviderFactories.RegisterFactory("System.Data.SqlClient", typeof(TestProviderFactory));
DataTable providerTable = DbProviderFactories.GetFactoryClasses();
Assert.Equal(1, providerTable.Rows.Count);
Expand All @@ -166,7 +192,9 @@ public void ReplaceFactoryWithRegisterFactoryWithTypeTest()
public void GetProviderInvariantNamesTest()
{
ClearRegisteredFactories();
#pragma warning disable CS0618 // 'SqlClientFactory' is obsolete: 'Use the Microsoft.Data.SqlClient package instead.
RegisterSqlClientAndTestRegistration(() => DbProviderFactories.RegisterFactory("System.Data.SqlClient", typeof(System.Data.SqlClient.SqlClientFactory)));
#pragma warning restore CS0618 // 'SqlClientFactory' is obsolete: 'Use the Microsoft.Data.SqlClient package instead.
DbProviderFactories.RegisterFactory("System.Data.Common.TestProvider", typeof(TestProviderFactory));
DataTable providerTable = DbProviderFactories.GetFactoryClasses();
Assert.Equal(2, providerTable.Rows.Count);
Expand Down Expand Up @@ -199,8 +227,10 @@ private void RegisterSqlClientAndTestRegistration(Action registrationFunc)
Assert.Equal(1, providerTable.Rows.Count);
DbProviderFactory factory = DbProviderFactories.GetFactory(providerTable.Rows[0]);
Assert.NotNull(factory);
#pragma warning disable CS0618 // 'SqlClientFactory' is obsolete: 'Use the Microsoft.Data.SqlClient package instead.
Assert.Equal(typeof(System.Data.SqlClient.SqlClientFactory), factory.GetType());
Assert.Equal(System.Data.SqlClient.SqlClientFactory.Instance, factory);
#pragma warning restore CS0618 // 'SqlClientFactory' is obsolete: 'Use the Microsoft.Data.SqlClient package instead.
}
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>$(NetCoreAppCurrent);$(NetCoreAppPrevious);$(NetCoreAppMinimum);netstandard2.0;$(NetFrameworkMinimum)</TargetFrameworks>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
Expand Down Expand Up @@ -146,6 +146,8 @@
<ItemGroup Condition="'$(TargetFrameworkIdentifier)' != '.NETCoreApp'">
<Compile Include="System\Numerics\Tensors\netstandard\TensorPrimitives.Single.netstandard.cs" />
<PackageReference Include="System.Memory" Version="$(SystemMemoryVersion)" />
<!-- Workaround https://github.com/dotnet/roslyn/issues/71442 by aliasing Vectors, which contains an internal MathF -->
<PackageReference Include="System.Numerics.Vectors" Version="$(SystemNumericsVectorsVersion)" Aliases="Vectors" />
<ProjectReference Include="$(LibrariesProjectRoot)Microsoft.Bcl.Numerics\src\Microsoft.Bcl.Numerics.csproj" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

extern alias Vectors;
using Vectors::System.Numerics;

using System.Diagnostics;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
Expand Down
2 changes: 1 addition & 1 deletion src/libraries/apicompat/ApiCompat.proj
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
<PackageReference Include="Microsoft.DotNet.ApiCompat.Task" Version="$(MicrosoftDotNetApiCompatTaskVersion)" IsImplicitlyDefined="true" />

<!-- Restore and reference assemblies not built in runtime anymore, required for resolving type forward on both comparison sides. -->
<ApiCompatTypeForwardDestinationPackage Include="System.Data.SqlClient" PackageVersion="$(SystemDataSqlClientVersion)" TargetFramework="netcoreapp2.1" />
<ApiCompatTypeForwardDestinationPackage Include="System.Data.SqlClient" PackageVersion="$(SystemDataSqlClientVersion)" TargetFramework="net8.0" />
<ApiCompatTypeForwardDestinationPackage Include="System.Drawing.Common" PackageVersion="$(SystemDrawingCommonVersion)" TargetFramework="net8.0" />

<!-- Restore and reference assemblies required for resolving type forwards on the baseline (left) side. -->
Expand Down

0 comments on commit d9e1e95

Please sign in to comment.