Skip to content

Commit

Permalink
Enable nullables on TestHostProvider (#3738)
Browse files Browse the repository at this point in the history
  • Loading branch information
Evangelink authored Jun 13, 2022
1 parent a3b7056 commit fd9d907
Show file tree
Hide file tree
Showing 36 changed files with 294 additions and 153 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,14 @@ public ProcDumpDumper(IProcessHelper processHelper, IFileHelper fileHelper, IEnv
_environment = environment;
}

protected Action<object?, string> OutputReceivedCallback => (process, data) =>
protected Action<object?, string?> OutputReceivedCallback => (process, data) =>
// useful for visibility when debugging this tool
// Console.ForegroundColor = ConsoleColor.Cyan;
// Console.WriteLine(data);
// Console.ForegroundColor = ConsoleColor.White;
// Log all standard output message of procdump in diag files.
// Otherwise they end up coming on console in pipleine.
EqtTrace.Info("ProcDumpDumper.OutputReceivedCallback: Output received from procdump process: " + data);
EqtTrace.Info($"ProcDumpDumper.OutputReceivedCallback: Output received from procdump process: {data ?? "<null>"}");

/// <inheritdoc/>
public void WaitForDumpToFinish()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ public ProcessDumpUtility(IProcessHelper processHelper, IFileHelper fileHelper,
_crashDumperFactory = crashDumperFactory;
}

protected Action<object, string> OutputReceivedCallback => (process, data) =>
protected Action<object?, string?> OutputReceivedCallback => (process, data) =>
// Log all standard output message of procdump in diag files.
// Otherwise they end up coming on console in pipleine.
EqtTrace.Info("ProcessDumpUtility.OutputReceivedCallback: Output received from procdump process: " + data);
EqtTrace.Info($"ProcessDumpUtility.OutputReceivedCallback: Output received from procdump process: {data ?? "<null>"}");

/// <inheritdoc/>
public IEnumerable<string> GetDumpFiles(bool warnOnNoDumpFiles, bool processCrashed)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,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<string!>!
Microsoft.TestPlatform.Extensions.BlameDataCollector.ProcDumpDumper.OutputReceivedCallback.get -> System.Action<object?, string!>!
Microsoft.TestPlatform.Extensions.BlameDataCollector.ProcDumpDumper.OutputReceivedCallback.get -> System.Action<object?, string?>!
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) -> void
Microsoft.TestPlatform.Extensions.BlameDataCollector.ProcDumpDumper.WaitForDumpToFinish() -> void
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ public WindowsHangDumper(IProcessHelper processHelper, Action<string>? logWarnin
_processHelper = processHelper;
}

private static Action<object?, string> OutputReceivedCallback => (process, data) =>
private static Action<object?, string?> OutputReceivedCallback => (process, data) =>
// useful for visibility when debugging this tool
// Console.ForegroundColor = ConsoleColor.Cyan;
// Console.WriteLine(data);
// Console.ForegroundColor = ConsoleColor.White;
// Log all standard output message of procdump in diag files.
// Otherwise they end up coming on console in pipleine.
EqtTrace.Info("ProcDumpDumper.OutputReceivedCallback: Output received from procdump process: " + data);
EqtTrace.Info($"ProcDumpDumper.OutputReceivedCallback: Output received from procdump process: {data ?? "<null>"}");

public void Dump(int processId, string outputDirectory, DumpTypeOption type)
{
Expand Down
8 changes: 8 additions & 0 deletions src/Microsoft.TestPlatform.PlatformAbstractions/Friends.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// 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.Runtime.CompilerServices;

#region Product Assemblies
[assembly: InternalsVisibleTo("Microsoft.TestPlatform.TestHostRuntimeProvider, PublicKey=002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293")]
#endregion
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,13 @@ public class AssemblyResolveEventArgs : EventArgs
/// name of the item to resolve.
/// </summary>
/// <param name="name">The Full name of an assembly to resolve.</param>
public AssemblyResolveEventArgs(string name)
public AssemblyResolveEventArgs(string? name)
{
Name = name;
}

/// <summary>
/// Gets or sets the name of the item to resolve.
/// </summary>
public string Name { get; set; }
public string? Name { get; set; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ public interface IProcessHelper
/// <param name="exitCallBack">Call back for on process exit</param>
/// <param name="outputCallback">Call back for on process output</param>
/// <returns>The process created.</returns>
object LaunchProcess(string processPath, string arguments, string workingDirectory, IDictionary<string, string>? envVariables, Action<object?, string>? errorCallback, Action<object>? exitCallBack, Action<object?, string>? outputCallBack);
object LaunchProcess(string processPath, string arguments, string workingDirectory, IDictionary<string, string>? envVariables, Action<object?, string?>? errorCallback, Action<object?>? exitCallBack, Action<object?, string?>? outputCallBack);

/// <summary>
/// Gets the current process file path.
/// </summary>
/// <returns>The current process file path.</returns>
string GetCurrentProcessFileName();
string? GetCurrentProcessFileName();

/// <summary>
/// Gets the current process location.
Expand All @@ -40,7 +40,7 @@ public interface IProcessHelper
/// Gets the location of test engine.
/// </summary>
/// <returns>Location of test engine.</returns>
string GetTestEngineDirectory();
string? GetTestEngineDirectory();

/// <summary>
/// Gets the location of native dll's, depending on current process architecture..
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<PropertyGroup>
<AssemblyName>Microsoft.TestPlatform.PlatformAbstractions</AssemblyName>
<RootNamespace>Microsoft.TestPlatform.PlatformAbstractions</RootNamespace>
<TargetFrameworks>net45;net451;netcoreapp1.0;netcoreapp2.1;netstandard1.3;netstandard2.0</TargetFrameworks>
<TargetFrameworks>net45;net451;netcoreapp1.0;netcoreapp2.1;netstandard1.3;netstandard2.0;net6.0</TargetFrameworks>
<TargetFrameworks Condition="'$(OS)' == 'Windows_NT'">$(TargetFrameworks);uap10.0;netstandard1.0</TargetFrameworks>
<TargetFrameworks Condition=" '$(DotNetBuildFromSource)' == 'true' ">net6.0</TargetFrameworks>
<IsTestProject>false</IsTestProject>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ 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
Expand All @@ -42,15 +42,15 @@ Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.Interfaces.IEnvironment
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.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<string!, string!>? envVariables, System.Action<object?, string!>? errorCallback, System.Action<object!>? exitCallBack, System.Action<object?, string!>? outputCallBack) -> object!
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<string!, string!>? envVariables, System.Action<object?, string?>? errorCallback, System.Action<object?>? exitCallBack, System.Action<object?, string?>? outputCallBack) -> object!
Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.Interfaces.IProcessHelper.SetExitCallback(int processId, System.Action<object?>? 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
Expand Down Expand Up @@ -95,14 +95,14 @@ 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.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.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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ Microsoft.VisualStudio.TestPlatform.ObjectModel.RollingFileTraceListener.Rolling
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<string!, string!>? envVariables, System.Action<object?, string!>? errorCallback, System.Action<object!>? exitCallBack, System.Action<object?, string!>? outputCallBack) -> object!
Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.ProcessHelper.LaunchProcess(string! processPath, string! arguments, string! workingDirectory, System.Collections.Generic.IDictionary<string!, string!>? envVariables, System.Action<object?, string?>? errorCallback, System.Action<object?>? exitCallBack, System.Action<object?, string?>? outputCallBack) -> object!
Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.ProcessHelper.SetExitCallback(int processId, System.Action<object?>? 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
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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ Microsoft.VisualStudio.TestPlatform.ObjectModel.RollingFileTraceListener.Rolling
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<string!, string!>? envVariables, System.Action<object?, string!>? errorCallback, System.Action<object!>? exitCallBack, System.Action<object?, string!>? outputCallBack) -> object!
Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.ProcessHelper.LaunchProcess(string! processPath, string! arguments, string! workingDirectory, System.Collections.Generic.IDictionary<string!, string!>? envVariables, System.Action<object?, string?>? errorCallback, System.Action<object?>? exitCallBack, System.Action<object?, string?>? outputCallBack) -> object!
Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.ProcessHelper.SetExitCallback(int processId, System.Action<object?>? 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
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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ Microsoft.VisualStudio.TestPlatform.ObjectModel.RollingFileTraceListener.Rolling
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<string!, string!>? envVariables, System.Action<object?, string!>? errorCallback, System.Action<object!>? exitCallBack, System.Action<object?, string!>? outputCallBack) -> object!
Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.ProcessHelper.LaunchProcess(string! processPath, string! arguments, string! workingDirectory, System.Collections.Generic.IDictionary<string!, string!>? envVariables, System.Action<object?, string?>? errorCallback, System.Action<object?>? exitCallBack, System.Action<object?, string?>? outputCallBack) -> object!
Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.ProcessHelper.SetExitCallback(int processId, System.Action<object?>? 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
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
Expand Down
Loading

0 comments on commit fd9d907

Please sign in to comment.