From babcd106b5e28ed60ad4447987c55093a50580fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Amaury=20Lev=C3=A9?= Date: Mon, 13 Jul 2026 10:08:55 +0200 Subject: [PATCH 1/4] Make non-compliant TODO comments policy-compliant Rewrites the ~37 src/ TODO comments that did not reference a tracked GitHub issue into plain explanatory comments, satisfying the repo's TODO policy (every TODO must reference an issue). Addresses the outstanding open item from discussion #9656 (the changelog gap it also flagged was already fixed in #9667). Vendored code (XxHashShared, Jsonite), TODOs already referencing issues (#8086, #2999, #8772), and the intentional placeholder string in IgnoreShouldHaveJustificationFixer are left untouched. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 30a539c0-f7a1-4e63-b611-60b0fd18f12f --- .../MSTest.TestAdapter/VSTestAdapter/MSTestExecutor.cs | 4 ++-- .../Data/TestDataConnectionSql.Schema.cs | 2 +- .../Discovery/AssemblyEnumerator.cs | 2 +- .../Discovery/TypeEnumerator.cs | 4 ++-- .../Execution/ExceptionHelper.cs | 2 +- .../Execution/TestMethodInfo.Execution.cs | 6 +++--- .../Extensions/MethodInfoExtensions.cs | 2 +- .../Helpers/RuntimeContext.cs | 2 +- .../Utilities/AppDomainUtilities.cs | 2 +- .../Utilities/DeploymentItemUtility.cs | 2 +- .../AssertThrowsShouldContainSingleStatementAnalyzer.cs | 2 +- .../AssertionArgsShouldAvoidConditionalAccessAnalyzer.cs | 4 ++-- .../RoslynAnalyzerHelpers/DiagnosticExtensions.cs | 2 +- .../AzureDevOpsRunIdCoordinator.cs | 2 +- .../QuarantineFile.cs | 2 +- .../TrxDataConsumer.cs | 2 +- .../TrxReportEngine.Metadata.cs | 8 ++++---- .../TrxReportEngine.Results.Definitions.cs | 2 +- .../TrxReportEngine.Results.cs | 6 +++--- .../TrxReportEngine.cs | 2 +- .../Helpers/RunSettingsHelpers.cs | 2 +- .../ObjectModel/ObjectModelConverters.cs | 2 +- .../ObjectModel/RunSettingsAdapter.cs | 2 +- .../Microsoft.Testing.Platform/Hosts/ToolsTestHost.cs | 4 ++-- .../OutputDevice/Terminal/SimpleTerminalBase.cs | 2 +- .../Attributes/DeploymentItemAttribute.cs | 2 +- .../Attributes/WinUI_UITestMethodAttribute.cs | 2 +- .../TestFramework.Extensions/PrivateObject.Helpers.cs | 2 +- 28 files changed, 39 insertions(+), 39 deletions(-) diff --git a/src/Adapter/MSTest.TestAdapter/VSTestAdapter/MSTestExecutor.cs b/src/Adapter/MSTest.TestAdapter/VSTestAdapter/MSTestExecutor.cs index b58fef7d53..b43e90496b 100644 --- a/src/Adapter/MSTest.TestAdapter/VSTestAdapter/MSTestExecutor.cs +++ b/src/Adapter/MSTest.TestAdapter/VSTestAdapter/MSTestExecutor.cs @@ -124,7 +124,7 @@ internal async Task RunTestsAsync(IEnumerable? tests, IRunContext? run throw new ArgumentNullException(nameof(frameworkHandle)); } - // TODO: Verify why VSTest annotates the IEnumerable as nullable. + // VSTest annotates the IEnumerable as nullable; the exact reason is unclear. if (tests is null) { throw new ArgumentNullException(nameof(tests)); @@ -203,7 +203,7 @@ private async Task RunTestsFromSourcesCoreAsync(IEnumerable? sources, IR throw new ArgumentNullException(nameof(frameworkHandle)); } - // TODO: Verify why VSTest annotates the IEnumerable as nullable. + // VSTest annotates the IEnumerable as nullable; the exact reason is unclear. if (sources is null) { throw new ArgumentNullException(nameof(sources)); diff --git a/src/Adapter/MSTestAdapter.PlatformServices/Data/TestDataConnectionSql.Schema.cs b/src/Adapter/MSTestAdapter.PlatformServices/Data/TestDataConnectionSql.Schema.cs index 7bc0aed4c2..df539a4d73 100644 --- a/src/Adapter/MSTestAdapter.PlatformServices/Data/TestDataConnectionSql.Schema.cs +++ b/src/Adapter/MSTestAdapter.PlatformServices/Data/TestDataConnectionSql.Schema.cs @@ -45,7 +45,7 @@ public override List GetDataTablesAndViews() SchemaMetaData[] metadatas = GetSchemaMetaData(); - // TODO: may be find better way to enumerate tables/views. + // There may be a better way to enumerate tables/views. foreach (SchemaMetaData metadata in metadatas) { DataTable? dataTable = null; diff --git a/src/Adapter/MSTestAdapter.PlatformServices/Discovery/AssemblyEnumerator.cs b/src/Adapter/MSTestAdapter.PlatformServices/Discovery/AssemblyEnumerator.cs index efdb766f24..0c875a34bb 100644 --- a/src/Adapter/MSTestAdapter.PlatformServices/Discovery/AssemblyEnumerator.cs +++ b/src/Adapter/MSTestAdapter.PlatformServices/Discovery/AssemblyEnumerator.cs @@ -247,7 +247,7 @@ private static bool TryUnfoldITestDataSources(UnitTestElement test, DiscoveryTes isDataDriven = true; if (!TryUnfoldITestDataSource(dataSource, test, new(testMethodInfo.MethodInfo, test.TestMethod.DisplayName), tempListOfTests, ref globalTestCaseIndex, mustSerialize)) { - // TODO: Improve multi-source design! + // The multi-source design could be improved. // Ideally we would want to consider each data source separately but when one source cannot be expanded, // we will run all sources from the given method so we need to bail-out "globally". return false; diff --git a/src/Adapter/MSTestAdapter.PlatformServices/Discovery/TypeEnumerator.cs b/src/Adapter/MSTestAdapter.PlatformServices/Discovery/TypeEnumerator.cs index 60df656e33..e341cba360 100644 --- a/src/Adapter/MSTestAdapter.PlatformServices/Discovery/TypeEnumerator.cs +++ b/src/Adapter/MSTestAdapter.PlatformServices/Discovery/TypeEnumerator.cs @@ -148,7 +148,7 @@ internal UnitTestElement GetTestFromMethod(MethodInfo method, bool classDisables MethodInfo = method, }; - // TODO: For every test method in a class, we are asking reflect helper multiple times for the same + // For every test method in a class, we are asking reflect helper multiple times for the same // information (like test categories, traits, deployment items) which is not optimal. IReflectionOperations reflectionOperations = PlatformServiceProvider.Instance.ReflectionOperations; var testElement = new UnitTestElement(testMethod) @@ -195,7 +195,7 @@ internal UnitTestElement GetTestFromMethod(MethodInfo method, bool classDisables // In production, we always have a TestMethod attribute because GetTestFromMethod is called under IsValidTestMethod // In unit tests, we may not have the test to have TestMethodAttribute. - // TODO: Adjust all unit tests to properly have the attribute and uncomment the assert. + // Unit tests could be adjusted to properly have the attribute so the assert can be uncommented. // DebugEx.Assert(testMethodAttribute is not null, "Expected to find a 'TestMethod' attribute."); // get DisplayName from TestMethodAttribute (or any inherited attribute) diff --git a/src/Adapter/MSTestAdapter.PlatformServices/Execution/ExceptionHelper.cs b/src/Adapter/MSTestAdapter.PlatformServices/Execution/ExceptionHelper.cs index 288d06e1be..2fa528cf5d 100644 --- a/src/Adapter/MSTestAdapter.PlatformServices/Execution/ExceptionHelper.cs +++ b/src/Adapter/MSTestAdapter.PlatformServices/Execution/ExceptionHelper.cs @@ -31,7 +31,7 @@ internal static class ExceptionHelper curException != null; curException = curException.InnerException) { - // TODO:Fix the shadow stack-trace used in Private Object + // The shadow stack-trace used in Private Object could be improved. // (Look-in Assertion.cs in the UnitTestFramework assembly) // Sometimes the stack trace can be null, but the inner stack trace diff --git a/src/Adapter/MSTestAdapter.PlatformServices/Execution/TestMethodInfo.Execution.cs b/src/Adapter/MSTestAdapter.PlatformServices/Execution/TestMethodInfo.Execution.cs index 26530800e4..f068931e6d 100644 --- a/src/Adapter/MSTestAdapter.PlatformServices/Execution/TestMethodInfo.Execution.cs +++ b/src/Adapter/MSTestAdapter.PlatformServices/Execution/TestMethodInfo.Execution.cs @@ -102,7 +102,7 @@ private async Task ExecuteInternalAsync(object?[]? arguments, Cancel } } - // TODO remove dry violation with TestMethodRunner + // This duplicates logic in TestMethodRunner (DRY violation). bool setTestContextSucessful = false; if (_executionContext is null) { @@ -348,7 +348,7 @@ async SynchronizationContextPreservingTask ExecuteWithTimeoutTokenAs TestResult timeoutResult = new() { Outcome = UnitTestOutcome.Timeout, TestFailureException = new TestFailedException(UnitTestOutcome.Timeout, errorMessage) }; - // TODO: execution context propagation here may still not be accurate. + // Execution context propagation here may still not be accurate. // if test init was successfully executed by ExecuteAsyncAction, but then the test itself timed out or cancelled, // then at this point we will run the cleanup on an execution context that doesn't have any state set by the test initialize. @@ -362,7 +362,7 @@ void ExecuteAsyncAction() { try { - // TODO: Avoid blocking. + // Ideally this would avoid blocking. // This used to always happen, but now is moved to the code path where there is a Timeout on the test method. // The GetAwaiter().GetResult() call here can be a source of deadlocks, especially for UWP/WinUI. // When the test method has `await`s with ConfigureAwait(true) (which is the default), the continuation is diff --git a/src/Adapter/MSTestAdapter.PlatformServices/Extensions/MethodInfoExtensions.cs b/src/Adapter/MSTestAdapter.PlatformServices/Extensions/MethodInfoExtensions.cs index 430639d9e1..092f573576 100644 --- a/src/Adapter/MSTestAdapter.PlatformServices/Extensions/MethodInfoExtensions.cs +++ b/src/Adapter/MSTestAdapter.PlatformServices/Extensions/MethodInfoExtensions.cs @@ -380,7 +380,7 @@ private static MethodInfo ConstructGenericMethod(MethodInfo methodInfo, Paramete for (int i = 0; i < map.Length; i++) { - // TODO: Better to throw? or tolerate and transform to typeof(object)? + // It is unclear whether it is better to throw here or tolerate and transform to typeof(object). // This is reachable in the following case for example: // [DataRow(null)] // public void TestMethod(T t) { } diff --git a/src/Adapter/MSTestAdapter.PlatformServices/Helpers/RuntimeContext.cs b/src/Adapter/MSTestAdapter.PlatformServices/Helpers/RuntimeContext.cs index 6e18ccaafd..17621a95fd 100644 --- a/src/Adapter/MSTestAdapter.PlatformServices/Helpers/RuntimeContext.cs +++ b/src/Adapter/MSTestAdapter.PlatformServices/Helpers/RuntimeContext.cs @@ -6,7 +6,7 @@ namespace Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.Helpers; internal static class RuntimeContext { private static readonly Lazy IsHotReloadEnabledLazy = new(() => - // TODO: We should be using a capability from the runner instead of looking at environment variables. + // Ideally we would use a capability from the runner instead of looking at environment variables. Environment.GetEnvironmentVariable("DOTNET_WATCH") == "1" || Environment.GetEnvironmentVariable("TESTINGPLATFORM_HOTRELOAD_ENABLED") == "1"); diff --git a/src/Adapter/MSTestAdapter.PlatformServices/Utilities/AppDomainUtilities.cs b/src/Adapter/MSTestAdapter.PlatformServices/Utilities/AppDomainUtilities.cs index f3d0b2afbc..60ad6afdab 100644 --- a/src/Adapter/MSTestAdapter.PlatformServices/Utilities/AppDomainUtilities.cs +++ b/src/Adapter/MSTestAdapter.PlatformServices/Utilities/AppDomainUtilities.cs @@ -69,7 +69,7 @@ internal static void SetAppDomainFrameworkVersionBasedOnTestSource(AppDomainSetu /// /// /// Framework string - /// TODO: Need to add components/E2E tests to cover these scenarios. + /// Components/E2E tests could be added to cover these scenarios. /// [SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1650:ElementDocumentationMustBeSpelledCorrectly", Justification = "Reviewed. Suppression is OK here.")] internal static string GetTargetFrameworkVersionString(string testSourcePath) diff --git a/src/Adapter/MSTestAdapter.PlatformServices/Utilities/DeploymentItemUtility.cs b/src/Adapter/MSTestAdapter.PlatformServices/Utilities/DeploymentItemUtility.cs index c371e13baa..79082009f1 100644 --- a/src/Adapter/MSTestAdapter.PlatformServices/Utilities/DeploymentItemUtility.cs +++ b/src/Adapter/MSTestAdapter.PlatformServices/Utilities/DeploymentItemUtility.cs @@ -123,7 +123,7 @@ internal static IList GetDeploymentItems(IEnumerable? deploymentItemsToBeAdded = FromKeyValuePairs(items); - // TODO: Check if we can avoid potential NRE here. + // A potential NRE here could possibly be avoided. foreach (DeploymentItem deploymentItemToBeAdded in deploymentItemsToBeAdded!) { AddDeploymentItem(allDeploymentItems, deploymentItemToBeAdded); diff --git a/src/Analyzers/MSTest.Analyzers/AssertThrowsShouldContainSingleStatementAnalyzer.cs b/src/Analyzers/MSTest.Analyzers/AssertThrowsShouldContainSingleStatementAnalyzer.cs index ef41149c65..e5292cbcff 100644 --- a/src/Analyzers/MSTest.Analyzers/AssertThrowsShouldContainSingleStatementAnalyzer.cs +++ b/src/Analyzers/MSTest.Analyzers/AssertThrowsShouldContainSingleStatementAnalyzer.cs @@ -100,7 +100,7 @@ private static int CountStatements(IBlockOperation blockOperation) // Skip implicit return/labeled operations. // Implicit returns don't represent user code. // Implicit labeled operations seem to be created for lambdas only under VB. But we don't do a language check. - // TODO: Should we bail-out for any implicit operation? + // It is unclear whether we should bail out for any implicit operation. if (operation is IReturnOperation or ILabeledOperation && operation.IsImplicit) { continue; diff --git a/src/Analyzers/MSTest.Analyzers/AssertionArgsShouldAvoidConditionalAccessAnalyzer.cs b/src/Analyzers/MSTest.Analyzers/AssertionArgsShouldAvoidConditionalAccessAnalyzer.cs index 85e6bec08f..ca810d5c02 100644 --- a/src/Analyzers/MSTest.Analyzers/AssertionArgsShouldAvoidConditionalAccessAnalyzer.cs +++ b/src/Analyzers/MSTest.Analyzers/AssertionArgsShouldAvoidConditionalAccessAnalyzer.cs @@ -34,8 +34,8 @@ public sealed class AssertionArgsShouldAvoidConditionalAccessAnalyzer : Diagnost ("AreNotEqual", 2), ("AreEquivalent", 2), ("AreNotEquivalent", 2), - // TODO: Is it really bad to have Assert.Contains(myCollection, expression_with_conditional_access)? A codefix seems like may not always yield the correct result for this case. - // TODO: Maybe we should check one argument only (the collection itself) + // It is unclear whether Assert.Contains(myCollection, expression_with_conditional_access) is genuinely problematic; a codefix may not always yield the correct result for this case. + // We might only need to check one argument (the collection itself). // Same applies to DoesNotContain ("Contains", 2), ("DoesNotContain", 2), diff --git a/src/Analyzers/MSTest.Analyzers/RoslynAnalyzerHelpers/DiagnosticExtensions.cs b/src/Analyzers/MSTest.Analyzers/RoslynAnalyzerHelpers/DiagnosticExtensions.cs index c62e890828..eada3e8a4c 100644 --- a/src/Analyzers/MSTest.Analyzers/RoslynAnalyzerHelpers/DiagnosticExtensions.cs +++ b/src/Analyzers/MSTest.Analyzers/RoslynAnalyzerHelpers/DiagnosticExtensions.cs @@ -137,7 +137,7 @@ public static Diagnostic CreateDiagnostic( => syntaxReference.GetSyntax(cancellationToken).CreateDiagnostic(rule, args); /// - /// TODO: Revert this reflection based workaround once we move to Microsoft.CodeAnalysis version 3.0 + /// This reflection-based workaround can be reverted once we move to Microsoft.CodeAnalysis version 3.0. /// private static readonly PropertyInfo? s_syntaxTreeDiagnosticOptionsProperty = typeof(SyntaxTree).GetTypeInfo().GetDeclaredProperty("DiagnosticOptions"); diff --git a/src/Platform/Microsoft.Testing.Extensions.AzureDevOpsReport/AzureDevOpsRunIdCoordinator.cs b/src/Platform/Microsoft.Testing.Extensions.AzureDevOpsReport/AzureDevOpsRunIdCoordinator.cs index 79233269d1..966a012cae 100644 --- a/src/Platform/Microsoft.Testing.Extensions.AzureDevOpsReport/AzureDevOpsRunIdCoordinator.cs +++ b/src/Platform/Microsoft.Testing.Extensions.AzureDevOpsReport/AzureDevOpsRunIdCoordinator.cs @@ -84,7 +84,7 @@ public async Task AcquireRunAsync(AzureDevOpsPublishC throw new InvalidOperationException(AzureDevOpsResources.AzureDevOpsLivePublishingRunIdFileMismatch); } - // TODO: Elect a deterministic surviving participant when the owner lease expires before writing azdo-runid..json. + // A deterministic surviving participant could be elected when the owner lease expires before writing azdo-runid..json. throw new InvalidOperationException(AzureDevOpsResources.AzureDevOpsLivePublishingMissingRunIdFile); } catch diff --git a/src/Platform/Microsoft.Testing.Extensions.AzureDevOpsReport/QuarantineFile.cs b/src/Platform/Microsoft.Testing.Extensions.AzureDevOpsReport/QuarantineFile.cs index c35d07c6fa..47d5ce5c7d 100644 --- a/src/Platform/Microsoft.Testing.Extensions.AzureDevOpsReport/QuarantineFile.cs +++ b/src/Platform/Microsoft.Testing.Extensions.AzureDevOpsReport/QuarantineFile.cs @@ -13,7 +13,7 @@ internal sealed class QuarantineFile private const int MaxPatternCount = 10_000; private const int MaxPatternLength = 4 * 1024; - // TODO: Consider an opt-in modifier for case-insensitive quarantine matching if customer scenarios require it. + // An opt-in modifier for case-insensitive quarantine matching could be added if customer scenarios require it. private static readonly RegexOptions RegexOptions = RegexOptions.CultureInvariant; private readonly Regex[] _patterns; diff --git a/src/Platform/Microsoft.Testing.Extensions.TrxReport/TrxDataConsumer.cs b/src/Platform/Microsoft.Testing.Extensions.TrxReport/TrxDataConsumer.cs index 2ca1a6c778..20afa70819 100644 --- a/src/Platform/Microsoft.Testing.Extensions.TrxReport/TrxDataConsumer.cs +++ b/src/Platform/Microsoft.Testing.Extensions.TrxReport/TrxDataConsumer.cs @@ -172,7 +172,7 @@ await _logger.LogDebugAsync($""" // This tells the TestHostController process the info of the registered ITestFramework. // The TestHostController needs that info to create the TrxReportEngine so that the info are written to the TRX file. // Note: TestHostController cannot retrieve ITestFramework from service provider which is why we need the extra complexity here. - // TODO: Investigate if TestHostController can/should have access to ITestFramework and simplify this. + // It would be worth investigating whether TestHostController can/should have access to ITestFramework to simplify this. await _trxTestApplicationLifecycleCallbacks.NamedPipeClient.RequestReplyAsync(new TestAdapterInformationRequest(_testFramework.Uid, _testFramework.Version), cancellationToken) .TimeoutAfterAsync(TimeoutHelper.DefaultHangTimeSpanTimeout, cancellationToken).ConfigureAwait(false); } diff --git a/src/Platform/Microsoft.Testing.Extensions.TrxReport/TrxReportEngine.Metadata.cs b/src/Platform/Microsoft.Testing.Extensions.TrxReport/TrxReportEngine.Metadata.cs index 7a220d6cf5..e0ac947ebb 100644 --- a/src/Platform/Microsoft.Testing.Extensions.TrxReport/TrxReportEngine.Metadata.cs +++ b/src/Platform/Microsoft.Testing.Extensions.TrxReport/TrxReportEngine.Metadata.cs @@ -9,7 +9,7 @@ internal sealed partial class TrxReportEngine { private void AddResultSummary(XElement testRun, string resultSummaryOutcome, string runDeploymentRoot, string testHostCrashInfo, int exitCode, SummaryCounts summaryCounts, List attachmentWarnings, bool isTestHostCrashed = false) { - // TODO: VSTest adds Output/StdOut element to ResultSummary which we don't add. + // Unlike VSTest, we do not add an Output/StdOut element to ResultSummary. // VSTest adds mainly two things in that element: // 1. Skipped test messages (see AddRunLevelInformationalMessage call in HandleSkippedTest in VSTest's TrxLogger implementation) // 2. Messages published with TestMessageLevel.Informational. @@ -43,7 +43,7 @@ private void AddResultSummary(XElement testRun, string resultSummaryOutcome, str new XAttribute("pending", 0)); resultSummary.Add(counters); - // TODO: VSTest adds two additional things to RunInfos + // VSTest adds two additional things to RunInfos. // 1. Messages published with TestMessageLevel.Warning or TestMessageLevel.Error // 2. Errors when constructing result files. // In addition, in these cases, it turns TRX outcome to error. @@ -59,8 +59,8 @@ private void AddResultSummary(XElement testRun, string resultSummaryOutcome, str if (_artifactsByExtension.Count != 0) { - // TODO: VSTest seems to also add ResultFiles element, and not only CollectorDataEntries. - // TODO: Revise VSTest implementation for Converter.ToCollectionEntries and Converter.ToResultFiles + // VSTest seems to also add a ResultFiles element, and not only CollectorDataEntries. + // The VSTest implementation for Converter.ToCollectionEntries and Converter.ToResultFiles could be revised. var collectorDataEntries = new XElement(NamespaceUri + "CollectorDataEntries"); resultSummary.Add(collectorDataEntries); diff --git a/src/Platform/Microsoft.Testing.Extensions.TrxReport/TrxReportEngine.Results.Definitions.cs b/src/Platform/Microsoft.Testing.Extensions.TrxReport/TrxReportEngine.Results.Definitions.cs index fab66a0f8f..115c200768 100644 --- a/src/Platform/Microsoft.Testing.Extensions.TrxReport/TrxReportEngine.Results.Definitions.cs +++ b/src/Platform/Microsoft.Testing.Extensions.TrxReport/TrxReportEngine.Results.Definitions.cs @@ -93,7 +93,7 @@ private static XElement CreateUnitTestElementForTestDefinition(string testDefini unitTest.Add(properties); } - // TODO: We are not adding Workitems, but VSTest does. + // Unlike VSTest, we do not add Workitems. return unitTest; } } diff --git a/src/Platform/Microsoft.Testing.Extensions.TrxReport/TrxReportEngine.Results.cs b/src/Platform/Microsoft.Testing.Extensions.TrxReport/TrxReportEngine.Results.cs index 3754220f9f..aa397ee863 100644 --- a/src/Platform/Microsoft.Testing.Extensions.TrxReport/TrxReportEngine.Results.cs +++ b/src/Platform/Microsoft.Testing.Extensions.TrxReport/TrxReportEngine.Results.cs @@ -173,8 +173,8 @@ private SummaryCounts AddResults(IReadOnlyList testResults, strin unitTestResult.Add(output); } - // TODO: VSTest used to store the relative paths in a sorted list (ignoring case). - // TODO: VSTest is able to classify per-test attachments into two categories: + // VSTest used to store the relative paths in a sorted list (ignoring case). + // VSTest is able to classify per-test attachments into two categories: // 1. ResultFiles // 2. CollectorDataEntries // So far, we only have "ResultFiles". @@ -287,7 +287,7 @@ private SummaryCounts AddResults(IReadOnlyList testResults, strin ? methodIdentifier.TypeName : $"{methodIdentifier.Namespace}.{methodIdentifier.TypeName}"; - // TODO: Are we expected to append backtick and arity here for generic methods? + // It is unclear whether we are expected to append backtick and arity here for generic methods. return (classNameFromIdentifierProperty, methodIdentifier.MethodName); } } diff --git a/src/Platform/Microsoft.Testing.Extensions.TrxReport/TrxReportEngine.cs b/src/Platform/Microsoft.Testing.Extensions.TrxReport/TrxReportEngine.cs index 19f73f7a0e..b69cb56a9f 100644 --- a/src/Platform/Microsoft.Testing.Extensions.TrxReport/TrxReportEngine.cs +++ b/src/Platform/Microsoft.Testing.Extensions.TrxReport/TrxReportEngine.cs @@ -80,7 +80,7 @@ public TrxReportEngine( testRunId = Guid.NewGuid(); } - // TODO: VSTest implementation seems to also add "runUser" attribute. + // The VSTest implementation seems to also add a "runUser" attribute. // Revise that. testRun.SetAttributeValue("id", testRunId); string testRunName = $"{_environment.GetEnvironmentVariable("UserName")}@{_environment.MachineName} {FormatDateTimeForRunName(_clock.UtcNow)}"; diff --git a/src/Platform/Microsoft.Testing.Extensions.VSTestBridge/Helpers/RunSettingsHelpers.cs b/src/Platform/Microsoft.Testing.Extensions.VSTestBridge/Helpers/RunSettingsHelpers.cs index b46a062d81..cb08f79a76 100644 --- a/src/Platform/Microsoft.Testing.Extensions.VSTestBridge/Helpers/RunSettingsHelpers.cs +++ b/src/Platform/Microsoft.Testing.Extensions.VSTestBridge/Helpers/RunSettingsHelpers.cs @@ -10,7 +10,7 @@ namespace Microsoft.Testing.Extensions.VSTestBridge.Helpers; internal static class RunSettingsHelpers { - // TODO: There are two code paths that read runsettings. One is calling the ICommandLineOptions overload, other is calling the CommandLineParseResult overload. + // There are two code paths that read runsettings. One calls the ICommandLineOptions overload, the other calls the CommandLineParseResult overload. // Figure out if they can/should be unified so that we do one I/O operation instead of two. public static string ReadRunSettings(ICommandLineOptions commandLineOptions, IFileSystem fileSystem) { diff --git a/src/Platform/Microsoft.Testing.Extensions.VSTestBridge/ObjectModel/ObjectModelConverters.cs b/src/Platform/Microsoft.Testing.Extensions.VSTestBridge/ObjectModel/ObjectModelConverters.cs index 30eb05e69b..47614b92ba 100644 --- a/src/Platform/Microsoft.Testing.Extensions.VSTestBridge/ObjectModel/ObjectModelConverters.cs +++ b/src/Platform/Microsoft.Testing.Extensions.VSTestBridge/ObjectModel/ObjectModelConverters.cs @@ -154,7 +154,7 @@ public static TestNode ToTestNode( TestMethodIdentifierProperty? testMethodIdentifierProperty = testNode.Properties.SingleOrDefault(); if (testMethodIdentifierProperty is not null) { - // TODO: Should TRX className have arity for generic classes? + // It is unclear whether the TRX className should have arity for generic classes. if (RoslynString.IsNullOrEmpty(testMethodIdentifierProperty.Namespace)) { testNode.Properties.Add(new TrxFullyQualifiedTypeNameProperty(testMethodIdentifierProperty.TypeName)); diff --git a/src/Platform/Microsoft.Testing.Extensions.VSTestBridge/ObjectModel/RunSettingsAdapter.cs b/src/Platform/Microsoft.Testing.Extensions.VSTestBridge/ObjectModel/RunSettingsAdapter.cs index 06cc0ce7a2..c38a8edc53 100644 --- a/src/Platform/Microsoft.Testing.Extensions.VSTestBridge/ObjectModel/RunSettingsAdapter.cs +++ b/src/Platform/Microsoft.Testing.Extensions.VSTestBridge/ObjectModel/RunSettingsAdapter.cs @@ -51,7 +51,7 @@ public RunSettingsAdapter( public string? SettingsXml { get; } /// - // TODO: Needs to be implemented if used by adapters. It is not used by MSTest. + // Needs to be implemented if used by adapters. It is not used by MSTest. public ISettingsProvider? GetSettings(string? settingsName) => throw new NotImplementedException(); private static void WarnOnUnsupportedEntries(XDocument document, IMessageLogger messageLogger) diff --git a/src/Platform/Microsoft.Testing.Platform/Hosts/ToolsTestHost.cs b/src/Platform/Microsoft.Testing.Platform/Hosts/ToolsTestHost.cs index d5cc39b7db..0da98bd5e3 100644 --- a/src/Platform/Microsoft.Testing.Platform/Hosts/ToolsTestHost.cs +++ b/src/Platform/Microsoft.Testing.Platform/Hosts/ToolsTestHost.cs @@ -50,8 +50,8 @@ public async Task RunAsync() string toolNameToRun = _commandLineHandler.ParseResult.ToolName; - // TODO: Apply the override or do not support it for Tools? - // TODO: Verify reserved tool names? + // It is unclear whether the override should be applied or simply not supported for Tools. + // Reserved tool names may also need to be verified. _toolsInformation.GroupBy(x => x.Name).Where(x => x.Count() > 1).ToList() .ForEach(x => throw new InvalidOperationException($"Tool '{x.Key}' is registered more than once.")); diff --git a/src/Platform/Microsoft.Testing.Platform/OutputDevice/Terminal/SimpleTerminalBase.cs b/src/Platform/Microsoft.Testing.Platform/OutputDevice/Terminal/SimpleTerminalBase.cs index d4d63f11a2..3f305c8240 100644 --- a/src/Platform/Microsoft.Testing.Platform/OutputDevice/Terminal/SimpleTerminalBase.cs +++ b/src/Platform/Microsoft.Testing.Platform/OutputDevice/Terminal/SimpleTerminalBase.cs @@ -165,7 +165,7 @@ public void StartBusyIndicator() // nop } - // TODO: Refactor NonAnsiTerminal and AnsiTerminal such that we don't need StartUpdate/StopUpdate. + // NonAnsiTerminal and AnsiTerminal could be refactored such that we don't need StartUpdate/StopUpdate. // It's much better if we use lock C# keyword instead of manually calling Monitor.Enter/Exit // Using lock also ensures we don't accidentally have `await`s in between that could cause Exit to be on a different thread. public void StartUpdate() diff --git a/src/TestFramework/TestFramework.Extensions/Attributes/DeploymentItemAttribute.cs b/src/TestFramework/TestFramework.Extensions/Attributes/DeploymentItemAttribute.cs index 7db827d834..d2a747cc8c 100644 --- a/src/TestFramework/TestFramework.Extensions/Attributes/DeploymentItemAttribute.cs +++ b/src/TestFramework/TestFramework.Extensions/Attributes/DeploymentItemAttribute.cs @@ -28,7 +28,7 @@ namespace Microsoft.VisualStudio.TestTools.UnitTesting; /// /// [AttributeUsage(AttributeTargets.Method | AttributeTargets.Class, AllowMultiple = true)] -// TODO: This API should not exist in the netstandard2.0 build, because it's not available in UWP/WinUI. +// This API should not exist in the netstandard2.0 build, because it's not available in UWP/WinUI. // This is a binary breaking change, however. public sealed class DeploymentItemAttribute : Attribute { diff --git a/src/TestFramework/TestFramework.Extensions/Attributes/WinUI_UITestMethodAttribute.cs b/src/TestFramework/TestFramework.Extensions/Attributes/WinUI_UITestMethodAttribute.cs index 3ec4dfadf9..97b7c0e191 100644 --- a/src/TestFramework/TestFramework.Extensions/Attributes/WinUI_UITestMethodAttribute.cs +++ b/src/TestFramework/TestFramework.Extensions/Attributes/WinUI_UITestMethodAttribute.cs @@ -43,7 +43,7 @@ public UITestMethodAttribute([CallerFilePath] string callerFilePath = "", [Calle /// public override async Task ExecuteAsync(ITestMethod testMethod) { - // TODO: Code seems to be assuming DeclaringType is never null, but it can be null. + // This code assumes DeclaringType is never null, but it can be null. // Using 'bang' notation for now to ensure same behavior. DispatcherQueue dispatcher = GetDispatcherQueue(testMethod.MethodInfo.DeclaringType!.Assembly) ?? throw new InvalidOperationException(FrameworkExtensionsMessages.AsyncUITestMethodWithNoDispatcherQueue); if (dispatcher.HasThreadAccess) diff --git a/src/TestFramework/TestFramework.Extensions/PrivateObject.Helpers.cs b/src/TestFramework/TestFramework.Extensions/PrivateObject.Helpers.cs index 7b177fe638..3fdbbffeae 100644 --- a/src/TestFramework/TestFramework.Extensions/PrivateObject.Helpers.cs +++ b/src/TestFramework/TestFramework.Extensions/PrivateObject.Helpers.cs @@ -81,7 +81,7 @@ private void BuildGenericMethodCacheForType(Type t) var finalCandidates = new MethodInfo[methodCandidates.Count]; methodCandidates.CopyTo(finalCandidates, 0); - // TODO: Check if it's possible to have parameterTypes null here as we assert it's not null above. + // parameterTypes is asserted non-null above, so it should not be null here. if (parameterTypes == null || parameterTypes.Length != 0) { // Now that we have a preliminary list of candidates, select the most appropriate one. From b7fb5b4a6777ce0f03e8ee81a24682d94154bffa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Amaury=20Lev=C3=A9?= Date: Mon, 13 Jul 2026 10:16:30 +0200 Subject: [PATCH 2/4] Address review: document invariants instead of vague notes Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 30a539c0-f7a1-4e63-b611-60b0fd18f12f --- .../Utilities/DeploymentItemUtility.cs | 2 +- .../RoslynAnalyzerHelpers/DiagnosticExtensions.cs | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Adapter/MSTestAdapter.PlatformServices/Utilities/DeploymentItemUtility.cs b/src/Adapter/MSTestAdapter.PlatformServices/Utilities/DeploymentItemUtility.cs index 79082009f1..0c8dcc6d4d 100644 --- a/src/Adapter/MSTestAdapter.PlatformServices/Utilities/DeploymentItemUtility.cs +++ b/src/Adapter/MSTestAdapter.PlatformServices/Utilities/DeploymentItemUtility.cs @@ -123,7 +123,7 @@ internal static IList GetDeploymentItems(IEnumerable? deploymentItemsToBeAdded = FromKeyValuePairs(items); - // A potential NRE here could possibly be avoided. + // deploymentItemsToBeAdded is never null here: items is non-empty (filtered above) and FromKeyValuePairs only returns null for an empty array. foreach (DeploymentItem deploymentItemToBeAdded in deploymentItemsToBeAdded!) { AddDeploymentItem(allDeploymentItems, deploymentItemToBeAdded); diff --git a/src/Analyzers/MSTest.Analyzers/RoslynAnalyzerHelpers/DiagnosticExtensions.cs b/src/Analyzers/MSTest.Analyzers/RoslynAnalyzerHelpers/DiagnosticExtensions.cs index eada3e8a4c..6731cb442c 100644 --- a/src/Analyzers/MSTest.Analyzers/RoslynAnalyzerHelpers/DiagnosticExtensions.cs +++ b/src/Analyzers/MSTest.Analyzers/RoslynAnalyzerHelpers/DiagnosticExtensions.cs @@ -137,7 +137,8 @@ public static Diagnostic CreateDiagnostic( => syntaxReference.GetSyntax(cancellationToken).CreateDiagnostic(rule, args); /// - /// This reflection-based workaround can be reverted once we move to Microsoft.CodeAnalysis version 3.0. + /// Reflection is used to read diagnostic severity overrides in a way that works across Microsoft.CodeAnalysis versions: + /// 'CompilationOptions.SyntaxTreeOptionsProvider' is preferred (>= 3.7) and the deprecated 'SyntaxTree.DiagnosticOptions' is used as a fallback (3.3 - 3.7). /// private static readonly PropertyInfo? s_syntaxTreeDiagnosticOptionsProperty = typeof(SyntaxTree).GetTypeInfo().GetDeclaredProperty("DiagnosticOptions"); From 7f7d53c701ec0ab458885cd1971929dfd0b78dd6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Amaury=20Lev=C3=A9?= Date: Mon, 13 Jul 2026 10:34:55 +0200 Subject: [PATCH 3/4] Address review: fix doc element, correct API name, clarify reference note Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 30a539c0-f7a1-4e63-b611-60b0fd18f12f --- .../Utilities/AppDomainUtilities.cs | 6 ++++-- .../AssertionArgsShouldAvoidConditionalAccessAnalyzer.cs | 2 +- .../TrxReportEngine.Metadata.cs | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/Adapter/MSTestAdapter.PlatformServices/Utilities/AppDomainUtilities.cs b/src/Adapter/MSTestAdapter.PlatformServices/Utilities/AppDomainUtilities.cs index 60ad6afdab..b1e530003d 100644 --- a/src/Adapter/MSTestAdapter.PlatformServices/Utilities/AppDomainUtilities.cs +++ b/src/Adapter/MSTestAdapter.PlatformServices/Utilities/AppDomainUtilities.cs @@ -68,9 +68,11 @@ internal static void SetAppDomainFrameworkVersionBasedOnTestSource(AppDomainSetu /// The path of the dll. /// /// - /// Framework string - /// Components/E2E tests could be added to cover these scenarios. + /// Framework string. /// + /// + /// Components/E2E tests could be added to cover these scenarios. + /// [SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1650:ElementDocumentationMustBeSpelledCorrectly", Justification = "Reviewed. Suppression is OK here.")] internal static string GetTargetFrameworkVersionString(string testSourcePath) { diff --git a/src/Analyzers/MSTest.Analyzers/AssertionArgsShouldAvoidConditionalAccessAnalyzer.cs b/src/Analyzers/MSTest.Analyzers/AssertionArgsShouldAvoidConditionalAccessAnalyzer.cs index ca810d5c02..66282fddf9 100644 --- a/src/Analyzers/MSTest.Analyzers/AssertionArgsShouldAvoidConditionalAccessAnalyzer.cs +++ b/src/Analyzers/MSTest.Analyzers/AssertionArgsShouldAvoidConditionalAccessAnalyzer.cs @@ -34,7 +34,7 @@ public sealed class AssertionArgsShouldAvoidConditionalAccessAnalyzer : Diagnost ("AreNotEqual", 2), ("AreEquivalent", 2), ("AreNotEquivalent", 2), - // It is unclear whether Assert.Contains(myCollection, expression_with_conditional_access) is genuinely problematic; a codefix may not always yield the correct result for this case. + // It is unclear whether CollectionAssert.Contains(myCollection, expression_with_conditional_access) is genuinely problematic; a codefix may not always yield the correct result for this case. // We might only need to check one argument (the collection itself). // Same applies to DoesNotContain ("Contains", 2), diff --git a/src/Platform/Microsoft.Testing.Extensions.TrxReport/TrxReportEngine.Metadata.cs b/src/Platform/Microsoft.Testing.Extensions.TrxReport/TrxReportEngine.Metadata.cs index e0ac947ebb..c11aba683c 100644 --- a/src/Platform/Microsoft.Testing.Extensions.TrxReport/TrxReportEngine.Metadata.cs +++ b/src/Platform/Microsoft.Testing.Extensions.TrxReport/TrxReportEngine.Metadata.cs @@ -60,7 +60,7 @@ private void AddResultSummary(XElement testRun, string resultSummaryOutcome, str if (_artifactsByExtension.Count != 0) { // VSTest seems to also add a ResultFiles element, and not only CollectorDataEntries. - // The VSTest implementation for Converter.ToCollectionEntries and Converter.ToResultFiles could be revised. + // Whether this reporter should also emit ResultFiles here could be revisited by referencing VSTest's Converter.ToCollectionEntries and Converter.ToResultFiles. var collectorDataEntries = new XElement(NamespaceUri + "CollectorDataEntries"); resultSummary.Add(collectorDataEntries); From 4ace370d2dfd2843764db04f1d807e03a8c3c828 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Amaury=20Lev=C3=A9?= Date: Mon, 13 Jul 2026 11:45:12 +0200 Subject: [PATCH 4/4] Address review: reword directive follow-up comments as declarative notes Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 30a539c0-f7a1-4e63-b611-60b0fd18f12f --- .../Microsoft.Testing.Extensions.TrxReport/TrxReportEngine.cs | 3 +-- .../Helpers/RunSettingsHelpers.cs | 2 +- .../TestFramework.Extensions/PrivateObject.Helpers.cs | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/Platform/Microsoft.Testing.Extensions.TrxReport/TrxReportEngine.cs b/src/Platform/Microsoft.Testing.Extensions.TrxReport/TrxReportEngine.cs index b69cb56a9f..d0d7aecd35 100644 --- a/src/Platform/Microsoft.Testing.Extensions.TrxReport/TrxReportEngine.cs +++ b/src/Platform/Microsoft.Testing.Extensions.TrxReport/TrxReportEngine.cs @@ -80,8 +80,7 @@ public TrxReportEngine( testRunId = Guid.NewGuid(); } - // The VSTest implementation seems to also add a "runUser" attribute. - // Revise that. + // Unlike the VSTest implementation, this reporter does not currently add a "runUser" attribute. testRun.SetAttributeValue("id", testRunId); string testRunName = $"{_environment.GetEnvironmentVariable("UserName")}@{_environment.MachineName} {FormatDateTimeForRunName(_clock.UtcNow)}"; testRun.SetAttributeValue("name", testRunName); diff --git a/src/Platform/Microsoft.Testing.Extensions.VSTestBridge/Helpers/RunSettingsHelpers.cs b/src/Platform/Microsoft.Testing.Extensions.VSTestBridge/Helpers/RunSettingsHelpers.cs index cb08f79a76..94a0726fbf 100644 --- a/src/Platform/Microsoft.Testing.Extensions.VSTestBridge/Helpers/RunSettingsHelpers.cs +++ b/src/Platform/Microsoft.Testing.Extensions.VSTestBridge/Helpers/RunSettingsHelpers.cs @@ -11,7 +11,7 @@ namespace Microsoft.Testing.Extensions.VSTestBridge.Helpers; internal static class RunSettingsHelpers { // There are two code paths that read runsettings. One calls the ICommandLineOptions overload, the other calls the CommandLineParseResult overload. - // Figure out if they can/should be unified so that we do one I/O operation instead of two. + // It is unclear whether they can/should be unified so that a single I/O operation is done instead of two. public static string ReadRunSettings(ICommandLineOptions commandLineOptions, IFileSystem fileSystem) { _ = commandLineOptions.TryGetOptionArgumentList(RunSettingsCommandLineOptionsProvider.RunSettingsOptionName, out string[]? fileNames); diff --git a/src/TestFramework/TestFramework.Extensions/PrivateObject.Helpers.cs b/src/TestFramework/TestFramework.Extensions/PrivateObject.Helpers.cs index 3fdbbffeae..a6b19ef357 100644 --- a/src/TestFramework/TestFramework.Extensions/PrivateObject.Helpers.cs +++ b/src/TestFramework/TestFramework.Extensions/PrivateObject.Helpers.cs @@ -81,7 +81,7 @@ private void BuildGenericMethodCacheForType(Type t) var finalCandidates = new MethodInfo[methodCandidates.Count]; methodCandidates.CopyTo(finalCandidates, 0); - // parameterTypes is asserted non-null above, so it should not be null here. + // parameterTypes is only asserted non-null in debug builds (see above), so the null check is kept as a defensive guard for release builds. if (parameterTypes == null || parameterTypes.Length != 0) { // Now that we have a preliminary list of candidates, select the most appropriate one.