Skip to content
Open
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
4 changes: 2 additions & 2 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ This project includes several key products and libraries that facilitate SQL Ser
## 🛠️ Key Features
- **Connectivity to SQL Server**: Provides robust and secure connections to SQL Server databases, using various authentication methods, such as Windows Authentication, SQL Server Authentication, and Entra ID authentication, e.g. `ActiveDirectoryIntegrated`, `ActiveDirectoryPassword`, `ActiveDirectoryServicePrincipal`,`ActiveDirectoryInteractive`, `ActiveDirectoryDefault`, and `ActiveDirectoryManagedIdentity`.
- **Connection Resiliency**: Implements connection resiliency features to handle transient faults and network issues, ensuring reliable database connectivity.
- **TLS Encryption**: Supports secure connections using TLS protocols to encrypt data in transit. Supports TLS 1.2 and higher, ensuring secure communication with SQL Server. Supported encryption modes are:
- **TLS Encryption**: Supports secure connections using TLS protocols to encrypt data in transit. Supports TLS 1.2 and higher, ensuring secure communication with SQL Server. Supported encryption modes are:
- **Optional**: Encryption is used if available, but not required.
- **Mandatory**: Encryption is mandatory for the connection.
- **Strict**: Enforces strict TLS requirements, ensuring only secure connections are established.
Expand Down Expand Up @@ -123,7 +123,7 @@ When a new issue is created, follow these steps:
- Ensure the PR passes all CI checks before merging.

### ✅ Closing Issues
- Add a comment summarizing the fix and referencing the PR
- Add a comment summarizing the fix and referencing the PR

### ⚙️ Automating Workflows
- Auto-label PRs based on folder paths (e.g., changes in `src/Microsoft.Data.SqlClient/src/` → `Area\SqlClient`, changes in `tests/` → `Area\Testing`) and whether they add new public APIs or introduce a breaking change.
Expand Down
2 changes: 1 addition & 1 deletion .github/instructions/ado-pipelines.instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ Key parameters:
- `runAlwaysEncryptedTests` — include AE test set; default `true`
- `runLegacySqlTests` — include SQL Server 2016/2017 manual-test legs; default `true`
- `debug` — enable debug output; default `false`
- `dotnetVerbosity` — MSBuild verbosity; default `normal`
- `dotnetVerbosity` — build verbosity; default `normal`

## Build Stage Order

Expand Down
2 changes: 1 addition & 1 deletion .github/instructions/architecture.instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ The `netcore/` and `netfx/` directories are legacy artifacts from the old dual-p
- `netcore/ref/` and `netfx/ref/` — **STILL ACTIVE**. Reference assemblies remain in these directories and define the public API surface for each target framework.

### OS Targeting with `TargetOs`
The unified project uses a `TargetOs` MSBuild property to handle OS-specific compilation:
The unified project uses a `TargetOs` build property to handle OS-specific compilation:

```xml
<!-- Automatic OS detection -->
Expand Down
23 changes: 9 additions & 14 deletions .github/instructions/testing.instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ The default test filter is defined in `build.proj` via `TestFilters`:
```xml
<TestFilters Condition="'$(TestFilters)' == ''">category!=failing&amp;category!=flaky&amp;category!=interactive</TestFilters>
```
This can be overridden via MSBuild property: `msbuild build.proj -t:TestSqlClientUnit -p:TestFilters="your_filter"`.
This can be overridden via build property: `dotnet build build.proj -t:TestSqlClientUnit -p:TestFilters="your_filter"`.

### Test Attributes
```csharp
Expand All @@ -139,19 +139,19 @@ public void TestIntermittentlyFails() { ... }

## Running Tests

### Using MSBuild (Recommended)
### Using `build.proj` targets (Recommended)
```bash
# Build and run all unit tests
msbuild build.proj -t:TestSqlClientUnit
dotnet build build.proj -t:TestSqlClientUnit

# Run functional tests only
msbuild build.proj -t:TestSqlClientFunctional
dotnet build build.proj -t:TestSqlClientFunctional

# Run manual tests for specific framework
msbuild build.proj -t:TestSqlClientManual -p:TestFramework=net8.0
dotnet build build.proj -t:TestSqlClientManual -p:TestFramework=net8.0

# Run specific test set
msbuild build.proj -t:TestSqlClientManual -p:TestSet=1
dotnet build build.proj -t:TestSqlClientManual -p:TestSet=1
```

### Using dotnet CLI
Expand Down Expand Up @@ -325,7 +325,7 @@ AssertExtensions.ThrowsContains<SqlException>(() => action(), "expected message"

### Running with Coverage
```bash
msbuild build.proj -t:TestSqlClientUnit -p:TestCodeCoverage=true
dotnet build build.proj -t:TestSqlClientUnit -p:TestCodeCoverage=true
```

### Coverage Targets
Expand All @@ -335,16 +335,11 @@ msbuild build.proj -t:TestSqlClientUnit -p:TestCodeCoverage=true

## Debugging Tests

### Visual Studio
### IDE
1. Set breakpoints in test code
2. Right-click test → Debug Test
2. Right-click test → Debug Test (or use CodeLens "Debug Test" link)
3. Use Test Explorer for navigation

### VS Code
1. Configure C# extension
2. Use CodeLens "Debug Test" link
3. Attach to test process

### Command Line
```bash
# Enable verbose output
Expand Down
12 changes: 6 additions & 6 deletions .github/plans/apicompat-ref-assembly-validation.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ The comparison uses `Microsoft.DotNet.ApiCompat.Tool` in **strict mode**, which
## Usage

```
dotnet msbuild build.proj /t:CompareRefAssemblies /p:BaselinePackageVersion=6.1.4
dotnet build build.proj /t:CompareMdsRefAssemblies /p:BaselinePackageVersion=6.1.4
```
Comment thread
paulmedynski marked this conversation as resolved.

- `BaselinePackageVersion` is **required** (no default). The user must specify which published package to compare against.
Expand All @@ -22,7 +22,7 @@ dotnet msbuild build.proj /t:CompareRefAssemblies /p:BaselinePackageVersion=6.1.

Add an entry for version `9.0.200` alongside the existing `dotnet-coverage` entry. This enables `dotnet apicompat` after `dotnet tool restore`.

### 2. Create `tools/targets/CompareRefAssemblies.targets`
### 2. Create `tools/targets/CompareMdsRefAssemblies.targets`

A single new file containing all properties, items, and targets (steps 3–11 below). Follows the naming convention of existing files like `GenerateMdsPackage.targets`.

Expand Down Expand Up @@ -85,7 +85,7 @@ Runs `<Exec Command="dotnet tool restore" WorkingDirectory="$(RepoRoot)" />`.
- Preceded by `<Message Importance="high">` labelling each comparison
- Uses item metadata to map `net462` to `$(LegacyNetFxRefDir)` and others to `$(LegacyNetCoreRefDir)`

### 11. `CompareRefAssemblies` target (public entry point)
### 11. `CompareMdsRefAssemblies` target (public entry point)

- Declared with `DependsOnTargets="_RunRefApiCompat"`
- Emits a final `<Message>` summarizing completion
Expand All @@ -95,12 +95,12 @@ Runs `<Exec Command="dotnet tool restore" WorkingDirectory="$(RepoRoot)" />`.
Add one line after the existing `.targets` imports (after line 7):

```xml
<Import Project="$(ToolsDir)targets\CompareRefAssemblies.targets" />
<Import Project="$(ToolsDir)targets\CompareMdsRefAssemblies.targets" />
```

## Design Decisions

- **Single new file** at `tools/targets/CompareRefAssemblies.targets` — only one `<Import>` line added to `build.proj`.
- **Single new file** at `tools/targets/CompareMdsRefAssemblies.targets` — only one `<Import>` line added to `build.proj`.
- **Internal targets prefixed with `_`** to signal they're not intended to be called directly.
- **Strict mode** ensures API additions are also flagged — important for detecting accidental public surface changes during file reorganization.
- **`ContinueOnError="ErrorAndContinue"`** on each apicompat `Exec` so all 8 comparisons run and all differences are reported together.
Expand All @@ -111,7 +111,7 @@ Add one line after the existing `.targets` imports (after line 7):
## Verification

```
dotnet msbuild build.proj /t:CompareRefAssemblies /p:BaselinePackageVersion=6.1.4
dotnet build build.proj /t:CompareMdsRefAssemblies /p:BaselinePackageVersion=6.1.4
```

- Downloads 6.1.4 nupkg, builds both ref project variants, runs 8 comparisons (4 TFMs × 2 variants).
Expand Down
89 changes: 54 additions & 35 deletions BUILDGUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ contained within this repository.
## Prerequisites

### .NET SDK

Projects in this repository require the .NET SDK to be installed in order to build. For the exact version required for
building the current version, see [global.json](global.json). Downloads for .NET SDK can be found at:
https://dotnet.microsoft.com/en-us/download/dotnet
Expand All @@ -16,9 +17,11 @@ on operating systems that do not support .NET Framework. As such, it is not nece

### Miscellaneous

**Powershell** is required to run several miscellaneous tasks as part of building and packaging. On Windows systems,
no action is required. On Linux and MacOS systems, the `pwsh` command is required to be in the `$PATH` environment
variable. For specific instructions see: [Install PowerShell](https://learn.microsoft.com/en-us/powershell/scripting/install/install-powershell)
**Powershell** is required to run several miscellaneous tasks as part of building and packaging. On
Windows systems, either the built-in `powershell.exe` will be used, or if installed, the modern
`pwsh` will be used. On Linux and MacOS systems, the `pwsh` command is required to be in the `$PATH`
environment variable. For specific instructions see: [Install
PowerShell](https://learn.microsoft.com/en-us/powershell/scripting/install/install-powershell)

The **NuGet** binary is required to package the Microsoft.Data.SqlClient project. For convenience, this can be be done
via the PowerShell script [tools/scripts/downloadLatestNuget.ps1](tools/scripts/downloadLatestNuget.ps1), however, any
Expand All @@ -45,12 +48,22 @@ package the project. The `build.proj` file provides convenient targets to accomp

### Building Projects

From the root of your repository, run `msbuild` against `build.proj` with a build target, following this pattern:
From the root of your repository, run `dotnet build` against `build.proj` with a build target, following this pattern:

```bash
dotnet build build.proj -t:<build_target> [optional_parameters]
```

Since `build.proj` is the only project file in the repo root, it can be omitted when building from
the root:

```bash
msbuild build.proj -t:<build_target> [optional_parameters]
dotnet build -t:<build_target> [optional_parameters]
```

The command-line examples below will assume that `build.proj` is selected by default and will omit
it from the `dotnet build` command.

The following build targets can be used to build the following projects. All targets will implicitly build any other
projects they depend on.

Expand Down Expand Up @@ -87,28 +100,28 @@ placed in `artifacts/Microsoft.Data.SqlClient.ref/Project-<configuration>/<tfm>`

Build all projects:
```bash
msbuild build.proj -t:Build
dotnet build -t:Build
```

Build Microsoft.Data.SqlClient in Release configuration:
```bash
msbuild build.proj -t:BuildSqlClient -p:Configuration=Release
dotnet build -t:BuildSqlClient -p:Configuration=Release
```

Build v1.2.3 of Microsoft.Data.SqlClient.Extensions.Abstractions:
```bash
msbuild build.proj -t:BuildAbstractions -p:PackageVersion=1.2.3
dotnet build -t:BuildAbstractions -p:PackageVersion=1.2.3
```

### Testing Projects

This section provides a summary and brief example of how to execute tests for projects in this repository. **For more
information about test procedures, including config file setup, see [TESTGUIDE.md](TESTGUIDE.md).**

From the root of your repository, run `msbuild` against `build.proj` with a test target, following this pattern:
From the root of your repository, run `dotnet build` against `build.proj` with a test target, following this pattern:

```bash
msbuild build.proj -t:<test_target> [optional_parameters]
dotnet build -t:<test_target> [optional_parameters]
```

| `<test_target>` | Description |
Expand Down Expand Up @@ -140,37 +153,37 @@ A selection of parameters for test targets in `build.proj` relevant to common de
Run Microsoft.Data.SqlClient unit tests:

```bash
msbuild build.proj -t:TestSqlClientUnit
dotnet build -t:TestSqlClientUnit
```

Run Microsoft.Data.SqlClient manual test set 2:
```bash
msbuild build.proj -t:TestSqlClientManual -p:TestSet=2
dotnet build -t:TestSqlClientManual -p:TestSet=2
```

Run Microsoft.Data.SqlClient functional tests against x86 dotnet:
```bash
msbuild build.proj -t:TestSqlClientFunctional -p:DotnetPath='C:\path\to\dotnet\x86\'
dotnet build -t:TestSqlClientFunctional -p:DotnetPath='C:\path\to\dotnet\x86\'
```

Run all Microsoft.Data.SqlClient.Extensions.Azure unit tests, including interactive, but excluding failing tests:
```bash
msbuild build.proj -t:TestAzure -p:TestFilters=category!=failing
dotnet build -t:TestAzure -p:TestFilters=category!=failing
```

Run Microsoft.Data.SqlClient functional tests against net8.0 runtime:
```bash
msbuild build.proj -t:TestSqlClientFunctional -p:TestFramework=net8.0
dotnet build -t:TestSqlClientFunctional -p:TestFramework=net8.0
```

### Packaging Projects

Just like bulding and testing the various projects in this repository, packaging the projects into NuGet packages is
also handle by `build.proj`. From the root of your repository, run `msbuild` against `build.proj` with a test target,
Just like building and testing the various projects in this repository, packaging the projects into NuGet packages is
also handled by `build.proj`. From the root of your repository, run `dotnet build` against `build.proj` with a test target,
following this pattern:

```bash
msbuild build.proj -t:<pack_target> [optional_parameters]
dotnet build -t:<pack_target> [optional_parameters]
```

| `<build_target>` | Desription |
Expand Down Expand Up @@ -198,23 +211,27 @@ A selection of parameters for pack targets in `build.proj` relevant to common de
#### Examples

Package Microsoft.Data.SqlClient.Internal.Logging into a NuGet package:

```bash
msbuild build.proj -t:PackLogging
dotnet build -t:PackLogging
```

Package Microsoft.Data.SqlClient if `nuget.exe` is not in the `$PATH` environment variable:

```bash
msbuild build.proj -t:PackSqlClient -p:NugetPath="C:\my\nuget.exe"
dotnet build -t:PackSqlClient -p:NugetPath="C:\my\nuget.exe"
```

Package version 1.2.3 of Microsoft.Data.SqlClient.Extensions.Abstractions:

```bash
msbuild build.proj -t:PackAbstractions -p:PackageVersionAbstractions=1.2.3
dotnet build -t:PackAbstractions -p:PackageVersionAbstractions=1.2.3
```

Package version Microsoft.Data.SqlClient.Extensions.Azure without building it beforehand:

```bash
msbuild build.proj -t:PackAzure -p:PackBuild=false
dotnet build -t:PackAzure -p:PackBuild=false
```

## Versioning
Expand Down Expand Up @@ -274,21 +291,28 @@ run subsequent `build.proj` targets against them.
Build Microsoft.Data.SqlClient version 7.1.1 that references Microsoft.Data.SqlClient.Extensions.Abstractions v1.0.1
and Microsoft.Data.SqlClient.Internal.Logging v2.2.2.

Build v2.2.2 of Logging and copy to packages:

```bash
# Build v2.2.2 of Logging and copy to packages
msbuild build.proj -t:PackLogging \
dotnet build -t:PackLogging \
-p:ReferenceType=Package \
-p:PackageVersionLogging=2.2.2
cp artifacts/Microsoft.Data.SqlClient.Internal.Logging/Debug/*.*pkg packages/
```

# Build v1.0.1 of Abstractions that depends on v2.2.2 of Logging
msbuild build.proj -t:PackAbstractions \
Build v1.0.1 of Abstractions that depends on v2.2.2 of Logging:

```bash
dotnet build -t:PackAbstractions \
-p:ReferenceType=Package \
-p:PackageVersionAbstractions=1.0.1 \
-p:PackageVersionLogging=2.2.2 \
-p:PackageVersionLogging=2.2.2
cp artifacts/Microsoft.Data.SqlClient.Extensions.Abstractions/Package-Debug/*.*pkg packages/
```

Build SqlClient:

# Build SqlClient
```bash
msbuild -t:PackSqlClient \
Comment thread
paulmedynski marked this conversation as resolved.
-p:ReferenceType=Package \
-p:PackageVersionSqlClient=7.1.1 \
Expand All @@ -298,22 +322,17 @@ cp artifacts/Microsoft.Data.SqlClient/Package-Debug/*.*pkg packages/
```

Run Microsoft.Data.SqlClient functional tests against the versions build above:

```bash
msbuild build.proj -t:TestSqlClientFunctional \
dotnet build -t:TestSqlClientFunctional \
-p:ReferenceType=Package \
-p:PackageVersionSqlClient=7.1.1 \
-p:PackageVersionAbstractions=1.0.1 \
-p:PackageVersionLogging=2.2.2
```

----


Manual test prerequisites and configuration are covered in [TESTGUIDE.md](TESTGUIDE.md#manual-test-prerequisites).


---

## Using Managed SNI on Windows

Managed SNI can be enabled on Windows by enabling the below AppContext switch:
Expand Down
Loading
Loading