diff --git a/TestPlatform.sln b/TestPlatform.sln index f526198810..db16cd0641 100644 --- a/TestPlatform.sln +++ b/TestPlatform.sln @@ -1043,6 +1043,7 @@ Global src\Microsoft.TestPlatform.Nullability\Microsoft.TestPlatform.Nullability.projitems*{76d4bb7e-d981-42d5-be96-6fad8def9a4a}*SharedItemsImports = 5 src\Microsoft.TestPlatform.Execution.Shared\Microsoft.TestPlatform.Execution.Shared.projitems*{7f26eda3-c8c4-4b7f-a9b6-d278c2f40a13}*SharedItemsImports = 13 src\Microsoft.TestPlatform.Nullability\Microsoft.TestPlatform.Nullability.projitems*{9df3bc3c-2a53-46e7-9291-40728ace5f82}*SharedItemsImports = 13 + src\Microsoft.TestPlatform.Nullability\Microsoft.TestPlatform.Nullability.projitems*{cae652af-6801-425e-aaf3-ab20de7df88e}*SharedItemsImports = 5 src\Microsoft.TestPlatform.Nullability\Microsoft.TestPlatform.Nullability.projitems*{fbf74c8f-695c-4967-84ac-358eefb1376d}*SharedItemsImports = 5 EndGlobalSection EndGlobal diff --git a/src/Microsoft.TestPlatform.CommunicationUtilities/Messages/MessageType.cs b/src/Microsoft.TestPlatform.CommunicationUtilities/Messages/MessageType.cs index 0eeb1fd355..0e78729547 100644 --- a/src/Microsoft.TestPlatform.CommunicationUtilities/Messages/MessageType.cs +++ b/src/Microsoft.TestPlatform.CommunicationUtilities/Messages/MessageType.cs @@ -1,8 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. -using System; - using Microsoft.VisualStudio.TestPlatform.ObjectModel; using Microsoft.VisualStudio.TestPlatform.ObjectModel.Client; diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Adapter/FrameworkHandle.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/Adapter/FrameworkHandle.cs index 3fafe2a784..9e19a7c39c 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Adapter/FrameworkHandle.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Adapter/FrameworkHandle.cs @@ -12,7 +12,6 @@ using Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.Interfaces; using Microsoft.VisualStudio.TestPlatform.ObjectModel.Engine; using Microsoft.VisualStudio.TestPlatform.ObjectModel.Engine.ClientProtocol; -using Microsoft.VisualStudio.TestPlatform.PlatformAbstractions; using CrossPlatEngineResources = Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Resources.Resources; @@ -75,7 +74,7 @@ public FrameworkHandle(ITestCaseEventsHandler testCaseEventsHandler, ITestRunCac public int LaunchProcessWithDebuggerAttached(string filePath, string workingDirectory, string arguments, IDictionary environmentVariables) { // If an adapter attempts to launch a process after the run is complete (=> this object is disposed) - // throw an error. + // throw an error. if (_isDisposed) { throw new ObjectDisposedException("IFrameworkHandle"); diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/TestEngine.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/TestEngine.cs index a8600ab563..5e61617f1a 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/TestEngine.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/TestEngine.cs @@ -7,7 +7,6 @@ using System.Linq; using System.Text; -using Microsoft.VisualStudio.TestPlatform.Common; using Microsoft.VisualStudio.TestPlatform.Common.Hosting; using Microsoft.VisualStudio.TestPlatform.Common.Logging; using Microsoft.VisualStudio.TestPlatform.Common.Telemetry; diff --git a/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/ProcDumpDumper.cs b/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/ProcDumpDumper.cs index 4118b316c0..f5767f1af8 100644 --- a/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/ProcDumpDumper.cs +++ b/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/ProcDumpDumper.cs @@ -48,7 +48,7 @@ public ProcDumpDumper(IProcessHelper processHelper, IFileHelper fileHelper, IEnv _environment = environment; } - protected Action OutputReceivedCallback => (process, data) => + protected Action OutputReceivedCallback => (process, data) => // useful for visibility when debugging this tool // Console.ForegroundColor = ConsoleColor.Cyan; // Console.WriteLine(data); diff --git a/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/PublicAPI/PublicAPI.Shipped.txt b/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/PublicAPI/PublicAPI.Shipped.txt index a4a8ba823e..c9f6f04366 100644 --- a/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/PublicAPI/PublicAPI.Shipped.txt +++ b/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/PublicAPI/PublicAPI.Shipped.txt @@ -72,7 +72,7 @@ Microsoft.TestPlatform.Extensions.BlameDataCollector.ProcDumpDumper.AttachToTarg Microsoft.TestPlatform.Extensions.BlameDataCollector.ProcDumpDumper.DetachFromTargetProcess(int targetProcessId) -> void Microsoft.TestPlatform.Extensions.BlameDataCollector.ProcDumpDumper.Dump(int processId, string! outputDirectory, Microsoft.TestPlatform.Extensions.BlameDataCollector.DumpTypeOption dumpType) -> void Microsoft.TestPlatform.Extensions.BlameDataCollector.ProcDumpDumper.GetDumpFiles(bool processCrashed) -> System.Collections.Generic.IEnumerable! -Microsoft.TestPlatform.Extensions.BlameDataCollector.ProcDumpDumper.OutputReceivedCallback.get -> System.Action! +Microsoft.TestPlatform.Extensions.BlameDataCollector.ProcDumpDumper.OutputReceivedCallback.get -> System.Action! Microsoft.TestPlatform.Extensions.BlameDataCollector.ProcDumpDumper.ProcDumpDumper() -> void Microsoft.TestPlatform.Extensions.BlameDataCollector.ProcDumpDumper.ProcDumpDumper(Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.Interfaces.IProcessHelper! processHelper, Microsoft.VisualStudio.TestPlatform.Utilities.Helpers.Interfaces.IFileHelper! fileHelper, Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.Interfaces.IEnvironment! environment, Microsoft.TestPlatform.Extensions.BlameDataCollector.INativeMethodsHelper? nativeMethodsHelper) -> void Microsoft.TestPlatform.Extensions.BlameDataCollector.ProcDumpDumper.WaitForDumpToFinish() -> void diff --git a/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/WindowsHangDumper.cs b/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/WindowsHangDumper.cs index ab636bed59..2dd1ad4c8e 100644 --- a/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/WindowsHangDumper.cs +++ b/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/WindowsHangDumper.cs @@ -27,7 +27,7 @@ public WindowsHangDumper(IProcessHelper processHelper, Action? logWarnin _processHelper = processHelper; } - private static Action OutputReceivedCallback => (process, data) => + private static Action OutputReceivedCallback => (process, data) => // useful for visibility when debugging this tool // Console.ForegroundColor = ConsoleColor.Cyan; // Console.WriteLine(data); diff --git a/src/Microsoft.TestPlatform.PlatformAbstractions/Interfaces/IO/IStream.cs b/src/Microsoft.TestPlatform.PlatformAbstractions/Interfaces/IO/IStream.cs index 39286513fa..1c3be3afd4 100644 --- a/src/Microsoft.TestPlatform.PlatformAbstractions/Interfaces/IO/IStream.cs +++ b/src/Microsoft.TestPlatform.PlatformAbstractions/Interfaces/IO/IStream.cs @@ -3,8 +3,6 @@ using System.IO; -#nullable disable - namespace Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.Interfaces; /// diff --git a/src/Microsoft.TestPlatform.PlatformAbstractions/Interfaces/Runtime/IAssemblyLoadContext.cs b/src/Microsoft.TestPlatform.PlatformAbstractions/Interfaces/Runtime/IAssemblyLoadContext.cs index c232076c2b..4de9220947 100644 --- a/src/Microsoft.TestPlatform.PlatformAbstractions/Interfaces/Runtime/IAssemblyLoadContext.cs +++ b/src/Microsoft.TestPlatform.PlatformAbstractions/Interfaces/Runtime/IAssemblyLoadContext.cs @@ -3,8 +3,6 @@ using System.Reflection; -#nullable disable - namespace Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.Interfaces; /// diff --git a/src/Microsoft.TestPlatform.PlatformAbstractions/Interfaces/Runtime/IAssemblyResolver.cs b/src/Microsoft.TestPlatform.PlatformAbstractions/Interfaces/Runtime/IAssemblyResolver.cs index 2d251c5ad0..b59b07d6db 100644 --- a/src/Microsoft.TestPlatform.PlatformAbstractions/Interfaces/Runtime/IAssemblyResolver.cs +++ b/src/Microsoft.TestPlatform.PlatformAbstractions/Interfaces/Runtime/IAssemblyResolver.cs @@ -4,8 +4,6 @@ using System; using System.Reflection; -#nullable disable - namespace Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.Interfaces; /// @@ -16,7 +14,7 @@ namespace Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.Interfaces; /// The assembly that resolves the type, assembly, or resource; or null if the assembly /// cannot be resolved. /// -public delegate Assembly AssemblyResolveEventHandler(object sender, AssemblyResolveEventArgs args); +public delegate Assembly AssemblyResolveEventHandler(object? sender, AssemblyResolveEventArgs? args); /// /// The AssemblyResolver interface. @@ -26,7 +24,7 @@ public interface IAssemblyResolver : IDisposable /// /// Occurs when the resolution of an assembly fails /// - event AssemblyResolveEventHandler AssemblyResolve; + event AssemblyResolveEventHandler? AssemblyResolve; } /// diff --git a/src/Microsoft.TestPlatform.PlatformAbstractions/Interfaces/System/IEnvironment.cs b/src/Microsoft.TestPlatform.PlatformAbstractions/Interfaces/System/IEnvironment.cs index ff62a3107d..6e3e745cb1 100644 --- a/src/Microsoft.TestPlatform.PlatformAbstractions/Interfaces/System/IEnvironment.cs +++ b/src/Microsoft.TestPlatform.PlatformAbstractions/Interfaces/System/IEnvironment.cs @@ -1,8 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. -#nullable disable - namespace Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.Interfaces; /// diff --git a/src/Microsoft.TestPlatform.PlatformAbstractions/Interfaces/System/IProcessHelper.cs b/src/Microsoft.TestPlatform.PlatformAbstractions/Interfaces/System/IProcessHelper.cs index 7ca3488f8e..e524c43a25 100644 --- a/src/Microsoft.TestPlatform.PlatformAbstractions/Interfaces/System/IProcessHelper.cs +++ b/src/Microsoft.TestPlatform.PlatformAbstractions/Interfaces/System/IProcessHelper.cs @@ -4,8 +4,6 @@ using System; using System.Collections.Generic; -#nullable disable - namespace Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.Interfaces; /// @@ -24,7 +22,7 @@ public interface IProcessHelper /// Call back for on process exit /// Call back for on process output /// The process created. - object LaunchProcess(string processPath, string arguments, string workingDirectory, IDictionary environmentVariables, Action errorCallback, Action exitCallBack, Action outputCallback); + object LaunchProcess(string processPath, string arguments, string workingDirectory, IDictionary? envVariables, Action? errorCallback, Action? exitCallBack, Action? outputCallBack); /// /// Gets the current process file path. @@ -73,7 +71,7 @@ public interface IProcessHelper /// /// process parameter /// process id. - int GetProcessId(object process); + int GetProcessId(object? process); /// /// Gets the process name for given process id. @@ -88,7 +86,7 @@ public interface IProcessHelper /// process parameter /// return value of exitCode /// False if process has not exited, True otherwise - bool TryGetExitCode(object process, out int exitCode); + bool TryGetExitCode(object? process, out int exitCode); /// /// Sets the process exit callback. @@ -99,19 +97,19 @@ public interface IProcessHelper /// /// Callback on process exit. /// - void SetExitCallback(int processId, Action callbackAction); + void SetExitCallback(int processId, Action? callbackAction); /// /// Terminates a process. /// /// Reference of process to terminate. - void TerminateProcess(object process); + void TerminateProcess(object? process); /// /// Wait for process to exit /// /// Reference to process - void WaitForProcessExit(object process); + void WaitForProcessExit(object? process); /// /// Gets the process handle for given process Id. diff --git a/src/Microsoft.TestPlatform.PlatformAbstractions/Interfaces/System/IThread.cs b/src/Microsoft.TestPlatform.PlatformAbstractions/Interfaces/System/IThread.cs index 6c73e627c7..eac70a45ee 100644 --- a/src/Microsoft.TestPlatform.PlatformAbstractions/Interfaces/System/IThread.cs +++ b/src/Microsoft.TestPlatform.PlatformAbstractions/Interfaces/System/IThread.cs @@ -3,8 +3,6 @@ using System; -#nullable disable - namespace Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.Interfaces; public interface IThread @@ -16,5 +14,5 @@ public interface IThread /// The apartment state. /// True for running in Sync, False for running in Async /// When thread apartment state not supported for platform. > - void Run(Action action, PlatformApartmentState apartmentState, bool waitForCompletion); + void Run(Action? action, PlatformApartmentState apartmentState, bool waitForCompletion); } diff --git a/src/Microsoft.TestPlatform.PlatformAbstractions/Interfaces/System/PlatformApartmentState.cs b/src/Microsoft.TestPlatform.PlatformAbstractions/Interfaces/System/PlatformApartmentState.cs index dfa5dbb6a4..7267f586ab 100644 --- a/src/Microsoft.TestPlatform.PlatformAbstractions/Interfaces/System/PlatformApartmentState.cs +++ b/src/Microsoft.TestPlatform.PlatformAbstractions/Interfaces/System/PlatformApartmentState.cs @@ -1,8 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. -#nullable disable - namespace Microsoft.VisualStudio.TestPlatform.PlatformAbstractions; /// diff --git a/src/Microsoft.TestPlatform.PlatformAbstractions/Interfaces/System/PlatformArchitecture.cs b/src/Microsoft.TestPlatform.PlatformAbstractions/Interfaces/System/PlatformArchitecture.cs index 018d936804..b1d477c7d3 100644 --- a/src/Microsoft.TestPlatform.PlatformAbstractions/Interfaces/System/PlatformArchitecture.cs +++ b/src/Microsoft.TestPlatform.PlatformAbstractions/Interfaces/System/PlatformArchitecture.cs @@ -1,8 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. -#nullable disable - namespace Microsoft.VisualStudio.TestPlatform.PlatformAbstractions; /// diff --git a/src/Microsoft.TestPlatform.PlatformAbstractions/Interfaces/System/PlatformOperatingSystem.cs b/src/Microsoft.TestPlatform.PlatformAbstractions/Interfaces/System/PlatformOperatingSystem.cs index c8ba6ecdf0..94515fe380 100644 --- a/src/Microsoft.TestPlatform.PlatformAbstractions/Interfaces/System/PlatformOperatingSystem.cs +++ b/src/Microsoft.TestPlatform.PlatformAbstractions/Interfaces/System/PlatformOperatingSystem.cs @@ -1,8 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. -#nullable disable - namespace Microsoft.VisualStudio.TestPlatform.PlatformAbstractions; /// diff --git a/src/Microsoft.TestPlatform.PlatformAbstractions/Interfaces/System/ThreadApartmentStateNotSupportedException.cs b/src/Microsoft.TestPlatform.PlatformAbstractions/Interfaces/System/ThreadApartmentStateNotSupportedException.cs index 34c8aa481f..eee94a5adf 100644 --- a/src/Microsoft.TestPlatform.PlatformAbstractions/Interfaces/System/ThreadApartmentStateNotSupportedException.cs +++ b/src/Microsoft.TestPlatform.PlatformAbstractions/Interfaces/System/ThreadApartmentStateNotSupportedException.cs @@ -3,8 +3,6 @@ using System; -#nullable disable - namespace Microsoft.VisualStudio.TestPlatform.PlatformAbstractions; /// @@ -26,7 +24,7 @@ public ThreadApartmentStateNotSupportedException() /// Initializes with the message. /// /// Message for the exception. - public ThreadApartmentStateNotSupportedException(string message) + public ThreadApartmentStateNotSupportedException(string? message) : base(message) { } @@ -37,7 +35,7 @@ public ThreadApartmentStateNotSupportedException(string message) /// /// Message for the exception. /// The inner exception. - public ThreadApartmentStateNotSupportedException(string message, Exception innerException) + public ThreadApartmentStateNotSupportedException(string? message, Exception? innerException) : base(message, innerException) { } diff --git a/src/Microsoft.TestPlatform.PlatformAbstractions/Interfaces/Tracing/IPlatformEqtTrace.cs b/src/Microsoft.TestPlatform.PlatformAbstractions/Interfaces/Tracing/IPlatformEqtTrace.cs index 499e8b1dda..ea01d92123 100644 --- a/src/Microsoft.TestPlatform.PlatformAbstractions/Interfaces/Tracing/IPlatformEqtTrace.cs +++ b/src/Microsoft.TestPlatform.PlatformAbstractions/Interfaces/Tracing/IPlatformEqtTrace.cs @@ -1,8 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. -#nullable disable - namespace Microsoft.VisualStudio.TestPlatform.ObjectModel; /// @@ -59,7 +57,7 @@ bool DoNotInitialize /// Gets file path for trace log file. /// /// True if tracing is enabled. - string GetLogFile(); + string? GetLogFile(); /// /// Sets platform specific trace value for tracing verbosity. diff --git a/src/Microsoft.TestPlatform.PlatformAbstractions/Interfaces/Tracing/PlatformTraceLevel.cs b/src/Microsoft.TestPlatform.PlatformAbstractions/Interfaces/Tracing/PlatformTraceLevel.cs index 8a8da1f553..b01a5293dc 100644 --- a/src/Microsoft.TestPlatform.PlatformAbstractions/Interfaces/Tracing/PlatformTraceLevel.cs +++ b/src/Microsoft.TestPlatform.PlatformAbstractions/Interfaces/Tracing/PlatformTraceLevel.cs @@ -1,8 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. -#nullable disable - namespace Microsoft.VisualStudio.TestPlatform.ObjectModel; public enum PlatformTraceLevel diff --git a/src/Microsoft.TestPlatform.PlatformAbstractions/Microsoft.TestPlatform.PlatformAbstractions.csproj b/src/Microsoft.TestPlatform.PlatformAbstractions/Microsoft.TestPlatform.PlatformAbstractions.csproj index e927847a2a..e4676ee4cf 100644 --- a/src/Microsoft.TestPlatform.PlatformAbstractions/Microsoft.TestPlatform.PlatformAbstractions.csproj +++ b/src/Microsoft.TestPlatform.PlatformAbstractions/Microsoft.TestPlatform.PlatformAbstractions.csproj @@ -3,6 +3,7 @@ ..\..\ + Microsoft.TestPlatform.PlatformAbstractions diff --git a/src/Microsoft.TestPlatform.PlatformAbstractions/PublicAPI/PublicAPI.Shipped.txt b/src/Microsoft.TestPlatform.PlatformAbstractions/PublicAPI/PublicAPI.Shipped.txt index 1e19a7cdd2..9a6ec487a0 100644 --- a/src/Microsoft.TestPlatform.PlatformAbstractions/PublicAPI/PublicAPI.Shipped.txt +++ b/src/Microsoft.TestPlatform.PlatformAbstractions/PublicAPI/PublicAPI.Shipped.txt @@ -1,19 +1,20 @@ -Microsoft.VisualStudio.TestPlatform.ObjectModel.IPlatformEqtTrace +#nullable enable +Microsoft.VisualStudio.TestPlatform.ObjectModel.IPlatformEqtTrace Microsoft.VisualStudio.TestPlatform.ObjectModel.IPlatformEqtTrace.DoNotInitialize.get -> bool Microsoft.VisualStudio.TestPlatform.ObjectModel.IPlatformEqtTrace.DoNotInitialize.set -> void -Microsoft.VisualStudio.TestPlatform.ObjectModel.IPlatformEqtTrace.GetLogFile() -> string +Microsoft.VisualStudio.TestPlatform.ObjectModel.IPlatformEqtTrace.GetLogFile() -> string? Microsoft.VisualStudio.TestPlatform.ObjectModel.IPlatformEqtTrace.GetTraceLevel() -> Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformTraceLevel -Microsoft.VisualStudio.TestPlatform.ObjectModel.IPlatformEqtTrace.InitializeTrace(string customLogFile, Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformTraceLevel traceLevel) -> bool -Microsoft.VisualStudio.TestPlatform.ObjectModel.IPlatformEqtTrace.InitializeVerboseTrace(string customLogFile) -> bool +Microsoft.VisualStudio.TestPlatform.ObjectModel.IPlatformEqtTrace.InitializeTrace(string! customLogFile, Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformTraceLevel traceLevel) -> bool +Microsoft.VisualStudio.TestPlatform.ObjectModel.IPlatformEqtTrace.InitializeVerboseTrace(string! customLogFile) -> bool Microsoft.VisualStudio.TestPlatform.ObjectModel.IPlatformEqtTrace.SetTraceLevel(Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformTraceLevel value) -> void Microsoft.VisualStudio.TestPlatform.ObjectModel.IPlatformEqtTrace.ShouldTrace(Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformTraceLevel traceLevel) -> bool -Microsoft.VisualStudio.TestPlatform.ObjectModel.IPlatformEqtTrace.WriteLine(Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformTraceLevel level, string message) -> void +Microsoft.VisualStudio.TestPlatform.ObjectModel.IPlatformEqtTrace.WriteLine(Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformTraceLevel level, string! message) -> void Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformEqtTrace Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformEqtTrace.DoNotInitialize.get -> bool Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformEqtTrace.DoNotInitialize.set -> void -Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformEqtTrace.GetLogFile() -> string +Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformEqtTrace.GetLogFile() -> string? Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformEqtTrace.GetTraceLevel() -> Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformTraceLevel -Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformEqtTrace.InitializeVerboseTrace(string customLogFile) -> bool +Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformEqtTrace.InitializeVerboseTrace(string! customLogFile) -> bool Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformEqtTrace.PlatformEqtTrace() -> void Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformEqtTrace.SetTraceLevel(Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformTraceLevel value) -> void Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformEqtTrace.ShouldTrace(Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformTraceLevel traceLevel) -> bool @@ -24,40 +25,40 @@ Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformTraceLevel.Off = 0 -> Mi Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformTraceLevel.Verbose = 4 -> Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformTraceLevel Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformTraceLevel.Warning = 2 -> Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformTraceLevel Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.Interfaces.AssemblyResolveEventArgs -Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.Interfaces.AssemblyResolveEventArgs.AssemblyResolveEventArgs(string name) -> void -Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.Interfaces.AssemblyResolveEventArgs.Name.get -> string +Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.Interfaces.AssemblyResolveEventArgs.AssemblyResolveEventArgs(string! name) -> void +Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.Interfaces.AssemblyResolveEventArgs.Name.get -> string! Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.Interfaces.AssemblyResolveEventArgs.Name.set -> void Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.Interfaces.AssemblyResolveEventHandler Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.Interfaces.IAssemblyLoadContext -Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.Interfaces.IAssemblyLoadContext.GetAssemblyNameFromPath(string assemblyPath) -> System.Reflection.AssemblyName -Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.Interfaces.IAssemblyLoadContext.LoadAssemblyFromPath(string assemblyPath) -> System.Reflection.Assembly +Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.Interfaces.IAssemblyLoadContext.GetAssemblyNameFromPath(string! assemblyPath) -> System.Reflection.AssemblyName! +Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.Interfaces.IAssemblyLoadContext.LoadAssemblyFromPath(string! assemblyPath) -> System.Reflection.Assembly! Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.Interfaces.IAssemblyResolver -Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.Interfaces.IAssemblyResolver.AssemblyResolve -> Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.Interfaces.AssemblyResolveEventHandler +Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.Interfaces.IAssemblyResolver.AssemblyResolve -> Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.Interfaces.AssemblyResolveEventHandler? Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.Interfaces.IEnvironment Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.Interfaces.IEnvironment.Architecture.get -> Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.PlatformArchitecture Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.Interfaces.IEnvironment.Exit(int exitcode) -> void Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.Interfaces.IEnvironment.GetCurrentManagedThreadId() -> int Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.Interfaces.IEnvironment.OperatingSystem.get -> Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.PlatformOperatingSystem -Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.Interfaces.IEnvironment.OperatingSystemVersion.get -> string +Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.Interfaces.IEnvironment.OperatingSystemVersion.get -> string! Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.Interfaces.IProcessHelper Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.Interfaces.IProcessHelper.GetCurrentProcessArchitecture() -> Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.PlatformArchitecture -Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.Interfaces.IProcessHelper.GetCurrentProcessFileName() -> string +Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.Interfaces.IProcessHelper.GetCurrentProcessFileName() -> string! Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.Interfaces.IProcessHelper.GetCurrentProcessId() -> int -Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.Interfaces.IProcessHelper.GetCurrentProcessLocation() -> string -Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.Interfaces.IProcessHelper.GetNativeDllDirectory() -> string +Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.Interfaces.IProcessHelper.GetCurrentProcessLocation() -> string! +Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.Interfaces.IProcessHelper.GetNativeDllDirectory() -> string! Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.Interfaces.IProcessHelper.GetProcessHandle(int processId) -> System.IntPtr -Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.Interfaces.IProcessHelper.GetProcessId(object process) -> int -Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.Interfaces.IProcessHelper.GetProcessName(int processId) -> string -Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.Interfaces.IProcessHelper.GetTestEngineDirectory() -> string -Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.Interfaces.IProcessHelper.LaunchProcess(string processPath, string arguments, string workingDirectory, System.Collections.Generic.IDictionary environmentVariables, System.Action errorCallback, System.Action exitCallBack, System.Action outputCallback) -> object -Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.Interfaces.IProcessHelper.SetExitCallback(int processId, System.Action callbackAction) -> void -Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.Interfaces.IProcessHelper.TerminateProcess(object process) -> void -Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.Interfaces.IProcessHelper.TryGetExitCode(object process, out int exitCode) -> bool -Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.Interfaces.IProcessHelper.WaitForProcessExit(object process) -> void +Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.Interfaces.IProcessHelper.GetProcessId(object? process) -> int +Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.Interfaces.IProcessHelper.GetProcessName(int processId) -> string! +Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.Interfaces.IProcessHelper.GetTestEngineDirectory() -> string! +Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.Interfaces.IProcessHelper.LaunchProcess(string! processPath, string! arguments, string! workingDirectory, System.Collections.Generic.IDictionary? envVariables, System.Action? errorCallback, System.Action? exitCallBack, System.Action? outputCallBack) -> object! +Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.Interfaces.IProcessHelper.SetExitCallback(int processId, System.Action? callbackAction) -> void +Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.Interfaces.IProcessHelper.TerminateProcess(object? process) -> void +Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.Interfaces.IProcessHelper.TryGetExitCode(object? process, out int exitCode) -> bool +Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.Interfaces.IProcessHelper.WaitForProcessExit(object? process) -> void Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.Interfaces.IStream -Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.Interfaces.IStream.CreateBufferedStream(System.IO.Stream stream, int bufferSize) -> System.IO.Stream +Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.Interfaces.IStream.CreateBufferedStream(System.IO.Stream! stream, int bufferSize) -> System.IO.Stream! Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.Interfaces.IThread -Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.Interfaces.IThread.Run(System.Action action, Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.PlatformApartmentState apartmentState, bool waitForCompletion) -> void +Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.Interfaces.IThread.Run(System.Action? action, Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.PlatformApartmentState apartmentState, bool waitForCompletion) -> void Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.PlatformApartmentState Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.PlatformApartmentState.MTA = 0 -> Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.PlatformApartmentState Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.PlatformApartmentState.STA = 1 -> Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.PlatformApartmentState @@ -69,11 +70,11 @@ Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.PlatformArchitecture.X6 Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.PlatformArchitecture.X86 = 0 -> Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.PlatformArchitecture Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.PlatformAssemblyExtensions Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.PlatformAssemblyLoadContext -Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.PlatformAssemblyLoadContext.GetAssemblyNameFromPath(string assemblyPath) -> System.Reflection.AssemblyName -Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.PlatformAssemblyLoadContext.LoadAssemblyFromPath(string assemblyPath) -> System.Reflection.Assembly +Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.PlatformAssemblyLoadContext.GetAssemblyNameFromPath(string! assemblyPath) -> System.Reflection.AssemblyName! +Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.PlatformAssemblyLoadContext.LoadAssemblyFromPath(string! assemblyPath) -> System.Reflection.Assembly! Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.PlatformAssemblyLoadContext.PlatformAssemblyLoadContext() -> void Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.PlatformAssemblyResolver -Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.PlatformAssemblyResolver.AssemblyResolve -> Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.Interfaces.AssemblyResolveEventHandler +Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.PlatformAssemblyResolver.AssemblyResolve -> Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.Interfaces.AssemblyResolveEventHandler? Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.PlatformAssemblyResolver.Dispose() -> void Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.PlatformAssemblyResolver.PlatformAssemblyResolver() -> void Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.PlatformEnvironment @@ -81,38 +82,38 @@ Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.PlatformEnvironment.Arc Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.PlatformEnvironment.Exit(int exitcode) -> void Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.PlatformEnvironment.GetCurrentManagedThreadId() -> int Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.PlatformEnvironment.OperatingSystem.get -> Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.PlatformOperatingSystem -Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.PlatformEnvironment.OperatingSystemVersion.get -> string +Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.PlatformEnvironment.OperatingSystemVersion.get -> string! Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.PlatformEnvironment.PlatformEnvironment() -> void Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.PlatformOperatingSystem Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.PlatformOperatingSystem.OSX = 2 -> Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.PlatformOperatingSystem Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.PlatformOperatingSystem.Unix = 1 -> Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.PlatformOperatingSystem Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.PlatformOperatingSystem.Windows = 0 -> Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.PlatformOperatingSystem Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.PlatformStream -Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.PlatformStream.CreateBufferedStream(System.IO.Stream stream, int bufferSize) -> System.IO.Stream +Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.PlatformStream.CreateBufferedStream(System.IO.Stream! stream, int bufferSize) -> System.IO.Stream! Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.PlatformStream.PlatformStream() -> void Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.PlatformThread Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.PlatformThread.PlatformThread() -> void Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.ProcessHelper Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.ProcessHelper.GetCurrentProcessArchitecture() -> Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.PlatformArchitecture -Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.ProcessHelper.GetCurrentProcessFileName() -> string +Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.ProcessHelper.GetCurrentProcessFileName() -> string! Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.ProcessHelper.GetCurrentProcessId() -> int -Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.ProcessHelper.GetCurrentProcessLocation() -> string -Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.ProcessHelper.GetNativeDllDirectory() -> string +Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.ProcessHelper.GetCurrentProcessLocation() -> string! +Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.ProcessHelper.GetNativeDllDirectory() -> string! Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.ProcessHelper.GetProcessHandle(int processId) -> System.IntPtr -Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.ProcessHelper.GetProcessId(object process) -> int -Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.ProcessHelper.GetProcessName(int processId) -> string -Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.ProcessHelper.GetTestEngineDirectory() -> string +Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.ProcessHelper.GetProcessId(object? process) -> int +Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.ProcessHelper.GetProcessName(int processId) -> string! +Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.ProcessHelper.GetTestEngineDirectory() -> string! Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.ProcessHelper.ProcessHelper() -> void -Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.ProcessHelper.TerminateProcess(object process) -> void -Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.ProcessHelper.TryGetExitCode(object process, out int exitCode) -> bool -Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.ProcessHelper.WaitForProcessExit(object process) -> void +Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.ProcessHelper.TerminateProcess(object? process) -> void +Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.ProcessHelper.TryGetExitCode(object? process, out int exitCode) -> bool +Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.ProcessHelper.WaitForProcessExit(object? process) -> void Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.ThreadApartmentStateNotSupportedException Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.ThreadApartmentStateNotSupportedException.ThreadApartmentStateNotSupportedException() -> void -Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.ThreadApartmentStateNotSupportedException.ThreadApartmentStateNotSupportedException(string message) -> void -Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.ThreadApartmentStateNotSupportedException.ThreadApartmentStateNotSupportedException(string message, System.Exception innerException) -> void -static Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformEqtTrace.ErrorOnInitialization.get -> string +Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.ThreadApartmentStateNotSupportedException.ThreadApartmentStateNotSupportedException(string? message) -> void +Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.ThreadApartmentStateNotSupportedException.ThreadApartmentStateNotSupportedException(string? message, System.Exception? innerException) -> void +static Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformEqtTrace.ErrorOnInitialization.get -> string? static Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformEqtTrace.ErrorOnInitialization.set -> void -static Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.PlatformAssemblyExtensions.GetAssemblyLocation(this System.Reflection.Assembly assembly) -> string +static Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.PlatformAssemblyExtensions.GetAssemblyLocation(this System.Reflection.Assembly! assembly) -> string! Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.Interfaces.IProcessHelper.GetProcessArchitecture(int processId) -> Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.PlatformArchitecture Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.ProcessHelper.GetProcessArchitecture(int processId) -> Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.PlatformArchitecture diff --git a/src/Microsoft.TestPlatform.PlatformAbstractions/PublicAPI/net45/PublicAPI.Shipped.txt b/src/Microsoft.TestPlatform.PlatformAbstractions/PublicAPI/net45/PublicAPI.Shipped.txt index 900229a3de..601ba4ffde 100644 --- a/src/Microsoft.TestPlatform.PlatformAbstractions/PublicAPI/net45/PublicAPI.Shipped.txt +++ b/src/Microsoft.TestPlatform.PlatformAbstractions/PublicAPI/net45/PublicAPI.Shipped.txt @@ -1,25 +1,26 @@ -Microsoft.VisualStudio.TestPlatform.ObjectModel.IPlatformEqtTrace.SetupListener(System.Diagnostics.TraceListener listener) -> void -Microsoft.VisualStudio.TestPlatform.ObjectModel.IPlatformEqtTrace.SetupRemoteEqtTraceListeners(System.AppDomain childDomain) -> void -Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformEqtTrace.InitializeTrace(string customLogFile, Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformTraceLevel platformTraceLevel) -> bool +#nullable enable +Microsoft.VisualStudio.TestPlatform.ObjectModel.IPlatformEqtTrace.SetupListener(System.Diagnostics.TraceListener? listener) -> void +Microsoft.VisualStudio.TestPlatform.ObjectModel.IPlatformEqtTrace.SetupRemoteEqtTraceListeners(System.AppDomain? childDomain) -> void +Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformEqtTrace.InitializeTrace(string! customLogFile, Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformTraceLevel platformTraceLevel) -> bool Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformEqtTrace.MapPlatformTraceToTrace(Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformTraceLevel traceLevel) -> System.Diagnostics.TraceLevel -Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformEqtTrace.SetupListener(System.Diagnostics.TraceListener listener) -> void -Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformEqtTrace.SetupRemoteEqtTraceListeners(System.AppDomain childDomain) -> void -Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformEqtTrace.WriteLine(Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformTraceLevel level, string message) -> void +Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformEqtTrace.SetupListener(System.Diagnostics.TraceListener? listener) -> void +Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformEqtTrace.SetupRemoteEqtTraceListeners(System.AppDomain? childDomain) -> void +Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformEqtTrace.WriteLine(Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformTraceLevel level, string! message) -> void Microsoft.VisualStudio.TestPlatform.ObjectModel.RemoteEqtTrace Microsoft.VisualStudio.TestPlatform.ObjectModel.RemoteEqtTrace.RemoteEqtTrace() -> void Microsoft.VisualStudio.TestPlatform.ObjectModel.RemoteEqtTrace.TraceLevel.get -> System.Diagnostics.TraceLevel Microsoft.VisualStudio.TestPlatform.ObjectModel.RemoteEqtTrace.TraceLevel.set -> void Microsoft.VisualStudio.TestPlatform.ObjectModel.RollingFileTraceListener -Microsoft.VisualStudio.TestPlatform.ObjectModel.RollingFileTraceListener.RollingFileTraceListener(string fileName, string name, int rollSizeKB) -> void +Microsoft.VisualStudio.TestPlatform.ObjectModel.RollingFileTraceListener.RollingFileTraceListener(string! fileName, string! name, int rollSizeKB) -> void Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.PlatformAssemblyResolver.Dispose(bool disposing) -> void Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.PlatformAssemblyResolver.~PlatformAssemblyResolver() -> void -Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.PlatformThread.Run(System.Action action, Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.PlatformApartmentState apartmentState, bool waitForCompletion) -> void -Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.ProcessHelper.LaunchProcess(string processPath, string arguments, string workingDirectory, System.Collections.Generic.IDictionary envVariables, System.Action errorCallback, System.Action exitCallBack, System.Action outputCallBack) -> object -Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.ProcessHelper.SetExitCallback(int processId, System.Action callbackAction) -> void +Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.PlatformThread.Run(System.Action? action, Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.PlatformApartmentState apartmentState, bool waitForCompletion) -> void +Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.ProcessHelper.LaunchProcess(string! processPath, string! arguments, string! workingDirectory, System.Collections.Generic.IDictionary? envVariables, System.Action? errorCallback, System.Action? exitCallBack, System.Action? outputCallBack) -> object! +Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.ProcessHelper.SetExitCallback(int processId, System.Action? callbackAction) -> void Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.ProcessStartInfoExtensions override Microsoft.VisualStudio.TestPlatform.ObjectModel.RollingFileTraceListener.Dispose(bool disposing) -> void -override Microsoft.VisualStudio.TestPlatform.ObjectModel.RollingFileTraceListener.WriteLine(string message) -> void -static Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformEqtTrace.LogFile.get -> string +override Microsoft.VisualStudio.TestPlatform.ObjectModel.RollingFileTraceListener.WriteLine(string! message) -> void +static Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformEqtTrace.LogFile.get -> string? static Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformEqtTrace.TraceLevel.get -> System.Diagnostics.TraceLevel static Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformEqtTrace.TraceLevel.set -> void -static Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.ProcessStartInfoExtensions.AddEnvironmentVariable(this System.Diagnostics.ProcessStartInfo startInfo, string name, string value) -> void +static Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.ProcessStartInfoExtensions.AddEnvironmentVariable(this System.Diagnostics.ProcessStartInfo! startInfo, string! name, string? value) -> void diff --git a/src/Microsoft.TestPlatform.PlatformAbstractions/PublicAPI/net451/PublicAPI.Shipped.txt b/src/Microsoft.TestPlatform.PlatformAbstractions/PublicAPI/net451/PublicAPI.Shipped.txt index 900229a3de..601ba4ffde 100644 --- a/src/Microsoft.TestPlatform.PlatformAbstractions/PublicAPI/net451/PublicAPI.Shipped.txt +++ b/src/Microsoft.TestPlatform.PlatformAbstractions/PublicAPI/net451/PublicAPI.Shipped.txt @@ -1,25 +1,26 @@ -Microsoft.VisualStudio.TestPlatform.ObjectModel.IPlatformEqtTrace.SetupListener(System.Diagnostics.TraceListener listener) -> void -Microsoft.VisualStudio.TestPlatform.ObjectModel.IPlatformEqtTrace.SetupRemoteEqtTraceListeners(System.AppDomain childDomain) -> void -Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformEqtTrace.InitializeTrace(string customLogFile, Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformTraceLevel platformTraceLevel) -> bool +#nullable enable +Microsoft.VisualStudio.TestPlatform.ObjectModel.IPlatformEqtTrace.SetupListener(System.Diagnostics.TraceListener? listener) -> void +Microsoft.VisualStudio.TestPlatform.ObjectModel.IPlatformEqtTrace.SetupRemoteEqtTraceListeners(System.AppDomain? childDomain) -> void +Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformEqtTrace.InitializeTrace(string! customLogFile, Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformTraceLevel platformTraceLevel) -> bool Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformEqtTrace.MapPlatformTraceToTrace(Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformTraceLevel traceLevel) -> System.Diagnostics.TraceLevel -Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformEqtTrace.SetupListener(System.Diagnostics.TraceListener listener) -> void -Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformEqtTrace.SetupRemoteEqtTraceListeners(System.AppDomain childDomain) -> void -Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformEqtTrace.WriteLine(Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformTraceLevel level, string message) -> void +Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformEqtTrace.SetupListener(System.Diagnostics.TraceListener? listener) -> void +Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformEqtTrace.SetupRemoteEqtTraceListeners(System.AppDomain? childDomain) -> void +Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformEqtTrace.WriteLine(Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformTraceLevel level, string! message) -> void Microsoft.VisualStudio.TestPlatform.ObjectModel.RemoteEqtTrace Microsoft.VisualStudio.TestPlatform.ObjectModel.RemoteEqtTrace.RemoteEqtTrace() -> void Microsoft.VisualStudio.TestPlatform.ObjectModel.RemoteEqtTrace.TraceLevel.get -> System.Diagnostics.TraceLevel Microsoft.VisualStudio.TestPlatform.ObjectModel.RemoteEqtTrace.TraceLevel.set -> void Microsoft.VisualStudio.TestPlatform.ObjectModel.RollingFileTraceListener -Microsoft.VisualStudio.TestPlatform.ObjectModel.RollingFileTraceListener.RollingFileTraceListener(string fileName, string name, int rollSizeKB) -> void +Microsoft.VisualStudio.TestPlatform.ObjectModel.RollingFileTraceListener.RollingFileTraceListener(string! fileName, string! name, int rollSizeKB) -> void Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.PlatformAssemblyResolver.Dispose(bool disposing) -> void Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.PlatformAssemblyResolver.~PlatformAssemblyResolver() -> void -Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.PlatformThread.Run(System.Action action, Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.PlatformApartmentState apartmentState, bool waitForCompletion) -> void -Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.ProcessHelper.LaunchProcess(string processPath, string arguments, string workingDirectory, System.Collections.Generic.IDictionary envVariables, System.Action errorCallback, System.Action exitCallBack, System.Action outputCallBack) -> object -Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.ProcessHelper.SetExitCallback(int processId, System.Action callbackAction) -> void +Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.PlatformThread.Run(System.Action? action, Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.PlatformApartmentState apartmentState, bool waitForCompletion) -> void +Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.ProcessHelper.LaunchProcess(string! processPath, string! arguments, string! workingDirectory, System.Collections.Generic.IDictionary? envVariables, System.Action? errorCallback, System.Action? exitCallBack, System.Action? outputCallBack) -> object! +Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.ProcessHelper.SetExitCallback(int processId, System.Action? callbackAction) -> void Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.ProcessStartInfoExtensions override Microsoft.VisualStudio.TestPlatform.ObjectModel.RollingFileTraceListener.Dispose(bool disposing) -> void -override Microsoft.VisualStudio.TestPlatform.ObjectModel.RollingFileTraceListener.WriteLine(string message) -> void -static Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformEqtTrace.LogFile.get -> string +override Microsoft.VisualStudio.TestPlatform.ObjectModel.RollingFileTraceListener.WriteLine(string! message) -> void +static Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformEqtTrace.LogFile.get -> string? static Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformEqtTrace.TraceLevel.get -> System.Diagnostics.TraceLevel static Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformEqtTrace.TraceLevel.set -> void -static Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.ProcessStartInfoExtensions.AddEnvironmentVariable(this System.Diagnostics.ProcessStartInfo startInfo, string name, string value) -> void +static Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.ProcessStartInfoExtensions.AddEnvironmentVariable(this System.Diagnostics.ProcessStartInfo! startInfo, string! name, string? value) -> void diff --git a/src/Microsoft.TestPlatform.PlatformAbstractions/PublicAPI/net6.0/PublicAPI.Shipped.txt b/src/Microsoft.TestPlatform.PlatformAbstractions/PublicAPI/net6.0/PublicAPI.Shipped.txt index cd6e7ecdfc..e728f1a51f 100644 --- a/src/Microsoft.TestPlatform.PlatformAbstractions/PublicAPI/net6.0/PublicAPI.Shipped.txt +++ b/src/Microsoft.TestPlatform.PlatformAbstractions/PublicAPI/net6.0/PublicAPI.Shipped.txt @@ -1,17 +1,18 @@ -Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformEqtTrace.InitializeTrace(string customLogFile, Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformTraceLevel platformTraceLevel) -> bool +#nullable enable +Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformEqtTrace.InitializeTrace(string! customLogFile, Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformTraceLevel platformTraceLevel) -> bool Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformEqtTrace.MapPlatformTraceToTrace(Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformTraceLevel traceLevel) -> System.Diagnostics.TraceLevel -Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformEqtTrace.WriteLine(Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformTraceLevel level, string message) -> void +Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformEqtTrace.WriteLine(Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformTraceLevel level, string! message) -> void Microsoft.VisualStudio.TestPlatform.ObjectModel.RollingFileTraceListener -Microsoft.VisualStudio.TestPlatform.ObjectModel.RollingFileTraceListener.RollingFileTraceListener(string fileName, string name, int rollSizeKB) -> void +Microsoft.VisualStudio.TestPlatform.ObjectModel.RollingFileTraceListener.RollingFileTraceListener(string! fileName, string! name, int rollSizeKB) -> void Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.PlatformAssemblyResolver.Dispose(bool disposing) -> void Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.PlatformAssemblyResolver.~PlatformAssemblyResolver() -> void -Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.PlatformThread.Run(System.Action action, Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.PlatformApartmentState apartmentState, bool waitForCompletion) -> void -Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.ProcessHelper.LaunchProcess(string processPath, string arguments, string workingDirectory, System.Collections.Generic.IDictionary envVariables, System.Action errorCallback, System.Action exitCallBack, System.Action outputCallBack) -> object -Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.ProcessHelper.SetExitCallback(int processId, System.Action callbackAction) -> void +Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.PlatformThread.Run(System.Action? action, Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.PlatformApartmentState apartmentState, bool waitForCompletion) -> void +Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.ProcessHelper.LaunchProcess(string! processPath, string! arguments, string! workingDirectory, System.Collections.Generic.IDictionary? envVariables, System.Action? errorCallback, System.Action? exitCallBack, System.Action? outputCallBack) -> object! +Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.ProcessHelper.SetExitCallback(int processId, System.Action? callbackAction) -> void Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.ProcessStartInfoExtensions override Microsoft.VisualStudio.TestPlatform.ObjectModel.RollingFileTraceListener.Dispose(bool disposing) -> void -override Microsoft.VisualStudio.TestPlatform.ObjectModel.RollingFileTraceListener.WriteLine(string message) -> void -static Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformEqtTrace.LogFile.get -> string +override Microsoft.VisualStudio.TestPlatform.ObjectModel.RollingFileTraceListener.WriteLine(string! message) -> void +static Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformEqtTrace.LogFile.get -> string? static Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformEqtTrace.TraceLevel.get -> System.Diagnostics.TraceLevel static Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformEqtTrace.TraceLevel.set -> void -static Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.ProcessStartInfoExtensions.AddEnvironmentVariable(this System.Diagnostics.ProcessStartInfo startInfo, string name, string value) -> void +static Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.ProcessStartInfoExtensions.AddEnvironmentVariable(this System.Diagnostics.ProcessStartInfo! startInfo, string! name, string? value) -> void diff --git a/src/Microsoft.TestPlatform.PlatformAbstractions/PublicAPI/netcoreapp1.0/PublicAPI.Shipped.txt b/src/Microsoft.TestPlatform.PlatformAbstractions/PublicAPI/netcoreapp1.0/PublicAPI.Shipped.txt index cd6e7ecdfc..e728f1a51f 100644 --- a/src/Microsoft.TestPlatform.PlatformAbstractions/PublicAPI/netcoreapp1.0/PublicAPI.Shipped.txt +++ b/src/Microsoft.TestPlatform.PlatformAbstractions/PublicAPI/netcoreapp1.0/PublicAPI.Shipped.txt @@ -1,17 +1,18 @@ -Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformEqtTrace.InitializeTrace(string customLogFile, Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformTraceLevel platformTraceLevel) -> bool +#nullable enable +Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformEqtTrace.InitializeTrace(string! customLogFile, Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformTraceLevel platformTraceLevel) -> bool Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformEqtTrace.MapPlatformTraceToTrace(Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformTraceLevel traceLevel) -> System.Diagnostics.TraceLevel -Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformEqtTrace.WriteLine(Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformTraceLevel level, string message) -> void +Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformEqtTrace.WriteLine(Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformTraceLevel level, string! message) -> void Microsoft.VisualStudio.TestPlatform.ObjectModel.RollingFileTraceListener -Microsoft.VisualStudio.TestPlatform.ObjectModel.RollingFileTraceListener.RollingFileTraceListener(string fileName, string name, int rollSizeKB) -> void +Microsoft.VisualStudio.TestPlatform.ObjectModel.RollingFileTraceListener.RollingFileTraceListener(string! fileName, string! name, int rollSizeKB) -> void Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.PlatformAssemblyResolver.Dispose(bool disposing) -> void Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.PlatformAssemblyResolver.~PlatformAssemblyResolver() -> void -Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.PlatformThread.Run(System.Action action, Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.PlatformApartmentState apartmentState, bool waitForCompletion) -> void -Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.ProcessHelper.LaunchProcess(string processPath, string arguments, string workingDirectory, System.Collections.Generic.IDictionary envVariables, System.Action errorCallback, System.Action exitCallBack, System.Action outputCallBack) -> object -Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.ProcessHelper.SetExitCallback(int processId, System.Action callbackAction) -> void +Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.PlatformThread.Run(System.Action? action, Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.PlatformApartmentState apartmentState, bool waitForCompletion) -> void +Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.ProcessHelper.LaunchProcess(string! processPath, string! arguments, string! workingDirectory, System.Collections.Generic.IDictionary? envVariables, System.Action? errorCallback, System.Action? exitCallBack, System.Action? outputCallBack) -> object! +Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.ProcessHelper.SetExitCallback(int processId, System.Action? callbackAction) -> void Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.ProcessStartInfoExtensions override Microsoft.VisualStudio.TestPlatform.ObjectModel.RollingFileTraceListener.Dispose(bool disposing) -> void -override Microsoft.VisualStudio.TestPlatform.ObjectModel.RollingFileTraceListener.WriteLine(string message) -> void -static Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformEqtTrace.LogFile.get -> string +override Microsoft.VisualStudio.TestPlatform.ObjectModel.RollingFileTraceListener.WriteLine(string! message) -> void +static Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformEqtTrace.LogFile.get -> string? static Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformEqtTrace.TraceLevel.get -> System.Diagnostics.TraceLevel static Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformEqtTrace.TraceLevel.set -> void -static Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.ProcessStartInfoExtensions.AddEnvironmentVariable(this System.Diagnostics.ProcessStartInfo startInfo, string name, string value) -> void +static Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.ProcessStartInfoExtensions.AddEnvironmentVariable(this System.Diagnostics.ProcessStartInfo! startInfo, string! name, string? value) -> void diff --git a/src/Microsoft.TestPlatform.PlatformAbstractions/PublicAPI/netcoreapp2.1/PublicAPI.Shipped.txt b/src/Microsoft.TestPlatform.PlatformAbstractions/PublicAPI/netcoreapp2.1/PublicAPI.Shipped.txt index cd6e7ecdfc..e728f1a51f 100644 --- a/src/Microsoft.TestPlatform.PlatformAbstractions/PublicAPI/netcoreapp2.1/PublicAPI.Shipped.txt +++ b/src/Microsoft.TestPlatform.PlatformAbstractions/PublicAPI/netcoreapp2.1/PublicAPI.Shipped.txt @@ -1,17 +1,18 @@ -Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformEqtTrace.InitializeTrace(string customLogFile, Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformTraceLevel platformTraceLevel) -> bool +#nullable enable +Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformEqtTrace.InitializeTrace(string! customLogFile, Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformTraceLevel platformTraceLevel) -> bool Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformEqtTrace.MapPlatformTraceToTrace(Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformTraceLevel traceLevel) -> System.Diagnostics.TraceLevel -Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformEqtTrace.WriteLine(Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformTraceLevel level, string message) -> void +Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformEqtTrace.WriteLine(Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformTraceLevel level, string! message) -> void Microsoft.VisualStudio.TestPlatform.ObjectModel.RollingFileTraceListener -Microsoft.VisualStudio.TestPlatform.ObjectModel.RollingFileTraceListener.RollingFileTraceListener(string fileName, string name, int rollSizeKB) -> void +Microsoft.VisualStudio.TestPlatform.ObjectModel.RollingFileTraceListener.RollingFileTraceListener(string! fileName, string! name, int rollSizeKB) -> void Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.PlatformAssemblyResolver.Dispose(bool disposing) -> void Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.PlatformAssemblyResolver.~PlatformAssemblyResolver() -> void -Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.PlatformThread.Run(System.Action action, Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.PlatformApartmentState apartmentState, bool waitForCompletion) -> void -Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.ProcessHelper.LaunchProcess(string processPath, string arguments, string workingDirectory, System.Collections.Generic.IDictionary envVariables, System.Action errorCallback, System.Action exitCallBack, System.Action outputCallBack) -> object -Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.ProcessHelper.SetExitCallback(int processId, System.Action callbackAction) -> void +Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.PlatformThread.Run(System.Action? action, Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.PlatformApartmentState apartmentState, bool waitForCompletion) -> void +Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.ProcessHelper.LaunchProcess(string! processPath, string! arguments, string! workingDirectory, System.Collections.Generic.IDictionary? envVariables, System.Action? errorCallback, System.Action? exitCallBack, System.Action? outputCallBack) -> object! +Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.ProcessHelper.SetExitCallback(int processId, System.Action? callbackAction) -> void Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.ProcessStartInfoExtensions override Microsoft.VisualStudio.TestPlatform.ObjectModel.RollingFileTraceListener.Dispose(bool disposing) -> void -override Microsoft.VisualStudio.TestPlatform.ObjectModel.RollingFileTraceListener.WriteLine(string message) -> void -static Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformEqtTrace.LogFile.get -> string +override Microsoft.VisualStudio.TestPlatform.ObjectModel.RollingFileTraceListener.WriteLine(string! message) -> void +static Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformEqtTrace.LogFile.get -> string? static Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformEqtTrace.TraceLevel.get -> System.Diagnostics.TraceLevel static Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformEqtTrace.TraceLevel.set -> void -static Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.ProcessStartInfoExtensions.AddEnvironmentVariable(this System.Diagnostics.ProcessStartInfo startInfo, string name, string value) -> void +static Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.ProcessStartInfoExtensions.AddEnvironmentVariable(this System.Diagnostics.ProcessStartInfo! startInfo, string! name, string? value) -> void diff --git a/src/Microsoft.TestPlatform.PlatformAbstractions/PublicAPI/netstandard1.0/PublicAPI.Shipped.txt b/src/Microsoft.TestPlatform.PlatformAbstractions/PublicAPI/netstandard1.0/PublicAPI.Shipped.txt index 52c2c42ffb..604eff3ae7 100644 --- a/src/Microsoft.TestPlatform.PlatformAbstractions/PublicAPI/netstandard1.0/PublicAPI.Shipped.txt +++ b/src/Microsoft.TestPlatform.PlatformAbstractions/PublicAPI/netstandard1.0/PublicAPI.Shipped.txt @@ -1,6 +1,7 @@ -Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformEqtTrace.InitializeTrace(string customLogFile, Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformTraceLevel traceLevel) -> bool -Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformEqtTrace.WriteLine(Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformTraceLevel traceLevel, string message) -> void -Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.PlatformThread.Run(System.Action action, Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.PlatformApartmentState platformApartmentState, bool waitForCompletion) -> void -Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.ProcessHelper.GetProcessById(int processId) -> object -Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.ProcessHelper.LaunchProcess(string processPath, string arguments, string workingDirectory, System.Collections.Generic.IDictionary environmentVariables, System.Action errorCallback, System.Action exitCallBack, System.Action ouputCallBack) -> object -Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.ProcessHelper.SetExitCallback(int parentProcessId, System.Action callbackAction) -> void +#nullable enable +Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformEqtTrace.InitializeTrace(string! customLogFile, Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformTraceLevel traceLevel) -> bool +Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformEqtTrace.WriteLine(Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformTraceLevel traceLevel, string! message) -> void +Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.PlatformThread.Run(System.Action? action, Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.PlatformApartmentState platformApartmentState, bool waitForCompletion) -> void +Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.ProcessHelper.GetProcessById(int processId) -> object! +Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.ProcessHelper.LaunchProcess(string! processPath, string! arguments, string! workingDirectory, System.Collections.Generic.IDictionary? envVariables, System.Action? errorCallback, System.Action? exitCallBack, System.Action? outputCallBack) -> object! +Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.ProcessHelper.SetExitCallback(int parentProcessId, System.Action? callbackAction) -> void diff --git a/src/Microsoft.TestPlatform.PlatformAbstractions/PublicAPI/netstandard1.3/PublicAPI.Shipped.txt b/src/Microsoft.TestPlatform.PlatformAbstractions/PublicAPI/netstandard1.3/PublicAPI.Shipped.txt index 52c2c42ffb..604eff3ae7 100644 --- a/src/Microsoft.TestPlatform.PlatformAbstractions/PublicAPI/netstandard1.3/PublicAPI.Shipped.txt +++ b/src/Microsoft.TestPlatform.PlatformAbstractions/PublicAPI/netstandard1.3/PublicAPI.Shipped.txt @@ -1,6 +1,7 @@ -Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformEqtTrace.InitializeTrace(string customLogFile, Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformTraceLevel traceLevel) -> bool -Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformEqtTrace.WriteLine(Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformTraceLevel traceLevel, string message) -> void -Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.PlatformThread.Run(System.Action action, Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.PlatformApartmentState platformApartmentState, bool waitForCompletion) -> void -Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.ProcessHelper.GetProcessById(int processId) -> object -Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.ProcessHelper.LaunchProcess(string processPath, string arguments, string workingDirectory, System.Collections.Generic.IDictionary environmentVariables, System.Action errorCallback, System.Action exitCallBack, System.Action ouputCallBack) -> object -Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.ProcessHelper.SetExitCallback(int parentProcessId, System.Action callbackAction) -> void +#nullable enable +Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformEqtTrace.InitializeTrace(string! customLogFile, Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformTraceLevel traceLevel) -> bool +Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformEqtTrace.WriteLine(Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformTraceLevel traceLevel, string! message) -> void +Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.PlatformThread.Run(System.Action? action, Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.PlatformApartmentState platformApartmentState, bool waitForCompletion) -> void +Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.ProcessHelper.GetProcessById(int processId) -> object! +Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.ProcessHelper.LaunchProcess(string! processPath, string! arguments, string! workingDirectory, System.Collections.Generic.IDictionary? envVariables, System.Action? errorCallback, System.Action? exitCallBack, System.Action? outputCallBack) -> object! +Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.ProcessHelper.SetExitCallback(int parentProcessId, System.Action? callbackAction) -> void diff --git a/src/Microsoft.TestPlatform.PlatformAbstractions/PublicAPI/netstandard2.0/PublicAPI.Shipped.txt b/src/Microsoft.TestPlatform.PlatformAbstractions/PublicAPI/netstandard2.0/PublicAPI.Shipped.txt index cd6e7ecdfc..e728f1a51f 100644 --- a/src/Microsoft.TestPlatform.PlatformAbstractions/PublicAPI/netstandard2.0/PublicAPI.Shipped.txt +++ b/src/Microsoft.TestPlatform.PlatformAbstractions/PublicAPI/netstandard2.0/PublicAPI.Shipped.txt @@ -1,17 +1,18 @@ -Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformEqtTrace.InitializeTrace(string customLogFile, Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformTraceLevel platformTraceLevel) -> bool +#nullable enable +Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformEqtTrace.InitializeTrace(string! customLogFile, Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformTraceLevel platformTraceLevel) -> bool Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformEqtTrace.MapPlatformTraceToTrace(Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformTraceLevel traceLevel) -> System.Diagnostics.TraceLevel -Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformEqtTrace.WriteLine(Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformTraceLevel level, string message) -> void +Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformEqtTrace.WriteLine(Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformTraceLevel level, string! message) -> void Microsoft.VisualStudio.TestPlatform.ObjectModel.RollingFileTraceListener -Microsoft.VisualStudio.TestPlatform.ObjectModel.RollingFileTraceListener.RollingFileTraceListener(string fileName, string name, int rollSizeKB) -> void +Microsoft.VisualStudio.TestPlatform.ObjectModel.RollingFileTraceListener.RollingFileTraceListener(string! fileName, string! name, int rollSizeKB) -> void Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.PlatformAssemblyResolver.Dispose(bool disposing) -> void Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.PlatformAssemblyResolver.~PlatformAssemblyResolver() -> void -Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.PlatformThread.Run(System.Action action, Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.PlatformApartmentState apartmentState, bool waitForCompletion) -> void -Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.ProcessHelper.LaunchProcess(string processPath, string arguments, string workingDirectory, System.Collections.Generic.IDictionary envVariables, System.Action errorCallback, System.Action exitCallBack, System.Action outputCallBack) -> object -Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.ProcessHelper.SetExitCallback(int processId, System.Action callbackAction) -> void +Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.PlatformThread.Run(System.Action? action, Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.PlatformApartmentState apartmentState, bool waitForCompletion) -> void +Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.ProcessHelper.LaunchProcess(string! processPath, string! arguments, string! workingDirectory, System.Collections.Generic.IDictionary? envVariables, System.Action? errorCallback, System.Action? exitCallBack, System.Action? outputCallBack) -> object! +Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.ProcessHelper.SetExitCallback(int processId, System.Action? callbackAction) -> void Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.ProcessStartInfoExtensions override Microsoft.VisualStudio.TestPlatform.ObjectModel.RollingFileTraceListener.Dispose(bool disposing) -> void -override Microsoft.VisualStudio.TestPlatform.ObjectModel.RollingFileTraceListener.WriteLine(string message) -> void -static Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformEqtTrace.LogFile.get -> string +override Microsoft.VisualStudio.TestPlatform.ObjectModel.RollingFileTraceListener.WriteLine(string! message) -> void +static Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformEqtTrace.LogFile.get -> string? static Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformEqtTrace.TraceLevel.get -> System.Diagnostics.TraceLevel static Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformEqtTrace.TraceLevel.set -> void -static Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.ProcessStartInfoExtensions.AddEnvironmentVariable(this System.Diagnostics.ProcessStartInfo startInfo, string name, string value) -> void +static Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.ProcessStartInfoExtensions.AddEnvironmentVariable(this System.Diagnostics.ProcessStartInfo! startInfo, string! name, string? value) -> void diff --git a/src/Microsoft.TestPlatform.PlatformAbstractions/PublicAPI/uap10.0/PublicAPI.Shipped.txt b/src/Microsoft.TestPlatform.PlatformAbstractions/PublicAPI/uap10.0/PublicAPI.Shipped.txt index e83d369b18..5a732437a9 100644 --- a/src/Microsoft.TestPlatform.PlatformAbstractions/PublicAPI/uap10.0/PublicAPI.Shipped.txt +++ b/src/Microsoft.TestPlatform.PlatformAbstractions/PublicAPI/uap10.0/PublicAPI.Shipped.txt @@ -1,8 +1,9 @@ -Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformEqtTrace.InitializeTrace(string customLogFile, Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformTraceLevel traceLevel) -> bool -Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformEqtTrace.WriteLine(Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformTraceLevel level, string message) -> void -Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.PlatformThread.Run(System.Action action, Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.PlatformApartmentState apartmentState, bool waitForCompletion) -> void -Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.ProcessHelper.GetProcessById(int processId) -> object -Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.ProcessHelper.LaunchProcess(string processPath, string arguments, string workingDirectory, System.Collections.Generic.IDictionary environmentVariables, System.Action errorCallback, System.Action exitCallBack, System.Action outputCallback) -> object -Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.ProcessHelper.SetExitCallback(int parentProcessId, System.Action callbackAction) -> void -static Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformEqtTrace.LogFile.get -> string +#nullable enable +Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformEqtTrace.InitializeTrace(string! customLogFile, Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformTraceLevel traceLevel) -> bool +Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformEqtTrace.WriteLine(Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformTraceLevel level, string! message) -> void +Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.PlatformThread.Run(System.Action? action, Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.PlatformApartmentState apartmentState, bool waitForCompletion) -> void +Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.ProcessHelper.GetProcessById(int processId) -> object! +Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.ProcessHelper.LaunchProcess(string! processPath, string! arguments, string! workingDirectory, System.Collections.Generic.IDictionary? envVariables, System.Action? errorCallback, System.Action? exitCallBack, System.Action? outputCallBack) -> object! +Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.ProcessHelper.SetExitCallback(int parentProcessId, System.Action? callbackAction) -> void +static Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformEqtTrace.LogFile.get -> string? static Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformEqtTrace.LogFile.set -> void diff --git a/src/Microsoft.TestPlatform.PlatformAbstractions/common/IO/PlatformStream.cs b/src/Microsoft.TestPlatform.PlatformAbstractions/common/IO/PlatformStream.cs index eaaa320ffc..4d1ecdfbd6 100644 --- a/src/Microsoft.TestPlatform.PlatformAbstractions/common/IO/PlatformStream.cs +++ b/src/Microsoft.TestPlatform.PlatformAbstractions/common/IO/PlatformStream.cs @@ -7,8 +7,6 @@ using Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.Interfaces; -#nullable disable - namespace Microsoft.VisualStudio.TestPlatform.PlatformAbstractions; /// diff --git a/src/Microsoft.TestPlatform.PlatformAbstractions/common/System/ProcessHelper.cs b/src/Microsoft.TestPlatform.PlatformAbstractions/common/System/ProcessHelper.cs index 16eb766281..032817b66d 100644 --- a/src/Microsoft.TestPlatform.PlatformAbstractions/common/System/ProcessHelper.cs +++ b/src/Microsoft.TestPlatform.PlatformAbstractions/common/System/ProcessHelper.cs @@ -13,8 +13,6 @@ using Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.Interfaces; -#nullable disable - namespace Microsoft.VisualStudio.TestPlatform.PlatformAbstractions; /// @@ -25,7 +23,7 @@ public partial class ProcessHelper : IProcessHelper private static readonly string Arm = "arm"; /// - public object LaunchProcess(string processPath, string arguments, string workingDirectory, IDictionary envVariables, Action errorCallback, Action exitCallBack, Action outputCallBack) + public object LaunchProcess(string processPath, string arguments, string workingDirectory, IDictionary? envVariables, Action? errorCallback, Action? exitCallBack, Action? outputCallBack) { if (!File.Exists(processPath)) { @@ -161,7 +159,7 @@ public string GetProcessName(int processId) } /// - public bool TryGetExitCode(object process, out int exitCode) + public bool TryGetExitCode(object? process, out int exitCode) { try { @@ -180,7 +178,7 @@ public bool TryGetExitCode(object process, out int exitCode) } /// - public void SetExitCallback(int processId, Action callbackAction) + public void SetExitCallback(int processId, Action? callbackAction) { try { @@ -197,7 +195,7 @@ public void SetExitCallback(int processId, Action callbackAction) } /// - public void TerminateProcess(object process) + public void TerminateProcess(object? process) { try { @@ -212,7 +210,7 @@ public void TerminateProcess(object process) } /// - public int GetProcessId(object process) + public int GetProcessId(object? process) { var proc = process as Process; return proc?.Id ?? -1; @@ -228,7 +226,7 @@ public string GetNativeDllDirectory() } /// - public void WaitForProcessExit(object process) + public void WaitForProcessExit(object? process) { if (process is Process proc && !proc.HasExited) { diff --git a/src/Microsoft.TestPlatform.PlatformAbstractions/common/Tracing/PlatformEqtTrace.cs b/src/Microsoft.TestPlatform.PlatformAbstractions/common/Tracing/PlatformEqtTrace.cs index 690cbd35e7..57673e2730 100644 --- a/src/Microsoft.TestPlatform.PlatformAbstractions/common/Tracing/PlatformEqtTrace.cs +++ b/src/Microsoft.TestPlatform.PlatformAbstractions/common/Tracing/PlatformEqtTrace.cs @@ -9,8 +9,6 @@ using System.Globalization; using System.IO; -#nullable disable - namespace Microsoft.VisualStudio.TestPlatform.ObjectModel; /// @@ -83,7 +81,7 @@ public partial class PlatformEqtTrace : IPlatformEqtTrace private static readonly object LockObject = new(); - private static TraceSource s_traceSource; + private static TraceSource? s_traceSource; /// /// Specifies whether the trace is initialized or not @@ -98,7 +96,7 @@ public partial class PlatformEqtTrace : IPlatformEqtTrace private static int s_traceFileSize; private static readonly int DefaultTraceFileSize = 10240; // 10Mb. - public static string LogFile + public static string? LogFile { get; private set; @@ -127,7 +125,7 @@ public static TraceLevel TraceLevel } } - public static string ErrorOnInitialization + public static string? ErrorOnInitialization { get; set; @@ -208,7 +206,7 @@ public bool ShouldTrace(PlatformTraceLevel traceLevel) } /// - public string GetLogFile() + public string? GetLogFile() { return LogFile; } @@ -282,7 +280,7 @@ public TraceLevel MapPlatformTraceToTrace(PlatformTraceLevel traceLevel) /// Setup trace listeners. It should be called when setting trace listener for child domain. /// /// New listener. - internal static void SetupRemoteListeners(TraceListener listener) + internal static void SetupRemoteListeners(TraceListener? listener) { lock (IsInitializationLock) { @@ -391,7 +389,7 @@ private static string GetProcessName() { try { - string processName = null; + string? processName = null; string[] args = Environment.GetCommandLineArgs(); @@ -404,7 +402,7 @@ private static string GetProcessName() // If we still have not got process name from command line - use the slow way. // This should never happen unless the process is called from execv with empty cmdline. - if (string.IsNullOrEmpty(processName)) + if (processName.IsNullOrEmpty()) { Debug.Fail("Could not get process name from command line, will try to use the slow way."); using var process = Process.GetCurrentProcess(); diff --git a/src/Microsoft.TestPlatform.PlatformAbstractions/common/Tracing/RollingFileTraceListener.cs b/src/Microsoft.TestPlatform.PlatformAbstractions/common/Tracing/RollingFileTraceListener.cs index a9689e590c..c03713c7b6 100644 --- a/src/Microsoft.TestPlatform.PlatformAbstractions/common/Tracing/RollingFileTraceListener.cs +++ b/src/Microsoft.TestPlatform.PlatformAbstractions/common/Tracing/RollingFileTraceListener.cs @@ -8,8 +8,6 @@ using System.IO; using System.Text; -#nullable disable - namespace Microsoft.VisualStudio.TestPlatform.ObjectModel; /// @@ -32,7 +30,7 @@ public RollingFileTraceListener( int rollSizeKB) : base(OpenTextWriter(fileName), name) { - if (string.IsNullOrWhiteSpace(fileName)) + if (fileName.IsNullOrWhiteSpace()) { throw new ArgumentException("fileName was null or whitespace", nameof(fileName)); } @@ -89,7 +87,7 @@ internal static TallyKeepingFileStreamWriter OpenTextWriter(string fileName) /// protected override void Dispose(bool disposing) { - RollingHelper?.Dispose(); + RollingHelper.Dispose(); base.Dispose(disposing); } @@ -127,7 +125,7 @@ internal sealed class StreamWriterRollingHelper : IDisposable /// The original stream writer from the base trace listener will be replaced with /// this listener. /// - private TallyKeepingFileStreamWriter _managedWriter; + private TallyKeepingFileStreamWriter? _managedWriter; private bool _lastRollFailed; private readonly Stopwatch _sinceLastRoll = Stopwatch.StartNew(); private readonly long _failedRollTimeout = TimeSpan.FromMinutes(1).Ticks; diff --git a/src/Microsoft.TestPlatform.PlatformAbstractions/net451/Interfaces/Tracing/IPlatformEqtTrace.cs b/src/Microsoft.TestPlatform.PlatformAbstractions/net451/Interfaces/Tracing/IPlatformEqtTrace.cs index f3c4c6cdfb..a244bb699d 100644 --- a/src/Microsoft.TestPlatform.PlatformAbstractions/net451/Interfaces/Tracing/IPlatformEqtTrace.cs +++ b/src/Microsoft.TestPlatform.PlatformAbstractions/net451/Interfaces/Tracing/IPlatformEqtTrace.cs @@ -6,8 +6,6 @@ using System; using System.Diagnostics; -#nullable disable - namespace Microsoft.VisualStudio.TestPlatform.ObjectModel; public partial interface IPlatformEqtTrace @@ -17,7 +15,7 @@ public partial interface IPlatformEqtTrace /// If calling domain, doesn't have tracing enabled nothing is done. /// /// Child AppDomain. - void SetupRemoteEqtTraceListeners(AppDomain childDomain); + void SetupRemoteEqtTraceListeners(AppDomain? childDomain); /// /// Setup a custom trace listener instead of default trace listener created by test platform. @@ -26,7 +24,7 @@ public partial interface IPlatformEqtTrace /// /// The listener. /// - void SetupListener(TraceListener listener); + void SetupListener(TraceListener? listener); } #endif diff --git a/src/Microsoft.TestPlatform.PlatformAbstractions/net451/Runtime/PlatformAssemblyExtensions.cs b/src/Microsoft.TestPlatform.PlatformAbstractions/net451/Runtime/PlatformAssemblyExtensions.cs index bab0549d59..90378811f7 100644 --- a/src/Microsoft.TestPlatform.PlatformAbstractions/net451/Runtime/PlatformAssemblyExtensions.cs +++ b/src/Microsoft.TestPlatform.PlatformAbstractions/net451/Runtime/PlatformAssemblyExtensions.cs @@ -5,8 +5,6 @@ using System.Reflection; -#nullable disable - namespace Microsoft.VisualStudio.TestPlatform.PlatformAbstractions; /// diff --git a/src/Microsoft.TestPlatform.PlatformAbstractions/net451/Runtime/PlatformAssemblyLoadContext.cs b/src/Microsoft.TestPlatform.PlatformAbstractions/net451/Runtime/PlatformAssemblyLoadContext.cs index 50e80a6642..2893bfa7de 100644 --- a/src/Microsoft.TestPlatform.PlatformAbstractions/net451/Runtime/PlatformAssemblyLoadContext.cs +++ b/src/Microsoft.TestPlatform.PlatformAbstractions/net451/Runtime/PlatformAssemblyLoadContext.cs @@ -7,8 +7,6 @@ using Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.Interfaces; -#nullable disable - namespace Microsoft.VisualStudio.TestPlatform.PlatformAbstractions; /// diff --git a/src/Microsoft.TestPlatform.PlatformAbstractions/net451/Runtime/PlatformAssemblyResolver.cs b/src/Microsoft.TestPlatform.PlatformAbstractions/net451/Runtime/PlatformAssemblyResolver.cs index 8eb42fb2d1..5bbc4b89d0 100644 --- a/src/Microsoft.TestPlatform.PlatformAbstractions/net451/Runtime/PlatformAssemblyResolver.cs +++ b/src/Microsoft.TestPlatform.PlatformAbstractions/net451/Runtime/PlatformAssemblyResolver.cs @@ -8,8 +8,6 @@ using Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.Interfaces; -#nullable disable - namespace Microsoft.VisualStudio.TestPlatform.PlatformAbstractions; /// @@ -34,7 +32,7 @@ public PlatformAssemblyResolver() } /// - public event AssemblyResolveEventHandler AssemblyResolve; + public event AssemblyResolveEventHandler? AssemblyResolve; public void Dispose() { @@ -70,9 +68,9 @@ protected void Dispose(bool disposing) /// /// The . /// - private Assembly AssemblyResolverEvent(object sender, object eventArgs) + private Assembly? AssemblyResolverEvent(object sender, object eventArgs) { - return eventArgs is not ResolveEventArgs args ? null : AssemblyResolve(this, new AssemblyResolveEventArgs(args.Name)); + return eventArgs is not ResolveEventArgs args ? null : AssemblyResolve?.Invoke(this, new AssemblyResolveEventArgs(args.Name)); } } diff --git a/src/Microsoft.TestPlatform.PlatformAbstractions/net451/System/PlatformEnvironment.cs b/src/Microsoft.TestPlatform.PlatformAbstractions/net451/System/PlatformEnvironment.cs index b5df2faab5..96b6df5ffc 100644 --- a/src/Microsoft.TestPlatform.PlatformAbstractions/net451/System/PlatformEnvironment.cs +++ b/src/Microsoft.TestPlatform.PlatformAbstractions/net451/System/PlatformEnvironment.cs @@ -9,8 +9,6 @@ using Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.Interfaces; -#nullable disable - namespace Microsoft.VisualStudio.TestPlatform.PlatformAbstractions; /// @@ -18,16 +16,11 @@ public class PlatformEnvironment : IEnvironment { /// public PlatformArchitecture Architecture - { - get - { - return Environment.Is64BitOperatingSystem - ? IsArm64() - ? PlatformArchitecture.ARM64 - : PlatformArchitecture.X64 - : PlatformArchitecture.X86; - } - } + => Environment.Is64BitOperatingSystem + ? IsArm64() + ? PlatformArchitecture.ARM64 + : PlatformArchitecture.X64 + : PlatformArchitecture.X86; private static bool IsArm64() { @@ -71,13 +64,7 @@ public PlatformOperatingSystem OperatingSystem } /// - public string OperatingSystemVersion - { - get - { - return Environment.OSVersion.ToString(); - } - } + public string OperatingSystemVersion => Environment.OSVersion.ToString(); /// public void Exit(int exitcode) diff --git a/src/Microsoft.TestPlatform.PlatformAbstractions/net451/System/PlatformThread.cs b/src/Microsoft.TestPlatform.PlatformAbstractions/net451/System/PlatformThread.cs index aaf4a55c8f..805843c406 100644 --- a/src/Microsoft.TestPlatform.PlatformAbstractions/net451/System/PlatformThread.cs +++ b/src/Microsoft.TestPlatform.PlatformAbstractions/net451/System/PlatformThread.cs @@ -9,21 +9,19 @@ using Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.Interfaces; -#nullable disable - namespace Microsoft.VisualStudio.TestPlatform.PlatformAbstractions; public class PlatformThread : IThread { /// - public void Run(Action action, PlatformApartmentState apartmentState, bool waitForCompletion) + public void Run(Action? action, PlatformApartmentState apartmentState, bool waitForCompletion) { if (action == null) { return; } - Exception exThrown = null; + Exception? exThrown = null; var thread = new Thread(() => { try diff --git a/src/Microsoft.TestPlatform.PlatformAbstractions/net451/System/ProcessHelper.cs b/src/Microsoft.TestPlatform.PlatformAbstractions/net451/System/ProcessHelper.cs index 1dc87a5e3f..a69b5e105a 100644 --- a/src/Microsoft.TestPlatform.PlatformAbstractions/net451/System/ProcessHelper.cs +++ b/src/Microsoft.TestPlatform.PlatformAbstractions/net451/System/ProcessHelper.cs @@ -10,8 +10,6 @@ using Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.Interfaces; -#nullable disable - namespace Microsoft.VisualStudio.TestPlatform.PlatformAbstractions; public partial class ProcessHelper : IProcessHelper diff --git a/src/Microsoft.TestPlatform.PlatformAbstractions/net451/System/ProcessStartInfoExtensions.cs b/src/Microsoft.TestPlatform.PlatformAbstractions/net451/System/ProcessStartInfoExtensions.cs index d47880fa7f..cf851752b0 100644 --- a/src/Microsoft.TestPlatform.PlatformAbstractions/net451/System/ProcessStartInfoExtensions.cs +++ b/src/Microsoft.TestPlatform.PlatformAbstractions/net451/System/ProcessStartInfoExtensions.cs @@ -5,8 +5,6 @@ using System.Diagnostics; -#nullable disable - namespace Microsoft.VisualStudio.TestPlatform.PlatformAbstractions; public static class ProcessStartInfoExtensions @@ -17,7 +15,7 @@ public static class ProcessStartInfoExtensions /// The process start info /// Environment Variable name. /// Environment Variable value. - public static void AddEnvironmentVariable(this ProcessStartInfo startInfo, string name, string value) + public static void AddEnvironmentVariable(this ProcessStartInfo startInfo, string name, string? value) { startInfo.EnvironmentVariables[name] = value; } diff --git a/src/Microsoft.TestPlatform.PlatformAbstractions/net451/Tracing/PlatformEqtTrace.cs b/src/Microsoft.TestPlatform.PlatformAbstractions/net451/Tracing/PlatformEqtTrace.cs index c3650df942..47f9fa3450 100644 --- a/src/Microsoft.TestPlatform.PlatformAbstractions/net451/Tracing/PlatformEqtTrace.cs +++ b/src/Microsoft.TestPlatform.PlatformAbstractions/net451/Tracing/PlatformEqtTrace.cs @@ -6,8 +6,6 @@ using System; using System.Diagnostics; -#nullable disable - namespace Microsoft.VisualStudio.TestPlatform.ObjectModel; /// @@ -30,40 +28,42 @@ public partial class PlatformEqtTrace : IPlatformEqtTrace /// If calling domain, doesn't have tracing enabled nothing is done. /// /// Child AppDomain. - public void SetupRemoteEqtTraceListeners(AppDomain childDomain) + public void SetupRemoteEqtTraceListeners(AppDomain? childDomain) { Debug.Assert(childDomain != null, "domain"); - if (childDomain != null) + if (childDomain == null) { - RemoteEqtTrace remoteEqtTrace = (RemoteEqtTrace)childDomain.CreateInstanceFromAndUnwrap( - typeof(RemoteEqtTrace).Assembly.Location, - typeof(RemoteEqtTrace).FullName); + return; + } - if (!Equals(TraceLevel, TraceLevel.Off)) - { - remoteEqtTrace.TraceLevel = TraceLevel; + RemoteEqtTrace remoteEqtTrace = (RemoteEqtTrace)childDomain.CreateInstanceFromAndUnwrap( + typeof(RemoteEqtTrace).Assembly.Location, + typeof(RemoteEqtTrace).FullName); - TraceListener tptListner = null; - foreach (TraceListener listener in Trace.Listeners) - { - if (string.Equals(listener.Name, ListenerName, StringComparison.OrdinalIgnoreCase)) - { - Debug.Assert(tptListner == null, "Multiple TptListeners found."); - tptListner = listener; - } - } + if (!Equals(TraceLevel, TraceLevel.Off)) + { + remoteEqtTrace.TraceLevel = TraceLevel; - remoteEqtTrace.SetupRemoteListeners(tptListner); - } - else + TraceListener? tptListner = null; + foreach (TraceListener listener in Trace.Listeners) { - DoNotInitialize = true; + if (string.Equals(listener.Name, ListenerName, StringComparison.OrdinalIgnoreCase)) + { + TPDebug.Assert(tptListner == null, "Multiple TptListeners found."); + tptListner = listener; + } } + + remoteEqtTrace.SetupRemoteListeners(tptListner); + } + else + { + DoNotInitialize = true; } } /// - public void SetupListener(TraceListener listener) + public void SetupListener(TraceListener? listener) { lock (IsInitializationLock) { diff --git a/src/Microsoft.TestPlatform.PlatformAbstractions/net451/Tracing/RemoteEqtTrace.cs b/src/Microsoft.TestPlatform.PlatformAbstractions/net451/Tracing/RemoteEqtTrace.cs index 35bbd6cac4..b8b167305c 100644 --- a/src/Microsoft.TestPlatform.PlatformAbstractions/net451/Tracing/RemoteEqtTrace.cs +++ b/src/Microsoft.TestPlatform.PlatformAbstractions/net451/Tracing/RemoteEqtTrace.cs @@ -6,8 +6,6 @@ using System; using System.Diagnostics; -#nullable disable - namespace Microsoft.VisualStudio.TestPlatform.ObjectModel; /// @@ -35,7 +33,7 @@ public TraceLevel TraceLevel /// Register listeners from parent domain in current domain. /// /// Trace listener instance. - internal void SetupRemoteListeners(TraceListener listener) + internal void SetupRemoteListeners(TraceListener? listener) { PlatformEqtTrace.SetupRemoteListeners(listener); } diff --git a/src/Microsoft.TestPlatform.PlatformAbstractions/netcore/Runtime/PlatformAssemblyExtensions.cs b/src/Microsoft.TestPlatform.PlatformAbstractions/netcore/Runtime/PlatformAssemblyExtensions.cs index 194a56c1e0..3d8018bf0a 100644 --- a/src/Microsoft.TestPlatform.PlatformAbstractions/netcore/Runtime/PlatformAssemblyExtensions.cs +++ b/src/Microsoft.TestPlatform.PlatformAbstractions/netcore/Runtime/PlatformAssemblyExtensions.cs @@ -5,8 +5,6 @@ using System.Reflection; -#nullable disable - namespace Microsoft.VisualStudio.TestPlatform.PlatformAbstractions; /// diff --git a/src/Microsoft.TestPlatform.PlatformAbstractions/netcore/Runtime/PlatformAssemblyLoadContext.cs b/src/Microsoft.TestPlatform.PlatformAbstractions/netcore/Runtime/PlatformAssemblyLoadContext.cs index 012f8f8122..f25d7439d9 100644 --- a/src/Microsoft.TestPlatform.PlatformAbstractions/netcore/Runtime/PlatformAssemblyLoadContext.cs +++ b/src/Microsoft.TestPlatform.PlatformAbstractions/netcore/Runtime/PlatformAssemblyLoadContext.cs @@ -8,8 +8,6 @@ using Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.Interfaces; -#nullable disable - namespace Microsoft.VisualStudio.TestPlatform.PlatformAbstractions; /// diff --git a/src/Microsoft.TestPlatform.PlatformAbstractions/netcore/Runtime/PlatformAssemblyResolver.cs b/src/Microsoft.TestPlatform.PlatformAbstractions/netcore/Runtime/PlatformAssemblyResolver.cs index 879be7fcc3..29a939d9c5 100644 --- a/src/Microsoft.TestPlatform.PlatformAbstractions/netcore/Runtime/PlatformAssemblyResolver.cs +++ b/src/Microsoft.TestPlatform.PlatformAbstractions/netcore/Runtime/PlatformAssemblyResolver.cs @@ -9,8 +9,6 @@ using Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.Interfaces; -#nullable disable - namespace Microsoft.VisualStudio.TestPlatform.PlatformAbstractions; /// @@ -36,7 +34,7 @@ public PlatformAssemblyResolver() } /// - public event AssemblyResolveEventHandler AssemblyResolve; + public event AssemblyResolveEventHandler? AssemblyResolve; public void Dispose() { @@ -72,9 +70,9 @@ protected void Dispose(bool disposing) /// /// The . /// - private Assembly AssemblyResolverEvent(object sender, object eventArgs) + private Assembly? AssemblyResolverEvent(object sender, object eventArgs) { - return eventArgs is not AssemblyName args ? null : AssemblyResolve(this, new AssemblyResolveEventArgs(args.Name)); + return eventArgs is not AssemblyName args ? null : AssemblyResolve?.Invoke(this, new AssemblyResolveEventArgs(args.Name)); } } diff --git a/src/Microsoft.TestPlatform.PlatformAbstractions/netcore/System/PlatformEnvironment.cs b/src/Microsoft.TestPlatform.PlatformAbstractions/netcore/System/PlatformEnvironment.cs index 27c541504b..61e73c0455 100644 --- a/src/Microsoft.TestPlatform.PlatformAbstractions/netcore/System/PlatformEnvironment.cs +++ b/src/Microsoft.TestPlatform.PlatformAbstractions/netcore/System/PlatformEnvironment.cs @@ -8,8 +8,6 @@ using Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.Interfaces; -#nullable disable - namespace Microsoft.VisualStudio.TestPlatform.PlatformAbstractions; /// diff --git a/src/Microsoft.TestPlatform.PlatformAbstractions/netcore/System/PlatformThread.cs b/src/Microsoft.TestPlatform.PlatformAbstractions/netcore/System/PlatformThread.cs index 7b22b336c0..f1c6c8be68 100644 --- a/src/Microsoft.TestPlatform.PlatformAbstractions/netcore/System/PlatformThread.cs +++ b/src/Microsoft.TestPlatform.PlatformAbstractions/netcore/System/PlatformThread.cs @@ -9,14 +9,12 @@ using Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.Interfaces; -#nullable disable - namespace Microsoft.VisualStudio.TestPlatform.PlatformAbstractions; public class PlatformThread : IThread { /// - public void Run(Action action, PlatformApartmentState apartmentState, bool waitForCompletion) + public void Run(Action? action, PlatformApartmentState apartmentState, bool waitForCompletion) { if (apartmentState == PlatformApartmentState.STA) { @@ -28,7 +26,7 @@ public void Run(Action action, PlatformApartmentState apartmentState, bool waitF return; } - Exception exThrown = null; + Exception? exThrown = null; var thread = new Thread(() => { try diff --git a/src/Microsoft.TestPlatform.PlatformAbstractions/netcore/System/ProcessHelper.cs b/src/Microsoft.TestPlatform.PlatformAbstractions/netcore/System/ProcessHelper.cs index 7fad59938d..9ccaba7c7c 100644 --- a/src/Microsoft.TestPlatform.PlatformAbstractions/netcore/System/ProcessHelper.cs +++ b/src/Microsoft.TestPlatform.PlatformAbstractions/netcore/System/ProcessHelper.cs @@ -11,8 +11,6 @@ using Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.Interfaces; -#nullable disable - namespace Microsoft.VisualStudio.TestPlatform.PlatformAbstractions; public partial class ProcessHelper : IProcessHelper diff --git a/src/Microsoft.TestPlatform.PlatformAbstractions/netcore/System/ProcessStartInfoExtensions.cs b/src/Microsoft.TestPlatform.PlatformAbstractions/netcore/System/ProcessStartInfoExtensions.cs index df8b435c13..e784c47c6c 100644 --- a/src/Microsoft.TestPlatform.PlatformAbstractions/netcore/System/ProcessStartInfoExtensions.cs +++ b/src/Microsoft.TestPlatform.PlatformAbstractions/netcore/System/ProcessStartInfoExtensions.cs @@ -5,8 +5,6 @@ using System.Diagnostics; -#nullable disable - namespace Microsoft.VisualStudio.TestPlatform.PlatformAbstractions; public static class ProcessStartInfoExtensions @@ -17,7 +15,7 @@ public static class ProcessStartInfoExtensions /// The process start info /// Environment Variable name. /// Environment Variable value. - public static void AddEnvironmentVariable(this ProcessStartInfo startInfo, string name, string value) + public static void AddEnvironmentVariable(this ProcessStartInfo startInfo, string name, string? value) { startInfo.Environment[name] = value; } diff --git a/src/Microsoft.TestPlatform.PlatformAbstractions/netstandard/IO/PlatformStream.cs b/src/Microsoft.TestPlatform.PlatformAbstractions/netstandard/IO/PlatformStream.cs index 3079a60a8b..def1d7ceed 100644 --- a/src/Microsoft.TestPlatform.PlatformAbstractions/netstandard/IO/PlatformStream.cs +++ b/src/Microsoft.TestPlatform.PlatformAbstractions/netstandard/IO/PlatformStream.cs @@ -8,8 +8,6 @@ using Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.Interfaces; -#nullable disable - namespace Microsoft.VisualStudio.TestPlatform.PlatformAbstractions; /// diff --git a/src/Microsoft.TestPlatform.PlatformAbstractions/netstandard/Runtime/PlatformAssemblyExtensions.cs b/src/Microsoft.TestPlatform.PlatformAbstractions/netstandard/Runtime/PlatformAssemblyExtensions.cs index 9b6243ab35..a203f23dbb 100644 --- a/src/Microsoft.TestPlatform.PlatformAbstractions/netstandard/Runtime/PlatformAssemblyExtensions.cs +++ b/src/Microsoft.TestPlatform.PlatformAbstractions/netstandard/Runtime/PlatformAssemblyExtensions.cs @@ -6,8 +6,6 @@ using System; using System.Reflection; -#nullable disable - namespace Microsoft.VisualStudio.TestPlatform.PlatformAbstractions; public static class PlatformAssemblyExtensions diff --git a/src/Microsoft.TestPlatform.PlatformAbstractions/netstandard/Runtime/PlatformAssemblyLoadContext.cs b/src/Microsoft.TestPlatform.PlatformAbstractions/netstandard/Runtime/PlatformAssemblyLoadContext.cs index 9b201b15a6..f53b92a8da 100644 --- a/src/Microsoft.TestPlatform.PlatformAbstractions/netstandard/Runtime/PlatformAssemblyLoadContext.cs +++ b/src/Microsoft.TestPlatform.PlatformAbstractions/netstandard/Runtime/PlatformAssemblyLoadContext.cs @@ -7,8 +7,6 @@ using Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.Interfaces; -#nullable disable - namespace Microsoft.VisualStudio.TestPlatform.PlatformAbstractions; /// diff --git a/src/Microsoft.TestPlatform.PlatformAbstractions/netstandard/Runtime/PlatformAssemblyResolver.cs b/src/Microsoft.TestPlatform.PlatformAbstractions/netstandard/Runtime/PlatformAssemblyResolver.cs index 6df8dcb259..0708b2214a 100644 --- a/src/Microsoft.TestPlatform.PlatformAbstractions/netstandard/Runtime/PlatformAssemblyResolver.cs +++ b/src/Microsoft.TestPlatform.PlatformAbstractions/netstandard/Runtime/PlatformAssemblyResolver.cs @@ -7,8 +7,6 @@ using Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.Interfaces; -#nullable disable - namespace Microsoft.VisualStudio.TestPlatform.PlatformAbstractions; /// @@ -20,7 +18,7 @@ public PlatformAssemblyResolver() } /// - public event AssemblyResolveEventHandler AssemblyResolve; + public event AssemblyResolveEventHandler? AssemblyResolve; public void Dispose() { @@ -29,7 +27,7 @@ public void Dispose() private void DummyEventThrower() { - AssemblyResolve(this, null); + AssemblyResolve?.Invoke(this, null); } } diff --git a/src/Microsoft.TestPlatform.PlatformAbstractions/netstandard/System/PlatformEnvironment.cs b/src/Microsoft.TestPlatform.PlatformAbstractions/netstandard/System/PlatformEnvironment.cs index 83e63e4f86..61d274b2bd 100644 --- a/src/Microsoft.TestPlatform.PlatformAbstractions/netstandard/System/PlatformEnvironment.cs +++ b/src/Microsoft.TestPlatform.PlatformAbstractions/netstandard/System/PlatformEnvironment.cs @@ -7,8 +7,6 @@ using Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.Interfaces; -#nullable disable - namespace Microsoft.VisualStudio.TestPlatform.PlatformAbstractions; /// diff --git a/src/Microsoft.TestPlatform.PlatformAbstractions/netstandard/System/PlatformThread.cs b/src/Microsoft.TestPlatform.PlatformAbstractions/netstandard/System/PlatformThread.cs index ceed938e51..82210bdf6f 100644 --- a/src/Microsoft.TestPlatform.PlatformAbstractions/netstandard/System/PlatformThread.cs +++ b/src/Microsoft.TestPlatform.PlatformAbstractions/netstandard/System/PlatformThread.cs @@ -7,15 +7,13 @@ using Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.Interfaces; -#nullable disable - namespace Microsoft.VisualStudio.TestPlatform.PlatformAbstractions; /// public class PlatformThread : IThread { /// - public void Run(Action action, PlatformApartmentState platformApartmentState, bool waitForCompletion) + public void Run(Action? action, PlatformApartmentState platformApartmentState, bool waitForCompletion) { throw new NotImplementedException(); } diff --git a/src/Microsoft.TestPlatform.PlatformAbstractions/netstandard/System/ProcessHelper.cs b/src/Microsoft.TestPlatform.PlatformAbstractions/netstandard/System/ProcessHelper.cs index 181b8c3efa..617eccc2fa 100644 --- a/src/Microsoft.TestPlatform.PlatformAbstractions/netstandard/System/ProcessHelper.cs +++ b/src/Microsoft.TestPlatform.PlatformAbstractions/netstandard/System/ProcessHelper.cs @@ -8,8 +8,6 @@ using Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.Interfaces; -#nullable disable - namespace Microsoft.VisualStudio.TestPlatform.PlatformAbstractions; /// @@ -18,14 +16,7 @@ namespace Microsoft.VisualStudio.TestPlatform.PlatformAbstractions; public class ProcessHelper : IProcessHelper { /// - public object LaunchProcess( - string processPath, - string arguments, - string workingDirectory, - IDictionary environmentVariables, - Action errorCallback, - Action exitCallBack, - Action ouputCallBack) + public object LaunchProcess(string processPath, string arguments, string workingDirectory, IDictionary? envVariables, Action? errorCallback, Action? exitCallBack, Action? outputCallBack) { throw new NotImplementedException(); } @@ -61,25 +52,25 @@ public string GetProcessName(int processId) } /// - public bool TryGetExitCode(object process, out int exitCode) + public bool TryGetExitCode(object? process, out int exitCode) { throw new NotImplementedException(); } /// - public void SetExitCallback(int parentProcessId, Action callbackAction) + public void SetExitCallback(int parentProcessId, Action? callbackAction) { throw new NotImplementedException(); } /// - public void TerminateProcess(object process) + public void TerminateProcess(object? process) { throw new NotImplementedException(); } /// - public int GetProcessId(object process) + public int GetProcessId(object? process) { throw new NotImplementedException(); } @@ -97,7 +88,7 @@ public PlatformArchitecture GetCurrentProcessArchitecture() } /// - public void WaitForProcessExit(object process) + public void WaitForProcessExit(object? process) { throw new NotImplementedException(); } diff --git a/src/Microsoft.TestPlatform.PlatformAbstractions/netstandard/Tracing/PlatformEqtTrace.cs b/src/Microsoft.TestPlatform.PlatformAbstractions/netstandard/Tracing/PlatformEqtTrace.cs index 4d1d220e4e..20f1cfc645 100644 --- a/src/Microsoft.TestPlatform.PlatformAbstractions/netstandard/Tracing/PlatformEqtTrace.cs +++ b/src/Microsoft.TestPlatform.PlatformAbstractions/netstandard/Tracing/PlatformEqtTrace.cs @@ -6,8 +6,6 @@ using System; using System.Diagnostics; -#nullable disable - namespace Microsoft.VisualStudio.TestPlatform.ObjectModel; /// @@ -27,7 +25,7 @@ public class PlatformEqtTrace : IPlatformEqtTrace { private PlatformTraceLevel _traceLevel = PlatformTraceLevel.Off; - public static string ErrorOnInitialization { get; set; } + public static string? ErrorOnInitialization { get; set; } public bool DoNotInitialize { get; set; } @@ -72,7 +70,7 @@ public bool ShouldTrace(PlatformTraceLevel traceLevel) return !DoNotInitialize && (int)_traceLevel >= (int)traceLevel; } - public string GetLogFile() => string.Empty; + public string? GetLogFile() => string.Empty; public void SetTraceLevel(PlatformTraceLevel value) { diff --git a/src/Microsoft.TestPlatform.PlatformAbstractions/uap10.0/IO/PlatformStream.cs b/src/Microsoft.TestPlatform.PlatformAbstractions/uap10.0/IO/PlatformStream.cs index 01c2425af4..a854028d62 100644 --- a/src/Microsoft.TestPlatform.PlatformAbstractions/uap10.0/IO/PlatformStream.cs +++ b/src/Microsoft.TestPlatform.PlatformAbstractions/uap10.0/IO/PlatformStream.cs @@ -7,8 +7,6 @@ using Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.Interfaces; -#nullable disable - namespace Microsoft.VisualStudio.TestPlatform.PlatformAbstractions; /// diff --git a/src/Microsoft.TestPlatform.PlatformAbstractions/uap10.0/Runtime/PlatformAssemblyExtensions.cs b/src/Microsoft.TestPlatform.PlatformAbstractions/uap10.0/Runtime/PlatformAssemblyExtensions.cs index c26ccd4e08..1db7507c0d 100644 --- a/src/Microsoft.TestPlatform.PlatformAbstractions/uap10.0/Runtime/PlatformAssemblyExtensions.cs +++ b/src/Microsoft.TestPlatform.PlatformAbstractions/uap10.0/Runtime/PlatformAssemblyExtensions.cs @@ -7,8 +7,6 @@ using System.IO; using System.Reflection; -#nullable disable - namespace Microsoft.VisualStudio.TestPlatform.PlatformAbstractions; /// diff --git a/src/Microsoft.TestPlatform.PlatformAbstractions/uap10.0/Runtime/PlatformAssemblyLoadContext.cs b/src/Microsoft.TestPlatform.PlatformAbstractions/uap10.0/Runtime/PlatformAssemblyLoadContext.cs index f73cc900d9..291734160e 100644 --- a/src/Microsoft.TestPlatform.PlatformAbstractions/uap10.0/Runtime/PlatformAssemblyLoadContext.cs +++ b/src/Microsoft.TestPlatform.PlatformAbstractions/uap10.0/Runtime/PlatformAssemblyLoadContext.cs @@ -8,8 +8,6 @@ using Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.Interfaces; -#nullable disable - namespace Microsoft.VisualStudio.TestPlatform.PlatformAbstractions; /// diff --git a/src/Microsoft.TestPlatform.PlatformAbstractions/uap10.0/Runtime/PlatformAssemblyResolver.cs b/src/Microsoft.TestPlatform.PlatformAbstractions/uap10.0/Runtime/PlatformAssemblyResolver.cs index 89bd2b84b2..201589cf88 100644 --- a/src/Microsoft.TestPlatform.PlatformAbstractions/uap10.0/Runtime/PlatformAssemblyResolver.cs +++ b/src/Microsoft.TestPlatform.PlatformAbstractions/uap10.0/Runtime/PlatformAssemblyResolver.cs @@ -5,8 +5,6 @@ using Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.Interfaces; -#nullable disable - namespace Microsoft.VisualStudio.TestPlatform.PlatformAbstractions; /// @@ -17,7 +15,7 @@ public PlatformAssemblyResolver() } /// - public event AssemblyResolveEventHandler AssemblyResolve; + public event AssemblyResolveEventHandler? AssemblyResolve; public void Dispose() { @@ -26,7 +24,7 @@ public void Dispose() private void DummyEventThrower() { // need to raise this event, else compiler throws error - AssemblyResolve(this, null); + AssemblyResolve?.Invoke(this, null); } } diff --git a/src/Microsoft.TestPlatform.PlatformAbstractions/uap10.0/System/PlatformEnvironment.cs b/src/Microsoft.TestPlatform.PlatformAbstractions/uap10.0/System/PlatformEnvironment.cs index 78695351b7..3be2617a80 100644 --- a/src/Microsoft.TestPlatform.PlatformAbstractions/uap10.0/System/PlatformEnvironment.cs +++ b/src/Microsoft.TestPlatform.PlatformAbstractions/uap10.0/System/PlatformEnvironment.cs @@ -8,8 +8,6 @@ using Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.Interfaces; -#nullable disable - namespace Microsoft.VisualStudio.TestPlatform.PlatformAbstractions; /// @@ -17,42 +15,23 @@ public class PlatformEnvironment : IEnvironment { /// public PlatformArchitecture Architecture - { - get + => RuntimeInformation.OSArchitecture switch { - switch (RuntimeInformation.OSArchitecture) - { - case System.Runtime.InteropServices.Architecture.X86: - return PlatformArchitecture.X86; - case System.Runtime.InteropServices.Architecture.X64: - return PlatformArchitecture.X64; - case System.Runtime.InteropServices.Architecture.Arm: - return PlatformArchitecture.ARM; - case System.Runtime.InteropServices.Architecture.Arm64: - return PlatformArchitecture.ARM64; - default: - throw new NotSupportedException(); - } - } - } + System.Runtime.InteropServices.Architecture.X86 => PlatformArchitecture.X86, + System.Runtime.InteropServices.Architecture.X64 => PlatformArchitecture.X64, + System.Runtime.InteropServices.Architecture.Arm => PlatformArchitecture.ARM, + System.Runtime.InteropServices.Architecture.Arm64 => PlatformArchitecture.ARM64, + _ => throw new NotSupportedException(), + }; /// public PlatformOperatingSystem OperatingSystem - { - get - { - return RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? PlatformOperatingSystem.Windows : PlatformOperatingSystem.Unix; - } - } + => RuntimeInformation.IsOSPlatform(OSPlatform.Windows) + ? PlatformOperatingSystem.Windows + : PlatformOperatingSystem.Unix; /// - public string OperatingSystemVersion - { - get - { - return RuntimeInformation.OSDescription; - } - } + public string OperatingSystemVersion => RuntimeInformation.OSDescription; /// public void Exit(int exitcode) diff --git a/src/Microsoft.TestPlatform.PlatformAbstractions/uap10.0/System/PlatformThread.cs b/src/Microsoft.TestPlatform.PlatformAbstractions/uap10.0/System/PlatformThread.cs index b991342165..d43b6fb32a 100644 --- a/src/Microsoft.TestPlatform.PlatformAbstractions/uap10.0/System/PlatformThread.cs +++ b/src/Microsoft.TestPlatform.PlatformAbstractions/uap10.0/System/PlatformThread.cs @@ -8,14 +8,12 @@ using Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.Interfaces; -#nullable disable - namespace Microsoft.VisualStudio.TestPlatform.PlatformAbstractions; public class PlatformThread : IThread { /// - public void Run(Action action, PlatformApartmentState apartmentState, bool waitForCompletion) + public void Run(Action? action, PlatformApartmentState apartmentState, bool waitForCompletion) { if (apartmentState == PlatformApartmentState.STA) { diff --git a/src/Microsoft.TestPlatform.PlatformAbstractions/uap10.0/System/ProcessHelper.cs b/src/Microsoft.TestPlatform.PlatformAbstractions/uap10.0/System/ProcessHelper.cs index f3ddf331c9..ed336c2933 100644 --- a/src/Microsoft.TestPlatform.PlatformAbstractions/uap10.0/System/ProcessHelper.cs +++ b/src/Microsoft.TestPlatform.PlatformAbstractions/uap10.0/System/ProcessHelper.cs @@ -9,8 +9,6 @@ using Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.Interfaces; -#nullable disable - namespace Microsoft.VisualStudio.TestPlatform.PlatformAbstractions; /// @@ -19,14 +17,7 @@ namespace Microsoft.VisualStudio.TestPlatform.PlatformAbstractions; public partial class ProcessHelper : IProcessHelper { /// - public object LaunchProcess( - string processPath, - string arguments, - string workingDirectory, - IDictionary environmentVariables, - Action errorCallback, - Action exitCallBack, - Action outputCallback) + public object LaunchProcess(string processPath, string arguments, string workingDirectory, IDictionary? envVariables, Action? errorCallback, Action? exitCallBack, Action? outputCallBack) { throw new NotImplementedException(); } @@ -62,24 +53,24 @@ public string GetProcessName(int processId) } /// - public bool TryGetExitCode(object process, out int exitCode) + public bool TryGetExitCode(object? process, out int exitCode) { throw new NotImplementedException(); } /// - public void SetExitCallback(int parentProcessId, Action callbackAction) + public void SetExitCallback(int parentProcessId, Action? callbackAction) { } /// - public void TerminateProcess(object process) + public void TerminateProcess(object? process) { throw new NotImplementedException(); } /// - public int GetProcessId(object process) + public int GetProcessId(object? process) { return -1; } @@ -98,7 +89,7 @@ public string GetNativeDllDirectory() } /// - public void WaitForProcessExit(object process) + public void WaitForProcessExit(object? process) { throw new NotImplementedException(); } diff --git a/src/Microsoft.TestPlatform.PlatformAbstractions/uap10.0/Tracing/FileEventListener.cs b/src/Microsoft.TestPlatform.PlatformAbstractions/uap10.0/Tracing/FileEventListener.cs index 572e8258ad..4ac201a38c 100644 --- a/src/Microsoft.TestPlatform.PlatformAbstractions/uap10.0/Tracing/FileEventListener.cs +++ b/src/Microsoft.TestPlatform.PlatformAbstractions/uap10.0/Tracing/FileEventListener.cs @@ -11,8 +11,6 @@ using System.Threading; using System.Threading.Tasks; -#nullable disable - namespace Microsoft.VisualStudio.TestPlatform.ObjectModel; internal sealed class FileEventListener : EventListener @@ -20,12 +18,12 @@ internal sealed class FileEventListener : EventListener /// /// Storage file to be used to write logs /// - private FileStream _fileStream; + private readonly FileStream _fileStream; /// /// StreamWriter to write logs to file /// - private StreamWriter _streamWriter; + private readonly StreamWriter _streamWriter; /// /// Name of the current log file @@ -43,7 +41,11 @@ public FileEventListener(string name) { _fileName = name; - AssignLocalFile(); + _fileStream = new FileStream(_fileName, FileMode.Append | FileMode.OpenOrCreate); + _streamWriter = new StreamWriter(_fileStream) + { + AutoFlush = true + }; } protected override void OnEventWritten(EventWrittenEventArgs eventData) @@ -64,15 +66,6 @@ protected override void OnEventWritten(EventWrittenEventArgs eventData) WriteToFile(lines); } - private void AssignLocalFile() - { - _fileStream = new FileStream(_fileName, FileMode.Append | FileMode.OpenOrCreate); - _streamWriter = new StreamWriter(_fileStream) - { - AutoFlush = true - }; - } - private async void WriteToFile(IEnumerable lines) { await _semaphoreSlim.WaitAsync(); diff --git a/src/Microsoft.TestPlatform.PlatformAbstractions/uap10.0/Tracing/PlatformEqtTrace.cs b/src/Microsoft.TestPlatform.PlatformAbstractions/uap10.0/Tracing/PlatformEqtTrace.cs index cb2441a799..44f1bb5de1 100644 --- a/src/Microsoft.TestPlatform.PlatformAbstractions/uap10.0/Tracing/PlatformEqtTrace.cs +++ b/src/Microsoft.TestPlatform.PlatformAbstractions/uap10.0/Tracing/PlatformEqtTrace.cs @@ -7,8 +7,6 @@ using System.Diagnostics.Tracing; using System.IO; -#nullable disable - namespace Microsoft.VisualStudio.TestPlatform.ObjectModel; /// @@ -30,9 +28,9 @@ public class PlatformEqtTrace : IPlatformEqtTrace private static bool s_isInitialized; - public static string ErrorOnInitialization { get; set; } + public static string? ErrorOnInitialization { get; set; } - public static string LogFile { get; set; } + public static string? LogFile { get; set; } public bool DoNotInitialize { @@ -103,7 +101,7 @@ public bool ShouldTrace(PlatformTraceLevel traceLevel) } /// - public string GetLogFile() + public string? GetLogFile() { return LogFile; } @@ -137,7 +135,7 @@ private bool TraceInitialized() try { - var eventListener = new FileEventListener(string.IsNullOrEmpty(LogFile) ? "UnitTestLog" : LogFile); + var eventListener = new FileEventListener(LogFile.IsNullOrEmpty() ? "UnitTestLog" : LogFile); PlatformTraceLevel traceLevel = GetTraceLevel(); if (traceLevel > PlatformTraceLevel.Off) diff --git a/src/Microsoft.TestPlatform.PlatformAbstractions/uap10.0/Tracing/UnitTestEventSource.cs b/src/Microsoft.TestPlatform.PlatformAbstractions/uap10.0/Tracing/UnitTestEventSource.cs index 2fe33706e0..90871a160b 100644 --- a/src/Microsoft.TestPlatform.PlatformAbstractions/uap10.0/Tracing/UnitTestEventSource.cs +++ b/src/Microsoft.TestPlatform.PlatformAbstractions/uap10.0/Tracing/UnitTestEventSource.cs @@ -5,8 +5,6 @@ using System.Diagnostics.Tracing; -#nullable disable - namespace Microsoft.VisualStudio.TestPlatform.ObjectModel; internal sealed class UnitTestEventSource : EventSource diff --git a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Client/ProxyOperationManagerTests.cs b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Client/ProxyOperationManagerTests.cs index a0a7f75af9..8f4d7e05b9 100644 --- a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Client/ProxyOperationManagerTests.cs +++ b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Client/ProxyOperationManagerTests.cs @@ -4,6 +4,7 @@ using System; using System.Collections.Generic; using System.Diagnostics; +using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.Linq; using System.Net; @@ -26,8 +27,6 @@ using Moq; -#nullable disable - namespace TestPlatform.CrossPlatEngine.UnitTests.Client; [TestClass] @@ -35,35 +34,26 @@ public class ProxyOperationManagerTests : ProxyBaseManagerTests { private const int Clientprocessexitwait = 10 * 1000; - private readonly ProxyOperationManager _testOperationManager; + private static readonly int ConnectionTimeout = EnvironmentHelper.DefaultConnectionTimeout * 1000; + private static readonly string DefaultRunSettings = "\r\n\r\n \r\n {0}\r\n \r\n"; + private static readonly string TimoutErrorMessage = + "vstest.console process failed to connect to testhost process after 90 seconds. This may occur due to machine slowness, please set environment variable VSTEST_CONNECTION_TIMEOUT to increase timeout."; + private readonly ProxyOperationManager _testOperationManager; private readonly Mock _mockRequestSender; - - private Mock _mockProcessHelper; - - private Mock _mockRunsettingHelper; - - private Mock _mockWindowsRegistry; - - private Mock _mockEnvironmentVariableHelper; - - private Mock _mockFileHelper; - - private Mock _mockEnvironment; - private readonly Mock _mockRequestData; - private readonly int _connectionTimeout = EnvironmentHelper.DefaultConnectionTimeout * 1000; - - private readonly string _defaultRunSettings = "\r\n\r\n \r\n {0}\r\n \r\n"; - - private static readonly string TimoutErrorMessage = - "vstest.console process failed to connect to testhost process after 90 seconds. This may occur due to machine slowness, please set environment variable VSTEST_CONNECTION_TIMEOUT to increase timeout."; + private Mock? _mockProcessHelper; + private Mock? _mockRunsettingHelper; + private Mock? _mockWindowsRegistry; + private Mock? _mockEnvironmentVariableHelper; + private Mock? _mockFileHelper; + private Mock? _mockEnvironment; public ProxyOperationManagerTests() { _mockRequestSender = new Mock(); - _mockRequestSender.Setup(rs => rs.WaitForRequestHandlerConnection(_connectionTimeout, It.IsAny())).Returns(true); + _mockRequestSender.Setup(rs => rs.WaitForRequestHandlerConnection(ConnectionTimeout, It.IsAny())).Returns(true); _mockRequestData = new Mock(); _mockRequestData.Setup(rd => rd.MetricsCollection).Returns(new Mock().Object); _testOperationManager = new TestableProxyOperationManager(_mockRequestData.Object, _mockRequestSender.Object, _mockTestHostManager.Object); @@ -84,7 +74,7 @@ public void SetupChannelShouldLaunchTestHost() th => th.GetTestHostProcessStartInfo(Enumerable.Empty(), It.IsAny>(), It.IsAny())) .Returns(expectedStartInfo); - _testOperationManager.SetupChannel(Enumerable.Empty(), _defaultRunSettings); + _testOperationManager.SetupChannel(Enumerable.Empty(), DefaultRunSettings); _mockTestHostManager.Verify(thl => thl.LaunchTestHostAsync(It.Is(si => si == expectedStartInfo), It.IsAny()), Times.Once); } @@ -95,7 +85,7 @@ public void SetupChannelShouldCreateTimestampedLogFileForHost() _mockRequestSender.Setup(rs => rs.InitializeCommunication()).Returns(123); EqtTrace.InitializeTrace("log.txt", PlatformTraceLevel.Verbose); - _testOperationManager.SetupChannel(Enumerable.Empty(), _defaultRunSettings); + _testOperationManager.SetupChannel(Enumerable.Empty(), DefaultRunSettings); _mockTestHostManager.Verify( th => @@ -117,7 +107,7 @@ public void SetupChannelShouldAddRunnerProcessIdForTestHost() { _mockRequestSender.Setup(rs => rs.InitializeCommunication()).Returns(123); - _testOperationManager.SetupChannel(Enumerable.Empty(), _defaultRunSettings); + _testOperationManager.SetupChannel(Enumerable.Empty(), DefaultRunSettings); _mockTestHostManager.Verify( th => @@ -137,7 +127,7 @@ public void SetupChannelShouldAddCorrectTraceLevelForTestHost() #endif _mockRequestSender.Setup(rs => rs.InitializeCommunication()).Returns(123); - _testOperationManager.SetupChannel(Enumerable.Empty(), _defaultRunSettings); + _testOperationManager.SetupChannel(Enumerable.Empty(), DefaultRunSettings); _mockTestHostManager.Verify( th => @@ -150,7 +140,7 @@ public void SetupChannelShouldAddCorrectTraceLevelForTestHost() [TestMethod] public void SetupChannelShouldSetupServerForCommunication() { - _testOperationManager.SetupChannel(Enumerable.Empty(), _defaultRunSettings); + _testOperationManager.SetupChannel(Enumerable.Empty(), DefaultRunSettings); _mockRequestSender.Verify(s => s.InitializeCommunication(), Times.Once); } @@ -177,7 +167,7 @@ public void SetupChannelShouldCallHostServerIfRunnerIsServer() var localTestOperationManager = new TestableProxyOperationManager(_mockRequestData.Object, testRequestSender, _mockTestHostManager.Object); - localTestOperationManager.SetupChannel(Enumerable.Empty(), _defaultRunSettings); + localTestOperationManager.SetupChannel(Enumerable.Empty(), DefaultRunSettings); mockCommunicationServer.Verify(s => s.Start(IPAddress.Loopback.ToString() + ":0"), Times.Once); } @@ -205,7 +195,7 @@ public void SetupChannelShouldCallSetupClientIfRunnerIsClient() var localTestOperationManager = new TestableProxyOperationManager(_mockRequestData.Object, testRequestSender, _mockTestHostManager.Object); - localTestOperationManager.SetupChannel(Enumerable.Empty(), _defaultRunSettings); + localTestOperationManager.SetupChannel(Enumerable.Empty(), DefaultRunSettings); mockCommunicationEndpoint.Verify(s => s.Start(It.IsAny()), Times.Once); } @@ -213,8 +203,8 @@ public void SetupChannelShouldCallSetupClientIfRunnerIsClient() [TestMethod] public void SetupChannelShouldNotInitializeIfConnectionIsAlreadyInitialized() { - _testOperationManager.SetupChannel(Enumerable.Empty(), _defaultRunSettings); - _testOperationManager.SetupChannel(Enumerable.Empty(), _defaultRunSettings); + _testOperationManager.SetupChannel(Enumerable.Empty(), DefaultRunSettings); + _testOperationManager.SetupChannel(Enumerable.Empty(), DefaultRunSettings); _mockRequestSender.Verify(s => s.InitializeCommunication(), Times.Once); } @@ -222,18 +212,18 @@ public void SetupChannelShouldNotInitializeIfConnectionIsAlreadyInitialized() [TestMethod] public void SetupChannelShouldWaitForTestHostConnection() { - _testOperationManager.SetupChannel(Enumerable.Empty(), _defaultRunSettings); + _testOperationManager.SetupChannel(Enumerable.Empty(), DefaultRunSettings); - _mockRequestSender.Verify(rs => rs.WaitForRequestHandlerConnection(_connectionTimeout, It.IsAny()), Times.Once); + _mockRequestSender.Verify(rs => rs.WaitForRequestHandlerConnection(ConnectionTimeout, It.IsAny()), Times.Once); } [TestMethod] public void SetupChannelShouldNotWaitForTestHostConnectionIfConnectionIsInitialized() { - _testOperationManager.SetupChannel(Enumerable.Empty(), _defaultRunSettings); - _testOperationManager.SetupChannel(Enumerable.Empty(), _defaultRunSettings); + _testOperationManager.SetupChannel(Enumerable.Empty(), DefaultRunSettings); + _testOperationManager.SetupChannel(Enumerable.Empty(), DefaultRunSettings); - _mockRequestSender.Verify(rs => rs.WaitForRequestHandlerConnection(_connectionTimeout, It.IsAny()), Times.Exactly(1)); + _mockRequestSender.Verify(rs => rs.WaitForRequestHandlerConnection(ConnectionTimeout, It.IsAny()), Times.Exactly(1)); } [TestMethod] @@ -242,7 +232,7 @@ public void SetupChannelShouldHonorTimeOutSetByUser() Environment.SetEnvironmentVariable(EnvironmentHelper.VstestConnectionTimeout, "100"); _mockRequestSender.Setup(rs => rs.WaitForRequestHandlerConnection(100000, It.IsAny())).Returns(true); - _testOperationManager.SetupChannel(Enumerable.Empty(), _defaultRunSettings); + _testOperationManager.SetupChannel(Enumerable.Empty(), DefaultRunSettings); _mockRequestSender.Verify(rs => rs.WaitForRequestHandlerConnection(100000, It.IsAny()), Times.Exactly(1)); } @@ -251,11 +241,11 @@ public void SetupChannelShouldHonorTimeOutSetByUser() public void SetupChannelShouldThrowIfWaitForTestHostConnectionTimesOut() { SetupTestHostLaunched(true); - _mockRequestSender.Setup(rs => rs.WaitForRequestHandlerConnection(_connectionTimeout, It.IsAny())).Returns(false); + _mockRequestSender.Setup(rs => rs.WaitForRequestHandlerConnection(ConnectionTimeout, It.IsAny())).Returns(false); var operationManager = new TestableProxyOperationManager(_mockRequestData.Object, _mockRequestSender.Object, _mockTestHostManager.Object); - var message = Assert.ThrowsException(() => operationManager.SetupChannel(Enumerable.Empty(), _defaultRunSettings)).Message; + var message = Assert.ThrowsException(() => operationManager.SetupChannel(Enumerable.Empty(), DefaultRunSettings)).Message; Assert.AreEqual(message, TimoutErrorMessage); } @@ -263,13 +253,13 @@ public void SetupChannelShouldThrowIfWaitForTestHostConnectionTimesOut() public void SetupChannelShouldThrowTestPlatformExceptionIfRequestCancelled() { SetupTestHostLaunched(true); - _mockRequestSender.Setup(rs => rs.WaitForRequestHandlerConnection(_connectionTimeout, It.IsAny())).Returns(false); + _mockRequestSender.Setup(rs => rs.WaitForRequestHandlerConnection(ConnectionTimeout, It.IsAny())).Returns(false); var cancellationTokenSource = new CancellationTokenSource(); var operationManager = new TestableProxyOperationManager(_mockRequestData.Object, _mockRequestSender.Object, _mockTestHostManager.Object, cancellationTokenSource); cancellationTokenSource.Cancel(); - var message = Assert.ThrowsException(() => operationManager.SetupChannel(Enumerable.Empty(), _defaultRunSettings)).Message; + var message = Assert.ThrowsException(() => operationManager.SetupChannel(Enumerable.Empty(), DefaultRunSettings)).Message; Equals("Canceling the operation as requested.", message); } @@ -277,14 +267,14 @@ public void SetupChannelShouldThrowTestPlatformExceptionIfRequestCancelled() public void SetupChannelShouldThrowTestPlatformExceptionIfRequestCancelledDuringLaunchOfTestHost() { SetupTestHostLaunched(true); - _mockRequestSender.Setup(rs => rs.WaitForRequestHandlerConnection(_connectionTimeout, It.IsAny())).Returns(false); + _mockRequestSender.Setup(rs => rs.WaitForRequestHandlerConnection(ConnectionTimeout, It.IsAny())).Returns(false); _mockTestHostManager.Setup(rs => rs.LaunchTestHostAsync(It.IsAny(), It.IsAny())).Callback(() => Task.Run(() => throw new OperationCanceledException())); var cancellationTokenSource = new CancellationTokenSource(); var operationManager = new TestableProxyOperationManager(_mockRequestData.Object, _mockRequestSender.Object, _mockTestHostManager.Object, cancellationTokenSource); - var message = Assert.ThrowsException(() => operationManager.SetupChannel(Enumerable.Empty(), _defaultRunSettings)).Message; + var message = Assert.ThrowsException(() => operationManager.SetupChannel(Enumerable.Empty(), DefaultRunSettings)).Message; Equals("Canceling the operation as requested.", message); } @@ -292,13 +282,13 @@ public void SetupChannelShouldThrowTestPlatformExceptionIfRequestCancelledDuring public void SetupChannelShouldThrowTestPlatformExceptionIfRequestCancelledPostHostLaunchDuringWaitForHandlerConnection() { SetupTestHostLaunched(true); - _mockRequestSender.Setup(rs => rs.WaitForRequestHandlerConnection(_connectionTimeout, It.IsAny())).Returns(false); + _mockRequestSender.Setup(rs => rs.WaitForRequestHandlerConnection(ConnectionTimeout, It.IsAny())).Returns(false); var cancellationTokenSource = new CancellationTokenSource(); _mockTestHostManager.Setup(rs => rs.LaunchTestHostAsync(It.IsAny(), It.IsAny())).Callback(() => cancellationTokenSource.Cancel()); var operationManager = new TestableProxyOperationManager(_mockRequestData.Object, _mockRequestSender.Object, _mockTestHostManager.Object, cancellationTokenSource); - var message = Assert.ThrowsException(() => operationManager.SetupChannel(Enumerable.Empty(), _defaultRunSettings)).Message; + var message = Assert.ThrowsException(() => operationManager.SetupChannel(Enumerable.Empty(), DefaultRunSettings)).Message; Equals("Canceling the operation as requested.", message); } @@ -306,18 +296,18 @@ public void SetupChannelShouldThrowTestPlatformExceptionIfRequestCancelledPostHo public void SetupChannelShouldThrowIfLaunchTestHostFails() { SetupTestHostLaunched(false); - _mockRequestSender.Setup(rs => rs.WaitForRequestHandlerConnection(_connectionTimeout, It.IsAny())).Returns(true); + _mockRequestSender.Setup(rs => rs.WaitForRequestHandlerConnection(ConnectionTimeout, It.IsAny())).Returns(true); var operationManager = new TestableProxyOperationManager(_mockRequestData.Object, _mockRequestSender.Object, _mockTestHostManager.Object); - var message = Assert.ThrowsException(() => operationManager.SetupChannel(Enumerable.Empty(), _defaultRunSettings)).Message; + var message = Assert.ThrowsException(() => operationManager.SetupChannel(Enumerable.Empty(), DefaultRunSettings)).Message; Assert.AreEqual(message, string.Format(CultureInfo.CurrentUICulture, Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Resources.Resources.InitializationFailed)); } [TestMethod] public void SetupChannelShouldCheckVersionWithTestHost() { - _testOperationManager.SetupChannel(Enumerable.Empty(), _defaultRunSettings); + _testOperationManager.SetupChannel(Enumerable.Empty(), DefaultRunSettings); _mockRequestSender.Verify(rs => rs.CheckVersionWithTestHost(), Times.Once); } @@ -326,7 +316,7 @@ public void SetupChannelShouldThrowExceptionIfVersionCheckFails() { // Make the version check fail _mockRequestSender.Setup(rs => rs.CheckVersionWithTestHost()).Throws(new TestPlatformException("Version check failed")); - Assert.ThrowsException(() => _testOperationManager.SetupChannel(Enumerable.Empty(), _defaultRunSettings)); + Assert.ThrowsException(() => _testOperationManager.SetupChannel(Enumerable.Empty(), DefaultRunSettings)); } [TestMethod] @@ -336,7 +326,7 @@ public void SetupChannelForDotnetHostManagerWithIsVersionCheckRequiredFalseShoul var testHostManager = new TestableDotnetTestHostManager(false, _mockProcessHelper.Object, _mockFileHelper.Object, _mockEnvironment.Object, _mockRunsettingHelper.Object, _mockWindowsRegistry.Object, _mockEnvironmentVariableHelper.Object); var operationManager = new TestableProxyOperationManager(_mockRequestData.Object, _mockRequestSender.Object, testHostManager); - operationManager.SetupChannel(Enumerable.Empty(), _defaultRunSettings); + operationManager.SetupChannel(Enumerable.Empty(), DefaultRunSettings); _mockRequestSender.Verify(rs => rs.CheckVersionWithTestHost(), Times.Never); } @@ -348,7 +338,7 @@ public void SetupChannelForDotnetHostManagerWithIsVersionCheckRequiredTrueShould var testHostManager = new TestableDotnetTestHostManager(true, _mockProcessHelper.Object, _mockFileHelper.Object, _mockEnvironment.Object, _mockRunsettingHelper.Object, _mockWindowsRegistry.Object, _mockEnvironmentVariableHelper.Object); var operationManager = new TestableProxyOperationManager(_mockRequestData.Object, _mockRequestSender.Object, testHostManager); - operationManager.SetupChannel(Enumerable.Empty(), _defaultRunSettings); + operationManager.SetupChannel(Enumerable.Empty(), DefaultRunSettings); _mockRequestSender.Verify(rs => rs.CheckVersionWithTestHost(), Times.Once); } @@ -356,8 +346,8 @@ public void SetupChannelForDotnetHostManagerWithIsVersionCheckRequiredTrueShould [TestMethod] public void CloseShouldEndSessionIfHostWasLaunched() { - _mockRequestSender.Setup(rs => rs.WaitForRequestHandlerConnection(_connectionTimeout, It.IsAny())).Returns(true); - _testOperationManager.SetupChannel(Enumerable.Empty(), _defaultRunSettings); + _mockRequestSender.Setup(rs => rs.WaitForRequestHandlerConnection(ConnectionTimeout, It.IsAny())).Returns(true); + _testOperationManager.SetupChannel(Enumerable.Empty(), DefaultRunSettings); _testOperationManager.Close(); @@ -384,12 +374,12 @@ public void CloseShouldAlwaysCleanTestHost() public void CloseShouldResetChannelInitialization() { SetupWaitForTestHostExit(); - _mockRequestSender.Setup(rs => rs.WaitForRequestHandlerConnection(_connectionTimeout, It.IsAny())).Returns(true); - _testOperationManager.SetupChannel(Enumerable.Empty(), _defaultRunSettings); + _mockRequestSender.Setup(rs => rs.WaitForRequestHandlerConnection(ConnectionTimeout, It.IsAny())).Returns(true); + _testOperationManager.SetupChannel(Enumerable.Empty(), DefaultRunSettings); _testOperationManager.Close(); - _testOperationManager.SetupChannel(Enumerable.Empty(), _defaultRunSettings); + _testOperationManager.SetupChannel(Enumerable.Empty(), DefaultRunSettings); _mockTestHostManager.Verify(th => th.LaunchTestHostAsync(It.IsAny(), It.IsAny()), Times.Exactly(2)); } @@ -397,8 +387,8 @@ public void CloseShouldResetChannelInitialization() public void CloseShouldTerminateTesthostProcessIfWaitTimesout() { // Ensure testhost start returns a dummy process id - _mockRequestSender.Setup(rs => rs.WaitForRequestHandlerConnection(_connectionTimeout, It.IsAny())).Returns(true); - _testOperationManager.SetupChannel(Enumerable.Empty(), _defaultRunSettings); + _mockRequestSender.Setup(rs => rs.WaitForRequestHandlerConnection(ConnectionTimeout, It.IsAny())).Returns(true); + _testOperationManager.SetupChannel(Enumerable.Empty(), DefaultRunSettings); _testOperationManager.Close(); @@ -445,7 +435,7 @@ public void UpdateTestProcessStartInfoShouldUpdateTelemetryOptedInArgTrueIfTelem .Returns(Task.FromResult(true)); // Act. - testOperationManager.SetupChannel(Enumerable.Empty(), _defaultRunSettings); + testOperationManager.SetupChannel(Enumerable.Empty(), DefaultRunSettings); // Verify. Assert.IsTrue(receivedTestProcessInfo.Arguments.Contains("--telemetryoptedin true")); @@ -468,12 +458,13 @@ public void UpdateTestProcessStartInfoShouldUpdateTelemetryOptedInArgFalseIfTele .Returns(Task.FromResult(true)); // Act. - testOperationManager.SetupChannel(Enumerable.Empty(), _defaultRunSettings); + testOperationManager.SetupChannel(Enumerable.Empty(), DefaultRunSettings); // Verify. Assert.IsTrue(receivedTestProcessInfo.Arguments.Contains("--telemetryoptedin false")); } + [MemberNotNull(nameof(_mockProcessHelper), nameof(_mockFileHelper), nameof(_mockEnvironment), nameof(_mockRunsettingHelper), nameof(_mockWindowsRegistry), nameof(_mockEnvironmentVariableHelper))] private void SetUpMocksForDotNetTestHost() { _mockProcessHelper = new Mock(); @@ -491,9 +482,9 @@ private void SetUpMocksForDotNetTestHost() It.IsAny(), It.IsAny(), It.IsAny>(), - It.IsAny>(), + It.IsAny>(), It.IsAny>(), - It.IsAny>())) + It.IsAny>())) .Callback, Action, Action, Action>( (var1, var2, var3, dictionary, errorCallback, exitCallback, outputCallback) => { diff --git a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/DataCollection/DotnetDataCollectionLauncherTests.cs b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/DataCollection/DotnetDataCollectionLauncherTests.cs index 7bfc205e83..e25c5bb97d 100644 --- a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/DataCollection/DotnetDataCollectionLauncherTests.cs +++ b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/DataCollection/DotnetDataCollectionLauncherTests.cs @@ -40,7 +40,7 @@ public void LaunchDataCollectorShouldLaunchDataCollectorProcess() List arguments = new(); _dataCollectionLauncher.LaunchDataCollector(null, arguments); - _mockProcessHelper.Verify(x => x.LaunchProcess(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny>(), It.IsAny>(), It.IsAny>()), Times.Once()); + _mockProcessHelper.Verify(x => x.LaunchProcess(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny>(), It.IsAny>(), It.IsAny>()), Times.Once()); } [TestMethod] @@ -52,7 +52,7 @@ public void LaunchDataCollectorShouldAppendDoubleQuoteForDataCollectorDllPath() List arguments = new(); _dataCollectionLauncher.LaunchDataCollector(null, arguments); - _mockProcessHelper.Verify(x => x.LaunchProcess(It.IsAny(), string.Format("{0} \"{1}\" {2} ", "exec", dataCollectorAssemblyPath, string.Join(" ", arguments)), It.IsAny(), It.IsAny>(), It.IsAny>(), It.IsAny>(), It.IsAny>()), Times.Once()); + _mockProcessHelper.Verify(x => x.LaunchProcess(It.IsAny(), string.Format("{0} \"{1}\" {2} ", "exec", dataCollectorAssemblyPath, string.Join(" ", arguments)), It.IsAny(), It.IsAny>(), It.IsAny>(), It.IsAny>(), It.IsAny>()), Times.Once()); } [TestMethod] @@ -63,6 +63,6 @@ public void LaunchDataCollectorShouldLaunchDataCollectorProcessWithCurrecntWorki string currentWorkingDirectory = Directory.GetCurrentDirectory(); - _mockProcessHelper.Verify(x => x.LaunchProcess(It.IsAny(), It.IsAny(), currentWorkingDirectory, It.IsAny>(), It.IsAny>(), It.IsAny>(), It.IsAny>()), Times.Once()); + _mockProcessHelper.Verify(x => x.LaunchProcess(It.IsAny(), It.IsAny(), currentWorkingDirectory, It.IsAny>(), It.IsAny>(), It.IsAny>(), It.IsAny>()), Times.Once()); } } diff --git a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/TestHostManagerFactoryTests.cs b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/TestHostManagerFactoryTests.cs index 6a178e2d7d..5a96419a44 100644 --- a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/TestHostManagerFactoryTests.cs +++ b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/TestHostManagerFactoryTests.cs @@ -1,8 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. -using System; - using Microsoft.VisualStudio.TestPlatform.CrossPlatEngine; using Microsoft.VisualStudio.TestPlatform.ObjectModel.Client; using Microsoft.VisualStudio.TestTools.UnitTesting; diff --git a/test/Microsoft.TestPlatform.TestHostProvider.UnitTests/Hosting/DefaultTestHostManagerTests.cs b/test/Microsoft.TestPlatform.TestHostProvider.UnitTests/Hosting/DefaultTestHostManagerTests.cs index ca482cc9bf..fed025f0c3 100644 --- a/test/Microsoft.TestPlatform.TestHostProvider.UnitTests/Hosting/DefaultTestHostManagerTests.cs +++ b/test/Microsoft.TestPlatform.TestHostProvider.UnitTests/Hosting/DefaultTestHostManagerTests.cs @@ -324,9 +324,9 @@ public void LaunchTestHostShouldReturnTestHostProcessId() It.IsAny(), It.IsAny(), It.IsAny>(), - It.IsAny>(), + It.IsAny>(), It.IsAny>(), - It.IsAny>())).Returns(Process.GetCurrentProcess()); + It.IsAny>())).Returns(Process.GetCurrentProcess()); _testHostManager.Initialize(_mockMessageLogger.Object, $" {Architecture.X64} {Framework.DefaultFramework} {false} "); var startInfo = _testHostManager.GetTestHostProcessStartInfo(Enumerable.Empty(), null, default); @@ -396,7 +396,7 @@ public void LaunchTestHostShouldSetExitCallbackInCaseCustomHost() mockCustomLauncher.Setup(mc => mc.LaunchTestHost(It.IsAny(), It.IsAny())).Returns(currentProcess.Id); _testHostManager.LaunchTestHostAsync(_startInfo, CancellationToken.None).Wait(); - _mockProcessHelper.Verify(ph => ph.SetExitCallback(currentProcess.Id, It.IsAny>())); + _mockProcessHelper.Verify(ph => ph.SetExitCallback(currentProcess.Id, It.IsAny>())); } [TestMethod] @@ -532,9 +532,9 @@ private void ErrorCallBackTestHelper(string errorMessage, int exitCode) It.IsAny(), It.IsAny(), It.IsAny>(), - It.IsAny>(), + It.IsAny>(), It.IsAny>(), - It.IsAny>())) + It.IsAny>())) .Callback, Action, Action, Action>( (var1, var2, var3, dictionary, errorCallback, exitCallback, outputCallback) => { @@ -566,9 +566,9 @@ private void ExitCallBackTestHelper(int exitCode) It.IsAny(), It.IsAny(), It.IsAny>(), - It.IsAny>(), + It.IsAny>(), It.IsAny>(), - It.IsAny>())) + It.IsAny>())) .Callback, Action, Action, Action>( (var1, var2, var3, dictionary, errorCallback, exitCallback, outputCallback) => { diff --git a/test/Microsoft.TestPlatform.TestHostProvider.UnitTests/Hosting/DotnetTestHostManagerTests.cs b/test/Microsoft.TestPlatform.TestHostProvider.UnitTests/Hosting/DotnetTestHostManagerTests.cs index 581c26ad93..ac1811ac62 100644 --- a/test/Microsoft.TestPlatform.TestHostProvider.UnitTests/Hosting/DotnetTestHostManagerTests.cs +++ b/test/Microsoft.TestPlatform.TestHostProvider.UnitTests/Hosting/DotnetTestHostManagerTests.cs @@ -585,7 +585,7 @@ public void LaunchTestHostShouldSetExitCallBackInCaseCustomHost() _dotnetHostManager.SetCustomLauncher(_mockTestHostLauncher.Object); _dotnetHostManager.LaunchTestHostAsync(startInfo, CancellationToken.None).Wait(); - _mockProcessHelper.Verify(ph => ph.SetExitCallback(expectedProcessId, It.IsAny>())); + _mockProcessHelper.Verify(ph => ph.SetExitCallback(expectedProcessId, It.IsAny>())); } [TestMethod] @@ -1015,9 +1015,9 @@ private void ErrorCallBackTestHelper(string errorMessage, int exitCode) It.IsAny(), It.IsAny(), It.IsAny>(), - It.IsAny>(), + It.IsAny>(), It.IsAny>(), - It.IsAny>())) + It.IsAny>())) .Callback, Action, Action, Action>( (var1, var2, var3, dictionary, errorCallback, exitCallback, outputCallback) => { @@ -1039,9 +1039,9 @@ private void ExitCallBackTestHelper(int exitCode) It.IsAny(), It.IsAny(), It.IsAny>(), - It.IsAny>(), + It.IsAny>(), It.IsAny>(), - It.IsAny>())) + It.IsAny>())) .Callback, Action, Action, Action>( (var1, var2, var3, dictionary, errorCallback, exitCallback, outputCallback) => { diff --git a/test/testhost.UnitTests/DefaultEngineInvokerTests.cs b/test/testhost.UnitTests/DefaultEngineInvokerTests.cs index a9d872e001..228e1fb14c 100644 --- a/test/testhost.UnitTests/DefaultEngineInvokerTests.cs +++ b/test/testhost.UnitTests/DefaultEngineInvokerTests.cs @@ -90,7 +90,7 @@ public void InvokeShouldSetParentProcessExistCallback() { _engineInvoker.Invoke(ArgsDictionary); - _mockProcessHelper.Verify(h => h.SetExitCallback(ParentProcessId, It.IsAny>())); + _mockProcessHelper.Verify(h => h.SetExitCallback(ParentProcessId, It.IsAny>())); } [TestMethod] diff --git a/test/vstest.ProgrammerTests/Fakes/FakeProcess.cs b/test/vstest.ProgrammerTests/Fakes/FakeProcess.cs index 9ce73ca5d4..cde1a8024b 100644 --- a/test/vstest.ProgrammerTests/Fakes/FakeProcess.cs +++ b/test/vstest.ProgrammerTests/Fakes/FakeProcess.cs @@ -51,9 +51,9 @@ public FakeProcess(FakeErrorAggregator fakeErrorAggregator, string path, string? }; } - internal static FakeProcess EnsureFakeProcess(object process) + internal static FakeProcess? EnsureFakeProcess(object? process) { - return (FakeProcess)process; + return process as FakeProcess; } internal void SetId(int id) diff --git a/test/vstest.ProgrammerTests/Fakes/FakeProcessHelper.cs b/test/vstest.ProgrammerTests/Fakes/FakeProcessHelper.cs index 17a8fadbe3..596848899e 100644 --- a/test/vstest.ProgrammerTests/Fakes/FakeProcessHelper.cs +++ b/test/vstest.ProgrammerTests/Fakes/FakeProcessHelper.cs @@ -63,10 +63,10 @@ public IntPtr GetProcessHandle(int processId) throw new NotImplementedException(); } - public int GetProcessId(object process) + public int GetProcessId(object? process) { var fakeProcess = FakeProcess.EnsureFakeProcess(process); - return fakeProcess.Id; + return fakeProcess?.Id ?? -1; } public string GetProcessName(int processId) @@ -80,7 +80,7 @@ public string GetTestEngineDirectory() throw new NotImplementedException(); } - public object LaunchProcess(string processPath, string arguments, string workingDirectory, IDictionary environmentVariables, Action errorCallback, Action exitCallBack, Action outputCallback) + public object LaunchProcess(string processPath, string arguments, string workingDirectory, IDictionary? environmentVariables, Action? errorCallback, Action? exitCallBack, Action? outputCallback) { // TODO: Throw if setting says we can't start new processes; var process = new FakeProcess(FakeErrorAggregator, processPath, arguments, workingDirectory, environmentVariables, errorCallback, exitCallBack, outputCallback); @@ -90,24 +90,24 @@ public object LaunchProcess(string processPath, string arguments, string working return process; } - public void SetExitCallback(int processId, Action callbackAction) + public void SetExitCallback(int processId, Action? callbackAction) { // TODO: implement? } - public void TerminateProcess(object process) + public void TerminateProcess(object? process) { - var fakeProcess = (FakeProcess)process; - fakeProcess.Exit(); + if (process is FakeProcess fakeProcess) + fakeProcess.Exit(); } - public bool TryGetExitCode(object process, out int exitCode) + public bool TryGetExitCode(object? process, out int exitCode) { - exitCode = ((FakeProcess)process).ExitCode; + exitCode = (process as FakeProcess)?.ExitCode ?? -1; return true; } - public void WaitForProcessExit(object process) + public void WaitForProcessExit(object? process) { // todo: implement for timeouts? } diff --git a/test/vstest.console.UnitTests/Processors/PortArgumentProcessorTests.cs b/test/vstest.console.UnitTests/Processors/PortArgumentProcessorTests.cs index b5f36416d6..c1e3979ca1 100644 --- a/test/vstest.console.UnitTests/Processors/PortArgumentProcessorTests.cs +++ b/test/vstest.console.UnitTests/Processors/PortArgumentProcessorTests.cs @@ -125,7 +125,7 @@ public void ExecutorInitializeShouldSetProcessExitCallback() _executor.Initialize(port.ToString()); - _mockProcessHelper.Verify(ph => ph.SetExitCallback(processId, It.IsAny>()), Times.Once); + _mockProcessHelper.Verify(ph => ph.SetExitCallback(processId, It.IsAny>()), Times.Once); } [TestMethod]