Skip to content

Commit

Permalink
Null annotate ILogger.cs (#9876)
Browse files Browse the repository at this point in the history
* Null annotate ILogger.cs

`ILogger.Parameters` is documented as allowing a `null` value. This change updates the annotation accordingly.

NOTE this change has been made in the browser without building, so it's possible that CI highlights other usages that need fixing.

* Update annotation in SimpleErrorLogger

* Update annotation in TerminalLogger
  • Loading branch information
drewnoakes authored Mar 27, 2024
1 parent 65d7f67 commit 2372c72
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/Build/Logging/SimpleErrorLogger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public LoggerVerbosity Verbosity
set { }
}

public string Parameters
public string? Parameters
{
get => string.Empty;
set { }
Expand Down
4 changes: 1 addition & 3 deletions src/Framework/ILogger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@

using System.Runtime.InteropServices;

#nullable disable

namespace Microsoft.Build.Framework
{
/// <summary>
Expand Down Expand Up @@ -75,7 +73,7 @@ public interface ILogger
/// to defaults. If a logger does not take parameters, it can ignore this property.
/// </summary>
/// <value>The parameter string (can be null).</value>
string Parameters { get; set; }
string? Parameters { get; set; }

/// <summary>
/// Called by the build engine to allow loggers to subscribe to the events they desire.
Expand Down
2 changes: 1 addition & 1 deletion src/MSBuild/TerminalLogger/TerminalLogger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ internal TerminalLogger(ITerminal terminal)
public LoggerVerbosity Verbosity { get => LoggerVerbosity.Minimal; set { } }

/// <inheritdoc/>
public string Parameters
public string? Parameters
{
get => ""; set { }
}
Expand Down

0 comments on commit 2372c72

Please sign in to comment.