Skip to content

Conversation

@benrr101
Copy link
Contributor

@benrr101 benrr101 commented Jan 8, 2026

Description

This PR updates the Unit Test project to point at the common (merged) MDS project. There's some unconventional changes to make this work, though.

  • Unit Test project now references the common MDS csproj
  • Common MDS project updated to include strings/resx files
  • Common MDS project updated to have InternalsVisibleTo attribute
  • Unit Test project package references updated to match the common project format
  • Fixed SNI dll issues in Unit Test project by replacing copy targets with a package reference to the SNI package
    • This might not be the "right" solution (ie, it's so simple, idk why we wouldn't have tried it already)
    • I posit it's valid b/c MDS has a package reference to SNI, the version number is locked in via the central feed stuff
    • I took this approach b/c the copy targets had the build output hard-coded to include the OS in the path. The copy targets only applied to netfx, but I still needed to copy them in for netcore. For netcore, the OS will vary, and I really did not want to bring the same song and dance for OS variables into the test projects.
  • Temporarily introduce a new Test Common project that the Unit Test project references
    • This is the most controversial change, but I stress that it's temporary
    • The Test Common project maintains a reference to the MDS project, and all the test projects reference it.
    • We can't point Unit Test project at common MDS project without the Test Common project also pointin at common MDS project
    • We can't point the existing Test Common project at the common MDS project without breaking Functional/Manual tests
    • Thus, we either need to update all the test projects at once (big change, dangerous) or make a parallel version of the Test Common project.
    • I have chosen the latter option.
    • The plan for unwinding this is once the functional/manual test projects reference the common MDS project, they will also point to the parallel Test Common project. Once that happens, the existing test common can be deleted.

How does this impact our pipelines?

No changes were necessary to the CI/PR pipelines. The existing build.proj command for running the Unit Tests continues to work even after changing the MDS target. A small tweak was necessary to ensure that we weren't building unnecessary projects before running the tests, but that's no big issue, afaik. Pipelines should continue to Just Work™️

I considered making new targets in the build2.proj but decided to just get this out first. There's some cruft in the way we call the Unit Tests today, so leaving it as-is isn't making anything worse.

Issues

N/A

Testing

Locally the build.proj targets and running the unit tests inside the IDE still work.

Copilot AI review requested due to automatic review settings January 8, 2026 01:05
@benrr101 benrr101 requested a review from a team as a code owner January 8, 2026 01:05
@benrr101 benrr101 added Area\Tests Issues that are targeted to tests or test projects Common Project 🚮 Things that relate to the common project project labels Jan 8, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR migrates the Unit Test project to reference the common (merged) Microsoft.Data.SqlClient project instead of the separate platform-specific projects (netfx/netcore). The changes introduce a temporary parallel Test Common project to avoid breaking existing Functional and Manual test projects during the migration.

Key Changes:

  • Updated Unit Test project to reference the unified MDS project and resolve SNI dependencies via package references
  • Added InternalsVisibleTo attribute and resource file configurations to the common MDS project
  • Created a temporary Microsoft.Data.SqlClient.TestCommon project that references the unified MDS project
  • Refactored test code to improve clarity and remove unnecessary try-catch blocks

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
build.proj Removed redundant project references from UnitTests ItemGroup since the dependencies are now managed by the test project itself
src/Microsoft.Data.SqlClient/src/Microsoft.Data.SqlClient.csproj Added InternalsVisibleTo for UnitTests assembly and configured embedded resource handling for Strings.resx files
src/Microsoft.Data.SqlClient/tests/Common/Microsoft.Data.SqlClient.TestCommon.csproj New temporary test common project that references the unified MDS project with necessary test dependencies
src/Microsoft.Data.SqlClient/tests/UnitTests/Microsoft.Data.SqlClient.UnitTests.csproj Restructured to reference the unified MDS project, use SNI package references instead of copy targets, and separate dependencies by target framework
src/Microsoft.Data.SqlClient/tests/UnitTests/SimulatedServerTests/ConnectionFailoverTests.cs Improved test code clarity by extracting actions and removing unnecessary try-catch blocks
src/Microsoft.Data.SqlClient.sln Added the new Microsoft.Data.SqlClient.TestCommon project to the solution with build configurations

Comment on lines +35 to 80
<ItemGroup Condition="'$(TargetFramework)' == 'net462'">
<Reference Include="System.Transactions" />

<PackageReference Include="Microsoft.Data.SqlClient.SNI" />
<PackageReference Include="Microsoft.DotNet.XUnitExtensions" />
<PackageReference Include="Microsoft.NET.Test.Sdk" />
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies"
IncludeAssets="runtime; build; native; contentfiles; analyzers; buildtransitive"
PrivateAssets="all" />
<PackageReference Include="Microsoft.SqlServer.Server" />
<PackageReference Include="System.Configuration.ConfigurationManager" />
<PackageReference Include="System.Runtime.InteropServices.RuntimeInformation" />
<PackageReference Include="xunit" />
<PackageReference Include="xunit.runner.console"
IncludeAssets="runtime; build; native; contentfiles; analyzers; buildtransitive"
PrivateAssets="all" />
<PackageReference Include="xunit.runner.visualstudio"
IncludeAssets="runtime; build; native; contentfiles; analyzers; buildtransitive"
PrivateAssets="all" />

<ProjectReference Include="$(TestsPath)tools\TDS\TDS.Servers\TDS.Servers.csproj" />
<ProjectReference Include="$(TestsPath)tools\TDS\TDS.EndPoint\TDS.EndPoint.csproj" />
<ProjectReference Include="$(TestsPath)tools\TDS\TDS\TDS.csproj" />
<ProjectReference Include="$(TestsPath)Common\Common.csproj" />
</ItemGroup>
<!-- .NET Framework references -->
<ItemGroup Condition="$(TargetGroup) == 'netfx'">
<PackageReference Include="System.Runtime.InteropServices.RuntimeInformation" />
<ProjectReference Include="$(NetFxSource)src\Microsoft.Data.SqlClient.csproj" />
<Reference Include="System.Transactions" />
<ProjectReference Include="$(TestsPath)Common\Microsoft.Data.SqlClient.TestCommon.csproj" />
</ItemGroup>
<!-- .NET references -->
<ItemGroup Condition="'$(TargetGroup)'=='netcoreapp'">
<ProjectReference Include="$(NetCoreSource)src\Microsoft.Data.SqlClient.csproj" />
</ItemGroup>
<ItemGroup>
<ContentWithTargetPath Condition="'$(TargetGroup)'=='netfx'" Include="$(BinFolder)$(Configuration).AnyCPU\Microsoft.Data.SqlClient\netfx\$(TargetFramework)\*SNI*.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<TargetPath>%(Filename)%(Extension)</TargetPath>
</ContentWithTargetPath>
</ItemGroup>
<ItemGroup>
<ContentWithTargetPath Include="..\tools\Microsoft.Data.SqlClient.TestUtilities\xunit.runner.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<TargetPath>xunit.runner.json</TargetPath>
</ContentWithTargetPath>
</ItemGroup>
<!-- Resources -->
<ItemGroup>
<Compile Update="Resources.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>

<EmbeddedResource Update="Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
<!-- References for netcore -->
<ItemGroup Condition="'$(TargetFramework)' != 'net462'">
<PackageReference Include="Microsoft.Data.SqlClient.SNI.runtime" />
<PackageReference Include="Microsoft.DotNet.XUnitExtensions" />
<PackageReference Include="Microsoft.NET.Test.Sdk" />
<PackageReference Include="Microsoft.SqlServer.Server" />
<PackageReference Include="System.Configuration.ConfigurationManager" />
<PackageReference Include="xunit" />
<PackageReference Include="xunit.runner.console"
IncludeAssets="runtime; build; native; contentfiles; analyzers; buildtransitive"
PrivateAssets="all" />
<PackageReference Include="xunit.runner.visualstudio"
IncludeAssets="runtime; build; native; contentfiles; analyzers; buildtransitive"
PrivateAssets="all" />

<ProjectReference Include="$(TestsPath)tools\TDS\TDS.Servers\TDS.Servers.csproj" />
<ProjectReference Include="$(TestsPath)tools\TDS\TDS.EndPoint\TDS.EndPoint.csproj" />
<ProjectReference Include="$(TestsPath)tools\TDS\TDS\TDS.csproj" />
<ProjectReference Include="$(TestsPath)Common\Microsoft.Data.SqlClient.TestCommon.csproj" />
</ItemGroup>
Copy link

Copilot AI Jan 8, 2026

Choose a reason for hiding this comment

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

The package reference duplicates are being added across both conditional ItemGroups (netframework and netcore). Consider consolidating common package references (Microsoft.DotNet.XUnitExtensions, Microsoft.NET.Test.Sdk, Microsoft.SqlServer.Server, System.Configuration.ConfigurationManager, xunit, xunit.runner.console, xunit.runner.visualstudio) into a shared ItemGroup to reduce duplication and improve maintainability.

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

"improve maintainability" is arguable, hence why I did it in the first place

Comment on lines 31 to +79
<ProjectReference Include="$(TestsPath)tools\TDS\TDS.Servers\TDS.Servers.csproj" />
<ProjectReference Include="$(TestsPath)tools\TDS\TDS.EndPoint\TDS.EndPoint.csproj" />
<ProjectReference Include="$(TestsPath)tools\TDS\TDS\TDS.csproj" />
<ProjectReference Include="$(TestsPath)Common\Common.csproj" />
</ItemGroup>
<!-- .NET Framework references -->
<ItemGroup Condition="$(TargetGroup) == 'netfx'">
<PackageReference Include="System.Runtime.InteropServices.RuntimeInformation" />
<ProjectReference Include="$(NetFxSource)src\Microsoft.Data.SqlClient.csproj" />
<Reference Include="System.Transactions" />
<ProjectReference Include="$(TestsPath)Common\Microsoft.Data.SqlClient.TestCommon.csproj" />
</ItemGroup>
<!-- .NET references -->
<ItemGroup Condition="'$(TargetGroup)'=='netcoreapp'">
<ProjectReference Include="$(NetCoreSource)src\Microsoft.Data.SqlClient.csproj" />
</ItemGroup>
<ItemGroup>
<ContentWithTargetPath Condition="'$(TargetGroup)'=='netfx'" Include="$(BinFolder)$(Configuration).AnyCPU\Microsoft.Data.SqlClient\netfx\$(TargetFramework)\*SNI*.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<TargetPath>%(Filename)%(Extension)</TargetPath>
</ContentWithTargetPath>
</ItemGroup>
<ItemGroup>
<ContentWithTargetPath Include="..\tools\Microsoft.Data.SqlClient.TestUtilities\xunit.runner.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<TargetPath>xunit.runner.json</TargetPath>
</ContentWithTargetPath>
</ItemGroup>
<!-- Resources -->
<ItemGroup>
<Compile Update="Resources.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>

<EmbeddedResource Update="Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
<!-- References for netcore -->
<ItemGroup Condition="'$(TargetFramework)' != 'net462'">
<PackageReference Include="Microsoft.Data.SqlClient.SNI.runtime" />
<PackageReference Include="Microsoft.DotNet.XUnitExtensions" />
<PackageReference Include="Microsoft.NET.Test.Sdk" />
<PackageReference Include="Microsoft.SqlServer.Server" />
<PackageReference Include="System.Configuration.ConfigurationManager" />
<PackageReference Include="xunit" />
<PackageReference Include="xunit.runner.console"
IncludeAssets="runtime; build; native; contentfiles; analyzers; buildtransitive"
PrivateAssets="all" />
<PackageReference Include="xunit.runner.visualstudio"
IncludeAssets="runtime; build; native; contentfiles; analyzers; buildtransitive"
PrivateAssets="all" />

<ProjectReference Include="$(TestsPath)tools\TDS\TDS.Servers\TDS.Servers.csproj" />
<ProjectReference Include="$(TestsPath)tools\TDS\TDS.EndPoint\TDS.EndPoint.csproj" />
<ProjectReference Include="$(TestsPath)tools\TDS\TDS\TDS.csproj" />
<ProjectReference Include="$(TestsPath)Common\Microsoft.Data.SqlClient.TestCommon.csproj" />
Copy link

Copilot AI Jan 8, 2026

Choose a reason for hiding this comment

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

The TDS-related project references (TDS.Servers, TDS.EndPoint, TDS) are duplicated in both the net462 and netcore conditional ItemGroups. These common test dependencies should be moved to a shared ItemGroup to reduce duplication.

Copilot uses AI. Check for mistakes.
Copy link
Member

Choose a reason for hiding this comment

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

Move these to props file.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I disagree, at this point I want to reduce the usage of props files - they are difficult to discover and unless we have several projects using them, it's not beneficial to put things in a props file. The TDS projects are only being referenced by the unit test project, so moving those to a props file specifically isn't beneficial.

Comment on lines +22 to +40
<!-- References for netfx -->
<ItemGroup Condition="'$(TargetFramework)' == 'net462'">
<PackageReference Include="Azure.Identity" />
<PackageReference Include="Azure.Security.KeyVault.Keys" />
<PackageReference Include="Microsoft.DotNet.XUnitExtensions" />
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies"
IncludeAssets="runtime; build; native; contentfiles; analyzers; buildtransitive"
PrivateAssets="all" />
<PackageReference Include="System.Runtime.InteropServices.RuntimeInformation" />
<PackageReference Include="xunit" />
</ItemGroup>

<!-- References for netcore -->
<ItemGroup Condition="'$(TargetFramework)' != 'net462'">
<PackageReference Include="Azure.Identity" />
<PackageReference Include="Azure.Security.KeyVault.Keys" />
<PackageReference Include="Microsoft.DotNet.XUnitExtensions" />
<PackageReference Include="xunit" />
</ItemGroup>
Copy link

Copilot AI Jan 8, 2026

Choose a reason for hiding this comment

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

Similarly, the package references to Azure.Identity, Azure.Security.KeyVault.Keys, Microsoft.DotNet.XUnitExtensions, and xunit are duplicated in both conditional ItemGroups. Consider consolidating these common dependencies into a shared ItemGroup to improve maintainability.

Suggested change
<!-- References for netfx -->
<ItemGroup Condition="'$(TargetFramework)' == 'net462'">
<PackageReference Include="Azure.Identity" />
<PackageReference Include="Azure.Security.KeyVault.Keys" />
<PackageReference Include="Microsoft.DotNet.XUnitExtensions" />
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies"
IncludeAssets="runtime; build; native; contentfiles; analyzers; buildtransitive"
PrivateAssets="all" />
<PackageReference Include="System.Runtime.InteropServices.RuntimeInformation" />
<PackageReference Include="xunit" />
</ItemGroup>
<!-- References for netcore -->
<ItemGroup Condition="'$(TargetFramework)' != 'net462'">
<PackageReference Include="Azure.Identity" />
<PackageReference Include="Azure.Security.KeyVault.Keys" />
<PackageReference Include="Microsoft.DotNet.XUnitExtensions" />
<PackageReference Include="xunit" />
</ItemGroup>
<!-- Common test package references -->
<ItemGroup>
<PackageReference Include="Azure.Identity" />
<PackageReference Include="Azure.Security.KeyVault.Keys" />
<PackageReference Include="Microsoft.DotNet.XUnitExtensions" />
<PackageReference Include="xunit" />
</ItemGroup>
<!-- References for netfx -->
<ItemGroup Condition="'$(TargetFramework)' == 'net462'">
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies"
IncludeAssets="runtime; build; native; contentfiles; analyzers; buildtransitive"
PrivateAssets="all" />
<PackageReference Include="System.Runtime.InteropServices.RuntimeInformation" />
</ItemGroup>

Copilot uses AI. Check for mistakes.
// Act
connection.Open();


Copy link

Copilot AI Jan 8, 2026

Choose a reason for hiding this comment

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

An extra blank line has been added here which is unnecessary. Consider removing it for cleaner code formatting.

Suggested change

Copilot uses AI. Check for mistakes.
Comment on lines +3 to 4
<!-- @TODO: Use full assembly name here -->
<AssemblyName>UnitTests</AssemblyName>
Copy link

Copilot AI Jan 8, 2026

Choose a reason for hiding this comment

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

The TODO comment indicates that the AssemblyName should be changed to use the full assembly name (likely "Microsoft.Data.SqlClient.UnitTests") to match project naming conventions. This should be addressed before merging to ensure consistency with other projects in the solution.

Suggested change
<!-- @TODO: Use full assembly name here -->
<AssemblyName>UnitTests</AssemblyName>
<AssemblyName>Microsoft.Data.SqlClient.UnitTests</AssemblyName>

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The TODO Is here for later. Not today.

Copy link
Member

@cheenamalhotra cheenamalhotra Jan 8, 2026

Choose a reason for hiding this comment

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

MsBuild system prefers props files more than empty shell projects to architect shared references, and common properties. Props files can be built with the same XML schema so your code wouldn't change much.

You can convert the TestCommon project into a .props file that every test project includes - and make sure it contains shared references, such that project files can stay lightweight and all dependencies/common properties can be pulled into the props file.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's not an empty shell project, it is the same as the existing Common project, just with a reference to the common MDS project. The files compiled files are included by default as is the norm in modern csproj files.

<ItemGroup Condition="'$(TargetFramework)' == 'net462'">
<Reference Include="System.Transactions" />

<PackageReference Include="Microsoft.Data.SqlClient.SNI" />
Copy link
Member

Choose a reason for hiding this comment

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

We need this reference only for Project Reference testing and only for .NET Framework targets, and not for package reference testing or .NET targets as it should flow as a transitive dependency in all other cases.

Copy link
Member

Choose a reason for hiding this comment

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

Make sure you include the dependency version in Directory.Package.Props

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Well the good news then is that the Unit Test only runs in project reference mode. And the SNI is already in Directory.Package.props because MDS takes a dependency on it.

</EmbeddedResource>
<!-- References for netcore -->
<ItemGroup Condition="'$(TargetFramework)' != 'net462'">
<PackageReference Include="Microsoft.Data.SqlClient.SNI.runtime" />
Copy link
Member

Choose a reason for hiding this comment

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

Should not be referenced, allow transitive dependency to include automatically.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Doesn't work, though. Does work when referenced.

<PackageReference Include="Microsoft.NET.Test.Sdk" />
<PackageReference Include="Microsoft.SqlServer.Server" />
<PackageReference Include="System.Configuration.ConfigurationManager" />
<PackageReference Include="xunit" />
Copy link
Member

Choose a reason for hiding this comment

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

Move all repetitive dependencies to the base props file (test common as of now), and include the props file directly.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As described above, TestCommon is not an empty proj just being used for props.

}

// Act
connection.Open();
Copy link
Member

Choose a reason for hiding this comment

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

Why was the try-catch removed?

Copy link
Contributor

Choose a reason for hiding this comment

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

If Open() throws, it will fail the test anyway. The xUnit diagnostics will look a bit different, but the file/line numbers will be evident.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Assert.Fail will only report whatever the message is, in this case a little message and the message property of the exception. Letting the uncaught exception will fail the test and emit the entire exception - message, stack trace, inner exceptions (if any). Not only that, but removing the try/catch cleans it up quite a bit.

Was this necessary for this PR? No, but this test was failing in my local testing for the branches, and to debug it better I removed the try/catch as per the reasons above. It's a small change, so I left it in this PR.

paulmedynski
paulmedynski previously approved these changes Jan 8, 2026
<NetStandardDriver Include="**/netcore/ref/Microsoft.Data.SqlClient*.csproj" />
<AKVProvider Include="**/add-ons/**/AzureKeyVaultProvider/*.csproj" />

<UnitTests Include="**/Common/Common.csproj" />
Copy link
Contributor

Choose a reason for hiding this comment

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

I had to include these so that the referenced projects are built and available for the proper target when we build the unit tests project. I'd be happy to get rid of them, but try building unit tests after cleaning the project to make sure everything still works.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, this is something I'm working through right now in the failing build. I ignored the "--no-build" on the dotnet command and it tripped me up.

Copilot AI review requested due to automatic review settings January 9, 2026 20:10
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Comment on lines +1 to +41
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<AssemblyName>Microsoft.Data.SqlClient.TestCommon</AssemblyName>
<RootNamespace>Microsoft.Data.SqlClient.TestCommon</RootNamespace>
<Nullable>enable</Nullable>
</PropertyGroup>

<!-- Embedded resources and content files =========================== -->
<ItemGroup>
<ContentWithTargetPath Include="..\tools\Microsoft.Data.SqlClient.TestUtilities\xunit.runner.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<TargetPath>xunit.runner.json</TargetPath>
</ContentWithTargetPath>
</ItemGroup>

<!-- References ====================================================== -->
<!-- Test target reference -->
<ItemGroup>
<ProjectReference Include="$(RepoRoot)src/Microsoft.Data.SqlClient/src/Microsoft.Data.SqlClient.csproj" />
</ItemGroup>

<!-- References for netfx -->
<ItemGroup Condition="'$(TargetFramework)' == 'net462'">
<PackageReference Include="Azure.Identity" />
<PackageReference Include="Azure.Security.KeyVault.Keys" />
<PackageReference Include="Microsoft.DotNet.XUnitExtensions" />
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies"
IncludeAssets="runtime; build; native; contentfiles; analyzers; buildtransitive"
PrivateAssets="all" />
<PackageReference Include="System.Runtime.InteropServices.RuntimeInformation" />
<PackageReference Include="xunit" />
</ItemGroup>

<!-- References for netcore -->
<ItemGroup Condition="'$(TargetFramework)' != 'net462'">
<PackageReference Include="Azure.Identity" />
<PackageReference Include="Azure.Security.KeyVault.Keys" />
<PackageReference Include="Microsoft.DotNet.XUnitExtensions" />
<PackageReference Include="xunit" />
</ItemGroup>
</Project>
Copy link

Copilot AI Jan 9, 2026

Choose a reason for hiding this comment

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

The new Microsoft.Data.SqlClient.TestCommon project doesn't include any compile files. Looking at the existing Common.csproj in the same directory, it contains files like DisposableArray.cs, LocalAppContextSwitchesHelper.cs, and SqlDataReaderExtensions.cs. These files should be included in the new TestCommon project either through explicit Compile elements or by ensuring EnableDefaultCompileItems is true (which is the default for SDK-style projects). Without including these source files, the TestCommon project will be empty and won't provide the shared test utilities that other test projects depend on.

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

No they should not be included - by default all files in the folder are compiled, there's no need to manually include them.

Copilot AI review requested due to automatic review settings January 10, 2026 00:48
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Comment on lines 55 to +58
<ProjectReference Include="$(TestsPath)tools\TDS\TDS.Servers\TDS.Servers.csproj" />
<ProjectReference Include="$(TestsPath)tools\TDS\TDS.EndPoint\TDS.EndPoint.csproj" />
<ProjectReference Include="$(TestsPath)tools\TDS\TDS\TDS.csproj" />
<ProjectReference Include="$(TestsPath)Common\Common.csproj" />
</ItemGroup>
<!-- .NET Framework references -->
<ItemGroup Condition="$(TargetGroup) == 'netfx'">
<PackageReference Include="System.Runtime.InteropServices.RuntimeInformation" />
<ProjectReference Include="$(NetFxSource)src\Microsoft.Data.SqlClient.csproj" />
<Reference Include="System.Transactions" />
<ProjectReference Include="$(TestsPath)Common\Microsoft.Data.SqlClient.TestCommon.csproj" />
Copy link

Copilot AI Jan 10, 2026

Choose a reason for hiding this comment

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

The TDS project references (TDS.Servers, TDS.EndPoint, TDS) are duplicated in both the net462 and netcore conditional ItemGroups. These references should be moved to a common ItemGroup that applies to all target frameworks to avoid duplication and simplify maintenance.

Copilot uses AI. Check for mistakes.
Comment on lines +19 to +23
<ItemGroup Condition="'$(CDP_BUILD_TYPE)' != 'Official'">
<AssemblyAttribute Include="System.Runtime.CompilerServices.InternalsVisibleToAttribute">
<_Parameter1>UnitTests</_Parameter1>
</AssemblyAttribute>
</ItemGroup>
Copy link

Copilot AI Jan 10, 2026

Choose a reason for hiding this comment

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

The InternalsVisibleTo attribute is only added for non-official builds (when CDP_BUILD_TYPE != 'Official'). This means unit tests won't be able to access internal members in official builds, which could cause test failures in production build pipelines. Consider whether this restriction is intentional or if the tests should always have access to internals.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area\Tests Issues that are targeted to tests or test projects Common Project 🚮 Things that relate to the common project project

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants