-
Notifications
You must be signed in to change notification settings - Fork 325
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enable nullable on ObjectModel (#3793)
- Loading branch information
1 parent
69a84d7
commit b58c1ce
Showing
368 changed files
with
1,786 additions
and
1,962 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
src/DataCollectors/Microsoft.TestPlatform.Extensions.EventLogCollector/BannedSymbols.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
M:System.Diagnostics.Debug.Assert(System.Boolean); Use 'TPDebug.Assert' instead | ||
M:System.Diagnostics.Debug.Assert(System.Boolean,System.String); Use 'TPDebug.Assert' instead | ||
M:System.Diagnostics.TPDebug.Assert(System.Boolean); Use 'TPDebug.Assert' instead | ||
M:System.Diagnostics.TPDebug.Assert(System.Boolean,System.String); Use 'TPDebug.Assert' instead | ||
M:System.String.IsNullOrEmpty(System.String); Use 'StringUtils.IsNullOrEmpty' instead | ||
M:System.String.IsNullOrWhiteSpace(System.String); Use 'StringUtils.IsNullOrWhiteSpace' instead |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
src/Microsoft.TestPlatform.AdapterUtilities/NullableHelpers.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT license. See LICENSE file in the project root for full license information. | ||
// <auto-generated> | ||
// This code is auto-generated. Changes to this file will be lost! | ||
// This T4 file is copied in various projects because inclusion as link or through shared project | ||
// doesn't allow to generate the C# file locally. If some modification is required, please update | ||
// all instances. | ||
// </auto-generated> | ||
|
||
#nullable enable | ||
|
||
using System.Diagnostics; | ||
using System.Diagnostics.CodeAnalysis; | ||
|
||
namespace Microsoft.TestPlatform.AdapterUtilities; | ||
|
||
internal static class StringUtils | ||
{ | ||
/// <inheritdoc cref="string.IsNullOrEmpty(string)"/> | ||
[SuppressMessage("ApiDesign", "RS0030:Do not used banned APIs", Justification = "Replacement API to allow nullable hints for compiler")] | ||
public static bool IsNullOrEmpty([NotNullWhen(returnValue: false)] this string? value) | ||
=> string.IsNullOrEmpty(value); | ||
|
||
/// <inheritdoc cref="string.IsNullOrWhiteSpace(string)"/> | ||
[SuppressMessage("ApiDesign", "RS0030:Do not used banned APIs", Justification = "Replacement API to allow nullable hints for compiler")] | ||
public static bool IsNullOrWhiteSpace([NotNullWhen(returnValue: false)] this string? value) | ||
=> string.IsNullOrWhiteSpace(value); | ||
} | ||
|
||
[SuppressMessage("ApiDesign", "RS0030:Do not used banned APIs", Justification = "Replacement API to allow nullable hints for compiler")] | ||
internal static class TPDebug | ||
{ | ||
/// <inheritdoc cref="Debug.Assert(bool)"/> | ||
[Conditional("DEBUG")] | ||
public static void Assert([DoesNotReturnIf(false)] bool b) | ||
=> Debug.Assert(b); | ||
|
||
/// <inheritdoc cref="Debug.Assert(bool, string)"/> | ||
[Conditional("DEBUG")] | ||
public static void Assert([DoesNotReturnIf(false)] bool b, string message) | ||
=> Debug.Assert(b, message); | ||
} |
45 changes: 45 additions & 0 deletions
45
src/Microsoft.TestPlatform.AdapterUtilities/NullableHelpers.tt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<#@ template debug="true" hostspecific="true" language="C#" #> | ||
<#@ output extension=".cs" #> | ||
<#@ assembly name="System.Core" #> | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT license. See LICENSE file in the project root for full license information. | ||
// <auto-generated> | ||
// This code is auto-generated. Changes to this file will be lost! | ||
// This T4 file is copied in various projects because inclusion as link or through shared project | ||
// doesn't allow to generate the C# file locally. If some modification is required, please update | ||
// all instances. | ||
// </auto-generated> | ||
|
||
#nullable enable | ||
|
||
using System.Diagnostics; | ||
using System.Diagnostics.CodeAnalysis; | ||
|
||
namespace <#= System.Runtime.Remoting.Messaging.CallContext.LogicalGetData("NamespaceHint") #>; | ||
|
||
internal static class StringUtils | ||
{ | ||
/// <inheritdoc cref="string.IsNullOrEmpty(string)"/> | ||
[SuppressMessage("ApiDesign", "RS0030:Do not used banned APIs", Justification = "Replacement API to allow nullable hints for compiler")] | ||
public static bool IsNullOrEmpty([NotNullWhen(returnValue: false)] this string? value) | ||
=> string.IsNullOrEmpty(value); | ||
|
||
/// <inheritdoc cref="string.IsNullOrWhiteSpace(string)"/> | ||
[SuppressMessage("ApiDesign", "RS0030:Do not used banned APIs", Justification = "Replacement API to allow nullable hints for compiler")] | ||
public static bool IsNullOrWhiteSpace([NotNullWhen(returnValue: false)] this string? value) | ||
=> string.IsNullOrWhiteSpace(value); | ||
} | ||
|
||
[SuppressMessage("ApiDesign", "RS0030:Do not used banned APIs", Justification = "Replacement API to allow nullable hints for compiler")] | ||
internal static class TPDebug | ||
{ | ||
/// <inheritdoc cref="Debug.Assert(bool)"/> | ||
[Conditional("DEBUG")] | ||
public static void Assert([DoesNotReturnIf(false)] bool b) | ||
=> Debug.Assert(b); | ||
|
||
/// <inheritdoc cref="Debug.Assert(bool, string)"/> | ||
[Conditional("DEBUG")] | ||
public static void Assert([DoesNotReturnIf(false)] bool b, string message) | ||
=> Debug.Assert(b, message); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
M:System.Diagnostics.Debug.Assert(System.Boolean); Use 'TPDebug.Assert' instead | ||
M:System.Diagnostics.Debug.Assert(System.Boolean,System.String); Use 'TPDebug.Assert' instead | ||
M:System.Diagnostics.TPDebug.Assert(System.Boolean); Use 'TPDebug.Assert' instead | ||
M:System.Diagnostics.TPDebug.Assert(System.Boolean,System.String); Use 'TPDebug.Assert' instead | ||
M:System.String.IsNullOrEmpty(System.String); Use 'StringUtils.IsNullOrEmpty' instead | ||
M:System.String.IsNullOrWhiteSpace(System.String); Use 'StringUtils.IsNullOrWhiteSpace' instead |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.