Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Microsoft.TestPlatform.Client/TestPlatform.cs
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ private static void AddExtensionAssembliesFromExtensionDirectory()
// Otherwise we will always get a "No suitable test runtime provider found for this run." error.
// I (@haplois) will modify this behavior later on, but we also need to consider legacy adapters
// and make sure they still work after modification.
string runSettings = RunSettingsManager.Instance.ActiveRunSettings.SettingsXml;
string? runSettings = RunSettingsManager.Instance.ActiveRunSettings.SettingsXml;
RunConfiguration runConfiguration = XmlRunSettingsUtilities.GetRunConfigurationNode(runSettings);
TestAdapterLoadingStrategy strategy = runConfiguration.TestAdapterLoadingStrategy;

Expand Down
2 changes: 0 additions & 2 deletions src/Microsoft.TestPlatform.Common/Constants.cs
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.Common;

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

using Microsoft.VisualStudio.TestPlatform.ObjectModel;

#nullable disable

namespace Microsoft.VisualStudio.TestPlatform.Common.DataCollection;

/// <summary>
Expand All @@ -21,7 +19,11 @@ public class AfterTestRunEndResult
// We want to fallback to the non-public default constructor https://www.newtonsoft.com/json/help/html/T_Newtonsoft_Json_ConstructorHandling.htm during deserialization
private AfterTestRunEndResult()
{

// Forcing nulls to the differnet properties as this is only serialization ctor but
// we can guarantee non-null for the other ctors.
AttachmentSets = null!;
InvokedDataCollectors = null!;
Metrics = null!;
}

/// <summary>
Expand Down Expand Up @@ -50,7 +52,7 @@ public AfterTestRunEndResult(Collection<AttachmentSet> attachmentSets, IDictiona
/// The metrics.
/// </param>
public AfterTestRunEndResult(Collection<AttachmentSet> attachmentSets,
Collection<InvokedDataCollector> invokedDataCollectors,
Collection<InvokedDataCollector>? invokedDataCollectors,
IDictionary<string, object> metrics)
{
AttachmentSets = attachmentSets;
Expand All @@ -62,7 +64,7 @@ public AfterTestRunEndResult(Collection<AttachmentSet> attachmentSets,
public Collection<AttachmentSet> AttachmentSets { get; private set; }

[DataMember]
public Collection<InvokedDataCollector> InvokedDataCollectors { get; private set; }
public Collection<InvokedDataCollector>? InvokedDataCollectors { get; private set; }

[DataMember]
public IDictionary<string, object> Metrics { get; private set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
using System.Collections.Generic;
using System.Runtime.Serialization;

#nullable disable

namespace Microsoft.VisualStudio.TestPlatform.Common.DataCollection;

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@
using Microsoft.VisualStudio.TestPlatform.Utilities;
using Microsoft.VisualStudio.TestPlatform.Utilities.Helpers.Interfaces;

#nullable disable

namespace Microsoft.VisualStudio.TestPlatform.Common.DataCollector;

/// <summary>
Expand Down Expand Up @@ -48,7 +46,7 @@ internal class DataCollectionAttachmentManager : IDataCollectionAttachmentManage
/// <summary>
/// Logger for data collection messages
/// </summary>
private IMessageSink _messageSink;
private IMessageSink? _messageSink;

/// <summary>
/// Attachment transfer tasks associated with a given datacollection context.
Expand Down Expand Up @@ -88,7 +86,7 @@ protected DataCollectionAttachmentManager(IFileHelper fileHelper)
/// <summary>
/// Gets the session output directory.
/// </summary>
internal string SessionOutputDirectory { get; private set; }
internal string? SessionOutputDirectory { get; private set; }

/// <summary>
/// Gets the attachment sets for the given datacollection context.
Expand Down Expand Up @@ -162,7 +160,7 @@ public List<AttachmentSet> GetAttachments(DataCollectionContext dataCollectionCo
}

/// <inheritdoc/>
public void AddAttachment(FileTransferInformation fileTransferInfo, AsyncCompletedEventHandler sendFileCompletedCallback, Uri uri, string friendlyName)
public void AddAttachment(FileTransferInformation fileTransferInfo, AsyncCompletedEventHandler? sendFileCompletedCallback, Uri uri, string friendlyName)
{
ValidateArg.NotNull(fileTransferInfo, nameof(fileTransferInfo));

Expand Down Expand Up @@ -217,7 +215,7 @@ private static void Validate(FileTransferInformation fileTransferInfo, string lo

if (!Directory.Exists(directoryName))
{
Directory.CreateDirectory(directoryName);
Directory.CreateDirectory(directoryName!);
}
else if (File.Exists(localFilePath))
{
Expand All @@ -240,7 +238,7 @@ private static void Validate(FileTransferInformation fileTransferInfo, string lo
/// <param name="friendlyName">
/// The friendly Name.
/// </param>
private void AddNewFileTransfer(FileTransferInformation fileTransferInfo, AsyncCompletedEventHandler sendFileCompletedCallback, Uri uri, string friendlyName)
private void AddNewFileTransfer(FileTransferInformation fileTransferInfo, AsyncCompletedEventHandler? sendFileCompletedCallback, Uri uri, string friendlyName)
{
var context = fileTransferInfo.Context;
TPDebug.Assert(
Expand All @@ -251,6 +249,7 @@ private void AddNewFileTransfer(FileTransferInformation fileTransferInfo, AsyncC
? fileTransferInfo.Context.TestExecId.Id.ToString()
: string.Empty;

TPDebug.Assert(SessionOutputDirectory is not null, "SessionOutputDirectory is null.");
var directoryPath = Path.Combine(
SessionOutputDirectory,
testCaseId);
Expand Down Expand Up @@ -354,7 +353,7 @@ private void LogError(string errorMessage, Uri collectorUri, string collectorFri
args.TestCaseId = testCaseId;
}

_messageSink.SendMessage(args);
_messageSink?.SendMessage(args);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@

using Microsoft.VisualStudio.TestPlatform.ObjectModel;

#nullable disable

namespace Microsoft.VisualStudio.TestPlatform.Common.DataCollector;

/// <summary>
Expand Down Expand Up @@ -81,7 +79,7 @@ public string FirstDataCollectorThatRequested
}

/// <summary>
/// Adds the data collector to the list of data collectors that requested this variable.
/// Adds the data collector to the list of data collectors that requested this variable.
/// </summary>
/// <param name="requestingDataCollectorFriendlyName">Friendly name of requesting data collector.</param>
public void AddRequestingDataCollector(string requestingDataCollectorFriendlyName)
Expand Down
Loading