Skip to content

Commit

Permalink
Enable nullables on Abstraction project (#3723)
Browse files Browse the repository at this point in the history
  • Loading branch information
Evangelink authored Jun 8, 2022
1 parent 95e3afd commit 1235324
Show file tree
Hide file tree
Showing 78 changed files with 339 additions and 491 deletions.
1 change: 1 addition & 0 deletions TestPlatform.sln
Original file line number Diff line number Diff line change
Expand Up @@ -1044,6 +1044,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
Original file line number Diff line number Diff line change
@@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -75,7 +74,7 @@ public FrameworkHandle(ITestCaseEventsHandler testCaseEventsHandler, ITestRunCac
public int LaunchProcessWithDebuggerAttached(string filePath, string workingDirectory, string arguments, IDictionary<string, string> 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");
Expand Down
1 change: 0 additions & 1 deletion src/Microsoft.TestPlatform.CrossPlatEngine/TestEngine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ 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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<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, Microsoft.TestPlatform.Extensions.BlameDataCollector.INativeMethodsHelper? nativeMethodsHelper) -> void
Microsoft.TestPlatform.Extensions.BlameDataCollector.ProcDumpDumper.WaitForDumpToFinish() -> void
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ 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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@

using System.IO;

#nullable disable

namespace Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.Interfaces;

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@

using System.Reflection;

#nullable disable

namespace Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.Interfaces;

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
using System;
using System.Reflection;

#nullable disable

namespace Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.Interfaces;

/// <summary>
Expand All @@ -16,7 +14,7 @@ namespace Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.Interfaces;
/// <returns>The assembly that resolves the type, assembly, or resource; or null if the assembly
/// cannot be resolved.
/// </returns>
public delegate Assembly AssemblyResolveEventHandler(object sender, AssemblyResolveEventArgs args);
public delegate Assembly AssemblyResolveEventHandler(object? sender, AssemblyResolveEventArgs? args);

/// <summary>
/// The AssemblyResolver interface.
Expand All @@ -26,7 +24,7 @@ public interface IAssemblyResolver : IDisposable
/// <summary>
/// Occurs when the resolution of an assembly fails
/// </summary>
event AssemblyResolveEventHandler AssemblyResolve;
event AssemblyResolveEventHandler? AssemblyResolve;
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
@@ -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;

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
using System;
using System.Collections.Generic;

#nullable disable

namespace Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.Interfaces;

/// <summary>
Expand All @@ -24,7 +22,7 @@ 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> environmentVariables, 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.
Expand Down Expand Up @@ -73,7 +71,7 @@ public interface IProcessHelper
/// </summary>
/// <param name="process">process parameter</param>
/// <returns>process id.</returns>
int GetProcessId(object process);
int GetProcessId(object? process);

/// <summary>
/// Gets the process name for given process id.
Expand All @@ -88,7 +86,7 @@ public interface IProcessHelper
/// <param name="process">process parameter</param>
/// <param name="exitCode">return value of exitCode</param>
/// <returns>False if process has not exited, True otherwise</returns>
bool TryGetExitCode(object process, out int exitCode);
bool TryGetExitCode(object? process, out int exitCode);

/// <summary>
/// Sets the process exit callback.
Expand All @@ -99,19 +97,19 @@ public interface IProcessHelper
/// <param name="callbackAction">
/// Callback on process exit.
/// </param>
void SetExitCallback(int processId, Action<object> callbackAction);
void SetExitCallback(int processId, Action<object?>? callbackAction);

/// <summary>
/// Terminates a process.
/// </summary>
/// <param name="process">Reference of process to terminate.</param>
void TerminateProcess(object process);
void TerminateProcess(object? process);

/// <summary>
/// Wait for process to exit
/// </summary>
/// <param name="process">Reference to process</param>
void WaitForProcessExit(object process);
void WaitForProcessExit(object? process);

/// <summary>
/// Gets the process handle for given process Id.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@

using System;

#nullable disable

namespace Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.Interfaces;

public interface IThread
Expand All @@ -16,5 +14,5 @@ public interface IThread
/// <param name="apartmentState">The apartment state.</param>
/// <param name="waitForCompletion"> True for running in Sync, False for running in Async</param>
/// <exception cref="ThreadApartmentStateNotSupportedException"> When thread apartment state not supported for platform. </exception>>
void Run(Action action, PlatformApartmentState apartmentState, bool waitForCompletion);
void Run(Action? action, PlatformApartmentState apartmentState, bool waitForCompletion);
}
Original file line number Diff line number Diff line change
@@ -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;

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
@@ -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;

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
@@ -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;

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@

using System;

#nullable disable

namespace Microsoft.VisualStudio.TestPlatform.PlatformAbstractions;

/// <summary>
Expand All @@ -26,7 +24,7 @@ public ThreadApartmentStateNotSupportedException()
/// Initializes with the message.
/// </summary>
/// <param name="message">Message for the exception.</param>
public ThreadApartmentStateNotSupportedException(string message)
public ThreadApartmentStateNotSupportedException(string? message)
: base(message)
{
}
Expand All @@ -37,7 +35,7 @@ public ThreadApartmentStateNotSupportedException(string message)
/// </summary>
/// <param name="message">Message for the exception.</param>
/// <param name="innerException">The inner exception.</param>
public ThreadApartmentStateNotSupportedException(string message, Exception innerException)
public ThreadApartmentStateNotSupportedException(string? message, Exception? innerException)
: base(message, innerException)
{
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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;

/// <summary>
Expand Down Expand Up @@ -59,7 +57,7 @@ bool DoNotInitialize
/// Gets file path for trace log file.
/// </summary>
/// <returns>True if tracing is enabled.</returns>
string GetLogFile();
string? GetLogFile();

/// <summary>
/// Sets platform specific trace value for tracing verbosity.
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<PropertyGroup>
<TestPlatformRoot Condition="$(TestPlatformRoot) == ''">..\..\</TestPlatformRoot>
</PropertyGroup>
<Import Project="..\Microsoft.TestPlatform.Nullability\Microsoft.TestPlatform.Nullability.projitems" Label="Shared" />
<Import Project="$(TestPlatformRoot)scripts/build/TestPlatform.Settings.targets" />
<PropertyGroup>
<AssemblyName>Microsoft.TestPlatform.PlatformAbstractions</AssemblyName>
Expand Down
Loading

0 comments on commit 1235324

Please sign in to comment.