Skip to content

[6.1] Test | Fix Diagnostic Tests and remove Remote Executor (#4078)#4268

Closed
cheenamalhotra wants to merge 1 commit into
release/6.1from
dev/cheena/6.1-port-fixes
Closed

[6.1] Test | Fix Diagnostic Tests and remove Remote Executor (#4078)#4268
cheenamalhotra wants to merge 1 commit into
release/6.1from
dev/cheena/6.1-port-fixes

Conversation

@cheenamalhotra
Copy link
Copy Markdown
Member

Ports #4078 to release/6.1 branch to enable Diagnostics Testing and remove remote executor.

@cheenamalhotra cheenamalhotra requested a review from a team as a code owner May 11, 2026 20:18
Copilot AI review requested due to automatic review settings May 11, 2026 20:18
@github-project-automation github-project-automation Bot moved this to To triage in SqlClient Board May 11, 2026
@cheenamalhotra cheenamalhotra added the Area\Tests Issues that are targeted to tests or test projects label May 11, 2026
@cheenamalhotra cheenamalhotra added this to the 6.1.6 milestone May 11, 2026
Copy link
Copy Markdown
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

Ports PR #4078 onto the release/6.1 branch to get Diagnostics manual tests running reliably without Microsoft.DotNet.RemoteExecutor, and adjusts SqlConnection.OpenAsync diagnostic continuation behavior in the netcore implementation.

Changes:

  • Refactors DiagnosticTest to run in-process (no remote executor), serialize execution via an xUnit collection, and validate expected diagnostic events.
  • Removes Microsoft.DotNet.RemoteExecutor from manual test project/package dependency lists.
  • Updates SqlConnection.InternalOpenAsync to attach the diagnostic completion continuation with explicit continuation options.

Reviewed changes

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

File Description
src/Microsoft.Data.SqlClient/tests/ManualTests/TracingTests/DiagnosticTest.cs Reworks diagnostic manual tests to avoid remote execution and to assert presence of expected diagnostic events.
src/Microsoft.Data.SqlClient/tests/ManualTests/Microsoft.Data.SqlClient.ManualTesting.Tests.csproj Drops the RemoteExecutor package reference for manual tests.
src/Microsoft.Data.SqlClient/tests/Directory.Packages.props Removes centralized package version entry for RemoteExecutor.
src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlConnection.cs Adjusts the OpenAsync continuation wiring for diagnostic completion handling.

using SqlCommand cmd = new("SELECT *, baddata = 1 / 0 FROM sys.objects FOR xml auto, xmldata;", conn);
#endif
conn.Open();
Assert.Throws<SqlException>(() => cmd.ExecuteXmlReader());
Comment on lines +377 to 380
foreach (string expected in expectedDiagnostics)
{
Assert.True(observer.HasReceivedDiagnostic(expected), $"Missing diagnostic '{expected}'");
}
Comment on lines +412 to 415
foreach (string expected in expectedDiagnostics)
{
Assert.NotNull(kvp.Value);

SqlConnection sqlConnection = GetPropertyValueFromType<SqlConnection>(kvp.Value, "Connection");
Assert.NotNull(sqlConnection);

string operation = GetPropertyValueFromType<string>(kvp.Value, "Operation");
Assert.False(string.IsNullOrWhiteSpace(operation));

statistics = GetPropertyValueFromType<IDictionary>(kvp.Value, "Statistics");

Guid connectionId = GetPropertyValueFromType<Guid>(kvp.Value, "ConnectionId");
Assert.NotEqual(connectionId, Guid.Empty);

statsLogged = true;
Assert.True(observer.HasReceivedDiagnostic(expected), $"Missing diagnostic '{expected}'");
}
// See the LICENSE file in the project root for more information.

using System;
using System.Collections;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Threading.Tasks;
using System.Xml;
@cheenamalhotra
Copy link
Copy Markdown
Member Author

Discarded since #3658 isn't part of 6.1.

@github-project-automation github-project-automation Bot moved this from To triage to Done in SqlClient Board May 11, 2026
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

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants