92 references to new
Microsoft.DotNet.ApiCompatibility (4)
Logging\SuppressionEngine.cs (3)
70
Suppression globalTargetSuppression =
new
(error.DiagnosticId, error.Target, isBaselineSuppression: error.IsBaselineSuppression);
73
Suppression globalLeftRightSuppression =
new
(string.Empty, left: error.Left, right: error.Right, isBaselineSuppression: error.IsBaselineSuppression);
76
Suppression globalDiagnosticIdLeftRightSuppression =
new
(error.DiagnosticId, left: error.Left, right: error.Right, isBaselineSuppression: error.IsBaselineSuppression);
Runner\ApiCompatRunner.cs (1)
68
Suppression suppression =
new
(difference.DiagnosticId)
Microsoft.DotNet.ApiCompatibility.Tests (80)
Logging\SuppressionEngineTests.cs (37)
16
Suppression suppression =
new
("PKG004", "A.B()", "ref/net6.0/mylib.dll", "lib/net6.0/mylib.dll");
33
Assert.True(suppressionEngine.IsErrorSuppressed(new
Suppression
("CP0001", "T:A.B", "ref/netstandard2.0/tempValidation.dll", "lib/net6.0/tempValidation.dll")));
34
Assert.False(suppressionEngine.IsErrorSuppressed(new
Suppression
("CP0001", "T:A.C", "ref/netstandard2.0/tempValidation.dll", "lib/net6.0/tempValidation.dll")));
35
Assert.False(suppressionEngine.IsErrorSuppressed(new
Suppression
("CP0001", "T:A.B", "lib/netstandard2.0/tempValidation.dll", "lib/net6.0/tempValidation.dll")));
36
Assert.True(suppressionEngine.IsErrorSuppressed(new
Suppression
("PKV004", ".netframework,Version=v4.8")));
37
Assert.False(suppressionEngine.IsErrorSuppressed(new
Suppression
(string.Empty, string.Empty)));
38
Assert.False(suppressionEngine.IsErrorSuppressed(new
Suppression
("PKV004", ".netframework,Version=v4.8", "lib/net6.0/mylib.dll")));
39
Assert.False(suppressionEngine.IsErrorSuppressed(new
Suppression
("PKV004", ".NETStandard,Version=v2.0")));
40
Assert.True(suppressionEngine.IsErrorSuppressed(new
Suppression
("CP123", "T:myValidation.Class1", isBaselineSuppression: true)));
41
Assert.False(suppressionEngine.IsErrorSuppressed(new
Suppression
("CP123", "T:myValidation.Class1", isBaselineSuppression: false)));
42
Assert.True(suppressionEngine.IsErrorSuppressed(new
Suppression
("CP0001", "T:A.B", "ref/netstandard2.0/tempValidation.dll", "lib/net6.0/tempValidation.dll")));
113
Suppression usedSuppression =
new
("CP0001", "T:A", "lib/netstandard1.3/tempValidation.dll", "lib/netstandard1.3/tempValidation.dll");
159
engine.AddSuppression(new
Suppression
("CP0001", "T:A.B", isBaselineSuppression: true));
160
engine.AddSuppression(new
Suppression
("CP0001", "T:A.C"));
162
Assert.True(engine.IsErrorSuppressed(new
Suppression
("CP0001", "T:A.B", "ref/net6.0/myLib.dll", "lib/net6.0/myLib.dll", isBaselineSuppression: true)));
163
Assert.False(engine.IsErrorSuppressed(new
Suppression
("CP0001", "T:A.B", "ref/net6.0/myLib.dll", "lib/net6.0/myLib.dll", isBaselineSuppression: false)));
165
Assert.True(engine.IsErrorSuppressed(new
Suppression
("CP0001", "T:A.C", "ref/net6.0/myLib.dll", "lib/net6.0/myLib.dll", isBaselineSuppression: false)));
166
Assert.False(engine.IsErrorSuppressed(new
Suppression
("CP0001", "T:A.C", "ref/net6.0/myLib.dll", "lib/net6.0/myLib.dll", isBaselineSuppression: true)));
169
engine.AddSuppression(new
Suppression
("CP0003", null, "ref/net6.0/myleft.dll", "lib/net6.0/myright.dll", isBaselineSuppression: false));
171
Assert.True(engine.IsErrorSuppressed(new
Suppression
("CP0003", "T:A.B", "ref/net6.0/myLeft.dll", "lib/net6.0/myRight.dll")));
172
Assert.True(engine.IsErrorSuppressed(new
Suppression
("CP0003", "T:A.C", "ref/net6.0/myLeft.dll", "lib/net6.0/myRight.dll")));
173
Assert.True(engine.IsErrorSuppressed(new
Suppression
("CP0003", "T:A.D", "ref/net6.0/myLeft.dll", "lib/net6.0/myRight.dll")));
174
Assert.False(engine.IsErrorSuppressed(new
Suppression
("CP0003", "T:A.D", "ref/net6.0/myLeft.dll", "lib/net6.0/myRight.dll", isBaselineSuppression: true)));
177
engine.AddSuppression(new
Suppression
(string.Empty, null, "ref/net8.0/left.dll", "lib/net8.0/left.dll", isBaselineSuppression: false));
178
engine.AddSuppression(new
Suppression
(string.Empty, null, "ref/net8.0/left.dll", "lib/net8.0/left.dll", isBaselineSuppression: true));
180
Assert.True(engine.IsErrorSuppressed(new
Suppression
("CP0009", "T:A.B.C.D.E", "ref/net8.0/left.dll", "lib/net8.0/left.dll", isBaselineSuppression: false)));
181
Assert.True(engine.IsErrorSuppressed(new
Suppression
("CP0009", "T:A.B.C.D.E", "ref/net8.0/left.dll", "lib/net8.0/left.dll", isBaselineSuppression: true)));
198
Suppression newSuppression =
new
("CP0002", "F:MyNs.Class1.Field");
212
Assert.Equal(new
Suppression
("CP0001")
227
Assert.True(engine.IsErrorSuppressed(new
Suppression
("CP0001", "T:A.B", "ref/net6.0/myLib.dll", "lib/net6.0/myLib.dll", isBaselineSuppression: true)));
228
Assert.False(engine.IsErrorSuppressed(new
Suppression
("CP1110", "T:A.B", "ref/net6.0/myLib.dll", "lib/net6.0/myLib.dll", isBaselineSuppression: false)));
230
Assert.True(engine.IsErrorSuppressed(new
Suppression
("CP0001", "T:A.C", "ref/net6.0/myLib.dll", "lib/net6.0/myLib.dll", isBaselineSuppression: false)));
231
Assert.False(engine.IsErrorSuppressed(new
Suppression
("CP1000", "T:A.C", "ref/net6.0/myLib.dll", "lib/net6.0/myLib.dll", isBaselineSuppression: true)));
233
Assert.True(engine.IsErrorSuppressed(new
Suppression
("CP0003", "T:A.B", "ref/net6.0/myLeft.dll", "lib/net6.0/myRight.dll")));
234
Assert.True(engine.IsErrorSuppressed(new
Suppression
("CP0003", "T:A.C", "ref/net6.0/myLeft.dll", "lib/net6.0/myRight.dll")));
235
Assert.True(engine.IsErrorSuppressed(new
Suppression
("CP0003", "T:A.D", "ref/net6.0/myLeft.dll", "lib/net6.0/myRight.dll")));
236
Assert.False(engine.IsErrorSuppressed(new
Suppression
("CP1232", "T:A.D", "ref/net6.0/myLeft.dll", "lib/net6.0/myRight.dll", isBaselineSuppression: true)));
Logging\SuppressionTests.cs (43)
10
yield return new object[] { new
Suppression
(string.Empty), new
Suppression
(string.Empty) { Left = null, Right = null, Target = null } };
11
yield return new object[] { new
Suppression
(string.Empty), new
Suppression
(string.Empty) { Left = string.Empty, Right = string.Empty, Target = string.Empty } };
12
yield return new object[] { new
Suppression
("PK004"), new
Suppression
("pk004") };
13
yield return new object[] { new
Suppression
("PK004"), new
Suppression
(" pk004 ") };
14
yield return new object[] { new
Suppression
("PK004") { Target = "A.B" }, new
Suppression
(" pk004 ") { Target = "A.b " } };
15
yield return new object[] { new
Suppression
("PK004") { Target = "A.B", Left = "ref/net6.0/myLib.dll" }, new
Suppression
(" pk004 ") { Target = "A.B", Left = "ref/net6.0/mylib.dll" } };
16
yield return new object[] { new
Suppression
("PK004") { Target = "A.B", Left = "ref/net6.0/myLib.dll", Right = "lib/net6.0/myLib.dll" }, new
Suppression
("PK004") { Target = "A.B", Left = "ref/net6.0/myLib.dll", Right = "lib/net6.0/myLib.dll", IsBaselineSuppression = false } };
17
yield return new object[] { new
Suppression
("PK004") { Target = "A.B", Left = "ref/net6.0/myLib.dll", Right = "lib/net6.0/myLib.dll", IsBaselineSuppression = false }, new
Suppression
("PK004") { Target = "A.B", Left = "ref/net6.0/myLib.dll", Right = "lib/net6.0/myLib.dll", IsBaselineSuppression = false } };
18
yield return new object[] { new
Suppression
("PK004") { Target = "A.B", Left = "ref/net6.0/myLib.dll", Right = "lib/net6.0/myLib.dll", IsBaselineSuppression = true }, new
Suppression
("PK004") { Target = "A.B", Left = "ref/net6.0/myLib.dll", Right = "lib/net6.0/myLib.dll", IsBaselineSuppression = true } };
23
yield return new object[] { new
Suppression
(string.Empty), new
Suppression
("PK005") };
24
yield return new object[] { new
Suppression
("PK004"), new
Suppression
("PK005") };
25
yield return new object[] { new
Suppression
("PK004"), new
Suppression
("PK004") { Target = "A.B()" } };
26
yield return new object[] { new
Suppression
("PK004") { Target = "A.B" }, new
Suppression
("PK004") { Target = "A.B()" } };
27
yield return new object[] { new
Suppression
("PK004") { Target = "A.C" }, new
Suppression
("PK004") { Target = "A.B()" } };
28
yield return new object[] { new
Suppression
("PK004") { Target = "A.B()", Left = "ref/net6.0/myLib.dll" }, new
Suppression
("PK004") { Target = "A.B()" } };
29
yield return new object[] { new
Suppression
("PK004") { Target = "A.B()", Left = "ref/net6.0/myLib.dll" }, new
Suppression
("PK004") { Target = "A.B()", Left = "lib/net6.0/myLib.dll" } };
30
yield return new object[] { new
Suppression
("PK004") { Target = "A.B()", Right = "ref/net6.0/myLib.dll" }, new
Suppression
("PK004") { Target = "A.B()" } };
31
yield return new object[] { new
Suppression
("PK004") { Target = "A.B()", Right = "ref/net6.0/myLib.dll" }, new
Suppression
("PK004") { Target = "A.B()", Right = "lib/net6.0/myLib.dll" } };
32
yield return new object[] { new
Suppression
("PK004") { Target = "A.B()", Left = "ref/net6.0/mylib.dll", Right = "lib/net6.0/myLib.dll" }, new
Suppression
("PK004") { Target = "A.B()", Left = "ref/netstandard2.0/mylib.dll", Right = "lib/net6.0/myLib.dll" } };
33
yield return new object[] { new
Suppression
("PK004") { Target = "A.B", Left = "ref/net6.0/myLib.dll", Right = "lib/net6.0/myLib.dll", IsBaselineSuppression = true }, new
Suppression
("PK004") { Target = "A.B", Left = "ref/net6.0/myLib.dll", Right = "lib/net6.0/myLib.dll", IsBaselineSuppression = false } };
34
yield return new object[] { new
Suppression
("PK004") { Target = "A.B", Left = "ref/net6.0/myLib.dll", Right = "lib/net6.0/myLib.dll" }, new
Suppression
("PK004") { Target = "A.B", Left = "ref/net6.0/myLib.dll", Right = "lib/net6.0/myLib.dll", IsBaselineSuppression = true } };
56
Assert.False(new
Suppression
("PK0004").Equals(null));
Microsoft.DotNet.PackageValidation (8)
ApiCompatRunnerExtensions.cs (1)
91
log.LogWarning(new
Suppression
(DiagnosticIds.SearchDirectoriesNotFoundForTfm) { Target = displayString },
Validators\BaselinePackageValidator.cs (4)
48
log.LogError(new
Suppression
(DiagnosticIds.TargetFrameworkDropped) { Target = baselineTargetFramework.ToString() },
72
log.LogError(new
Suppression
(DiagnosticIds.TargetFrameworkDropped) { Target = baselineTargetFramework.ToString() },
101
log.LogError(new
Suppression
(DiagnosticIds.TargetFrameworkAndRidPairDropped) { Target = baselineTargetFramework.ToString() + "-" + baselineRuntimeSpecificAssetsRidGroup.Key },
136
log.LogWarning(new
Suppression
(DiagnosticIds.BaselineTargetFrameworkIgnoredButPresentInCurrentPackage,
Validators\CompatibleTFMValidator.cs (3)
44
log.LogError(new
Suppression
(DiagnosticIds.ApplicableCompileTimeAsset) { Target = framework.ToString() },
54
log.LogError(new
Suppression
(DiagnosticIds.CompatibleRuntimeRidLessAsset) { Target = framework.ToString() },
74
log.LogError(new
Suppression
(DiagnosticIds.CompatibleRuntimeRidSpecificAsset) { Target = framework.ToString() + "-" + rid },