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 to .NET 10 #1121

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
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
2 changes: 1 addition & 1 deletion .vsconfig
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"components": [
"Microsoft.VisualStudio.Component.CoreEditor",
"Microsoft.VisualStudio.Workload.CoreEditor",
"Microsoft.NetCore.Component.Runtime.9.0",
"Microsoft.NetCore.Component.Runtime.10.0",
"Microsoft.NetCore.Component.SDK",
"Microsoft.VisualStudio.Component.Roslyn.Compiler",
"Microsoft.VisualStudio.Component.Roslyn.LanguageServices"
Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -248,3 +248,10 @@ Added overloads to support specifying the name of the Initial Catalog using the
`netstandard2.0`/`net6.0` and `5.1.5` for `net8.0` to include fixes for
[CVE-2024-0056](https://github.com/advisories/GHSA-98g6-xh36-x2p7).
* Use interop methods that are compatible with .NET native AoT.

## SqlLocalDb v4.0.0

### Changes

* Drop support for `net6.0`.
* Add support for `net10.0`.
6 changes: 4 additions & 2 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,14 @@
<EnableNETAnalyzers>true</EnableNETAnalyzers>
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
<GenerateDocumentationFile>false</GenerateDocumentationFile>
<GenerateGitMetadata Condition=" '$(CI)' != '' and '$(GenerateGitMetadata)' == '' ">true</GenerateGitMetadata>
<GenerateGitMetadata Condition=" '$(CI)' != '' AND '$(GenerateGitMetadata)' == '' ">true</GenerateGitMetadata>
<ImplicitUsings>enable</ImplicitUsings>
<LangVersion>latest</LangVersion>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
<NeutralLanguage>en-US</NeutralLanguage>
<NuGetAuditMode>direct</NuGetAuditMode>
<!-- TODO Remove once .NET 10 is stable -->
<NoWarn>$(NoWarn);NU5104</NoWarn>
<Nullable>enable</Nullable>
<PackageIcon>package-icon.png</PackageIcon>
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
Expand All @@ -48,7 +50,7 @@
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<UseArtifactsOutput>true</UseArtifactsOutput>
<VersionPrefix>3.4.1</VersionPrefix>
<VersionPrefix>4.0.0</VersionPrefix>
</PropertyGroup>
<PropertyGroup Condition=" '$(GITHUB_ACTIONS)' != '' AND '$(DEPENDABOT_JOB_ID)' == '' ">
<VersionSuffix Condition=" '$(VersionSuffix)' == '' AND '$(GITHUB_HEAD_REF)' == '' ">beta.$(GITHUB_RUN_NUMBER)</VersionSuffix>
Expand Down
10 changes: 5 additions & 5 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@
<PackageVersion Include="Humanizer" Version="2.14.1" />
<PackageVersion Include="MartinCostello.Logging.XUnit.v3" Version="0.5.1" />
<PackageVersion Include="Microsoft.CodeAnalysis.PublicApiAnalyzers" Version="3.3.4" />
<PackageVersion Include="Microsoft.Data.SqlClient" Version="5.2.2" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.SqlServer" Version="9.0.2" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="9.0.2" />
<PackageVersion Include="Microsoft.Data.SqlClient" Version="6.0.1" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.SqlServer" Version="10.0.0-preview.1.25081.1" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="10.0.0-preview.1.25080.5" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="9.0.2" />
<PackageVersion Include="Microsoft.Extensions.Logging" Version="9.0.2" />
<PackageVersion Include="Microsoft.Extensions.Logging" Version="10.0.0-preview.1.25080.5" />
<PackageVersion Include="Microsoft.Extensions.Logging.Abstractions" Version="9.0.2" />
<PackageVersion Include="Microsoft.Extensions.Logging.Console" Version="9.0.0" />
<PackageVersion Include="Microsoft.Extensions.Logging.Console" Version="10.0.0-preview.1.25080.5" />
<PackageVersion Include="Microsoft.Extensions.TimeProvider.Testing" Version="9.2.0" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.13.0" />
<PackageVersion Include="Microsoft.Win32.Registry" Version="4.7.0" />
Expand Down
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"sdk": {
"version": "9.0.200",
"version": "10.0.100-preview.1.25120.13",
"allowPrerelease": false,
"rollForward": "latestMajor"
}
Expand Down
2 changes: 1 addition & 1 deletion package-readme.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# SQL LocalDB Wrapper

SQL LocalDB Wrapper is a .NET library providing interop with the [Microsoft SQL Server LocalDB](https://docs.microsoft.com/en-us/sql/relational-databases/express-localdb-instance-apis/sql-server-express-localdb-reference-instance-apis?view=sql-server-2017 "SQL Server Express LocalDB Reference - Instance APIs") Instance API from managed code using .NET APIs. The library targets `netstandard2.0`, `net6.0` and `net8.0`.
SQL LocalDB Wrapper is a .NET library providing interop with the [Microsoft SQL Server LocalDB](https://docs.microsoft.com/en-us/sql/relational-databases/express-localdb-instance-apis/sql-server-express-localdb-reference-instance-apis?view=sql-server-2017 "SQL Server Express LocalDB Reference - Instance APIs") Instance API from managed code using .NET APIs. The library targets `netstandard2.0`, `net8.0` and `net10.0`.

[![NuGet](https://img.shields.io/nuget/v/MartinCostello.SqlLocalDb?logo=nuget&label=Latest&color=blue)](https://www.nuget.org/packages/MartinCostello.SqlLocalDb "Download MartinCostello.SqlLocalDb from NuGet")
[![NuGet Downloads](https://img.shields.io/nuget/dt/MartinCostello.SqlLocalDb?logo=nuget&label=Downloads&color=blue)](https://www.nuget.org/packages/MartinCostello.SqlLocalDb "Download MartinCostello.SqlLocalDb from NuGet")
Expand Down
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# SQL LocalDB Wrapper

SQL LocalDB Wrapper is a .NET library providing interop with the [Microsoft SQL Server LocalDB](https://docs.microsoft.com/en-us/sql/relational-databases/express-localdb-instance-apis/sql-server-express-localdb-reference-instance-apis?view=sql-server-2017 "SQL Server Express LocalDB Reference - Instance APIs") Instance API from managed code using .NET APIs. The library targets `netstandard2.0`, `net6.0` and `net8.0`.
SQL LocalDB Wrapper is a .NET library providing interop with the [Microsoft SQL Server LocalDB](https://docs.microsoft.com/en-us/sql/relational-databases/express-localdb-instance-apis/sql-server-express-localdb-reference-instance-apis?view=sql-server-2017 "SQL Server Express LocalDB Reference - Instance APIs") Instance API from managed code using .NET APIs. The library targets `netstandard2.0`, `net8.0` and `net10.0`.

[![NuGet](https://img.shields.io/nuget/v/MartinCostello.SqlLocalDb?logo=nuget&label=Latest&color=blue)](https://www.nuget.org/packages/MartinCostello.SqlLocalDb "Download MartinCostello.SqlLocalDb from NuGet")
[![NuGet Downloads](https://img.shields.io/nuget/dt/MartinCostello.SqlLocalDb?logo=nuget&label=Downloads&color=blue)](https://www.nuget.org/packages/MartinCostello.SqlLocalDb "Download MartinCostello.SqlLocalDb from NuGet")
Expand Down
2 changes: 1 addition & 1 deletion samples/TodoApp.Tests/TodoApp.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<IsPackable>false</IsPackable>
<NoWarn>$(NoWarn);CA1303;CA1707;CA2007;SA1600</NoWarn>
<RootNamespace>TodoApp</RootNamespace>
<TargetFramework>net9.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>
<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion samples/TodoApp/TodoApp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<IsPackable>false</IsPackable>
<NoWarn>$(NoWarn);CA1062;CA1303;CA1822;CA2007;CA2227;SA1516;SA1600</NoWarn>
<RootNamespace>TodoApp</RootNamespace>
<TargetFramework>net9.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Humanizer" />
Expand Down
10 changes: 10 additions & 0 deletions src/SqlLocalDb/CompatibilitySuppressions.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<Suppressions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Suppression>
<DiagnosticId>CP0008</DiagnosticId>
<Target>T:MartinCostello.SqlLocalDb.StopInstanceOptions</Target>
<Left>lib/net6.0/MartinCostello.SqlLocalDb.dll</Left>
<Right>lib/netstandard2.0/MartinCostello.SqlLocalDb.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
</Suppressions>
12 changes: 10 additions & 2 deletions src/SqlLocalDb/Interop/LocalDbInstanceApi.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
// Copyright (c) Martin Costello, 2012-2018. All rights reserved.
// Copyright (c) Martin Costello, 2012-2018. All rights reserved.
// Licensed under the Apache 2.0 license. See the LICENSE file in the project root for full license information.

using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Text;
using Microsoft.Extensions.Logging;

#if NET10_0_OR_GREATER
using Lock = System.Threading.Lock;
#else
using Lock = object;
#endif

namespace MartinCostello.SqlLocalDb.Interop;

/// <summary>
Expand Down Expand Up @@ -45,10 +51,12 @@ internal sealed class LocalDbInstanceApi : IDisposable
private static readonly char[] _nullArray = ['\0'];
#endif

#pragma warning disable SA1121
/// <summary>
/// Synchronization object to protect loading the native library and its functions. This field is read-only.
/// </summary>
private readonly object _syncRoot = new();
private readonly Lock _syncRoot = new();
#pragma warning restore SA1121

/// <summary>
/// Whether the instance has been disposed of.
Expand Down
13 changes: 7 additions & 6 deletions src/SqlLocalDb/MartinCostello.SqlLocalDb.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<PackageValidationBaselineVersion>3.4.0</PackageValidationBaselineVersion>
<RootNamespace>MartinCostello.SqlLocalDb</RootNamespace>
<Summary>$(Description)</Summary>
<TargetFrameworks>netstandard2.0;net6.0;net8.0</TargetFrameworks>
<TargetFrameworks>netstandard2.0;net8.0;net10.0</TargetFrameworks>
<Title>SQL LocalDB Wrapper</Title>
</PropertyGroup>
<PropertyGroup Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net8.0'))">
Expand Down Expand Up @@ -38,18 +38,19 @@
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" VersionOverride="2.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" VersionOverride="2.0.0" />
</ItemGroup>
<ItemGroup Condition="!$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net6.0'))">
<ItemGroup Condition="!$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net8.0'))">
<PackageReference Include="Microsoft.Win32.Registry" />
</ItemGroup>
<ItemGroup Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net6.0'))">
<PackageReference Update="Microsoft.Extensions.DependencyInjection.Abstractions" VersionOverride="6.0.0" />
<PackageReference Update="Microsoft.Extensions.Logging.Abstractions" VersionOverride="6.0.0" />
</ItemGroup>
<ItemGroup Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net8.0'))">
<PackageReference Update="Microsoft.Data.SqlClient" VersionOverride="5.1.5" />
<PackageReference Update="Microsoft.Extensions.DependencyInjection.Abstractions" VersionOverride="8.0.0" />
<PackageReference Update="Microsoft.Extensions.Logging.Abstractions" VersionOverride="8.0.0" />
</ItemGroup>
<ItemGroup Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net10.0'))">
<PackageReference Update="Microsoft.Data.SqlClient" VersionOverride="6.0.1" />
<PackageReference Update="Microsoft.Extensions.DependencyInjection.Abstractions" VersionOverride="10.0.0-preview.1.25080.5" />
<PackageReference Update="Microsoft.Extensions.Logging.Abstractions" VersionOverride="10.0.0-preview.1.25080.5" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.PublicApiAnalyzers" PrivateAssets="All" />
<AdditionalFiles Include="PublicAPI\$(TargetFramework)\PublicAPI.Shipped.txt" />
Expand Down
1 change: 1 addition & 0 deletions src/SqlLocalDb/PublicAPI/net10.0/PublicAPI.Shipped.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#nullable enable
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#nullable enable
MartinCostello.SqlLocalDb.ISqlLocalDbApi
MartinCostello.SqlLocalDb.ISqlLocalDbApi
MartinCostello.SqlLocalDb.ISqlLocalDbApi.CreateInstance(string! instanceName, string! version) -> MartinCostello.SqlLocalDb.ISqlLocalDbInstanceInfo!
MartinCostello.SqlLocalDb.ISqlLocalDbApi.DefaultInstanceName.get -> string!
MartinCostello.SqlLocalDb.ISqlLocalDbApi.DeleteInstance(string! instanceName) -> void
Expand Down Expand Up @@ -193,4 +192,4 @@ static readonly MartinCostello.SqlLocalDb.SqlLocalDbErrors.WindowsApiError -> in
static readonly MartinCostello.SqlLocalDb.SqlLocalDbErrors.XEventAssert -> int
static readonly MartinCostello.SqlLocalDb.SqlLocalDbErrors.XEventConfigFileTooLong -> int
static readonly MartinCostello.SqlLocalDb.SqlLocalDbErrors.XEventError -> int
static readonly MartinCostello.SqlLocalDb.SqlLocalDbErrors.XEventFailed -> int
static readonly MartinCostello.SqlLocalDb.SqlLocalDbErrors.XEventFailed -> int
1 change: 0 additions & 1 deletion src/SqlLocalDb/PublicAPI/net6.0/PublicAPI.Unshipped.txt

This file was deleted.

2 changes: 1 addition & 1 deletion src/TestApp/MartinCostello.SqlLocalDb.TestApp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<NoWarn>$(NoWarn);CA1031;CA2007;SA1600</NoWarn>
<OutputType>Exe</OutputType>
<RootNamespace>MartinCostello.SqlLocalDb</RootNamespace>
<TargetFramework>net9.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<Compile Update="Strings.Designer.cs" AutoGen="True" DependentUpon="Strings.resx" DesignTime="True" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<PreserveCompilationContext>true</PreserveCompilationContext>
<RootNamespace>MartinCostello.SqlLocalDb</RootNamespace>
<Summary>$(Description)</Summary>
<TargetFramework>net9.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<Content Include="xunit.runner.json" CopyToOutputDirectory="PreserveNewest" />
Expand Down