From 578992fc2b6ef8f5ad8f04e630f139682751dad0 Mon Sep 17 00:00:00 2001 From: Igor Velikorossov Date: Tue, 15 Aug 2023 17:52:44 +1000 Subject: [PATCH 001/172] Upadte branding to 9.0-alpha1 (#4289) --- .github/fabricbot.json | 2 +- eng/Versions.props | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/fabricbot.json b/.github/fabricbot.json index 95f3d618c9b..65bff8ff244 100644 --- a/.github/fabricbot.json +++ b/.github/fabricbot.json @@ -637,7 +637,7 @@ { "name": "addMilestone", "parameters": { - "milestoneName": "8.0 RC1" + "milestoneName": "9.0-preview1" } } ], diff --git a/eng/Versions.props b/eng/Versions.props index 831cd44cd40..f14fc47c53a 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -1,9 +1,9 @@ - 8 + 9 0 0 - rc + alpha 1 $(MajorVersion).$(MinorVersion).$(PatchVersion) true From ee0956025d46e8cf9a33fee58cc042af031c33ec Mon Sep 17 00:00:00 2001 From: Nikita Balabaev Date: Tue, 15 Aug 2023 16:16:27 +0200 Subject: [PATCH 002/172] Remove a few internal references (#4290) Co-authored-by: Nikita Balabaev --- .gitignore | 4 +-- .spelling | 18 ------------- .../BenchEnricher.cs | 2 +- eng/Tools/DiagConfig/README.md | 26 +++++++++---------- src/LegacySupport/README.md | 2 +- .../Logging/FakeLogRecord.cs | 2 +- .../EventCountersCollectorOptions.cs | 1 - .../Logging/FakeLoggerExtensionsTests.cs | 2 +- .../Metering/OTelMeteringExtensionsTests.cs | 12 ++++----- .../Telemetry.Internal/TestEventSource.cs | 2 +- .../appsettings.json | 6 ++--- 11 files changed, 28 insertions(+), 49 deletions(-) diff --git a/.gitignore b/.gitignore index 58f72853dee..7025b580ae0 100644 --- a/.gitignore +++ b/.gitignore @@ -308,6 +308,4 @@ BenchmarkDotNet.artifacts/ /_TEST -*.binlog - -/docs/releases/r9-packages.md \ No newline at end of file +*.binlog \ No newline at end of file diff --git a/.spelling b/.spelling index 14da61d41f7..746d818b56a 100644 --- a/.spelling +++ b/.spelling @@ -112,7 +112,6 @@ ECS ECS ejuvenate encodings -eng.ms enricher Enricher enrichers @@ -283,23 +282,6 @@ Protobuf-net PubSub QoS quantiles -R9 -R9_RELEASE -R9A000 -R9A001 -R9A002 -R9G000 -R9G001 -R9G002 -R9G003 -R9G004 -R9G005 -R9G006 -R9G007 -R9G008 -R9G009 -R9G010 -r9support Ramati ramping RDFE diff --git a/bench/Libraries/Microsoft.Extensions.Http.Telemetry.PerformanceTests/BenchEnricher.cs b/bench/Libraries/Microsoft.Extensions.Http.Telemetry.PerformanceTests/BenchEnricher.cs index 8ce37c0dd8b..0b3e43f245c 100644 --- a/bench/Libraries/Microsoft.Extensions.Http.Telemetry.PerformanceTests/BenchEnricher.cs +++ b/bench/Libraries/Microsoft.Extensions.Http.Telemetry.PerformanceTests/BenchEnricher.cs @@ -8,7 +8,7 @@ namespace Microsoft.Extensions.Http.Telemetry.Logging.Bench; internal sealed class BenchEnricher : IHttpClientLogEnricher { - private const string Key = "Performance in R9"; + private const string Key = "Performance in .NET Extensions"; private const string Value = "is paramount."; public void Enrich(IEnrichmentTagCollector collector, HttpRequestMessage? request = null, diff --git a/eng/Tools/DiagConfig/README.md b/eng/Tools/DiagConfig/README.md index 93f3b4f6e42..64f08083330 100644 --- a/eng/Tools/DiagConfig/README.md +++ b/eng/Tools/DiagConfig/README.md @@ -12,28 +12,28 @@ refreshed as new analyzers are added or existing ones are modified. The lower a diagnostic's tier value, the more relatively important the diagnostic is. * A variable set of named attributes. Each attribute indicates a severity for the diagnostic, along with -an optional comment. Attributes and their severities are maintained by the R9 team and are used to +an optional comment. Attributes and their severities are maintained by the .NET Extensions team and are used to describe how to handle a given diagnostic for a given type of source code. More on attributes below. Here's an example diagnostic: ```yaml Diagnostics: - EA0001: + CA1001: Metadata: - Category: Performance - Title: Switch to `Microsoft.IO.RecyclableMemoryStream` for additional performance. - Description: Identifies uses of System.IO.MemoryStream. - HelpLinkUri: https://eng.ms/docs/experiences-devices/r9-sdk/docs/static-analysis-and-analyzers/analyzer/rules/r9a001 - CustomTags: [] - Tier: 1 + Category: Design + Title: Types that own disposable fields should be disposable + Description: A class declares and implements an instance field that is a System.IDisposable type, and the class does not implement IDisposable. A class that declares an IDisposable field indirectly owns an unmanaged resource and should implement the IDisposable interface. + HelpLinkUri: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1001 + CustomTags: + - PortedFromFxCop + - Telemetry + - EnabledRuleInAggressiveMode + DefaultSeverity: None + Tier: 2 Attributes: - baseline: - Severity: None - Comment: - production: + general: Severity: Warning - Comment: ``` ## What's the Point? diff --git a/src/LegacySupport/README.md b/src/LegacySupport/README.md index dc06a9c7333..ddc416aae2e 100644 --- a/src/LegacySupport/README.md +++ b/src/LegacySupport/README.md @@ -1,7 +1,7 @@ # About this Folder This folder contains a bunch of sources copied from newer versions of .NET which we pull in to -R9 sources as necessary. This enables us to compile source code that depends on these newer +our sources as necessary. This enables us to compile source code that depends on these newer features from .NET even when targeting older frameworks. Please see the `eng/MSBuild/LegacySupport.props` file for the set of project properties that control importing diff --git a/src/Libraries/Microsoft.Extensions.Telemetry.Testing/Logging/FakeLogRecord.cs b/src/Libraries/Microsoft.Extensions.Telemetry.Testing/Logging/FakeLogRecord.cs index c2d9efeb051..8f4c814a3d3 100644 --- a/src/Libraries/Microsoft.Extensions.Telemetry.Testing/Logging/FakeLogRecord.cs +++ b/src/Libraries/Microsoft.Extensions.Telemetry.Testing/Logging/FakeLogRecord.cs @@ -64,7 +64,7 @@ public FakeLogRecord(LogLevel level, EventId id, object? state, Exception? excep /// /// The object returned by this property is the same as what returns, except it has been cast to a read-only list. /// - /// The state object was not generated by the R9 logging model and is not a read-only list. + /// The state object is not compatible with supported logging model and is not a read-only list. public IReadOnlyList>? StructuredState => (IReadOnlyList>?)State; /// diff --git a/src/Libraries/Microsoft.Extensions.Telemetry/Metering.Collectors.EventCounters/EventCountersCollectorOptions.cs b/src/Libraries/Microsoft.Extensions.Telemetry/Metering.Collectors.EventCounters/EventCountersCollectorOptions.cs index 65c5bced7d2..47b66798f6c 100644 --- a/src/Libraries/Microsoft.Extensions.Telemetry/Metering.Collectors.EventCounters/EventCountersCollectorOptions.cs +++ b/src/Libraries/Microsoft.Extensions.Telemetry/Metering.Collectors.EventCounters/EventCountersCollectorOptions.cs @@ -54,7 +54,6 @@ public class EventCountersCollectorOptions /// /// /// Includes the recommended default event counters in addition to the counters specified in . - /// See the list of recommended default counters in . /// EventSource: "System.Runtime", Counters: /// - "cpu-usage", "working-set", "time-in-gc", "alloc-rate", "exception-count", "gen-2-gc-count", "gen-2-size", /// - "monitor-lock-contention-count", "active-timer-count", "threadpool-queue-length", "threadpool-thread-count", diff --git a/test/Libraries/Microsoft.Extensions.Telemetry.Testing.Tests/Logging/FakeLoggerExtensionsTests.cs b/test/Libraries/Microsoft.Extensions.Telemetry.Testing.Tests/Logging/FakeLoggerExtensionsTests.cs index 2c0e5f744b7..3d98fea2cda 100644 --- a/test/Libraries/Microsoft.Extensions.Telemetry.Testing.Tests/Logging/FakeLoggerExtensionsTests.cs +++ b/test/Libraries/Microsoft.Extensions.Telemetry.Testing.Tests/Logging/FakeLoggerExtensionsTests.cs @@ -23,7 +23,7 @@ public void Basic() var factory = serviceProvider.GetService(); var collector = serviceProvider.GetFakeLogCollector(); - var logger = factory!.CreateLogger("R9"); + var logger = factory!.CreateLogger("DOT-NET"); Assert.Equal(0, collector.Count); logger.LogError("M1"); Assert.Equal(1, collector.Count); diff --git a/test/Libraries/Microsoft.Extensions.Telemetry.Tests/Metering/OTelMeteringExtensionsTests.cs b/test/Libraries/Microsoft.Extensions.Telemetry.Tests/Metering/OTelMeteringExtensionsTests.cs index aba3091f5a7..57b96b934cd 100644 --- a/test/Libraries/Microsoft.Extensions.Telemetry.Tests/Metering/OTelMeteringExtensionsTests.cs +++ b/test/Libraries/Microsoft.Extensions.Telemetry.Tests/Metering/OTelMeteringExtensionsTests.cs @@ -204,7 +204,7 @@ public async Task AddMetering_MeterStateOverrides_WithOverlappingMatches_Applies jsonConfigRoot.Bind("MeteringWithOverrides", meteringOptions); configurationSection.Value = JsonConvert.SerializeObject(meteringOptions); - using var exporter = new TestExporter("R9.Test"); + using var exporter = new TestExporter("DotNet.Test"); using var reader = new BaseExportingMetricReader(exporter); using var host = await FakeHost.CreateBuilder() @@ -216,7 +216,7 @@ public async Task AddMetering_MeterStateOverrides_WithOverlappingMatches_Applies })) .StartAsync(); - var meterNameR9Test = $"R9.Test{DateTime.Now.Ticks}"; + var meterNameR9Test = $"DotNet.Test{DateTime.Now.Ticks}"; using var meter1 = new Meter(meterNameR9Test); var counter1 = meter1.CreateCounter("meter1_counter1"); counter1.Add(5); @@ -224,7 +224,7 @@ public async Task AddMetering_MeterStateOverrides_WithOverlappingMatches_Applies Assert.Equal(0, exporter.Metrics.Count); Assert.False(IsMetricAvailable(exporter.Metrics, meterNameR9Test, "meter1_counter1")); - var meterNameR9TestInternal = $"R9.Test.Internal{DateTime.Now.Ticks}"; + var meterNameR9TestInternal = $"DotNet.Test.Internal{DateTime.Now.Ticks}"; using var meter2 = new Meter(meterNameR9TestInternal); var counter2 = meter2.CreateCounter("meter2_counter2"); counter2.Add(16); @@ -232,7 +232,7 @@ public async Task AddMetering_MeterStateOverrides_WithOverlappingMatches_Applies Assert.True(IsMetricAvailable(exporter.Metrics, meterNameR9TestInternal, "meter2_counter2")); Assert.Equal(16, exporter.FirstMetricPoint().GetSumLong()); - var meterNameR9TestExternal = $"R9.Test.External{DateTime.Now.Ticks}"; + var meterNameR9TestExternal = $"DotNet.Test.External{DateTime.Now.Ticks}"; using var meter3 = new Meter(meterNameR9TestExternal); var counter3 = meter3.CreateCounter("meter3_counter3"); counter2.Add(8); @@ -375,7 +375,7 @@ public async Task LongCounter_SumAsExpected() [Fact(Skip = "Flaky")] public async Task EmitMetric_DoesNotThrowAsync() { - var meterName1 = $"Microsoft.R9.Extensions.Meter1{DateTime.Now.Ticks}"; + var meterName1 = $"Microsoft.Extensions.Meter1{DateTime.Now.Ticks}"; var meterName2 = $"Meter2{DateTime.Now.Ticks}"; using var exporter = new TestExporter(meterName1, meterName2); @@ -388,7 +388,7 @@ public async Task EmitMetric_DoesNotThrowAsync() builder.AddMetering(option => { option.MeterState = MeteringState.Disabled; - option.MeterStateOverrides.Add(new KeyValuePair("Microsoft.R9.Extensions", MeteringState.Enabled)); + option.MeterStateOverrides.Add(new KeyValuePair("Microsoft.Extensions", MeteringState.Enabled)); }) .AddTestExporter(reader); })) diff --git a/test/Libraries/Microsoft.Extensions.Telemetry.Tests/Telemetry.Internal/TestEventSource.cs b/test/Libraries/Microsoft.Extensions.Telemetry.Tests/Telemetry.Internal/TestEventSource.cs index c31f8546065..8c572617a32 100644 --- a/test/Libraries/Microsoft.Extensions.Telemetry.Tests/Telemetry.Internal/TestEventSource.cs +++ b/test/Libraries/Microsoft.Extensions.Telemetry.Tests/Telemetry.Internal/TestEventSource.cs @@ -5,7 +5,7 @@ namespace Microsoft.Extensions.Telemetry.Internal.Test; -[EventSource(Name = "R9-SelfDiagnostics-Test")] +[EventSource(Name = "DotNet-SelfDiagnostics-Test")] internal sealed class TestEventSource : EventSource { public const string WarningMessageText = "This is a warning event."; diff --git a/test/Libraries/Microsoft.Extensions.Telemetry.Tests/appsettings.json b/test/Libraries/Microsoft.Extensions.Telemetry.Tests/appsettings.json index eb8605bee70..975140356d3 100644 --- a/test/Libraries/Microsoft.Extensions.Telemetry.Tests/appsettings.json +++ b/test/Libraries/Microsoft.Extensions.Telemetry.Tests/appsettings.json @@ -6,9 +6,9 @@ "MeterState": "Enabled", "MeterStateOverrides": { "testMeter2": "Disabled", - "R9.Test": "Disabled", - "R9.Test.Internal": "Enabled", - "R9.Test.External": "Disabled" + "DotNet.Test": "Disabled", + "DotNet.Test.Internal": "Enabled", + "DotNet.Test.External": "Disabled" } }, "MeteringWithOverridesWithEmptyOverride": { From 9a71715251031af8f9e4e1594e9c412547058851 Mon Sep 17 00:00:00 2001 From: Nikita Balabaev Date: Tue, 15 Aug 2023 16:17:54 +0200 Subject: [PATCH 003/172] Remove MSB3270 suppression (#4291) Co-authored-by: Nikita Balabaev --- Directory.Build.props | 5 ----- 1 file changed, 5 deletions(-) diff --git a/Directory.Build.props b/Directory.Build.props index 16340286ac5..9eeb84ce52d 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -82,11 +82,6 @@ true - - - None - - diff --git a/test/Generators/Microsoft.Gen.Logging/Unit/ParserTests.LogProperties.cs b/test/Generators/Microsoft.Gen.Logging/Unit/ParserTests.LogProperties.cs index f28efcc9287..96bb274aada 100644 --- a/test/Generators/Microsoft.Gen.Logging/Unit/ParserTests.LogProperties.cs +++ b/test/Generators/Microsoft.Gen.Logging/Unit/ParserTests.LogProperties.cs @@ -9,6 +9,39 @@ namespace Microsoft.Gen.Logging.Test; public partial class ParserTests { + [Fact] + public static async Task InvalidLogPropertiesUsage() + { + await RunGenerator(@" + class MyClass2 + { + public int A { get; set; } + } + + class MyClass + { + [/*0+*/LogProperties/*-0*/] + internal MyClass2 P0 { get; set; } + + [/*1+*/LogProperties/*-1*/] + internal static MyClass2 P1 { get; set; } + + [/*2+*/LogProperties/*-2*/] + internal MyClass2 P2 { set; } + + [/*3+*/LogProperties/*-3*/] + public MyClass2 P3 { internal get; set; } + + public int A { get; set; } + } + + partial class C + { + [LoggerMessage(0, LogLevel.Debug, ""Parameter"")] + static partial void M0(ILogger logger, [LogProperties] MyClass p1); + }", DiagDescriptors.InvalidAttributeUsage); + } + [Fact] public static async Task LogPropertiesOmitParamName_DetectsNameCollision() { @@ -21,7 +54,7 @@ class MyType partial class C { [LoggerMessage(0, LogLevel.Debug, ""Parameterless..."")] - static partial void M0(ILogger logger, [LogProperties(OmitParameterName = true)] MyType /*0+*/p0/*-0*/); + static partial void M0(ILogger logger, [LogProperties(OmitReferenceName = true)] MyType /*0+*/p0/*-0*/); }"; await RunGenerator(Source, DiagDescriptors.LogPropertiesNameCollision); @@ -200,6 +233,7 @@ public class MyClass { public int Transitive_Prop { get; set; } + [LogProperties] public MyTransitiveClass Transitive { get; set; } } @@ -217,270 +251,6 @@ partial class C await RunGenerator(Source, DiagDescriptors.LogPropertiesNameCollision); } - [Fact] - public async Task LogPropertiesProviderTypeNotFound() - { - await RunGenerator(@" - class MyClass - { - public string Property { get; set; } - } - - partial class C - { - [LoggerMessage(0, LogLevel.Debug, ""Parameter"")] - static partial void M(ILogger logger, [LogProperties(typeof(XXX), """")] MyClass p1); - }"); - } - - [Theory] - [InlineData("null")] - [InlineData("\"\"")] - [InlineData("\"Error\"")] - [InlineData("\"Prop\"")] - [InlineData("\"Field\"")] - [InlineData("\"Const\"")] - public async Task LogPropertiesProviderMethodNotFound(string methodName) - { - string source = @$" - class MyClass - {{ - public string Property {{ get; set; }} - }} - - static class Provider - {{ - public static string Prop {{ get; set; }} - public static string Field; - public static const string Const = ""test""; - }} - - partial class C - {{ - [LoggerMessage(0, LogLevel.Debug, ""Parameter"")] - static partial void M(ILogger logger, [/*0+*/LogProperties(typeof(Provider), {methodName})/*-0*/] MyClass p1); - }}"; - - await RunGenerator(source, DiagDescriptors.TagProviderMethodNotFound); - } - - [Fact] - public async Task LogPropertiesProviderMethodNotFound2() - { - const string Source = @" - class MyClass - { - public string Property { get; set; } - } - - static class Provider - { - public static void Provide1(ITagCollector props, MyClass? value) - { - } - - public static void Provide2(ITagCollector props, MyClass? value, int a) - { - } - } - - partial class C - { - [LoggerMessage(0, LogLevel.Debug, ""Parameter"")] - static partial void M(ILogger logger, [/*0+*/LogProperties(typeof(Provider), nameof(Provider.Provide))/*-0*/] MyClass p1); - }"; - - await RunGenerator(Source, DiagDescriptors.TagProviderMethodNotFound); - } - - [Fact] - public async Task LogPropertiesProviderMethodIsGeneric() - { - const string Source = @" - class MyClass - { - public string Property { get; set; } - } - - static class Provider - { - public static void Provide(ITagCollector props, MyClass? value) - { - } - } - - partial class C - { - [LoggerMessage(0, LogLevel.Debug, ""Parameter"")] - static partial void M(ILogger logger, [/*0+*/LogProperties(typeof(Provider), nameof(Provider.Provide))/*-0*/] MyClass p1); - }"; - - await RunGenerator(Source, DiagDescriptors.TagProviderMethodInvalidSignature); - } - - [Fact] - public async Task LogPropertiesProvider_UsingInterfacesAndBaseClassAndNullableAndOptional() - { - const string Source = @" - interface IFoo - { - } - - class BaseClass - { - } - - class MyClass : BaseClass, IFoo - { - } - - static class Provider - { - public static void Provide1(ITagCollector props, MyClass? value) {} - public static void Provide2(ITagCollector props, BaseClass value) {} - public static void Provide3(ITagCollector props, IFoo value) {} - public static void Provide4(ITagCollector props, MyClass value, object o = null) {} - public static void Provide5(ITagCollector props, MyClass value) {} - } - - partial class C - { - [LoggerMessage(LogLevel.Debug)] - static partial void M1(ILogger logger, [LogProperties(typeof(Provider), nameof(Provider.Provide1))] MyClass p1); - - [LoggerMessage(LogLevel.Debug)] - static partial void M2(ILogger logger, [LogProperties(typeof(Provider), nameof(Provider.Provide2))] MyClass p1); - - [LoggerMessage(LogLevel.Debug)] - static partial void M3(ILogger logger, [LogProperties(typeof(Provider), nameof(Provider.Provide3))] MyClass p1); - - [LoggerMessage(LogLevel.Debug)] - static partial void M4(ILogger logger, [LogProperties(typeof(Provider), nameof(Provider.Provide4))] MyClass p1); - - [LoggerMessage(LogLevel.Debug)] - static partial void M5(ILogger logger, [/*0+*/LogProperties(typeof(Provider), nameof(Provider.Provide5))/*-0*/] MyClass? p1); - }"; - - await RunGenerator(Source, DiagDescriptors.TagProviderMethodInvalidSignature); - } - - [Theory] - [InlineData("")] - [InlineData("ITagCollector props")] - [InlineData("ITagCollector props, MyClass? value, int a")] - public async Task LogPropertiesProviderMethodParamsCount(string paramsList) - { - string source = @$" - class MyClass - {{ - public string Property {{ get; set; }} - }} - - static class Provider - {{ - public static void Provide({paramsList}) - {{ - }} - }} - - partial class C - {{ - [LoggerMessage(0, LogLevel.Debug, ""Parameter"")] - static partial void M(ILogger logger, [/*0+*/LogProperties(typeof(Provider), nameof(Provider.Provide))/*-0*/] MyClass p1); - }}"; - - await RunGenerator(source, DiagDescriptors.TagProviderMethodInvalidSignature); - } - - [Theory] - [CombinatorialData] - public async Task LogPropertiesProviderMethodParamsRefKind( - [CombinatorialValues("ref", "out", "in", "")] string listModifier, - [CombinatorialValues("ref", "out", "in", "")] string valueModifier) - { - if (listModifier == string.Empty && valueModifier == string.Empty) - { - return; - } - - string source = @$" - class MyClass - {{ - public string Property {{ get; set; }} - }} - - static class Provider - {{ - public static void Provide({listModifier} ITagCollector props, {valueModifier} MyClass? value) - {{ - }} - }} - - partial class C - {{ - [LoggerMessage(0, LogLevel.Debug, ""Parameter"")] - static partial void M(ILogger logger, [/*0+*/LogProperties(typeof(Provider), nameof(Provider.Provide))/*-0*/] MyClass p1); - }}"; - - await RunGenerator(source, DiagDescriptors.TagProviderMethodInvalidSignature); - } - - [Theory] - [CombinatorialData] - public async Task LogPropertiesProviderMethodParamsInvalidType( - [CombinatorialValues("ITagCollector", "MyClass?", "int", "object", "string", "DateTime")] string listType, - [CombinatorialValues("ITagCollector", "int", "string", "DateTime")] string valueType) - { - string source = @$" - class MyClass - {{ - public string Property {{ get; set; }} - }} - - static class Provider - {{ - public static void Provide({listType} props, {valueType} value) - {{ - }} - }} - - partial class C - {{ - [LoggerMessage(0, LogLevel.Debug, ""Parameter"")] - static partial void M(ILogger logger, [/*0+*/LogProperties(typeof(Provider), nameof(Provider.Provide))/*-0*/] MyClass p1); - }}"; - - await RunGenerator(source, DiagDescriptors.TagProviderMethodInvalidSignature); - } - - [Theory] - [InlineData("private")] - [InlineData("")] - public async Task LogPropertiesProviderMethodIsInaccessible(string methodModifier) - { - string source = @$" - class MyClass - {{ - public string Property {{ get; set; }} - }} - - static class Provider - {{ - {methodModifier} static void Provide(ITagCollector props, MyClass? value) - {{ - return 0; - }} - }} - - partial class C - {{ - [LoggerMessage(0, LogLevel.Debug, ""Parameter"")] - static partial void M(ILogger logger, [/*0+*/LogProperties(typeof(Provider), nameof(Provider.Provide))/*-0*/] MyClass p1); - }}"; - - await RunGenerator(source, DiagDescriptors.TagProviderMethodInaccessible); - } - [Theory] [InlineData("int")] [InlineData("int?")] @@ -531,10 +301,19 @@ partial class C public async Task IneligibleTypeForPropertiesLogging(string type) { string source = @$" + class MyClass + {{ + [LogProperties] + public {type} /*0+*/Prop/*-0*/ {{ get; set; }} + }} + partial class C {{ [LoggerMessage(0, LogLevel.Debug, ""No params..."")] - static partial void M(ILogger logger, [LogProperties] {type} /*0+*/test/*-0*/); + static partial void M0(ILogger logger, [LogProperties] {type} /*1+*/test/*-1*/); + + [LoggerMessage(1, LogLevel.Debug, ""No params..."")] + static partial void M1(ILogger logger, [LogProperties] MyClass test); }}"; await RunGenerator(source, DiagDescriptors.InvalidTypeToLogProperties); @@ -552,21 +331,25 @@ public async Task PropertyToLogWithTypeCycle(string propertyType) string source = @$" public class ClassA {{ + [LogProperties] public {propertyType} Prop {{ get; set; }} }} public class ClassB {{ + [LogProperties] public ClassC Prop {{ get; set; }} }} public class ClassC {{ + [LogProperties] public ClassA Prop {{ get; set; }} }} public struct StructA {{ + [LogProperties] public ClassA Prop {{ get; set; }} }} @@ -601,109 +384,4 @@ partial class LoggerClass await RunGenerator(Source, DiagDescriptors.LogPropertiesHiddenPropertyDetected); } - - [Fact] - public async Task MultipleDataClassificationAttributes() - { - const string Source = @" - using Microsoft.Extensions.Compliance.Testing; - - class MyClass - { - [PrivateData] - [PrivateData] - public string? /*0+*/A/*-0*/ { get; set; } - } - - internal static partial class C - { - [LoggerMessage(0, LogLevel.Debug, ""Only {A}"")] - static partial void M(ILogger logger, [FeedbackData] string a, [LogProperties] MyClass param); - }"; - - await RunGenerator(Source, DiagDescriptors.MultipleDataClassificationAttributes); - } - - [Theory] - [InlineData("object")] - [InlineData("object?")] - [InlineData("System.Object")] - [InlineData("System.Object?")] - [InlineData("MyClass")] - [InlineData("MyStruct")] - [InlineData("MyInterface")] - public async Task TypeIsEligibleForLogPropertiesProvider(string type) - { - string source = @$" - internal static partial class C - {{ - class MyClass {{ }} - - struct MyStruct {{ }} - - struct MyInterface {{ }} - - public static void Provide(ITagCollector props, {type} value) - {{ - }} - - [LoggerMessage(0, LogLevel.Debug, ""No params..."")] - static partial void M(ILogger logger, [LogProperties(typeof(C), nameof(C.Provide))] {type} test); - }}"; - - await RunGenerator(source); - } - - [Theory] - [InlineData("int")] - [InlineData("int?")] - [InlineData("System.Int32")] - [InlineData("System.Int32?")] - [InlineData("bool")] - [InlineData("bool?")] - [InlineData("System.Boolean")] - [InlineData("System.Boolean?")] - [InlineData("byte")] - [InlineData("byte?")] - [InlineData("char?")] - [InlineData("string")] - [InlineData("string?")] - [InlineData("double?")] - [InlineData("decimal?")] - [InlineData("int[]")] - [InlineData("int?[]")] - [InlineData("int[]?")] - [InlineData("int?[]?")] - [InlineData("object[]")] - [InlineData("object[]?")] - [InlineData("System.Array")] - [InlineData("System.DateTime")] - [InlineData("System.DateTimeOffset")] - [InlineData("System.DateTime?")] - [InlineData("System.DateTimeOffset?")] - [InlineData("System.IDisposable")] - [InlineData("System.Action")] - [InlineData("System.Action")] - [InlineData("System.Func")] - [InlineData("System.Nullable")] - [InlineData("System.Nullable")] - [InlineData("System.Nullable")] - [InlineData("System.Nullable")] - [InlineData("System.Nullable")] - [InlineData("System.Nullable")] - public async Task IneligibleTypeForLogPropertiesProvider(string type) - { - string source = @$" - internal static partial class C - {{ - public static void Provide(ITagCollector props, {type} value) - {{ - }} - - [LoggerMessage(0, LogLevel.Debug, ""No params..."")] - static partial void M(ILogger logger, [LogProperties(typeof(C), nameof(C.Provide))] {type} /*0+*/test/*-0*/); - }}"; - - await RunGenerator(source, DiagDescriptors.InvalidTypeToLogProperties); - } } diff --git a/test/Generators/Microsoft.Gen.Logging/Unit/ParserTests.TagProvider.cs b/test/Generators/Microsoft.Gen.Logging/Unit/ParserTests.TagProvider.cs new file mode 100644 index 00000000000..5ebd57f720b --- /dev/null +++ b/test/Generators/Microsoft.Gen.Logging/Unit/ParserTests.TagProvider.cs @@ -0,0 +1,406 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System.Threading.Tasks; +using Microsoft.Gen.Logging.Parsing; +using Xunit; + +namespace Microsoft.Gen.Logging.Test; + +public partial class ParserTests +{ + [Fact] + public async Task InvalidTagProviderUsage() + { + await RunGenerator(@" + class MyClass + { + [/*0+*/TagProvider(typeof(Provider), ""Provide"")/*-0*/] + internal string P0 { get; set; } + + [/*1+*/TagProvider(typeof(Provider), ""Provide"")/*-1*/] + internal static string P1 { get; set; } + + [/*2+*/TagProvider(typeof(Provider), ""Provide"")/*-2*/] + internal string P2 { set; } + + [/*3+*/TagProvider(typeof(Provider), ""Provide"")/*-3*/] + public string P3 { internal get; set; } + } + + static class Provider + { + public static void Provide(ITagCollector collector, string p1) { } + } + + partial class C + { + [LoggerMessage(0, LogLevel.Debug, ""Parameter"")] + static partial void M0(ILogger logger, [LogProperties] MyClass p1); + }", DiagDescriptors.InvalidAttributeUsage); + } + + [Fact] + public async Task TooManyAttributes() + { + await RunGenerator(@" + class MyClass + { + public string Property { get; set; } + } + + class MyClass2 + { + [LogProperties, TagProvider(typeof(Provider), ""Provide"")] + public MyClass /*0+*/Property1/*-0*/ { get; set; } = new(); + + [LogPropertyIgnore, TagProvider(typeof(Provider), ""Provide"")] + public MyClass /*1+*/Property2/*-1*/ { get; set; } = new(); + + public int Property3 { get; set; } + } + + static class Provider + { + public static void Provide(ITagCollector collector, MyClass p1) { } + } + + partial class C + { + [LoggerMessage(0, LogLevel.Debug, ""Parameter"")] + static partial void M0(ILogger logger, [LogProperties, TagProvider(typeof(Provider), nameof(Provider.Provide))] MyClass /*2+*/p1/*-2*/); + + [LoggerMessage(1, LogLevel.Debug, ""Parameter"")] + static partial void M1(ILogger logger, [LogProperties] MyClass2 p1); + }", DiagDescriptors.CantMixAttributes); + } + + [Fact] + public async Task TagProviderTypeNotFound() + { + await RunGenerator(@" + class MyClass + { + public string Property { get; set; } + } + + partial class C + { + [LoggerMessage(0, LogLevel.Debug, ""Parameter"")] + static partial void M(ILogger logger, [TagProvider(typeof(XXX), """")] MyClass p1); + }"); + } + + [Fact] + public async Task TagProviderOnUnsupportedParameters() + { + string source = @" + class MyClass + { + public string Property { get; set; } + } + + static class Provider + { + public static void Provide(ITagCollector props, MyClass? value) + { + } + } + + partial class C + { + [LoggerMessage(""Hello"")] + static partial void M0(ILogger logger, [TagProvider(typeof(Provider), ""Provide"")] LogLevel /*0+*/l1/*-0*/); + + [LoggerMessage(LogLevel.Debug)] + static partial void M1(ILogger logger, [TagProvider(typeof(Provider), ""Provide"")] global::System.Exception /*1+*/ex/*-1*/); + + [LoggerMessage(LogLevel.Debug)] + static partial void M2([TagProvider(typeof(Provider), ""Provide"")] ILogger /*2+*/logger/*-2*/, string p0); + }"; + + await RunGenerator(source, DiagDescriptors.TagProviderInvalidUsage); + } + + [Theory] + [InlineData("null")] + [InlineData("\"\"")] + [InlineData("\"Error\"")] + [InlineData("\"Prop\"")] + [InlineData("\"Field\"")] + [InlineData("\"Const\"")] + public async Task TagProviderMethodNotFound(string methodName) + { + string source = @$" + class MyClass + {{ + public string Property {{ get; set; }} + }} + + static class Provider + {{ + public static string Prop {{ get; set; }} + public static string Field; + public static const string Const = ""test""; + }} + + partial class C + {{ + [LoggerMessage(0, LogLevel.Debug, ""Parameter"")] + static partial void M(ILogger logger, [/*0+*/TagProvider(typeof(Provider), {methodName})/*-0*/] MyClass p1); + }}"; + + await RunGenerator(source, DiagDescriptors.TagProviderMethodNotFound); + } + + [Theory] + [InlineData("null")] + [InlineData("\"\"")] + [InlineData("\"Error\"")] + [InlineData("\"Prop\"")] + [InlineData("\"Field\"")] + [InlineData("\"Const\"")] + public async Task TagProviderMethodNotFoundNested(string methodName) + { + string source = @$" + class MyClass + {{ + public string Property {{ get; set; }} + + [/*0+*/TagProvider(typeof(Provider), {methodName})/*-0*/] + public string AnotherProperty {{ get; set; }} + }} + + static class Provider + {{ + public static string Prop {{ get; set; }} + public static string Field; + public static const string Const = ""test""; + }} + + partial class C + {{ + [LoggerMessage(0, LogLevel.Debug, ""Parameter"")] + static partial void M(ILogger logger, [LogProperties] MyClass p1); + }}"; + + await RunGenerator(source, DiagDescriptors.TagProviderMethodNotFound); + } + + [Fact] + public async Task TagProviderMethodNotFound2() + { + const string Source = @" + class MyClass + { + public string Property { get; set; } + } + + static class Provider + { + public static void Provide1(ITagCollector props, MyClass? value) + { + } + + public static void Provide2(ITagCollector props, MyClass? value, int a) + { + } + } + + partial class C + { + [LoggerMessage(0, LogLevel.Debug, ""Parameter"")] + static partial void M(ILogger logger, [/*0+*/TagProvider(typeof(Provider), nameof(Provider.Provide))/*-0*/] MyClass p1); + }"; + + await RunGenerator(Source, DiagDescriptors.TagProviderMethodNotFound); + } + + [Fact] + public async Task TagProviderMethodIsGeneric() + { + const string Source = @" + class MyClass + { + public string Property { get; set; } + } + + static class Provider + { + public static void Provide(ITagCollector props, MyClass? value) + { + } + } + + partial class C + { + [LoggerMessage(0, LogLevel.Debug, ""Parameter"")] + static partial void M(ILogger logger, [/*0+*/TagProvider(typeof(Provider), nameof(Provider.Provide))/*-0*/] MyClass p1); + }"; + + await RunGenerator(Source, DiagDescriptors.TagProviderMethodInvalidSignature); + } + + [Fact] + public async Task TagProvider_UsingInterfacesAndBaseClassAndNullableAndOptional() + { + const string Source = @" + interface IFoo + { + } + + class BaseClass + { + } + + class MyClass : BaseClass, IFoo + { + } + + static class Provider + { + public static void Provide1(ITagCollector props, MyClass? value) {} + public static void Provide2(ITagCollector props, BaseClass value) {} + public static void Provide3(ITagCollector props, IFoo value) {} + public static void Provide4(ITagCollector props, MyClass value, object o = null) {} + public static void Provide5(ITagCollector props, MyClass value) {} + } + + partial class C + { + [LoggerMessage(LogLevel.Debug)] + static partial void M1(ILogger logger, [TagProvider(typeof(Provider), nameof(Provider.Provide1))] MyClass p1); + + [LoggerMessage(LogLevel.Debug)] + static partial void M2(ILogger logger, [TagProvider(typeof(Provider), nameof(Provider.Provide2))] MyClass p1); + + [LoggerMessage(LogLevel.Debug)] + static partial void M3(ILogger logger, [TagProvider(typeof(Provider), nameof(Provider.Provide3))] MyClass p1); + + [LoggerMessage(LogLevel.Debug)] + static partial void M4(ILogger logger, [TagProvider(typeof(Provider), nameof(Provider.Provide4))] MyClass p1); + + [LoggerMessage(LogLevel.Debug)] + static partial void M5(ILogger logger, [/*0+*/TagProvider(typeof(Provider), nameof(Provider.Provide5))/*-0*/] MyClass? p1); + }"; + + await RunGenerator(Source, DiagDescriptors.TagProviderMethodInvalidSignature); + } + + [Theory] + [InlineData("")] + [InlineData("ITagCollector props")] + [InlineData("ITagCollector props, MyClass? value, int a")] + public async Task TagProviderMethodParamsCount(string paramsList) + { + string source = @$" + class MyClass + {{ + public string Property {{ get; set; }} + }} + + static class Provider + {{ + public static void Provide({paramsList}) + {{ + }} + }} + + partial class C + {{ + [LoggerMessage(0, LogLevel.Debug, ""Parameter"")] + static partial void M(ILogger logger, [/*0+*/TagProvider(typeof(Provider), nameof(Provider.Provide))/*-0*/] MyClass p1); + }}"; + + await RunGenerator(source, DiagDescriptors.TagProviderMethodInvalidSignature); + } + + [Theory] + [CombinatorialData] + public async Task TagProviderMethodParamsRefKind( + [CombinatorialValues("ref", "out", "in", "")] string listModifier, + [CombinatorialValues("ref", "out", "in", "")] string valueModifier) + { + if (listModifier == string.Empty && valueModifier == string.Empty) + { + return; + } + + string source = @$" + class MyClass + {{ + public string Property {{ get; set; }} + }} + + static class Provider + {{ + public static void Provide({listModifier} ITagCollector props, {valueModifier} MyClass? value) + {{ + }} + }} + + partial class C + {{ + [LoggerMessage(0, LogLevel.Debug, ""Parameter"")] + static partial void M(ILogger logger, [/*0+*/TagProvider(typeof(Provider), nameof(Provider.Provide))/*-0*/] MyClass p1); + }}"; + + await RunGenerator(source, DiagDescriptors.TagProviderMethodInvalidSignature); + } + + [Theory] + [CombinatorialData] + public async Task TagProviderMethodParamsInvalidType( + [CombinatorialValues("ITagCollector", "MyClass?", "int", "object", "string", "DateTime")] string listType, + [CombinatorialValues("ITagCollector", "int", "string", "DateTime")] string valueType) + { + string source = @$" + class MyClass + {{ + public string Property {{ get; set; }} + }} + + static class Provider + {{ + public static void Provide({listType} props, {valueType} value) + {{ + }} + }} + + partial class C + {{ + [LoggerMessage(0, LogLevel.Debug, ""Parameter"")] + static partial void M(ILogger logger, [/*0+*/TagProvider(typeof(Provider), nameof(Provider.Provide))/*-0*/] MyClass p1); + }}"; + + await RunGenerator(source, DiagDescriptors.TagProviderMethodInvalidSignature); + } + + [Theory] + [InlineData("private")] + [InlineData("")] + public async Task TagProviderMethodIsInaccessible(string methodModifier) + { + string source = @$" + class MyClass + {{ + public string Property {{ get; set; }} + }} + + static class Provider + {{ + {methodModifier} static void Provide(ITagCollector props, MyClass? value) + {{ + return 0; + }} + }} + + partial class C + {{ + [LoggerMessage(0, LogLevel.Debug, ""Parameter"")] + static partial void M(ILogger logger, [/*0+*/TagProvider(typeof(Provider), nameof(Provider.Provide))/*-0*/] MyClass p1); + }}"; + + await RunGenerator(source, DiagDescriptors.TagProviderMethodInaccessible); + } +} diff --git a/test/Generators/Microsoft.Gen.Logging/Unit/ParserTests.cs b/test/Generators/Microsoft.Gen.Logging/Unit/ParserTests.cs index 898abcb7849..549eb5e2127 100644 --- a/test/Generators/Microsoft.Gen.Logging/Unit/ParserTests.cs +++ b/test/Generators/Microsoft.Gen.Logging/Unit/ParserTests.cs @@ -18,6 +18,43 @@ namespace Microsoft.Gen.Logging.Test; public partial class ParserTests { + [Fact] + public async Task IncompatibleAttributes() + { + await RunGenerator(@$" + using Microsoft.Extensions.Compliance.Testing; + + class MyClass2 + {{ + public int A {{ get; set; }} + }} + + class MyClass + {{ + public string P0 {{ get; set; }} = ""Hello""; + + [PrivateData, LogProperties] + public MyClass2 /*0+*/P1/*-0*/ {{ get; set; }} = ""Hello""; + + [PrivateData, TagProvider(typeof(Provider), nameof(Provider.Provide)] + public string /*1+*/P2/*-1*/ {{ get; set; }} = ""Hello""; + }} + + static class Provider + {{ + public static void Provide(ITagCollector collector, string value) {{ }} + }} + + internal partial class C + {{ + [LoggerMessage(0, LogLevel.Debug, ""M0 {{p0}}"")] + partial static void M0(ILogger logger, [PrivateData, LogProperties] MyClass /*2+*/p0/*-2*/); + + [LoggerMessage(1, LogLevel.Debug, ""M1 {{p0}}"")] + partial static void M1(ILogger logger, [PrivateData, TagProvider(typeof(Provider), nameof(Provider.Provide))] string /*3+*/p0/*-3*/); + }}", DiagDescriptors.CantUseDataClassificationWithLogPropertiesOrTagProvider); + } + [Fact] public async Task NullableStructEnumerable() { diff --git a/test/Generators/Microsoft.Gen.Logging/Unit/SymbolLoaderTests.cs b/test/Generators/Microsoft.Gen.Logging/Unit/SymbolLoaderTests.cs index 4284b783aa2..13e3d7284c8 100644 --- a/test/Generators/Microsoft.Gen.Logging/Unit/SymbolLoaderTests.cs +++ b/test/Generators/Microsoft.Gen.Logging/Unit/SymbolLoaderTests.cs @@ -22,6 +22,7 @@ public class SymbolLoaderTests [InlineData(SymbolLoader.LogPropertiesAttribute)] [InlineData(SymbolLoader.ITagCollectorType)] [InlineData(SymbolLoader.LogPropertyIgnoreAttribute)] + [InlineData(SymbolLoader.TagProviderAttribute)] public void Loader_ReturnsNull_WhenTypeIsUnavailable(string type, bool callbackShouldBeCalled = false) { var compilationMock = new Mock( diff --git a/test/Libraries/Microsoft.Extensions.Telemetry.Abstractions.Tests/Logging/LogPropertiesAttributeTests.cs b/test/Libraries/Microsoft.Extensions.Telemetry.Abstractions.Tests/Logging/LogPropertiesAttributeTests.cs index 0b971528d2c..e2bd33e0406 100644 --- a/test/Libraries/Microsoft.Extensions.Telemetry.Abstractions.Tests/Logging/LogPropertiesAttributeTests.cs +++ b/test/Libraries/Microsoft.Extensions.Telemetry.Abstractions.Tests/Logging/LogPropertiesAttributeTests.cs @@ -1,7 +1,6 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System; using Xunit; namespace Microsoft.Extensions.Telemetry.Logging.Test; @@ -19,44 +18,12 @@ public void SkipNullProps() } [Fact] - public void OmitParameterName() + public void OmiReferenceName() { var lpa = new LogPropertiesAttribute(); - Assert.False(lpa.OmitParameterName); + Assert.False(lpa.OmitReferenceName); - lpa.OmitParameterName = true; - Assert.True(lpa.OmitParameterName); - } - - [Fact] - public void ShouldThrow_WhenCtorArgument_IsNull() - { - Assert.Throws(() => new LogPropertiesAttribute(null!, "test")); - Assert.Throws(() => new LogPropertiesAttribute(typeof(object), null!)); - } - - [Fact] - public void ShouldThrow_WhenMethodIsEmptyOrWhitespace() - { - Assert.Throws(() => new LogPropertiesAttribute(typeof(object), string.Empty)); - Assert.Throws(() => new LogPropertiesAttribute(typeof(object), new string(' ', 3))); - } - - [Fact] - public void ShouldSet_Properties_WhenCustomProvider() - { - const string ProviderMethod = "test_method"; - - var attr = new LogPropertiesAttribute(typeof(DateTime), ProviderMethod); - Assert.Equal(typeof(DateTime), attr.ProviderType); - Assert.Equal(ProviderMethod, attr.ProviderMethod); - } - - [Fact] - public void ShouldNotSet_Properties_WhenDefaultProvider() - { - var attr = new LogPropertiesAttribute(); - Assert.Null(attr.ProviderType); - Assert.Null(attr.ProviderMethod); + lpa.OmitReferenceName = true; + Assert.True(lpa.OmitReferenceName); } } diff --git a/test/Libraries/Microsoft.Extensions.Telemetry.Abstractions.Tests/Logging/TagProviderAttributeTests.cs b/test/Libraries/Microsoft.Extensions.Telemetry.Abstractions.Tests/Logging/TagProviderAttributeTests.cs new file mode 100644 index 00000000000..07d7925c896 --- /dev/null +++ b/test/Libraries/Microsoft.Extensions.Telemetry.Abstractions.Tests/Logging/TagProviderAttributeTests.cs @@ -0,0 +1,46 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System; +using Xunit; + +namespace Microsoft.Extensions.Telemetry.Logging.Test; + +public class TagProviderAttributeTests +{ + [Fact] + public void OmitReferenceName() + { + const string ProviderMethod = "test_method"; + + var attr = new TagProviderAttribute(typeof(DateTime), ProviderMethod); + Assert.False(attr.OmitReferenceName); + + attr.OmitReferenceName = true; + Assert.True(attr.OmitReferenceName); + } + + [Fact] + public void ShouldThrow_WhenCtorArgument_IsNull() + { + Assert.Throws(() => new TagProviderAttribute(null!, "test")); + Assert.Throws(() => new TagProviderAttribute(typeof(object), null!)); + } + + [Fact] + public void ShouldThrow_WhenMethodIsEmptyOrWhitespace() + { + Assert.Throws(() => new TagProviderAttribute(typeof(object), string.Empty)); + Assert.Throws(() => new TagProviderAttribute(typeof(object), new string(' ', 3))); + } + + [Fact] + public void ShouldSet_Properties_WhenCustomProvider() + { + const string ProviderMethod = "test_method"; + + var attr = new TagProviderAttribute(typeof(DateTime), ProviderMethod); + Assert.Equal(typeof(DateTime), attr.ProviderType); + Assert.Equal(ProviderMethod, attr.ProviderMethod); + } +} From d10b5494f94af0468f7602c4a18810bd60fb34a5 Mon Sep 17 00:00:00 2001 From: dotnet-maestro-bot Date: Wed, 6 Sep 2023 08:43:35 -0700 Subject: [PATCH 017/172] [automated] Merge branch 'release/8.0' => 'main' (#4359) * Update dependencies from https://github.com/dotnet/aspnetcore build 20230901.19 (#4347) Microsoft.AspNetCore.App.Runtime.win-x64 , Microsoft.AspNetCore.Mvc.Testing , Microsoft.AspNetCore.TestHost , Microsoft.Extensions.Caching.StackExchangeRedis , Microsoft.Extensions.Diagnostics.HealthChecks , Microsoft.Extensions.Diagnostics.HealthChecks.Abstractions , Microsoft.Extensions.Features , Microsoft.Extensions.Http.Polly , Microsoft.Extensions.ObjectPool From Version 8.0.0-rc.2.23431.20 -> To Version 8.0.0-rc.2.23451.19 Co-authored-by: dotnet-maestro[bot] * Update dependencies from https://github.com/dotnet/arcade build 20230901.1 (#4351) Microsoft.DotNet.Arcade.Sdk , Microsoft.DotNet.Helix.Sdk From Version 8.0.0-beta.23425.2 -> To Version 8.0.0-beta.23451.1 Co-authored-by: dotnet-maestro[bot] * Update dependencies from https://github.com/dotnet/aspnetcore build 20230903.2 (#4349) Microsoft.AspNetCore.App.Runtime.win-x64 , Microsoft.AspNetCore.Mvc.Testing , Microsoft.AspNetCore.TestHost , Microsoft.Extensions.Caching.StackExchangeRedis , Microsoft.Extensions.Diagnostics.HealthChecks , Microsoft.Extensions.Diagnostics.HealthChecks.Abstractions , Microsoft.Extensions.Features , Microsoft.Extensions.Http.Polly , Microsoft.Extensions.ObjectPool From Version 8.0.0-rc.2.23451.19 -> To Version 8.0.0-rc.2.23453.2 Co-authored-by: dotnet-maestro[bot] * Fix "DuplicateRequestName" error message missing requestName argument (#4358) Co-authored-by: Diogo Barbosa * Major update to the logging generator. (#4360) - Now has full support for modern data classifications, including combined data classifications (where two annotations apply to the same piece of state). - Fix some bugs around putting spurious @ in logging property names in certain cases. - Improved many error paths by eliminating cascading errors. You now tend to just get one clean error. - Simplify [LogProperties] and create the [TagProvider] attribute. Both features are orthogonal, they should never have been provided by a single attribute. - Dynamically adjust the name of the generated static variables in order to avoid conflicts with user-created symbols. - Harmonize transitive behavior. When you apply [LogProperties] on a parameter, it results in a one level deep iteration of the parameter's properties. If you want to go deeper, you need to apply [LogProperties] on each property you want to go deeper on. At any point, you can AtSymbolsTestExtensions apply [TagProvider] to invoke user-controlled code instead of using the automatic way. - Rename LogPropertiesAttribute.OmitParameterName to OmitReferenceName since the attribute can now be used on properties as well as parameters. - Fully support the LoggerMessageAttribute constructors. Prior logic was still based on the similar-but-different LogMethodAttribute and was therefore missing a few corner cases. Co-authored-by: Martin Taillefer --------- Co-authored-by: dotnet-maestro[bot] <42748379+dotnet-maestro[bot]@users.noreply.github.com> Co-authored-by: dotnet-maestro[bot] Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Diogo Barbosa Co-authored-by: Martin Taillefer --- eng/Version.Details.xml | 36 ++++++++++++++++++------------------ eng/Versions.props | 18 +++++++++--------- 2 files changed, 27 insertions(+), 27 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index b8c0d5cc609..706c1efbe32 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -128,41 +128,41 @@ https://github.com/dotnet/runtime 3c48925a6c1ab31865b4438a6cb88242d1a8fe4d - + https://github.com/dotnet/aspnetcore - 37a7008591e5139c4d810872b81830aa763cc608 + 7ac89ddffbda55d7e1a5710381356229f4582d9e - + https://github.com/dotnet/aspnetcore - 37a7008591e5139c4d810872b81830aa763cc608 + 7ac89ddffbda55d7e1a5710381356229f4582d9e - + https://github.com/dotnet/aspnetcore - 37a7008591e5139c4d810872b81830aa763cc608 + 7ac89ddffbda55d7e1a5710381356229f4582d9e - + https://github.com/dotnet/aspnetcore - 37a7008591e5139c4d810872b81830aa763cc608 + 7ac89ddffbda55d7e1a5710381356229f4582d9e - + https://github.com/dotnet/aspnetcore - 37a7008591e5139c4d810872b81830aa763cc608 + 7ac89ddffbda55d7e1a5710381356229f4582d9e - + https://github.com/dotnet/aspnetcore - 37a7008591e5139c4d810872b81830aa763cc608 + 7ac89ddffbda55d7e1a5710381356229f4582d9e - + https://github.com/dotnet/aspnetcore - 37a7008591e5139c4d810872b81830aa763cc608 + 7ac89ddffbda55d7e1a5710381356229f4582d9e - + https://github.com/dotnet/aspnetcore - 37a7008591e5139c4d810872b81830aa763cc608 + 7ac89ddffbda55d7e1a5710381356229f4582d9e - + https://github.com/dotnet/aspnetcore - 37a7008591e5139c4d810872b81830aa763cc608 + 7ac89ddffbda55d7e1a5710381356229f4582d9e diff --git a/eng/Versions.props b/eng/Versions.props index 5037387df87..947317f60db 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -60,15 +60,15 @@ 8.0.0-rc.2.23431.9 8.0.0-rc.2.23431.9 - 8.0.0-rc.2.23431.20 - 8.0.0-rc.2.23431.20 - 8.0.0-rc.2.23431.20 - 8.0.0-rc.2.23431.20 - 8.0.0-rc.2.23431.20 - 8.0.0-rc.2.23431.20 - 8.0.0-rc.2.23431.20 - 8.0.0-rc.2.23431.20 - 8.0.0-rc.2.23431.20 + 8.0.0-rc.2.23453.2 + 8.0.0-rc.2.23453.2 + 8.0.0-rc.2.23453.2 + 8.0.0-rc.2.23453.2 + 8.0.0-rc.2.23453.2 + 8.0.0-rc.2.23453.2 + 8.0.0-rc.2.23453.2 + 8.0.0-rc.2.23453.2 + 8.0.0-rc.2.23453.2 @@ -29,6 +31,12 @@ + + + + + + diff --git a/global.json b/global.json index b8243d53d90..846701bc949 100644 --- a/global.json +++ b/global.json @@ -1,9 +1,9 @@ { "sdk": { - "version": "8.0.100-rc.2.23462.28" + "version": "9.0.100-alpha.1.23464.17" }, "tools": { - "dotnet": "8.0.100-rc.2.23462.28", + "dotnet": "9.0.100-alpha.1.23464.17", "runtimes": { "dotnet/x64": [ "6.0.22" From 9c3be98a86237678b0e79dd1c47a61fd83894f8b Mon Sep 17 00:00:00 2001 From: Chris Ross Date: Tue, 26 Sep 2023 16:22:13 -0700 Subject: [PATCH 031/172] Update SDK to 9.0.100-alpha.1.23476.6 (#4474) --- global.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/global.json b/global.json index 846701bc949..01601871a5e 100644 --- a/global.json +++ b/global.json @@ -1,9 +1,9 @@ { "sdk": { - "version": "9.0.100-alpha.1.23464.17" + "version": "9.0.100-alpha.1.23476.6" }, "tools": { - "dotnet": "9.0.100-alpha.1.23464.17", + "dotnet": "9.0.100-alpha.1.23476.6", "runtimes": { "dotnet/x64": [ "6.0.22" From b07ccb013ffa729b27cd50f68cf2c478142a86b6 Mon Sep 17 00:00:00 2001 From: dotnet-maestro-bot Date: Wed, 27 Sep 2023 08:41:51 -0700 Subject: [PATCH 032/172] [automated] Merge branch 'release/8.0' => 'main' (#4480) * Http.Resilience does not depend on redaction anymore (#4470) * Do not depend on redaction anymore fixes * Update dependencies from https://github.com/dotnet/aspnetcore build 20230926.22 (#4478) Microsoft.AspNetCore.App.Runtime.win-x64 , Microsoft.AspNetCore.Mvc.Testing , Microsoft.AspNetCore.TestHost , Microsoft.Extensions.Caching.StackExchangeRedis , Microsoft.Extensions.Diagnostics.HealthChecks , Microsoft.Extensions.Diagnostics.HealthChecks.Abstractions , Microsoft.Extensions.Features , Microsoft.Extensions.Http.Polly , Microsoft.Extensions.ObjectPool From Version 8.0.0-rtm.23475.5 -> To Version 8.0.0-rtm.23476.22 Dependency coherency updates Microsoft.Bcl.TimeProvider,Microsoft.Extensions.Caching.Abstractions,Microsoft.Extensions.Caching.Memory,Microsoft.Extensions.Configuration.Abstractions,Microsoft.Extensions.Configuration.Binder,Microsoft.Extensions.Configuration.CommandLine,Microsoft.Extensions.Configuration.Json,Microsoft.Extensions.Configuration,Microsoft.Extensions.DependencyInjection.Abstractions,Microsoft.Extensions.DependencyInjection,Microsoft.Extensions.Hosting.Abstractions,Microsoft.Extensions.Hosting,Microsoft.Extensions.Http,Microsoft.Extensions.Logging.Abstractions,Microsoft.Extensions.Logging.Configuration,Microsoft.Extensions.Logging.Console,Microsoft.Extensions.Logging,Microsoft.Extensions.Options.ConfigurationExtensions,Microsoft.Extensions.Options.DataAnnotations,Microsoft.Extensions.Options,Microsoft.Extensions.Primitives,System.Collections.Immutable,System.Configuration.ConfigurationManager,System.Diagnostics.DiagnosticSource,System.Diagnostics.PerformanceCounter,System.IO.Hashing,System.Net.Http.Json,System.Security.Cryptography.Pkcs,System.Security.Cryptography.Xml,System.Text.Encodings.Web,System.Text.Json,System.Runtime.Caching From Version 8.0.0-rc.2.23464.16 -> To Version 8.0.0-rtm.23475.7 (parent: Microsoft.AspNetCore.App.Runtime.win-x64 Co-authored-by: dotnet-maestro[bot] Co-authored-by: Javier Calvarro Nelson * Rename `Endpoint` to `UriEndpoint` (#4476) * Rename Endpoint to UriEndpoint * Drop fault injection from resilience (#4475) * Drop fault injection from resilience * Update API baselines --------- Co-authored-by: martintmk <103487740+martintmk@users.noreply.github.com> Co-authored-by: dotnet-maestro[bot] <42748379+dotnet-maestro[bot]@users.noreply.github.com> Co-authored-by: dotnet-maestro[bot] Co-authored-by: Javier Calvarro Nelson --- .../FaultInjectionRequestBenchmarks.cs | 63 ---- .../HttpClientFactory.cs | 15 +- eng/Version.Details.xml | 166 ++++----- eng/Versions.props | 84 ++--- eng/packages/General.props | 4 - .../FaultInjection/ContextExtensions.cs | 50 --- .../HttpFaultInjectionOptionsBuilder.cs | 112 ------ ...enceFaultInjectionHttpBuilderExtensions.cs | 112 ------ ...ultInjectionServiceCollectionExtensions.cs | 104 ------ .../IHttpClientChaosPolicyFactory.cs | 23 -- .../FaultInjectionContextMessageHandler.cs | 37 -- .../FaultInjectionEventMeterTagNames.cs | 30 -- .../FaultInjectionTelemetryHandler.cs | 20 - ...onWeightAssignmentContextMessageHandler.cs | 39 -- .../Internal/HttpClientChaosPolicyFactory.cs | 141 ------- .../HttpClientFaultInjectionMetrics.cs | 23 -- .../Internal/HttpContentOptions.cs | 11 - .../Internal/HttpContentOptionsRegistry.cs | 29 -- .../Internal/IHttpContentOptionsRegistry.cs | 24 -- .../FaultInjection/Internal/Log.cs | 21 -- .../FaultInjection/Internal/Metric.cs | 17 - ...ienceHedgingHttpClientBuilderExtensions.cs | 7 +- .../HttpStandardHedgingResilienceOptions.cs | 3 +- ...StandardHedgingHandlerBuilderExtensions.cs | 8 +- ...icrosoft.Extensions.Http.Resilience.csproj | 4 - .../Microsoft.Extensions.Http.Resilience.json | 182 +++------ ...eHttpClientBuilderExtensions.Resilience.cs | 3 + ...HttpResiliencePipelineBuilderExtensions.cs | 8 +- ...dardResiliencePipelineBuilderExtensions.cs | 8 +- .../ByAuthorityPipelineKeyProvider.cs | 15 - .../Internal/PipelineKeyProviderHelper.cs | 8 +- .../OrderedGroupsRoutingStrategy.cs | 6 +- .../WeightedGroupsRoutingStrategy.cs | 8 +- .../Routing/OrderedGroupsRoutingOptions.cs | 2 +- .../Routing/{Endpoint.cs => UriEndpoint.cs} | 2 +- .../{EndpointGroup.cs => UriEndpointGroup.cs} | 6 +- .../Routing/WeightedGroupSelectionMode.cs | 4 +- .../Routing/WeightedGroupsRoutingOptions.cs | 2 +- ...htedEndpoint.cs => WeightedUriEndpoint.cs} | 2 +- ...ntGroup.cs => WeightedUriEndpointGroup.cs} | 4 +- .../FaultInjectionOptionsBuilder.cs | 139 ------- ...ultInjectionServiceCollectionExtensions.cs | 181 --------- .../FaultInjection/IChaosPolicyFactory.cs | 44 --- .../IFaultInjectionOptionsProvider.cs | 28 -- .../FaultInjection/InjectedFaultException.cs | 41 -- .../Internals/ChaosPolicyFactory.cs | 250 ------------- .../Internals/CustomResultRegistry.cs | 31 -- .../Internals/ExceptionRegistry.cs | 38 -- .../FaultInjectionEventMeterTagNames.cs | 25 -- .../Internals/FaultInjectionMetrics.cs | 23 -- .../FaultInjectionOptionsProvider.cs | 44 --- .../FaultInjectionOptionsValidator.cs | 66 ---- .../FaultInjectionTelemetryHandler.cs | 16 - .../Internals/ICustomResultRegistry.cs | 20 - .../Internals/IExceptionRegistry.cs | 24 -- .../FaultInjection/Internals/Log.cs | 19 - .../FaultInjection/Internals/Metric.cs | 17 - .../Internals/WeightAssignmentHelper.cs | 29 -- .../Options/ChaosPolicyOptionsBase.cs | 43 --- .../Options/ChaosPolicyOptionsGroup.cs | 48 --- .../Options/CustomResultPolicyOptions.cs | 28 -- .../Options/ExceptionPolicyOptions.cs | 25 -- .../FaultInjectionCustomResultOptions.cs | 9 - .../Options/FaultInjectionExceptionOptions.cs | 11 - .../Options/FaultInjectionOptions.cs | 19 - .../FaultPolicyWeightAssignmentsOptions.cs | 25 -- .../HttpResponseInjectionPolicyOptions.cs | 32 -- .../Options/LatencyPolicyOptions.cs | 25 -- .../Microsoft.Extensions.Resilience.csproj | 6 +- .../Microsoft.Extensions.Resilience.json | 254 ------------- .../ResilienceServiceCollectionExtensions.cs | 3 +- .../FaultInjection/ContextExtensionsTest.cs | 64 ---- .../HttpClientBuilderExtensionsTest.cs | 272 -------------- .../HttpClientFaultInjectionExtensionsTest.cs | 232 ------------ .../HttpFaultInjectionOptionsBuilderTest.cs | 172 --------- .../FaultInjectionTelemetryHandlerTests.cs | 79 ---- ...ightAssignmentContextMessageHandlerTest.cs | 83 ----- .../HttpClientChaosPolicyFactoryTest.cs | 187 ---------- .../HttpContentOptionsRegistryTest.cs | 56 --- .../Hedging/StandardHedgingTests.cs | 3 +- ...ClientBuilderExtensionsTests.BySelector.cs | 26 +- ...ClientBuilderExtensionsTests.Resilience.cs | 20 +- .../Routing/EndpointTests.cs | 2 +- .../Routing/OrderedRoutingStrategyTest.cs | 14 +- .../Routing/WeightedRoutingStrategyTest.cs | 20 +- .../FaultInjectionExtensionsTest.cs | 263 ------------- .../FaultInjectionOptionsBuilderTest.cs | 128 ------- .../InjectedFaultExceptionTests.cs | 41 -- .../Internals/ChaosPolicyFactoryTest.cs | 351 ------------------ .../Internals/CustomResultRegistryTest.cs | 42 --- .../Internals/ExceptionRegistryTest.cs | 54 --- .../FaultInjectionOptionsProviderTest.cs | 100 ----- .../FaultInjectionTelemetryHandlerTests.cs | 40 -- .../Internals/WeightAssignmentHelperTest.cs | 64 ---- .../Options/ChaosPolicyOptionsGroupTest.cs | 49 --- .../Options/CustomResultPolicyOptionTest.cs | 58 --- .../Options/ExceptionPolicyOptionTest.cs | 58 --- .../Options/FaultInjectionOptionsTest.cs | 29 -- .../HttpResponseInjectionPolicyOptionTest.cs | 59 --- .../Options/LatencyPolicyOptionTest.cs | 59 --- .../Options/OptionsValidationTests.cs | 157 -------- 101 files changed, 243 insertions(+), 5509 deletions(-) delete mode 100644 bench/Libraries/Microsoft.Extensions.Http.Resilience.PerformanceTests/FaultInjectionRequestBenchmarks.cs delete mode 100644 src/Libraries/Microsoft.Extensions.Http.Resilience/FaultInjection/ContextExtensions.cs delete mode 100644 src/Libraries/Microsoft.Extensions.Http.Resilience/FaultInjection/HttpFaultInjectionOptionsBuilder.cs delete mode 100644 src/Libraries/Microsoft.Extensions.Http.Resilience/FaultInjection/HttpResilienceFaultInjectionHttpBuilderExtensions.cs delete mode 100644 src/Libraries/Microsoft.Extensions.Http.Resilience/FaultInjection/HttpResilienceFaultInjectionServiceCollectionExtensions.cs delete mode 100644 src/Libraries/Microsoft.Extensions.Http.Resilience/FaultInjection/IHttpClientChaosPolicyFactory.cs delete mode 100644 src/Libraries/Microsoft.Extensions.Http.Resilience/FaultInjection/Internal/FaultInjectionContextMessageHandler.cs delete mode 100644 src/Libraries/Microsoft.Extensions.Http.Resilience/FaultInjection/Internal/FaultInjectionEventMeterTagNames.cs delete mode 100644 src/Libraries/Microsoft.Extensions.Http.Resilience/FaultInjection/Internal/FaultInjectionTelemetryHandler.cs delete mode 100644 src/Libraries/Microsoft.Extensions.Http.Resilience/FaultInjection/Internal/FaultInjectionWeightAssignmentContextMessageHandler.cs delete mode 100644 src/Libraries/Microsoft.Extensions.Http.Resilience/FaultInjection/Internal/HttpClientChaosPolicyFactory.cs delete mode 100644 src/Libraries/Microsoft.Extensions.Http.Resilience/FaultInjection/Internal/HttpClientFaultInjectionMetrics.cs delete mode 100644 src/Libraries/Microsoft.Extensions.Http.Resilience/FaultInjection/Internal/HttpContentOptions.cs delete mode 100644 src/Libraries/Microsoft.Extensions.Http.Resilience/FaultInjection/Internal/HttpContentOptionsRegistry.cs delete mode 100644 src/Libraries/Microsoft.Extensions.Http.Resilience/FaultInjection/Internal/IHttpContentOptionsRegistry.cs delete mode 100644 src/Libraries/Microsoft.Extensions.Http.Resilience/FaultInjection/Internal/Log.cs delete mode 100644 src/Libraries/Microsoft.Extensions.Http.Resilience/FaultInjection/Internal/Metric.cs rename src/Libraries/Microsoft.Extensions.Http.Resilience/Routing/{Endpoint.cs => UriEndpoint.cs} (96%) rename src/Libraries/Microsoft.Extensions.Http.Resilience/Routing/{EndpointGroup.cs => UriEndpointGroup.cs} (87%) rename src/Libraries/Microsoft.Extensions.Http.Resilience/Routing/{WeightedEndpoint.cs => WeightedUriEndpoint.cs} (96%) rename src/Libraries/Microsoft.Extensions.Http.Resilience/Routing/{WeightedEndpointGroup.cs => WeightedUriEndpointGroup.cs} (82%) delete mode 100644 src/Libraries/Microsoft.Extensions.Resilience/FaultInjection/FaultInjectionOptionsBuilder.cs delete mode 100644 src/Libraries/Microsoft.Extensions.Resilience/FaultInjection/FaultInjectionServiceCollectionExtensions.cs delete mode 100644 src/Libraries/Microsoft.Extensions.Resilience/FaultInjection/IChaosPolicyFactory.cs delete mode 100644 src/Libraries/Microsoft.Extensions.Resilience/FaultInjection/IFaultInjectionOptionsProvider.cs delete mode 100644 src/Libraries/Microsoft.Extensions.Resilience/FaultInjection/InjectedFaultException.cs delete mode 100644 src/Libraries/Microsoft.Extensions.Resilience/FaultInjection/Internals/ChaosPolicyFactory.cs delete mode 100644 src/Libraries/Microsoft.Extensions.Resilience/FaultInjection/Internals/CustomResultRegistry.cs delete mode 100644 src/Libraries/Microsoft.Extensions.Resilience/FaultInjection/Internals/ExceptionRegistry.cs delete mode 100644 src/Libraries/Microsoft.Extensions.Resilience/FaultInjection/Internals/FaultInjectionEventMeterTagNames.cs delete mode 100644 src/Libraries/Microsoft.Extensions.Resilience/FaultInjection/Internals/FaultInjectionMetrics.cs delete mode 100644 src/Libraries/Microsoft.Extensions.Resilience/FaultInjection/Internals/FaultInjectionOptionsProvider.cs delete mode 100644 src/Libraries/Microsoft.Extensions.Resilience/FaultInjection/Internals/FaultInjectionOptionsValidator.cs delete mode 100644 src/Libraries/Microsoft.Extensions.Resilience/FaultInjection/Internals/FaultInjectionTelemetryHandler.cs delete mode 100644 src/Libraries/Microsoft.Extensions.Resilience/FaultInjection/Internals/ICustomResultRegistry.cs delete mode 100644 src/Libraries/Microsoft.Extensions.Resilience/FaultInjection/Internals/IExceptionRegistry.cs delete mode 100644 src/Libraries/Microsoft.Extensions.Resilience/FaultInjection/Internals/Log.cs delete mode 100644 src/Libraries/Microsoft.Extensions.Resilience/FaultInjection/Internals/Metric.cs delete mode 100644 src/Libraries/Microsoft.Extensions.Resilience/FaultInjection/Internals/WeightAssignmentHelper.cs delete mode 100644 src/Libraries/Microsoft.Extensions.Resilience/FaultInjection/Options/ChaosPolicyOptionsBase.cs delete mode 100644 src/Libraries/Microsoft.Extensions.Resilience/FaultInjection/Options/ChaosPolicyOptionsGroup.cs delete mode 100644 src/Libraries/Microsoft.Extensions.Resilience/FaultInjection/Options/CustomResultPolicyOptions.cs delete mode 100644 src/Libraries/Microsoft.Extensions.Resilience/FaultInjection/Options/ExceptionPolicyOptions.cs delete mode 100644 src/Libraries/Microsoft.Extensions.Resilience/FaultInjection/Options/FaultInjectionCustomResultOptions.cs delete mode 100644 src/Libraries/Microsoft.Extensions.Resilience/FaultInjection/Options/FaultInjectionExceptionOptions.cs delete mode 100644 src/Libraries/Microsoft.Extensions.Resilience/FaultInjection/Options/FaultInjectionOptions.cs delete mode 100644 src/Libraries/Microsoft.Extensions.Resilience/FaultInjection/Options/FaultPolicyWeightAssignmentsOptions.cs delete mode 100644 src/Libraries/Microsoft.Extensions.Resilience/FaultInjection/Options/HttpResponseInjectionPolicyOptions.cs delete mode 100644 src/Libraries/Microsoft.Extensions.Resilience/FaultInjection/Options/LatencyPolicyOptions.cs delete mode 100644 test/Libraries/Microsoft.Extensions.Http.Resilience.Tests/FaultInjection/ContextExtensionsTest.cs delete mode 100644 test/Libraries/Microsoft.Extensions.Http.Resilience.Tests/FaultInjection/HttpClientBuilderExtensionsTest.cs delete mode 100644 test/Libraries/Microsoft.Extensions.Http.Resilience.Tests/FaultInjection/HttpClientFaultInjectionExtensionsTest.cs delete mode 100644 test/Libraries/Microsoft.Extensions.Http.Resilience.Tests/FaultInjection/HttpFaultInjectionOptionsBuilderTest.cs delete mode 100644 test/Libraries/Microsoft.Extensions.Http.Resilience.Tests/FaultInjection/Internal/FaultInjectionTelemetryHandlerTests.cs delete mode 100644 test/Libraries/Microsoft.Extensions.Http.Resilience.Tests/FaultInjection/Internal/FaultInjectionWeightAssignmentContextMessageHandlerTest.cs delete mode 100644 test/Libraries/Microsoft.Extensions.Http.Resilience.Tests/FaultInjection/Internal/HttpClientChaosPolicyFactoryTest.cs delete mode 100644 test/Libraries/Microsoft.Extensions.Http.Resilience.Tests/FaultInjection/Internal/HttpContentOptionsRegistryTest.cs delete mode 100644 test/Libraries/Microsoft.Extensions.Resilience.Tests/FaultInjection/FaultInjectionExtensionsTest.cs delete mode 100644 test/Libraries/Microsoft.Extensions.Resilience.Tests/FaultInjection/FaultInjectionOptionsBuilderTest.cs delete mode 100644 test/Libraries/Microsoft.Extensions.Resilience.Tests/FaultInjection/InjectedFaultExceptionTests.cs delete mode 100644 test/Libraries/Microsoft.Extensions.Resilience.Tests/FaultInjection/Internals/ChaosPolicyFactoryTest.cs delete mode 100644 test/Libraries/Microsoft.Extensions.Resilience.Tests/FaultInjection/Internals/CustomResultRegistryTest.cs delete mode 100644 test/Libraries/Microsoft.Extensions.Resilience.Tests/FaultInjection/Internals/ExceptionRegistryTest.cs delete mode 100644 test/Libraries/Microsoft.Extensions.Resilience.Tests/FaultInjection/Internals/FaultInjectionOptionsProviderTest.cs delete mode 100644 test/Libraries/Microsoft.Extensions.Resilience.Tests/FaultInjection/Internals/FaultInjectionTelemetryHandlerTests.cs delete mode 100644 test/Libraries/Microsoft.Extensions.Resilience.Tests/FaultInjection/Internals/WeightAssignmentHelperTest.cs delete mode 100644 test/Libraries/Microsoft.Extensions.Resilience.Tests/FaultInjection/Options/ChaosPolicyOptionsGroupTest.cs delete mode 100644 test/Libraries/Microsoft.Extensions.Resilience.Tests/FaultInjection/Options/CustomResultPolicyOptionTest.cs delete mode 100644 test/Libraries/Microsoft.Extensions.Resilience.Tests/FaultInjection/Options/ExceptionPolicyOptionTest.cs delete mode 100644 test/Libraries/Microsoft.Extensions.Resilience.Tests/FaultInjection/Options/FaultInjectionOptionsTest.cs delete mode 100644 test/Libraries/Microsoft.Extensions.Resilience.Tests/FaultInjection/Options/HttpResponseInjectionPolicyOptionTest.cs delete mode 100644 test/Libraries/Microsoft.Extensions.Resilience.Tests/FaultInjection/Options/LatencyPolicyOptionTest.cs delete mode 100644 test/Libraries/Microsoft.Extensions.Resilience.Tests/FaultInjection/Options/OptionsValidationTests.cs diff --git a/bench/Libraries/Microsoft.Extensions.Http.Resilience.PerformanceTests/FaultInjectionRequestBenchmarks.cs b/bench/Libraries/Microsoft.Extensions.Http.Resilience.PerformanceTests/FaultInjectionRequestBenchmarks.cs deleted file mode 100644 index 8f65d4f070d..00000000000 --- a/bench/Libraries/Microsoft.Extensions.Http.Resilience.PerformanceTests/FaultInjectionRequestBenchmarks.cs +++ /dev/null @@ -1,63 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -using System; -using System.Collections.Generic; -using System.Net.Http; -using System.Threading; -using System.Threading.Tasks; -using BenchmarkDotNet.Attributes; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Resilience.FaultInjection; - -namespace Microsoft.Extensions.Http.Resilience.FaultInjection.PerformanceTests; - -public class FaultInjectionRequestBenchmarks -{ - private const string HttpClientIdentifier = "HttpClientClass"; - private static readonly Uri _defaultUrl = new("https://www.google.ca/"); - private ServiceProvider _serviceProvider = null!; - private HttpClient _client = null!; - - [GlobalSetup] - public void GlobalSetup() - { - var services = new ServiceCollection(); - - if (SetupFaultInjection) - { - Action action = builder => - builder - .Configure(option => - { - option.ChaosPolicyOptionsGroups = new Dictionary(); - }); - - services.AddHttpClientFaultInjection(action); - } - - services.AddHttpClient(HttpClientIdentifier); - - _serviceProvider = services.BuildServiceProvider(); - var clientFactory = _serviceProvider.GetRequiredService(); - _client = clientFactory.CreateClient(HttpClientIdentifier); - } - - [GlobalCleanup] - public void GlobalCleanup() - { - _serviceProvider.Dispose(); - } - - [Params( - true, - false)] - public bool SetupFaultInjection { get; set; } - - [Benchmark] - public async Task SendAsync() - { - using var request = new HttpRequestMessage(HttpMethod.Get, _defaultUrl); - await _client.SendAsync(request, HttpCompletionOption.ResponseContentRead, CancellationToken.None).ConfigureAwait(false); - } -} diff --git a/bench/Libraries/Microsoft.Extensions.Http.Resilience.PerformanceTests/HttpClientFactory.cs b/bench/Libraries/Microsoft.Extensions.Http.Resilience.PerformanceTests/HttpClientFactory.cs index 3a1a60bac88..787fde93907 100644 --- a/bench/Libraries/Microsoft.Extensions.Http.Resilience.PerformanceTests/HttpClientFactory.cs +++ b/bench/Libraries/Microsoft.Extensions.Http.Resilience.PerformanceTests/HttpClientFactory.cs @@ -6,7 +6,6 @@ using System.Linq; using System.Threading; using Microsoft.Extensions.Compliance.Redaction; -using Microsoft.Extensions.Compliance.Testing; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection.Extensions; using Microsoft.Extensions.Logging; @@ -68,7 +67,7 @@ public static ServiceProvider InitializeServiceProvider(params HedgingClientType private static void AddHedging(this IServiceCollection services, HedgingClientType clientType) { var clientBuilder = services.AddHttpClient(clientType.ToString(), client => client.Timeout = Timeout.InfiniteTimeSpan); - var hedgingBuilder = clientBuilder.AddStandardHedgingHandler().SelectPipelineByAuthority(FakeClassifications.PublicData); + var hedgingBuilder = clientBuilder.AddStandardHedgingHandler().SelectPipelineByAuthority(); _ = clientBuilder.AddHttpMessageHandler(); if (clientType.HasFlag(HedgingClientType.NoRoutes)) @@ -84,15 +83,15 @@ private static void AddHedging(this IServiceCollection services, HedgingClientTy { options.Groups = Enumerable.Repeat(0, routes).Select(_ => { - return new EndpointGroup + return new UriEndpointGroup { Endpoints = new[] { - new WeightedEndpoint + new WeightedUriEndpoint { Uri = new Uri(PrimaryEndpoint) }, - new WeightedEndpoint + new WeightedUriEndpoint { Uri = new Uri(SecondaryEndpoint) } @@ -107,15 +106,15 @@ private static void AddHedging(this IServiceCollection services, HedgingClientTy { options.Groups = Enumerable.Repeat(0, routes).Select(_ => { - return new WeightedEndpointGroup + return new WeightedUriEndpointGroup { Endpoints = new[] { - new WeightedEndpoint + new WeightedUriEndpoint { Uri = new Uri(PrimaryEndpoint) }, - new WeightedEndpoint + new WeightedUriEndpoint { Uri = new Uri(SecondaryEndpoint) } diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 42b233e7ac7..6014f41a128 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,172 +1,172 @@ - + https://github.com/dotnet/runtime - 9cdbc87dadbf358206f20f17fed005cdcb253452 + a3d5300baee03169bf737cfc4e9b1f7dbece4d05 - + https://github.com/dotnet/runtime - 9cdbc87dadbf358206f20f17fed005cdcb253452 + a3d5300baee03169bf737cfc4e9b1f7dbece4d05 - + https://github.com/dotnet/runtime - 9cdbc87dadbf358206f20f17fed005cdcb253452 + a3d5300baee03169bf737cfc4e9b1f7dbece4d05 - + https://github.com/dotnet/runtime - 9cdbc87dadbf358206f20f17fed005cdcb253452 + a3d5300baee03169bf737cfc4e9b1f7dbece4d05 - + https://github.com/dotnet/runtime - 9cdbc87dadbf358206f20f17fed005cdcb253452 + a3d5300baee03169bf737cfc4e9b1f7dbece4d05 - + https://github.com/dotnet/runtime - 9cdbc87dadbf358206f20f17fed005cdcb253452 + a3d5300baee03169bf737cfc4e9b1f7dbece4d05 - + https://github.com/dotnet/runtime - 9cdbc87dadbf358206f20f17fed005cdcb253452 + a3d5300baee03169bf737cfc4e9b1f7dbece4d05 - + https://github.com/dotnet/runtime - 9cdbc87dadbf358206f20f17fed005cdcb253452 + a3d5300baee03169bf737cfc4e9b1f7dbece4d05 - + https://github.com/dotnet/runtime - 9cdbc87dadbf358206f20f17fed005cdcb253452 + a3d5300baee03169bf737cfc4e9b1f7dbece4d05 - + https://github.com/dotnet/runtime - 9cdbc87dadbf358206f20f17fed005cdcb253452 + a3d5300baee03169bf737cfc4e9b1f7dbece4d05 - + https://github.com/dotnet/runtime 9cdbc87dadbf358206f20f17fed005cdcb253452 - + https://github.com/dotnet/runtime - 9cdbc87dadbf358206f20f17fed005cdcb253452 + a3d5300baee03169bf737cfc4e9b1f7dbece4d05 - + https://github.com/dotnet/runtime - 9cdbc87dadbf358206f20f17fed005cdcb253452 + a3d5300baee03169bf737cfc4e9b1f7dbece4d05 - + https://github.com/dotnet/runtime - 9cdbc87dadbf358206f20f17fed005cdcb253452 + a3d5300baee03169bf737cfc4e9b1f7dbece4d05 - + https://github.com/dotnet/runtime - 9cdbc87dadbf358206f20f17fed005cdcb253452 + a3d5300baee03169bf737cfc4e9b1f7dbece4d05 - + https://github.com/dotnet/runtime - 9cdbc87dadbf358206f20f17fed005cdcb253452 + a3d5300baee03169bf737cfc4e9b1f7dbece4d05 - + https://github.com/dotnet/runtime - 9cdbc87dadbf358206f20f17fed005cdcb253452 + a3d5300baee03169bf737cfc4e9b1f7dbece4d05 - + https://github.com/dotnet/runtime - 9cdbc87dadbf358206f20f17fed005cdcb253452 + a3d5300baee03169bf737cfc4e9b1f7dbece4d05 - + https://github.com/dotnet/runtime - 9cdbc87dadbf358206f20f17fed005cdcb253452 + a3d5300baee03169bf737cfc4e9b1f7dbece4d05 - + https://github.com/dotnet/runtime - 9cdbc87dadbf358206f20f17fed005cdcb253452 + a3d5300baee03169bf737cfc4e9b1f7dbece4d05 - + https://github.com/dotnet/runtime - 9cdbc87dadbf358206f20f17fed005cdcb253452 + a3d5300baee03169bf737cfc4e9b1f7dbece4d05 - + https://github.com/dotnet/runtime - 9cdbc87dadbf358206f20f17fed005cdcb253452 + a3d5300baee03169bf737cfc4e9b1f7dbece4d05 - + https://github.com/dotnet/runtime - 9cdbc87dadbf358206f20f17fed005cdcb253452 + a3d5300baee03169bf737cfc4e9b1f7dbece4d05 - + https://github.com/dotnet/runtime - 9cdbc87dadbf358206f20f17fed005cdcb253452 + a3d5300baee03169bf737cfc4e9b1f7dbece4d05 - + https://github.com/dotnet/runtime - 9cdbc87dadbf358206f20f17fed005cdcb253452 + a3d5300baee03169bf737cfc4e9b1f7dbece4d05 - + https://github.com/dotnet/runtime - 9cdbc87dadbf358206f20f17fed005cdcb253452 + a3d5300baee03169bf737cfc4e9b1f7dbece4d05 - + https://github.com/dotnet/runtime - 9cdbc87dadbf358206f20f17fed005cdcb253452 + a3d5300baee03169bf737cfc4e9b1f7dbece4d05 - + https://github.com/dotnet/runtime - 9cdbc87dadbf358206f20f17fed005cdcb253452 + a3d5300baee03169bf737cfc4e9b1f7dbece4d05 - + https://github.com/dotnet/runtime - 9cdbc87dadbf358206f20f17fed005cdcb253452 + a3d5300baee03169bf737cfc4e9b1f7dbece4d05 - + https://github.com/dotnet/runtime - 9cdbc87dadbf358206f20f17fed005cdcb253452 + a3d5300baee03169bf737cfc4e9b1f7dbece4d05 - + https://github.com/dotnet/runtime - 9cdbc87dadbf358206f20f17fed005cdcb253452 + a3d5300baee03169bf737cfc4e9b1f7dbece4d05 - + https://github.com/dotnet/runtime - 9cdbc87dadbf358206f20f17fed005cdcb253452 + a3d5300baee03169bf737cfc4e9b1f7dbece4d05 - + https://github.com/dotnet/runtime - 9cdbc87dadbf358206f20f17fed005cdcb253452 + a3d5300baee03169bf737cfc4e9b1f7dbece4d05 - + https://github.com/dotnet/aspnetcore - 325a7569823645e43020a8c38771353c6f6eaddf + 4292763bd5143205daabb682311ee34f23897d9b - + https://github.com/dotnet/aspnetcore - 325a7569823645e43020a8c38771353c6f6eaddf + 4292763bd5143205daabb682311ee34f23897d9b - + https://github.com/dotnet/aspnetcore - 325a7569823645e43020a8c38771353c6f6eaddf + 4292763bd5143205daabb682311ee34f23897d9b - + https://github.com/dotnet/aspnetcore - 325a7569823645e43020a8c38771353c6f6eaddf + 4292763bd5143205daabb682311ee34f23897d9b - + https://github.com/dotnet/aspnetcore - 325a7569823645e43020a8c38771353c6f6eaddf + 4292763bd5143205daabb682311ee34f23897d9b - + https://github.com/dotnet/aspnetcore - 325a7569823645e43020a8c38771353c6f6eaddf + 4292763bd5143205daabb682311ee34f23897d9b - + https://github.com/dotnet/aspnetcore - 325a7569823645e43020a8c38771353c6f6eaddf + 4292763bd5143205daabb682311ee34f23897d9b - + https://github.com/dotnet/aspnetcore - 325a7569823645e43020a8c38771353c6f6eaddf + 4292763bd5143205daabb682311ee34f23897d9b - + https://github.com/dotnet/aspnetcore - 325a7569823645e43020a8c38771353c6f6eaddf + 4292763bd5143205daabb682311ee34f23897d9b diff --git a/eng/Versions.props b/eng/Versions.props index 8c91375d04b..dd390287ce9 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -27,49 +27,49 @@ --> - 8.0.0-rc.2.23464.16 - 8.0.0-rc.2.23464.16 - 8.0.0-rc.2.23464.16 - 8.0.0-rc.2.23464.16 - 8.0.0-rc.2.23464.16 - 8.0.0-rc.2.23464.16 - 8.0.0-rc.2.23464.16 - 8.0.0-rc.2.23464.16 - 8.0.0-rc.2.23464.16 - 8.0.0-rc.2.23464.16 - 8.0.0-rc.2.23464.16 - 8.0.0-rc.2.23464.16 - 8.0.0-rc.2.23464.16 - 8.0.0-rc.2.23464.16 - 8.0.0-rc.2.23464.16 - 8.0.0-rc.2.23464.16 - 8.0.0-rc.2.23464.16 - 8.0.0-rc.2.23464.16 - 8.0.0-rc.2.23464.16 - 8.0.0-rc.2.23464.16 - 8.0.0-rc.2.23464.16 - 8.0.0-rc.2.23464.16 - 8.0.0-rc.2.23464.16 - 8.0.0-rc.2.23464.16 - 8.0.0-rc.2.23464.16 - 8.0.0-rc.2.23464.16 - 8.0.0-rc.2.23464.16 - 8.0.0-rc.2.23464.16 - 8.0.0-rc.2.23464.16 - 8.0.0-rc.2.23464.16 - 8.0.0-rc.2.23464.16 - 8.0.0-rc.2.23464.16 - 8.0.0-rc.2.23464.16 + 8.0.0-rtm.23475.7 + 8.0.0-rtm.23475.7 + 8.0.0-rtm.23475.7 + 8.0.0-rtm.23475.7 + 8.0.0-rtm.23475.7 + 8.0.0-rtm.23475.7 + 8.0.0-rtm.23475.7 + 8.0.0-rtm.23475.7 + 8.0.0-rtm.23475.7 + 8.0.0-rtm.23475.7 + 8.0.0-rtm.23475.7 + 8.0.0-rtm.23475.7 + 8.0.0-rtm.23475.7 + 8.0.0-rtm.23475.7 + 8.0.0-rtm.23475.7 + 8.0.0-rtm.23475.7 + 8.0.0-rtm.23475.7 + 8.0.0-rtm.23475.7 + 8.0.0-rtm.23475.7 + 8.0.0-rtm.23475.7 + 8.0.0-rtm.23475.7 + 8.0.0-rtm.23475.7 + 8.0.0-rtm.23475.7 + 8.0.0-rtm.23475.7 + 8.0.0-rtm.23475.7 + 8.0.0-rtm.23475.7 + 8.0.0-rtm.23475.7 + 8.0.0-rtm.23475.7 + 8.0.0-rtm.23475.7 + 8.0.0-rtm.23475.7 + 8.0.0-rtm.23475.7 + 8.0.0-rtm.23475.7 + 8.0.0-rtm.23475.7 - 8.0.0-rtm.23475.5 - 8.0.0-rtm.23475.5 - 8.0.0-rtm.23475.5 - 8.0.0-rtm.23475.5 - 8.0.0-rtm.23475.5 - 8.0.0-rtm.23475.5 - 8.0.0-rtm.23475.5 - 8.0.0-rtm.23475.5 - 8.0.0-rtm.23475.5 + 8.0.0-rtm.23476.22 + 8.0.0-rtm.23476.22 + 8.0.0-rtm.23476.22 + 8.0.0-rtm.23476.22 + 8.0.0-rtm.23476.22 + 8.0.0-rtm.23476.22 + 8.0.0-rtm.23476.22 + 8.0.0-rtm.23476.22 + 8.0.0-rtm.23476.22 - 8.0.0-rtm.23475.7 - 8.0.0-rtm.23475.7 - 8.0.0-rtm.23475.7 - 8.0.0-rtm.23475.7 - 8.0.0-rtm.23475.7 - 8.0.0-rtm.23475.7 - 8.0.0-rtm.23475.7 - 8.0.0-rtm.23475.7 - 8.0.0-rtm.23475.7 - 8.0.0-rtm.23475.7 - 8.0.0-rtm.23475.7 - 8.0.0-rtm.23475.7 - 8.0.0-rtm.23475.7 - 8.0.0-rtm.23475.7 - 8.0.0-rtm.23475.7 - 8.0.0-rtm.23475.7 - 8.0.0-rtm.23475.7 - 8.0.0-rtm.23475.7 - 8.0.0-rtm.23475.7 - 8.0.0-rtm.23475.7 - 8.0.0-rtm.23475.7 - 8.0.0-rtm.23475.7 - 8.0.0-rtm.23475.7 - 8.0.0-rtm.23475.7 - 8.0.0-rtm.23475.7 - 8.0.0-rtm.23475.7 - 8.0.0-rtm.23475.7 - 8.0.0-rtm.23475.7 - 8.0.0-rtm.23475.7 - 8.0.0-rtm.23475.7 - 8.0.0-rtm.23475.7 - 8.0.0-rtm.23475.7 - 8.0.0-rtm.23475.7 + 8.0.0-rtm.23477.9 + 8.0.0-rtm.23477.9 + 8.0.0-rtm.23477.9 + 8.0.0-rtm.23477.9 + 8.0.0-rtm.23477.9 + 8.0.0-rtm.23477.9 + 8.0.0-rtm.23477.9 + 8.0.0-rtm.23477.9 + 8.0.0-rtm.23477.9 + 8.0.0-rtm.23477.9 + 8.0.0-rtm.23477.9 + 8.0.0-rtm.23477.9 + 8.0.0-rtm.23477.9 + 8.0.0-rtm.23477.9 + 8.0.0-rtm.23477.9 + 8.0.0-rtm.23477.9 + 8.0.0-rtm.23477.9 + 8.0.0-rtm.23477.9 + 8.0.0-rtm.23477.9 + 8.0.0-rtm.23477.9 + 8.0.0-rtm.23477.9 + 8.0.0-rtm.23477.9 + 8.0.0-rtm.23477.9 + 8.0.0-rtm.23477.9 + 8.0.0-rtm.23477.9 + 8.0.0-rtm.23477.9 + 8.0.0-rtm.23477.9 + 8.0.0-rtm.23477.9 + 8.0.0-rtm.23477.9 + 8.0.0-rtm.23477.9 + 8.0.0-rtm.23477.9 + 8.0.0-rtm.23477.9 + 8.0.0-rtm.23477.9 - 8.0.0-rtm.23476.22 - 8.0.0-rtm.23476.22 - 8.0.0-rtm.23476.22 - 8.0.0-rtm.23476.22 - 8.0.0-rtm.23476.22 - 8.0.0-rtm.23476.22 - 8.0.0-rtm.23476.22 - 8.0.0-rtm.23476.22 - 8.0.0-rtm.23476.22 + 8.0.0-rtm.23478.3 + 8.0.0-rtm.23478.3 + 8.0.0-rtm.23478.3 + 8.0.0-rtm.23478.3 + 8.0.0-rtm.23478.3 + 8.0.0-rtm.23478.3 + 8.0.0-rtm.23478.3 + 8.0.0-rtm.23478.3 + 8.0.0-rtm.23478.3 net - 8 + 9 0 $(TargetFrameworkMajorVersion).$(TargetFrameworkMinorVersion) @@ -13,10 +14,10 @@ $(TargetFrameworkName)$(TargetFrameworkVersion) $(LatestTargetFramework) - $(SupportedNetCoreTargetFrameworks);net6.0 + $(SupportedNetCoreTargetFrameworks);net8.0 - net6.0 + net8.0 diff --git a/Directory.Build.targets b/Directory.Build.targets index 7954433dfb6..2254bdbca57 100644 --- a/Directory.Build.targets +++ b/Directory.Build.targets @@ -8,6 +8,8 @@ + + $(MSBuildWarningsAsMessages);NETSDK1138;MSB3270 diff --git a/eng/Net9Workarounds.props b/eng/Net9Workarounds.props new file mode 100644 index 00000000000..676bad31897 --- /dev/null +++ b/eng/Net9Workarounds.props @@ -0,0 +1,7 @@ + + + + false + true + + \ No newline at end of file diff --git a/eng/Net9Workarounds.targets b/eng/Net9Workarounds.targets new file mode 100644 index 00000000000..c92595dd496 --- /dev/null +++ b/eng/Net9Workarounds.targets @@ -0,0 +1,67 @@ + + + + 99.9 + + true + + + + + + + + + + $(MicrosoftNETCoreAppRuntimewinx64Version) + $(MicrosoftNETCoreAppRefVersion) + + $(MicrosoftNETCoreAppRuntimeVersion) + + + + $(MicrosoftAspNetCoreAppRuntimewinx64Version) + $(MicrosoftAspNetCoreAppRefVersion) + + $(MicrosoftNETCoreAppRuntimeVersion) + + + + $(MicrosoftNETCoreAppRuntimewinx64Version) + + + + $(MicrosoftNETCoreAppRuntimewinx64Version) + + + + $(MicrosoftAspNetCoreAppRuntimewinx64Version) + + + + \ No newline at end of file diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index c2d004a607e..823ea7b6524 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,172 +1,188 @@ - + https://github.com/dotnet/runtime - 885100b00bc944cbb698bc4cc2ec3ec18007534f + 736dabeca728ccf8b911d96d1b4c575b4d0db7d2 - + https://github.com/dotnet/runtime - 885100b00bc944cbb698bc4cc2ec3ec18007534f + 736dabeca728ccf8b911d96d1b4c575b4d0db7d2 - + https://github.com/dotnet/runtime - 885100b00bc944cbb698bc4cc2ec3ec18007534f + 736dabeca728ccf8b911d96d1b4c575b4d0db7d2 - + https://github.com/dotnet/runtime - 885100b00bc944cbb698bc4cc2ec3ec18007534f + 736dabeca728ccf8b911d96d1b4c575b4d0db7d2 - + https://github.com/dotnet/runtime - 885100b00bc944cbb698bc4cc2ec3ec18007534f + 736dabeca728ccf8b911d96d1b4c575b4d0db7d2 - + https://github.com/dotnet/runtime - 885100b00bc944cbb698bc4cc2ec3ec18007534f + 736dabeca728ccf8b911d96d1b4c575b4d0db7d2 - + https://github.com/dotnet/runtime - 885100b00bc944cbb698bc4cc2ec3ec18007534f + 736dabeca728ccf8b911d96d1b4c575b4d0db7d2 - + https://github.com/dotnet/runtime - 885100b00bc944cbb698bc4cc2ec3ec18007534f + 736dabeca728ccf8b911d96d1b4c575b4d0db7d2 - + https://github.com/dotnet/runtime - 885100b00bc944cbb698bc4cc2ec3ec18007534f + 736dabeca728ccf8b911d96d1b4c575b4d0db7d2 - + https://github.com/dotnet/runtime - 885100b00bc944cbb698bc4cc2ec3ec18007534f + 736dabeca728ccf8b911d96d1b4c575b4d0db7d2 - + https://github.com/dotnet/runtime - 885100b00bc944cbb698bc4cc2ec3ec18007534f + 736dabeca728ccf8b911d96d1b4c575b4d0db7d2 - + https://github.com/dotnet/runtime - 885100b00bc944cbb698bc4cc2ec3ec18007534f + 736dabeca728ccf8b911d96d1b4c575b4d0db7d2 - + https://github.com/dotnet/runtime - 885100b00bc944cbb698bc4cc2ec3ec18007534f + 736dabeca728ccf8b911d96d1b4c575b4d0db7d2 - + https://github.com/dotnet/runtime - 885100b00bc944cbb698bc4cc2ec3ec18007534f + 736dabeca728ccf8b911d96d1b4c575b4d0db7d2 - + https://github.com/dotnet/runtime - 885100b00bc944cbb698bc4cc2ec3ec18007534f + 736dabeca728ccf8b911d96d1b4c575b4d0db7d2 - + https://github.com/dotnet/runtime - 885100b00bc944cbb698bc4cc2ec3ec18007534f + 736dabeca728ccf8b911d96d1b4c575b4d0db7d2 - + https://github.com/dotnet/runtime - 885100b00bc944cbb698bc4cc2ec3ec18007534f + 736dabeca728ccf8b911d96d1b4c575b4d0db7d2 - + https://github.com/dotnet/runtime - 885100b00bc944cbb698bc4cc2ec3ec18007534f + 736dabeca728ccf8b911d96d1b4c575b4d0db7d2 - + https://github.com/dotnet/runtime - 885100b00bc944cbb698bc4cc2ec3ec18007534f + 736dabeca728ccf8b911d96d1b4c575b4d0db7d2 - + https://github.com/dotnet/runtime - 885100b00bc944cbb698bc4cc2ec3ec18007534f + 736dabeca728ccf8b911d96d1b4c575b4d0db7d2 - + https://github.com/dotnet/runtime - 885100b00bc944cbb698bc4cc2ec3ec18007534f + 736dabeca728ccf8b911d96d1b4c575b4d0db7d2 - + https://github.com/dotnet/runtime - 885100b00bc944cbb698bc4cc2ec3ec18007534f + 736dabeca728ccf8b911d96d1b4c575b4d0db7d2 - + https://github.com/dotnet/runtime - 885100b00bc944cbb698bc4cc2ec3ec18007534f + 736dabeca728ccf8b911d96d1b4c575b4d0db7d2 - + + https://github.com/dotnet/runtime - 885100b00bc944cbb698bc4cc2ec3ec18007534f + 736dabeca728ccf8b911d96d1b4c575b4d0db7d2 - + https://github.com/dotnet/runtime - 885100b00bc944cbb698bc4cc2ec3ec18007534f + 736dabeca728ccf8b911d96d1b4c575b4d0db7d2 - + https://github.com/dotnet/runtime - 885100b00bc944cbb698bc4cc2ec3ec18007534f + 736dabeca728ccf8b911d96d1b4c575b4d0db7d2 - + https://github.com/dotnet/runtime - 885100b00bc944cbb698bc4cc2ec3ec18007534f + 736dabeca728ccf8b911d96d1b4c575b4d0db7d2 - + https://github.com/dotnet/runtime - 885100b00bc944cbb698bc4cc2ec3ec18007534f + 736dabeca728ccf8b911d96d1b4c575b4d0db7d2 - + https://github.com/dotnet/runtime - 885100b00bc944cbb698bc4cc2ec3ec18007534f + 736dabeca728ccf8b911d96d1b4c575b4d0db7d2 - + https://github.com/dotnet/runtime - 885100b00bc944cbb698bc4cc2ec3ec18007534f + 736dabeca728ccf8b911d96d1b4c575b4d0db7d2 - + https://github.com/dotnet/runtime - 885100b00bc944cbb698bc4cc2ec3ec18007534f + 736dabeca728ccf8b911d96d1b4c575b4d0db7d2 - + https://github.com/dotnet/runtime - 885100b00bc944cbb698bc4cc2ec3ec18007534f + 736dabeca728ccf8b911d96d1b4c575b4d0db7d2 - + https://github.com/dotnet/runtime - 885100b00bc944cbb698bc4cc2ec3ec18007534f + 736dabeca728ccf8b911d96d1b4c575b4d0db7d2 - + + https://github.com/dotnet/runtime + 736dabeca728ccf8b911d96d1b4c575b4d0db7d2 + + + https://github.com/dotnet/runtime + 736dabeca728ccf8b911d96d1b4c575b4d0db7d2 + + + https://github.com/dotnet/aspnetcore + 6f8b962b73cd7e252a76f1b562db61202effc310 + + https://github.com/dotnet/aspnetcore - 96b96df20c1d09ec5dc2a0831b6a39c33529c14a + 6f8b962b73cd7e252a76f1b562db61202effc310 - + https://github.com/dotnet/aspnetcore - 96b96df20c1d09ec5dc2a0831b6a39c33529c14a + 6f8b962b73cd7e252a76f1b562db61202effc310 - + https://github.com/dotnet/aspnetcore - 96b96df20c1d09ec5dc2a0831b6a39c33529c14a + 6f8b962b73cd7e252a76f1b562db61202effc310 - + https://github.com/dotnet/aspnetcore - 96b96df20c1d09ec5dc2a0831b6a39c33529c14a + 6f8b962b73cd7e252a76f1b562db61202effc310 - + https://github.com/dotnet/aspnetcore - 96b96df20c1d09ec5dc2a0831b6a39c33529c14a + 6f8b962b73cd7e252a76f1b562db61202effc310 - + https://github.com/dotnet/aspnetcore - 96b96df20c1d09ec5dc2a0831b6a39c33529c14a + 6f8b962b73cd7e252a76f1b562db61202effc310 - + https://github.com/dotnet/aspnetcore - 96b96df20c1d09ec5dc2a0831b6a39c33529c14a + 6f8b962b73cd7e252a76f1b562db61202effc310 - + https://github.com/dotnet/aspnetcore - 96b96df20c1d09ec5dc2a0831b6a39c33529c14a + 6f8b962b73cd7e252a76f1b562db61202effc310 - + https://github.com/dotnet/aspnetcore - 96b96df20c1d09ec5dc2a0831b6a39c33529c14a + 6f8b962b73cd7e252a76f1b562db61202effc310 diff --git a/eng/Versions.props b/eng/Versions.props index 76565aa7fcb..31c5a61407a 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -8,6 +8,7 @@ $(MajorVersion).$(MinorVersion).$(PatchVersion) true $(MajorVersion).$(MinorVersion).0.0 + true @@ -27,49 +28,52 @@ --> - 8.0.0-rtm.23477.9 - 8.0.0-rtm.23477.9 - 8.0.0-rtm.23477.9 - 8.0.0-rtm.23477.9 - 8.0.0-rtm.23477.9 - 8.0.0-rtm.23477.9 - 8.0.0-rtm.23477.9 - 8.0.0-rtm.23477.9 - 8.0.0-rtm.23477.9 - 8.0.0-rtm.23477.9 - 8.0.0-rtm.23477.9 - 8.0.0-rtm.23477.9 - 8.0.0-rtm.23477.9 - 8.0.0-rtm.23477.9 - 8.0.0-rtm.23477.9 - 8.0.0-rtm.23477.9 - 8.0.0-rtm.23477.9 - 8.0.0-rtm.23477.9 - 8.0.0-rtm.23477.9 - 8.0.0-rtm.23477.9 - 8.0.0-rtm.23477.9 - 8.0.0-rtm.23477.9 - 8.0.0-rtm.23477.9 - 8.0.0-rtm.23477.9 - 8.0.0-rtm.23477.9 - 8.0.0-rtm.23477.9 - 8.0.0-rtm.23477.9 - 8.0.0-rtm.23477.9 - 8.0.0-rtm.23477.9 - 8.0.0-rtm.23477.9 - 8.0.0-rtm.23477.9 - 8.0.0-rtm.23477.9 - 8.0.0-rtm.23477.9 + 9.0.0-alpha.1.23470.17 + 9.0.0-alpha.1.23470.17 + 9.0.0-alpha.1.23470.17 + 9.0.0-alpha.1.23470.17 + 9.0.0-alpha.1.23470.17 + 9.0.0-alpha.1.23470.17 + 9.0.0-alpha.1.23470.17 + 9.0.0-alpha.1.23470.17 + 9.0.0-alpha.1.23470.17 + 9.0.0-alpha.1.23470.17 + 9.0.0-alpha.1.23470.17 + 9.0.0-alpha.1.23470.17 + 9.0.0-alpha.1.23470.17 + 9.0.0-alpha.1.23470.17 + 9.0.0-alpha.1.23470.17 + 9.0.0-alpha.1.23470.17 + 9.0.0-alpha.1.23470.17 + 9.0.0-alpha.1.23470.17 + 9.0.0-alpha.1.23470.17 + 9.0.0-alpha.1.23470.17 + 9.0.0-alpha.1.23470.17 + 9.0.0-alpha.1.23470.17 + 9.0.0-alpha.1.23470.17 + 9.0.0-alpha.1.23470.17 + 9.0.0-alpha.1.23470.17 + 9.0.0-alpha.1.23470.17 + 9.0.0-alpha.1.23470.17 + 9.0.0-alpha.1.23470.17 + 9.0.0-alpha.1.23470.17 + 9.0.0-alpha.1.23470.17 + 9.0.0-alpha.1.23470.17 + 9.0.0-alpha.1.23470.17 + 9.0.0-alpha.1.23470.17 + 9.0.0-alpha.1.23470.17 + 9.0.0-alpha.1.23470.17 - 8.0.0-rtm.23478.18 - 8.0.0-rtm.23478.18 - 8.0.0-rtm.23478.18 - 8.0.0-rtm.23478.18 - 8.0.0-rtm.23478.18 - 8.0.0-rtm.23478.18 - 8.0.0-rtm.23478.18 - 8.0.0-rtm.23478.18 - 8.0.0-rtm.23478.18 + 9.0.0-alpha.1.23476.39 + 9.0.0-alpha.1.23476.39 + 9.0.0-alpha.1.23476.39 + 9.0.0-alpha.1.23476.39 + 9.0.0-alpha.1.23476.39 + 9.0.0-alpha.1.23476.39 + 9.0.0-alpha.1.23476.39 + 9.0.0-alpha.1.23476.39 + 9.0.0-alpha.1.23476.39 + 9.0.0-alpha.1.23476.39 + + $(MicrosoftNETCoreAppRuntimewinx64Version) diff --git a/eng/packages/TestOnly.props b/eng/packages/TestOnly.props index b36c628403e..0a8f977ec71 100644 --- a/eng/packages/TestOnly.props +++ b/eng/packages/TestOnly.props @@ -30,6 +30,11 @@ + + + + + diff --git a/global.json b/global.json index 01601871a5e..9f09a4947eb 100644 --- a/global.json +++ b/global.json @@ -6,10 +6,12 @@ "dotnet": "9.0.100-alpha.1.23476.6", "runtimes": { "dotnet/x64": [ - "6.0.22" + "8.0.0-rtm.23475.7", + "$(MicrosoftNETCoreAppRuntimewinx64Version)" ], "aspnetcore/x64": [ - "6.0.22" + "8.0.0-rtm.23475.5", + "$(MicrosoftAspNetCoreAppRuntimewinx64Version)" ] } }, diff --git a/test/Libraries/Microsoft.AspNetCore.AsyncState.Tests/Microsoft.AspNetCore.AsyncState.Tests.csproj b/test/Libraries/Microsoft.AspNetCore.AsyncState.Tests/Microsoft.AspNetCore.AsyncState.Tests.csproj index 68654cb2b72..8a7574d6ae3 100644 --- a/test/Libraries/Microsoft.AspNetCore.AsyncState.Tests/Microsoft.AspNetCore.AsyncState.Tests.csproj +++ b/test/Libraries/Microsoft.AspNetCore.AsyncState.Tests/Microsoft.AspNetCore.AsyncState.Tests.csproj @@ -1,4 +1,4 @@ - + Microsoft.AspNetCore.AsyncState.Test Unit tests for Microsoft.AspNetCore.AsyncState. @@ -6,8 +6,6 @@ $(TestNetCoreTargetFrameworks) - - true From a7fc9e6d3c720bdab36868e884d5f33fb4ca142f Mon Sep 17 00:00:00 2001 From: Brennan Date: Mon, 2 Oct 2023 12:19:14 -0700 Subject: [PATCH 036/172] Update SDK version (#4499) --- global.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/global.json b/global.json index 9f09a4947eb..f18b7215123 100644 --- a/global.json +++ b/global.json @@ -1,9 +1,9 @@ { "sdk": { - "version": "9.0.100-alpha.1.23476.6" + "version": "9.0.100-alpha.1.23479.5" }, "tools": { - "dotnet": "9.0.100-alpha.1.23476.6", + "dotnet": "9.0.100-alpha.1.23479.5", "runtimes": { "dotnet/x64": [ "8.0.0-rtm.23475.7", From ab869c6d839be079f9ad21c0d2c744861f4c4149 Mon Sep 17 00:00:00 2001 From: Jose Perez Rodriguez Date: Mon, 2 Oct 2023 14:14:15 -0700 Subject: [PATCH 037/172] Removing the XXHash3Redactor (#4473) * Removing the XXHash3Redactor * Addressing Feedback --- .spelling | 1 - eng/MSBuild/LegacySupport.props | 4 - eng/MSBuild/LegacySupport.targets | 4 - src/LegacySupport/xxH3/README.md | 7 - src/LegacySupport/xxH3/XxHash3.cs | 1069 ----------------- src/LegacySupport/xxH3/XxHash32.State.cs | 18 - src/LegacySupport/xxH3/XxHash64.State.cs | 31 - ...osoft.Extensions.Compliance.Redaction.json | 30 - .../RedactionBuilderExtensions.cs | 66 - .../XXHash3Redactor.cs | 84 -- .../XXHash3RedactorOptions.cs | 23 - ...icrosoft.Extensions.Http.Resilience.csproj | 1 - .../XXHash3RedactorExtensionsTests.cs | 84 -- .../XXHash3RedactorTests.cs | 69 -- 14 files changed, 1491 deletions(-) delete mode 100644 src/LegacySupport/xxH3/README.md delete mode 100644 src/LegacySupport/xxH3/XxHash3.cs delete mode 100644 src/LegacySupport/xxH3/XxHash32.State.cs delete mode 100644 src/LegacySupport/xxH3/XxHash64.State.cs delete mode 100644 src/Libraries/Microsoft.Extensions.Compliance.Redaction/RedactionBuilderExtensions.cs delete mode 100644 src/Libraries/Microsoft.Extensions.Compliance.Redaction/XXHash3Redactor.cs delete mode 100644 src/Libraries/Microsoft.Extensions.Compliance.Redaction/XXHash3RedactorOptions.cs delete mode 100644 test/Libraries/Microsoft.Extensions.Compliance.Redaction.Tests/XXHash3RedactorExtensionsTests.cs delete mode 100644 test/Libraries/Microsoft.Extensions.Compliance.Redaction.Tests/XXHash3RedactorTests.cs diff --git a/.spelling b/.spelling index d5fcb2b611f..be8e3729252 100644 --- a/.spelling +++ b/.spelling @@ -368,5 +368,4 @@ Workstream Workstreams xmls xUnit -xxHash Zipkin diff --git a/eng/MSBuild/LegacySupport.props b/eng/MSBuild/LegacySupport.props index c2ac5942396..11e7aa6c0f5 100644 --- a/eng/MSBuild/LegacySupport.props +++ b/eng/MSBuild/LegacySupport.props @@ -47,10 +47,6 @@ - - - - diff --git a/eng/MSBuild/LegacySupport.targets b/eng/MSBuild/LegacySupport.targets index b585332dc59..8c119d5413b 100644 --- a/eng/MSBuild/LegacySupport.targets +++ b/eng/MSBuild/LegacySupport.targets @@ -1,6 +1,2 @@ - - true - true - diff --git a/src/LegacySupport/xxH3/README.md b/src/LegacySupport/xxH3/README.md deleted file mode 100644 index 285163aa439..00000000000 --- a/src/LegacySupport/xxH3/README.md +++ /dev/null @@ -1,7 +0,0 @@ -To use this source in your project, add the following to your `.csproj` file: - -```xml - - true - -``` diff --git a/src/LegacySupport/xxH3/XxHash3.cs b/src/LegacySupport/xxH3/XxHash3.cs deleted file mode 100644 index 90a86367fc3..00000000000 --- a/src/LegacySupport/xxH3/XxHash3.cs +++ /dev/null @@ -1,1069 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -#pragma warning disable CS3021 -#pragma warning disable S109 -#pragma warning disable SA1513 -#pragma warning disable SA1005 -#pragma warning disable S2148 -#pragma warning disable SA1405 -#pragma warning disable SA1519 -#pragma warning disable S907 -#pragma warning disable S1199 -#pragma warning disable IDE0055 -#pragma warning disable SA1407 -#pragma warning disable S103 -#pragma warning disable SA1623 -#pragma warning disable SA1128 -#pragma warning disable SA1629 -#pragma warning disable SA1131 -#pragma warning disable SA1106 -#pragma warning disable S2333 -#pragma warning disable SA1202 -#pragma warning disable S1135 -#pragma warning disable S2156 -#pragma warning disable R9A015 - -// Based on the XXH3 implementation from https://github.com/Cyan4973/xxHash. - -using System.Buffers.Binary; -using System.Diagnostics; -using System.Numerics; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -#if NET7_0_OR_GREATER -using System.Runtime.Intrinsics; -using System.Runtime.Intrinsics.Arm; -using System.Runtime.Intrinsics.X86; -#endif - -namespace System.IO.Hashing -{ - /// Provides an implementation of the XXH3 hash algorithm. - /// - /// For methods that persist the computed numerical hash value as bytes, - /// the value is written in the Big Endian byte order. - /// -#if NET5_0_OR_GREATER - [SkipLocalsInit] -#endif - [System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] - internal sealed unsafe partial class XxHash3 - { - /// XXH3 produces 8-byte hashes. - private const int StripeLengthBytes = 64; - private const int SecretLengthBytes = 192; - private const int SecretLastAccStartBytes = 7; - private const int SecretConsumeRateBytes = 8; - private const int AccumulatorCount = StripeLengthBytes / sizeof(ulong); - private const int MidSizeMaxBytes = 240; - - /// The default secret for when no seed is provided. - /// This is the same as a custom secret derived from a seed of 0. - private static ReadOnlySpan DefaultSecret => new byte[] - { - 0xb8, 0xfe, 0x6c, 0x39, 0x23, 0xa4, 0x4b, 0xbe, 0x7c, 0x01, 0x81, 0x2c, 0xf7, 0x21, 0xad, 0x1c, - 0xde, 0xd4, 0x6d, 0xe9, 0x83, 0x90, 0x97, 0xdb, 0x72, 0x40, 0xa4, 0xa4, 0xb7, 0xb3, 0x67, 0x1f, - 0xcb, 0x79, 0xe6, 0x4e, 0xcc, 0xc0, 0xe5, 0x78, 0x82, 0x5a, 0xd0, 0x7d, 0xcc, 0xff, 0x72, 0x21, - 0xb8, 0x08, 0x46, 0x74, 0xf7, 0x43, 0x24, 0x8e, 0xe0, 0x35, 0x90, 0xe6, 0x81, 0x3a, 0x26, 0x4c, - 0x3c, 0x28, 0x52, 0xbb, 0x91, 0xc3, 0x00, 0xcb, 0x88, 0xd0, 0x65, 0x8b, 0x1b, 0x53, 0x2e, 0xa3, - 0x71, 0x64, 0x48, 0x97, 0xa2, 0x0d, 0xf9, 0x4e, 0x38, 0x19, 0xef, 0x46, 0xa9, 0xde, 0xac, 0xd8, - 0xa8, 0xfa, 0x76, 0x3f, 0xe3, 0x9c, 0x34, 0x3f, 0xf9, 0xdc, 0xbb, 0xc7, 0xc7, 0x0b, 0x4f, 0x1d, - 0x8a, 0x51, 0xe0, 0x4b, 0xcd, 0xb4, 0x59, 0x31, 0xc8, 0x9f, 0x7e, 0xc9, 0xd9, 0x78, 0x73, 0x64, - 0xea, 0xc5, 0xac, 0x83, 0x34, 0xd3, 0xeb, 0xc3, 0xc5, 0x81, 0xa0, 0xff, 0xfa, 0x13, 0x63, 0xeb, - 0x17, 0x0d, 0xdd, 0x51, 0xb7, 0xf0, 0xda, 0x49, 0xd3, 0x16, 0x55, 0x26, 0x29, 0xd4, 0x68, 0x9e, - 0x2b, 0x16, 0xbe, 0x58, 0x7d, 0x47, 0xa1, 0xfc, 0x8f, 0xf8, 0xb8, 0xd1, 0x7a, 0xd0, 0x31, 0xce, - 0x45, 0xcb, 0x3a, 0x8f, 0x95, 0x16, 0x04, 0x28, 0xaf, 0xd7, 0xfb, 0xca, 0xbb, 0x4b, 0x40, 0x7e, - }; - -#if DEBUG - static XxHash3() - { - // Make sure DefaultSecret is the custom secret derived from a seed of 0. - byte* secret = stackalloc byte[SecretLengthBytes]; - DeriveSecretFromSeed(secret, 0); - Debug.Assert(new Span(secret, SecretLengthBytes).SequenceEqual(DefaultSecret)); - } -#endif - -#if false - private State _state; - - /// Initializes a new instance of the class using the default seed value 0. - public XxHash3() : this(0) - { - } - - /// Initializes a new instance of the class using the specified seed. - public XxHash3(long seed) - { - _state.Seed = (ulong)seed; - - fixed (byte* secret = _state.Secret) - { - if (seed == 0) - { - DefaultSecret.CopyTo(new Span(secret, SecretLengthBytes)); - } - else - { - DeriveSecretFromSeed(secret, (ulong)seed); - } - } - - Reset(); - } - - /// Computes the XXH3 hash of the provided data. - /// The data to hash. - /// The XXH3 64-bit hash code of the provided data. - /// is . - public static byte[] Hash(byte[] source) => Hash(source, seed: 0); - - /// Computes the XXH3 hash of the provided data using the provided seed. - /// The data to hash. - /// The seed value for this hash computation. - /// The XXH3 64-bit hash code of the provided data. - /// is . - public static byte[] Hash(byte[] source, long seed) - { -#if NET6_0_OR_GREATER - ArgumentNullException.ThrowIfNull(source); -#else - if (source is null) - { - throw new ArgumentNullException(nameof(source)); - } -#endif - - return Hash(new ReadOnlySpan(source), seed); - } - - /// Computes the XXH3 hash of the provided data using the optionally provided . - /// The data to hash. - /// The seed value for this hash computation. The default is zero. - /// The XXH3 64-bit hash code of the provided data. - public static byte[] Hash(ReadOnlySpan source, long seed = 0) - { - byte[] result = new byte[HashLengthInBytes]; - ulong hash = HashToUInt64(source, seed); - BinaryPrimitives.WriteUInt64BigEndian(result, hash); - return result; - } - - /// Computes the XXH3 hash of the provided data into the provided using the optionally provided . - /// The data to hash. - /// The buffer that receives the computed 64-bit hash code. - /// The seed value for this hash computation. The default is zero. - /// The number of bytes written to . - /// is shorter than (8 bytes). - public static int Hash(ReadOnlySpan source, Span destination, long seed = 0) - { - if (!TryHash(source, destination, out int bytesWritten, seed)) - { - throw new InvalidOperationException(); - } - - return bytesWritten; - } - - /// Attempts to compute the XXH3 hash of the provided data into the provided using the optionally provided . - /// The data to hash. - /// The buffer that receives the computed 64-bit hash code. - /// When this method returns, contains the number of bytes written to . - /// The seed value for this hash computation. The default is zero. - /// if is long enough to receive the computed hash value (8 bytes); otherwise, . - public static bool TryHash(ReadOnlySpan source, Span destination, out int bytesWritten, long seed = 0) - { - if (destination.Length >= sizeof(long)) - { - ulong hash = HashToUInt64(source, seed); - - if (BitConverter.IsLittleEndian) - { - hash = BinaryPrimitives.ReverseEndianness(hash); - } - Unsafe.WriteUnaligned(ref MemoryMarshal.GetReference(destination), hash); - - bytesWritten = HashLengthInBytes; - return true; - } - - bytesWritten = 0; - return false; - } -#endif - - /// Computes the XXH3 hash of the provided data. - /// The data to hash. - /// The seed value for this hash computation. - /// The computed XXH3 hash. - [CLSCompliant(false)] - public static ulong HashToUInt64(ReadOnlySpan source, long seed = 0) - { - uint length = (uint)source.Length; - fixed (byte* sourcePtr = &MemoryMarshal.GetReference(source)) - { - if (length <= 16) - { - return HashLength0To16(sourcePtr, length, (ulong)seed); - } - - if (length <= 128) - { - return HashLength17To128(sourcePtr, length, (ulong)seed); - } - - if (length <= MidSizeMaxBytes) - { - return HashLength129To240(sourcePtr, length, (ulong)seed); - } - - return HashLengthOver240(sourcePtr, length, (ulong)seed); - } - } - -#if false - /// Resets the hash computation to the initial state. - public void Reset() - { - _state.BufferedCount = 0; - _state.StripesProcessedInCurrentBlock = 0; - _state.TotalLength = 0; - - fixed (ulong* accumulators = _state.Accumulators) - { - InitializeAccumulators(accumulators); - } - } - - /// Appends the contents of to the data already processed for the current hash computation. - /// The data to process. - public void Append(ReadOnlySpan source) - { - Debug.Assert(_state.BufferedCount <= InternalBufferLengthBytes); - - _state.TotalLength += (uint)source.Length; - - fixed (byte* buffer = _state.Buffer) - { - // Small input: just copy the data to the buffer. - if (source.Length <= InternalBufferLengthBytes - _state.BufferedCount) - { - source.CopyTo(new Span(buffer + _state.BufferedCount, source.Length)); - _state.BufferedCount += (uint)source.Length; - return; - } - - fixed (byte* secret = _state.Secret) - fixed (ulong* accumulators = _state.Accumulators) - fixed (byte* sourcePtr = &MemoryMarshal.GetReference(source)) - { - // Internal buffer is partially filled (always, except at beginning). Complete it, then consume it. - int sourceIndex = 0; - if (_state.BufferedCount != 0) - { - int loadSize = InternalBufferLengthBytes - (int)_state.BufferedCount; - - source.Slice(0, loadSize).CopyTo(new Span(buffer + _state.BufferedCount, loadSize)); - sourceIndex = loadSize; - - ConsumeStripes(accumulators, ref _state.StripesProcessedInCurrentBlock, NumStripesPerBlock, buffer, InternalBufferStripes, secret); - _state.BufferedCount = 0; - } - Debug.Assert(sourceIndex < source.Length); - - // Large input to consume: ingest per full block. - if (source.Length - sourceIndex > NumStripesPerBlock * StripeLengthBytes) - { - ulong stripes = (ulong)(source.Length - sourceIndex - 1) / StripeLengthBytes; - Debug.Assert(NumStripesPerBlock >= _state.StripesProcessedInCurrentBlock); - - // Join to current block's end. - ulong stripesToEnd = NumStripesPerBlock - _state.StripesProcessedInCurrentBlock; - Debug.Assert(stripesToEnd <= stripes); - Accumulate(accumulators, sourcePtr + sourceIndex, secret + ((int)_state.StripesProcessedInCurrentBlock * SecretConsumeRateBytes), (int)stripesToEnd); - ScrambleAccumulators(accumulators, secret + (SecretLengthBytes - StripeLengthBytes)); - _state.StripesProcessedInCurrentBlock = 0; - sourceIndex += (int)stripesToEnd * StripeLengthBytes; - stripes -= stripesToEnd; - - // Consume entire blocks. - while (stripes >= NumStripesPerBlock) - { - Accumulate(accumulators, sourcePtr + sourceIndex, secret, NumStripesPerBlock); - ScrambleAccumulators(accumulators, secret + (SecretLengthBytes - StripeLengthBytes)); - sourceIndex += NumStripesPerBlock * StripeLengthBytes; - stripes -= NumStripesPerBlock; - } - - // Consume complete stripes in the last partial block. - Accumulate(accumulators, sourcePtr + sourceIndex, secret, (int)stripes); - sourceIndex += (int)stripes * StripeLengthBytes; - Debug.Assert(sourceIndex < source.Length); // at least some bytes left - _state.StripesProcessedInCurrentBlock = stripes; - - // Copy the last stripe into the end of the buffer so it is available to GetCurrentHashCore when processing the "stripe from the end". - source.Slice(sourceIndex - StripeLengthBytes, StripeLengthBytes).CopyTo(new Span(buffer + InternalBufferLengthBytes - StripeLengthBytes, StripeLengthBytes)); - } - else if (source.Length - sourceIndex > InternalBufferLengthBytes) - { - // Content to consume <= block size. Consume source by a multiple of internal buffer size. - do - { - ConsumeStripes(accumulators, ref _state.StripesProcessedInCurrentBlock, NumStripesPerBlock, sourcePtr + sourceIndex, InternalBufferStripes, secret); - sourceIndex += InternalBufferLengthBytes; - } - while (source.Length - sourceIndex > InternalBufferLengthBytes); - - // Copy the last stripe into the end of the buffer so it is available to GetCurrentHashCore when processing the "stripe from the end". - source.Slice(sourceIndex - StripeLengthBytes, StripeLengthBytes).CopyTo(new Span(buffer + InternalBufferLengthBytes - StripeLengthBytes, StripeLengthBytes)); - } - - // Buffer the remaining input. - Span remaining = new Span(buffer, source.Length - sourceIndex); - Debug.Assert(sourceIndex < source.Length); - Debug.Assert(remaining.Length <= InternalBufferLengthBytes); - source.Slice(sourceIndex).CopyTo(remaining); - _state.BufferedCount = (uint)remaining.Length; - } - } - } - - /// Gets the current computed hash value without modifying accumulated state. - /// The hash value for the data already provided. - [CLSCompliant(false)] - public ulong GetCurrentHashAsUInt64() - { - ulong current; - - if (_state.TotalLength > MidSizeMaxBytes) - { - // Digest on a local copy to ensure the accumulators remain unaltered. - ulong* accumulators = stackalloc ulong[AccumulatorCount]; - fixed (ulong* stateAccumulators = _state.Accumulators) - { -#if NET7_0_OR_GREATER - if (Vector256.IsHardwareAccelerated) - { - Vector256.Store(Vector256.Load(stateAccumulators), accumulators); - Vector256.Store(Vector256.Load(stateAccumulators + 4), accumulators + 4); - } - else if (Vector128.IsHardwareAccelerated) - { - Vector128.Store(Vector128.Load(stateAccumulators), accumulators); - Vector128.Store(Vector128.Load(stateAccumulators + 2), accumulators + 2); - Vector128.Store(Vector128.Load(stateAccumulators + 4), accumulators + 4); - Vector128.Store(Vector128.Load(stateAccumulators + 6), accumulators + 6); - } - else -#endif - { - for (int i = 0; i < 8; i++) - { - accumulators[i] = stateAccumulators[i]; - } - } - } - - fixed (byte* secret = _state.Secret) - { - DigestLong(accumulators, secret); - current = MergeAccumulators(accumulators, secret + SecretMergeAccsStartBytes, _state.TotalLength * XxHash64.Prime64_1); - } - } - else - { - fixed (byte* buffer = _state.Buffer) - { - current = HashToUInt64(new ReadOnlySpan(buffer, (int)_state.TotalLength), (long)_state.Seed); - } - } - - return current; - - void DigestLong(ulong* accumulators, byte* secret) - { - Debug.Assert(_state.BufferedCount > 0); - - fixed (byte* buffer = _state.Buffer) - { - byte* accumulateData; - if (_state.BufferedCount >= StripeLengthBytes) - { - uint stripes = (_state.BufferedCount - 1) / StripeLengthBytes; - ulong stripesSoFar = _state.StripesProcessedInCurrentBlock; - - ConsumeStripes(accumulators, ref stripesSoFar, NumStripesPerBlock, buffer, stripes, secret); - - accumulateData = buffer + _state.BufferedCount - StripeLengthBytes; - } - else - { - byte* lastStripe = stackalloc byte[StripeLengthBytes]; - int catchupSize = StripeLengthBytes - (int)_state.BufferedCount; - - new ReadOnlySpan(buffer + InternalBufferLengthBytes - catchupSize, catchupSize).CopyTo(new Span(lastStripe, StripeLengthBytes)); - new ReadOnlySpan(buffer, (int)_state.BufferedCount).CopyTo(new Span(lastStripe + catchupSize, (int)_state.BufferedCount)); - - accumulateData = lastStripe; - } - - Accumulate512(accumulators, accumulateData, secret + (SecretLengthBytes - StripeLengthBytes - SecretLastAccStartBytes)); - } - } - } -#endif - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static ulong HashLength0To16(byte* source, uint length, ulong seed) - { - if (length > 8) - { - return HashLength9To16(source, length, seed); - } - - if (length >= 4) - { - return HashLength4To8(source, length, seed); - } - - if (length != 0) - { - return HashLength1To3(source, length, seed); - } - - return XxHash64.Avalanche(seed ^ 0x8726F9105DC21DDC); // DefaultSecretUInt64[7] ^ DefaultSecretUInt64[8] - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static ulong HashLength1To3(byte* source, uint length, ulong seed) - { - Debug.Assert(length >= 1 && length <= 3); - - // When source.Length == 1, c1 == source[0], c2 == source[0], c3 == source[0] - // When source.Length == 2, c1 == source[0], c2 == source[1], c3 == source[1] - // When source.Length == 3, c1 == source[0], c2 == source[1], c3 == source[2] - byte c1 = *source; - byte c2 = source[length >> 1]; - byte c3 = source[length - 1]; - - uint combined = ((uint)c1 << 16) | ((uint)c2 << 24) | c3 | (length << 8); - - return XxHash64.Avalanche(combined ^ (0x87275A9B + seed)); // DefaultSecretUInt32[0] ^ DefaultSecretUInt32[1] - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static ulong HashLength4To8(byte* source, uint length, ulong seed) - { - Debug.Assert(length >= 4 && length <= 8); - - seed ^= (ulong)BinaryPrimitives.ReverseEndianness((uint)seed) << 32; - - uint inputLow = ReadUInt32LE(source); - uint inputHigh = ReadUInt32LE(source + length - sizeof(uint)); - - ulong bitflip = 0xC73AB174C5ECD5A2 - seed; // DefaultSecretUInt64[1] ^ DefaultSecretUInt64[2] - ulong input64 = inputHigh + (((ulong)inputLow) << 32); - - return Rrmxmx(input64 ^ bitflip, length); - } - - /// This is a stronger avalanche, preferable when input has not been previously mixed. - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static ulong Rrmxmx(ulong hash, uint length) - { - hash ^= BitOperations.RotateLeft(hash, 49) ^ BitOperations.RotateLeft(hash, 24); - hash *= 0x9FB21C651E98DF25; - hash ^= (hash >> 35) + length; - hash *= 0x9FB21C651E98DF25; - return XorShift(hash, 28); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static ulong HashLength9To16(byte* source, uint length, ulong seed) - { - Debug.Assert(length >= 9 && length <= 16); - - ulong bitflipLow = 0x6782737BEA4239B9 + seed; // DefaultSecretUInt64[3] ^ DefaultSecretUInt64[4] - ulong bitflipHigh = 0xAF56BC3B0996523A - seed; // DefaultSecretUInt64[5] ^ DefaultSecretUInt64[6] - - ulong inputLow = ReadUInt64LE(source) ^ bitflipLow; - ulong inputHigh = ReadUInt64LE(source + length - sizeof(ulong)) ^ bitflipHigh; - - return Avalanche( - length + - BinaryPrimitives.ReverseEndianness(inputLow) + - inputHigh + - Multiply64To128ThenFold(inputLow, inputHigh)); - } - - private static ulong HashLength17To128(byte* source, uint length, ulong seed) - { - Debug.Assert(length >= 17 && length <= 128); - - ulong hash = length * XxHash64.Prime64_1; - - switch ((length - 1) / 32) - { - default: // case 3 - hash += Mix16Bytes(source + 48, 0x3F349CE33F76FAA8, 0x1D4F0BC7C7BBDCF9, seed); // DefaultSecretUInt64[12], DefaultSecretUInt64[13] - hash += Mix16Bytes(source + length - 64, 0x3159B4CD4BE0518A, 0x647378D9C97E9FC8, seed); // DefaultSecretUInt64[14], DefaultSecretUInt64[15] - goto case 2; - case 2: - hash += Mix16Bytes(source + 32, 0xCB00C391BB52283C, 0xA32E531B8B65D088, seed); // DefaultSecretUInt64[8], DefaultSecretUInt64[9] - hash += Mix16Bytes(source + length - 48, 0x4EF90DA297486471, 0xD8ACDEA946EF1938, seed); // DefaultSecretUInt64[10], DefaultSecretUInt64[11] - goto case 1; - case 1: - hash += Mix16Bytes(source + 16, 0x78E5C0CC4EE679CB, 0x2172FFCC7DD05A82, seed); // DefaultSecretUInt64[4], DefaultSecretUInt64[5] - hash += Mix16Bytes(source + length - 32, 0x8E2443F7744608B8, 0x4C263A81E69035E0, seed); // DefaultSecretUInt64[6], DefaultSecretUInt64[7] - goto case 0; - case 0: - hash += Mix16Bytes(source, 0xBE4BA423396CFEB8, 0x1CAD21F72C81017C, seed); // DefaultSecretUInt64[0], DefaultSecretUInt64[1] - hash += Mix16Bytes(source + length - 16, 0xDB979083E96DD4DE, 0x1F67B3B7A4A44072, seed); // DefaultSecretUInt64[2], DefaultSecretUInt64[3] - break; - } - - return Avalanche(hash); - } - - private static ulong HashLength129To240(byte* source, uint length, ulong seed) - { - Debug.Assert(length >= 129 && length <= 240); - - ulong hash = length * XxHash64.Prime64_1; - - hash += Mix16Bytes(source + (16 * 0), 0xBE4BA423396CFEB8, 0x1CAD21F72C81017C, seed); // DefaultSecretUInt64[0], DefaultSecretUInt64[1] - hash += Mix16Bytes(source + (16 * 1), 0xDB979083E96DD4DE, 0x1F67B3B7A4A44072, seed); // DefaultSecretUInt64[2], DefaultSecretUInt64[3] - hash += Mix16Bytes(source + (16 * 2), 0x78E5C0CC4EE679CB, 0x2172FFCC7DD05A82, seed); // DefaultSecretUInt64[4], DefaultSecretUInt64[5] - hash += Mix16Bytes(source + (16 * 3), 0x8E2443F7744608B8, 0x4C263A81E69035E0, seed); // DefaultSecretUInt64[6], DefaultSecretUInt64[7] - hash += Mix16Bytes(source + (16 * 4), 0xCB00C391BB52283C, 0xA32E531B8B65D088, seed); // DefaultSecretUInt64[8], DefaultSecretUInt64[9] - hash += Mix16Bytes(source + (16 * 5), 0x4EF90DA297486471, 0xD8ACDEA946EF1938, seed); // DefaultSecretUInt64[10], DefaultSecretUInt64[11] - hash += Mix16Bytes(source + (16 * 6), 0x3F349CE33F76FAA8, 0x1D4F0BC7C7BBDCF9, seed); // DefaultSecretUInt64[12], DefaultSecretUInt64[13] - hash += Mix16Bytes(source + (16 * 7), 0x3159B4CD4BE0518A, 0x647378D9C97E9FC8, seed); // DefaultSecretUInt64[14], DefaultSecretUInt64[15] - - hash = Avalanche(hash); - - switch ((length - (16 * 8)) / 16) - { - default: // case 7 - Debug.Assert((length - 16 * 8) / 16 == 7); - hash += Mix16Bytes(source + (16 * 14), 0xBBDCF93F349CE33F, 0xE0518A1D4F0BC7C7, seed); // Read(ref DefaultSecret[99]), Read(ref DefaultSecret[107]) - goto case 6; - case 6: - hash += Mix16Bytes(source + (16 * 13), 0xEF19384EF90DA297, 0x76FAA8D8ACDEA946, seed); // Read(ref DefaultSecret[83]), Read(ref DefaultSecret[91]) - goto case 5; - case 5: - hash += Mix16Bytes(source + (16 * 12), 0x65D088CB00C391BB, 0x486471A32E531B8B, seed); // Read(ref DefaultSecret[67]), Read(ref DefaultSecret[75]) - goto case 4; - case 4: - hash += Mix16Bytes(source + (16 * 11), 0x9035E08E2443F774, 0x52283C4C263A81E6, seed); // Read(ref DefaultSecret[51]), Read(ref DefaultSecret[59]) - goto case 3; - case 3: - hash += Mix16Bytes(source + (16 * 10), 0xD05A8278E5C0CC4E, 0x4608B82172FFCC7D, seed); // Read(ref DefaultSecret[35]), Read(ref DefaultSecret[43]) - goto case 2; - case 2: - hash += Mix16Bytes(source + (16 * 9), 0xA44072DB979083E9, 0xE679CB1F67B3B7A4, seed); // Read(ref DefaultSecret[19]), Read(ref DefaultSecret[27]) - goto case 1; - case 1: - hash += Mix16Bytes(source + (16 * 8), 0x81017CBE4BA42339, 0x6DD4DE1CAD21F72C, seed); // Read(ref DefaultSecret[3]), Read(ref DefaultSecret[11]) - goto case 0; - case 0: - break; - } - - // Handle the last 16 bytes. - hash += Mix16Bytes(source + length - 16, 0x7378D9C97E9FC831, 0xEBD33483ACC5EA64, seed); // DefaultSecret[119], DefaultSecret[127] - return Avalanche(hash); - } - - private static ulong HashLengthOver240(byte* source, uint length, ulong seed) - { - Debug.Assert(length > 240); - - fixed (byte* defaultSecret = &MemoryMarshal.GetReference(DefaultSecret)) - { - byte* secret = defaultSecret; - if (seed != 0) - { - byte* customSecret = stackalloc byte[SecretLengthBytes]; - DeriveSecretFromSeed(customSecret, seed); - secret = customSecret; - } - - ulong* accumulators = stackalloc ulong[AccumulatorCount]; - InitializeAccumulators(accumulators); - - const int StripesPerBlock = (SecretLengthBytes - StripeLengthBytes) / SecretConsumeRateBytes; - const int BlockLen = StripeLengthBytes * StripesPerBlock; - int blocksNum = (int)((length - 1) / BlockLen); - - Accumulate(accumulators, source, secret, StripesPerBlock, true, blocksNum); - int offset = BlockLen * blocksNum; - - int stripesNumber = (int)((length - 1 - offset) / StripeLengthBytes); - Accumulate(accumulators, source + offset, secret, stripesNumber); - Accumulate512(accumulators, source + length - StripeLengthBytes, secret + (SecretLengthBytes - StripeLengthBytes - SecretLastAccStartBytes)); - - return MergeAccumulators(accumulators, secret + 11, length * XxHash64.Prime64_1); - } - } - -#if false - private static void ConsumeStripes(ulong* accumulators, ref ulong stripesSoFar, ulong stripesPerBlock, byte* source, ulong stripes, byte* secret) - { - Debug.Assert(stripes <= stripesPerBlock); // can handle max 1 scramble per invocation - Debug.Assert(stripesSoFar < stripesPerBlock); - - ulong stripesToEndOfBlock = stripesPerBlock - stripesSoFar; - if (stripesToEndOfBlock <= stripes) - { - // need a scrambling operation - ulong stripesAfterBlock = stripes - stripesToEndOfBlock; - Accumulate(accumulators, source, secret + ((int)stripesSoFar * SecretConsumeRateBytes), (int)stripesToEndOfBlock); - ScrambleAccumulators(accumulators, secret + (SecretLengthBytes - StripeLengthBytes)); - Accumulate(accumulators, source + ((int)stripesToEndOfBlock * StripeLengthBytes), secret, (int)stripesAfterBlock); - stripesSoFar = stripesAfterBlock; - } - else - { - Accumulate(accumulators, source, secret + ((int)stripesSoFar * SecretConsumeRateBytes), (int)stripes); - stripesSoFar += stripes; - } - } -#endif - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void InitializeAccumulators(ulong* accumulators) - { -#if NET7_0_OR_GREATER - if (Vector256.IsHardwareAccelerated) - { - Vector256.Store(Vector256.Create(XxHash32.Prime32_3, XxHash64.Prime64_1, XxHash64.Prime64_2, XxHash64.Prime64_3), accumulators); - Vector256.Store(Vector256.Create(XxHash64.Prime64_4, XxHash32.Prime32_2, XxHash64.Prime64_5, XxHash32.Prime32_1), accumulators + 4); - } - else if (Vector128.IsHardwareAccelerated) - { - Vector128.Store(Vector128.Create(XxHash32.Prime32_3, XxHash64.Prime64_1), accumulators); - Vector128.Store(Vector128.Create(XxHash64.Prime64_2, XxHash64.Prime64_3), accumulators + 2); - Vector128.Store(Vector128.Create(XxHash64.Prime64_4, XxHash32.Prime32_2), accumulators + 4); - Vector128.Store(Vector128.Create(XxHash64.Prime64_5, XxHash32.Prime32_1), accumulators + 6); - } - else -#endif - { - accumulators[0] = XxHash32.Prime32_3; - accumulators[1] = XxHash64.Prime64_1; - accumulators[2] = XxHash64.Prime64_2; - accumulators[3] = XxHash64.Prime64_3; - accumulators[4] = XxHash64.Prime64_4; - accumulators[5] = XxHash32.Prime32_2; - accumulators[6] = XxHash64.Prime64_5; - accumulators[7] = XxHash32.Prime32_1; - } - } - - private static ulong MergeAccumulators(ulong* accumulators, byte* secret, ulong start) - { - ulong result64 = start; - - result64 += Multiply64To128ThenFold(accumulators[0] ^ ReadUInt64LE(secret), accumulators[1] ^ ReadUInt64LE(secret + 8)); - result64 += Multiply64To128ThenFold(accumulators[2] ^ ReadUInt64LE(secret + 16), accumulators[3] ^ ReadUInt64LE(secret + 24)); - result64 += Multiply64To128ThenFold(accumulators[4] ^ ReadUInt64LE(secret + 32), accumulators[5] ^ ReadUInt64LE(secret + 40)); - result64 += Multiply64To128ThenFold(accumulators[6] ^ ReadUInt64LE(secret + 48), accumulators[7] ^ ReadUInt64LE(secret + 56)); - - return Avalanche(result64); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static ulong Mix16Bytes(byte* source, ulong secretLow, ulong secretHigh, ulong seed) => - Multiply64To128ThenFold( - ReadUInt64LE(source) ^ (secretLow + seed), - ReadUInt64LE(source + sizeof(ulong)) ^ (secretHigh - seed)); - - /// Calculates a 32-bit to 64-bit long multiply. - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static ulong Multiply32To64(ulong v1, ulong v2) => (uint)v1 * (ulong)(uint)v2; - - /// "This is a fast avalanche stage, suitable when input bits are already partially mixed." - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static ulong Avalanche(ulong hash) - { - hash = XorShift(hash, 37); - hash *= 0x165667919E3779F9; - hash = XorShift(hash, 32); - return hash; - } - - /// Calculates a 64-bit to 128-bit multiply, then XOR folds it. - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static ulong Multiply64To128ThenFold(ulong left, ulong right) - { -#if NET5_0_OR_GREATER - ulong upper = Math.BigMul(left, right, out ulong lower); -#else - ulong lowerLow = Multiply32To64(left & 0xFFFFFFFF, right & 0xFFFFFFFF); - ulong higherLow = Multiply32To64(left >> 32, right & 0xFFFFFFFF); - ulong lowerHigh = Multiply32To64(left & 0xFFFFFFFF, right >> 32); - ulong higherHigh = Multiply32To64(left >> 32, right >> 32); - - ulong cross = (lowerLow >> 32) + (higherLow & 0xFFFFFFFF) + lowerHigh; - ulong upper = (higherLow >> 32) + (cross >> 32) + higherHigh; - ulong lower = (cross << 32) | (lowerLow & 0xFFFFFFFF); -#endif - return lower ^ upper; - } - - private static void DeriveSecretFromSeed(byte* destinationSecret, ulong seed) - { - fixed (byte* defaultSecret = &MemoryMarshal.GetReference(DefaultSecret)) - { -#if NET7_0_OR_GREATER - if (Vector256.IsHardwareAccelerated && BitConverter.IsLittleEndian) - { - Vector256 seedVec = Vector256.Create(seed, 0u - seed, seed, 0u - seed); - for (int i = 0; i < SecretLengthBytes; i += Vector256.Count) - { - Vector256.Store(Vector256.Load((ulong*)(defaultSecret + i)) + seedVec, (ulong*)(destinationSecret + i)); - } - } - else if (Vector128.IsHardwareAccelerated && BitConverter.IsLittleEndian) - { - Vector128 seedVec = Vector128.Create(seed, 0u - seed); - for (int i = 0; i < SecretLengthBytes; i += Vector128.Count) - { - Vector128.Store(Vector128.Load((ulong*)(defaultSecret + i)) + seedVec, (ulong*)(destinationSecret + i)); - } - } - else -#endif - { - for (int i = 0; i < SecretLengthBytes; i += sizeof(ulong) * 2) - { - WriteUInt64LE(destinationSecret + i, ReadUInt64LE(defaultSecret + i) + seed); - WriteUInt64LE(destinationSecret + i + 8, ReadUInt64LE(defaultSecret + i + 8) - seed); - } - } - } - } - - /// Optimized version of looping over . - [MethodImpl(MethodImplOptions.NoInlining)] - private static void Accumulate(ulong* accumulators, byte* source, byte* secret, int stripesToProcess, bool scramble = false, int blockCount = 1) - { - byte* secretForAccumulate = secret; - byte* secretForScramble = secret + (SecretLengthBytes - StripeLengthBytes); - -#if NET7_0_OR_GREATER - if (Vector256.IsHardwareAccelerated && BitConverter.IsLittleEndian) - { - Vector256 acc1 = Vector256.Load(accumulators); - Vector256 acc2 = Vector256.Load(accumulators + Vector256.Count); - - for (int j = 0; j < blockCount; j++) - { - secret = secretForAccumulate; - for (int i = 0; i < stripesToProcess; i++) - { - Vector256 secretVal = Vector256.Load((uint*)secret); - acc1 = Accumulate256(acc1, source, secretVal); - source += Vector256.Count; - - secretVal = Vector256.Load((uint*)secret + Vector256.Count); - acc2 = Accumulate256(acc2, source, secretVal); - source += Vector256.Count; - - secret += SecretConsumeRateBytes; - } - - if (scramble) - { - acc1 = ScrambleAccumulator256(acc1, Vector256.Load((ulong*)secretForScramble)); - acc2 = ScrambleAccumulator256(acc2, Vector256.Load((ulong*)secretForScramble + Vector256.Count)); - } - } - - Vector256.Store(acc1, accumulators); - Vector256.Store(acc2, accumulators + Vector256.Count); - } - else if (Vector128.IsHardwareAccelerated && BitConverter.IsLittleEndian) - { - Vector128 acc1 = Vector128.Load(accumulators); - Vector128 acc2 = Vector128.Load(accumulators + Vector128.Count); - Vector128 acc3 = Vector128.Load(accumulators + Vector128.Count * 2); - Vector128 acc4 = Vector128.Load(accumulators + Vector128.Count * 3); - - for (int j = 0; j < blockCount; j++) - { - secret = secretForAccumulate; - for (int i = 0; i < stripesToProcess; i++) - { - Vector128 secretVal = Vector128.Load((uint*)secret); - acc1 = Accumulate128(acc1, source, secretVal); - source += Vector128.Count; - - secretVal = Vector128.Load((uint*)secret + Vector128.Count); - acc2 = Accumulate128(acc2, source, secretVal); - source += Vector128.Count; - - secretVal = Vector128.Load((uint*)secret + Vector128.Count * 2); - acc3 = Accumulate128(acc3, source, secretVal); - source += Vector128.Count; - - secretVal = Vector128.Load((uint*)secret + Vector128.Count * 3); - acc4 = Accumulate128(acc4, source, secretVal); - source += Vector128.Count; - - secret += SecretConsumeRateBytes; - } - - if (scramble) - { - acc1 = ScrambleAccumulator128(acc1, Vector128.Load((ulong*)secretForScramble)); - acc2 = ScrambleAccumulator128(acc2, Vector128.Load((ulong*)secretForScramble + Vector128.Count)); - acc3 = ScrambleAccumulator128(acc3, Vector128.Load((ulong*)secretForScramble + Vector128.Count * 2)); - acc4 = ScrambleAccumulator128(acc4, Vector128.Load((ulong*)secretForScramble + Vector128.Count * 3)); - } - } - - Vector128.Store(acc1, accumulators); - Vector128.Store(acc2, accumulators + Vector128.Count); - Vector128.Store(acc3, accumulators + Vector128.Count * 2); - Vector128.Store(acc4, accumulators + Vector128.Count * 3); - } - else -#endif - { - for (int j = 0; j < blockCount; j++) - { - for (int i = 0; i < stripesToProcess; i++) - { - Accumulate512Inlined(accumulators, source, secret + (i * SecretConsumeRateBytes)); - source += StripeLengthBytes; - } - - if (scramble) - { - ScrambleAccumulators(accumulators, secretForScramble); - } - } - } - } - - [MethodImpl(MethodImplOptions.NoInlining)] - private static void Accumulate512(ulong* accumulators, byte* source, byte* secret) - { - Accumulate512Inlined(accumulators, source, secret); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void Accumulate512Inlined(ulong* accumulators, byte* source, byte* secret) - { -#if NET7_0_OR_GREATER - if (Vector256.IsHardwareAccelerated && BitConverter.IsLittleEndian) - { - for (int i = 0; i < AccumulatorCount / Vector256.Count; i++) - { - Vector256 accVec = Accumulate256(Vector256.Load(accumulators), source, Vector256.Load((uint*)secret)); - Vector256.Store(accVec, accumulators); - - accumulators += Vector256.Count; - secret += Vector256.Count; - source += Vector256.Count; - } - } - else if (Vector128.IsHardwareAccelerated && BitConverter.IsLittleEndian) - { - for (int i = 0; i < AccumulatorCount / Vector128.Count; i++) - { - Vector128 accVec = Accumulate128(Vector128.Load(accumulators), source, Vector128.Load((uint*)secret)); - Vector128.Store(accVec, accumulators); - - accumulators += Vector128.Count; - secret += Vector128.Count; - source += Vector128.Count; - } - } - else -#endif - { - for (int i = 0; i < AccumulatorCount; i++) - { - ulong sourceVal = ReadUInt64LE(source + (8 * i)); - ulong sourceKey = sourceVal ^ ReadUInt64LE(secret + (i * 8)); - - accumulators[i ^ 1] += sourceVal; // swap adjacent lanes - accumulators[i] += Multiply32To64(sourceKey & 0xFFFFFFFF, sourceKey >> 32); - } - } - } - -#if NET7_0_OR_GREATER - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static Vector256 Accumulate256(Vector256 accVec, byte* source, Vector256 secret) - { - Vector256 sourceVec = Vector256.Load((uint*)source); - Vector256 sourceKey = sourceVec ^ secret; - - // TODO: Figure out how to unwind this shuffle and just use Vector256.Multiply - Vector256 sourceKeyLow = Vector256.Shuffle(sourceKey, Vector256.Create(1u, 0, 3, 0, 5, 0, 7, 0)); - Vector256 sourceSwap = Vector256.Shuffle(sourceVec, Vector256.Create(2u, 3, 0, 1, 6, 7, 4, 5)); - Vector256 sum = accVec + sourceSwap.AsUInt64(); - Vector256 product = Avx2.IsSupported ? - Avx2.Multiply(sourceKey, sourceKeyLow) : - (sourceKey & Vector256.Create(~0u, 0u, ~0u, 0u, ~0u, 0u, ~0u, 0u)).AsUInt64() * (sourceKeyLow & Vector256.Create(~0u, 0u, ~0u, 0u, ~0u, 0u, ~0u, 0u)).AsUInt64(); - - accVec = product + sum; - return accVec; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static Vector128 Accumulate128(Vector128 accVec, byte* source, Vector128 secret) - { - Vector128 sourceVec = Vector128.Load((uint*)source); - Vector128 sourceKey = sourceVec ^ secret; - - // TODO: Figure out how to unwind this shuffle and just use Vector128.Multiply - Vector128 sourceSwap = Vector128.Shuffle(sourceVec, Vector128.Create(2u, 3, 0, 1)); - Vector128 sum = accVec + sourceSwap.AsUInt64(); - - Vector128 product = MultiplyWideningLower(sourceKey); - accVec = product + sum; - return accVec; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static Vector128 MultiplyWideningLower(Vector128 source) - { - if (AdvSimd.IsSupported) - { - Vector64 sourceLow = Vector128.Shuffle(source, Vector128.Create(0u, 2, 0, 0)).GetLower(); - Vector64 sourceHigh = Vector128.Shuffle(source, Vector128.Create(1u, 3, 0, 0)).GetLower(); - return AdvSimd.MultiplyWideningLower(sourceLow, sourceHigh); - } - else - { - Vector128 sourceLow = Vector128.Shuffle(source, Vector128.Create(1u, 0, 3, 0)); - return Sse2.IsSupported ? - Sse2.Multiply(source, sourceLow) : - (source & Vector128.Create(~0u, 0u, ~0u, 0u)).AsUInt64() * (sourceLow & Vector128.Create(~0u, 0u, ~0u, 0u)).AsUInt64(); - } - } -#endif - - private static void ScrambleAccumulators(ulong* accumulators, byte* secret) - { -#if NET7_0_OR_GREATER - if (Vector256.IsHardwareAccelerated && BitConverter.IsLittleEndian) - { - for (int i = 0; i < AccumulatorCount / Vector256.Count; i++) - { - Vector256 accVec = ScrambleAccumulator256(Vector256.Load(accumulators), Vector256.Load((ulong*)secret)); - Vector256.Store(accVec, accumulators); - - accumulators += Vector256.Count; - secret += Vector256.Count; - } - } - else if (Vector128.IsHardwareAccelerated && BitConverter.IsLittleEndian) - { - for (int i = 0; i < AccumulatorCount / Vector128.Count; i++) - { - Vector128 accVec = ScrambleAccumulator128(Vector128.Load(accumulators), Vector128.Load((ulong*)secret)); - Vector128.Store(accVec, accumulators); - - accumulators += Vector128.Count; - secret += Vector128.Count; - } - } - else -#endif - { - for (int i = 0; i < AccumulatorCount; i++) - { - ulong xorShift = XorShift(*accumulators, 47); - ulong xorWithKey = xorShift ^ ReadUInt64LE(secret); - *accumulators = xorWithKey * XxHash32.Prime32_1; - - accumulators++; - secret += sizeof(ulong); - } - } - } - -#if NET7_0_OR_GREATER - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static Vector256 ScrambleAccumulator256(Vector256 accVec, Vector256 secret) - { - Vector256 xorShift = accVec ^ Vector256.ShiftRightLogical(accVec, 47); - Vector256 xorWithKey = xorShift ^ secret; - accVec = xorWithKey * Vector256.Create((ulong)XxHash32.Prime32_1); - return accVec; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static Vector128 ScrambleAccumulator128(Vector128 accVec, Vector128 secret) - { - Vector128 xorShift = accVec ^ Vector128.ShiftRightLogical(accVec, 47); - Vector128 xorWithKey = xorShift ^ secret; - accVec = xorWithKey * Vector128.Create((ulong)XxHash32.Prime32_1); - return accVec; - } -#endif - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static ulong XorShift(ulong value, int shift) - { - Debug.Assert(shift >= 0 && shift < 64); - return value ^ (value >> shift); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static uint ReadUInt32LE(byte* data) => - BitConverter.IsLittleEndian ? - Unsafe.ReadUnaligned(data) : - BinaryPrimitives.ReverseEndianness(Unsafe.ReadUnaligned(data)); - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static ulong ReadUInt64LE(byte* data) => - BitConverter.IsLittleEndian ? - Unsafe.ReadUnaligned(data) : - BinaryPrimitives.ReverseEndianness(Unsafe.ReadUnaligned(data)); - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void WriteUInt64LE(byte* data, ulong value) - { - if (!BitConverter.IsLittleEndian) - { - value = BinaryPrimitives.ReverseEndianness(value); - } - Unsafe.WriteUnaligned(data, value); - } -#if false - [StructLayout(LayoutKind.Auto)] - private struct State - { - /// The accumulators. Length is . - internal fixed ulong Accumulators[AccumulatorCount]; - - /// Used to store a custom secret generated from a seed. Length is . - internal fixed byte Secret[SecretLengthBytes]; - - /// The internal buffer. Length is . - internal fixed byte Buffer[InternalBufferLengthBytes]; - - /// The amount of memory in . - internal uint BufferedCount; - - /// Number of stripes processed in the current block. - internal ulong StripesProcessedInCurrentBlock; - - /// Total length hashed. - internal ulong TotalLength; - - /// The seed employed (possibly 0). - internal ulong Seed; - }; -#endif - } -} diff --git a/src/LegacySupport/xxH3/XxHash32.State.cs b/src/LegacySupport/xxH3/XxHash32.State.cs deleted file mode 100644 index 222ab4ba6f2..00000000000 --- a/src/LegacySupport/xxH3/XxHash32.State.cs +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -#pragma warning disable SA1310 -#pragma warning disable S2148 - -namespace System.IO.Hashing; - -[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] -internal static class XxHash32 -{ - internal const uint Prime32_1 = 0x9E3779B1; - internal const uint Prime32_2 = 0x85EBCA77; - internal const uint Prime32_3 = 0xC2B2AE3D; - internal const uint Prime32_4 = 0x27D4EB2F; - internal const uint Prime32_5 = 0x165667B1; -} - diff --git a/src/LegacySupport/xxH3/XxHash64.State.cs b/src/LegacySupport/xxH3/XxHash64.State.cs deleted file mode 100644 index cc0d0bc7e01..00000000000 --- a/src/LegacySupport/xxH3/XxHash64.State.cs +++ /dev/null @@ -1,31 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -#pragma warning disable SA1310 -#pragma warning disable S2148 -#pragma warning disable S109 - -using System.Runtime.CompilerServices; - -namespace System.IO.Hashing; - -[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] -internal static class XxHash64 -{ - internal const ulong Prime64_1 = 0x9E3779B185EBCA87; - internal const ulong Prime64_2 = 0xC2B2AE3D27D4EB4F; - internal const ulong Prime64_3 = 0x165667B19E3779F9; - internal const ulong Prime64_4 = 0x85EBCA77C2B2AE63; - internal const ulong Prime64_5 = 0x27D4EB2F165667C5; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal static ulong Avalanche(ulong hash) - { - hash ^= hash >> 33; - hash *= Prime64_2; - hash ^= hash >> 29; - hash *= Prime64_3; - hash ^= hash >> 32; - return hash; - } -} diff --git a/src/Libraries/Microsoft.Extensions.Compliance.Redaction/Microsoft.Extensions.Compliance.Redaction.json b/src/Libraries/Microsoft.Extensions.Compliance.Redaction/Microsoft.Extensions.Compliance.Redaction.json index 70b42ce9fb5..856d914aa85 100644 --- a/src/Libraries/Microsoft.Extensions.Compliance.Redaction/Microsoft.Extensions.Compliance.Redaction.json +++ b/src/Libraries/Microsoft.Extensions.Compliance.Redaction/Microsoft.Extensions.Compliance.Redaction.json @@ -25,20 +25,6 @@ } ] }, - { - "Type": "static class Microsoft.Extensions.Compliance.Redaction.RedactionBuilderExtensions", - "Stage": "Stable", - "Methods": [ - { - "Member": "static Microsoft.Extensions.Compliance.Redaction.IRedactionBuilder Microsoft.Extensions.Compliance.Redaction.RedactionBuilderExtensions.SetXxHash3Redactor(this Microsoft.Extensions.Compliance.Redaction.IRedactionBuilder builder, System.Action configure, params Microsoft.Extensions.Compliance.Classification.DataClassification[] classifications);", - "Stage": "Stable" - }, - { - "Member": "static Microsoft.Extensions.Compliance.Redaction.IRedactionBuilder Microsoft.Extensions.Compliance.Redaction.RedactionBuilderExtensions.SetXxHash3Redactor(this Microsoft.Extensions.Compliance.Redaction.IRedactionBuilder builder, Microsoft.Extensions.Configuration.IConfigurationSection section, params Microsoft.Extensions.Compliance.Classification.DataClassification[] classifications);", - "Stage": "Stable" - } - ] - }, { "Type": "static class Microsoft.Extensions.DependencyInjection.RedactionServiceCollectionExtensions", "Stage": "Stable", @@ -52,22 +38,6 @@ "Stage": "Stable" } ] - }, - { - "Type": "class Microsoft.Extensions.Compliance.Redaction.XxHash3RedactorOptions", - "Stage": "Stable", - "Methods": [ - { - "Member": "Microsoft.Extensions.Compliance.Redaction.XxHash3RedactorOptions.XxHash3RedactorOptions();", - "Stage": "Stable" - } - ], - "Properties": [ - { - "Member": "ulong Microsoft.Extensions.Compliance.Redaction.XxHash3RedactorOptions.HashSeed { get; set; }", - "Stage": "Stable" - } - ] } ] } \ No newline at end of file diff --git a/src/Libraries/Microsoft.Extensions.Compliance.Redaction/RedactionBuilderExtensions.cs b/src/Libraries/Microsoft.Extensions.Compliance.Redaction/RedactionBuilderExtensions.cs deleted file mode 100644 index 0cde1371766..00000000000 --- a/src/Libraries/Microsoft.Extensions.Compliance.Redaction/RedactionBuilderExtensions.cs +++ /dev/null @@ -1,66 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -using System; -using System.Diagnostics.CodeAnalysis; -using Microsoft.Extensions.Compliance.Classification; -using Microsoft.Extensions.Compliance.Redaction; -using Microsoft.Extensions.Configuration; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.Shared.Diagnostics; - -namespace Microsoft.Extensions.Compliance.Redaction; - -/// -/// Extensions to add redactors to a redaction builder. -/// -public static class RedactionBuilderExtensions -{ - /// - /// Sets the xxHash3 redactor to use for a set of data classes. - /// - /// The builder to attach the redactor to. - /// Configuration function. - /// The data classes for which the redactor type should be used. - /// The value of . - /// , or are . - public static IRedactionBuilder SetXxHash3Redactor(this IRedactionBuilder builder, Action configure, params DataClassification[] classifications) - { - _ = Throw.IfNull(builder); - _ = Throw.IfNull(configure); - _ = Throw.IfNull(classifications); - - _ = builder - .Services - .AddOptions() - .Configure(configure); - - return builder.SetRedactor(classifications); - } - - /// - /// Sets the xxHash3 redactor to use for a set of data classes. - /// - /// The builder to attach the redactor to. - /// Configuration section. - /// The data classes for which the redactor type should be used. - /// The value of . - /// , or are . - [DynamicDependency(DynamicallyAccessedMemberTypes.All, typeof(XxHash3RedactorOptions))] - [UnconditionalSuppressMessage( - "Trimming", - "IL2026:Members annotated with 'RequiresUnreferencedCodeAttribute' require dynamic access otherwise can break functionality when trimming application code", - Justification = "Addressed with [DynamicDependency]")] - public static IRedactionBuilder SetXxHash3Redactor(this IRedactionBuilder builder, IConfigurationSection section, params DataClassification[] classifications) - { - _ = Throw.IfNull(builder); - _ = Throw.IfNull(section); - _ = Throw.IfNull(classifications); - - _ = builder - .Services.AddOptions() - .Services.Configure(section); - - return builder.SetRedactor(classifications); - } -} diff --git a/src/Libraries/Microsoft.Extensions.Compliance.Redaction/XXHash3Redactor.cs b/src/Libraries/Microsoft.Extensions.Compliance.Redaction/XXHash3Redactor.cs deleted file mode 100644 index 8d1f21b7763..00000000000 --- a/src/Libraries/Microsoft.Extensions.Compliance.Redaction/XXHash3Redactor.cs +++ /dev/null @@ -1,84 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -using System; -using System.Globalization; -using System.IO.Hashing; -using System.Runtime.InteropServices; -using Microsoft.Extensions.Options; -using Microsoft.Shared.Diagnostics; - -namespace Microsoft.Extensions.Compliance.Redaction; - -/// -/// Redactor that uses XxHash3 hashing to redact data. -/// -internal sealed class XxHash3Redactor : Redactor -{ - internal const int HashSize = 16; - internal const string Prefix = " - /// Initializes a new instance of the class. - /// - /// The options to control the redactor. - public XxHash3Redactor(IOptions options) - { - _seed = options.Value.HashSeed; - } - - /// - public override int GetRedactedLength(ReadOnlySpan input) - { - if (input.IsEmpty) - { - return 0; - } - - return RedactedSize; - } - - /// - public override int Redact(ReadOnlySpan source, Span destination) - { - var length = GetRedactedLength(source); - - if (length == 0) - { - return 0; - } - - Throw.IfBufferTooSmall(destination.Length, length, nameof(destination)); - - var s = MemoryMarshal.AsBytes(source); - var hash = XxHash3.HashToUInt64(s, (long)_seed); - -#pragma warning disable S109 // Magic numbers should not be used - destination[24] = '>'; // do this first to avoid redundant bounds checking - destination[0] = '<'; - destination[1] = 'x'; - destination[2] = 'x'; - destination[3] = 'h'; - destination[4] = 'a'; - destination[5] = 's'; - destination[6] = 'h'; - destination[7] = ':'; -#pragma warning restore S109 // Magic numbers should not be used - -#if NETCOREAPP3_1_OR_GREATER - _ = hash.TryFormat(destination.Slice(Prefix.Length), out var _, "x16", CultureInfo.InvariantCulture); -#else - var str = hash.ToString("x16", CultureInfo.InvariantCulture); - for (int i = 0; i < str.Length; i++) - { - destination[Prefix.Length + i] = str[i]; - } -#endif - - return RedactedSize; - } -} diff --git a/src/Libraries/Microsoft.Extensions.Compliance.Redaction/XXHash3RedactorOptions.cs b/src/Libraries/Microsoft.Extensions.Compliance.Redaction/XXHash3RedactorOptions.cs deleted file mode 100644 index 5dc9aaff992..00000000000 --- a/src/Libraries/Microsoft.Extensions.Compliance.Redaction/XXHash3RedactorOptions.cs +++ /dev/null @@ -1,23 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -namespace Microsoft.Extensions.Compliance.Redaction; - -/// -/// Options for the XxHash3 redactor. -/// -public class XxHash3RedactorOptions -{ - /// - /// Gets or sets a hash seed used when computing hashes during redaction. - /// - /// - /// The default value is 0. - /// - /// - /// You typically pick a unique value for your application and don't change it afterwards. You'll want a different value for - /// different deployment environments in order to prevent identifiers from one environment being redacted to the same - /// value across environments. - /// - public ulong HashSeed { get; set; } -} diff --git a/src/Libraries/Microsoft.Extensions.Http.Resilience/Microsoft.Extensions.Http.Resilience.csproj b/src/Libraries/Microsoft.Extensions.Http.Resilience/Microsoft.Extensions.Http.Resilience.csproj index f9ea08aac40..8464b259dc8 100644 --- a/src/Libraries/Microsoft.Extensions.Http.Resilience/Microsoft.Extensions.Http.Resilience.csproj +++ b/src/Libraries/Microsoft.Extensions.Http.Resilience/Microsoft.Extensions.Http.Resilience.csproj @@ -9,7 +9,6 @@ true true true - true true true true diff --git a/test/Libraries/Microsoft.Extensions.Compliance.Redaction.Tests/XXHash3RedactorExtensionsTests.cs b/test/Libraries/Microsoft.Extensions.Compliance.Redaction.Tests/XXHash3RedactorExtensionsTests.cs deleted file mode 100644 index 31e506af2f0..00000000000 --- a/test/Libraries/Microsoft.Extensions.Compliance.Redaction.Tests/XXHash3RedactorExtensionsTests.cs +++ /dev/null @@ -1,84 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -using System.Collections.Generic; -using System.Globalization; -using Microsoft.Extensions.Compliance.Testing; -using Microsoft.Extensions.Configuration; -using Microsoft.Extensions.DependencyInjection; -using Xunit; - -namespace Microsoft.Extensions.Compliance.Redaction.Test; - -public class XXHash3RedactorExtensionsTests -{ - [Fact] - public void DelegateBased() - { - var redactorProvider = new ServiceCollection() - .AddRedaction(redaction => redaction.SetXxHash3Redactor(o => o.HashSeed = 101, FakeClassifications.PrivateData)) - .BuildServiceProvider() - .GetRequiredService(); - - CheckProvider(redactorProvider); - } - - [Fact] - public void HostBuilder_GivenXXHashRedactorWithConfigurationSectionConfig_RegistersItAsHashingRedactorAndRedacts() - { - var redactorProvider = new ServiceCollection() - .AddRedaction(redaction => - { - var section = GetRedactorConfiguration(new ConfigurationBuilder(), 101); - redaction.SetXxHash3Redactor(section, FakeClassifications.PrivateData); - }) - .BuildServiceProvider() - .GetRequiredService(); - - CheckProvider(redactorProvider); - } - - private static void CheckProvider(IRedactorProvider redactorProvider) - { - const string Example = "Redact Me"; - - var classifications = new[] - { - FakeClassifications.PublicData, - FakeClassifications.PrivateData - }; - - foreach (var dc in classifications) - { - var redactor = redactorProvider.GetRedactor(dc); - - var expectedLength = redactor.GetRedactedLength(Example); - var destination = new char[expectedLength]; - var actualLength = redactor.Redact(Example, destination); - - if (dc == FakeClassifications.PrivateData) - { - Assert.Equal(XxHash3Redactor.RedactedSize, expectedLength); - Assert.Equal(XxHash3Redactor.RedactedSize, actualLength); - } - else - { - Assert.True(expectedLength == 0 || expectedLength == Example.Length); - Assert.True(actualLength == 0 || actualLength == Example.Length); - } - } - } - - private static IConfigurationSection GetRedactorConfiguration(IConfigurationBuilder builder, ulong hashSeed) - { - XxHash3RedactorOptions options; - - return builder - .AddInMemoryCollection(new Dictionary - { - { $"{nameof(XxHash3RedactorOptions)}:{nameof(options.HashSeed)}", hashSeed.ToString(CultureInfo.InvariantCulture) }, - }) - .Build() - .GetSection(nameof(XxHash3RedactorOptions)); - } -} diff --git a/test/Libraries/Microsoft.Extensions.Compliance.Redaction.Tests/XXHash3RedactorTests.cs b/test/Libraries/Microsoft.Extensions.Compliance.Redaction.Tests/XXHash3RedactorTests.cs deleted file mode 100644 index e1c5bb77135..00000000000 --- a/test/Libraries/Microsoft.Extensions.Compliance.Redaction.Tests/XXHash3RedactorTests.cs +++ /dev/null @@ -1,69 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -using System; -using Xunit; - -namespace Microsoft.Extensions.Compliance.Redaction.Test; - -public class XxHash3RedactorTests -{ - [Fact] - public void Basic() - { - var redactor = new XxHash3Redactor(Microsoft.Extensions.Options.Options.Create(new XxHash3RedactorOptions - { - HashSeed = 101, - })); - - Assert.Equal(XxHash3Redactor.RedactedSize, redactor.GetRedactedLength(" ")); - Assert.Equal(XxHash3Redactor.RedactedSize, redactor.GetRedactedLength("--")); - Assert.Equal(XxHash3Redactor.RedactedSize, redactor.GetRedactedLength("XXXXXXXXXXXXXXXXXXXXXXX")); - - var s1 = new char[XxHash3Redactor.RedactedSize]; - var r1 = redactor.Redact("Hello", s1); - - var s2 = new char[XxHash3Redactor.RedactedSize]; - var r2 = redactor.Redact("Hello", s2); - - Assert.Equal(r1, r2); - Assert.Equal(s1, s2); - - redactor = new XxHash3Redactor(Microsoft.Extensions.Options.Options.Create(new XxHash3RedactorOptions - { - HashSeed = 10101, - })); - - var s3 = new char[XxHash3Redactor.RedactedSize]; - for (int i = 0; i < s3.Length; i++) - { - s3[i] = '@'; - } - - var r3 = redactor.Redact("Hello", s3); - - Assert.Equal(r1, r3); - Assert.NotEqual(s1, s3); - Assert.DoesNotContain('@', s3); - } - - [Fact] - public void XXHashRedactor_Does_Nothing_With_Empty_Input() - { - var redactor = new XxHash3Redactor(Microsoft.Extensions.Options.Options.Create(new XxHash3RedactorOptions - { - HashSeed = 101, - })); - - var buffer = new char[5]; - - var written = redactor.Redact(string.Empty, buffer); - - Assert.Equal(0, written); - - foreach (var item in buffer) - { - Assert.Equal('\0', item); - } - } -} From d77be9ef68c6de11cacd9529c3bc891956d271dd Mon Sep 17 00:00:00 2001 From: Mitch Denny Date: Tue, 3 Oct 2023 16:57:25 +1100 Subject: [PATCH 038/172] Update SDK. (#4500) --- global.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/global.json b/global.json index f18b7215123..5c041a50457 100644 --- a/global.json +++ b/global.json @@ -1,9 +1,9 @@ { "sdk": { - "version": "9.0.100-alpha.1.23479.5" + "version": "9.0.100-alpha.1.23502.7" }, "tools": { - "dotnet": "9.0.100-alpha.1.23479.5", + "dotnet": "9.0.100-alpha.1.23502.7", "runtimes": { "dotnet/x64": [ "8.0.0-rtm.23475.7", From 772f9289efa4dc46fb2b903cd18902966bd3236d Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Tue, 3 Oct 2023 12:55:20 +0000 Subject: [PATCH 039/172] Update dependencies from https://github.com/dotnet/aspnetcore build 20231002.21 (#4503) [main] Update dependencies from dotnet/aspnetcore - Coherency Updates: - Microsoft.Bcl.TimeProvider: from 9.0.0-alpha.1.23470.17 to 9.0.0-alpha.1.23502.2 (parent: Microsoft.AspNetCore.App.Runtime.win-x64) - Microsoft.Extensions.Caching.Abstractions: from 9.0.0-alpha.1.23470.17 to 9.0.0-alpha.1.23502.2 (parent: Microsoft.AspNetCore.App.Runtime.win-x64) - Microsoft.Extensions.Caching.Memory: from 9.0.0-alpha.1.23470.17 to 9.0.0-alpha.1.23502.2 (parent: Microsoft.AspNetCore.App.Runtime.win-x64) - Microsoft.Extensions.Configuration.Abstractions: from 9.0.0-alpha.1.23470.17 to 9.0.0-alpha.1.23502.2 (parent: Microsoft.AspNetCore.App.Runtime.win-x64) - Microsoft.Extensions.Configuration.Binder: from 9.0.0-alpha.1.23470.17 to 9.0.0-alpha.1.23502.2 (parent: Microsoft.AspNetCore.App.Runtime.win-x64) - Microsoft.Extensions.Configuration.CommandLine: from 9.0.0-alpha.1.23470.17 to 9.0.0-alpha.1.23502.2 (parent: Microsoft.AspNetCore.App.Runtime.win-x64) - Microsoft.Extensions.Configuration.Json: from 9.0.0-alpha.1.23470.17 to 9.0.0-alpha.1.23502.2 (parent: Microsoft.AspNetCore.App.Runtime.win-x64) - Microsoft.Extensions.Configuration: from 9.0.0-alpha.1.23470.17 to 9.0.0-alpha.1.23502.2 (parent: Microsoft.AspNetCore.App.Runtime.win-x64) - Microsoft.Extensions.DependencyInjection.Abstractions: from 9.0.0-alpha.1.23470.17 to 9.0.0-alpha.1.23502.2 (parent: Microsoft.AspNetCore.App.Runtime.win-x64) - Microsoft.Extensions.DependencyInjection: from 9.0.0-alpha.1.23470.17 to 9.0.0-alpha.1.23502.2 (parent: Microsoft.AspNetCore.App.Runtime.win-x64) - Microsoft.Extensions.Hosting.Abstractions: from 9.0.0-alpha.1.23470.17 to 9.0.0-alpha.1.23502.2 (parent: Microsoft.AspNetCore.App.Runtime.win-x64) - Microsoft.Extensions.Diagnostics: from 9.0.0-alpha.1.23470.17 to 9.0.0-alpha.1.23502.2 (parent: Microsoft.AspNetCore.App.Runtime.win-x64) - Microsoft.Extensions.Hosting: from 9.0.0-alpha.1.23470.17 to 9.0.0-alpha.1.23502.2 (parent: Microsoft.AspNetCore.App.Runtime.win-x64) - Microsoft.Extensions.Http: from 9.0.0-alpha.1.23470.17 to 9.0.0-alpha.1.23502.2 (parent: Microsoft.AspNetCore.App.Runtime.win-x64) - Microsoft.Extensions.Logging.Abstractions: from 9.0.0-alpha.1.23470.17 to 9.0.0-alpha.1.23502.2 (parent: Microsoft.AspNetCore.App.Runtime.win-x64) - Microsoft.Extensions.Logging.Configuration: from 9.0.0-alpha.1.23470.17 to 9.0.0-alpha.1.23502.2 (parent: Microsoft.AspNetCore.App.Runtime.win-x64) - Microsoft.Extensions.Logging.Console: from 9.0.0-alpha.1.23470.17 to 9.0.0-alpha.1.23502.2 (parent: Microsoft.AspNetCore.App.Runtime.win-x64) - Microsoft.Extensions.Logging: from 9.0.0-alpha.1.23470.17 to 9.0.0-alpha.1.23502.2 (parent: Microsoft.AspNetCore.App.Runtime.win-x64) - Microsoft.Extensions.Options.ConfigurationExtensions: from 9.0.0-alpha.1.23470.17 to 9.0.0-alpha.1.23502.2 (parent: Microsoft.AspNetCore.App.Runtime.win-x64) - Microsoft.Extensions.Options.DataAnnotations: from 9.0.0-alpha.1.23470.17 to 9.0.0-alpha.1.23502.2 (parent: Microsoft.AspNetCore.App.Runtime.win-x64) - Microsoft.Extensions.Options: from 9.0.0-alpha.1.23470.17 to 9.0.0-alpha.1.23502.2 (parent: Microsoft.AspNetCore.App.Runtime.win-x64) - Microsoft.Extensions.Primitives: from 9.0.0-alpha.1.23470.17 to 9.0.0-alpha.1.23502.2 (parent: Microsoft.AspNetCore.App.Runtime.win-x64) - Microsoft.NETCore.App.Ref: from 9.0.0-alpha.1.23470.17 to 9.0.0-alpha.1.23502.2 (parent: Microsoft.AspNetCore.App.Runtime.win-x64) - Microsoft.NETCore.App.Runtime.win-x64: from 9.0.0-alpha.1.23470.17 to 9.0.0-alpha.1.23502.2 (parent: Microsoft.AspNetCore.App.Runtime.win-x64) - System.Collections.Immutable: from 9.0.0-alpha.1.23470.17 to 9.0.0-alpha.1.23502.2 (parent: Microsoft.AspNetCore.App.Runtime.win-x64) - System.Configuration.ConfigurationManager: from 9.0.0-alpha.1.23470.17 to 9.0.0-alpha.1.23502.2 (parent: Microsoft.AspNetCore.App.Runtime.win-x64) - System.Diagnostics.DiagnosticSource: from 9.0.0-alpha.1.23470.17 to 9.0.0-alpha.1.23502.2 (parent: Microsoft.AspNetCore.App.Runtime.win-x64) - System.Diagnostics.PerformanceCounter: from 9.0.0-alpha.1.23470.17 to 9.0.0-alpha.1.23502.2 (parent: Microsoft.AspNetCore.App.Runtime.win-x64) - System.IO.Hashing: from 9.0.0-alpha.1.23470.17 to 9.0.0-alpha.1.23502.2 (parent: Microsoft.AspNetCore.App.Runtime.win-x64) - System.Net.Http.Json: from 9.0.0-alpha.1.23470.17 to 9.0.0-alpha.1.23502.2 (parent: Microsoft.AspNetCore.App.Runtime.win-x64) - System.Security.Cryptography.Pkcs: from 9.0.0-alpha.1.23470.17 to 9.0.0-alpha.1.23502.2 (parent: Microsoft.AspNetCore.App.Runtime.win-x64) - System.Security.Cryptography.Xml: from 9.0.0-alpha.1.23470.17 to 9.0.0-alpha.1.23502.2 (parent: Microsoft.AspNetCore.App.Runtime.win-x64) - System.Text.Encodings.Web: from 9.0.0-alpha.1.23470.17 to 9.0.0-alpha.1.23502.2 (parent: Microsoft.AspNetCore.App.Runtime.win-x64) - System.Text.Json: from 9.0.0-alpha.1.23470.17 to 9.0.0-alpha.1.23502.2 (parent: Microsoft.AspNetCore.App.Runtime.win-x64) - System.Runtime.Caching: from 9.0.0-alpha.1.23470.17 to 9.0.0-alpha.1.23502.2 (parent: Microsoft.AspNetCore.App.Runtime.win-x64) --- eng/Version.Details.xml | 180 ++++++++++++++++++++-------------------- eng/Versions.props | 90 ++++++++++---------- 2 files changed, 135 insertions(+), 135 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 823ea7b6524..e7b2d479d20 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,188 +1,188 @@ - + https://github.com/dotnet/runtime - 736dabeca728ccf8b911d96d1b4c575b4d0db7d2 + f47c963e966f000b59c79dc9acb5305a07d0031a - + https://github.com/dotnet/runtime - 736dabeca728ccf8b911d96d1b4c575b4d0db7d2 + f47c963e966f000b59c79dc9acb5305a07d0031a - + https://github.com/dotnet/runtime - 736dabeca728ccf8b911d96d1b4c575b4d0db7d2 + f47c963e966f000b59c79dc9acb5305a07d0031a - + https://github.com/dotnet/runtime - 736dabeca728ccf8b911d96d1b4c575b4d0db7d2 + f47c963e966f000b59c79dc9acb5305a07d0031a - + https://github.com/dotnet/runtime - 736dabeca728ccf8b911d96d1b4c575b4d0db7d2 + f47c963e966f000b59c79dc9acb5305a07d0031a - + https://github.com/dotnet/runtime - 736dabeca728ccf8b911d96d1b4c575b4d0db7d2 + f47c963e966f000b59c79dc9acb5305a07d0031a - + https://github.com/dotnet/runtime - 736dabeca728ccf8b911d96d1b4c575b4d0db7d2 + f47c963e966f000b59c79dc9acb5305a07d0031a - + https://github.com/dotnet/runtime - 736dabeca728ccf8b911d96d1b4c575b4d0db7d2 + f47c963e966f000b59c79dc9acb5305a07d0031a - + https://github.com/dotnet/runtime - 736dabeca728ccf8b911d96d1b4c575b4d0db7d2 + f47c963e966f000b59c79dc9acb5305a07d0031a - + https://github.com/dotnet/runtime - 736dabeca728ccf8b911d96d1b4c575b4d0db7d2 + f47c963e966f000b59c79dc9acb5305a07d0031a - + https://github.com/dotnet/runtime - 736dabeca728ccf8b911d96d1b4c575b4d0db7d2 + f47c963e966f000b59c79dc9acb5305a07d0031a - + https://github.com/dotnet/runtime - 736dabeca728ccf8b911d96d1b4c575b4d0db7d2 + f47c963e966f000b59c79dc9acb5305a07d0031a - + https://github.com/dotnet/runtime - 736dabeca728ccf8b911d96d1b4c575b4d0db7d2 + f47c963e966f000b59c79dc9acb5305a07d0031a - + https://github.com/dotnet/runtime - 736dabeca728ccf8b911d96d1b4c575b4d0db7d2 + f47c963e966f000b59c79dc9acb5305a07d0031a - + https://github.com/dotnet/runtime - 736dabeca728ccf8b911d96d1b4c575b4d0db7d2 + f47c963e966f000b59c79dc9acb5305a07d0031a - + https://github.com/dotnet/runtime - 736dabeca728ccf8b911d96d1b4c575b4d0db7d2 + f47c963e966f000b59c79dc9acb5305a07d0031a - + https://github.com/dotnet/runtime - 736dabeca728ccf8b911d96d1b4c575b4d0db7d2 + f47c963e966f000b59c79dc9acb5305a07d0031a - + https://github.com/dotnet/runtime - 736dabeca728ccf8b911d96d1b4c575b4d0db7d2 + f47c963e966f000b59c79dc9acb5305a07d0031a - + https://github.com/dotnet/runtime - 736dabeca728ccf8b911d96d1b4c575b4d0db7d2 + f47c963e966f000b59c79dc9acb5305a07d0031a - + https://github.com/dotnet/runtime - 736dabeca728ccf8b911d96d1b4c575b4d0db7d2 + f47c963e966f000b59c79dc9acb5305a07d0031a - + https://github.com/dotnet/runtime - 736dabeca728ccf8b911d96d1b4c575b4d0db7d2 + f47c963e966f000b59c79dc9acb5305a07d0031a - + https://github.com/dotnet/runtime - 736dabeca728ccf8b911d96d1b4c575b4d0db7d2 + f47c963e966f000b59c79dc9acb5305a07d0031a - + https://github.com/dotnet/runtime - 736dabeca728ccf8b911d96d1b4c575b4d0db7d2 + f47c963e966f000b59c79dc9acb5305a07d0031a - + https://github.com/dotnet/runtime - 736dabeca728ccf8b911d96d1b4c575b4d0db7d2 + f47c963e966f000b59c79dc9acb5305a07d0031a - + https://github.com/dotnet/runtime - 736dabeca728ccf8b911d96d1b4c575b4d0db7d2 + f47c963e966f000b59c79dc9acb5305a07d0031a - + https://github.com/dotnet/runtime - 736dabeca728ccf8b911d96d1b4c575b4d0db7d2 + f47c963e966f000b59c79dc9acb5305a07d0031a - + https://github.com/dotnet/runtime - 736dabeca728ccf8b911d96d1b4c575b4d0db7d2 + f47c963e966f000b59c79dc9acb5305a07d0031a - + https://github.com/dotnet/runtime - 736dabeca728ccf8b911d96d1b4c575b4d0db7d2 + f47c963e966f000b59c79dc9acb5305a07d0031a - + https://github.com/dotnet/runtime - 736dabeca728ccf8b911d96d1b4c575b4d0db7d2 + f47c963e966f000b59c79dc9acb5305a07d0031a - + https://github.com/dotnet/runtime - 736dabeca728ccf8b911d96d1b4c575b4d0db7d2 + f47c963e966f000b59c79dc9acb5305a07d0031a - + https://github.com/dotnet/runtime - 736dabeca728ccf8b911d96d1b4c575b4d0db7d2 + f47c963e966f000b59c79dc9acb5305a07d0031a - + https://github.com/dotnet/runtime - 736dabeca728ccf8b911d96d1b4c575b4d0db7d2 + f47c963e966f000b59c79dc9acb5305a07d0031a - + https://github.com/dotnet/runtime - 736dabeca728ccf8b911d96d1b4c575b4d0db7d2 + f47c963e966f000b59c79dc9acb5305a07d0031a - + https://github.com/dotnet/runtime - 736dabeca728ccf8b911d96d1b4c575b4d0db7d2 + f47c963e966f000b59c79dc9acb5305a07d0031a - + https://github.com/dotnet/runtime - 736dabeca728ccf8b911d96d1b4c575b4d0db7d2 + f47c963e966f000b59c79dc9acb5305a07d0031a - + https://github.com/dotnet/aspnetcore - 6f8b962b73cd7e252a76f1b562db61202effc310 + c046946464f132fc3f32ac0a02c54ac3d29ac1d7 - + https://github.com/dotnet/aspnetcore - 6f8b962b73cd7e252a76f1b562db61202effc310 + c046946464f132fc3f32ac0a02c54ac3d29ac1d7 - + https://github.com/dotnet/aspnetcore - 6f8b962b73cd7e252a76f1b562db61202effc310 + c046946464f132fc3f32ac0a02c54ac3d29ac1d7 - + https://github.com/dotnet/aspnetcore - 6f8b962b73cd7e252a76f1b562db61202effc310 + c046946464f132fc3f32ac0a02c54ac3d29ac1d7 - + https://github.com/dotnet/aspnetcore - 6f8b962b73cd7e252a76f1b562db61202effc310 + c046946464f132fc3f32ac0a02c54ac3d29ac1d7 - + https://github.com/dotnet/aspnetcore - 6f8b962b73cd7e252a76f1b562db61202effc310 + c046946464f132fc3f32ac0a02c54ac3d29ac1d7 - + https://github.com/dotnet/aspnetcore - 6f8b962b73cd7e252a76f1b562db61202effc310 + c046946464f132fc3f32ac0a02c54ac3d29ac1d7 - + https://github.com/dotnet/aspnetcore - 6f8b962b73cd7e252a76f1b562db61202effc310 + c046946464f132fc3f32ac0a02c54ac3d29ac1d7 - + https://github.com/dotnet/aspnetcore - 6f8b962b73cd7e252a76f1b562db61202effc310 + c046946464f132fc3f32ac0a02c54ac3d29ac1d7 - + https://github.com/dotnet/aspnetcore - 6f8b962b73cd7e252a76f1b562db61202effc310 + c046946464f132fc3f32ac0a02c54ac3d29ac1d7 diff --git a/eng/Versions.props b/eng/Versions.props index 31c5a61407a..4a8c1e88244 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -28,52 +28,52 @@ --> - 9.0.0-alpha.1.23470.17 - 9.0.0-alpha.1.23470.17 - 9.0.0-alpha.1.23470.17 - 9.0.0-alpha.1.23470.17 - 9.0.0-alpha.1.23470.17 - 9.0.0-alpha.1.23470.17 - 9.0.0-alpha.1.23470.17 - 9.0.0-alpha.1.23470.17 - 9.0.0-alpha.1.23470.17 - 9.0.0-alpha.1.23470.17 - 9.0.0-alpha.1.23470.17 - 9.0.0-alpha.1.23470.17 - 9.0.0-alpha.1.23470.17 - 9.0.0-alpha.1.23470.17 - 9.0.0-alpha.1.23470.17 - 9.0.0-alpha.1.23470.17 - 9.0.0-alpha.1.23470.17 - 9.0.0-alpha.1.23470.17 - 9.0.0-alpha.1.23470.17 - 9.0.0-alpha.1.23470.17 - 9.0.0-alpha.1.23470.17 - 9.0.0-alpha.1.23470.17 - 9.0.0-alpha.1.23470.17 - 9.0.0-alpha.1.23470.17 - 9.0.0-alpha.1.23470.17 - 9.0.0-alpha.1.23470.17 - 9.0.0-alpha.1.23470.17 - 9.0.0-alpha.1.23470.17 - 9.0.0-alpha.1.23470.17 - 9.0.0-alpha.1.23470.17 - 9.0.0-alpha.1.23470.17 - 9.0.0-alpha.1.23470.17 - 9.0.0-alpha.1.23470.17 - 9.0.0-alpha.1.23470.17 - 9.0.0-alpha.1.23470.17 + 9.0.0-alpha.1.23502.2 + 9.0.0-alpha.1.23502.2 + 9.0.0-alpha.1.23502.2 + 9.0.0-alpha.1.23502.2 + 9.0.0-alpha.1.23502.2 + 9.0.0-alpha.1.23502.2 + 9.0.0-alpha.1.23502.2 + 9.0.0-alpha.1.23502.2 + 9.0.0-alpha.1.23502.2 + 9.0.0-alpha.1.23502.2 + 9.0.0-alpha.1.23502.2 + 9.0.0-alpha.1.23502.2 + 9.0.0-alpha.1.23502.2 + 9.0.0-alpha.1.23502.2 + 9.0.0-alpha.1.23502.2 + 9.0.0-alpha.1.23502.2 + 9.0.0-alpha.1.23502.2 + 9.0.0-alpha.1.23502.2 + 9.0.0-alpha.1.23502.2 + 9.0.0-alpha.1.23502.2 + 9.0.0-alpha.1.23502.2 + 9.0.0-alpha.1.23502.2 + 9.0.0-alpha.1.23502.2 + 9.0.0-alpha.1.23502.2 + 9.0.0-alpha.1.23502.2 + 9.0.0-alpha.1.23502.2 + 9.0.0-alpha.1.23502.2 + 9.0.0-alpha.1.23502.2 + 9.0.0-alpha.1.23502.2 + 9.0.0-alpha.1.23502.2 + 9.0.0-alpha.1.23502.2 + 9.0.0-alpha.1.23502.2 + 9.0.0-alpha.1.23502.2 + 9.0.0-alpha.1.23502.2 + 9.0.0-alpha.1.23502.2 - 9.0.0-alpha.1.23476.39 - 9.0.0-alpha.1.23476.39 - 9.0.0-alpha.1.23476.39 - 9.0.0-alpha.1.23476.39 - 9.0.0-alpha.1.23476.39 - 9.0.0-alpha.1.23476.39 - 9.0.0-alpha.1.23476.39 - 9.0.0-alpha.1.23476.39 - 9.0.0-alpha.1.23476.39 - 9.0.0-alpha.1.23476.39 + 9.0.0-alpha.1.23502.21 + 9.0.0-alpha.1.23502.21 + 9.0.0-alpha.1.23502.21 + 9.0.0-alpha.1.23502.21 + 9.0.0-alpha.1.23502.21 + 9.0.0-alpha.1.23502.21 + 9.0.0-alpha.1.23502.21 + 9.0.0-alpha.1.23502.21 + 9.0.0-alpha.1.23502.21 + 9.0.0-alpha.1.23502.21 - + https://github.com/dotnet/runtime - f47c963e966f000b59c79dc9acb5305a07d0031a + 5c8055668b7af03022e368febc109e512013a292 - + https://github.com/dotnet/runtime - f47c963e966f000b59c79dc9acb5305a07d0031a + 5c8055668b7af03022e368febc109e512013a292 - + https://github.com/dotnet/runtime - f47c963e966f000b59c79dc9acb5305a07d0031a + 5c8055668b7af03022e368febc109e512013a292 - + https://github.com/dotnet/runtime - f47c963e966f000b59c79dc9acb5305a07d0031a + 5c8055668b7af03022e368febc109e512013a292 - + https://github.com/dotnet/runtime - f47c963e966f000b59c79dc9acb5305a07d0031a + 5c8055668b7af03022e368febc109e512013a292 - + https://github.com/dotnet/runtime - f47c963e966f000b59c79dc9acb5305a07d0031a + 5c8055668b7af03022e368febc109e512013a292 - + https://github.com/dotnet/runtime - f47c963e966f000b59c79dc9acb5305a07d0031a + 5c8055668b7af03022e368febc109e512013a292 - + https://github.com/dotnet/runtime - f47c963e966f000b59c79dc9acb5305a07d0031a + 5c8055668b7af03022e368febc109e512013a292 - + https://github.com/dotnet/runtime - f47c963e966f000b59c79dc9acb5305a07d0031a + 5c8055668b7af03022e368febc109e512013a292 - + https://github.com/dotnet/runtime - f47c963e966f000b59c79dc9acb5305a07d0031a + 5c8055668b7af03022e368febc109e512013a292 - + https://github.com/dotnet/runtime - f47c963e966f000b59c79dc9acb5305a07d0031a + 5c8055668b7af03022e368febc109e512013a292 - + https://github.com/dotnet/runtime - f47c963e966f000b59c79dc9acb5305a07d0031a + 5c8055668b7af03022e368febc109e512013a292 - + https://github.com/dotnet/aspnetcore - c046946464f132fc3f32ac0a02c54ac3d29ac1d7 + f49c1c7f7467c184ffb630086afac447772096c6 - + https://github.com/dotnet/aspnetcore - c046946464f132fc3f32ac0a02c54ac3d29ac1d7 + f49c1c7f7467c184ffb630086afac447772096c6 - + https://github.com/dotnet/aspnetcore - c046946464f132fc3f32ac0a02c54ac3d29ac1d7 + f49c1c7f7467c184ffb630086afac447772096c6 - + https://github.com/dotnet/aspnetcore - c046946464f132fc3f32ac0a02c54ac3d29ac1d7 + f49c1c7f7467c184ffb630086afac447772096c6 - + https://github.com/dotnet/aspnetcore - c046946464f132fc3f32ac0a02c54ac3d29ac1d7 + f49c1c7f7467c184ffb630086afac447772096c6 - + https://github.com/dotnet/aspnetcore - c046946464f132fc3f32ac0a02c54ac3d29ac1d7 + f49c1c7f7467c184ffb630086afac447772096c6 - + https://github.com/dotnet/aspnetcore - c046946464f132fc3f32ac0a02c54ac3d29ac1d7 + f49c1c7f7467c184ffb630086afac447772096c6 - + https://github.com/dotnet/aspnetcore - c046946464f132fc3f32ac0a02c54ac3d29ac1d7 + f49c1c7f7467c184ffb630086afac447772096c6 - + https://github.com/dotnet/aspnetcore - c046946464f132fc3f32ac0a02c54ac3d29ac1d7 + f49c1c7f7467c184ffb630086afac447772096c6 - + https://github.com/dotnet/aspnetcore - c046946464f132fc3f32ac0a02c54ac3d29ac1d7 + f49c1c7f7467c184ffb630086afac447772096c6 diff --git a/eng/Versions.props b/eng/Versions.props index 4a8c1e88244..368d5d716e3 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -28,52 +28,52 @@ --> - 9.0.0-alpha.1.23502.2 - 9.0.0-alpha.1.23502.2 - 9.0.0-alpha.1.23502.2 - 9.0.0-alpha.1.23502.2 - 9.0.0-alpha.1.23502.2 - 9.0.0-alpha.1.23502.2 - 9.0.0-alpha.1.23502.2 - 9.0.0-alpha.1.23502.2 - 9.0.0-alpha.1.23502.2 - 9.0.0-alpha.1.23502.2 - 9.0.0-alpha.1.23502.2 - 9.0.0-alpha.1.23502.2 - 9.0.0-alpha.1.23502.2 - 9.0.0-alpha.1.23502.2 - 9.0.0-alpha.1.23502.2 - 9.0.0-alpha.1.23502.2 - 9.0.0-alpha.1.23502.2 - 9.0.0-alpha.1.23502.2 - 9.0.0-alpha.1.23502.2 - 9.0.0-alpha.1.23502.2 - 9.0.0-alpha.1.23502.2 - 9.0.0-alpha.1.23502.2 - 9.0.0-alpha.1.23502.2 - 9.0.0-alpha.1.23502.2 - 9.0.0-alpha.1.23502.2 - 9.0.0-alpha.1.23502.2 - 9.0.0-alpha.1.23502.2 - 9.0.0-alpha.1.23502.2 - 9.0.0-alpha.1.23502.2 - 9.0.0-alpha.1.23502.2 - 9.0.0-alpha.1.23502.2 - 9.0.0-alpha.1.23502.2 - 9.0.0-alpha.1.23502.2 - 9.0.0-alpha.1.23502.2 - 9.0.0-alpha.1.23502.2 + 9.0.0-alpha.1.23503.1 + 9.0.0-alpha.1.23503.1 + 9.0.0-alpha.1.23503.1 + 9.0.0-alpha.1.23503.1 + 9.0.0-alpha.1.23503.1 + 9.0.0-alpha.1.23503.1 + 9.0.0-alpha.1.23503.1 + 9.0.0-alpha.1.23503.1 + 9.0.0-alpha.1.23503.1 + 9.0.0-alpha.1.23503.1 + 9.0.0-alpha.1.23503.1 + 9.0.0-alpha.1.23503.1 + 9.0.0-alpha.1.23503.1 + 9.0.0-alpha.1.23503.1 + 9.0.0-alpha.1.23503.1 + 9.0.0-alpha.1.23503.1 + 9.0.0-alpha.1.23503.1 + 9.0.0-alpha.1.23503.1 + 9.0.0-alpha.1.23503.1 + 9.0.0-alpha.1.23503.1 + 9.0.0-alpha.1.23503.1 + 9.0.0-alpha.1.23503.1 + 9.0.0-alpha.1.23503.1 + 9.0.0-alpha.1.23503.1 + 9.0.0-alpha.1.23503.1 + 9.0.0-alpha.1.23503.1 + 9.0.0-alpha.1.23503.1 + 9.0.0-alpha.1.23503.1 + 9.0.0-alpha.1.23503.1 + 9.0.0-alpha.1.23503.1 + 9.0.0-alpha.1.23503.1 + 9.0.0-alpha.1.23503.1 + 9.0.0-alpha.1.23503.1 + 9.0.0-alpha.1.23503.1 + 9.0.0-alpha.1.23503.1 - 9.0.0-alpha.1.23502.21 - 9.0.0-alpha.1.23502.21 - 9.0.0-alpha.1.23502.21 - 9.0.0-alpha.1.23502.21 - 9.0.0-alpha.1.23502.21 - 9.0.0-alpha.1.23502.21 - 9.0.0-alpha.1.23502.21 - 9.0.0-alpha.1.23502.21 - 9.0.0-alpha.1.23502.21 - 9.0.0-alpha.1.23502.21 + 9.0.0-alpha.1.23503.6 + 9.0.0-alpha.1.23503.6 + 9.0.0-alpha.1.23503.6 + 9.0.0-alpha.1.23503.6 + 9.0.0-alpha.1.23503.6 + 9.0.0-alpha.1.23503.6 + 9.0.0-alpha.1.23503.6 + 9.0.0-alpha.1.23503.6 + 9.0.0-alpha.1.23503.6 + 9.0.0-alpha.1.23503.6 - + https://github.com/dotnet/runtime - 5c8055668b7af03022e368febc109e512013a292 + 1d352cb36c06a16bc93e424809fb431d5795e741 - + https://github.com/dotnet/runtime - 5c8055668b7af03022e368febc109e512013a292 + 1d352cb36c06a16bc93e424809fb431d5795e741 - + https://github.com/dotnet/runtime - 5c8055668b7af03022e368febc109e512013a292 + 1d352cb36c06a16bc93e424809fb431d5795e741 - + https://github.com/dotnet/runtime - 5c8055668b7af03022e368febc109e512013a292 + 1d352cb36c06a16bc93e424809fb431d5795e741 - + https://github.com/dotnet/runtime - 5c8055668b7af03022e368febc109e512013a292 + 1d352cb36c06a16bc93e424809fb431d5795e741 - + https://github.com/dotnet/runtime - 5c8055668b7af03022e368febc109e512013a292 + 1d352cb36c06a16bc93e424809fb431d5795e741 - + https://github.com/dotnet/runtime - 5c8055668b7af03022e368febc109e512013a292 + 1d352cb36c06a16bc93e424809fb431d5795e741 - + https://github.com/dotnet/runtime - 5c8055668b7af03022e368febc109e512013a292 + 1d352cb36c06a16bc93e424809fb431d5795e741 - + https://github.com/dotnet/runtime - 5c8055668b7af03022e368febc109e512013a292 + 1d352cb36c06a16bc93e424809fb431d5795e741 - + https://github.com/dotnet/runtime - 5c8055668b7af03022e368febc109e512013a292 + 1d352cb36c06a16bc93e424809fb431d5795e741 - + https://github.com/dotnet/runtime - 5c8055668b7af03022e368febc109e512013a292 + 1d352cb36c06a16bc93e424809fb431d5795e741 - + https://github.com/dotnet/runtime - 5c8055668b7af03022e368febc109e512013a292 + 1d352cb36c06a16bc93e424809fb431d5795e741 - + https://github.com/dotnet/aspnetcore - f49c1c7f7467c184ffb630086afac447772096c6 + 933bc8447e10e3e4a327e8ac1c598935ddd294ae - + https://github.com/dotnet/aspnetcore - f49c1c7f7467c184ffb630086afac447772096c6 + 933bc8447e10e3e4a327e8ac1c598935ddd294ae - + https://github.com/dotnet/aspnetcore - f49c1c7f7467c184ffb630086afac447772096c6 + 933bc8447e10e3e4a327e8ac1c598935ddd294ae - + https://github.com/dotnet/aspnetcore - f49c1c7f7467c184ffb630086afac447772096c6 + 933bc8447e10e3e4a327e8ac1c598935ddd294ae - + https://github.com/dotnet/aspnetcore - f49c1c7f7467c184ffb630086afac447772096c6 + 933bc8447e10e3e4a327e8ac1c598935ddd294ae - + https://github.com/dotnet/aspnetcore - f49c1c7f7467c184ffb630086afac447772096c6 + 933bc8447e10e3e4a327e8ac1c598935ddd294ae - + https://github.com/dotnet/aspnetcore - f49c1c7f7467c184ffb630086afac447772096c6 + 933bc8447e10e3e4a327e8ac1c598935ddd294ae - + https://github.com/dotnet/aspnetcore - f49c1c7f7467c184ffb630086afac447772096c6 + 933bc8447e10e3e4a327e8ac1c598935ddd294ae - + https://github.com/dotnet/aspnetcore - f49c1c7f7467c184ffb630086afac447772096c6 + 933bc8447e10e3e4a327e8ac1c598935ddd294ae - + https://github.com/dotnet/aspnetcore - f49c1c7f7467c184ffb630086afac447772096c6 + 933bc8447e10e3e4a327e8ac1c598935ddd294ae diff --git a/eng/Versions.props b/eng/Versions.props index 368d5d716e3..8216569bb02 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -28,52 +28,52 @@ --> - 9.0.0-alpha.1.23503.1 - 9.0.0-alpha.1.23503.1 - 9.0.0-alpha.1.23503.1 - 9.0.0-alpha.1.23503.1 - 9.0.0-alpha.1.23503.1 - 9.0.0-alpha.1.23503.1 - 9.0.0-alpha.1.23503.1 - 9.0.0-alpha.1.23503.1 - 9.0.0-alpha.1.23503.1 - 9.0.0-alpha.1.23503.1 - 9.0.0-alpha.1.23503.1 - 9.0.0-alpha.1.23503.1 - 9.0.0-alpha.1.23503.1 - 9.0.0-alpha.1.23503.1 - 9.0.0-alpha.1.23503.1 - 9.0.0-alpha.1.23503.1 - 9.0.0-alpha.1.23503.1 - 9.0.0-alpha.1.23503.1 - 9.0.0-alpha.1.23503.1 - 9.0.0-alpha.1.23503.1 - 9.0.0-alpha.1.23503.1 - 9.0.0-alpha.1.23503.1 - 9.0.0-alpha.1.23503.1 - 9.0.0-alpha.1.23503.1 - 9.0.0-alpha.1.23503.1 - 9.0.0-alpha.1.23503.1 - 9.0.0-alpha.1.23503.1 - 9.0.0-alpha.1.23503.1 - 9.0.0-alpha.1.23503.1 - 9.0.0-alpha.1.23503.1 - 9.0.0-alpha.1.23503.1 - 9.0.0-alpha.1.23503.1 - 9.0.0-alpha.1.23503.1 - 9.0.0-alpha.1.23503.1 - 9.0.0-alpha.1.23503.1 + 9.0.0-alpha.1.23503.19 + 9.0.0-alpha.1.23503.19 + 9.0.0-alpha.1.23503.19 + 9.0.0-alpha.1.23503.19 + 9.0.0-alpha.1.23503.19 + 9.0.0-alpha.1.23503.19 + 9.0.0-alpha.1.23503.19 + 9.0.0-alpha.1.23503.19 + 9.0.0-alpha.1.23503.19 + 9.0.0-alpha.1.23503.19 + 9.0.0-alpha.1.23503.19 + 9.0.0-alpha.1.23503.19 + 9.0.0-alpha.1.23503.19 + 9.0.0-alpha.1.23503.19 + 9.0.0-alpha.1.23503.19 + 9.0.0-alpha.1.23503.19 + 9.0.0-alpha.1.23503.19 + 9.0.0-alpha.1.23503.19 + 9.0.0-alpha.1.23503.19 + 9.0.0-alpha.1.23503.19 + 9.0.0-alpha.1.23503.19 + 9.0.0-alpha.1.23503.19 + 9.0.0-alpha.1.23503.19 + 9.0.0-alpha.1.23503.19 + 9.0.0-alpha.1.23503.19 + 9.0.0-alpha.1.23503.19 + 9.0.0-alpha.1.23503.19 + 9.0.0-alpha.1.23503.19 + 9.0.0-alpha.1.23503.19 + 9.0.0-alpha.1.23503.19 + 9.0.0-alpha.1.23503.19 + 9.0.0-alpha.1.23503.19 + 9.0.0-alpha.1.23503.19 + 9.0.0-alpha.1.23503.19 + 9.0.0-alpha.1.23503.19 - 9.0.0-alpha.1.23503.6 - 9.0.0-alpha.1.23503.6 - 9.0.0-alpha.1.23503.6 - 9.0.0-alpha.1.23503.6 - 9.0.0-alpha.1.23503.6 - 9.0.0-alpha.1.23503.6 - 9.0.0-alpha.1.23503.6 - 9.0.0-alpha.1.23503.6 - 9.0.0-alpha.1.23503.6 - 9.0.0-alpha.1.23503.6 + 9.0.0-alpha.1.23504.22 + 9.0.0-alpha.1.23504.22 + 9.0.0-alpha.1.23504.22 + 9.0.0-alpha.1.23504.22 + 9.0.0-alpha.1.23504.22 + 9.0.0-alpha.1.23504.22 + 9.0.0-alpha.1.23504.22 + 9.0.0-alpha.1.23504.22 + 9.0.0-alpha.1.23504.22 + 9.0.0-alpha.1.23504.22 - 9.0.0-alpha.1.23504.22 - 9.0.0-alpha.1.23504.22 - 9.0.0-alpha.1.23504.22 - 9.0.0-alpha.1.23504.22 - 9.0.0-alpha.1.23504.22 - 9.0.0-alpha.1.23504.22 - 9.0.0-alpha.1.23504.22 - 9.0.0-alpha.1.23504.22 - 9.0.0-alpha.1.23504.22 - 9.0.0-alpha.1.23504.22 + 9.0.0-alpha.1.23505.5 + 9.0.0-alpha.1.23505.5 + 9.0.0-alpha.1.23505.5 + 9.0.0-alpha.1.23505.5 + 9.0.0-alpha.1.23505.5 + 9.0.0-alpha.1.23505.5 + 9.0.0-alpha.1.23505.5 + 9.0.0-alpha.1.23505.5 + 9.0.0-alpha.1.23505.5 + 9.0.0-alpha.1.23505.5 - + https://github.com/dotnet/runtime - 1d352cb36c06a16bc93e424809fb431d5795e741 + 915a2f90b67a73c4fb35cc92d60ba1f4616dce3d - + https://github.com/dotnet/runtime - 1d352cb36c06a16bc93e424809fb431d5795e741 + 915a2f90b67a73c4fb35cc92d60ba1f4616dce3d - + https://github.com/dotnet/runtime - 1d352cb36c06a16bc93e424809fb431d5795e741 + 915a2f90b67a73c4fb35cc92d60ba1f4616dce3d - + https://github.com/dotnet/runtime - 1d352cb36c06a16bc93e424809fb431d5795e741 + 915a2f90b67a73c4fb35cc92d60ba1f4616dce3d - + https://github.com/dotnet/runtime - 1d352cb36c06a16bc93e424809fb431d5795e741 + 915a2f90b67a73c4fb35cc92d60ba1f4616dce3d - + https://github.com/dotnet/runtime - 1d352cb36c06a16bc93e424809fb431d5795e741 + 915a2f90b67a73c4fb35cc92d60ba1f4616dce3d - + https://github.com/dotnet/runtime - 1d352cb36c06a16bc93e424809fb431d5795e741 + 915a2f90b67a73c4fb35cc92d60ba1f4616dce3d - + https://github.com/dotnet/runtime - 1d352cb36c06a16bc93e424809fb431d5795e741 + 915a2f90b67a73c4fb35cc92d60ba1f4616dce3d - + https://github.com/dotnet/runtime - 1d352cb36c06a16bc93e424809fb431d5795e741 + 915a2f90b67a73c4fb35cc92d60ba1f4616dce3d - + https://github.com/dotnet/runtime - 1d352cb36c06a16bc93e424809fb431d5795e741 + 915a2f90b67a73c4fb35cc92d60ba1f4616dce3d - + https://github.com/dotnet/runtime - 1d352cb36c06a16bc93e424809fb431d5795e741 + 915a2f90b67a73c4fb35cc92d60ba1f4616dce3d - + https://github.com/dotnet/runtime - 1d352cb36c06a16bc93e424809fb431d5795e741 + 915a2f90b67a73c4fb35cc92d60ba1f4616dce3d - + https://github.com/dotnet/aspnetcore - 4a252e441bfc93c82cabc69a65582e9d3290ba1b + e0aed17a16f5f6e5540925ef849bf87358fa10b3 - + https://github.com/dotnet/aspnetcore - 4a252e441bfc93c82cabc69a65582e9d3290ba1b + e0aed17a16f5f6e5540925ef849bf87358fa10b3 - + https://github.com/dotnet/aspnetcore - 4a252e441bfc93c82cabc69a65582e9d3290ba1b + e0aed17a16f5f6e5540925ef849bf87358fa10b3 - + https://github.com/dotnet/aspnetcore - 4a252e441bfc93c82cabc69a65582e9d3290ba1b + e0aed17a16f5f6e5540925ef849bf87358fa10b3 - + https://github.com/dotnet/aspnetcore - 4a252e441bfc93c82cabc69a65582e9d3290ba1b + e0aed17a16f5f6e5540925ef849bf87358fa10b3 - + https://github.com/dotnet/aspnetcore - 4a252e441bfc93c82cabc69a65582e9d3290ba1b + e0aed17a16f5f6e5540925ef849bf87358fa10b3 - + https://github.com/dotnet/aspnetcore - 4a252e441bfc93c82cabc69a65582e9d3290ba1b + e0aed17a16f5f6e5540925ef849bf87358fa10b3 - + https://github.com/dotnet/aspnetcore - 4a252e441bfc93c82cabc69a65582e9d3290ba1b + e0aed17a16f5f6e5540925ef849bf87358fa10b3 - + https://github.com/dotnet/aspnetcore - 4a252e441bfc93c82cabc69a65582e9d3290ba1b + e0aed17a16f5f6e5540925ef849bf87358fa10b3 - + https://github.com/dotnet/aspnetcore - 4a252e441bfc93c82cabc69a65582e9d3290ba1b + e0aed17a16f5f6e5540925ef849bf87358fa10b3 diff --git a/eng/Versions.props b/eng/Versions.props index 47d2e41cf66..6c112003112 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -28,52 +28,52 @@ --> - 9.0.0-alpha.1.23503.19 - 9.0.0-alpha.1.23503.19 - 9.0.0-alpha.1.23503.19 - 9.0.0-alpha.1.23503.19 - 9.0.0-alpha.1.23503.19 - 9.0.0-alpha.1.23503.19 - 9.0.0-alpha.1.23503.19 - 9.0.0-alpha.1.23503.19 - 9.0.0-alpha.1.23503.19 - 9.0.0-alpha.1.23503.19 - 9.0.0-alpha.1.23503.19 - 9.0.0-alpha.1.23503.19 - 9.0.0-alpha.1.23503.19 - 9.0.0-alpha.1.23503.19 - 9.0.0-alpha.1.23503.19 - 9.0.0-alpha.1.23503.19 - 9.0.0-alpha.1.23503.19 - 9.0.0-alpha.1.23503.19 - 9.0.0-alpha.1.23503.19 - 9.0.0-alpha.1.23503.19 - 9.0.0-alpha.1.23503.19 - 9.0.0-alpha.1.23503.19 - 9.0.0-alpha.1.23503.19 - 9.0.0-alpha.1.23503.19 - 9.0.0-alpha.1.23503.19 - 9.0.0-alpha.1.23503.19 - 9.0.0-alpha.1.23503.19 - 9.0.0-alpha.1.23503.19 - 9.0.0-alpha.1.23503.19 - 9.0.0-alpha.1.23503.19 - 9.0.0-alpha.1.23503.19 - 9.0.0-alpha.1.23503.19 - 9.0.0-alpha.1.23503.19 - 9.0.0-alpha.1.23503.19 - 9.0.0-alpha.1.23503.19 + 9.0.0-alpha.1.23506.3 + 9.0.0-alpha.1.23506.3 + 9.0.0-alpha.1.23506.3 + 9.0.0-alpha.1.23506.3 + 9.0.0-alpha.1.23506.3 + 9.0.0-alpha.1.23506.3 + 9.0.0-alpha.1.23506.3 + 9.0.0-alpha.1.23506.3 + 9.0.0-alpha.1.23506.3 + 9.0.0-alpha.1.23506.3 + 9.0.0-alpha.1.23506.3 + 9.0.0-alpha.1.23506.3 + 9.0.0-alpha.1.23506.3 + 9.0.0-alpha.1.23506.3 + 9.0.0-alpha.1.23506.3 + 9.0.0-alpha.1.23506.3 + 9.0.0-alpha.1.23506.3 + 9.0.0-alpha.1.23506.3 + 9.0.0-alpha.1.23506.3 + 9.0.0-alpha.1.23506.3 + 9.0.0-alpha.1.23506.3 + 9.0.0-alpha.1.23506.3 + 9.0.0-alpha.1.23506.3 + 9.0.0-alpha.1.23506.3 + 9.0.0-alpha.1.23506.3 + 9.0.0-alpha.1.23506.3 + 9.0.0-alpha.1.23506.3 + 9.0.0-alpha.1.23506.3 + 9.0.0-alpha.1.23506.3 + 9.0.0-alpha.1.23506.3 + 9.0.0-alpha.1.23506.3 + 9.0.0-alpha.1.23506.3 + 9.0.0-alpha.1.23506.3 + 9.0.0-alpha.1.23506.3 + 9.0.0-alpha.1.23506.3 - 9.0.0-alpha.1.23505.5 - 9.0.0-alpha.1.23505.5 - 9.0.0-alpha.1.23505.5 - 9.0.0-alpha.1.23505.5 - 9.0.0-alpha.1.23505.5 - 9.0.0-alpha.1.23505.5 - 9.0.0-alpha.1.23505.5 - 9.0.0-alpha.1.23505.5 - 9.0.0-alpha.1.23505.5 - 9.0.0-alpha.1.23505.5 + 9.0.0-alpha.1.23506.7 + 9.0.0-alpha.1.23506.7 + 9.0.0-alpha.1.23506.7 + 9.0.0-alpha.1.23506.7 + 9.0.0-alpha.1.23506.7 + 9.0.0-alpha.1.23506.7 + 9.0.0-alpha.1.23506.7 + 9.0.0-alpha.1.23506.7 + 9.0.0-alpha.1.23506.7 + 9.0.0-alpha.1.23506.7 - + https://github.com/dotnet/runtime - 915a2f90b67a73c4fb35cc92d60ba1f4616dce3d + 7204fbe5f56d52dd3fc4238e33de45f532f05d50 - + https://github.com/dotnet/runtime - 915a2f90b67a73c4fb35cc92d60ba1f4616dce3d + 7204fbe5f56d52dd3fc4238e33de45f532f05d50 - + https://github.com/dotnet/runtime - 915a2f90b67a73c4fb35cc92d60ba1f4616dce3d + 7204fbe5f56d52dd3fc4238e33de45f532f05d50 - + https://github.com/dotnet/runtime - 915a2f90b67a73c4fb35cc92d60ba1f4616dce3d + 7204fbe5f56d52dd3fc4238e33de45f532f05d50 - + https://github.com/dotnet/runtime - 915a2f90b67a73c4fb35cc92d60ba1f4616dce3d + 7204fbe5f56d52dd3fc4238e33de45f532f05d50 - + https://github.com/dotnet/runtime - 915a2f90b67a73c4fb35cc92d60ba1f4616dce3d + 7204fbe5f56d52dd3fc4238e33de45f532f05d50 - + https://github.com/dotnet/runtime - 915a2f90b67a73c4fb35cc92d60ba1f4616dce3d + 7204fbe5f56d52dd3fc4238e33de45f532f05d50 - + https://github.com/dotnet/runtime - 915a2f90b67a73c4fb35cc92d60ba1f4616dce3d + 7204fbe5f56d52dd3fc4238e33de45f532f05d50 - + https://github.com/dotnet/runtime - 915a2f90b67a73c4fb35cc92d60ba1f4616dce3d + 7204fbe5f56d52dd3fc4238e33de45f532f05d50 - + https://github.com/dotnet/runtime - 915a2f90b67a73c4fb35cc92d60ba1f4616dce3d + 7204fbe5f56d52dd3fc4238e33de45f532f05d50 - + https://github.com/dotnet/runtime - 915a2f90b67a73c4fb35cc92d60ba1f4616dce3d + 7204fbe5f56d52dd3fc4238e33de45f532f05d50 - + https://github.com/dotnet/runtime - 915a2f90b67a73c4fb35cc92d60ba1f4616dce3d + 7204fbe5f56d52dd3fc4238e33de45f532f05d50 - + https://github.com/dotnet/aspnetcore - e0aed17a16f5f6e5540925ef849bf87358fa10b3 + 923c83a76bb542629c323c0f380f5cd08afb3259 - + https://github.com/dotnet/aspnetcore - e0aed17a16f5f6e5540925ef849bf87358fa10b3 + 923c83a76bb542629c323c0f380f5cd08afb3259 - + https://github.com/dotnet/aspnetcore - e0aed17a16f5f6e5540925ef849bf87358fa10b3 + 923c83a76bb542629c323c0f380f5cd08afb3259 - + https://github.com/dotnet/aspnetcore - e0aed17a16f5f6e5540925ef849bf87358fa10b3 + 923c83a76bb542629c323c0f380f5cd08afb3259 - + https://github.com/dotnet/aspnetcore - e0aed17a16f5f6e5540925ef849bf87358fa10b3 + 923c83a76bb542629c323c0f380f5cd08afb3259 - + https://github.com/dotnet/aspnetcore - e0aed17a16f5f6e5540925ef849bf87358fa10b3 + 923c83a76bb542629c323c0f380f5cd08afb3259 - + https://github.com/dotnet/aspnetcore - e0aed17a16f5f6e5540925ef849bf87358fa10b3 + 923c83a76bb542629c323c0f380f5cd08afb3259 - + https://github.com/dotnet/aspnetcore - e0aed17a16f5f6e5540925ef849bf87358fa10b3 + 923c83a76bb542629c323c0f380f5cd08afb3259 - + https://github.com/dotnet/aspnetcore - e0aed17a16f5f6e5540925ef849bf87358fa10b3 + 923c83a76bb542629c323c0f380f5cd08afb3259 - + https://github.com/dotnet/aspnetcore - e0aed17a16f5f6e5540925ef849bf87358fa10b3 + 923c83a76bb542629c323c0f380f5cd08afb3259 diff --git a/eng/Versions.props b/eng/Versions.props index 6c112003112..c75ad1c445d 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -28,52 +28,52 @@ --> - 9.0.0-alpha.1.23506.3 - 9.0.0-alpha.1.23506.3 - 9.0.0-alpha.1.23506.3 - 9.0.0-alpha.1.23506.3 - 9.0.0-alpha.1.23506.3 - 9.0.0-alpha.1.23506.3 - 9.0.0-alpha.1.23506.3 - 9.0.0-alpha.1.23506.3 - 9.0.0-alpha.1.23506.3 - 9.0.0-alpha.1.23506.3 - 9.0.0-alpha.1.23506.3 - 9.0.0-alpha.1.23506.3 - 9.0.0-alpha.1.23506.3 - 9.0.0-alpha.1.23506.3 - 9.0.0-alpha.1.23506.3 - 9.0.0-alpha.1.23506.3 - 9.0.0-alpha.1.23506.3 - 9.0.0-alpha.1.23506.3 - 9.0.0-alpha.1.23506.3 - 9.0.0-alpha.1.23506.3 - 9.0.0-alpha.1.23506.3 - 9.0.0-alpha.1.23506.3 - 9.0.0-alpha.1.23506.3 - 9.0.0-alpha.1.23506.3 - 9.0.0-alpha.1.23506.3 - 9.0.0-alpha.1.23506.3 - 9.0.0-alpha.1.23506.3 - 9.0.0-alpha.1.23506.3 - 9.0.0-alpha.1.23506.3 - 9.0.0-alpha.1.23506.3 - 9.0.0-alpha.1.23506.3 - 9.0.0-alpha.1.23506.3 - 9.0.0-alpha.1.23506.3 - 9.0.0-alpha.1.23506.3 - 9.0.0-alpha.1.23506.3 + 9.0.0-alpha.1.23506.10 + 9.0.0-alpha.1.23506.10 + 9.0.0-alpha.1.23506.10 + 9.0.0-alpha.1.23506.10 + 9.0.0-alpha.1.23506.10 + 9.0.0-alpha.1.23506.10 + 9.0.0-alpha.1.23506.10 + 9.0.0-alpha.1.23506.10 + 9.0.0-alpha.1.23506.10 + 9.0.0-alpha.1.23506.10 + 9.0.0-alpha.1.23506.10 + 9.0.0-alpha.1.23506.10 + 9.0.0-alpha.1.23506.10 + 9.0.0-alpha.1.23506.10 + 9.0.0-alpha.1.23506.10 + 9.0.0-alpha.1.23506.10 + 9.0.0-alpha.1.23506.10 + 9.0.0-alpha.1.23506.10 + 9.0.0-alpha.1.23506.10 + 9.0.0-alpha.1.23506.10 + 9.0.0-alpha.1.23506.10 + 9.0.0-alpha.1.23506.10 + 9.0.0-alpha.1.23506.10 + 9.0.0-alpha.1.23506.10 + 9.0.0-alpha.1.23506.10 + 9.0.0-alpha.1.23506.10 + 9.0.0-alpha.1.23506.10 + 9.0.0-alpha.1.23506.10 + 9.0.0-alpha.1.23506.10 + 9.0.0-alpha.1.23506.10 + 9.0.0-alpha.1.23506.10 + 9.0.0-alpha.1.23506.10 + 9.0.0-alpha.1.23506.10 + 9.0.0-alpha.1.23506.10 + 9.0.0-alpha.1.23506.10 - 9.0.0-alpha.1.23506.7 - 9.0.0-alpha.1.23506.7 - 9.0.0-alpha.1.23506.7 - 9.0.0-alpha.1.23506.7 - 9.0.0-alpha.1.23506.7 - 9.0.0-alpha.1.23506.7 - 9.0.0-alpha.1.23506.7 - 9.0.0-alpha.1.23506.7 - 9.0.0-alpha.1.23506.7 - 9.0.0-alpha.1.23506.7 + 9.0.0-alpha.1.23507.1 + 9.0.0-alpha.1.23507.1 + 9.0.0-alpha.1.23507.1 + 9.0.0-alpha.1.23507.1 + 9.0.0-alpha.1.23507.1 + 9.0.0-alpha.1.23507.1 + 9.0.0-alpha.1.23507.1 + 9.0.0-alpha.1.23507.1 + 9.0.0-alpha.1.23507.1 + 9.0.0-alpha.1.23507.1 - + https://github.com/dotnet/runtime - 7204fbe5f56d52dd3fc4238e33de45f532f05d50 + f0208617e3c4f2e222adefa0b249d3af61400029 - + https://github.com/dotnet/runtime - 7204fbe5f56d52dd3fc4238e33de45f532f05d50 + f0208617e3c4f2e222adefa0b249d3af61400029 - + https://github.com/dotnet/runtime - 7204fbe5f56d52dd3fc4238e33de45f532f05d50 + f0208617e3c4f2e222adefa0b249d3af61400029 - + https://github.com/dotnet/runtime - 7204fbe5f56d52dd3fc4238e33de45f532f05d50 + f0208617e3c4f2e222adefa0b249d3af61400029 - + https://github.com/dotnet/runtime - 7204fbe5f56d52dd3fc4238e33de45f532f05d50 + f0208617e3c4f2e222adefa0b249d3af61400029 - + https://github.com/dotnet/runtime - 7204fbe5f56d52dd3fc4238e33de45f532f05d50 + f0208617e3c4f2e222adefa0b249d3af61400029 - + https://github.com/dotnet/runtime - 7204fbe5f56d52dd3fc4238e33de45f532f05d50 + f0208617e3c4f2e222adefa0b249d3af61400029 - + https://github.com/dotnet/runtime - 7204fbe5f56d52dd3fc4238e33de45f532f05d50 + f0208617e3c4f2e222adefa0b249d3af61400029 - + https://github.com/dotnet/runtime - 7204fbe5f56d52dd3fc4238e33de45f532f05d50 + f0208617e3c4f2e222adefa0b249d3af61400029 - + https://github.com/dotnet/runtime - 7204fbe5f56d52dd3fc4238e33de45f532f05d50 + f0208617e3c4f2e222adefa0b249d3af61400029 - + https://github.com/dotnet/runtime - 7204fbe5f56d52dd3fc4238e33de45f532f05d50 + f0208617e3c4f2e222adefa0b249d3af61400029 - + https://github.com/dotnet/runtime - 7204fbe5f56d52dd3fc4238e33de45f532f05d50 + f0208617e3c4f2e222adefa0b249d3af61400029 - + https://github.com/dotnet/aspnetcore - 923c83a76bb542629c323c0f380f5cd08afb3259 + 1bff5662061bcc4372a07d1c4d18c64ee0e698ae - + https://github.com/dotnet/aspnetcore - 923c83a76bb542629c323c0f380f5cd08afb3259 + 1bff5662061bcc4372a07d1c4d18c64ee0e698ae - + https://github.com/dotnet/aspnetcore - 923c83a76bb542629c323c0f380f5cd08afb3259 + 1bff5662061bcc4372a07d1c4d18c64ee0e698ae - + https://github.com/dotnet/aspnetcore - 923c83a76bb542629c323c0f380f5cd08afb3259 + 1bff5662061bcc4372a07d1c4d18c64ee0e698ae - + https://github.com/dotnet/aspnetcore - 923c83a76bb542629c323c0f380f5cd08afb3259 + 1bff5662061bcc4372a07d1c4d18c64ee0e698ae - + https://github.com/dotnet/aspnetcore - 923c83a76bb542629c323c0f380f5cd08afb3259 + 1bff5662061bcc4372a07d1c4d18c64ee0e698ae - + https://github.com/dotnet/aspnetcore - 923c83a76bb542629c323c0f380f5cd08afb3259 + 1bff5662061bcc4372a07d1c4d18c64ee0e698ae - + https://github.com/dotnet/aspnetcore - 923c83a76bb542629c323c0f380f5cd08afb3259 + 1bff5662061bcc4372a07d1c4d18c64ee0e698ae - + https://github.com/dotnet/aspnetcore - 923c83a76bb542629c323c0f380f5cd08afb3259 + 1bff5662061bcc4372a07d1c4d18c64ee0e698ae - + https://github.com/dotnet/aspnetcore - 923c83a76bb542629c323c0f380f5cd08afb3259 + 1bff5662061bcc4372a07d1c4d18c64ee0e698ae diff --git a/eng/Versions.props b/eng/Versions.props index c75ad1c445d..1e1498297dc 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -28,52 +28,52 @@ --> - 9.0.0-alpha.1.23506.10 - 9.0.0-alpha.1.23506.10 - 9.0.0-alpha.1.23506.10 - 9.0.0-alpha.1.23506.10 - 9.0.0-alpha.1.23506.10 - 9.0.0-alpha.1.23506.10 - 9.0.0-alpha.1.23506.10 - 9.0.0-alpha.1.23506.10 - 9.0.0-alpha.1.23506.10 - 9.0.0-alpha.1.23506.10 - 9.0.0-alpha.1.23506.10 - 9.0.0-alpha.1.23506.10 - 9.0.0-alpha.1.23506.10 - 9.0.0-alpha.1.23506.10 - 9.0.0-alpha.1.23506.10 - 9.0.0-alpha.1.23506.10 - 9.0.0-alpha.1.23506.10 - 9.0.0-alpha.1.23506.10 - 9.0.0-alpha.1.23506.10 - 9.0.0-alpha.1.23506.10 - 9.0.0-alpha.1.23506.10 - 9.0.0-alpha.1.23506.10 - 9.0.0-alpha.1.23506.10 - 9.0.0-alpha.1.23506.10 - 9.0.0-alpha.1.23506.10 - 9.0.0-alpha.1.23506.10 - 9.0.0-alpha.1.23506.10 - 9.0.0-alpha.1.23506.10 - 9.0.0-alpha.1.23506.10 - 9.0.0-alpha.1.23506.10 - 9.0.0-alpha.1.23506.10 - 9.0.0-alpha.1.23506.10 - 9.0.0-alpha.1.23506.10 - 9.0.0-alpha.1.23506.10 - 9.0.0-alpha.1.23506.10 + 9.0.0-alpha.1.23508.1 + 9.0.0-alpha.1.23508.1 + 9.0.0-alpha.1.23508.1 + 9.0.0-alpha.1.23508.1 + 9.0.0-alpha.1.23508.1 + 9.0.0-alpha.1.23508.1 + 9.0.0-alpha.1.23508.1 + 9.0.0-alpha.1.23508.1 + 9.0.0-alpha.1.23508.1 + 9.0.0-alpha.1.23508.1 + 9.0.0-alpha.1.23508.1 + 9.0.0-alpha.1.23508.1 + 9.0.0-alpha.1.23508.1 + 9.0.0-alpha.1.23508.1 + 9.0.0-alpha.1.23508.1 + 9.0.0-alpha.1.23508.1 + 9.0.0-alpha.1.23508.1 + 9.0.0-alpha.1.23508.1 + 9.0.0-alpha.1.23508.1 + 9.0.0-alpha.1.23508.1 + 9.0.0-alpha.1.23508.1 + 9.0.0-alpha.1.23508.1 + 9.0.0-alpha.1.23508.1 + 9.0.0-alpha.1.23508.1 + 9.0.0-alpha.1.23508.1 + 9.0.0-alpha.1.23508.1 + 9.0.0-alpha.1.23508.1 + 9.0.0-alpha.1.23508.1 + 9.0.0-alpha.1.23508.1 + 9.0.0-alpha.1.23508.1 + 9.0.0-alpha.1.23508.1 + 9.0.0-alpha.1.23508.1 + 9.0.0-alpha.1.23508.1 + 9.0.0-alpha.1.23508.1 + 9.0.0-alpha.1.23508.1 - 9.0.0-alpha.1.23507.1 - 9.0.0-alpha.1.23507.1 - 9.0.0-alpha.1.23507.1 - 9.0.0-alpha.1.23507.1 - 9.0.0-alpha.1.23507.1 - 9.0.0-alpha.1.23507.1 - 9.0.0-alpha.1.23507.1 - 9.0.0-alpha.1.23507.1 - 9.0.0-alpha.1.23507.1 - 9.0.0-alpha.1.23507.1 + 9.0.0-alpha.1.23508.2 + 9.0.0-alpha.1.23508.2 + 9.0.0-alpha.1.23508.2 + 9.0.0-alpha.1.23508.2 + 9.0.0-alpha.1.23508.2 + 9.0.0-alpha.1.23508.2 + 9.0.0-alpha.1.23508.2 + 9.0.0-alpha.1.23508.2 + 9.0.0-alpha.1.23508.2 + 9.0.0-alpha.1.23508.2 - + https://github.com/dotnet/runtime - f0208617e3c4f2e222adefa0b249d3af61400029 + 765798c49d5d908e512af0931b18fed782b4cf00 - + https://github.com/dotnet/runtime - f0208617e3c4f2e222adefa0b249d3af61400029 + 765798c49d5d908e512af0931b18fed782b4cf00 - + https://github.com/dotnet/runtime - f0208617e3c4f2e222adefa0b249d3af61400029 + 765798c49d5d908e512af0931b18fed782b4cf00 - + https://github.com/dotnet/runtime - f0208617e3c4f2e222adefa0b249d3af61400029 + 765798c49d5d908e512af0931b18fed782b4cf00 - + https://github.com/dotnet/runtime - f0208617e3c4f2e222adefa0b249d3af61400029 + 765798c49d5d908e512af0931b18fed782b4cf00 - + https://github.com/dotnet/runtime - f0208617e3c4f2e222adefa0b249d3af61400029 + 765798c49d5d908e512af0931b18fed782b4cf00 - + https://github.com/dotnet/runtime - f0208617e3c4f2e222adefa0b249d3af61400029 + 765798c49d5d908e512af0931b18fed782b4cf00 - + https://github.com/dotnet/runtime - f0208617e3c4f2e222adefa0b249d3af61400029 + 765798c49d5d908e512af0931b18fed782b4cf00 - + https://github.com/dotnet/runtime - f0208617e3c4f2e222adefa0b249d3af61400029 + 765798c49d5d908e512af0931b18fed782b4cf00 - + https://github.com/dotnet/runtime - f0208617e3c4f2e222adefa0b249d3af61400029 + 765798c49d5d908e512af0931b18fed782b4cf00 - + https://github.com/dotnet/runtime - f0208617e3c4f2e222adefa0b249d3af61400029 + 765798c49d5d908e512af0931b18fed782b4cf00 - + https://github.com/dotnet/runtime - f0208617e3c4f2e222adefa0b249d3af61400029 + 765798c49d5d908e512af0931b18fed782b4cf00 - + https://github.com/dotnet/aspnetcore - 1bff5662061bcc4372a07d1c4d18c64ee0e698ae + 16f8b03c2f5b4d3bc82a92ddafc642182e39c1b7 - + https://github.com/dotnet/aspnetcore - 1bff5662061bcc4372a07d1c4d18c64ee0e698ae + 16f8b03c2f5b4d3bc82a92ddafc642182e39c1b7 - + https://github.com/dotnet/aspnetcore - 1bff5662061bcc4372a07d1c4d18c64ee0e698ae + 16f8b03c2f5b4d3bc82a92ddafc642182e39c1b7 - + https://github.com/dotnet/aspnetcore - 1bff5662061bcc4372a07d1c4d18c64ee0e698ae + 16f8b03c2f5b4d3bc82a92ddafc642182e39c1b7 - + https://github.com/dotnet/aspnetcore - 1bff5662061bcc4372a07d1c4d18c64ee0e698ae + 16f8b03c2f5b4d3bc82a92ddafc642182e39c1b7 - + https://github.com/dotnet/aspnetcore - 1bff5662061bcc4372a07d1c4d18c64ee0e698ae + 16f8b03c2f5b4d3bc82a92ddafc642182e39c1b7 - + https://github.com/dotnet/aspnetcore - 1bff5662061bcc4372a07d1c4d18c64ee0e698ae + 16f8b03c2f5b4d3bc82a92ddafc642182e39c1b7 - + https://github.com/dotnet/aspnetcore - 1bff5662061bcc4372a07d1c4d18c64ee0e698ae + 16f8b03c2f5b4d3bc82a92ddafc642182e39c1b7 - + https://github.com/dotnet/aspnetcore - 1bff5662061bcc4372a07d1c4d18c64ee0e698ae + 16f8b03c2f5b4d3bc82a92ddafc642182e39c1b7 - + https://github.com/dotnet/aspnetcore - 1bff5662061bcc4372a07d1c4d18c64ee0e698ae + 16f8b03c2f5b4d3bc82a92ddafc642182e39c1b7 diff --git a/eng/Versions.props b/eng/Versions.props index 1e1498297dc..65d931b3752 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -28,52 +28,52 @@ --> - 9.0.0-alpha.1.23508.1 - 9.0.0-alpha.1.23508.1 - 9.0.0-alpha.1.23508.1 - 9.0.0-alpha.1.23508.1 - 9.0.0-alpha.1.23508.1 - 9.0.0-alpha.1.23508.1 - 9.0.0-alpha.1.23508.1 - 9.0.0-alpha.1.23508.1 - 9.0.0-alpha.1.23508.1 - 9.0.0-alpha.1.23508.1 - 9.0.0-alpha.1.23508.1 - 9.0.0-alpha.1.23508.1 - 9.0.0-alpha.1.23508.1 - 9.0.0-alpha.1.23508.1 - 9.0.0-alpha.1.23508.1 - 9.0.0-alpha.1.23508.1 - 9.0.0-alpha.1.23508.1 - 9.0.0-alpha.1.23508.1 - 9.0.0-alpha.1.23508.1 - 9.0.0-alpha.1.23508.1 - 9.0.0-alpha.1.23508.1 - 9.0.0-alpha.1.23508.1 - 9.0.0-alpha.1.23508.1 - 9.0.0-alpha.1.23508.1 - 9.0.0-alpha.1.23508.1 - 9.0.0-alpha.1.23508.1 - 9.0.0-alpha.1.23508.1 - 9.0.0-alpha.1.23508.1 - 9.0.0-alpha.1.23508.1 - 9.0.0-alpha.1.23508.1 - 9.0.0-alpha.1.23508.1 - 9.0.0-alpha.1.23508.1 - 9.0.0-alpha.1.23508.1 - 9.0.0-alpha.1.23508.1 - 9.0.0-alpha.1.23508.1 + 9.0.0-alpha.1.23514.1 + 9.0.0-alpha.1.23514.1 + 9.0.0-alpha.1.23514.1 + 9.0.0-alpha.1.23514.1 + 9.0.0-alpha.1.23514.1 + 9.0.0-alpha.1.23514.1 + 9.0.0-alpha.1.23514.1 + 9.0.0-alpha.1.23514.1 + 9.0.0-alpha.1.23514.1 + 9.0.0-alpha.1.23514.1 + 9.0.0-alpha.1.23514.1 + 9.0.0-alpha.1.23514.1 + 9.0.0-alpha.1.23514.1 + 9.0.0-alpha.1.23514.1 + 9.0.0-alpha.1.23514.1 + 9.0.0-alpha.1.23514.1 + 9.0.0-alpha.1.23514.1 + 9.0.0-alpha.1.23514.1 + 9.0.0-alpha.1.23514.1 + 9.0.0-alpha.1.23514.1 + 9.0.0-alpha.1.23514.1 + 9.0.0-alpha.1.23514.1 + 9.0.0-alpha.1.23514.1 + 9.0.0-alpha.1.23514.1 + 9.0.0-alpha.1.23514.1 + 9.0.0-alpha.1.23514.1 + 9.0.0-alpha.1.23514.1 + 9.0.0-alpha.1.23514.1 + 9.0.0-alpha.1.23514.1 + 9.0.0-alpha.1.23514.1 + 9.0.0-alpha.1.23514.1 + 9.0.0-alpha.1.23514.1 + 9.0.0-alpha.1.23514.1 + 9.0.0-alpha.1.23514.1 + 9.0.0-alpha.1.23514.1 - 9.0.0-alpha.1.23508.2 - 9.0.0-alpha.1.23508.2 - 9.0.0-alpha.1.23508.2 - 9.0.0-alpha.1.23508.2 - 9.0.0-alpha.1.23508.2 - 9.0.0-alpha.1.23508.2 - 9.0.0-alpha.1.23508.2 - 9.0.0-alpha.1.23508.2 - 9.0.0-alpha.1.23508.2 - 9.0.0-alpha.1.23508.2 + 9.0.0-alpha.1.23514.3 + 9.0.0-alpha.1.23514.3 + 9.0.0-alpha.1.23514.3 + 9.0.0-alpha.1.23514.3 + 9.0.0-alpha.1.23514.3 + 9.0.0-alpha.1.23514.3 + 9.0.0-alpha.1.23514.3 + 9.0.0-alpha.1.23514.3 + 9.0.0-alpha.1.23514.3 + 9.0.0-alpha.1.23514.3 - + https://github.com/dotnet/runtime - 765798c49d5d908e512af0931b18fed782b4cf00 + 3e0afa65b43fe5574066236992d6f2c58a461635 - + https://github.com/dotnet/runtime - 765798c49d5d908e512af0931b18fed782b4cf00 + 3e0afa65b43fe5574066236992d6f2c58a461635 - + https://github.com/dotnet/runtime - 765798c49d5d908e512af0931b18fed782b4cf00 + 3e0afa65b43fe5574066236992d6f2c58a461635 - + https://github.com/dotnet/runtime - 765798c49d5d908e512af0931b18fed782b4cf00 + 3e0afa65b43fe5574066236992d6f2c58a461635 - + https://github.com/dotnet/runtime - 765798c49d5d908e512af0931b18fed782b4cf00 + 3e0afa65b43fe5574066236992d6f2c58a461635 - + https://github.com/dotnet/runtime - 765798c49d5d908e512af0931b18fed782b4cf00 + 3e0afa65b43fe5574066236992d6f2c58a461635 - + https://github.com/dotnet/runtime - 765798c49d5d908e512af0931b18fed782b4cf00 + 3e0afa65b43fe5574066236992d6f2c58a461635 - + https://github.com/dotnet/runtime - 765798c49d5d908e512af0931b18fed782b4cf00 + 3e0afa65b43fe5574066236992d6f2c58a461635 - + https://github.com/dotnet/runtime - 765798c49d5d908e512af0931b18fed782b4cf00 + 3e0afa65b43fe5574066236992d6f2c58a461635 - + https://github.com/dotnet/runtime - 765798c49d5d908e512af0931b18fed782b4cf00 + 3e0afa65b43fe5574066236992d6f2c58a461635 - + https://github.com/dotnet/runtime - 765798c49d5d908e512af0931b18fed782b4cf00 + 3e0afa65b43fe5574066236992d6f2c58a461635 - + https://github.com/dotnet/runtime - 765798c49d5d908e512af0931b18fed782b4cf00 + 3e0afa65b43fe5574066236992d6f2c58a461635 - + https://github.com/dotnet/aspnetcore - 16f8b03c2f5b4d3bc82a92ddafc642182e39c1b7 + 6e1cebdcb07c3577023f68825b20c60a3692d540 - + https://github.com/dotnet/aspnetcore - 16f8b03c2f5b4d3bc82a92ddafc642182e39c1b7 + 6e1cebdcb07c3577023f68825b20c60a3692d540 - + https://github.com/dotnet/aspnetcore - 16f8b03c2f5b4d3bc82a92ddafc642182e39c1b7 + 6e1cebdcb07c3577023f68825b20c60a3692d540 - + https://github.com/dotnet/aspnetcore - 16f8b03c2f5b4d3bc82a92ddafc642182e39c1b7 + 6e1cebdcb07c3577023f68825b20c60a3692d540 - + https://github.com/dotnet/aspnetcore - 16f8b03c2f5b4d3bc82a92ddafc642182e39c1b7 + 6e1cebdcb07c3577023f68825b20c60a3692d540 - + https://github.com/dotnet/aspnetcore - 16f8b03c2f5b4d3bc82a92ddafc642182e39c1b7 + 6e1cebdcb07c3577023f68825b20c60a3692d540 - + https://github.com/dotnet/aspnetcore - 16f8b03c2f5b4d3bc82a92ddafc642182e39c1b7 + 6e1cebdcb07c3577023f68825b20c60a3692d540 - + https://github.com/dotnet/aspnetcore - 16f8b03c2f5b4d3bc82a92ddafc642182e39c1b7 + 6e1cebdcb07c3577023f68825b20c60a3692d540 - + https://github.com/dotnet/aspnetcore - 16f8b03c2f5b4d3bc82a92ddafc642182e39c1b7 + 6e1cebdcb07c3577023f68825b20c60a3692d540 - + https://github.com/dotnet/aspnetcore - 16f8b03c2f5b4d3bc82a92ddafc642182e39c1b7 + 6e1cebdcb07c3577023f68825b20c60a3692d540 diff --git a/eng/Versions.props b/eng/Versions.props index 65d931b3752..69ea3217bf0 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -28,52 +28,52 @@ --> - 9.0.0-alpha.1.23514.1 - 9.0.0-alpha.1.23514.1 - 9.0.0-alpha.1.23514.1 - 9.0.0-alpha.1.23514.1 - 9.0.0-alpha.1.23514.1 - 9.0.0-alpha.1.23514.1 - 9.0.0-alpha.1.23514.1 - 9.0.0-alpha.1.23514.1 - 9.0.0-alpha.1.23514.1 - 9.0.0-alpha.1.23514.1 - 9.0.0-alpha.1.23514.1 - 9.0.0-alpha.1.23514.1 - 9.0.0-alpha.1.23514.1 - 9.0.0-alpha.1.23514.1 - 9.0.0-alpha.1.23514.1 - 9.0.0-alpha.1.23514.1 - 9.0.0-alpha.1.23514.1 - 9.0.0-alpha.1.23514.1 - 9.0.0-alpha.1.23514.1 - 9.0.0-alpha.1.23514.1 - 9.0.0-alpha.1.23514.1 - 9.0.0-alpha.1.23514.1 - 9.0.0-alpha.1.23514.1 - 9.0.0-alpha.1.23514.1 - 9.0.0-alpha.1.23514.1 - 9.0.0-alpha.1.23514.1 - 9.0.0-alpha.1.23514.1 - 9.0.0-alpha.1.23514.1 - 9.0.0-alpha.1.23514.1 - 9.0.0-alpha.1.23514.1 - 9.0.0-alpha.1.23514.1 - 9.0.0-alpha.1.23514.1 - 9.0.0-alpha.1.23514.1 - 9.0.0-alpha.1.23514.1 - 9.0.0-alpha.1.23514.1 + 9.0.0-alpha.1.23514.5 + 9.0.0-alpha.1.23514.5 + 9.0.0-alpha.1.23514.5 + 9.0.0-alpha.1.23514.5 + 9.0.0-alpha.1.23514.5 + 9.0.0-alpha.1.23514.5 + 9.0.0-alpha.1.23514.5 + 9.0.0-alpha.1.23514.5 + 9.0.0-alpha.1.23514.5 + 9.0.0-alpha.1.23514.5 + 9.0.0-alpha.1.23514.5 + 9.0.0-alpha.1.23514.5 + 9.0.0-alpha.1.23514.5 + 9.0.0-alpha.1.23514.5 + 9.0.0-alpha.1.23514.5 + 9.0.0-alpha.1.23514.5 + 9.0.0-alpha.1.23514.5 + 9.0.0-alpha.1.23514.5 + 9.0.0-alpha.1.23514.5 + 9.0.0-alpha.1.23514.5 + 9.0.0-alpha.1.23514.5 + 9.0.0-alpha.1.23514.5 + 9.0.0-alpha.1.23514.5 + 9.0.0-alpha.1.23514.5 + 9.0.0-alpha.1.23514.5 + 9.0.0-alpha.1.23514.5 + 9.0.0-alpha.1.23514.5 + 9.0.0-alpha.1.23514.5 + 9.0.0-alpha.1.23514.5 + 9.0.0-alpha.1.23514.5 + 9.0.0-alpha.1.23514.5 + 9.0.0-alpha.1.23514.5 + 9.0.0-alpha.1.23514.5 + 9.0.0-alpha.1.23514.5 + 9.0.0-alpha.1.23514.5 - 9.0.0-alpha.1.23514.3 - 9.0.0-alpha.1.23514.3 - 9.0.0-alpha.1.23514.3 - 9.0.0-alpha.1.23514.3 - 9.0.0-alpha.1.23514.3 - 9.0.0-alpha.1.23514.3 - 9.0.0-alpha.1.23514.3 - 9.0.0-alpha.1.23514.3 - 9.0.0-alpha.1.23514.3 - 9.0.0-alpha.1.23514.3 + 9.0.0-alpha.1.23515.3 + 9.0.0-alpha.1.23515.3 + 9.0.0-alpha.1.23515.3 + 9.0.0-alpha.1.23515.3 + 9.0.0-alpha.1.23515.3 + 9.0.0-alpha.1.23515.3 + 9.0.0-alpha.1.23515.3 + 9.0.0-alpha.1.23515.3 + 9.0.0-alpha.1.23515.3 + 9.0.0-alpha.1.23515.3 - + https://github.com/dotnet/runtime - 3e0afa65b43fe5574066236992d6f2c58a461635 + b9159ab91a5dbd124dd15d78ed073c52eba8c31b - + https://github.com/dotnet/runtime - 3e0afa65b43fe5574066236992d6f2c58a461635 + b9159ab91a5dbd124dd15d78ed073c52eba8c31b - + https://github.com/dotnet/runtime - 3e0afa65b43fe5574066236992d6f2c58a461635 + b9159ab91a5dbd124dd15d78ed073c52eba8c31b - + https://github.com/dotnet/runtime - 3e0afa65b43fe5574066236992d6f2c58a461635 + b9159ab91a5dbd124dd15d78ed073c52eba8c31b - + https://github.com/dotnet/runtime - 3e0afa65b43fe5574066236992d6f2c58a461635 + b9159ab91a5dbd124dd15d78ed073c52eba8c31b - + https://github.com/dotnet/runtime - 3e0afa65b43fe5574066236992d6f2c58a461635 + b9159ab91a5dbd124dd15d78ed073c52eba8c31b - + https://github.com/dotnet/runtime - 3e0afa65b43fe5574066236992d6f2c58a461635 + b9159ab91a5dbd124dd15d78ed073c52eba8c31b - + https://github.com/dotnet/runtime - 3e0afa65b43fe5574066236992d6f2c58a461635 + b9159ab91a5dbd124dd15d78ed073c52eba8c31b - + https://github.com/dotnet/runtime - 3e0afa65b43fe5574066236992d6f2c58a461635 + b9159ab91a5dbd124dd15d78ed073c52eba8c31b - + https://github.com/dotnet/runtime - 3e0afa65b43fe5574066236992d6f2c58a461635 + b9159ab91a5dbd124dd15d78ed073c52eba8c31b - + https://github.com/dotnet/runtime - 3e0afa65b43fe5574066236992d6f2c58a461635 + b9159ab91a5dbd124dd15d78ed073c52eba8c31b - + https://github.com/dotnet/runtime - 3e0afa65b43fe5574066236992d6f2c58a461635 + b9159ab91a5dbd124dd15d78ed073c52eba8c31b - + https://github.com/dotnet/aspnetcore - 6e1cebdcb07c3577023f68825b20c60a3692d540 + b24cb43af229f8d2d778fbcbacfee9f06d980691 - + https://github.com/dotnet/aspnetcore - 6e1cebdcb07c3577023f68825b20c60a3692d540 + b24cb43af229f8d2d778fbcbacfee9f06d980691 - + https://github.com/dotnet/aspnetcore - 6e1cebdcb07c3577023f68825b20c60a3692d540 + b24cb43af229f8d2d778fbcbacfee9f06d980691 - + https://github.com/dotnet/aspnetcore - 6e1cebdcb07c3577023f68825b20c60a3692d540 + b24cb43af229f8d2d778fbcbacfee9f06d980691 - + https://github.com/dotnet/aspnetcore - 6e1cebdcb07c3577023f68825b20c60a3692d540 + b24cb43af229f8d2d778fbcbacfee9f06d980691 - + https://github.com/dotnet/aspnetcore - 6e1cebdcb07c3577023f68825b20c60a3692d540 + b24cb43af229f8d2d778fbcbacfee9f06d980691 - + https://github.com/dotnet/aspnetcore - 6e1cebdcb07c3577023f68825b20c60a3692d540 + b24cb43af229f8d2d778fbcbacfee9f06d980691 - + https://github.com/dotnet/aspnetcore - 6e1cebdcb07c3577023f68825b20c60a3692d540 + b24cb43af229f8d2d778fbcbacfee9f06d980691 - + https://github.com/dotnet/aspnetcore - 6e1cebdcb07c3577023f68825b20c60a3692d540 + b24cb43af229f8d2d778fbcbacfee9f06d980691 - + https://github.com/dotnet/aspnetcore - 6e1cebdcb07c3577023f68825b20c60a3692d540 + b24cb43af229f8d2d778fbcbacfee9f06d980691 diff --git a/eng/Versions.props b/eng/Versions.props index 69ea3217bf0..23a36960316 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -28,52 +28,52 @@ --> - 9.0.0-alpha.1.23514.5 - 9.0.0-alpha.1.23514.5 - 9.0.0-alpha.1.23514.5 - 9.0.0-alpha.1.23514.5 - 9.0.0-alpha.1.23514.5 - 9.0.0-alpha.1.23514.5 - 9.0.0-alpha.1.23514.5 - 9.0.0-alpha.1.23514.5 - 9.0.0-alpha.1.23514.5 - 9.0.0-alpha.1.23514.5 - 9.0.0-alpha.1.23514.5 - 9.0.0-alpha.1.23514.5 - 9.0.0-alpha.1.23514.5 - 9.0.0-alpha.1.23514.5 - 9.0.0-alpha.1.23514.5 - 9.0.0-alpha.1.23514.5 - 9.0.0-alpha.1.23514.5 - 9.0.0-alpha.1.23514.5 - 9.0.0-alpha.1.23514.5 - 9.0.0-alpha.1.23514.5 - 9.0.0-alpha.1.23514.5 - 9.0.0-alpha.1.23514.5 - 9.0.0-alpha.1.23514.5 - 9.0.0-alpha.1.23514.5 - 9.0.0-alpha.1.23514.5 - 9.0.0-alpha.1.23514.5 - 9.0.0-alpha.1.23514.5 - 9.0.0-alpha.1.23514.5 - 9.0.0-alpha.1.23514.5 - 9.0.0-alpha.1.23514.5 - 9.0.0-alpha.1.23514.5 - 9.0.0-alpha.1.23514.5 - 9.0.0-alpha.1.23514.5 - 9.0.0-alpha.1.23514.5 - 9.0.0-alpha.1.23514.5 + 9.0.0-alpha.1.23515.3 + 9.0.0-alpha.1.23515.3 + 9.0.0-alpha.1.23515.3 + 9.0.0-alpha.1.23515.3 + 9.0.0-alpha.1.23515.3 + 9.0.0-alpha.1.23515.3 + 9.0.0-alpha.1.23515.3 + 9.0.0-alpha.1.23515.3 + 9.0.0-alpha.1.23515.3 + 9.0.0-alpha.1.23515.3 + 9.0.0-alpha.1.23515.3 + 9.0.0-alpha.1.23515.3 + 9.0.0-alpha.1.23515.3 + 9.0.0-alpha.1.23515.3 + 9.0.0-alpha.1.23515.3 + 9.0.0-alpha.1.23515.3 + 9.0.0-alpha.1.23515.3 + 9.0.0-alpha.1.23515.3 + 9.0.0-alpha.1.23515.3 + 9.0.0-alpha.1.23515.3 + 9.0.0-alpha.1.23515.3 + 9.0.0-alpha.1.23515.3 + 9.0.0-alpha.1.23515.3 + 9.0.0-alpha.1.23515.3 + 9.0.0-alpha.1.23515.3 + 9.0.0-alpha.1.23515.3 + 9.0.0-alpha.1.23515.3 + 9.0.0-alpha.1.23515.3 + 9.0.0-alpha.1.23515.3 + 9.0.0-alpha.1.23515.3 + 9.0.0-alpha.1.23515.3 + 9.0.0-alpha.1.23515.3 + 9.0.0-alpha.1.23515.3 + 9.0.0-alpha.1.23515.3 + 9.0.0-alpha.1.23515.3 - 9.0.0-alpha.1.23515.3 - 9.0.0-alpha.1.23515.3 - 9.0.0-alpha.1.23515.3 - 9.0.0-alpha.1.23515.3 - 9.0.0-alpha.1.23515.3 - 9.0.0-alpha.1.23515.3 - 9.0.0-alpha.1.23515.3 - 9.0.0-alpha.1.23515.3 - 9.0.0-alpha.1.23515.3 - 9.0.0-alpha.1.23515.3 + 9.0.0-alpha.1.23516.9 + 9.0.0-alpha.1.23516.9 + 9.0.0-alpha.1.23516.9 + 9.0.0-alpha.1.23516.9 + 9.0.0-alpha.1.23516.9 + 9.0.0-alpha.1.23516.9 + 9.0.0-alpha.1.23516.9 + 9.0.0-alpha.1.23516.9 + 9.0.0-alpha.1.23516.9 + 9.0.0-alpha.1.23516.9 - + https://github.com/dotnet/runtime - b9159ab91a5dbd124dd15d78ed073c52eba8c31b + c5e7081f78aaae13238ed54c2c359999247e09fa - + https://github.com/dotnet/runtime - b9159ab91a5dbd124dd15d78ed073c52eba8c31b + c5e7081f78aaae13238ed54c2c359999247e09fa - + https://github.com/dotnet/runtime - b9159ab91a5dbd124dd15d78ed073c52eba8c31b + c5e7081f78aaae13238ed54c2c359999247e09fa - + https://github.com/dotnet/runtime - b9159ab91a5dbd124dd15d78ed073c52eba8c31b + c5e7081f78aaae13238ed54c2c359999247e09fa - + https://github.com/dotnet/runtime - b9159ab91a5dbd124dd15d78ed073c52eba8c31b + c5e7081f78aaae13238ed54c2c359999247e09fa - + https://github.com/dotnet/runtime - b9159ab91a5dbd124dd15d78ed073c52eba8c31b + c5e7081f78aaae13238ed54c2c359999247e09fa - + https://github.com/dotnet/runtime - b9159ab91a5dbd124dd15d78ed073c52eba8c31b + c5e7081f78aaae13238ed54c2c359999247e09fa - + https://github.com/dotnet/runtime - b9159ab91a5dbd124dd15d78ed073c52eba8c31b + c5e7081f78aaae13238ed54c2c359999247e09fa - + https://github.com/dotnet/runtime - b9159ab91a5dbd124dd15d78ed073c52eba8c31b + c5e7081f78aaae13238ed54c2c359999247e09fa - + https://github.com/dotnet/runtime - b9159ab91a5dbd124dd15d78ed073c52eba8c31b + c5e7081f78aaae13238ed54c2c359999247e09fa - + https://github.com/dotnet/runtime - b9159ab91a5dbd124dd15d78ed073c52eba8c31b + c5e7081f78aaae13238ed54c2c359999247e09fa - + https://github.com/dotnet/runtime - b9159ab91a5dbd124dd15d78ed073c52eba8c31b + c5e7081f78aaae13238ed54c2c359999247e09fa - + https://github.com/dotnet/aspnetcore - b24cb43af229f8d2d778fbcbacfee9f06d980691 + 662795d5aa2d4608e33a972415c81699e8af5736 - + https://github.com/dotnet/aspnetcore - b24cb43af229f8d2d778fbcbacfee9f06d980691 + 662795d5aa2d4608e33a972415c81699e8af5736 - + https://github.com/dotnet/aspnetcore - b24cb43af229f8d2d778fbcbacfee9f06d980691 + 662795d5aa2d4608e33a972415c81699e8af5736 - + https://github.com/dotnet/aspnetcore - b24cb43af229f8d2d778fbcbacfee9f06d980691 + 662795d5aa2d4608e33a972415c81699e8af5736 - + https://github.com/dotnet/aspnetcore - b24cb43af229f8d2d778fbcbacfee9f06d980691 + 662795d5aa2d4608e33a972415c81699e8af5736 - + https://github.com/dotnet/aspnetcore - b24cb43af229f8d2d778fbcbacfee9f06d980691 + 662795d5aa2d4608e33a972415c81699e8af5736 - + https://github.com/dotnet/aspnetcore - b24cb43af229f8d2d778fbcbacfee9f06d980691 + 662795d5aa2d4608e33a972415c81699e8af5736 - + https://github.com/dotnet/aspnetcore - b24cb43af229f8d2d778fbcbacfee9f06d980691 + 662795d5aa2d4608e33a972415c81699e8af5736 - + https://github.com/dotnet/aspnetcore - b24cb43af229f8d2d778fbcbacfee9f06d980691 + 662795d5aa2d4608e33a972415c81699e8af5736 - + https://github.com/dotnet/aspnetcore - b24cb43af229f8d2d778fbcbacfee9f06d980691 + 662795d5aa2d4608e33a972415c81699e8af5736 diff --git a/eng/Versions.props b/eng/Versions.props index 23a36960316..1de5f75c67e 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -28,52 +28,52 @@ --> - 9.0.0-alpha.1.23515.3 - 9.0.0-alpha.1.23515.3 - 9.0.0-alpha.1.23515.3 - 9.0.0-alpha.1.23515.3 - 9.0.0-alpha.1.23515.3 - 9.0.0-alpha.1.23515.3 - 9.0.0-alpha.1.23515.3 - 9.0.0-alpha.1.23515.3 - 9.0.0-alpha.1.23515.3 - 9.0.0-alpha.1.23515.3 - 9.0.0-alpha.1.23515.3 - 9.0.0-alpha.1.23515.3 - 9.0.0-alpha.1.23515.3 - 9.0.0-alpha.1.23515.3 - 9.0.0-alpha.1.23515.3 - 9.0.0-alpha.1.23515.3 - 9.0.0-alpha.1.23515.3 - 9.0.0-alpha.1.23515.3 - 9.0.0-alpha.1.23515.3 - 9.0.0-alpha.1.23515.3 - 9.0.0-alpha.1.23515.3 - 9.0.0-alpha.1.23515.3 - 9.0.0-alpha.1.23515.3 - 9.0.0-alpha.1.23515.3 - 9.0.0-alpha.1.23515.3 - 9.0.0-alpha.1.23515.3 - 9.0.0-alpha.1.23515.3 - 9.0.0-alpha.1.23515.3 - 9.0.0-alpha.1.23515.3 - 9.0.0-alpha.1.23515.3 - 9.0.0-alpha.1.23515.3 - 9.0.0-alpha.1.23515.3 - 9.0.0-alpha.1.23515.3 - 9.0.0-alpha.1.23515.3 - 9.0.0-alpha.1.23515.3 + 9.0.0-alpha.1.23517.2 + 9.0.0-alpha.1.23517.2 + 9.0.0-alpha.1.23517.2 + 9.0.0-alpha.1.23517.2 + 9.0.0-alpha.1.23517.2 + 9.0.0-alpha.1.23517.2 + 9.0.0-alpha.1.23517.2 + 9.0.0-alpha.1.23517.2 + 9.0.0-alpha.1.23517.2 + 9.0.0-alpha.1.23517.2 + 9.0.0-alpha.1.23517.2 + 9.0.0-alpha.1.23517.2 + 9.0.0-alpha.1.23517.2 + 9.0.0-alpha.1.23517.2 + 9.0.0-alpha.1.23517.2 + 9.0.0-alpha.1.23517.2 + 9.0.0-alpha.1.23517.2 + 9.0.0-alpha.1.23517.2 + 9.0.0-alpha.1.23517.2 + 9.0.0-alpha.1.23517.2 + 9.0.0-alpha.1.23517.2 + 9.0.0-alpha.1.23517.2 + 9.0.0-alpha.1.23517.2 + 9.0.0-alpha.1.23517.2 + 9.0.0-alpha.1.23517.2 + 9.0.0-alpha.1.23517.2 + 9.0.0-alpha.1.23517.2 + 9.0.0-alpha.1.23517.2 + 9.0.0-alpha.1.23517.2 + 9.0.0-alpha.1.23517.2 + 9.0.0-alpha.1.23517.2 + 9.0.0-alpha.1.23517.2 + 9.0.0-alpha.1.23517.2 + 9.0.0-alpha.1.23517.2 + 9.0.0-alpha.1.23517.2 - 9.0.0-alpha.1.23516.9 - 9.0.0-alpha.1.23516.9 - 9.0.0-alpha.1.23516.9 - 9.0.0-alpha.1.23516.9 - 9.0.0-alpha.1.23516.9 - 9.0.0-alpha.1.23516.9 - 9.0.0-alpha.1.23516.9 - 9.0.0-alpha.1.23516.9 - 9.0.0-alpha.1.23516.9 - 9.0.0-alpha.1.23516.9 + 9.0.0-alpha.1.23517.9 + 9.0.0-alpha.1.23517.9 + 9.0.0-alpha.1.23517.9 + 9.0.0-alpha.1.23517.9 + 9.0.0-alpha.1.23517.9 + 9.0.0-alpha.1.23517.9 + 9.0.0-alpha.1.23517.9 + 9.0.0-alpha.1.23517.9 + 9.0.0-alpha.1.23517.9 + 9.0.0-alpha.1.23517.9 - 9.0.0-alpha.1.23517.9 - 9.0.0-alpha.1.23517.9 - 9.0.0-alpha.1.23517.9 - 9.0.0-alpha.1.23517.9 - 9.0.0-alpha.1.23517.9 - 9.0.0-alpha.1.23517.9 - 9.0.0-alpha.1.23517.9 - 9.0.0-alpha.1.23517.9 - 9.0.0-alpha.1.23517.9 - 9.0.0-alpha.1.23517.9 + 9.0.0-alpha.1.23518.2 + 9.0.0-alpha.1.23518.2 + 9.0.0-alpha.1.23518.2 + 9.0.0-alpha.1.23518.2 + 9.0.0-alpha.1.23518.2 + 9.0.0-alpha.1.23518.2 + 9.0.0-alpha.1.23518.2 + 9.0.0-alpha.1.23518.2 + 9.0.0-alpha.1.23518.2 + 9.0.0-alpha.1.23518.2 - + https://github.com/dotnet/runtime - c5e7081f78aaae13238ed54c2c359999247e09fa + 04ede0dadfbf2f1082d3bd218cea6fe46bbbed4a - + https://github.com/dotnet/runtime - c5e7081f78aaae13238ed54c2c359999247e09fa + 04ede0dadfbf2f1082d3bd218cea6fe46bbbed4a - + https://github.com/dotnet/runtime - c5e7081f78aaae13238ed54c2c359999247e09fa + 04ede0dadfbf2f1082d3bd218cea6fe46bbbed4a - + https://github.com/dotnet/runtime - c5e7081f78aaae13238ed54c2c359999247e09fa + 04ede0dadfbf2f1082d3bd218cea6fe46bbbed4a - + https://github.com/dotnet/runtime - c5e7081f78aaae13238ed54c2c359999247e09fa + 04ede0dadfbf2f1082d3bd218cea6fe46bbbed4a - + https://github.com/dotnet/runtime - c5e7081f78aaae13238ed54c2c359999247e09fa + 04ede0dadfbf2f1082d3bd218cea6fe46bbbed4a - + https://github.com/dotnet/runtime - c5e7081f78aaae13238ed54c2c359999247e09fa + 04ede0dadfbf2f1082d3bd218cea6fe46bbbed4a - + https://github.com/dotnet/runtime - c5e7081f78aaae13238ed54c2c359999247e09fa + 04ede0dadfbf2f1082d3bd218cea6fe46bbbed4a - + https://github.com/dotnet/runtime - c5e7081f78aaae13238ed54c2c359999247e09fa + 04ede0dadfbf2f1082d3bd218cea6fe46bbbed4a - + https://github.com/dotnet/runtime - c5e7081f78aaae13238ed54c2c359999247e09fa + 04ede0dadfbf2f1082d3bd218cea6fe46bbbed4a - + https://github.com/dotnet/runtime - c5e7081f78aaae13238ed54c2c359999247e09fa + 04ede0dadfbf2f1082d3bd218cea6fe46bbbed4a - + https://github.com/dotnet/runtime - c5e7081f78aaae13238ed54c2c359999247e09fa + 04ede0dadfbf2f1082d3bd218cea6fe46bbbed4a - + https://github.com/dotnet/aspnetcore - 149d04bfd79425cbb297e67ac03b08a75ec8eb12 + 20801921d179ea83bc7d2290b0b1026b4267a277 - + https://github.com/dotnet/aspnetcore - 149d04bfd79425cbb297e67ac03b08a75ec8eb12 + 20801921d179ea83bc7d2290b0b1026b4267a277 - + https://github.com/dotnet/aspnetcore - 149d04bfd79425cbb297e67ac03b08a75ec8eb12 + 20801921d179ea83bc7d2290b0b1026b4267a277 - + https://github.com/dotnet/aspnetcore - 149d04bfd79425cbb297e67ac03b08a75ec8eb12 + 20801921d179ea83bc7d2290b0b1026b4267a277 - + https://github.com/dotnet/aspnetcore - 149d04bfd79425cbb297e67ac03b08a75ec8eb12 + 20801921d179ea83bc7d2290b0b1026b4267a277 - + https://github.com/dotnet/aspnetcore - 149d04bfd79425cbb297e67ac03b08a75ec8eb12 + 20801921d179ea83bc7d2290b0b1026b4267a277 - + https://github.com/dotnet/aspnetcore - 149d04bfd79425cbb297e67ac03b08a75ec8eb12 + 20801921d179ea83bc7d2290b0b1026b4267a277 - + https://github.com/dotnet/aspnetcore - 149d04bfd79425cbb297e67ac03b08a75ec8eb12 + 20801921d179ea83bc7d2290b0b1026b4267a277 - + https://github.com/dotnet/aspnetcore - 149d04bfd79425cbb297e67ac03b08a75ec8eb12 + 20801921d179ea83bc7d2290b0b1026b4267a277 - + https://github.com/dotnet/aspnetcore - 149d04bfd79425cbb297e67ac03b08a75ec8eb12 + 20801921d179ea83bc7d2290b0b1026b4267a277 diff --git a/eng/Versions.props b/eng/Versions.props index bef6db56951..2fb354068c7 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -28,52 +28,52 @@ --> - 9.0.0-alpha.1.23517.2 - 9.0.0-alpha.1.23517.2 - 9.0.0-alpha.1.23517.2 - 9.0.0-alpha.1.23517.2 - 9.0.0-alpha.1.23517.2 - 9.0.0-alpha.1.23517.2 - 9.0.0-alpha.1.23517.2 - 9.0.0-alpha.1.23517.2 - 9.0.0-alpha.1.23517.2 - 9.0.0-alpha.1.23517.2 - 9.0.0-alpha.1.23517.2 - 9.0.0-alpha.1.23517.2 - 9.0.0-alpha.1.23517.2 - 9.0.0-alpha.1.23517.2 - 9.0.0-alpha.1.23517.2 - 9.0.0-alpha.1.23517.2 - 9.0.0-alpha.1.23517.2 - 9.0.0-alpha.1.23517.2 - 9.0.0-alpha.1.23517.2 - 9.0.0-alpha.1.23517.2 - 9.0.0-alpha.1.23517.2 - 9.0.0-alpha.1.23517.2 - 9.0.0-alpha.1.23517.2 - 9.0.0-alpha.1.23517.2 - 9.0.0-alpha.1.23517.2 - 9.0.0-alpha.1.23517.2 - 9.0.0-alpha.1.23517.2 - 9.0.0-alpha.1.23517.2 - 9.0.0-alpha.1.23517.2 - 9.0.0-alpha.1.23517.2 - 9.0.0-alpha.1.23517.2 - 9.0.0-alpha.1.23517.2 - 9.0.0-alpha.1.23517.2 - 9.0.0-alpha.1.23517.2 - 9.0.0-alpha.1.23517.2 + 9.0.0-alpha.1.23519.1 + 9.0.0-alpha.1.23519.1 + 9.0.0-alpha.1.23519.1 + 9.0.0-alpha.1.23519.1 + 9.0.0-alpha.1.23519.1 + 9.0.0-alpha.1.23519.1 + 9.0.0-alpha.1.23519.1 + 9.0.0-alpha.1.23519.1 + 9.0.0-alpha.1.23519.1 + 9.0.0-alpha.1.23519.1 + 9.0.0-alpha.1.23519.1 + 9.0.0-alpha.1.23519.1 + 9.0.0-alpha.1.23519.1 + 9.0.0-alpha.1.23519.1 + 9.0.0-alpha.1.23519.1 + 9.0.0-alpha.1.23519.1 + 9.0.0-alpha.1.23519.1 + 9.0.0-alpha.1.23519.1 + 9.0.0-alpha.1.23519.1 + 9.0.0-alpha.1.23519.1 + 9.0.0-alpha.1.23519.1 + 9.0.0-alpha.1.23519.1 + 9.0.0-alpha.1.23519.1 + 9.0.0-alpha.1.23519.1 + 9.0.0-alpha.1.23519.1 + 9.0.0-alpha.1.23519.1 + 9.0.0-alpha.1.23519.1 + 9.0.0-alpha.1.23519.1 + 9.0.0-alpha.1.23519.1 + 9.0.0-alpha.1.23519.1 + 9.0.0-alpha.1.23519.1 + 9.0.0-alpha.1.23519.1 + 9.0.0-alpha.1.23519.1 + 9.0.0-alpha.1.23519.1 + 9.0.0-alpha.1.23519.1 - 9.0.0-alpha.1.23518.2 - 9.0.0-alpha.1.23518.2 - 9.0.0-alpha.1.23518.2 - 9.0.0-alpha.1.23518.2 - 9.0.0-alpha.1.23518.2 - 9.0.0-alpha.1.23518.2 - 9.0.0-alpha.1.23518.2 - 9.0.0-alpha.1.23518.2 - 9.0.0-alpha.1.23518.2 - 9.0.0-alpha.1.23518.2 + 9.0.0-alpha.1.23520.1 + 9.0.0-alpha.1.23520.1 + 9.0.0-alpha.1.23520.1 + 9.0.0-alpha.1.23520.1 + 9.0.0-alpha.1.23520.1 + 9.0.0-alpha.1.23520.1 + 9.0.0-alpha.1.23520.1 + 9.0.0-alpha.1.23520.1 + 9.0.0-alpha.1.23520.1 + 9.0.0-alpha.1.23520.1 - + https://github.com/dotnet/runtime - 04ede0dadfbf2f1082d3bd218cea6fe46bbbed4a + 0151c4696eb14f52f567ceee91d2896ff2586edf - + https://github.com/dotnet/runtime - 04ede0dadfbf2f1082d3bd218cea6fe46bbbed4a + 0151c4696eb14f52f567ceee91d2896ff2586edf - + https://github.com/dotnet/runtime - 04ede0dadfbf2f1082d3bd218cea6fe46bbbed4a + 0151c4696eb14f52f567ceee91d2896ff2586edf - + https://github.com/dotnet/runtime - 04ede0dadfbf2f1082d3bd218cea6fe46bbbed4a + 0151c4696eb14f52f567ceee91d2896ff2586edf - + https://github.com/dotnet/runtime - 04ede0dadfbf2f1082d3bd218cea6fe46bbbed4a + 0151c4696eb14f52f567ceee91d2896ff2586edf - + https://github.com/dotnet/runtime - 04ede0dadfbf2f1082d3bd218cea6fe46bbbed4a + 0151c4696eb14f52f567ceee91d2896ff2586edf - + https://github.com/dotnet/runtime - 04ede0dadfbf2f1082d3bd218cea6fe46bbbed4a + 0151c4696eb14f52f567ceee91d2896ff2586edf - + https://github.com/dotnet/runtime - 04ede0dadfbf2f1082d3bd218cea6fe46bbbed4a + 0151c4696eb14f52f567ceee91d2896ff2586edf - + https://github.com/dotnet/runtime - 04ede0dadfbf2f1082d3bd218cea6fe46bbbed4a + 0151c4696eb14f52f567ceee91d2896ff2586edf - + https://github.com/dotnet/runtime - 04ede0dadfbf2f1082d3bd218cea6fe46bbbed4a + 0151c4696eb14f52f567ceee91d2896ff2586edf - + https://github.com/dotnet/runtime - 04ede0dadfbf2f1082d3bd218cea6fe46bbbed4a + 0151c4696eb14f52f567ceee91d2896ff2586edf - + https://github.com/dotnet/runtime - 04ede0dadfbf2f1082d3bd218cea6fe46bbbed4a + 0151c4696eb14f52f567ceee91d2896ff2586edf - + https://github.com/dotnet/aspnetcore - 20801921d179ea83bc7d2290b0b1026b4267a277 + 334676042dd1b78bad80bf73b5ad2b6133a9519d - + https://github.com/dotnet/aspnetcore - 20801921d179ea83bc7d2290b0b1026b4267a277 + 334676042dd1b78bad80bf73b5ad2b6133a9519d - + https://github.com/dotnet/aspnetcore - 20801921d179ea83bc7d2290b0b1026b4267a277 + 334676042dd1b78bad80bf73b5ad2b6133a9519d - + https://github.com/dotnet/aspnetcore - 20801921d179ea83bc7d2290b0b1026b4267a277 + 334676042dd1b78bad80bf73b5ad2b6133a9519d - + https://github.com/dotnet/aspnetcore - 20801921d179ea83bc7d2290b0b1026b4267a277 + 334676042dd1b78bad80bf73b5ad2b6133a9519d - + https://github.com/dotnet/aspnetcore - 20801921d179ea83bc7d2290b0b1026b4267a277 + 334676042dd1b78bad80bf73b5ad2b6133a9519d - + https://github.com/dotnet/aspnetcore - 20801921d179ea83bc7d2290b0b1026b4267a277 + 334676042dd1b78bad80bf73b5ad2b6133a9519d - + https://github.com/dotnet/aspnetcore - 20801921d179ea83bc7d2290b0b1026b4267a277 + 334676042dd1b78bad80bf73b5ad2b6133a9519d - + https://github.com/dotnet/aspnetcore - 20801921d179ea83bc7d2290b0b1026b4267a277 + 334676042dd1b78bad80bf73b5ad2b6133a9519d - + https://github.com/dotnet/aspnetcore - 20801921d179ea83bc7d2290b0b1026b4267a277 + 334676042dd1b78bad80bf73b5ad2b6133a9519d diff --git a/eng/Versions.props b/eng/Versions.props index 2fb354068c7..fa9937d3a47 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -28,52 +28,52 @@ --> - 9.0.0-alpha.1.23519.1 - 9.0.0-alpha.1.23519.1 - 9.0.0-alpha.1.23519.1 - 9.0.0-alpha.1.23519.1 - 9.0.0-alpha.1.23519.1 - 9.0.0-alpha.1.23519.1 - 9.0.0-alpha.1.23519.1 - 9.0.0-alpha.1.23519.1 - 9.0.0-alpha.1.23519.1 - 9.0.0-alpha.1.23519.1 - 9.0.0-alpha.1.23519.1 - 9.0.0-alpha.1.23519.1 - 9.0.0-alpha.1.23519.1 - 9.0.0-alpha.1.23519.1 - 9.0.0-alpha.1.23519.1 - 9.0.0-alpha.1.23519.1 - 9.0.0-alpha.1.23519.1 - 9.0.0-alpha.1.23519.1 - 9.0.0-alpha.1.23519.1 - 9.0.0-alpha.1.23519.1 - 9.0.0-alpha.1.23519.1 - 9.0.0-alpha.1.23519.1 - 9.0.0-alpha.1.23519.1 - 9.0.0-alpha.1.23519.1 - 9.0.0-alpha.1.23519.1 - 9.0.0-alpha.1.23519.1 - 9.0.0-alpha.1.23519.1 - 9.0.0-alpha.1.23519.1 - 9.0.0-alpha.1.23519.1 - 9.0.0-alpha.1.23519.1 - 9.0.0-alpha.1.23519.1 - 9.0.0-alpha.1.23519.1 - 9.0.0-alpha.1.23519.1 - 9.0.0-alpha.1.23519.1 - 9.0.0-alpha.1.23519.1 + 9.0.0-alpha.1.23520.1 + 9.0.0-alpha.1.23520.1 + 9.0.0-alpha.1.23520.1 + 9.0.0-alpha.1.23520.1 + 9.0.0-alpha.1.23520.1 + 9.0.0-alpha.1.23520.1 + 9.0.0-alpha.1.23520.1 + 9.0.0-alpha.1.23520.1 + 9.0.0-alpha.1.23520.1 + 9.0.0-alpha.1.23520.1 + 9.0.0-alpha.1.23520.1 + 9.0.0-alpha.1.23520.1 + 9.0.0-alpha.1.23520.1 + 9.0.0-alpha.1.23520.1 + 9.0.0-alpha.1.23520.1 + 9.0.0-alpha.1.23520.1 + 9.0.0-alpha.1.23520.1 + 9.0.0-alpha.1.23520.1 + 9.0.0-alpha.1.23520.1 + 9.0.0-alpha.1.23520.1 + 9.0.0-alpha.1.23520.1 + 9.0.0-alpha.1.23520.1 + 9.0.0-alpha.1.23520.1 + 9.0.0-alpha.1.23520.1 + 9.0.0-alpha.1.23520.1 + 9.0.0-alpha.1.23520.1 + 9.0.0-alpha.1.23520.1 + 9.0.0-alpha.1.23520.1 + 9.0.0-alpha.1.23520.1 + 9.0.0-alpha.1.23520.1 + 9.0.0-alpha.1.23520.1 + 9.0.0-alpha.1.23520.1 + 9.0.0-alpha.1.23520.1 + 9.0.0-alpha.1.23520.1 + 9.0.0-alpha.1.23520.1 - 9.0.0-alpha.1.23520.1 - 9.0.0-alpha.1.23520.1 - 9.0.0-alpha.1.23520.1 - 9.0.0-alpha.1.23520.1 - 9.0.0-alpha.1.23520.1 - 9.0.0-alpha.1.23520.1 - 9.0.0-alpha.1.23520.1 - 9.0.0-alpha.1.23520.1 - 9.0.0-alpha.1.23520.1 - 9.0.0-alpha.1.23520.1 + 9.0.0-alpha.1.23520.12 + 9.0.0-alpha.1.23520.12 + 9.0.0-alpha.1.23520.12 + 9.0.0-alpha.1.23520.12 + 9.0.0-alpha.1.23520.12 + 9.0.0-alpha.1.23520.12 + 9.0.0-alpha.1.23520.12 + 9.0.0-alpha.1.23520.12 + 9.0.0-alpha.1.23520.12 + 9.0.0-alpha.1.23520.12 - + https://github.com/dotnet/runtime - 0151c4696eb14f52f567ceee91d2896ff2586edf + 9a6d53050f15071287e6d2b111be80af54e43689 - + https://github.com/dotnet/runtime - 0151c4696eb14f52f567ceee91d2896ff2586edf + 9a6d53050f15071287e6d2b111be80af54e43689 - + https://github.com/dotnet/runtime - 0151c4696eb14f52f567ceee91d2896ff2586edf + 9a6d53050f15071287e6d2b111be80af54e43689 - + https://github.com/dotnet/runtime - 0151c4696eb14f52f567ceee91d2896ff2586edf + 9a6d53050f15071287e6d2b111be80af54e43689 - + https://github.com/dotnet/runtime - 0151c4696eb14f52f567ceee91d2896ff2586edf + 9a6d53050f15071287e6d2b111be80af54e43689 - + https://github.com/dotnet/runtime - 0151c4696eb14f52f567ceee91d2896ff2586edf + 9a6d53050f15071287e6d2b111be80af54e43689 - + https://github.com/dotnet/runtime - 0151c4696eb14f52f567ceee91d2896ff2586edf + 9a6d53050f15071287e6d2b111be80af54e43689 - + https://github.com/dotnet/runtime - 0151c4696eb14f52f567ceee91d2896ff2586edf + 9a6d53050f15071287e6d2b111be80af54e43689 - + https://github.com/dotnet/runtime - 0151c4696eb14f52f567ceee91d2896ff2586edf + 9a6d53050f15071287e6d2b111be80af54e43689 - + https://github.com/dotnet/runtime - 0151c4696eb14f52f567ceee91d2896ff2586edf + 9a6d53050f15071287e6d2b111be80af54e43689 - + https://github.com/dotnet/runtime - 0151c4696eb14f52f567ceee91d2896ff2586edf + 9a6d53050f15071287e6d2b111be80af54e43689 - + https://github.com/dotnet/runtime - 0151c4696eb14f52f567ceee91d2896ff2586edf + 9a6d53050f15071287e6d2b111be80af54e43689 - + https://github.com/dotnet/aspnetcore - 334676042dd1b78bad80bf73b5ad2b6133a9519d + f23bd5ebe09b58f11df14675a9b550315b3d8c3d - + https://github.com/dotnet/aspnetcore - 334676042dd1b78bad80bf73b5ad2b6133a9519d + f23bd5ebe09b58f11df14675a9b550315b3d8c3d - + https://github.com/dotnet/aspnetcore - 334676042dd1b78bad80bf73b5ad2b6133a9519d + f23bd5ebe09b58f11df14675a9b550315b3d8c3d - + https://github.com/dotnet/aspnetcore - 334676042dd1b78bad80bf73b5ad2b6133a9519d + f23bd5ebe09b58f11df14675a9b550315b3d8c3d - + https://github.com/dotnet/aspnetcore - 334676042dd1b78bad80bf73b5ad2b6133a9519d + f23bd5ebe09b58f11df14675a9b550315b3d8c3d - + https://github.com/dotnet/aspnetcore - 334676042dd1b78bad80bf73b5ad2b6133a9519d + f23bd5ebe09b58f11df14675a9b550315b3d8c3d - + https://github.com/dotnet/aspnetcore - 334676042dd1b78bad80bf73b5ad2b6133a9519d + f23bd5ebe09b58f11df14675a9b550315b3d8c3d - + https://github.com/dotnet/aspnetcore - 334676042dd1b78bad80bf73b5ad2b6133a9519d + f23bd5ebe09b58f11df14675a9b550315b3d8c3d - + https://github.com/dotnet/aspnetcore - 334676042dd1b78bad80bf73b5ad2b6133a9519d + f23bd5ebe09b58f11df14675a9b550315b3d8c3d - + https://github.com/dotnet/aspnetcore - 334676042dd1b78bad80bf73b5ad2b6133a9519d + f23bd5ebe09b58f11df14675a9b550315b3d8c3d diff --git a/eng/Versions.props b/eng/Versions.props index fa9937d3a47..c37eb02c882 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -28,52 +28,52 @@ --> - 9.0.0-alpha.1.23520.1 - 9.0.0-alpha.1.23520.1 - 9.0.0-alpha.1.23520.1 - 9.0.0-alpha.1.23520.1 - 9.0.0-alpha.1.23520.1 - 9.0.0-alpha.1.23520.1 - 9.0.0-alpha.1.23520.1 - 9.0.0-alpha.1.23520.1 - 9.0.0-alpha.1.23520.1 - 9.0.0-alpha.1.23520.1 - 9.0.0-alpha.1.23520.1 - 9.0.0-alpha.1.23520.1 - 9.0.0-alpha.1.23520.1 - 9.0.0-alpha.1.23520.1 - 9.0.0-alpha.1.23520.1 - 9.0.0-alpha.1.23520.1 - 9.0.0-alpha.1.23520.1 - 9.0.0-alpha.1.23520.1 - 9.0.0-alpha.1.23520.1 - 9.0.0-alpha.1.23520.1 - 9.0.0-alpha.1.23520.1 - 9.0.0-alpha.1.23520.1 - 9.0.0-alpha.1.23520.1 - 9.0.0-alpha.1.23520.1 - 9.0.0-alpha.1.23520.1 - 9.0.0-alpha.1.23520.1 - 9.0.0-alpha.1.23520.1 - 9.0.0-alpha.1.23520.1 - 9.0.0-alpha.1.23520.1 - 9.0.0-alpha.1.23520.1 - 9.0.0-alpha.1.23520.1 - 9.0.0-alpha.1.23520.1 - 9.0.0-alpha.1.23520.1 - 9.0.0-alpha.1.23520.1 - 9.0.0-alpha.1.23520.1 + 9.0.0-alpha.1.23521.1 + 9.0.0-alpha.1.23521.1 + 9.0.0-alpha.1.23521.1 + 9.0.0-alpha.1.23521.1 + 9.0.0-alpha.1.23521.1 + 9.0.0-alpha.1.23521.1 + 9.0.0-alpha.1.23521.1 + 9.0.0-alpha.1.23521.1 + 9.0.0-alpha.1.23521.1 + 9.0.0-alpha.1.23521.1 + 9.0.0-alpha.1.23521.1 + 9.0.0-alpha.1.23521.1 + 9.0.0-alpha.1.23521.1 + 9.0.0-alpha.1.23521.1 + 9.0.0-alpha.1.23521.1 + 9.0.0-alpha.1.23521.1 + 9.0.0-alpha.1.23521.1 + 9.0.0-alpha.1.23521.1 + 9.0.0-alpha.1.23521.1 + 9.0.0-alpha.1.23521.1 + 9.0.0-alpha.1.23521.1 + 9.0.0-alpha.1.23521.1 + 9.0.0-alpha.1.23521.1 + 9.0.0-alpha.1.23521.1 + 9.0.0-alpha.1.23521.1 + 9.0.0-alpha.1.23521.1 + 9.0.0-alpha.1.23521.1 + 9.0.0-alpha.1.23521.1 + 9.0.0-alpha.1.23521.1 + 9.0.0-alpha.1.23521.1 + 9.0.0-alpha.1.23521.1 + 9.0.0-alpha.1.23521.1 + 9.0.0-alpha.1.23521.1 + 9.0.0-alpha.1.23521.1 + 9.0.0-alpha.1.23521.1 - 9.0.0-alpha.1.23520.12 - 9.0.0-alpha.1.23520.12 - 9.0.0-alpha.1.23520.12 - 9.0.0-alpha.1.23520.12 - 9.0.0-alpha.1.23520.12 - 9.0.0-alpha.1.23520.12 - 9.0.0-alpha.1.23520.12 - 9.0.0-alpha.1.23520.12 - 9.0.0-alpha.1.23520.12 - 9.0.0-alpha.1.23520.12 + 9.0.0-alpha.1.23521.2 + 9.0.0-alpha.1.23521.2 + 9.0.0-alpha.1.23521.2 + 9.0.0-alpha.1.23521.2 + 9.0.0-alpha.1.23521.2 + 9.0.0-alpha.1.23521.2 + 9.0.0-alpha.1.23521.2 + 9.0.0-alpha.1.23521.2 + 9.0.0-alpha.1.23521.2 + 9.0.0-alpha.1.23521.2 - + https://github.com/dotnet/runtime - 9a6d53050f15071287e6d2b111be80af54e43689 + a72822891b5fa8430d564af9825d3914f90a14c2 - + https://github.com/dotnet/runtime - 9a6d53050f15071287e6d2b111be80af54e43689 + a72822891b5fa8430d564af9825d3914f90a14c2 - + https://github.com/dotnet/runtime - 9a6d53050f15071287e6d2b111be80af54e43689 + a72822891b5fa8430d564af9825d3914f90a14c2 - + https://github.com/dotnet/runtime - 9a6d53050f15071287e6d2b111be80af54e43689 + a72822891b5fa8430d564af9825d3914f90a14c2 - + https://github.com/dotnet/runtime - 9a6d53050f15071287e6d2b111be80af54e43689 + a72822891b5fa8430d564af9825d3914f90a14c2 - + https://github.com/dotnet/runtime - 9a6d53050f15071287e6d2b111be80af54e43689 + a72822891b5fa8430d564af9825d3914f90a14c2 - + https://github.com/dotnet/runtime - 9a6d53050f15071287e6d2b111be80af54e43689 + a72822891b5fa8430d564af9825d3914f90a14c2 - + https://github.com/dotnet/runtime - 9a6d53050f15071287e6d2b111be80af54e43689 + a72822891b5fa8430d564af9825d3914f90a14c2 - + https://github.com/dotnet/runtime - 9a6d53050f15071287e6d2b111be80af54e43689 + a72822891b5fa8430d564af9825d3914f90a14c2 - + https://github.com/dotnet/runtime - 9a6d53050f15071287e6d2b111be80af54e43689 + a72822891b5fa8430d564af9825d3914f90a14c2 - + https://github.com/dotnet/runtime - 9a6d53050f15071287e6d2b111be80af54e43689 + a72822891b5fa8430d564af9825d3914f90a14c2 - + https://github.com/dotnet/runtime - 9a6d53050f15071287e6d2b111be80af54e43689 + a72822891b5fa8430d564af9825d3914f90a14c2 - + https://github.com/dotnet/aspnetcore - f23bd5ebe09b58f11df14675a9b550315b3d8c3d + e431371c056cdd2f682f45a7909a6078e85b90dd - + https://github.com/dotnet/aspnetcore - f23bd5ebe09b58f11df14675a9b550315b3d8c3d + e431371c056cdd2f682f45a7909a6078e85b90dd - + https://github.com/dotnet/aspnetcore - f23bd5ebe09b58f11df14675a9b550315b3d8c3d + e431371c056cdd2f682f45a7909a6078e85b90dd - + https://github.com/dotnet/aspnetcore - f23bd5ebe09b58f11df14675a9b550315b3d8c3d + e431371c056cdd2f682f45a7909a6078e85b90dd - + https://github.com/dotnet/aspnetcore - f23bd5ebe09b58f11df14675a9b550315b3d8c3d + e431371c056cdd2f682f45a7909a6078e85b90dd - + https://github.com/dotnet/aspnetcore - f23bd5ebe09b58f11df14675a9b550315b3d8c3d + e431371c056cdd2f682f45a7909a6078e85b90dd - + https://github.com/dotnet/aspnetcore - f23bd5ebe09b58f11df14675a9b550315b3d8c3d + e431371c056cdd2f682f45a7909a6078e85b90dd - + https://github.com/dotnet/aspnetcore - f23bd5ebe09b58f11df14675a9b550315b3d8c3d + e431371c056cdd2f682f45a7909a6078e85b90dd - + https://github.com/dotnet/aspnetcore - f23bd5ebe09b58f11df14675a9b550315b3d8c3d + e431371c056cdd2f682f45a7909a6078e85b90dd - + https://github.com/dotnet/aspnetcore - f23bd5ebe09b58f11df14675a9b550315b3d8c3d + e431371c056cdd2f682f45a7909a6078e85b90dd diff --git a/eng/Versions.props b/eng/Versions.props index c37eb02c882..ce1814d281d 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -28,52 +28,52 @@ --> - 9.0.0-alpha.1.23521.1 - 9.0.0-alpha.1.23521.1 - 9.0.0-alpha.1.23521.1 - 9.0.0-alpha.1.23521.1 - 9.0.0-alpha.1.23521.1 - 9.0.0-alpha.1.23521.1 - 9.0.0-alpha.1.23521.1 - 9.0.0-alpha.1.23521.1 - 9.0.0-alpha.1.23521.1 - 9.0.0-alpha.1.23521.1 - 9.0.0-alpha.1.23521.1 - 9.0.0-alpha.1.23521.1 - 9.0.0-alpha.1.23521.1 - 9.0.0-alpha.1.23521.1 - 9.0.0-alpha.1.23521.1 - 9.0.0-alpha.1.23521.1 - 9.0.0-alpha.1.23521.1 - 9.0.0-alpha.1.23521.1 - 9.0.0-alpha.1.23521.1 - 9.0.0-alpha.1.23521.1 - 9.0.0-alpha.1.23521.1 - 9.0.0-alpha.1.23521.1 - 9.0.0-alpha.1.23521.1 - 9.0.0-alpha.1.23521.1 - 9.0.0-alpha.1.23521.1 - 9.0.0-alpha.1.23521.1 - 9.0.0-alpha.1.23521.1 - 9.0.0-alpha.1.23521.1 - 9.0.0-alpha.1.23521.1 - 9.0.0-alpha.1.23521.1 - 9.0.0-alpha.1.23521.1 - 9.0.0-alpha.1.23521.1 - 9.0.0-alpha.1.23521.1 - 9.0.0-alpha.1.23521.1 - 9.0.0-alpha.1.23521.1 + 9.0.0-alpha.1.23521.5 + 9.0.0-alpha.1.23521.5 + 9.0.0-alpha.1.23521.5 + 9.0.0-alpha.1.23521.5 + 9.0.0-alpha.1.23521.5 + 9.0.0-alpha.1.23521.5 + 9.0.0-alpha.1.23521.5 + 9.0.0-alpha.1.23521.5 + 9.0.0-alpha.1.23521.5 + 9.0.0-alpha.1.23521.5 + 9.0.0-alpha.1.23521.5 + 9.0.0-alpha.1.23521.5 + 9.0.0-alpha.1.23521.5 + 9.0.0-alpha.1.23521.5 + 9.0.0-alpha.1.23521.5 + 9.0.0-alpha.1.23521.5 + 9.0.0-alpha.1.23521.5 + 9.0.0-alpha.1.23521.5 + 9.0.0-alpha.1.23521.5 + 9.0.0-alpha.1.23521.5 + 9.0.0-alpha.1.23521.5 + 9.0.0-alpha.1.23521.5 + 9.0.0-alpha.1.23521.5 + 9.0.0-alpha.1.23521.5 + 9.0.0-alpha.1.23521.5 + 9.0.0-alpha.1.23521.5 + 9.0.0-alpha.1.23521.5 + 9.0.0-alpha.1.23521.5 + 9.0.0-alpha.1.23521.5 + 9.0.0-alpha.1.23521.5 + 9.0.0-alpha.1.23521.5 + 9.0.0-alpha.1.23521.5 + 9.0.0-alpha.1.23521.5 + 9.0.0-alpha.1.23521.5 + 9.0.0-alpha.1.23521.5 - 9.0.0-alpha.1.23521.2 - 9.0.0-alpha.1.23521.2 - 9.0.0-alpha.1.23521.2 - 9.0.0-alpha.1.23521.2 - 9.0.0-alpha.1.23521.2 - 9.0.0-alpha.1.23521.2 - 9.0.0-alpha.1.23521.2 - 9.0.0-alpha.1.23521.2 - 9.0.0-alpha.1.23521.2 - 9.0.0-alpha.1.23521.2 + 9.0.0-alpha.1.23522.2 + 9.0.0-alpha.1.23522.2 + 9.0.0-alpha.1.23522.2 + 9.0.0-alpha.1.23522.2 + 9.0.0-alpha.1.23522.2 + 9.0.0-alpha.1.23522.2 + 9.0.0-alpha.1.23522.2 + 9.0.0-alpha.1.23522.2 + 9.0.0-alpha.1.23522.2 + 9.0.0-alpha.1.23522.2 - + https://github.com/dotnet/runtime - a72822891b5fa8430d564af9825d3914f90a14c2 + 2959e1acd09aec0f1e59db9cbe41f3701b0bd4dd - + https://github.com/dotnet/runtime - a72822891b5fa8430d564af9825d3914f90a14c2 + 2959e1acd09aec0f1e59db9cbe41f3701b0bd4dd - + https://github.com/dotnet/runtime - a72822891b5fa8430d564af9825d3914f90a14c2 + 2959e1acd09aec0f1e59db9cbe41f3701b0bd4dd - + https://github.com/dotnet/runtime - a72822891b5fa8430d564af9825d3914f90a14c2 + 2959e1acd09aec0f1e59db9cbe41f3701b0bd4dd - + https://github.com/dotnet/runtime - a72822891b5fa8430d564af9825d3914f90a14c2 + 2959e1acd09aec0f1e59db9cbe41f3701b0bd4dd - + https://github.com/dotnet/runtime - a72822891b5fa8430d564af9825d3914f90a14c2 + 2959e1acd09aec0f1e59db9cbe41f3701b0bd4dd - + https://github.com/dotnet/runtime - a72822891b5fa8430d564af9825d3914f90a14c2 + 2959e1acd09aec0f1e59db9cbe41f3701b0bd4dd - + https://github.com/dotnet/runtime - a72822891b5fa8430d564af9825d3914f90a14c2 + 2959e1acd09aec0f1e59db9cbe41f3701b0bd4dd - + https://github.com/dotnet/runtime - a72822891b5fa8430d564af9825d3914f90a14c2 + 2959e1acd09aec0f1e59db9cbe41f3701b0bd4dd - + https://github.com/dotnet/runtime - a72822891b5fa8430d564af9825d3914f90a14c2 + 2959e1acd09aec0f1e59db9cbe41f3701b0bd4dd - + https://github.com/dotnet/runtime - a72822891b5fa8430d564af9825d3914f90a14c2 + 2959e1acd09aec0f1e59db9cbe41f3701b0bd4dd - + https://github.com/dotnet/runtime - a72822891b5fa8430d564af9825d3914f90a14c2 + 2959e1acd09aec0f1e59db9cbe41f3701b0bd4dd - + https://github.com/dotnet/aspnetcore - e431371c056cdd2f682f45a7909a6078e85b90dd + f84e43dc7a6156e63133f9c0346b58db9d62faf2 - + https://github.com/dotnet/aspnetcore - e431371c056cdd2f682f45a7909a6078e85b90dd + f84e43dc7a6156e63133f9c0346b58db9d62faf2 - + https://github.com/dotnet/aspnetcore - e431371c056cdd2f682f45a7909a6078e85b90dd + f84e43dc7a6156e63133f9c0346b58db9d62faf2 - + https://github.com/dotnet/aspnetcore - e431371c056cdd2f682f45a7909a6078e85b90dd + f84e43dc7a6156e63133f9c0346b58db9d62faf2 - + https://github.com/dotnet/aspnetcore - e431371c056cdd2f682f45a7909a6078e85b90dd + f84e43dc7a6156e63133f9c0346b58db9d62faf2 - + https://github.com/dotnet/aspnetcore - e431371c056cdd2f682f45a7909a6078e85b90dd + f84e43dc7a6156e63133f9c0346b58db9d62faf2 - + https://github.com/dotnet/aspnetcore - e431371c056cdd2f682f45a7909a6078e85b90dd + f84e43dc7a6156e63133f9c0346b58db9d62faf2 - + https://github.com/dotnet/aspnetcore - e431371c056cdd2f682f45a7909a6078e85b90dd + f84e43dc7a6156e63133f9c0346b58db9d62faf2 - + https://github.com/dotnet/aspnetcore - e431371c056cdd2f682f45a7909a6078e85b90dd + f84e43dc7a6156e63133f9c0346b58db9d62faf2 - + https://github.com/dotnet/aspnetcore - e431371c056cdd2f682f45a7909a6078e85b90dd + f84e43dc7a6156e63133f9c0346b58db9d62faf2 diff --git a/eng/Versions.props b/eng/Versions.props index ce1814d281d..fe601615b21 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -28,52 +28,52 @@ --> - 9.0.0-alpha.1.23521.5 - 9.0.0-alpha.1.23521.5 - 9.0.0-alpha.1.23521.5 - 9.0.0-alpha.1.23521.5 - 9.0.0-alpha.1.23521.5 - 9.0.0-alpha.1.23521.5 - 9.0.0-alpha.1.23521.5 - 9.0.0-alpha.1.23521.5 - 9.0.0-alpha.1.23521.5 - 9.0.0-alpha.1.23521.5 - 9.0.0-alpha.1.23521.5 - 9.0.0-alpha.1.23521.5 - 9.0.0-alpha.1.23521.5 - 9.0.0-alpha.1.23521.5 - 9.0.0-alpha.1.23521.5 - 9.0.0-alpha.1.23521.5 - 9.0.0-alpha.1.23521.5 - 9.0.0-alpha.1.23521.5 - 9.0.0-alpha.1.23521.5 - 9.0.0-alpha.1.23521.5 - 9.0.0-alpha.1.23521.5 - 9.0.0-alpha.1.23521.5 - 9.0.0-alpha.1.23521.5 - 9.0.0-alpha.1.23521.5 - 9.0.0-alpha.1.23521.5 - 9.0.0-alpha.1.23521.5 - 9.0.0-alpha.1.23521.5 - 9.0.0-alpha.1.23521.5 - 9.0.0-alpha.1.23521.5 - 9.0.0-alpha.1.23521.5 - 9.0.0-alpha.1.23521.5 - 9.0.0-alpha.1.23521.5 - 9.0.0-alpha.1.23521.5 - 9.0.0-alpha.1.23521.5 - 9.0.0-alpha.1.23521.5 + 9.0.0-alpha.1.23523.1 + 9.0.0-alpha.1.23523.1 + 9.0.0-alpha.1.23523.1 + 9.0.0-alpha.1.23523.1 + 9.0.0-alpha.1.23523.1 + 9.0.0-alpha.1.23523.1 + 9.0.0-alpha.1.23523.1 + 9.0.0-alpha.1.23523.1 + 9.0.0-alpha.1.23523.1 + 9.0.0-alpha.1.23523.1 + 9.0.0-alpha.1.23523.1 + 9.0.0-alpha.1.23523.1 + 9.0.0-alpha.1.23523.1 + 9.0.0-alpha.1.23523.1 + 9.0.0-alpha.1.23523.1 + 9.0.0-alpha.1.23523.1 + 9.0.0-alpha.1.23523.1 + 9.0.0-alpha.1.23523.1 + 9.0.0-alpha.1.23523.1 + 9.0.0-alpha.1.23523.1 + 9.0.0-alpha.1.23523.1 + 9.0.0-alpha.1.23523.1 + 9.0.0-alpha.1.23523.1 + 9.0.0-alpha.1.23523.1 + 9.0.0-alpha.1.23523.1 + 9.0.0-alpha.1.23523.1 + 9.0.0-alpha.1.23523.1 + 9.0.0-alpha.1.23523.1 + 9.0.0-alpha.1.23523.1 + 9.0.0-alpha.1.23523.1 + 9.0.0-alpha.1.23523.1 + 9.0.0-alpha.1.23523.1 + 9.0.0-alpha.1.23523.1 + 9.0.0-alpha.1.23523.1 + 9.0.0-alpha.1.23523.1 - 9.0.0-alpha.1.23522.2 - 9.0.0-alpha.1.23522.2 - 9.0.0-alpha.1.23522.2 - 9.0.0-alpha.1.23522.2 - 9.0.0-alpha.1.23522.2 - 9.0.0-alpha.1.23522.2 - 9.0.0-alpha.1.23522.2 - 9.0.0-alpha.1.23522.2 - 9.0.0-alpha.1.23522.2 - 9.0.0-alpha.1.23522.2 + 9.0.0-alpha.1.23524.1 + 9.0.0-alpha.1.23524.1 + 9.0.0-alpha.1.23524.1 + 9.0.0-alpha.1.23524.1 + 9.0.0-alpha.1.23524.1 + 9.0.0-alpha.1.23524.1 + 9.0.0-alpha.1.23524.1 + 9.0.0-alpha.1.23524.1 + 9.0.0-alpha.1.23524.1 + 9.0.0-alpha.1.23524.1 - + https://github.com/dotnet/runtime - 2959e1acd09aec0f1e59db9cbe41f3701b0bd4dd + d775a3bb77add85dc30032b20c78c83f9a0e3c1f - + https://github.com/dotnet/runtime - 2959e1acd09aec0f1e59db9cbe41f3701b0bd4dd + d775a3bb77add85dc30032b20c78c83f9a0e3c1f - + https://github.com/dotnet/runtime - 2959e1acd09aec0f1e59db9cbe41f3701b0bd4dd + d775a3bb77add85dc30032b20c78c83f9a0e3c1f - + https://github.com/dotnet/runtime - 2959e1acd09aec0f1e59db9cbe41f3701b0bd4dd + d775a3bb77add85dc30032b20c78c83f9a0e3c1f - + https://github.com/dotnet/runtime - 2959e1acd09aec0f1e59db9cbe41f3701b0bd4dd + d775a3bb77add85dc30032b20c78c83f9a0e3c1f - + https://github.com/dotnet/runtime - 2959e1acd09aec0f1e59db9cbe41f3701b0bd4dd + d775a3bb77add85dc30032b20c78c83f9a0e3c1f - + https://github.com/dotnet/runtime - 2959e1acd09aec0f1e59db9cbe41f3701b0bd4dd + d775a3bb77add85dc30032b20c78c83f9a0e3c1f - + https://github.com/dotnet/runtime - 2959e1acd09aec0f1e59db9cbe41f3701b0bd4dd + d775a3bb77add85dc30032b20c78c83f9a0e3c1f - + https://github.com/dotnet/runtime - 2959e1acd09aec0f1e59db9cbe41f3701b0bd4dd + d775a3bb77add85dc30032b20c78c83f9a0e3c1f - + https://github.com/dotnet/runtime - 2959e1acd09aec0f1e59db9cbe41f3701b0bd4dd + d775a3bb77add85dc30032b20c78c83f9a0e3c1f - + https://github.com/dotnet/runtime - 2959e1acd09aec0f1e59db9cbe41f3701b0bd4dd + d775a3bb77add85dc30032b20c78c83f9a0e3c1f - + https://github.com/dotnet/runtime - 2959e1acd09aec0f1e59db9cbe41f3701b0bd4dd + d775a3bb77add85dc30032b20c78c83f9a0e3c1f - + https://github.com/dotnet/aspnetcore - f84e43dc7a6156e63133f9c0346b58db9d62faf2 + 82ff9246592477abf4ff57ac905a368cbd99ff20 - + https://github.com/dotnet/aspnetcore - f84e43dc7a6156e63133f9c0346b58db9d62faf2 + 82ff9246592477abf4ff57ac905a368cbd99ff20 - + https://github.com/dotnet/aspnetcore - f84e43dc7a6156e63133f9c0346b58db9d62faf2 + 82ff9246592477abf4ff57ac905a368cbd99ff20 - + https://github.com/dotnet/aspnetcore - f84e43dc7a6156e63133f9c0346b58db9d62faf2 + 82ff9246592477abf4ff57ac905a368cbd99ff20 - + https://github.com/dotnet/aspnetcore - f84e43dc7a6156e63133f9c0346b58db9d62faf2 + 82ff9246592477abf4ff57ac905a368cbd99ff20 - + https://github.com/dotnet/aspnetcore - f84e43dc7a6156e63133f9c0346b58db9d62faf2 + 82ff9246592477abf4ff57ac905a368cbd99ff20 - + https://github.com/dotnet/aspnetcore - f84e43dc7a6156e63133f9c0346b58db9d62faf2 + 82ff9246592477abf4ff57ac905a368cbd99ff20 - + https://github.com/dotnet/aspnetcore - f84e43dc7a6156e63133f9c0346b58db9d62faf2 + 82ff9246592477abf4ff57ac905a368cbd99ff20 - + https://github.com/dotnet/aspnetcore - f84e43dc7a6156e63133f9c0346b58db9d62faf2 + 82ff9246592477abf4ff57ac905a368cbd99ff20 - + https://github.com/dotnet/aspnetcore - f84e43dc7a6156e63133f9c0346b58db9d62faf2 + 82ff9246592477abf4ff57ac905a368cbd99ff20 diff --git a/eng/Versions.props b/eng/Versions.props index fe601615b21..9cc1e2ec67a 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -28,52 +28,52 @@ --> - 9.0.0-alpha.1.23523.1 - 9.0.0-alpha.1.23523.1 - 9.0.0-alpha.1.23523.1 - 9.0.0-alpha.1.23523.1 - 9.0.0-alpha.1.23523.1 - 9.0.0-alpha.1.23523.1 - 9.0.0-alpha.1.23523.1 - 9.0.0-alpha.1.23523.1 - 9.0.0-alpha.1.23523.1 - 9.0.0-alpha.1.23523.1 - 9.0.0-alpha.1.23523.1 - 9.0.0-alpha.1.23523.1 - 9.0.0-alpha.1.23523.1 - 9.0.0-alpha.1.23523.1 - 9.0.0-alpha.1.23523.1 - 9.0.0-alpha.1.23523.1 - 9.0.0-alpha.1.23523.1 - 9.0.0-alpha.1.23523.1 - 9.0.0-alpha.1.23523.1 - 9.0.0-alpha.1.23523.1 - 9.0.0-alpha.1.23523.1 - 9.0.0-alpha.1.23523.1 - 9.0.0-alpha.1.23523.1 - 9.0.0-alpha.1.23523.1 - 9.0.0-alpha.1.23523.1 - 9.0.0-alpha.1.23523.1 - 9.0.0-alpha.1.23523.1 - 9.0.0-alpha.1.23523.1 - 9.0.0-alpha.1.23523.1 - 9.0.0-alpha.1.23523.1 - 9.0.0-alpha.1.23523.1 - 9.0.0-alpha.1.23523.1 - 9.0.0-alpha.1.23523.1 - 9.0.0-alpha.1.23523.1 - 9.0.0-alpha.1.23523.1 + 9.0.0-alpha.1.23523.13 + 9.0.0-alpha.1.23523.13 + 9.0.0-alpha.1.23523.13 + 9.0.0-alpha.1.23523.13 + 9.0.0-alpha.1.23523.13 + 9.0.0-alpha.1.23523.13 + 9.0.0-alpha.1.23523.13 + 9.0.0-alpha.1.23523.13 + 9.0.0-alpha.1.23523.13 + 9.0.0-alpha.1.23523.13 + 9.0.0-alpha.1.23523.13 + 9.0.0-alpha.1.23523.13 + 9.0.0-alpha.1.23523.13 + 9.0.0-alpha.1.23523.13 + 9.0.0-alpha.1.23523.13 + 9.0.0-alpha.1.23523.13 + 9.0.0-alpha.1.23523.13 + 9.0.0-alpha.1.23523.13 + 9.0.0-alpha.1.23523.13 + 9.0.0-alpha.1.23523.13 + 9.0.0-alpha.1.23523.13 + 9.0.0-alpha.1.23523.13 + 9.0.0-alpha.1.23523.13 + 9.0.0-alpha.1.23523.13 + 9.0.0-alpha.1.23523.13 + 9.0.0-alpha.1.23523.13 + 9.0.0-alpha.1.23523.13 + 9.0.0-alpha.1.23523.13 + 9.0.0-alpha.1.23523.13 + 9.0.0-alpha.1.23523.13 + 9.0.0-alpha.1.23523.13 + 9.0.0-alpha.1.23523.13 + 9.0.0-alpha.1.23523.13 + 9.0.0-alpha.1.23523.13 + 9.0.0-alpha.1.23523.13 - 9.0.0-alpha.1.23524.1 - 9.0.0-alpha.1.23524.1 - 9.0.0-alpha.1.23524.1 - 9.0.0-alpha.1.23524.1 - 9.0.0-alpha.1.23524.1 - 9.0.0-alpha.1.23524.1 - 9.0.0-alpha.1.23524.1 - 9.0.0-alpha.1.23524.1 - 9.0.0-alpha.1.23524.1 - 9.0.0-alpha.1.23524.1 + 9.0.0-alpha.1.23524.18 + 9.0.0-alpha.1.23524.18 + 9.0.0-alpha.1.23524.18 + 9.0.0-alpha.1.23524.18 + 9.0.0-alpha.1.23524.18 + 9.0.0-alpha.1.23524.18 + 9.0.0-alpha.1.23524.18 + 9.0.0-alpha.1.23524.18 + 9.0.0-alpha.1.23524.18 + 9.0.0-alpha.1.23524.18 - + https://github.com/dotnet/runtime - d775a3bb77add85dc30032b20c78c83f9a0e3c1f + a270140281a13ab82a4401dff3da6d27fe499087 - + https://github.com/dotnet/runtime - d775a3bb77add85dc30032b20c78c83f9a0e3c1f + a270140281a13ab82a4401dff3da6d27fe499087 - + https://github.com/dotnet/runtime - d775a3bb77add85dc30032b20c78c83f9a0e3c1f + a270140281a13ab82a4401dff3da6d27fe499087 - + https://github.com/dotnet/runtime - d775a3bb77add85dc30032b20c78c83f9a0e3c1f + a270140281a13ab82a4401dff3da6d27fe499087 - + https://github.com/dotnet/runtime - d775a3bb77add85dc30032b20c78c83f9a0e3c1f + a270140281a13ab82a4401dff3da6d27fe499087 - + https://github.com/dotnet/runtime - d775a3bb77add85dc30032b20c78c83f9a0e3c1f + a270140281a13ab82a4401dff3da6d27fe499087 - + https://github.com/dotnet/runtime - d775a3bb77add85dc30032b20c78c83f9a0e3c1f + a270140281a13ab82a4401dff3da6d27fe499087 - + https://github.com/dotnet/runtime - d775a3bb77add85dc30032b20c78c83f9a0e3c1f + a270140281a13ab82a4401dff3da6d27fe499087 - + https://github.com/dotnet/runtime - d775a3bb77add85dc30032b20c78c83f9a0e3c1f + a270140281a13ab82a4401dff3da6d27fe499087 - + https://github.com/dotnet/runtime - d775a3bb77add85dc30032b20c78c83f9a0e3c1f + a270140281a13ab82a4401dff3da6d27fe499087 - + https://github.com/dotnet/runtime - d775a3bb77add85dc30032b20c78c83f9a0e3c1f + a270140281a13ab82a4401dff3da6d27fe499087 - + https://github.com/dotnet/runtime - d775a3bb77add85dc30032b20c78c83f9a0e3c1f + a270140281a13ab82a4401dff3da6d27fe499087 - + https://github.com/dotnet/aspnetcore - 82ff9246592477abf4ff57ac905a368cbd99ff20 + ffa0a028464e13d46aaec0c5ad8de0725a4d5aa5 - + https://github.com/dotnet/aspnetcore - 82ff9246592477abf4ff57ac905a368cbd99ff20 + ffa0a028464e13d46aaec0c5ad8de0725a4d5aa5 - + https://github.com/dotnet/aspnetcore - 82ff9246592477abf4ff57ac905a368cbd99ff20 + ffa0a028464e13d46aaec0c5ad8de0725a4d5aa5 - + https://github.com/dotnet/aspnetcore - 82ff9246592477abf4ff57ac905a368cbd99ff20 + ffa0a028464e13d46aaec0c5ad8de0725a4d5aa5 - + https://github.com/dotnet/aspnetcore - 82ff9246592477abf4ff57ac905a368cbd99ff20 + ffa0a028464e13d46aaec0c5ad8de0725a4d5aa5 - + https://github.com/dotnet/aspnetcore - 82ff9246592477abf4ff57ac905a368cbd99ff20 + ffa0a028464e13d46aaec0c5ad8de0725a4d5aa5 - + https://github.com/dotnet/aspnetcore - 82ff9246592477abf4ff57ac905a368cbd99ff20 + ffa0a028464e13d46aaec0c5ad8de0725a4d5aa5 - + https://github.com/dotnet/aspnetcore - 82ff9246592477abf4ff57ac905a368cbd99ff20 + ffa0a028464e13d46aaec0c5ad8de0725a4d5aa5 - + https://github.com/dotnet/aspnetcore - 82ff9246592477abf4ff57ac905a368cbd99ff20 + ffa0a028464e13d46aaec0c5ad8de0725a4d5aa5 - + https://github.com/dotnet/aspnetcore - 82ff9246592477abf4ff57ac905a368cbd99ff20 + ffa0a028464e13d46aaec0c5ad8de0725a4d5aa5 diff --git a/eng/Versions.props b/eng/Versions.props index 9cc1e2ec67a..96beed61b2c 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -28,52 +28,52 @@ --> - 9.0.0-alpha.1.23523.13 - 9.0.0-alpha.1.23523.13 - 9.0.0-alpha.1.23523.13 - 9.0.0-alpha.1.23523.13 - 9.0.0-alpha.1.23523.13 - 9.0.0-alpha.1.23523.13 - 9.0.0-alpha.1.23523.13 - 9.0.0-alpha.1.23523.13 - 9.0.0-alpha.1.23523.13 - 9.0.0-alpha.1.23523.13 - 9.0.0-alpha.1.23523.13 - 9.0.0-alpha.1.23523.13 - 9.0.0-alpha.1.23523.13 - 9.0.0-alpha.1.23523.13 - 9.0.0-alpha.1.23523.13 - 9.0.0-alpha.1.23523.13 - 9.0.0-alpha.1.23523.13 - 9.0.0-alpha.1.23523.13 - 9.0.0-alpha.1.23523.13 - 9.0.0-alpha.1.23523.13 - 9.0.0-alpha.1.23523.13 - 9.0.0-alpha.1.23523.13 - 9.0.0-alpha.1.23523.13 - 9.0.0-alpha.1.23523.13 - 9.0.0-alpha.1.23523.13 - 9.0.0-alpha.1.23523.13 - 9.0.0-alpha.1.23523.13 - 9.0.0-alpha.1.23523.13 - 9.0.0-alpha.1.23523.13 - 9.0.0-alpha.1.23523.13 - 9.0.0-alpha.1.23523.13 - 9.0.0-alpha.1.23523.13 - 9.0.0-alpha.1.23523.13 - 9.0.0-alpha.1.23523.13 - 9.0.0-alpha.1.23523.13 + 9.0.0-alpha.1.23524.6 + 9.0.0-alpha.1.23524.6 + 9.0.0-alpha.1.23524.6 + 9.0.0-alpha.1.23524.6 + 9.0.0-alpha.1.23524.6 + 9.0.0-alpha.1.23524.6 + 9.0.0-alpha.1.23524.6 + 9.0.0-alpha.1.23524.6 + 9.0.0-alpha.1.23524.6 + 9.0.0-alpha.1.23524.6 + 9.0.0-alpha.1.23524.6 + 9.0.0-alpha.1.23524.6 + 9.0.0-alpha.1.23524.6 + 9.0.0-alpha.1.23524.6 + 9.0.0-alpha.1.23524.6 + 9.0.0-alpha.1.23524.6 + 9.0.0-alpha.1.23524.6 + 9.0.0-alpha.1.23524.6 + 9.0.0-alpha.1.23524.6 + 9.0.0-alpha.1.23524.6 + 9.0.0-alpha.1.23524.6 + 9.0.0-alpha.1.23524.6 + 9.0.0-alpha.1.23524.6 + 9.0.0-alpha.1.23524.6 + 9.0.0-alpha.1.23524.6 + 9.0.0-alpha.1.23524.6 + 9.0.0-alpha.1.23524.6 + 9.0.0-alpha.1.23524.6 + 9.0.0-alpha.1.23524.6 + 9.0.0-alpha.1.23524.6 + 9.0.0-alpha.1.23524.6 + 9.0.0-alpha.1.23524.6 + 9.0.0-alpha.1.23524.6 + 9.0.0-alpha.1.23524.6 + 9.0.0-alpha.1.23524.6 - 9.0.0-alpha.1.23524.18 - 9.0.0-alpha.1.23524.18 - 9.0.0-alpha.1.23524.18 - 9.0.0-alpha.1.23524.18 - 9.0.0-alpha.1.23524.18 - 9.0.0-alpha.1.23524.18 - 9.0.0-alpha.1.23524.18 - 9.0.0-alpha.1.23524.18 - 9.0.0-alpha.1.23524.18 - 9.0.0-alpha.1.23524.18 + 9.0.0-alpha.1.23525.5 + 9.0.0-alpha.1.23525.5 + 9.0.0-alpha.1.23525.5 + 9.0.0-alpha.1.23525.5 + 9.0.0-alpha.1.23525.5 + 9.0.0-alpha.1.23525.5 + 9.0.0-alpha.1.23525.5 + 9.0.0-alpha.1.23525.5 + 9.0.0-alpha.1.23525.5 + 9.0.0-alpha.1.23525.5 - + https://github.com/dotnet/runtime - a270140281a13ab82a4401dff3da6d27fe499087 + db558253fbd598ed682272c736ae6102673bd921 - + https://github.com/dotnet/runtime - a270140281a13ab82a4401dff3da6d27fe499087 + db558253fbd598ed682272c736ae6102673bd921 - + https://github.com/dotnet/runtime - a270140281a13ab82a4401dff3da6d27fe499087 + db558253fbd598ed682272c736ae6102673bd921 - + https://github.com/dotnet/runtime - a270140281a13ab82a4401dff3da6d27fe499087 + db558253fbd598ed682272c736ae6102673bd921 - + https://github.com/dotnet/runtime - a270140281a13ab82a4401dff3da6d27fe499087 + db558253fbd598ed682272c736ae6102673bd921 - + https://github.com/dotnet/runtime - a270140281a13ab82a4401dff3da6d27fe499087 + db558253fbd598ed682272c736ae6102673bd921 - + https://github.com/dotnet/runtime - a270140281a13ab82a4401dff3da6d27fe499087 + db558253fbd598ed682272c736ae6102673bd921 - + https://github.com/dotnet/runtime - a270140281a13ab82a4401dff3da6d27fe499087 + db558253fbd598ed682272c736ae6102673bd921 - + https://github.com/dotnet/runtime - a270140281a13ab82a4401dff3da6d27fe499087 + db558253fbd598ed682272c736ae6102673bd921 - + https://github.com/dotnet/runtime - a270140281a13ab82a4401dff3da6d27fe499087 + db558253fbd598ed682272c736ae6102673bd921 - + https://github.com/dotnet/runtime - a270140281a13ab82a4401dff3da6d27fe499087 + db558253fbd598ed682272c736ae6102673bd921 - + https://github.com/dotnet/runtime - a270140281a13ab82a4401dff3da6d27fe499087 + db558253fbd598ed682272c736ae6102673bd921 - + https://github.com/dotnet/aspnetcore - ffa0a028464e13d46aaec0c5ad8de0725a4d5aa5 + 560245be5abfc10e2583adb0ed8cdd1a60bad3e2 - + https://github.com/dotnet/aspnetcore - ffa0a028464e13d46aaec0c5ad8de0725a4d5aa5 + 560245be5abfc10e2583adb0ed8cdd1a60bad3e2 - + https://github.com/dotnet/aspnetcore - ffa0a028464e13d46aaec0c5ad8de0725a4d5aa5 + 560245be5abfc10e2583adb0ed8cdd1a60bad3e2 - + https://github.com/dotnet/aspnetcore - ffa0a028464e13d46aaec0c5ad8de0725a4d5aa5 + 560245be5abfc10e2583adb0ed8cdd1a60bad3e2 - + https://github.com/dotnet/aspnetcore - ffa0a028464e13d46aaec0c5ad8de0725a4d5aa5 + 560245be5abfc10e2583adb0ed8cdd1a60bad3e2 - + https://github.com/dotnet/aspnetcore - ffa0a028464e13d46aaec0c5ad8de0725a4d5aa5 + 560245be5abfc10e2583adb0ed8cdd1a60bad3e2 - + https://github.com/dotnet/aspnetcore - ffa0a028464e13d46aaec0c5ad8de0725a4d5aa5 + 560245be5abfc10e2583adb0ed8cdd1a60bad3e2 - + https://github.com/dotnet/aspnetcore - ffa0a028464e13d46aaec0c5ad8de0725a4d5aa5 + 560245be5abfc10e2583adb0ed8cdd1a60bad3e2 - + https://github.com/dotnet/aspnetcore - ffa0a028464e13d46aaec0c5ad8de0725a4d5aa5 + 560245be5abfc10e2583adb0ed8cdd1a60bad3e2 - + https://github.com/dotnet/aspnetcore - ffa0a028464e13d46aaec0c5ad8de0725a4d5aa5 + 560245be5abfc10e2583adb0ed8cdd1a60bad3e2 diff --git a/eng/Versions.props b/eng/Versions.props index 96beed61b2c..d5e1e5cd088 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -28,52 +28,52 @@ --> - 9.0.0-alpha.1.23524.6 - 9.0.0-alpha.1.23524.6 - 9.0.0-alpha.1.23524.6 - 9.0.0-alpha.1.23524.6 - 9.0.0-alpha.1.23524.6 - 9.0.0-alpha.1.23524.6 - 9.0.0-alpha.1.23524.6 - 9.0.0-alpha.1.23524.6 - 9.0.0-alpha.1.23524.6 - 9.0.0-alpha.1.23524.6 - 9.0.0-alpha.1.23524.6 - 9.0.0-alpha.1.23524.6 - 9.0.0-alpha.1.23524.6 - 9.0.0-alpha.1.23524.6 - 9.0.0-alpha.1.23524.6 - 9.0.0-alpha.1.23524.6 - 9.0.0-alpha.1.23524.6 - 9.0.0-alpha.1.23524.6 - 9.0.0-alpha.1.23524.6 - 9.0.0-alpha.1.23524.6 - 9.0.0-alpha.1.23524.6 - 9.0.0-alpha.1.23524.6 - 9.0.0-alpha.1.23524.6 - 9.0.0-alpha.1.23524.6 - 9.0.0-alpha.1.23524.6 - 9.0.0-alpha.1.23524.6 - 9.0.0-alpha.1.23524.6 - 9.0.0-alpha.1.23524.6 - 9.0.0-alpha.1.23524.6 - 9.0.0-alpha.1.23524.6 - 9.0.0-alpha.1.23524.6 - 9.0.0-alpha.1.23524.6 - 9.0.0-alpha.1.23524.6 - 9.0.0-alpha.1.23524.6 - 9.0.0-alpha.1.23524.6 + 9.0.0-alpha.1.23525.10 + 9.0.0-alpha.1.23525.10 + 9.0.0-alpha.1.23525.10 + 9.0.0-alpha.1.23525.10 + 9.0.0-alpha.1.23525.10 + 9.0.0-alpha.1.23525.10 + 9.0.0-alpha.1.23525.10 + 9.0.0-alpha.1.23525.10 + 9.0.0-alpha.1.23525.10 + 9.0.0-alpha.1.23525.10 + 9.0.0-alpha.1.23525.10 + 9.0.0-alpha.1.23525.10 + 9.0.0-alpha.1.23525.10 + 9.0.0-alpha.1.23525.10 + 9.0.0-alpha.1.23525.10 + 9.0.0-alpha.1.23525.10 + 9.0.0-alpha.1.23525.10 + 9.0.0-alpha.1.23525.10 + 9.0.0-alpha.1.23525.10 + 9.0.0-alpha.1.23525.10 + 9.0.0-alpha.1.23525.10 + 9.0.0-alpha.1.23525.10 + 9.0.0-alpha.1.23525.10 + 9.0.0-alpha.1.23525.10 + 9.0.0-alpha.1.23525.10 + 9.0.0-alpha.1.23525.10 + 9.0.0-alpha.1.23525.10 + 9.0.0-alpha.1.23525.10 + 9.0.0-alpha.1.23525.10 + 9.0.0-alpha.1.23525.10 + 9.0.0-alpha.1.23525.10 + 9.0.0-alpha.1.23525.10 + 9.0.0-alpha.1.23525.10 + 9.0.0-alpha.1.23525.10 + 9.0.0-alpha.1.23525.10 - 9.0.0-alpha.1.23525.5 - 9.0.0-alpha.1.23525.5 - 9.0.0-alpha.1.23525.5 - 9.0.0-alpha.1.23525.5 - 9.0.0-alpha.1.23525.5 - 9.0.0-alpha.1.23525.5 - 9.0.0-alpha.1.23525.5 - 9.0.0-alpha.1.23525.5 - 9.0.0-alpha.1.23525.5 - 9.0.0-alpha.1.23525.5 + 9.0.0-alpha.1.23527.4 + 9.0.0-alpha.1.23527.4 + 9.0.0-alpha.1.23527.4 + 9.0.0-alpha.1.23527.4 + 9.0.0-alpha.1.23527.4 + 9.0.0-alpha.1.23527.4 + 9.0.0-alpha.1.23527.4 + 9.0.0-alpha.1.23527.4 + 9.0.0-alpha.1.23527.4 + 9.0.0-alpha.1.23527.4 - + https://github.com/dotnet/runtime - db558253fbd598ed682272c736ae6102673bd921 + 039631a8e9f62a9a9ee72edc6c7896d58722e491 - + https://github.com/dotnet/runtime - db558253fbd598ed682272c736ae6102673bd921 + 039631a8e9f62a9a9ee72edc6c7896d58722e491 - + https://github.com/dotnet/runtime - db558253fbd598ed682272c736ae6102673bd921 + 039631a8e9f62a9a9ee72edc6c7896d58722e491 - + https://github.com/dotnet/runtime - db558253fbd598ed682272c736ae6102673bd921 + 039631a8e9f62a9a9ee72edc6c7896d58722e491 - + https://github.com/dotnet/runtime - db558253fbd598ed682272c736ae6102673bd921 + 039631a8e9f62a9a9ee72edc6c7896d58722e491 - + https://github.com/dotnet/runtime - db558253fbd598ed682272c736ae6102673bd921 + 039631a8e9f62a9a9ee72edc6c7896d58722e491 - + https://github.com/dotnet/runtime - db558253fbd598ed682272c736ae6102673bd921 + 039631a8e9f62a9a9ee72edc6c7896d58722e491 - + https://github.com/dotnet/runtime - db558253fbd598ed682272c736ae6102673bd921 + 039631a8e9f62a9a9ee72edc6c7896d58722e491 - + https://github.com/dotnet/runtime - db558253fbd598ed682272c736ae6102673bd921 + 039631a8e9f62a9a9ee72edc6c7896d58722e491 - + https://github.com/dotnet/runtime - db558253fbd598ed682272c736ae6102673bd921 + 039631a8e9f62a9a9ee72edc6c7896d58722e491 - + https://github.com/dotnet/runtime - db558253fbd598ed682272c736ae6102673bd921 + 039631a8e9f62a9a9ee72edc6c7896d58722e491 - + https://github.com/dotnet/runtime - db558253fbd598ed682272c736ae6102673bd921 + 039631a8e9f62a9a9ee72edc6c7896d58722e491 - + https://github.com/dotnet/aspnetcore - 560245be5abfc10e2583adb0ed8cdd1a60bad3e2 + 008fc0c8bb5e00f629c862d4b643a79cad515b92 - + https://github.com/dotnet/aspnetcore - 560245be5abfc10e2583adb0ed8cdd1a60bad3e2 + 008fc0c8bb5e00f629c862d4b643a79cad515b92 - + https://github.com/dotnet/aspnetcore - 560245be5abfc10e2583adb0ed8cdd1a60bad3e2 + 008fc0c8bb5e00f629c862d4b643a79cad515b92 - + https://github.com/dotnet/aspnetcore - 560245be5abfc10e2583adb0ed8cdd1a60bad3e2 + 008fc0c8bb5e00f629c862d4b643a79cad515b92 - + https://github.com/dotnet/aspnetcore - 560245be5abfc10e2583adb0ed8cdd1a60bad3e2 + 008fc0c8bb5e00f629c862d4b643a79cad515b92 - + https://github.com/dotnet/aspnetcore - 560245be5abfc10e2583adb0ed8cdd1a60bad3e2 + 008fc0c8bb5e00f629c862d4b643a79cad515b92 - + https://github.com/dotnet/aspnetcore - 560245be5abfc10e2583adb0ed8cdd1a60bad3e2 + 008fc0c8bb5e00f629c862d4b643a79cad515b92 - + https://github.com/dotnet/aspnetcore - 560245be5abfc10e2583adb0ed8cdd1a60bad3e2 + 008fc0c8bb5e00f629c862d4b643a79cad515b92 - + https://github.com/dotnet/aspnetcore - 560245be5abfc10e2583adb0ed8cdd1a60bad3e2 + 008fc0c8bb5e00f629c862d4b643a79cad515b92 - + https://github.com/dotnet/aspnetcore - 560245be5abfc10e2583adb0ed8cdd1a60bad3e2 + 008fc0c8bb5e00f629c862d4b643a79cad515b92 diff --git a/eng/Versions.props b/eng/Versions.props index d5e1e5cd088..e4e69947bbd 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -28,52 +28,52 @@ --> - 9.0.0-alpha.1.23525.10 - 9.0.0-alpha.1.23525.10 - 9.0.0-alpha.1.23525.10 - 9.0.0-alpha.1.23525.10 - 9.0.0-alpha.1.23525.10 - 9.0.0-alpha.1.23525.10 - 9.0.0-alpha.1.23525.10 - 9.0.0-alpha.1.23525.10 - 9.0.0-alpha.1.23525.10 - 9.0.0-alpha.1.23525.10 - 9.0.0-alpha.1.23525.10 - 9.0.0-alpha.1.23525.10 - 9.0.0-alpha.1.23525.10 - 9.0.0-alpha.1.23525.10 - 9.0.0-alpha.1.23525.10 - 9.0.0-alpha.1.23525.10 - 9.0.0-alpha.1.23525.10 - 9.0.0-alpha.1.23525.10 - 9.0.0-alpha.1.23525.10 - 9.0.0-alpha.1.23525.10 - 9.0.0-alpha.1.23525.10 - 9.0.0-alpha.1.23525.10 - 9.0.0-alpha.1.23525.10 - 9.0.0-alpha.1.23525.10 - 9.0.0-alpha.1.23525.10 - 9.0.0-alpha.1.23525.10 - 9.0.0-alpha.1.23525.10 - 9.0.0-alpha.1.23525.10 - 9.0.0-alpha.1.23525.10 - 9.0.0-alpha.1.23525.10 - 9.0.0-alpha.1.23525.10 - 9.0.0-alpha.1.23525.10 - 9.0.0-alpha.1.23525.10 - 9.0.0-alpha.1.23525.10 - 9.0.0-alpha.1.23525.10 + 9.0.0-alpha.1.23527.14 + 9.0.0-alpha.1.23527.14 + 9.0.0-alpha.1.23527.14 + 9.0.0-alpha.1.23527.14 + 9.0.0-alpha.1.23527.14 + 9.0.0-alpha.1.23527.14 + 9.0.0-alpha.1.23527.14 + 9.0.0-alpha.1.23527.14 + 9.0.0-alpha.1.23527.14 + 9.0.0-alpha.1.23527.14 + 9.0.0-alpha.1.23527.14 + 9.0.0-alpha.1.23527.14 + 9.0.0-alpha.1.23527.14 + 9.0.0-alpha.1.23527.14 + 9.0.0-alpha.1.23527.14 + 9.0.0-alpha.1.23527.14 + 9.0.0-alpha.1.23527.14 + 9.0.0-alpha.1.23527.14 + 9.0.0-alpha.1.23527.14 + 9.0.0-alpha.1.23527.14 + 9.0.0-alpha.1.23527.14 + 9.0.0-alpha.1.23527.14 + 9.0.0-alpha.1.23527.14 + 9.0.0-alpha.1.23527.14 + 9.0.0-alpha.1.23527.14 + 9.0.0-alpha.1.23527.14 + 9.0.0-alpha.1.23527.14 + 9.0.0-alpha.1.23527.14 + 9.0.0-alpha.1.23527.14 + 9.0.0-alpha.1.23527.14 + 9.0.0-alpha.1.23527.14 + 9.0.0-alpha.1.23527.14 + 9.0.0-alpha.1.23527.14 + 9.0.0-alpha.1.23527.14 + 9.0.0-alpha.1.23527.14 - 9.0.0-alpha.1.23527.4 - 9.0.0-alpha.1.23527.4 - 9.0.0-alpha.1.23527.4 - 9.0.0-alpha.1.23527.4 - 9.0.0-alpha.1.23527.4 - 9.0.0-alpha.1.23527.4 - 9.0.0-alpha.1.23527.4 - 9.0.0-alpha.1.23527.4 - 9.0.0-alpha.1.23527.4 - 9.0.0-alpha.1.23527.4 + 9.0.0-alpha.1.23528.2 + 9.0.0-alpha.1.23528.2 + 9.0.0-alpha.1.23528.2 + 9.0.0-alpha.1.23528.2 + 9.0.0-alpha.1.23528.2 + 9.0.0-alpha.1.23528.2 + 9.0.0-alpha.1.23528.2 + 9.0.0-alpha.1.23528.2 + 9.0.0-alpha.1.23528.2 + 9.0.0-alpha.1.23528.2 - + https://github.com/dotnet/runtime - 039631a8e9f62a9a9ee72edc6c7896d58722e491 + e30792635215453d30af195d2fdfdf2cb5565283 - + https://github.com/dotnet/runtime - 039631a8e9f62a9a9ee72edc6c7896d58722e491 + e30792635215453d30af195d2fdfdf2cb5565283 - + https://github.com/dotnet/runtime - 039631a8e9f62a9a9ee72edc6c7896d58722e491 + e30792635215453d30af195d2fdfdf2cb5565283 - + https://github.com/dotnet/runtime - 039631a8e9f62a9a9ee72edc6c7896d58722e491 + e30792635215453d30af195d2fdfdf2cb5565283 - + https://github.com/dotnet/runtime - 039631a8e9f62a9a9ee72edc6c7896d58722e491 + e30792635215453d30af195d2fdfdf2cb5565283 - + https://github.com/dotnet/runtime - 039631a8e9f62a9a9ee72edc6c7896d58722e491 + e30792635215453d30af195d2fdfdf2cb5565283 - + https://github.com/dotnet/runtime - 039631a8e9f62a9a9ee72edc6c7896d58722e491 + e30792635215453d30af195d2fdfdf2cb5565283 - + https://github.com/dotnet/runtime - 039631a8e9f62a9a9ee72edc6c7896d58722e491 + e30792635215453d30af195d2fdfdf2cb5565283 - + https://github.com/dotnet/runtime - 039631a8e9f62a9a9ee72edc6c7896d58722e491 + e30792635215453d30af195d2fdfdf2cb5565283 - + https://github.com/dotnet/runtime - 039631a8e9f62a9a9ee72edc6c7896d58722e491 + e30792635215453d30af195d2fdfdf2cb5565283 - + https://github.com/dotnet/runtime - 039631a8e9f62a9a9ee72edc6c7896d58722e491 + e30792635215453d30af195d2fdfdf2cb5565283 - + https://github.com/dotnet/runtime - 039631a8e9f62a9a9ee72edc6c7896d58722e491 + e30792635215453d30af195d2fdfdf2cb5565283 - + https://github.com/dotnet/aspnetcore - 008fc0c8bb5e00f629c862d4b643a79cad515b92 + 0bffc80eb103b6dca63a6249a168c4fee45d64ca - + https://github.com/dotnet/aspnetcore - 008fc0c8bb5e00f629c862d4b643a79cad515b92 + 0bffc80eb103b6dca63a6249a168c4fee45d64ca - + https://github.com/dotnet/aspnetcore - 008fc0c8bb5e00f629c862d4b643a79cad515b92 + 0bffc80eb103b6dca63a6249a168c4fee45d64ca - + https://github.com/dotnet/aspnetcore - 008fc0c8bb5e00f629c862d4b643a79cad515b92 + 0bffc80eb103b6dca63a6249a168c4fee45d64ca - + https://github.com/dotnet/aspnetcore - 008fc0c8bb5e00f629c862d4b643a79cad515b92 + 0bffc80eb103b6dca63a6249a168c4fee45d64ca - + https://github.com/dotnet/aspnetcore - 008fc0c8bb5e00f629c862d4b643a79cad515b92 + 0bffc80eb103b6dca63a6249a168c4fee45d64ca - + https://github.com/dotnet/aspnetcore - 008fc0c8bb5e00f629c862d4b643a79cad515b92 + 0bffc80eb103b6dca63a6249a168c4fee45d64ca - + https://github.com/dotnet/aspnetcore - 008fc0c8bb5e00f629c862d4b643a79cad515b92 + 0bffc80eb103b6dca63a6249a168c4fee45d64ca - + https://github.com/dotnet/aspnetcore - 008fc0c8bb5e00f629c862d4b643a79cad515b92 + 0bffc80eb103b6dca63a6249a168c4fee45d64ca - + https://github.com/dotnet/aspnetcore - 008fc0c8bb5e00f629c862d4b643a79cad515b92 + 0bffc80eb103b6dca63a6249a168c4fee45d64ca diff --git a/eng/Versions.props b/eng/Versions.props index e4e69947bbd..52df78d17b9 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -28,52 +28,52 @@ --> - 9.0.0-alpha.1.23527.14 - 9.0.0-alpha.1.23527.14 - 9.0.0-alpha.1.23527.14 - 9.0.0-alpha.1.23527.14 - 9.0.0-alpha.1.23527.14 - 9.0.0-alpha.1.23527.14 - 9.0.0-alpha.1.23527.14 - 9.0.0-alpha.1.23527.14 - 9.0.0-alpha.1.23527.14 - 9.0.0-alpha.1.23527.14 - 9.0.0-alpha.1.23527.14 - 9.0.0-alpha.1.23527.14 - 9.0.0-alpha.1.23527.14 - 9.0.0-alpha.1.23527.14 - 9.0.0-alpha.1.23527.14 - 9.0.0-alpha.1.23527.14 - 9.0.0-alpha.1.23527.14 - 9.0.0-alpha.1.23527.14 - 9.0.0-alpha.1.23527.14 - 9.0.0-alpha.1.23527.14 - 9.0.0-alpha.1.23527.14 - 9.0.0-alpha.1.23527.14 - 9.0.0-alpha.1.23527.14 - 9.0.0-alpha.1.23527.14 - 9.0.0-alpha.1.23527.14 - 9.0.0-alpha.1.23527.14 - 9.0.0-alpha.1.23527.14 - 9.0.0-alpha.1.23527.14 - 9.0.0-alpha.1.23527.14 - 9.0.0-alpha.1.23527.14 - 9.0.0-alpha.1.23527.14 - 9.0.0-alpha.1.23527.14 - 9.0.0-alpha.1.23527.14 - 9.0.0-alpha.1.23527.14 - 9.0.0-alpha.1.23527.14 + 9.0.0-alpha.1.23528.2 + 9.0.0-alpha.1.23528.2 + 9.0.0-alpha.1.23528.2 + 9.0.0-alpha.1.23528.2 + 9.0.0-alpha.1.23528.2 + 9.0.0-alpha.1.23528.2 + 9.0.0-alpha.1.23528.2 + 9.0.0-alpha.1.23528.2 + 9.0.0-alpha.1.23528.2 + 9.0.0-alpha.1.23528.2 + 9.0.0-alpha.1.23528.2 + 9.0.0-alpha.1.23528.2 + 9.0.0-alpha.1.23528.2 + 9.0.0-alpha.1.23528.2 + 9.0.0-alpha.1.23528.2 + 9.0.0-alpha.1.23528.2 + 9.0.0-alpha.1.23528.2 + 9.0.0-alpha.1.23528.2 + 9.0.0-alpha.1.23528.2 + 9.0.0-alpha.1.23528.2 + 9.0.0-alpha.1.23528.2 + 9.0.0-alpha.1.23528.2 + 9.0.0-alpha.1.23528.2 + 9.0.0-alpha.1.23528.2 + 9.0.0-alpha.1.23528.2 + 9.0.0-alpha.1.23528.2 + 9.0.0-alpha.1.23528.2 + 9.0.0-alpha.1.23528.2 + 9.0.0-alpha.1.23528.2 + 9.0.0-alpha.1.23528.2 + 9.0.0-alpha.1.23528.2 + 9.0.0-alpha.1.23528.2 + 9.0.0-alpha.1.23528.2 + 9.0.0-alpha.1.23528.2 + 9.0.0-alpha.1.23528.2 - 9.0.0-alpha.1.23528.2 - 9.0.0-alpha.1.23528.2 - 9.0.0-alpha.1.23528.2 - 9.0.0-alpha.1.23528.2 - 9.0.0-alpha.1.23528.2 - 9.0.0-alpha.1.23528.2 - 9.0.0-alpha.1.23528.2 - 9.0.0-alpha.1.23528.2 - 9.0.0-alpha.1.23528.2 - 9.0.0-alpha.1.23528.2 + 9.0.0-alpha.1.23529.2 + 9.0.0-alpha.1.23529.2 + 9.0.0-alpha.1.23529.2 + 9.0.0-alpha.1.23529.2 + 9.0.0-alpha.1.23529.2 + 9.0.0-alpha.1.23529.2 + 9.0.0-alpha.1.23529.2 + 9.0.0-alpha.1.23529.2 + 9.0.0-alpha.1.23529.2 + 9.0.0-alpha.1.23529.2 - + https://github.com/dotnet/runtime - e30792635215453d30af195d2fdfdf2cb5565283 + e5c631d28b985b773b28d0cb2346f49a92bd41dd - + https://github.com/dotnet/runtime - e30792635215453d30af195d2fdfdf2cb5565283 + e5c631d28b985b773b28d0cb2346f49a92bd41dd - + https://github.com/dotnet/runtime - e30792635215453d30af195d2fdfdf2cb5565283 + e5c631d28b985b773b28d0cb2346f49a92bd41dd - + https://github.com/dotnet/runtime - e30792635215453d30af195d2fdfdf2cb5565283 + e5c631d28b985b773b28d0cb2346f49a92bd41dd - + https://github.com/dotnet/runtime - e30792635215453d30af195d2fdfdf2cb5565283 + e5c631d28b985b773b28d0cb2346f49a92bd41dd - + https://github.com/dotnet/runtime - e30792635215453d30af195d2fdfdf2cb5565283 + e5c631d28b985b773b28d0cb2346f49a92bd41dd - + https://github.com/dotnet/runtime - e30792635215453d30af195d2fdfdf2cb5565283 + e5c631d28b985b773b28d0cb2346f49a92bd41dd - + https://github.com/dotnet/runtime - e30792635215453d30af195d2fdfdf2cb5565283 + e5c631d28b985b773b28d0cb2346f49a92bd41dd - + https://github.com/dotnet/runtime - e30792635215453d30af195d2fdfdf2cb5565283 + e5c631d28b985b773b28d0cb2346f49a92bd41dd - + https://github.com/dotnet/runtime - e30792635215453d30af195d2fdfdf2cb5565283 + e5c631d28b985b773b28d0cb2346f49a92bd41dd - + https://github.com/dotnet/runtime - e30792635215453d30af195d2fdfdf2cb5565283 + e5c631d28b985b773b28d0cb2346f49a92bd41dd - + https://github.com/dotnet/runtime - e30792635215453d30af195d2fdfdf2cb5565283 + e5c631d28b985b773b28d0cb2346f49a92bd41dd - + https://github.com/dotnet/aspnetcore - 0bffc80eb103b6dca63a6249a168c4fee45d64ca + c15938bb5f23fd3ad2374bde554a6b492a36ecde - + https://github.com/dotnet/aspnetcore - 0bffc80eb103b6dca63a6249a168c4fee45d64ca + c15938bb5f23fd3ad2374bde554a6b492a36ecde - + https://github.com/dotnet/aspnetcore - 0bffc80eb103b6dca63a6249a168c4fee45d64ca + c15938bb5f23fd3ad2374bde554a6b492a36ecde - + https://github.com/dotnet/aspnetcore - 0bffc80eb103b6dca63a6249a168c4fee45d64ca + c15938bb5f23fd3ad2374bde554a6b492a36ecde - + https://github.com/dotnet/aspnetcore - 0bffc80eb103b6dca63a6249a168c4fee45d64ca + c15938bb5f23fd3ad2374bde554a6b492a36ecde - + https://github.com/dotnet/aspnetcore - 0bffc80eb103b6dca63a6249a168c4fee45d64ca + c15938bb5f23fd3ad2374bde554a6b492a36ecde - + https://github.com/dotnet/aspnetcore - 0bffc80eb103b6dca63a6249a168c4fee45d64ca + c15938bb5f23fd3ad2374bde554a6b492a36ecde - + https://github.com/dotnet/aspnetcore - 0bffc80eb103b6dca63a6249a168c4fee45d64ca + c15938bb5f23fd3ad2374bde554a6b492a36ecde - + https://github.com/dotnet/aspnetcore - 0bffc80eb103b6dca63a6249a168c4fee45d64ca + c15938bb5f23fd3ad2374bde554a6b492a36ecde - + https://github.com/dotnet/aspnetcore - 0bffc80eb103b6dca63a6249a168c4fee45d64ca + c15938bb5f23fd3ad2374bde554a6b492a36ecde diff --git a/eng/Versions.props b/eng/Versions.props index 52df78d17b9..3e0579f3c18 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -28,52 +28,52 @@ --> - 9.0.0-alpha.1.23528.2 - 9.0.0-alpha.1.23528.2 - 9.0.0-alpha.1.23528.2 - 9.0.0-alpha.1.23528.2 - 9.0.0-alpha.1.23528.2 - 9.0.0-alpha.1.23528.2 - 9.0.0-alpha.1.23528.2 - 9.0.0-alpha.1.23528.2 - 9.0.0-alpha.1.23528.2 - 9.0.0-alpha.1.23528.2 - 9.0.0-alpha.1.23528.2 - 9.0.0-alpha.1.23528.2 - 9.0.0-alpha.1.23528.2 - 9.0.0-alpha.1.23528.2 - 9.0.0-alpha.1.23528.2 - 9.0.0-alpha.1.23528.2 - 9.0.0-alpha.1.23528.2 - 9.0.0-alpha.1.23528.2 - 9.0.0-alpha.1.23528.2 - 9.0.0-alpha.1.23528.2 - 9.0.0-alpha.1.23528.2 - 9.0.0-alpha.1.23528.2 - 9.0.0-alpha.1.23528.2 - 9.0.0-alpha.1.23528.2 - 9.0.0-alpha.1.23528.2 - 9.0.0-alpha.1.23528.2 - 9.0.0-alpha.1.23528.2 - 9.0.0-alpha.1.23528.2 - 9.0.0-alpha.1.23528.2 - 9.0.0-alpha.1.23528.2 - 9.0.0-alpha.1.23528.2 - 9.0.0-alpha.1.23528.2 - 9.0.0-alpha.1.23528.2 - 9.0.0-alpha.1.23528.2 - 9.0.0-alpha.1.23528.2 + 9.0.0-alpha.1.23529.4 + 9.0.0-alpha.1.23529.4 + 9.0.0-alpha.1.23529.4 + 9.0.0-alpha.1.23529.4 + 9.0.0-alpha.1.23529.4 + 9.0.0-alpha.1.23529.4 + 9.0.0-alpha.1.23529.4 + 9.0.0-alpha.1.23529.4 + 9.0.0-alpha.1.23529.4 + 9.0.0-alpha.1.23529.4 + 9.0.0-alpha.1.23529.4 + 9.0.0-alpha.1.23529.4 + 9.0.0-alpha.1.23529.4 + 9.0.0-alpha.1.23529.4 + 9.0.0-alpha.1.23529.4 + 9.0.0-alpha.1.23529.4 + 9.0.0-alpha.1.23529.4 + 9.0.0-alpha.1.23529.4 + 9.0.0-alpha.1.23529.4 + 9.0.0-alpha.1.23529.4 + 9.0.0-alpha.1.23529.4 + 9.0.0-alpha.1.23529.4 + 9.0.0-alpha.1.23529.4 + 9.0.0-alpha.1.23529.4 + 9.0.0-alpha.1.23529.4 + 9.0.0-alpha.1.23529.4 + 9.0.0-alpha.1.23529.4 + 9.0.0-alpha.1.23529.4 + 9.0.0-alpha.1.23529.4 + 9.0.0-alpha.1.23529.4 + 9.0.0-alpha.1.23529.4 + 9.0.0-alpha.1.23529.4 + 9.0.0-alpha.1.23529.4 + 9.0.0-alpha.1.23529.4 + 9.0.0-alpha.1.23529.4 - 9.0.0-alpha.1.23529.2 - 9.0.0-alpha.1.23529.2 - 9.0.0-alpha.1.23529.2 - 9.0.0-alpha.1.23529.2 - 9.0.0-alpha.1.23529.2 - 9.0.0-alpha.1.23529.2 - 9.0.0-alpha.1.23529.2 - 9.0.0-alpha.1.23529.2 - 9.0.0-alpha.1.23529.2 - 9.0.0-alpha.1.23529.2 + 9.0.0-alpha.1.23530.8 + 9.0.0-alpha.1.23530.8 + 9.0.0-alpha.1.23530.8 + 9.0.0-alpha.1.23530.8 + 9.0.0-alpha.1.23530.8 + 9.0.0-alpha.1.23530.8 + 9.0.0-alpha.1.23530.8 + 9.0.0-alpha.1.23530.8 + 9.0.0-alpha.1.23530.8 + 9.0.0-alpha.1.23530.8 - + https://github.com/dotnet/runtime - e5c631d28b985b773b28d0cb2346f49a92bd41dd + 920cd6e2b01d0fbede8882d015329e9b4d448c98 - + https://github.com/dotnet/runtime - e5c631d28b985b773b28d0cb2346f49a92bd41dd + 920cd6e2b01d0fbede8882d015329e9b4d448c98 - + https://github.com/dotnet/runtime - e5c631d28b985b773b28d0cb2346f49a92bd41dd + 920cd6e2b01d0fbede8882d015329e9b4d448c98 - + https://github.com/dotnet/runtime - e5c631d28b985b773b28d0cb2346f49a92bd41dd + 920cd6e2b01d0fbede8882d015329e9b4d448c98 - + https://github.com/dotnet/runtime - e5c631d28b985b773b28d0cb2346f49a92bd41dd + 920cd6e2b01d0fbede8882d015329e9b4d448c98 - + https://github.com/dotnet/runtime - e5c631d28b985b773b28d0cb2346f49a92bd41dd + 920cd6e2b01d0fbede8882d015329e9b4d448c98 - + https://github.com/dotnet/runtime - e5c631d28b985b773b28d0cb2346f49a92bd41dd + 920cd6e2b01d0fbede8882d015329e9b4d448c98 - + https://github.com/dotnet/runtime - e5c631d28b985b773b28d0cb2346f49a92bd41dd + 920cd6e2b01d0fbede8882d015329e9b4d448c98 - + https://github.com/dotnet/runtime - e5c631d28b985b773b28d0cb2346f49a92bd41dd + 920cd6e2b01d0fbede8882d015329e9b4d448c98 - + https://github.com/dotnet/runtime - e5c631d28b985b773b28d0cb2346f49a92bd41dd + 920cd6e2b01d0fbede8882d015329e9b4d448c98 - + https://github.com/dotnet/runtime - e5c631d28b985b773b28d0cb2346f49a92bd41dd + 920cd6e2b01d0fbede8882d015329e9b4d448c98 - + https://github.com/dotnet/runtime - e5c631d28b985b773b28d0cb2346f49a92bd41dd + 920cd6e2b01d0fbede8882d015329e9b4d448c98 - + https://github.com/dotnet/aspnetcore - c15938bb5f23fd3ad2374bde554a6b492a36ecde + 6ee95e7ecb839ddb2e6c0f0afbd1de809efa2899 - + https://github.com/dotnet/aspnetcore - c15938bb5f23fd3ad2374bde554a6b492a36ecde + 6ee95e7ecb839ddb2e6c0f0afbd1de809efa2899 - + https://github.com/dotnet/aspnetcore - c15938bb5f23fd3ad2374bde554a6b492a36ecde + 6ee95e7ecb839ddb2e6c0f0afbd1de809efa2899 - + https://github.com/dotnet/aspnetcore - c15938bb5f23fd3ad2374bde554a6b492a36ecde + 6ee95e7ecb839ddb2e6c0f0afbd1de809efa2899 - + https://github.com/dotnet/aspnetcore - c15938bb5f23fd3ad2374bde554a6b492a36ecde + 6ee95e7ecb839ddb2e6c0f0afbd1de809efa2899 - + https://github.com/dotnet/aspnetcore - c15938bb5f23fd3ad2374bde554a6b492a36ecde + 6ee95e7ecb839ddb2e6c0f0afbd1de809efa2899 - + https://github.com/dotnet/aspnetcore - c15938bb5f23fd3ad2374bde554a6b492a36ecde + 6ee95e7ecb839ddb2e6c0f0afbd1de809efa2899 - + https://github.com/dotnet/aspnetcore - c15938bb5f23fd3ad2374bde554a6b492a36ecde + 6ee95e7ecb839ddb2e6c0f0afbd1de809efa2899 - + https://github.com/dotnet/aspnetcore - c15938bb5f23fd3ad2374bde554a6b492a36ecde + 6ee95e7ecb839ddb2e6c0f0afbd1de809efa2899 - + https://github.com/dotnet/aspnetcore - c15938bb5f23fd3ad2374bde554a6b492a36ecde + 6ee95e7ecb839ddb2e6c0f0afbd1de809efa2899 diff --git a/eng/Versions.props b/eng/Versions.props index 3e0579f3c18..70f4f4caba3 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -28,52 +28,52 @@ --> - 9.0.0-alpha.1.23529.4 - 9.0.0-alpha.1.23529.4 - 9.0.0-alpha.1.23529.4 - 9.0.0-alpha.1.23529.4 - 9.0.0-alpha.1.23529.4 - 9.0.0-alpha.1.23529.4 - 9.0.0-alpha.1.23529.4 - 9.0.0-alpha.1.23529.4 - 9.0.0-alpha.1.23529.4 - 9.0.0-alpha.1.23529.4 - 9.0.0-alpha.1.23529.4 - 9.0.0-alpha.1.23529.4 - 9.0.0-alpha.1.23529.4 - 9.0.0-alpha.1.23529.4 - 9.0.0-alpha.1.23529.4 - 9.0.0-alpha.1.23529.4 - 9.0.0-alpha.1.23529.4 - 9.0.0-alpha.1.23529.4 - 9.0.0-alpha.1.23529.4 - 9.0.0-alpha.1.23529.4 - 9.0.0-alpha.1.23529.4 - 9.0.0-alpha.1.23529.4 - 9.0.0-alpha.1.23529.4 - 9.0.0-alpha.1.23529.4 - 9.0.0-alpha.1.23529.4 - 9.0.0-alpha.1.23529.4 - 9.0.0-alpha.1.23529.4 - 9.0.0-alpha.1.23529.4 - 9.0.0-alpha.1.23529.4 - 9.0.0-alpha.1.23529.4 - 9.0.0-alpha.1.23529.4 - 9.0.0-alpha.1.23529.4 - 9.0.0-alpha.1.23529.4 - 9.0.0-alpha.1.23529.4 - 9.0.0-alpha.1.23529.4 + 9.0.0-alpha.1.23530.14 + 9.0.0-alpha.1.23530.14 + 9.0.0-alpha.1.23530.14 + 9.0.0-alpha.1.23530.14 + 9.0.0-alpha.1.23530.14 + 9.0.0-alpha.1.23530.14 + 9.0.0-alpha.1.23530.14 + 9.0.0-alpha.1.23530.14 + 9.0.0-alpha.1.23530.14 + 9.0.0-alpha.1.23530.14 + 9.0.0-alpha.1.23530.14 + 9.0.0-alpha.1.23530.14 + 9.0.0-alpha.1.23530.14 + 9.0.0-alpha.1.23530.14 + 9.0.0-alpha.1.23530.14 + 9.0.0-alpha.1.23530.14 + 9.0.0-alpha.1.23530.14 + 9.0.0-alpha.1.23530.14 + 9.0.0-alpha.1.23530.14 + 9.0.0-alpha.1.23530.14 + 9.0.0-alpha.1.23530.14 + 9.0.0-alpha.1.23530.14 + 9.0.0-alpha.1.23530.14 + 9.0.0-alpha.1.23530.14 + 9.0.0-alpha.1.23530.14 + 9.0.0-alpha.1.23530.14 + 9.0.0-alpha.1.23530.14 + 9.0.0-alpha.1.23530.14 + 9.0.0-alpha.1.23530.14 + 9.0.0-alpha.1.23530.14 + 9.0.0-alpha.1.23530.14 + 9.0.0-alpha.1.23530.14 + 9.0.0-alpha.1.23530.14 + 9.0.0-alpha.1.23530.14 + 9.0.0-alpha.1.23530.14 - 9.0.0-alpha.1.23530.8 - 9.0.0-alpha.1.23530.8 - 9.0.0-alpha.1.23530.8 - 9.0.0-alpha.1.23530.8 - 9.0.0-alpha.1.23530.8 - 9.0.0-alpha.1.23530.8 - 9.0.0-alpha.1.23530.8 - 9.0.0-alpha.1.23530.8 - 9.0.0-alpha.1.23530.8 - 9.0.0-alpha.1.23530.8 + 9.0.0-alpha.1.23551.1 + 9.0.0-alpha.1.23551.1 + 9.0.0-alpha.1.23551.1 + 9.0.0-alpha.1.23551.1 + 9.0.0-alpha.1.23551.1 + 9.0.0-alpha.1.23551.1 + 9.0.0-alpha.1.23551.1 + 9.0.0-alpha.1.23551.1 + 9.0.0-alpha.1.23551.1 + 9.0.0-alpha.1.23551.1 - + https://github.com/dotnet/runtime - 920cd6e2b01d0fbede8882d015329e9b4d448c98 + f1d73dad7cafa72735a4e7843a77c6b58db1580e - + https://github.com/dotnet/runtime - 920cd6e2b01d0fbede8882d015329e9b4d448c98 + f1d73dad7cafa72735a4e7843a77c6b58db1580e - + https://github.com/dotnet/runtime - 920cd6e2b01d0fbede8882d015329e9b4d448c98 + f1d73dad7cafa72735a4e7843a77c6b58db1580e - + https://github.com/dotnet/runtime - 920cd6e2b01d0fbede8882d015329e9b4d448c98 + f1d73dad7cafa72735a4e7843a77c6b58db1580e - + https://github.com/dotnet/runtime - 920cd6e2b01d0fbede8882d015329e9b4d448c98 + f1d73dad7cafa72735a4e7843a77c6b58db1580e - + https://github.com/dotnet/runtime - 920cd6e2b01d0fbede8882d015329e9b4d448c98 + f1d73dad7cafa72735a4e7843a77c6b58db1580e - + https://github.com/dotnet/runtime - 920cd6e2b01d0fbede8882d015329e9b4d448c98 + f1d73dad7cafa72735a4e7843a77c6b58db1580e - + https://github.com/dotnet/runtime - 920cd6e2b01d0fbede8882d015329e9b4d448c98 + f1d73dad7cafa72735a4e7843a77c6b58db1580e - + https://github.com/dotnet/runtime - 920cd6e2b01d0fbede8882d015329e9b4d448c98 + f1d73dad7cafa72735a4e7843a77c6b58db1580e - + https://github.com/dotnet/runtime - 920cd6e2b01d0fbede8882d015329e9b4d448c98 + f1d73dad7cafa72735a4e7843a77c6b58db1580e - + https://github.com/dotnet/runtime - 920cd6e2b01d0fbede8882d015329e9b4d448c98 + f1d73dad7cafa72735a4e7843a77c6b58db1580e - + https://github.com/dotnet/runtime - 920cd6e2b01d0fbede8882d015329e9b4d448c98 + f1d73dad7cafa72735a4e7843a77c6b58db1580e - + https://github.com/dotnet/aspnetcore - 6ee95e7ecb839ddb2e6c0f0afbd1de809efa2899 + 6870c9b9946a738e4663a2ba6ecd81eb057571c9 - + https://github.com/dotnet/aspnetcore - 6ee95e7ecb839ddb2e6c0f0afbd1de809efa2899 + 6870c9b9946a738e4663a2ba6ecd81eb057571c9 - + https://github.com/dotnet/aspnetcore - 6ee95e7ecb839ddb2e6c0f0afbd1de809efa2899 + 6870c9b9946a738e4663a2ba6ecd81eb057571c9 - + https://github.com/dotnet/aspnetcore - 6ee95e7ecb839ddb2e6c0f0afbd1de809efa2899 + 6870c9b9946a738e4663a2ba6ecd81eb057571c9 - + https://github.com/dotnet/aspnetcore - 6ee95e7ecb839ddb2e6c0f0afbd1de809efa2899 + 6870c9b9946a738e4663a2ba6ecd81eb057571c9 - + https://github.com/dotnet/aspnetcore - 6ee95e7ecb839ddb2e6c0f0afbd1de809efa2899 + 6870c9b9946a738e4663a2ba6ecd81eb057571c9 - + https://github.com/dotnet/aspnetcore - 6ee95e7ecb839ddb2e6c0f0afbd1de809efa2899 + 6870c9b9946a738e4663a2ba6ecd81eb057571c9 - + https://github.com/dotnet/aspnetcore - 6ee95e7ecb839ddb2e6c0f0afbd1de809efa2899 + 6870c9b9946a738e4663a2ba6ecd81eb057571c9 - + https://github.com/dotnet/aspnetcore - 6ee95e7ecb839ddb2e6c0f0afbd1de809efa2899 + 6870c9b9946a738e4663a2ba6ecd81eb057571c9 - + https://github.com/dotnet/aspnetcore - 6ee95e7ecb839ddb2e6c0f0afbd1de809efa2899 + 6870c9b9946a738e4663a2ba6ecd81eb057571c9 diff --git a/eng/Versions.props b/eng/Versions.props index 70f4f4caba3..5c66ad2f4b7 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -28,52 +28,52 @@ --> - 9.0.0-alpha.1.23530.14 - 9.0.0-alpha.1.23530.14 - 9.0.0-alpha.1.23530.14 - 9.0.0-alpha.1.23530.14 - 9.0.0-alpha.1.23530.14 - 9.0.0-alpha.1.23530.14 - 9.0.0-alpha.1.23530.14 - 9.0.0-alpha.1.23530.14 - 9.0.0-alpha.1.23530.14 - 9.0.0-alpha.1.23530.14 - 9.0.0-alpha.1.23530.14 - 9.0.0-alpha.1.23530.14 - 9.0.0-alpha.1.23530.14 - 9.0.0-alpha.1.23530.14 - 9.0.0-alpha.1.23530.14 - 9.0.0-alpha.1.23530.14 - 9.0.0-alpha.1.23530.14 - 9.0.0-alpha.1.23530.14 - 9.0.0-alpha.1.23530.14 - 9.0.0-alpha.1.23530.14 - 9.0.0-alpha.1.23530.14 - 9.0.0-alpha.1.23530.14 - 9.0.0-alpha.1.23530.14 - 9.0.0-alpha.1.23530.14 - 9.0.0-alpha.1.23530.14 - 9.0.0-alpha.1.23530.14 - 9.0.0-alpha.1.23530.14 - 9.0.0-alpha.1.23530.14 - 9.0.0-alpha.1.23530.14 - 9.0.0-alpha.1.23530.14 - 9.0.0-alpha.1.23530.14 - 9.0.0-alpha.1.23530.14 - 9.0.0-alpha.1.23530.14 - 9.0.0-alpha.1.23530.14 - 9.0.0-alpha.1.23530.14 + 9.0.0-alpha.1.23551.2 + 9.0.0-alpha.1.23551.2 + 9.0.0-alpha.1.23551.2 + 9.0.0-alpha.1.23551.2 + 9.0.0-alpha.1.23551.2 + 9.0.0-alpha.1.23551.2 + 9.0.0-alpha.1.23551.2 + 9.0.0-alpha.1.23551.2 + 9.0.0-alpha.1.23551.2 + 9.0.0-alpha.1.23551.2 + 9.0.0-alpha.1.23551.2 + 9.0.0-alpha.1.23551.2 + 9.0.0-alpha.1.23551.2 + 9.0.0-alpha.1.23551.2 + 9.0.0-alpha.1.23551.2 + 9.0.0-alpha.1.23551.2 + 9.0.0-alpha.1.23551.2 + 9.0.0-alpha.1.23551.2 + 9.0.0-alpha.1.23551.2 + 9.0.0-alpha.1.23551.2 + 9.0.0-alpha.1.23551.2 + 9.0.0-alpha.1.23551.2 + 9.0.0-alpha.1.23551.2 + 9.0.0-alpha.1.23551.2 + 9.0.0-alpha.1.23551.2 + 9.0.0-alpha.1.23551.2 + 9.0.0-alpha.1.23551.2 + 9.0.0-alpha.1.23551.2 + 9.0.0-alpha.1.23551.2 + 9.0.0-alpha.1.23551.2 + 9.0.0-alpha.1.23551.2 + 9.0.0-alpha.1.23551.2 + 9.0.0-alpha.1.23551.2 + 9.0.0-alpha.1.23551.2 + 9.0.0-alpha.1.23551.2 - 9.0.0-alpha.1.23551.1 - 9.0.0-alpha.1.23551.1 - 9.0.0-alpha.1.23551.1 - 9.0.0-alpha.1.23551.1 - 9.0.0-alpha.1.23551.1 - 9.0.0-alpha.1.23551.1 - 9.0.0-alpha.1.23551.1 - 9.0.0-alpha.1.23551.1 - 9.0.0-alpha.1.23551.1 - 9.0.0-alpha.1.23551.1 + 9.0.0-alpha.1.23551.9 + 9.0.0-alpha.1.23551.9 + 9.0.0-alpha.1.23551.9 + 9.0.0-alpha.1.23551.9 + 9.0.0-alpha.1.23551.9 + 9.0.0-alpha.1.23551.9 + 9.0.0-alpha.1.23551.9 + 9.0.0-alpha.1.23551.9 + 9.0.0-alpha.1.23551.9 + 9.0.0-alpha.1.23551.9 - + https://github.com/dotnet/runtime - f1d73dad7cafa72735a4e7843a77c6b58db1580e + 655b177da2e423a04a60a331bc6c11fe5ec427c3 - + https://github.com/dotnet/runtime - f1d73dad7cafa72735a4e7843a77c6b58db1580e + 655b177da2e423a04a60a331bc6c11fe5ec427c3 - + https://github.com/dotnet/runtime - f1d73dad7cafa72735a4e7843a77c6b58db1580e + 655b177da2e423a04a60a331bc6c11fe5ec427c3 - + https://github.com/dotnet/runtime - f1d73dad7cafa72735a4e7843a77c6b58db1580e + 655b177da2e423a04a60a331bc6c11fe5ec427c3 - + https://github.com/dotnet/runtime - f1d73dad7cafa72735a4e7843a77c6b58db1580e + 655b177da2e423a04a60a331bc6c11fe5ec427c3 - + https://github.com/dotnet/runtime - f1d73dad7cafa72735a4e7843a77c6b58db1580e + 655b177da2e423a04a60a331bc6c11fe5ec427c3 - + https://github.com/dotnet/runtime - f1d73dad7cafa72735a4e7843a77c6b58db1580e + 655b177da2e423a04a60a331bc6c11fe5ec427c3 - + https://github.com/dotnet/runtime - f1d73dad7cafa72735a4e7843a77c6b58db1580e + 655b177da2e423a04a60a331bc6c11fe5ec427c3 - + https://github.com/dotnet/runtime - f1d73dad7cafa72735a4e7843a77c6b58db1580e + 655b177da2e423a04a60a331bc6c11fe5ec427c3 - + https://github.com/dotnet/runtime - f1d73dad7cafa72735a4e7843a77c6b58db1580e + 655b177da2e423a04a60a331bc6c11fe5ec427c3 - + https://github.com/dotnet/runtime - f1d73dad7cafa72735a4e7843a77c6b58db1580e + 655b177da2e423a04a60a331bc6c11fe5ec427c3 - + https://github.com/dotnet/runtime - f1d73dad7cafa72735a4e7843a77c6b58db1580e + 655b177da2e423a04a60a331bc6c11fe5ec427c3 - + https://github.com/dotnet/aspnetcore - 6870c9b9946a738e4663a2ba6ecd81eb057571c9 + 5cd5fe0c017255da4b521d0ad737bb6e260ed167 - + https://github.com/dotnet/aspnetcore - 6870c9b9946a738e4663a2ba6ecd81eb057571c9 + 5cd5fe0c017255da4b521d0ad737bb6e260ed167 - + https://github.com/dotnet/aspnetcore - 6870c9b9946a738e4663a2ba6ecd81eb057571c9 + 5cd5fe0c017255da4b521d0ad737bb6e260ed167 - + https://github.com/dotnet/aspnetcore - 6870c9b9946a738e4663a2ba6ecd81eb057571c9 + 5cd5fe0c017255da4b521d0ad737bb6e260ed167 - + https://github.com/dotnet/aspnetcore - 6870c9b9946a738e4663a2ba6ecd81eb057571c9 + 5cd5fe0c017255da4b521d0ad737bb6e260ed167 - + https://github.com/dotnet/aspnetcore - 6870c9b9946a738e4663a2ba6ecd81eb057571c9 + 5cd5fe0c017255da4b521d0ad737bb6e260ed167 - + https://github.com/dotnet/aspnetcore - 6870c9b9946a738e4663a2ba6ecd81eb057571c9 + 5cd5fe0c017255da4b521d0ad737bb6e260ed167 - + https://github.com/dotnet/aspnetcore - 6870c9b9946a738e4663a2ba6ecd81eb057571c9 + 5cd5fe0c017255da4b521d0ad737bb6e260ed167 - + https://github.com/dotnet/aspnetcore - 6870c9b9946a738e4663a2ba6ecd81eb057571c9 + 5cd5fe0c017255da4b521d0ad737bb6e260ed167 - + https://github.com/dotnet/aspnetcore - 6870c9b9946a738e4663a2ba6ecd81eb057571c9 + 5cd5fe0c017255da4b521d0ad737bb6e260ed167 diff --git a/eng/Versions.props b/eng/Versions.props index 5c66ad2f4b7..11cc5c50d7e 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -28,52 +28,52 @@ --> - 9.0.0-alpha.1.23551.2 - 9.0.0-alpha.1.23551.2 - 9.0.0-alpha.1.23551.2 - 9.0.0-alpha.1.23551.2 - 9.0.0-alpha.1.23551.2 - 9.0.0-alpha.1.23551.2 - 9.0.0-alpha.1.23551.2 - 9.0.0-alpha.1.23551.2 - 9.0.0-alpha.1.23551.2 - 9.0.0-alpha.1.23551.2 - 9.0.0-alpha.1.23551.2 - 9.0.0-alpha.1.23551.2 - 9.0.0-alpha.1.23551.2 - 9.0.0-alpha.1.23551.2 - 9.0.0-alpha.1.23551.2 - 9.0.0-alpha.1.23551.2 - 9.0.0-alpha.1.23551.2 - 9.0.0-alpha.1.23551.2 - 9.0.0-alpha.1.23551.2 - 9.0.0-alpha.1.23551.2 - 9.0.0-alpha.1.23551.2 - 9.0.0-alpha.1.23551.2 - 9.0.0-alpha.1.23551.2 - 9.0.0-alpha.1.23551.2 - 9.0.0-alpha.1.23551.2 - 9.0.0-alpha.1.23551.2 - 9.0.0-alpha.1.23551.2 - 9.0.0-alpha.1.23551.2 - 9.0.0-alpha.1.23551.2 - 9.0.0-alpha.1.23551.2 - 9.0.0-alpha.1.23551.2 - 9.0.0-alpha.1.23551.2 - 9.0.0-alpha.1.23551.2 - 9.0.0-alpha.1.23551.2 - 9.0.0-alpha.1.23551.2 + 9.0.0-alpha.1.23551.9 + 9.0.0-alpha.1.23551.9 + 9.0.0-alpha.1.23551.9 + 9.0.0-alpha.1.23551.9 + 9.0.0-alpha.1.23551.9 + 9.0.0-alpha.1.23551.9 + 9.0.0-alpha.1.23551.9 + 9.0.0-alpha.1.23551.9 + 9.0.0-alpha.1.23551.9 + 9.0.0-alpha.1.23551.9 + 9.0.0-alpha.1.23551.9 + 9.0.0-alpha.1.23551.9 + 9.0.0-alpha.1.23551.9 + 9.0.0-alpha.1.23551.9 + 9.0.0-alpha.1.23551.9 + 9.0.0-alpha.1.23551.9 + 9.0.0-alpha.1.23551.9 + 9.0.0-alpha.1.23551.9 + 9.0.0-alpha.1.23551.9 + 9.0.0-alpha.1.23551.9 + 9.0.0-alpha.1.23551.9 + 9.0.0-alpha.1.23551.9 + 9.0.0-alpha.1.23551.9 + 9.0.0-alpha.1.23551.9 + 9.0.0-alpha.1.23551.9 + 9.0.0-alpha.1.23551.9 + 9.0.0-alpha.1.23551.9 + 9.0.0-alpha.1.23551.9 + 9.0.0-alpha.1.23551.9 + 9.0.0-alpha.1.23551.9 + 9.0.0-alpha.1.23551.9 + 9.0.0-alpha.1.23551.9 + 9.0.0-alpha.1.23551.9 + 9.0.0-alpha.1.23551.9 + 9.0.0-alpha.1.23551.9 - 9.0.0-alpha.1.23551.9 - 9.0.0-alpha.1.23551.9 - 9.0.0-alpha.1.23551.9 - 9.0.0-alpha.1.23551.9 - 9.0.0-alpha.1.23551.9 - 9.0.0-alpha.1.23551.9 - 9.0.0-alpha.1.23551.9 - 9.0.0-alpha.1.23551.9 - 9.0.0-alpha.1.23551.9 - 9.0.0-alpha.1.23551.9 + 9.0.0-alpha.1.23552.7 + 9.0.0-alpha.1.23552.7 + 9.0.0-alpha.1.23552.7 + 9.0.0-alpha.1.23552.7 + 9.0.0-alpha.1.23552.7 + 9.0.0-alpha.1.23552.7 + 9.0.0-alpha.1.23552.7 + 9.0.0-alpha.1.23552.7 + 9.0.0-alpha.1.23552.7 + 9.0.0-alpha.1.23552.7 - + https://github.com/dotnet/runtime - 655b177da2e423a04a60a331bc6c11fe5ec427c3 + 9d3f324640e8083ddfaebeed91119cd69d43cd33 - + https://github.com/dotnet/runtime - 655b177da2e423a04a60a331bc6c11fe5ec427c3 + 9d3f324640e8083ddfaebeed91119cd69d43cd33 - + https://github.com/dotnet/runtime - 655b177da2e423a04a60a331bc6c11fe5ec427c3 + 9d3f324640e8083ddfaebeed91119cd69d43cd33 - + https://github.com/dotnet/runtime - 655b177da2e423a04a60a331bc6c11fe5ec427c3 + 9d3f324640e8083ddfaebeed91119cd69d43cd33 - + https://github.com/dotnet/runtime - 655b177da2e423a04a60a331bc6c11fe5ec427c3 + 9d3f324640e8083ddfaebeed91119cd69d43cd33 - + https://github.com/dotnet/runtime - 655b177da2e423a04a60a331bc6c11fe5ec427c3 + 9d3f324640e8083ddfaebeed91119cd69d43cd33 - + https://github.com/dotnet/runtime - 655b177da2e423a04a60a331bc6c11fe5ec427c3 + 9d3f324640e8083ddfaebeed91119cd69d43cd33 - + https://github.com/dotnet/runtime - 655b177da2e423a04a60a331bc6c11fe5ec427c3 + 9d3f324640e8083ddfaebeed91119cd69d43cd33 - + https://github.com/dotnet/runtime - 655b177da2e423a04a60a331bc6c11fe5ec427c3 + 9d3f324640e8083ddfaebeed91119cd69d43cd33 - + https://github.com/dotnet/runtime - 655b177da2e423a04a60a331bc6c11fe5ec427c3 + 9d3f324640e8083ddfaebeed91119cd69d43cd33 - + https://github.com/dotnet/runtime - 655b177da2e423a04a60a331bc6c11fe5ec427c3 + 9d3f324640e8083ddfaebeed91119cd69d43cd33 - + https://github.com/dotnet/runtime - 655b177da2e423a04a60a331bc6c11fe5ec427c3 + 9d3f324640e8083ddfaebeed91119cd69d43cd33 - + https://github.com/dotnet/aspnetcore - 5cd5fe0c017255da4b521d0ad737bb6e260ed167 + 7f18f8fea5c8e2efc26050f0815f8c911bb26ff1 - + https://github.com/dotnet/aspnetcore - 5cd5fe0c017255da4b521d0ad737bb6e260ed167 + 7f18f8fea5c8e2efc26050f0815f8c911bb26ff1 - + https://github.com/dotnet/aspnetcore - 5cd5fe0c017255da4b521d0ad737bb6e260ed167 + 7f18f8fea5c8e2efc26050f0815f8c911bb26ff1 - + https://github.com/dotnet/aspnetcore - 5cd5fe0c017255da4b521d0ad737bb6e260ed167 + 7f18f8fea5c8e2efc26050f0815f8c911bb26ff1 - + https://github.com/dotnet/aspnetcore - 5cd5fe0c017255da4b521d0ad737bb6e260ed167 + 7f18f8fea5c8e2efc26050f0815f8c911bb26ff1 - + https://github.com/dotnet/aspnetcore - 5cd5fe0c017255da4b521d0ad737bb6e260ed167 + 7f18f8fea5c8e2efc26050f0815f8c911bb26ff1 - + https://github.com/dotnet/aspnetcore - 5cd5fe0c017255da4b521d0ad737bb6e260ed167 + 7f18f8fea5c8e2efc26050f0815f8c911bb26ff1 - + https://github.com/dotnet/aspnetcore - 5cd5fe0c017255da4b521d0ad737bb6e260ed167 + 7f18f8fea5c8e2efc26050f0815f8c911bb26ff1 - + https://github.com/dotnet/aspnetcore - 5cd5fe0c017255da4b521d0ad737bb6e260ed167 + 7f18f8fea5c8e2efc26050f0815f8c911bb26ff1 - + https://github.com/dotnet/aspnetcore - 5cd5fe0c017255da4b521d0ad737bb6e260ed167 + 7f18f8fea5c8e2efc26050f0815f8c911bb26ff1 diff --git a/eng/Versions.props b/eng/Versions.props index 11cc5c50d7e..3073286093a 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -28,52 +28,52 @@ --> - 9.0.0-alpha.1.23551.9 - 9.0.0-alpha.1.23551.9 - 9.0.0-alpha.1.23551.9 - 9.0.0-alpha.1.23551.9 - 9.0.0-alpha.1.23551.9 - 9.0.0-alpha.1.23551.9 - 9.0.0-alpha.1.23551.9 - 9.0.0-alpha.1.23551.9 - 9.0.0-alpha.1.23551.9 - 9.0.0-alpha.1.23551.9 - 9.0.0-alpha.1.23551.9 - 9.0.0-alpha.1.23551.9 - 9.0.0-alpha.1.23551.9 - 9.0.0-alpha.1.23551.9 - 9.0.0-alpha.1.23551.9 - 9.0.0-alpha.1.23551.9 - 9.0.0-alpha.1.23551.9 - 9.0.0-alpha.1.23551.9 - 9.0.0-alpha.1.23551.9 - 9.0.0-alpha.1.23551.9 - 9.0.0-alpha.1.23551.9 - 9.0.0-alpha.1.23551.9 - 9.0.0-alpha.1.23551.9 - 9.0.0-alpha.1.23551.9 - 9.0.0-alpha.1.23551.9 - 9.0.0-alpha.1.23551.9 - 9.0.0-alpha.1.23551.9 - 9.0.0-alpha.1.23551.9 - 9.0.0-alpha.1.23551.9 - 9.0.0-alpha.1.23551.9 - 9.0.0-alpha.1.23551.9 - 9.0.0-alpha.1.23551.9 - 9.0.0-alpha.1.23551.9 - 9.0.0-alpha.1.23551.9 - 9.0.0-alpha.1.23551.9 + 9.0.0-alpha.1.23553.1 + 9.0.0-alpha.1.23553.1 + 9.0.0-alpha.1.23553.1 + 9.0.0-alpha.1.23553.1 + 9.0.0-alpha.1.23553.1 + 9.0.0-alpha.1.23553.1 + 9.0.0-alpha.1.23553.1 + 9.0.0-alpha.1.23553.1 + 9.0.0-alpha.1.23553.1 + 9.0.0-alpha.1.23553.1 + 9.0.0-alpha.1.23553.1 + 9.0.0-alpha.1.23553.1 + 9.0.0-alpha.1.23553.1 + 9.0.0-alpha.1.23553.1 + 9.0.0-alpha.1.23553.1 + 9.0.0-alpha.1.23553.1 + 9.0.0-alpha.1.23553.1 + 9.0.0-alpha.1.23553.1 + 9.0.0-alpha.1.23553.1 + 9.0.0-alpha.1.23553.1 + 9.0.0-alpha.1.23553.1 + 9.0.0-alpha.1.23553.1 + 9.0.0-alpha.1.23553.1 + 9.0.0-alpha.1.23553.1 + 9.0.0-alpha.1.23553.1 + 9.0.0-alpha.1.23553.1 + 9.0.0-alpha.1.23553.1 + 9.0.0-alpha.1.23553.1 + 9.0.0-alpha.1.23553.1 + 9.0.0-alpha.1.23553.1 + 9.0.0-alpha.1.23553.1 + 9.0.0-alpha.1.23553.1 + 9.0.0-alpha.1.23553.1 + 9.0.0-alpha.1.23553.1 + 9.0.0-alpha.1.23553.1 - 9.0.0-alpha.1.23552.7 - 9.0.0-alpha.1.23552.7 - 9.0.0-alpha.1.23552.7 - 9.0.0-alpha.1.23552.7 - 9.0.0-alpha.1.23552.7 - 9.0.0-alpha.1.23552.7 - 9.0.0-alpha.1.23552.7 - 9.0.0-alpha.1.23552.7 - 9.0.0-alpha.1.23552.7 - 9.0.0-alpha.1.23552.7 + 9.0.0-alpha.1.23553.5 + 9.0.0-alpha.1.23553.5 + 9.0.0-alpha.1.23553.5 + 9.0.0-alpha.1.23553.5 + 9.0.0-alpha.1.23553.5 + 9.0.0-alpha.1.23553.5 + 9.0.0-alpha.1.23553.5 + 9.0.0-alpha.1.23553.5 + 9.0.0-alpha.1.23553.5 + 9.0.0-alpha.1.23553.5 - + https://github.com/dotnet/runtime - 9d3f324640e8083ddfaebeed91119cd69d43cd33 + e733539a38458c5c3a64688b55a702444e470700 - + https://github.com/dotnet/runtime - 9d3f324640e8083ddfaebeed91119cd69d43cd33 + e733539a38458c5c3a64688b55a702444e470700 - + https://github.com/dotnet/runtime - 9d3f324640e8083ddfaebeed91119cd69d43cd33 + e733539a38458c5c3a64688b55a702444e470700 - + https://github.com/dotnet/runtime - 9d3f324640e8083ddfaebeed91119cd69d43cd33 + e733539a38458c5c3a64688b55a702444e470700 - + https://github.com/dotnet/runtime - 9d3f324640e8083ddfaebeed91119cd69d43cd33 + e733539a38458c5c3a64688b55a702444e470700 - + https://github.com/dotnet/runtime - 9d3f324640e8083ddfaebeed91119cd69d43cd33 + e733539a38458c5c3a64688b55a702444e470700 - + https://github.com/dotnet/runtime - 9d3f324640e8083ddfaebeed91119cd69d43cd33 + e733539a38458c5c3a64688b55a702444e470700 - + https://github.com/dotnet/runtime - 9d3f324640e8083ddfaebeed91119cd69d43cd33 + e733539a38458c5c3a64688b55a702444e470700 - + https://github.com/dotnet/runtime - 9d3f324640e8083ddfaebeed91119cd69d43cd33 + e733539a38458c5c3a64688b55a702444e470700 - + https://github.com/dotnet/runtime - 9d3f324640e8083ddfaebeed91119cd69d43cd33 + e733539a38458c5c3a64688b55a702444e470700 - + https://github.com/dotnet/runtime - 9d3f324640e8083ddfaebeed91119cd69d43cd33 + e733539a38458c5c3a64688b55a702444e470700 - + https://github.com/dotnet/runtime - 9d3f324640e8083ddfaebeed91119cd69d43cd33 + e733539a38458c5c3a64688b55a702444e470700 - + https://github.com/dotnet/aspnetcore - 7f18f8fea5c8e2efc26050f0815f8c911bb26ff1 + f222a8a8ff5f535f6a09f713131e09990ac3f8a1 - + https://github.com/dotnet/aspnetcore - 7f18f8fea5c8e2efc26050f0815f8c911bb26ff1 + f222a8a8ff5f535f6a09f713131e09990ac3f8a1 - + https://github.com/dotnet/aspnetcore - 7f18f8fea5c8e2efc26050f0815f8c911bb26ff1 + f222a8a8ff5f535f6a09f713131e09990ac3f8a1 - + https://github.com/dotnet/aspnetcore - 7f18f8fea5c8e2efc26050f0815f8c911bb26ff1 + f222a8a8ff5f535f6a09f713131e09990ac3f8a1 - + https://github.com/dotnet/aspnetcore - 7f18f8fea5c8e2efc26050f0815f8c911bb26ff1 + f222a8a8ff5f535f6a09f713131e09990ac3f8a1 - + https://github.com/dotnet/aspnetcore - 7f18f8fea5c8e2efc26050f0815f8c911bb26ff1 + f222a8a8ff5f535f6a09f713131e09990ac3f8a1 - + https://github.com/dotnet/aspnetcore - 7f18f8fea5c8e2efc26050f0815f8c911bb26ff1 + f222a8a8ff5f535f6a09f713131e09990ac3f8a1 - + https://github.com/dotnet/aspnetcore - 7f18f8fea5c8e2efc26050f0815f8c911bb26ff1 + f222a8a8ff5f535f6a09f713131e09990ac3f8a1 - + https://github.com/dotnet/aspnetcore - 7f18f8fea5c8e2efc26050f0815f8c911bb26ff1 + f222a8a8ff5f535f6a09f713131e09990ac3f8a1 - + https://github.com/dotnet/aspnetcore - 7f18f8fea5c8e2efc26050f0815f8c911bb26ff1 + f222a8a8ff5f535f6a09f713131e09990ac3f8a1 diff --git a/eng/Versions.props b/eng/Versions.props index 3073286093a..5be52fce360 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -28,52 +28,52 @@ --> - 9.0.0-alpha.1.23553.1 - 9.0.0-alpha.1.23553.1 - 9.0.0-alpha.1.23553.1 - 9.0.0-alpha.1.23553.1 - 9.0.0-alpha.1.23553.1 - 9.0.0-alpha.1.23553.1 - 9.0.0-alpha.1.23553.1 - 9.0.0-alpha.1.23553.1 - 9.0.0-alpha.1.23553.1 - 9.0.0-alpha.1.23553.1 - 9.0.0-alpha.1.23553.1 - 9.0.0-alpha.1.23553.1 - 9.0.0-alpha.1.23553.1 - 9.0.0-alpha.1.23553.1 - 9.0.0-alpha.1.23553.1 - 9.0.0-alpha.1.23553.1 - 9.0.0-alpha.1.23553.1 - 9.0.0-alpha.1.23553.1 - 9.0.0-alpha.1.23553.1 - 9.0.0-alpha.1.23553.1 - 9.0.0-alpha.1.23553.1 - 9.0.0-alpha.1.23553.1 - 9.0.0-alpha.1.23553.1 - 9.0.0-alpha.1.23553.1 - 9.0.0-alpha.1.23553.1 - 9.0.0-alpha.1.23553.1 - 9.0.0-alpha.1.23553.1 - 9.0.0-alpha.1.23553.1 - 9.0.0-alpha.1.23553.1 - 9.0.0-alpha.1.23553.1 - 9.0.0-alpha.1.23553.1 - 9.0.0-alpha.1.23553.1 - 9.0.0-alpha.1.23553.1 - 9.0.0-alpha.1.23553.1 - 9.0.0-alpha.1.23553.1 + 9.0.0-alpha.1.23556.1 + 9.0.0-alpha.1.23556.1 + 9.0.0-alpha.1.23556.1 + 9.0.0-alpha.1.23556.1 + 9.0.0-alpha.1.23556.1 + 9.0.0-alpha.1.23556.1 + 9.0.0-alpha.1.23556.1 + 9.0.0-alpha.1.23556.1 + 9.0.0-alpha.1.23556.1 + 9.0.0-alpha.1.23556.1 + 9.0.0-alpha.1.23556.1 + 9.0.0-alpha.1.23556.1 + 9.0.0-alpha.1.23556.1 + 9.0.0-alpha.1.23556.1 + 9.0.0-alpha.1.23556.1 + 9.0.0-alpha.1.23556.1 + 9.0.0-alpha.1.23556.1 + 9.0.0-alpha.1.23556.1 + 9.0.0-alpha.1.23556.1 + 9.0.0-alpha.1.23556.1 + 9.0.0-alpha.1.23556.1 + 9.0.0-alpha.1.23556.1 + 9.0.0-alpha.1.23556.1 + 9.0.0-alpha.1.23556.1 + 9.0.0-alpha.1.23556.1 + 9.0.0-alpha.1.23556.1 + 9.0.0-alpha.1.23556.1 + 9.0.0-alpha.1.23556.1 + 9.0.0-alpha.1.23556.1 + 9.0.0-alpha.1.23556.1 + 9.0.0-alpha.1.23556.1 + 9.0.0-alpha.1.23556.1 + 9.0.0-alpha.1.23556.1 + 9.0.0-alpha.1.23556.1 + 9.0.0-alpha.1.23556.1 - 9.0.0-alpha.1.23553.5 - 9.0.0-alpha.1.23553.5 - 9.0.0-alpha.1.23553.5 - 9.0.0-alpha.1.23553.5 - 9.0.0-alpha.1.23553.5 - 9.0.0-alpha.1.23553.5 - 9.0.0-alpha.1.23553.5 - 9.0.0-alpha.1.23553.5 - 9.0.0-alpha.1.23553.5 - 9.0.0-alpha.1.23553.5 + 9.0.0-alpha.1.23556.7 + 9.0.0-alpha.1.23556.7 + 9.0.0-alpha.1.23556.7 + 9.0.0-alpha.1.23556.7 + 9.0.0-alpha.1.23556.7 + 9.0.0-alpha.1.23556.7 + 9.0.0-alpha.1.23556.7 + 9.0.0-alpha.1.23556.7 + 9.0.0-alpha.1.23556.7 + 9.0.0-alpha.1.23556.7 - + https://github.com/dotnet/runtime - e733539a38458c5c3a64688b55a702444e470700 + 0ecd2f4999661e3b95e93cb4bdfa860009c155ba - + https://github.com/dotnet/runtime - e733539a38458c5c3a64688b55a702444e470700 + 0ecd2f4999661e3b95e93cb4bdfa860009c155ba - + https://github.com/dotnet/runtime - e733539a38458c5c3a64688b55a702444e470700 + 0ecd2f4999661e3b95e93cb4bdfa860009c155ba - + https://github.com/dotnet/runtime - e733539a38458c5c3a64688b55a702444e470700 + 0ecd2f4999661e3b95e93cb4bdfa860009c155ba - + https://github.com/dotnet/runtime - e733539a38458c5c3a64688b55a702444e470700 + 0ecd2f4999661e3b95e93cb4bdfa860009c155ba - + https://github.com/dotnet/runtime - e733539a38458c5c3a64688b55a702444e470700 + 0ecd2f4999661e3b95e93cb4bdfa860009c155ba - + https://github.com/dotnet/runtime - e733539a38458c5c3a64688b55a702444e470700 + 0ecd2f4999661e3b95e93cb4bdfa860009c155ba - + https://github.com/dotnet/runtime - e733539a38458c5c3a64688b55a702444e470700 + 0ecd2f4999661e3b95e93cb4bdfa860009c155ba - + https://github.com/dotnet/runtime - e733539a38458c5c3a64688b55a702444e470700 + 0ecd2f4999661e3b95e93cb4bdfa860009c155ba - + https://github.com/dotnet/runtime - e733539a38458c5c3a64688b55a702444e470700 + 0ecd2f4999661e3b95e93cb4bdfa860009c155ba - + https://github.com/dotnet/runtime - e733539a38458c5c3a64688b55a702444e470700 + 0ecd2f4999661e3b95e93cb4bdfa860009c155ba - + https://github.com/dotnet/runtime - e733539a38458c5c3a64688b55a702444e470700 + 0ecd2f4999661e3b95e93cb4bdfa860009c155ba - + https://github.com/dotnet/aspnetcore - f222a8a8ff5f535f6a09f713131e09990ac3f8a1 + 1a564a1504fdc9a982405cce0ca3583da797123a - + https://github.com/dotnet/aspnetcore - f222a8a8ff5f535f6a09f713131e09990ac3f8a1 + 1a564a1504fdc9a982405cce0ca3583da797123a - + https://github.com/dotnet/aspnetcore - f222a8a8ff5f535f6a09f713131e09990ac3f8a1 + 1a564a1504fdc9a982405cce0ca3583da797123a - + https://github.com/dotnet/aspnetcore - f222a8a8ff5f535f6a09f713131e09990ac3f8a1 + 1a564a1504fdc9a982405cce0ca3583da797123a - + https://github.com/dotnet/aspnetcore - f222a8a8ff5f535f6a09f713131e09990ac3f8a1 + 1a564a1504fdc9a982405cce0ca3583da797123a - + https://github.com/dotnet/aspnetcore - f222a8a8ff5f535f6a09f713131e09990ac3f8a1 + 1a564a1504fdc9a982405cce0ca3583da797123a - + https://github.com/dotnet/aspnetcore - f222a8a8ff5f535f6a09f713131e09990ac3f8a1 + 1a564a1504fdc9a982405cce0ca3583da797123a - + https://github.com/dotnet/aspnetcore - f222a8a8ff5f535f6a09f713131e09990ac3f8a1 + 1a564a1504fdc9a982405cce0ca3583da797123a - + https://github.com/dotnet/aspnetcore - f222a8a8ff5f535f6a09f713131e09990ac3f8a1 + 1a564a1504fdc9a982405cce0ca3583da797123a - + https://github.com/dotnet/aspnetcore - f222a8a8ff5f535f6a09f713131e09990ac3f8a1 + 1a564a1504fdc9a982405cce0ca3583da797123a diff --git a/eng/Versions.props b/eng/Versions.props index 5be52fce360..eade9c837bf 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -28,52 +28,52 @@ --> - 9.0.0-alpha.1.23556.1 - 9.0.0-alpha.1.23556.1 - 9.0.0-alpha.1.23556.1 - 9.0.0-alpha.1.23556.1 - 9.0.0-alpha.1.23556.1 - 9.0.0-alpha.1.23556.1 - 9.0.0-alpha.1.23556.1 - 9.0.0-alpha.1.23556.1 - 9.0.0-alpha.1.23556.1 - 9.0.0-alpha.1.23556.1 - 9.0.0-alpha.1.23556.1 - 9.0.0-alpha.1.23556.1 - 9.0.0-alpha.1.23556.1 - 9.0.0-alpha.1.23556.1 - 9.0.0-alpha.1.23556.1 - 9.0.0-alpha.1.23556.1 - 9.0.0-alpha.1.23556.1 - 9.0.0-alpha.1.23556.1 - 9.0.0-alpha.1.23556.1 - 9.0.0-alpha.1.23556.1 - 9.0.0-alpha.1.23556.1 - 9.0.0-alpha.1.23556.1 - 9.0.0-alpha.1.23556.1 - 9.0.0-alpha.1.23556.1 - 9.0.0-alpha.1.23556.1 - 9.0.0-alpha.1.23556.1 - 9.0.0-alpha.1.23556.1 - 9.0.0-alpha.1.23556.1 - 9.0.0-alpha.1.23556.1 - 9.0.0-alpha.1.23556.1 - 9.0.0-alpha.1.23556.1 - 9.0.0-alpha.1.23556.1 - 9.0.0-alpha.1.23556.1 - 9.0.0-alpha.1.23556.1 - 9.0.0-alpha.1.23556.1 + 9.0.0-alpha.1.23557.1 + 9.0.0-alpha.1.23557.1 + 9.0.0-alpha.1.23557.1 + 9.0.0-alpha.1.23557.1 + 9.0.0-alpha.1.23557.1 + 9.0.0-alpha.1.23557.1 + 9.0.0-alpha.1.23557.1 + 9.0.0-alpha.1.23557.1 + 9.0.0-alpha.1.23557.1 + 9.0.0-alpha.1.23557.1 + 9.0.0-alpha.1.23557.1 + 9.0.0-alpha.1.23557.1 + 9.0.0-alpha.1.23557.1 + 9.0.0-alpha.1.23557.1 + 9.0.0-alpha.1.23557.1 + 9.0.0-alpha.1.23557.1 + 9.0.0-alpha.1.23557.1 + 9.0.0-alpha.1.23557.1 + 9.0.0-alpha.1.23557.1 + 9.0.0-alpha.1.23557.1 + 9.0.0-alpha.1.23557.1 + 9.0.0-alpha.1.23557.1 + 9.0.0-alpha.1.23557.1 + 9.0.0-alpha.1.23557.1 + 9.0.0-alpha.1.23557.1 + 9.0.0-alpha.1.23557.1 + 9.0.0-alpha.1.23557.1 + 9.0.0-alpha.1.23557.1 + 9.0.0-alpha.1.23557.1 + 9.0.0-alpha.1.23557.1 + 9.0.0-alpha.1.23557.1 + 9.0.0-alpha.1.23557.1 + 9.0.0-alpha.1.23557.1 + 9.0.0-alpha.1.23557.1 + 9.0.0-alpha.1.23557.1 - 9.0.0-alpha.1.23556.7 - 9.0.0-alpha.1.23556.7 - 9.0.0-alpha.1.23556.7 - 9.0.0-alpha.1.23556.7 - 9.0.0-alpha.1.23556.7 - 9.0.0-alpha.1.23556.7 - 9.0.0-alpha.1.23556.7 - 9.0.0-alpha.1.23556.7 - 9.0.0-alpha.1.23556.7 - 9.0.0-alpha.1.23556.7 + 9.0.0-alpha.1.23557.6 + 9.0.0-alpha.1.23557.6 + 9.0.0-alpha.1.23557.6 + 9.0.0-alpha.1.23557.6 + 9.0.0-alpha.1.23557.6 + 9.0.0-alpha.1.23557.6 + 9.0.0-alpha.1.23557.6 + 9.0.0-alpha.1.23557.6 + 9.0.0-alpha.1.23557.6 + 9.0.0-alpha.1.23557.6 - + https://github.com/dotnet/runtime - 0ecd2f4999661e3b95e93cb4bdfa860009c155ba + dc9c9d5f9e23ff6aa0b99af8f6c410a0558fadaf - + https://github.com/dotnet/runtime - 0ecd2f4999661e3b95e93cb4bdfa860009c155ba + dc9c9d5f9e23ff6aa0b99af8f6c410a0558fadaf - + https://github.com/dotnet/runtime - 0ecd2f4999661e3b95e93cb4bdfa860009c155ba + dc9c9d5f9e23ff6aa0b99af8f6c410a0558fadaf - + https://github.com/dotnet/runtime - 0ecd2f4999661e3b95e93cb4bdfa860009c155ba + dc9c9d5f9e23ff6aa0b99af8f6c410a0558fadaf - + https://github.com/dotnet/runtime - 0ecd2f4999661e3b95e93cb4bdfa860009c155ba + dc9c9d5f9e23ff6aa0b99af8f6c410a0558fadaf - + https://github.com/dotnet/runtime - 0ecd2f4999661e3b95e93cb4bdfa860009c155ba + dc9c9d5f9e23ff6aa0b99af8f6c410a0558fadaf - + https://github.com/dotnet/runtime - 0ecd2f4999661e3b95e93cb4bdfa860009c155ba + dc9c9d5f9e23ff6aa0b99af8f6c410a0558fadaf - + https://github.com/dotnet/runtime - 0ecd2f4999661e3b95e93cb4bdfa860009c155ba + dc9c9d5f9e23ff6aa0b99af8f6c410a0558fadaf - + https://github.com/dotnet/runtime - 0ecd2f4999661e3b95e93cb4bdfa860009c155ba + dc9c9d5f9e23ff6aa0b99af8f6c410a0558fadaf - + https://github.com/dotnet/runtime - 0ecd2f4999661e3b95e93cb4bdfa860009c155ba + dc9c9d5f9e23ff6aa0b99af8f6c410a0558fadaf - + https://github.com/dotnet/runtime - 0ecd2f4999661e3b95e93cb4bdfa860009c155ba + dc9c9d5f9e23ff6aa0b99af8f6c410a0558fadaf - + https://github.com/dotnet/runtime - 0ecd2f4999661e3b95e93cb4bdfa860009c155ba + dc9c9d5f9e23ff6aa0b99af8f6c410a0558fadaf - + https://github.com/dotnet/aspnetcore - 1a564a1504fdc9a982405cce0ca3583da797123a + 1ab87c942788c9b35b1967f5209b22e5f357e901 - + https://github.com/dotnet/aspnetcore - 1a564a1504fdc9a982405cce0ca3583da797123a + 1ab87c942788c9b35b1967f5209b22e5f357e901 - + https://github.com/dotnet/aspnetcore - 1a564a1504fdc9a982405cce0ca3583da797123a + 1ab87c942788c9b35b1967f5209b22e5f357e901 - + https://github.com/dotnet/aspnetcore - 1a564a1504fdc9a982405cce0ca3583da797123a + 1ab87c942788c9b35b1967f5209b22e5f357e901 - + https://github.com/dotnet/aspnetcore - 1a564a1504fdc9a982405cce0ca3583da797123a + 1ab87c942788c9b35b1967f5209b22e5f357e901 - + https://github.com/dotnet/aspnetcore - 1a564a1504fdc9a982405cce0ca3583da797123a + 1ab87c942788c9b35b1967f5209b22e5f357e901 - + https://github.com/dotnet/aspnetcore - 1a564a1504fdc9a982405cce0ca3583da797123a + 1ab87c942788c9b35b1967f5209b22e5f357e901 - + https://github.com/dotnet/aspnetcore - 1a564a1504fdc9a982405cce0ca3583da797123a + 1ab87c942788c9b35b1967f5209b22e5f357e901 - + https://github.com/dotnet/aspnetcore - 1a564a1504fdc9a982405cce0ca3583da797123a + 1ab87c942788c9b35b1967f5209b22e5f357e901 - + https://github.com/dotnet/aspnetcore - 1a564a1504fdc9a982405cce0ca3583da797123a + 1ab87c942788c9b35b1967f5209b22e5f357e901 diff --git a/eng/Versions.props b/eng/Versions.props index eade9c837bf..11be73554a1 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -28,52 +28,52 @@ --> - 9.0.0-alpha.1.23557.1 - 9.0.0-alpha.1.23557.1 - 9.0.0-alpha.1.23557.1 - 9.0.0-alpha.1.23557.1 - 9.0.0-alpha.1.23557.1 - 9.0.0-alpha.1.23557.1 - 9.0.0-alpha.1.23557.1 - 9.0.0-alpha.1.23557.1 - 9.0.0-alpha.1.23557.1 - 9.0.0-alpha.1.23557.1 - 9.0.0-alpha.1.23557.1 - 9.0.0-alpha.1.23557.1 - 9.0.0-alpha.1.23557.1 - 9.0.0-alpha.1.23557.1 - 9.0.0-alpha.1.23557.1 - 9.0.0-alpha.1.23557.1 - 9.0.0-alpha.1.23557.1 - 9.0.0-alpha.1.23557.1 - 9.0.0-alpha.1.23557.1 - 9.0.0-alpha.1.23557.1 - 9.0.0-alpha.1.23557.1 - 9.0.0-alpha.1.23557.1 - 9.0.0-alpha.1.23557.1 - 9.0.0-alpha.1.23557.1 - 9.0.0-alpha.1.23557.1 - 9.0.0-alpha.1.23557.1 - 9.0.0-alpha.1.23557.1 - 9.0.0-alpha.1.23557.1 - 9.0.0-alpha.1.23557.1 - 9.0.0-alpha.1.23557.1 - 9.0.0-alpha.1.23557.1 - 9.0.0-alpha.1.23557.1 - 9.0.0-alpha.1.23557.1 - 9.0.0-alpha.1.23557.1 - 9.0.0-alpha.1.23557.1 + 9.0.0-alpha.1.23558.1 + 9.0.0-alpha.1.23558.1 + 9.0.0-alpha.1.23558.1 + 9.0.0-alpha.1.23558.1 + 9.0.0-alpha.1.23558.1 + 9.0.0-alpha.1.23558.1 + 9.0.0-alpha.1.23558.1 + 9.0.0-alpha.1.23558.1 + 9.0.0-alpha.1.23558.1 + 9.0.0-alpha.1.23558.1 + 9.0.0-alpha.1.23558.1 + 9.0.0-alpha.1.23558.1 + 9.0.0-alpha.1.23558.1 + 9.0.0-alpha.1.23558.1 + 9.0.0-alpha.1.23558.1 + 9.0.0-alpha.1.23558.1 + 9.0.0-alpha.1.23558.1 + 9.0.0-alpha.1.23558.1 + 9.0.0-alpha.1.23558.1 + 9.0.0-alpha.1.23558.1 + 9.0.0-alpha.1.23558.1 + 9.0.0-alpha.1.23558.1 + 9.0.0-alpha.1.23558.1 + 9.0.0-alpha.1.23558.1 + 9.0.0-alpha.1.23558.1 + 9.0.0-alpha.1.23558.1 + 9.0.0-alpha.1.23558.1 + 9.0.0-alpha.1.23558.1 + 9.0.0-alpha.1.23558.1 + 9.0.0-alpha.1.23558.1 + 9.0.0-alpha.1.23558.1 + 9.0.0-alpha.1.23558.1 + 9.0.0-alpha.1.23558.1 + 9.0.0-alpha.1.23558.1 + 9.0.0-alpha.1.23558.1 - 9.0.0-alpha.1.23557.6 - 9.0.0-alpha.1.23557.6 - 9.0.0-alpha.1.23557.6 - 9.0.0-alpha.1.23557.6 - 9.0.0-alpha.1.23557.6 - 9.0.0-alpha.1.23557.6 - 9.0.0-alpha.1.23557.6 - 9.0.0-alpha.1.23557.6 - 9.0.0-alpha.1.23557.6 - 9.0.0-alpha.1.23557.6 + 9.0.0-alpha.1.23559.3 + 9.0.0-alpha.1.23559.3 + 9.0.0-alpha.1.23559.3 + 9.0.0-alpha.1.23559.3 + 9.0.0-alpha.1.23559.3 + 9.0.0-alpha.1.23559.3 + 9.0.0-alpha.1.23559.3 + 9.0.0-alpha.1.23559.3 + 9.0.0-alpha.1.23559.3 + 9.0.0-alpha.1.23559.3 net - 9 + 8 0 $(TargetFrameworkMajorVersion).$(TargetFrameworkMinorVersion) @@ -14,10 +13,10 @@ $(TargetFrameworkName)$(TargetFrameworkVersion) $(LatestTargetFramework) - $(SupportedNetCoreTargetFrameworks);net8.0 + $(SupportedNetCoreTargetFrameworks);net6.0 - net8.0 + net6.0 diff --git a/Directory.Build.targets b/Directory.Build.targets index 99cb62a45fd..3dcffa62576 100644 --- a/Directory.Build.targets +++ b/Directory.Build.targets @@ -8,8 +8,6 @@ - - $(MSBuildWarningsAsMessages);NETSDK1138;MSB3270 diff --git a/NuGet.config b/NuGet.config index 63a27ab192a..77ef6280040 100644 --- a/NuGet.config +++ b/NuGet.config @@ -2,20 +2,26 @@ + + + + + - - + + + @@ -31,12 +37,6 @@ - - - - - - diff --git a/docs/building.md b/docs/building.md index c95aaa8bda3..023e951bb57 100644 --- a/docs/building.md +++ b/docs/building.md @@ -45,8 +45,8 @@ Here are few commands that you will likely use the most: - `build.sh --restore`: to install the required .NET SDK, .NET tools and the toolset. This is equivalent to running `./restore.sh`. - `build.sh --build`: to build the solution1. - `build.sh --test`: to run all unit tests in the solution1. - - `build.sh --vs `: to generate a "filtered" solution and save it as `SDK.sln`. It also performs the "restore" operation. Keywords can be any part of the name or path of project files you want to include. For example: `./build.sh --vs Http,Fakes,AspNetCore`.
- If for some reason you wish to generate a solution with all projects you can pass `*` for the keyword, e.g.: `./build.sh -vs '*'` (Note: you have to escape the asterisk or use `set -f` to turn off expansion).
+ - `build.sh --vs `: to generate a "filtered" solution and save it as `SDK.sln`. It also performs the "restore" operation. For example: `./build.sh --vs Http,Fakes`.
+ If for some reason you wish to generate a solution with all projects you can pass `*` for the keyword, e.g.: `./build.sh --vs '*'` (Note: you have to escape the asterisk or use `set -f` to turn off expansion).
> Under the hood, this invokes `scripts/Slngen.ps1` script, which in turn executes [slngen tool][slngen-tool]. If you want to customize how the "filtered" solution is generated, you will need to invoke `scripts/Slngen.ps1` script directly.
Run `./scripts/Slngen.ps1 -help` for more details. diff --git a/eng/Net9Workarounds.props b/eng/Net9Workarounds.props deleted file mode 100644 index 676bad31897..00000000000 --- a/eng/Net9Workarounds.props +++ /dev/null @@ -1,7 +0,0 @@ - - - - false - true - - \ No newline at end of file diff --git a/eng/Net9Workarounds.targets b/eng/Net9Workarounds.targets deleted file mode 100644 index c92595dd496..00000000000 --- a/eng/Net9Workarounds.targets +++ /dev/null @@ -1,67 +0,0 @@ - - - - 99.9 - - true - - - - - - - - - - $(MicrosoftNETCoreAppRuntimewinx64Version) - $(MicrosoftNETCoreAppRefVersion) - - $(MicrosoftNETCoreAppRuntimeVersion) - - - - $(MicrosoftAspNetCoreAppRuntimewinx64Version) - $(MicrosoftAspNetCoreAppRefVersion) - - $(MicrosoftNETCoreAppRuntimeVersion) - - - - $(MicrosoftNETCoreAppRuntimewinx64Version) - - - - $(MicrosoftNETCoreAppRuntimewinx64Version) - - - - $(MicrosoftAspNetCoreAppRuntimewinx64Version) - - - - \ No newline at end of file diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index b2ee6f561a9..f68eebe5b6d 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,198 +1,182 @@ - + https://github.com/dotnet/runtime - dc9c9d5f9e23ff6aa0b99af8f6c410a0558fadaf + 488a8a3521610422e8fbe22d5cc66127f3dce3dc - + https://github.com/dotnet/runtime - dc9c9d5f9e23ff6aa0b99af8f6c410a0558fadaf + 488a8a3521610422e8fbe22d5cc66127f3dce3dc - + https://github.com/dotnet/runtime - dc9c9d5f9e23ff6aa0b99af8f6c410a0558fadaf + 488a8a3521610422e8fbe22d5cc66127f3dce3dc - + https://github.com/dotnet/runtime - dc9c9d5f9e23ff6aa0b99af8f6c410a0558fadaf + 488a8a3521610422e8fbe22d5cc66127f3dce3dc - + https://github.com/dotnet/runtime - dc9c9d5f9e23ff6aa0b99af8f6c410a0558fadaf + 488a8a3521610422e8fbe22d5cc66127f3dce3dc - + https://github.com/dotnet/runtime - dc9c9d5f9e23ff6aa0b99af8f6c410a0558fadaf + 488a8a3521610422e8fbe22d5cc66127f3dce3dc - + https://github.com/dotnet/runtime - dc9c9d5f9e23ff6aa0b99af8f6c410a0558fadaf + 488a8a3521610422e8fbe22d5cc66127f3dce3dc - + https://github.com/dotnet/runtime - dc9c9d5f9e23ff6aa0b99af8f6c410a0558fadaf + 488a8a3521610422e8fbe22d5cc66127f3dce3dc - + https://github.com/dotnet/runtime - dc9c9d5f9e23ff6aa0b99af8f6c410a0558fadaf + 488a8a3521610422e8fbe22d5cc66127f3dce3dc - + https://github.com/dotnet/runtime - dc9c9d5f9e23ff6aa0b99af8f6c410a0558fadaf + 488a8a3521610422e8fbe22d5cc66127f3dce3dc - + https://github.com/dotnet/runtime - dc9c9d5f9e23ff6aa0b99af8f6c410a0558fadaf + 488a8a3521610422e8fbe22d5cc66127f3dce3dc - + https://github.com/dotnet/runtime - dc9c9d5f9e23ff6aa0b99af8f6c410a0558fadaf + 488a8a3521610422e8fbe22d5cc66127f3dce3dc - + https://github.com/dotnet/runtime - dc9c9d5f9e23ff6aa0b99af8f6c410a0558fadaf + 488a8a3521610422e8fbe22d5cc66127f3dce3dc - + https://github.com/dotnet/runtime - dc9c9d5f9e23ff6aa0b99af8f6c410a0558fadaf + 488a8a3521610422e8fbe22d5cc66127f3dce3dc - + https://github.com/dotnet/runtime - dc9c9d5f9e23ff6aa0b99af8f6c410a0558fadaf + 488a8a3521610422e8fbe22d5cc66127f3dce3dc - + https://github.com/dotnet/runtime - dc9c9d5f9e23ff6aa0b99af8f6c410a0558fadaf + 488a8a3521610422e8fbe22d5cc66127f3dce3dc - + https://github.com/dotnet/runtime - dc9c9d5f9e23ff6aa0b99af8f6c410a0558fadaf + 488a8a3521610422e8fbe22d5cc66127f3dce3dc - + https://github.com/dotnet/runtime - dc9c9d5f9e23ff6aa0b99af8f6c410a0558fadaf + 488a8a3521610422e8fbe22d5cc66127f3dce3dc - + https://github.com/dotnet/runtime - dc9c9d5f9e23ff6aa0b99af8f6c410a0558fadaf + 488a8a3521610422e8fbe22d5cc66127f3dce3dc - + https://github.com/dotnet/runtime - dc9c9d5f9e23ff6aa0b99af8f6c410a0558fadaf + 488a8a3521610422e8fbe22d5cc66127f3dce3dc - + https://github.com/dotnet/runtime - dc9c9d5f9e23ff6aa0b99af8f6c410a0558fadaf + 488a8a3521610422e8fbe22d5cc66127f3dce3dc - + https://github.com/dotnet/runtime - dc9c9d5f9e23ff6aa0b99af8f6c410a0558fadaf + 488a8a3521610422e8fbe22d5cc66127f3dce3dc - + https://github.com/dotnet/runtime - dc9c9d5f9e23ff6aa0b99af8f6c410a0558fadaf + 488a8a3521610422e8fbe22d5cc66127f3dce3dc - - + https://github.com/dotnet/runtime - dc9c9d5f9e23ff6aa0b99af8f6c410a0558fadaf + 488a8a3521610422e8fbe22d5cc66127f3dce3dc - + https://github.com/dotnet/runtime - dc9c9d5f9e23ff6aa0b99af8f6c410a0558fadaf + 488a8a3521610422e8fbe22d5cc66127f3dce3dc - + https://github.com/dotnet/runtime - dc9c9d5f9e23ff6aa0b99af8f6c410a0558fadaf + 488a8a3521610422e8fbe22d5cc66127f3dce3dc - + https://github.com/dotnet/runtime - dc9c9d5f9e23ff6aa0b99af8f6c410a0558fadaf + 488a8a3521610422e8fbe22d5cc66127f3dce3dc - + https://github.com/dotnet/runtime - dc9c9d5f9e23ff6aa0b99af8f6c410a0558fadaf + 488a8a3521610422e8fbe22d5cc66127f3dce3dc - + https://github.com/dotnet/runtime - dc9c9d5f9e23ff6aa0b99af8f6c410a0558fadaf + 488a8a3521610422e8fbe22d5cc66127f3dce3dc - + https://github.com/dotnet/runtime - dc9c9d5f9e23ff6aa0b99af8f6c410a0558fadaf + 488a8a3521610422e8fbe22d5cc66127f3dce3dc - + https://github.com/dotnet/runtime - dc9c9d5f9e23ff6aa0b99af8f6c410a0558fadaf + 488a8a3521610422e8fbe22d5cc66127f3dce3dc - + https://github.com/dotnet/runtime - dc9c9d5f9e23ff6aa0b99af8f6c410a0558fadaf + 488a8a3521610422e8fbe22d5cc66127f3dce3dc - + https://github.com/dotnet/runtime - dc9c9d5f9e23ff6aa0b99af8f6c410a0558fadaf + 488a8a3521610422e8fbe22d5cc66127f3dce3dc - - https://github.com/dotnet/runtime - dc9c9d5f9e23ff6aa0b99af8f6c410a0558fadaf - - - https://github.com/dotnet/runtime - dc9c9d5f9e23ff6aa0b99af8f6c410a0558fadaf - - - https://github.com/dotnet/aspnetcore - 1ab87c942788c9b35b1967f5209b22e5f357e901 - - + https://github.com/dotnet/aspnetcore - 1ab87c942788c9b35b1967f5209b22e5f357e901 + 815eb281ecad13eb69cf50516ac7f534b947f2b0 - + https://github.com/dotnet/aspnetcore - 1ab87c942788c9b35b1967f5209b22e5f357e901 + 815eb281ecad13eb69cf50516ac7f534b947f2b0 - + https://github.com/dotnet/aspnetcore - 1ab87c942788c9b35b1967f5209b22e5f357e901 + 815eb281ecad13eb69cf50516ac7f534b947f2b0 - + https://github.com/dotnet/aspnetcore - 1ab87c942788c9b35b1967f5209b22e5f357e901 + 815eb281ecad13eb69cf50516ac7f534b947f2b0 - + https://github.com/dotnet/aspnetcore - 1ab87c942788c9b35b1967f5209b22e5f357e901 + 815eb281ecad13eb69cf50516ac7f534b947f2b0 - + https://github.com/dotnet/aspnetcore - 1ab87c942788c9b35b1967f5209b22e5f357e901 + 815eb281ecad13eb69cf50516ac7f534b947f2b0 - + https://github.com/dotnet/aspnetcore - 1ab87c942788c9b35b1967f5209b22e5f357e901 + 815eb281ecad13eb69cf50516ac7f534b947f2b0 - + https://github.com/dotnet/aspnetcore - 1ab87c942788c9b35b1967f5209b22e5f357e901 + 815eb281ecad13eb69cf50516ac7f534b947f2b0 - + https://github.com/dotnet/aspnetcore - 1ab87c942788c9b35b1967f5209b22e5f357e901 + 815eb281ecad13eb69cf50516ac7f534b947f2b0 - + https://github.com/dotnet/arcade - aa0317458d29ec79935ca04fa47d3a6f14a0944f + a57022b44f3ff23de925530ea1d27da9701aed57 - + https://github.com/dotnet/arcade - aa0317458d29ec79935ca04fa47d3a6f14a0944f + a57022b44f3ff23de925530ea1d27da9701aed57 diff --git a/eng/Versions.props b/eng/Versions.props index 11be73554a1..161c8516cbe 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -1,18 +1,18 @@ - 9 - 0 + 8 + 1 0 - alpha - 1 + preview + + $(MajorVersion).$(MinorVersion).$(PatchVersion) true $(MajorVersion).$(MinorVersion).0.0 - true - false + true @@ -28,52 +28,49 @@ --> - 9.0.0-alpha.1.23558.1 - 9.0.0-alpha.1.23558.1 - 9.0.0-alpha.1.23558.1 - 9.0.0-alpha.1.23558.1 - 9.0.0-alpha.1.23558.1 - 9.0.0-alpha.1.23558.1 - 9.0.0-alpha.1.23558.1 - 9.0.0-alpha.1.23558.1 - 9.0.0-alpha.1.23558.1 - 9.0.0-alpha.1.23558.1 - 9.0.0-alpha.1.23558.1 - 9.0.0-alpha.1.23558.1 - 9.0.0-alpha.1.23558.1 - 9.0.0-alpha.1.23558.1 - 9.0.0-alpha.1.23558.1 - 9.0.0-alpha.1.23558.1 - 9.0.0-alpha.1.23558.1 - 9.0.0-alpha.1.23558.1 - 9.0.0-alpha.1.23558.1 - 9.0.0-alpha.1.23558.1 - 9.0.0-alpha.1.23558.1 - 9.0.0-alpha.1.23558.1 - 9.0.0-alpha.1.23558.1 - 9.0.0-alpha.1.23558.1 - 9.0.0-alpha.1.23558.1 - 9.0.0-alpha.1.23558.1 - 9.0.0-alpha.1.23558.1 - 9.0.0-alpha.1.23558.1 - 9.0.0-alpha.1.23558.1 - 9.0.0-alpha.1.23558.1 - 9.0.0-alpha.1.23558.1 - 9.0.0-alpha.1.23558.1 - 9.0.0-alpha.1.23558.1 - 9.0.0-alpha.1.23558.1 - 9.0.0-alpha.1.23558.1 + 8.0.0 + 8.0.0 + 8.0.0 + 8.0.0 + 8.0.0 + 8.0.0 + 8.0.0 + 8.0.0 + 8.0.0 + 8.0.0 + 8.0.0 + 8.0.0 + 8.0.0 + 8.0.0 + 8.0.0 + 8.0.0 + 8.0.0 + 8.0.0 + 8.0.0 + 8.0.0 + 8.0.0 + 8.0.0 + 8.0.0 + 8.0.0 + 8.0.0 + 8.0.0 + 8.0.0 + 8.0.0 + 8.0.0 + 8.0.0 + 8.0.0 + 8.0.0 + 8.0.0 - 9.0.0-alpha.1.23559.3 - 9.0.0-alpha.1.23559.3 - 9.0.0-alpha.1.23559.3 - 9.0.0-alpha.1.23559.3 - 9.0.0-alpha.1.23559.3 - 9.0.0-alpha.1.23559.3 - 9.0.0-alpha.1.23559.3 - 9.0.0-alpha.1.23559.3 - 9.0.0-alpha.1.23559.3 - 9.0.0-alpha.1.23559.3 + 8.0.0-rtm.23524.15 + 8.0.0-rtm.23524.15 + 8.0.0-rtm.23524.15 + 8.0.0-rtm.23524.15 + 8.0.0-rtm.23524.15 + 8.0.0-rtm.23524.15 + 8.0.0-rtm.23524.15 + 8.0.0-rtm.23524.15 + 8.0.0-rtm.23524.15 - - $(MicrosoftNETCoreAppRuntimewinx64Version) diff --git a/eng/common/build.sh b/eng/common/build.sh index 2c17ba529b9..50af40cdd2c 100755 --- a/eng/common/build.sh +++ b/eng/common/build.sh @@ -105,7 +105,7 @@ while [[ $# > 0 ]]; do -binarylog|-bl) binary_log=true ;; - -excludecibinarylog|-nobl) + -excludeCIBinarylog|-nobl) exclude_ci_binary_log=true ;; -pipelineslog|-pl) diff --git a/eng/common/cross/build-rootfs.sh b/eng/common/cross/build-rootfs.sh index 4228f202e5b..9caf9b021db 100755 --- a/eng/common/cross/build-rootfs.sh +++ b/eng/common/cross/build-rootfs.sh @@ -487,7 +487,7 @@ if [[ "$__CodeName" == "alpine" ]]; then -X "http://dl-cdn.alpinelinux.org/alpine/$version/main" \ -X "http://dl-cdn.alpinelinux.org/alpine/$version/community" \ -U $__ApkSignatureArg --root "$__RootfsDir" --arch "$__AlpineArch" \ - search 'llvm*-libs' | grep -E '^llvm' | sort | tail -1 | sed 's/-[^-]*//2g')" + search 'llvm*-libs' | sort | tail -1 | sed 's/-[^-]*//2g')" fi # install all packages in one go diff --git a/eng/common/cross/riscv64/tizen/tizen.patch b/eng/common/cross/riscv64/tizen/tizen.patch deleted file mode 100644 index eb6d1c07470..00000000000 --- a/eng/common/cross/riscv64/tizen/tizen.patch +++ /dev/null @@ -1,9 +0,0 @@ -diff -u -r a/usr/lib/libc.so b/usr/lib/libc.so ---- a/usr/lib64/libc.so 2016-12-30 23:00:08.284951863 +0900 -+++ b/usr/lib64/libc.so 2016-12-30 23:00:32.140951815 +0900 -@@ -2,4 +2,4 @@ - Use the shared library, but some functions are only in - the static library, so try that secondarily. */ - OUTPUT_FORMAT(elf64-littleriscv) --GROUP ( /lib64/libc.so.6 /usr/lib64/libc_nonshared.a AS_NEEDED ( /lib64/ld-linux-riscv64-lp64d.so.1 ) ) -+GROUP ( libc.so.6 libc_nonshared.a AS_NEEDED ( ld-linux-riscv64-lp64d.so.1 ) ) diff --git a/eng/common/cross/tizen-build-rootfs.sh b/eng/common/cross/tizen-build-rootfs.sh index ba31c93285f..ac84173d44f 100755 --- a/eng/common/cross/tizen-build-rootfs.sh +++ b/eng/common/cross/tizen-build-rootfs.sh @@ -22,10 +22,6 @@ case "$ARCH" in TIZEN_ARCH="x86_64" LINK_ARCH="x86" ;; - riscv64) - TIZEN_ARCH="riscv64" - LINK_ARCH="riscv" - ;; *) echo "Unsupported architecture for tizen: $ARCH" exit 1 @@ -62,21 +58,4 @@ rm -rf $TIZEN_TMP_DIR echo ">>Start configuring Tizen rootfs" ln -sfn asm-${LINK_ARCH} ./usr/include/asm patch -p1 < $__TIZEN_CROSSDIR/tizen.patch -if [[ "$TIZEN_ARCH" == "riscv64" ]]; then - echo "Fixing broken symlinks in $PWD" - rm ./usr/lib64/libresolv.so - ln -s ../../lib64/libresolv.so.2 ./usr/lib64/libresolv.so - rm ./usr/lib64/libpthread.so - ln -s ../../lib64/libpthread.so.0 ./usr/lib64/libpthread.so - rm ./usr/lib64/libdl.so - ln -s ../../lib64/libdl.so.2 ./usr/lib64/libdl.so - rm ./usr/lib64/libutil.so - ln -s ../../lib64/libutil.so.1 ./usr/lib64/libutil.so - rm ./usr/lib64/libm.so - ln -s ../../lib64/libm.so.6 ./usr/lib64/libm.so - rm ./usr/lib64/librt.so - ln -s ../../lib64/librt.so.1 ./usr/lib64/librt.so - rm ./lib/ld-linux-riscv64-lp64d.so.1 - ln -s ../lib64/ld-linux-riscv64-lp64d.so.1 ./lib/ld-linux-riscv64-lp64d.so.1 -fi echo "< - - - - + + + + diff --git a/eng/packages/TestOnly.props b/eng/packages/TestOnly.props index 52f99a5320f..b36c628403e 100644 --- a/eng/packages/TestOnly.props +++ b/eng/packages/TestOnly.props @@ -8,7 +8,7 @@ - + @@ -30,11 +30,6 @@ - - - - - diff --git a/global.json b/global.json index 2b231802f25..d7d4337e6f6 100644 --- a/global.json +++ b/global.json @@ -1,24 +1,22 @@ { "sdk": { - "version": "9.0.100-alpha.1.23557.5" + "version": "8.0.100-rtm.23506.1" }, "tools": { - "dotnet": "9.0.100-alpha.1.23557.5", + "dotnet": "8.0.100-rtm.23506.1", "runtimes": { "dotnet/x64": [ - "8.0.0-rtm.23516.15", - "$(MicrosoftNETCoreAppRuntimewinx64Version)" + "6.0.22" ], "aspnetcore/x64": [ - "8.0.0-rtm.23517.6", - "$(MicrosoftAspNetCoreAppRuntimewinx64Version)" + "6.0.22" ] } }, "msbuild-sdks": { "Microsoft.Build.NoTargets": "3.7.0", "Microsoft.Build.Traversal": "3.2.0", - "Microsoft.DotNet.Arcade.Sdk": "9.0.0-beta.23557.7", - "Microsoft.DotNet.Helix.Sdk": "9.0.0-beta.23557.7" + "Microsoft.DotNet.Arcade.Sdk": "8.0.0-beta.23525.4", + "Microsoft.DotNet.Helix.Sdk": "8.0.0-beta.23525.4" } } diff --git a/src/Analyzers/Microsoft.Analyzers.Local/ApiLifecycle/Json/JsonArray.cs b/src/Analyzers/Microsoft.Analyzers.Local/ApiLifecycle/Json/JsonArray.cs new file mode 100644 index 00000000000..b4921a4d0c1 --- /dev/null +++ b/src/Analyzers/Microsoft.Analyzers.Local/ApiLifecycle/Json/JsonArray.cs @@ -0,0 +1,139 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +// Forked from StyleCop.Analyzers repo. + +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Diagnostics.CodeAnalysis; + +namespace Microsoft.Extensions.LocalAnalyzers.Json; + +/// +/// Represents an ordered collection of JsonValues. +/// +[DebuggerDisplay("Count = {Count}")] +[DebuggerTypeProxy(typeof(JsonArrayDebugView))] +internal sealed class JsonArray : IEnumerable +{ + private readonly List _items = []; + + /// + /// Initializes a new instance of the class, adding the given values to the collection. + /// + /// The values to be added to this collection. + public JsonArray(params JsonValue[] values) + { + if (values == null) + { + throw new ArgumentNullException(nameof(values)); + } + + _items.AddRange(values); + } + + /// + /// Gets the number of values in this collection. + /// + /// The number of values in this collection. + public int Count => _items.Count; + + /// + /// Gets or sets the value at the given index. + /// + /// The zero-based index of the value to get or set. + /// + /// The getter will return JsonValue.Null if the given index is out of range. + /// + public JsonValue this[int index] + { + get => index >= 0 && index < _items.Count + ? _items[index] + : JsonValue.Null; + set => _items[index] = value; + } + + /// + /// Adds the given value to this collection. + /// + /// The value to be added. + /// Returns this collection. + public JsonArray Add(JsonValue value) + { + _items.Add(value); + return this; + } + + /// + /// Inserts the given value at the given index in this collection. + /// + /// The index where the given value will be inserted. + /// The value to be inserted into this collection. + /// Returns this collection. + public JsonArray Insert(int index, JsonValue value) + { + _items.Insert(index, value); + return this; + } + + /// + /// Removes the value at the given index. + /// + /// The index of the value to be removed. + /// Return this collection. + public JsonArray Remove(int index) + { + _items.RemoveAt(index); + return this; + } + + /// + /// Clears the contents of this collection. + /// + /// Returns this collection. + public JsonArray Clear() + { + _items.Clear(); + return this; + } + + /// + /// Determines whether the given item is in the JsonArray. + /// + /// The item to locate in the JsonArray. + /// Returns true if the item is found; otherwise, false. + public bool Contains(JsonValue item) => _items.Contains(item); + + /// + /// Determines the index of the given item in this JsonArray. + /// + /// The item to locate in this JsonArray. + /// The index of the item, if found. Otherwise, returns -1. + public int IndexOf(JsonValue item) => _items.IndexOf(item); + + /// + /// Returns an enumerator that iterates through the collection. + /// + /// The enumerator that iterates through the collection. + public IEnumerator GetEnumerator() => _items.GetEnumerator(); + + /// + /// Returns an enumerator that iterates through the collection. + /// + /// The enumerator that iterates through the collection. + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() => GetEnumerator(); + + [ExcludeFromCodeCoverage] + private sealed class JsonArrayDebugView + { + [SuppressMessage("Major Code Smell", "S1144:Unused private types or members should be removed", Justification = "Used by debugger.")] + public JsonArrayDebugView(JsonArray array) + { + Items = array._items.ToArray(); + } + + [DebuggerBrowsable(DebuggerBrowsableState.RootHidden)] + public JsonValue[] Items { get; } + } +} diff --git a/src/Analyzers/Microsoft.Analyzers.Local/ApiLifecycle/Json/JsonObject.cs b/src/Analyzers/Microsoft.Analyzers.Local/ApiLifecycle/Json/JsonObject.cs new file mode 100644 index 00000000000..54bc365173b --- /dev/null +++ b/src/Analyzers/Microsoft.Analyzers.Local/ApiLifecycle/Json/JsonObject.cs @@ -0,0 +1,212 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +// Forked from StyleCop.Analyzers repo. + +using System.Collections.Generic; +using System.Diagnostics; +using System.Diagnostics.CodeAnalysis; + +namespace Microsoft.Extensions.LocalAnalyzers.Json; + +/// +/// Represents a key-value pair collection of JsonValue objects. +/// +[DebuggerDisplay("Count = {Count}")] +[DebuggerTypeProxy(typeof(JsonObjectDebugView))] +internal sealed class JsonObject : IEnumerable>, IEnumerable +{ + private readonly IDictionary _properties; + + /// + /// Initializes a new instance of the class. + /// + public JsonObject() + { + _properties = new Dictionary(); + } + + /// + /// Gets the number of properties in this JsonObject. + /// + /// The number of properties in this JsonObject. + public int Count => _properties.Count; + + /// + /// Gets or sets the property with the given key. + /// + /// The key of the property to get or set. + /// + /// The getter will return JsonValue.Null if the given key is not associated with any value. + /// + public JsonValue this[string key] + { + get => _properties.TryGetValue(key, out var value) + ? value + : JsonValue.Null; + set => _properties[key] = value; + } + + /// + /// Adds a key with a value to this collection. + /// + /// The key of the property to be added. + /// Returns this JsonObject. + /// The that was added. + public JsonObject Add(string key) => Add(key, JsonValue.Null); + + /// + /// Adds a value associated with a key to this collection. + /// + /// The key of the property to be added. + /// The value of the property to be added. + /// Returns this JsonObject. + public JsonObject Add(string key, JsonValue value) + { + _properties.Add(key, value); + return this; + } + + /// + /// Removes a property with the given key. + /// + /// The key of the property to be removed. + /// + /// Returns true if the given key is found and removed; otherwise, false. + /// + public bool Remove(string key) => _properties.Remove(key); + + /// + /// Clears the contents of this collection. + /// + /// Returns this JsonObject. + public JsonObject Clear() + { + _properties.Clear(); + return this; + } + + /// + /// Changes the key of one of the items in the collection. + /// + /// + /// This method has no effects if the oldKey does not exists. + /// If the newKey already exists, the value will be overwritten. + /// + /// The name of the key to be changed. + /// The new name of the key. + /// Returns this JsonObject. + public JsonObject Rename(string oldKey, string newKey) + { + if (oldKey == newKey) + { + return this; + } + + if (_properties.TryGetValue(oldKey, out var value)) + { + this[newKey] = value; + _ = Remove(oldKey); + } + + return this; + } + + /// + /// Determines whether this collection contains an item associated with the given key. + /// + /// The key to locate in this collection. + /// Returns true if the key is found; otherwise, false. + public bool ContainsKey(string key) => _properties.ContainsKey(key); + + /// + /// Determines whether this collection contains the given JsonValue. + /// + /// The value to locate in this collection. + /// Returns true if the value is found; otherwise, false. + public bool Contains(JsonValue value) => _properties.Values.Contains(value); + + /// + /// Returns an enumerator that iterates through this collection. + /// + /// The enumerator that iterates through this collection. + public IEnumerator> GetEnumerator() => _properties.GetEnumerator(); + + /// + /// Returns an enumerator that iterates through this collection. + /// + /// The enumerator that iterates through this collection. + IEnumerator IEnumerable.GetEnumerator() => _properties.Values.GetEnumerator(); + + /// + /// Returns an enumerator that iterates through this collection. + /// + /// The enumerator that iterates through this collection. + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() => GetEnumerator(); + + [ExcludeFromCodeCoverage] + private sealed class JsonObjectDebugView + { + private readonly JsonObject _object; + + [SuppressMessage("Major Code Smell", "S1144:Unused private types or members should be removed", Justification = "Used by debugger.")] + public JsonObjectDebugView(JsonObject jsonObject) + { + _object = jsonObject; + } + + [DebuggerBrowsable(DebuggerBrowsableState.RootHidden)] + public KeyValuePair[] Keys + { + get + { + var keys = new KeyValuePair[_object.Count]; + + var i = 0; + foreach (var property in _object) + { + keys[i] = new KeyValuePair(property.Key, property.Value); + i += 1; + } + + return keys; + } + } + + [DebuggerDisplay("{value.ToString(),nq}", Name = "{key}", Type = "JsonValue({Type})")] + public sealed class KeyValuePair + { + [DebuggerBrowsable(DebuggerBrowsableState.Never)] +#pragma warning disable IDE0052 // Remove unread private members + private readonly string _key; +#pragma warning restore IDE0052 // Remove unread private members + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + private readonly JsonValue _value; + + public KeyValuePair(string key, JsonValue value) + { + _key = key; + _value = value; + } + + [DebuggerBrowsable(DebuggerBrowsableState.RootHidden)] + public object View + { + get + { + if (_value.IsJsonObject) + { + return (JsonObject)_value!; + } + else if (_value.IsJsonArray) + { + return (JsonArray)_value!; + } + + return _value; + } + } + } + } +} diff --git a/src/Analyzers/Microsoft.Analyzers.Local/ApiLifecycle/Json/JsonObjectExtensions.cs b/src/Analyzers/Microsoft.Analyzers.Local/ApiLifecycle/Json/JsonObjectExtensions.cs new file mode 100644 index 00000000000..27a2e6a5493 --- /dev/null +++ b/src/Analyzers/Microsoft.Analyzers.Local/ApiLifecycle/Json/JsonObjectExtensions.cs @@ -0,0 +1,29 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System; +using Microsoft.Extensions.LocalAnalyzers.Json; + +namespace Microsoft.Extensions.LocalAnalyzers.Json; + +internal static class JsonObjectExtensions +{ + public static T[] GetValueArray(this JsonObject value, string name) + { + var arrayOfTypes = value[name].AsJsonArray; + + if (arrayOfTypes == null) + { + return Array.Empty(); + } + + var types = new T[arrayOfTypes.Count]; + + for (var i = 0; i < arrayOfTypes.Count; i++) + { + types[i] = (T)Activator.CreateInstance(typeof(T), arrayOfTypes[i].AsJsonObject); + } + + return types; + } +} diff --git a/src/Analyzers/Microsoft.Analyzers.Local/ApiLifecycle/Json/JsonParseException.cs b/src/Analyzers/Microsoft.Analyzers.Local/ApiLifecycle/Json/JsonParseException.cs new file mode 100644 index 00000000000..9c9d6abaaf6 --- /dev/null +++ b/src/Analyzers/Microsoft.Analyzers.Local/ApiLifecycle/Json/JsonParseException.cs @@ -0,0 +1,73 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +// Forked from StyleCop.Analyzers repo. + +using System; + +namespace Microsoft.Extensions.LocalAnalyzers.Json; + +/// +/// The exception that is thrown when a JSON message cannot be parsed. +/// +/// +/// This exception is only intended to be thrown by LightJson. +/// +#pragma warning disable CA1032 // Implement standard exception constructors +public sealed class JsonParseException : Exception +#pragma warning restore CA1032 // Implement standard exception constructors +{ + /// + /// Gets the text position where the error occurred. + /// + /// The text position where the error occurred. + public TextPosition Position { get; } + + /// + /// Gets the type of error that caused the exception to be thrown. + /// + /// The type of error that caused the exception to be thrown. + public ParsingError Error { get; } + + /// + /// Initializes a new instance of the class. + /// + public JsonParseException() + : base(GetMessage(ParsingError.Unknown)) + { + } + + /// + /// Initializes a new instance of the class with the given error type and position. + /// + /// The error type that describes the cause of the error. + /// The position in the text where the error occurred. + public JsonParseException(ParsingError type, TextPosition position) + : this(GetMessage(type), type, position) + { + } + + /// + /// Initializes a new instance of the class with the given message, error type, and position. + /// + /// The message that describes the error. + /// The error type that describes the cause of the error. + /// The position in the text where the error occurred. + public JsonParseException(string message, ParsingError error, TextPosition position) + : base(message) + { + Error = error; + Position = position; + } + + private static string GetMessage(ParsingError type) + { + return type switch + { + ParsingError.IncompleteMessage => "The string ended before a value could be parsed.", + ParsingError.InvalidOrUnexpectedCharacter => "The parser encountered an invalid or unexpected character.", + ParsingError.DuplicateObjectKeys => "The parser encountered a JsonObject with duplicate keys.", + _ => "An error occurred while parsing the JSON message." + }; + } +} diff --git a/src/Analyzers/Microsoft.Analyzers.Local/ApiLifecycle/Json/JsonReader.cs b/src/Analyzers/Microsoft.Analyzers.Local/ApiLifecycle/Json/JsonReader.cs new file mode 100644 index 00000000000..fab89823a3f --- /dev/null +++ b/src/Analyzers/Microsoft.Analyzers.Local/ApiLifecycle/Json/JsonReader.cs @@ -0,0 +1,389 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +// Forked from StyleCop.Analyzers repo. + +using System; +using System.Globalization; +using System.IO; +using System.Text; + +namespace Microsoft.Extensions.LocalAnalyzers.Json; + +/// +/// Represents a reader that can read JsonValues. +/// +internal sealed class JsonReader +{ + private readonly TextScanner _scanner; + + private JsonReader(TextReader reader) + { + _scanner = new TextScanner(reader); + } + + /// + /// Creates a JsonValue by using the given TextReader. + /// + /// The TextReader used to read a JSON message. + /// The parsed . + public static JsonValue Parse(TextReader reader) + { + if (reader == null) + { + throw new ArgumentNullException(nameof(reader)); + } + + return new JsonReader(reader).Parse(); + } + + /// + /// Creates a JsonValue by reader the JSON message in the given string. + /// + /// The string containing the JSON message. + /// The parsed . + public static JsonValue Parse(string source) + { + if (source == null) + { + throw new ArgumentNullException(nameof(source)); + } + + using var reader = new StringReader(source); + + return Parse(reader); + } + + private string ReadJsonKey() + { + return ReadString(); + } + + private JsonValue ReadJsonValue() + { + _scanner.SkipWhitespace(); + + var next = _scanner.Peek(); + + if (char.IsNumber(next)) + { + return ReadNumber(); + } + + return next switch + { + '{' => ReadObject(), + '[' => ReadArray(), + '"' => ReadString(), + '-' => ReadNumber(), + 't' or 'f' => ReadBoolean(), + 'n' => ReadNull(), + _ => throw new JsonParseException( + ParsingError.InvalidOrUnexpectedCharacter, + _scanner.Position), + }; + } + + private JsonValue ReadNull() + { + _scanner.Assert("null"); + return JsonValue.Null; + } + + private JsonValue ReadBoolean() + { + switch (_scanner.Peek()) + { + case 't': + _scanner.Assert("true"); + return true; + + default: + _scanner.Assert("false"); + return false; + } + } + + private void ReadDigits(StringBuilder builder) + { + while (true) + { + int next = _scanner.Peek(throwAtEndOfFile: false); + if (next == -1 || !char.IsNumber((char)next)) + { + return; + } + + _ = builder.Append(_scanner.Read()); + } + } + + private JsonValue ReadNumber() + { + var builder = new StringBuilder(); + + if (_scanner.Peek() == '-') + { + _ = builder.Append(_scanner.Read()); + } + + if (_scanner.Peek() == '0') + { + _ = builder.Append(_scanner.Read()); + } + else + { + ReadDigits(builder); + } + + if (_scanner.Peek(throwAtEndOfFile: false) == '.') + { + _ = builder.Append(_scanner.Read()); + + ReadDigits(builder); + } + + if (_scanner.Peek(throwAtEndOfFile: false) == 'e' || _scanner.Peek(throwAtEndOfFile: false) == 'E') + { + _ = builder.Append(_scanner.Read()); + + var next = _scanner.Peek(); + + switch (next) + { + case '+': + case '-': + _ = builder.Append(_scanner.Read()); + break; + } + + ReadDigits(builder); + } + + return double.Parse( + builder.ToString(), + CultureInfo.InvariantCulture); + } + + private string ReadString() + { + var builder = new StringBuilder(); + + _scanner.Assert('"'); + + while (true) + { + var errorPosition = _scanner.Position; + var c = _scanner.Read(); + + if (c == '\\') + { + errorPosition = _scanner.Position; + c = _scanner.Read(); + + _ = char.ToLowerInvariant(c) switch + { + '"' or '\\' or '/' => builder.Append(c), + 'b' => builder.Append('\b'), + 'f' => builder.Append('\f'), + 'n' => builder.Append('\n'), + 'r' => builder.Append('\r'), + 't' => builder.Append('\t'), + 'u' => builder.Append(ReadUnicodeLiteral()), + _ => throw new JsonParseException( + ParsingError.InvalidOrUnexpectedCharacter, + errorPosition), + }; + } + else if (c == '"') + { + break; + } + else + { + if (char.IsControl(c)) + { + throw new JsonParseException( + ParsingError.InvalidOrUnexpectedCharacter, + errorPosition); + } + + _ = builder.Append(c); + } + } + + return builder.ToString(); + } + + private int ReadHexDigit() + { + var errorPosition = _scanner.Position; +#pragma warning disable S109 // Magic numbers should not be used + return char.ToUpperInvariant(_scanner.Read()) switch + { + '0' => 0, + '1' => 1, + '2' => 2, + '3' => 3, + '4' => 4, + '5' => 5, + '6' => 6, + '7' => 7, + '8' => 8, + '9' => 9, + 'A' => 10, + 'B' => 11, + 'C' => 12, + 'D' => 13, + 'E' => 14, + 'F' => 15, + _ => throw new JsonParseException( + ParsingError.InvalidOrUnexpectedCharacter, + errorPosition), + }; + } + + private char ReadUnicodeLiteral() + { + int value = 0; + + value += ReadHexDigit() * 4096; // 16^3 + value += ReadHexDigit() * 256; // 16^2 + value += ReadHexDigit() * 16; // 16^1 + value += ReadHexDigit(); // 16^0 + + return (char)value; + } +#pragma warning restore S109 // Magic numbers should not be used + private JsonObject ReadObject() + { + return ReadObject([]); + } + + private JsonObject ReadObject(JsonObject jsonObject) + { + _scanner.Assert('{'); + + _scanner.SkipWhitespace(); + + if (_scanner.Peek() == '}') + { + _ = _scanner.Read(); + } + else + { + while (true) + { + _scanner.SkipWhitespace(); + + var errorPosition = _scanner.Position; + var key = ReadJsonKey(); + + if (jsonObject.ContainsKey(key)) + { + throw new JsonParseException( + ParsingError.DuplicateObjectKeys, + errorPosition); + } + + _scanner.SkipWhitespace(); + + _scanner.Assert(':'); + + _scanner.SkipWhitespace(); + + var value = ReadJsonValue(); + + _ = jsonObject.Add(key, value); + + _scanner.SkipWhitespace(); + + errorPosition = _scanner.Position; + var next = _scanner.Read(); + if (next == ',') + { + // Allow trailing commas in objects + _scanner.SkipWhitespace(); + if (_scanner.Peek() == '}') + { + next = _scanner.Read(); + } + } + + if (next == '}') + { + break; + } + else if (next != ',') + { + throw new JsonParseException( + ParsingError.InvalidOrUnexpectedCharacter, + errorPosition); + } + } + } + + return jsonObject; + } + + private JsonArray ReadArray() + { + return ReadArray([]); + } + + private JsonArray ReadArray(JsonArray jsonArray) + { + _scanner.Assert('['); + + _scanner.SkipWhitespace(); + + if (_scanner.Peek() == ']') + { + _ = _scanner.Read(); + } + else + { + while (true) + { + _scanner.SkipWhitespace(); + + var value = ReadJsonValue(); + + _ = jsonArray.Add(value); + + _scanner.SkipWhitespace(); + + var errorPosition = _scanner.Position; + var next = _scanner.Read(); + if (next == ',') + { + // Allow trailing commas in arrays + _scanner.SkipWhitespace(); + if (_scanner.Peek() == ']') + { + next = _scanner.Read(); + } + } + + if (next == ']') + { + break; + } + else if (next != ',') + { + throw new JsonParseException( + ParsingError.InvalidOrUnexpectedCharacter, + errorPosition); + } + } + } + + return jsonArray; + } + + private JsonValue Parse() + { + _scanner.SkipWhitespace(); + return ReadJsonValue(); + } +} diff --git a/src/Analyzers/Microsoft.Analyzers.Local/ApiLifecycle/Json/JsonValue.cs b/src/Analyzers/Microsoft.Analyzers.Local/ApiLifecycle/Json/JsonValue.cs new file mode 100644 index 00000000000..93aa01236d5 --- /dev/null +++ b/src/Analyzers/Microsoft.Analyzers.Local/ApiLifecycle/Json/JsonValue.cs @@ -0,0 +1,622 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +// Forked from StyleCop.Analyzers repo. + +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Diagnostics.CodeAnalysis; +using System.Globalization; + +namespace Microsoft.Extensions.LocalAnalyzers.Json; + +/// +/// A wrapper object that contains a valid JSON value. +/// +[DebuggerDisplay("{ToString(),nq}", Type = "JsonValue({Type})")] +[DebuggerTypeProxy(typeof(JsonValueDebugView))] +[SuppressMessage("Major Bug", "S1244:Floating point numbers should not be tested for equality", + Justification = "Would require unnecessary refactor.")] +internal readonly struct JsonValue : IEquatable +{ + /// + /// Represents a JsonValue. + /// + public static readonly JsonValue Null = new(JsonValueType.Null, default, null); + private readonly object? _reference; + private readonly double _value; + + /// + /// Initializes a new instance of the struct, representing a Boolean value. + /// + /// The value to be wrapped. + public JsonValue(bool? value) + { + if (!value.HasValue) + { + this = Null; + return; + } + + Type = JsonValueType.Boolean; + _reference = null; + _value = value.Value ? 1 : 0; + } + + /// + /// Initializes a new instance of the struct, representing a Number value. + /// + /// The value to be wrapped. + public JsonValue(double? value) + { + if (!value.HasValue) + { + this = Null; + return; + } + + Type = JsonValueType.Number; + _reference = null; + _value = value.Value; + } + + /// + /// Initializes a new instance of the struct, representing a String value. + /// + /// The value to be wrapped. + public JsonValue(string? value) + { + if (value is null) + { + this = Null; + return; + } + + Type = JsonValueType.String; + _value = default; + _reference = value; + } + + /// + /// Initializes a new instance of the struct, representing a JsonObject. + /// + /// The value to be wrapped. + public JsonValue(JsonObject? value) + { + if (value is null) + { + this = Null; + return; + } + + Type = JsonValueType.Object; + _value = default; + _reference = value; + } + + /// + /// Initializes a new instance of the struct, representing a Array reference value. + /// + /// The value to be wrapped. + public JsonValue(JsonArray? value) + { + if (value is null) + { + this = Null; + return; + } + + Type = JsonValueType.Array; + _value = default; + _reference = value; + } + + /// + /// Initializes a new instance of the struct. + /// + /// The Json type of the JsonValue. + /// + /// The internal value of the JsonValue. + /// This is used when the Json type is Number or Boolean. + /// + /// + /// The internal value reference of the JsonValue. + /// This value is used when the Json type is String, JsonObject, or JsonArray. + /// + private JsonValue(JsonValueType type, double value, object? reference) + { + Type = type; + _value = value; + _reference = reference; + } + + /// + /// Gets the type of this JsonValue. + /// + /// The type of this JsonValue. + public JsonValueType Type { get; } + + /// + /// Gets a value indicating whether this JsonValue is Null. + /// + /// A value indicating whether this JsonValue is Null. + public bool IsNull => Type == JsonValueType.Null; + + /// + /// Gets a value indicating whether this JsonValue is a Boolean. + /// + /// A value indicating whether this JsonValue is a Boolean. + public bool IsBoolean => Type == JsonValueType.Boolean; + + /// + /// Gets a value indicating whether this JsonValue is an Integer. + /// + /// A value indicating whether this JsonValue is an Integer. +#pragma warning disable S2589 // Boolean expressions should not be gratuitous + public bool IsInteger => IsNumber && unchecked((int)_value) == _value; +#pragma warning restore S2589 // Boolean expressions should not be gratuitous + + /// + /// Gets a value indicating whether this JsonValue is a Number. + /// + /// A value indicating whether this JsonValue is a Number. + public bool IsNumber => Type == JsonValueType.Number; + + /// + /// Gets a value indicating whether this JsonValue is a String. + /// + /// A value indicating whether this JsonValue is a String. + public bool IsString => Type == JsonValueType.String; + + /// + /// Gets a value indicating whether this JsonValue is a JsonObject. + /// + /// A value indicating whether this JsonValue is a JsonObject. + public bool IsJsonObject => Type == JsonValueType.Object; + + /// + /// Gets a value indicating whether this JsonValue is a JsonArray. + /// + /// A value indicating whether this JsonValue is a JsonArray. + public bool IsJsonArray => Type == JsonValueType.Array; + + /// + /// Gets a value indicating whether this JsonValue represents a DateTime. + /// + /// A value indicating whether this JsonValue represents a DateTime. + public bool IsDateTime => AsDateTime != null; + + /// + /// Gets a value indicating whether this value is true or false. + /// + /// This value as a Boolean type. + public bool AsBoolean => Type switch + { + JsonValueType.Boolean => _value == 1, + JsonValueType.Number => _value != 0, + JsonValueType.String => !string.IsNullOrEmpty((string?)_reference), + JsonValueType.Object or JsonValueType.Array => true, + _ => false, + }; + + /// + /// Gets this value as an Integer type. + /// + /// This value as an Integer type. + public int AsInteger + { + get + { + var current = AsNumber; + + if (current >= int.MaxValue) + { + return int.MaxValue; + } + + if (_value <= int.MinValue) + { + return int.MinValue; + } + + return (int)_value; + } + } + + /// + /// Gets this value as a Number type. + /// + /// This value as a Number type. + public double AsNumber => Type switch + { + JsonValueType.Boolean => _value == 1 ? 1 : 0, + JsonValueType.Number => _value, + JsonValueType.String => double.TryParse((string?)_reference, NumberStyles.Float, CultureInfo.InvariantCulture, out var number) + ? number + : 0, + _ => 0 + }; + + /// + /// Gets this value as a String type. + /// + /// This value as a String type. + public string? AsString => Type switch + { + JsonValueType.Boolean => (_value == 1) + ? "true" + : "false", + JsonValueType.Number => _value.ToString(CultureInfo.InvariantCulture), + JsonValueType.String => (string?)_reference, + _ => null, + }; + + /// + /// Gets this value as an JsonObject. + /// + /// This value as an JsonObject. +#pragma warning disable S1168 // Empty arrays and collections should be returned instead of null + public JsonObject? AsJsonObject => IsJsonObject ? (JsonObject?)_reference : null; + + /// + /// Gets this value as an JsonArray. + /// + /// This value as an JsonArray. + public JsonArray? AsJsonArray => IsJsonArray ? (JsonArray?)_reference : null; +#pragma warning restore S1168 // Empty arrays and collections should be returned instead of null + + /// + /// Gets this value as a system.DateTime. + /// + /// This value as a system.DateTime. + public DateTime? AsDateTime => IsString && DateTime.TryParse((string?)_reference ?? string.Empty, out var value) + ? value + : null; + + /// + /// Gets this (inner) value as a System.object. + /// + /// This (inner) value as a System.object. + public object? AsObject => Type switch + { + JsonValueType.Boolean or JsonValueType.Number => _value, + JsonValueType.String or JsonValueType.Object or JsonValueType.Array => _reference, + _ => null + }; + + /// + /// Gets or sets the value associated with the specified key. + /// + /// The key of the value to get or set. + /// + /// Thrown when this JsonValue is not a JsonObject. + /// + public JsonValue this[string key] + { + get + { + if (IsJsonObject) + { + return ((JsonObject)_reference!)[key]; + } + else + { + throw new InvalidOperationException("This value does not represent a JsonObject."); + } + } + + set + { + if (IsJsonObject) + { + ((JsonObject)_reference!)[key] = value; + } + else + { + throw new InvalidOperationException("This value does not represent a JsonObject."); + } + } + } + + /// + /// Gets or sets the value at the specified index. + /// + /// The zero-based index of the value to get or set. + /// + /// Thrown when this is not a . + /// + public JsonValue this[int index] + { + get + { + if (IsJsonArray) + { + return ((JsonArray)_reference!)[index]; + } + else + { + throw new InvalidOperationException("This value does not represent a JsonArray."); + } + } + + set + { + if (IsJsonArray) + { + ((JsonArray)_reference!)[index] = value; + } + else + { + throw new InvalidOperationException("This value does not represent a JsonArray."); + } + } + } + + /// + /// Converts the given nullable boolean into a JsonValue. + /// + /// The value to be converted. + public static implicit operator JsonValue(bool? value) + { + return new JsonValue(value); + } + + /// + /// Converts the given nullable double into a JsonValue. + /// + /// The value to be converted. + public static implicit operator JsonValue(double? value) + { + return new JsonValue(value); + } + + /// + /// Converts the given string into a JsonValue. + /// + /// The value to be converted. + public static implicit operator JsonValue(string value) + { + return new JsonValue(value); + } + + /// + /// Converts the given JsonObject into a JsonValue. + /// + /// The value to be converted. + public static implicit operator JsonValue(JsonObject value) + { + return new JsonValue(value); + } + + /// + /// Converts the given JsonArray into a JsonValue. + /// + /// The value to be converted. + public static implicit operator JsonValue(JsonArray value) + { + return new JsonValue(value); + } + + /// + /// Converts the given DateTime? into a JsonValue. + /// + /// + /// The DateTime value will be stored as a string using ISO 8601 format, + /// since JSON does not define a DateTime type. + /// + /// The value to be converted. + public static implicit operator JsonValue(DateTime? value) + { + return value == null + ? Null + : new JsonValue(value.Value.ToString("o", CultureInfo.InvariantCulture)); + } + + /// + /// Converts the given JsonValue into an Int. + /// + /// The JsonValue to be converted. + public static explicit operator int(JsonValue jsonValue) + { + return jsonValue.IsInteger ? jsonValue.AsInteger : 0; + } + + /// + /// Converts the given JsonValue into a nullable Int. + /// + /// The JsonValue to be converted. + /// + /// Throws System.InvalidCastException when the inner value type of the + /// JsonValue is not the desired type of the conversion. + /// + public static explicit operator int?(JsonValue jsonValue) + { + return jsonValue.IsNull ? null : (int)jsonValue; + } + + /// + /// Converts the given JsonValue into a Bool. + /// + /// The JsonValue to be converted. + public static explicit operator bool(JsonValue jsonValue) + { + return jsonValue.IsBoolean && jsonValue._value == 1; + } + + /// + /// Converts the given JsonValue into a nullable Bool. + /// + /// The JsonValue to be converted. + /// + /// Throws System.InvalidCastException when the inner value type of the + /// JsonValue is not the desired type of the conversion. + /// + public static explicit operator bool?(JsonValue jsonValue) + { + return jsonValue.IsNull ? null : (bool)jsonValue; + } + + /// + /// Converts the given JsonValue into a Double. + /// + /// The JsonValue to be converted. + public static explicit operator double(JsonValue jsonValue) + { + return jsonValue.IsNumber ? jsonValue._value : double.NaN; + } + + /// + /// Converts the given JsonValue into a nullable Double. + /// + /// The JsonValue to be converted. + /// + /// Throws System.InvalidCastException when the inner value type of the + /// JsonValue is not the desired type of the conversion. + /// + public static explicit operator double?(JsonValue jsonValue) + { + return jsonValue.IsNull + ? null + : (double)jsonValue; + } + + /// + /// Converts the given JsonValue into a String. + /// + /// The JsonValue to be converted. + public static explicit operator string?(JsonValue jsonValue) + { + return jsonValue.IsString || jsonValue.IsNull + ? jsonValue._reference as string + : null; + } + + /// + /// Converts the given JsonValue into a JsonObject. + /// + /// The JsonValue to be converted. + public static explicit operator JsonObject?(JsonValue jsonValue) + { + return jsonValue.IsJsonObject || jsonValue.IsNull ? jsonValue._reference as JsonObject : null; + } + + /// + /// Converts the given JsonValue into a JsonArray. + /// + /// The JsonValue to be converted. + public static explicit operator JsonArray?(JsonValue jsonValue) + { + return jsonValue.IsJsonArray || jsonValue.IsNull ? jsonValue._reference as JsonArray : null; + } + + /// + /// Converts the given JsonValue into a DateTime. + /// + /// The JsonValue to be converted. + public static explicit operator DateTime(JsonValue jsonValue) + { + return jsonValue.AsDateTime ?? DateTime.MinValue; + } + + /// + /// Converts the given JsonValue into a nullable DateTime. + /// + /// The JsonValue to be converted. + public static explicit operator DateTime?(JsonValue jsonValue) + { + return jsonValue.IsDateTime || jsonValue.IsNull + ? jsonValue.AsDateTime + : null; + } + + /// + /// Returns a value indicating whether the two given JsonValues are equal. + /// + /// First JsonValue to compare. + /// Second JsonValue to compare. + public static bool operator ==(JsonValue a, JsonValue b) + { + return (a.Type == b.Type) + && (a._value == b._value) + && Equals(a._reference, b._reference); + } + + /// + /// Returns a value indicating whether the two given JsonValues are unequal. + /// + /// First JsonValue to compare. + /// Second JsonValue to compare. + public static bool operator !=(JsonValue a, JsonValue b) + { + return !(a == b); + } + + /// + /// Returns a JsonValue by parsing the given string. + /// + /// The JSON-formatted string to be parsed. + /// The representing the parsed text. + public static JsonValue Parse(string text) + { + return JsonReader.Parse(text); + } + + public bool Equals(JsonValue other) + { + return other == this; + } + + /// + public override bool Equals(object? obj) + { + if (obj is JsonValue jv) + { + return this == jv; + } + + return IsNull && obj is null; + } + + /// + public override int GetHashCode() + { + var r = _reference != null ? EqualityComparer.Default.GetHashCode(_reference) : 1; + + return IsNull + ? Type.GetHashCode() + : Type.GetHashCode() + ^ _value.GetHashCode() + ^ r; + } + + [ExcludeFromCodeCoverage] + private sealed class JsonValueDebugView + { + private readonly JsonValue _jsonValue; + + [SuppressMessage("Major Code Smell", "S1144:Unused private types or members should be removed", Justification = "Used by debugger.")] + public JsonValueDebugView(JsonValue jsonValue) + { + _jsonValue = jsonValue; + } + + [DebuggerBrowsable(DebuggerBrowsableState.RootHidden)] +#pragma warning disable S1168 // Empty arrays and collections should be returned instead of null + public JsonObject? ObjectView => _jsonValue.IsJsonObject + ? (JsonObject?)_jsonValue._reference + : null; + + [DebuggerBrowsable(DebuggerBrowsableState.RootHidden)] + public JsonArray? ArrayView => _jsonValue.IsJsonArray + ? (JsonArray?)_jsonValue._reference + : null; +#pragma warning restore S1168 // Empty arrays and collections should be returned instead of null + + public JsonValueType Type => _jsonValue.Type; + + public object? Value => _jsonValue.IsJsonObject || _jsonValue.IsJsonArray + ? _jsonValue._reference + : null; + } +} diff --git a/src/Analyzers/Microsoft.Analyzers.Local/ApiLifecycle/Json/JsonValueType.cs b/src/Analyzers/Microsoft.Analyzers.Local/ApiLifecycle/Json/JsonValueType.cs new file mode 100644 index 00000000000..63d44f14823 --- /dev/null +++ b/src/Analyzers/Microsoft.Analyzers.Local/ApiLifecycle/Json/JsonValueType.cs @@ -0,0 +1,42 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +// Forked from StyleCop.Analyzers repo. + +namespace Microsoft.Extensions.LocalAnalyzers.Json; + +/// +/// Enumerates the types of Json values. +/// +internal enum JsonValueType +{ + /// + /// A value. + /// + Null = 0, + + /// + /// A boolean value. + /// + Boolean, + + /// + /// A number value. + /// + Number, + + /// + /// A string value. + /// + String, + + /// + /// An object value. + /// + Object, + + /// + /// An array value. + /// + Array, +} diff --git a/src/Analyzers/Microsoft.Analyzers.Local/ApiLifecycle/Json/ParsingError.cs b/src/Analyzers/Microsoft.Analyzers.Local/ApiLifecycle/Json/ParsingError.cs new file mode 100644 index 00000000000..67f9aa2d28a --- /dev/null +++ b/src/Analyzers/Microsoft.Analyzers.Local/ApiLifecycle/Json/ParsingError.cs @@ -0,0 +1,33 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +// Forked from StyleCop.Analyzers repo. + +namespace Microsoft.Extensions.LocalAnalyzers.Json; + +/// +/// Enumerates the types of errors that can occur when parsing a JSON message. +/// +public enum ParsingError +{ + /// + /// Indicates that the cause of the error is unknown. + /// + Unknown = 0, + + /// + /// Indicates that the text ended before the message could be parsed. + /// + IncompleteMessage, + + /// + /// Indicates that a JsonObject contains more than one key with the same name. + /// + DuplicateObjectKeys, + + /// + /// Indicates that the parser encountered and invalid or unexpected character. + /// + InvalidOrUnexpectedCharacter, +} + diff --git a/src/Analyzers/Microsoft.Analyzers.Local/ApiLifecycle/Json/TextPosition.cs b/src/Analyzers/Microsoft.Analyzers.Local/ApiLifecycle/Json/TextPosition.cs new file mode 100644 index 00000000000..a2e5e672049 --- /dev/null +++ b/src/Analyzers/Microsoft.Analyzers.Local/ApiLifecycle/Json/TextPosition.cs @@ -0,0 +1,30 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +// Forked from StyleCop.Analyzers repo. + +namespace Microsoft.Extensions.LocalAnalyzers.Json; + +/// +/// Represents a position within a plain text resource. +/// +#pragma warning disable CA1815 // Override equals and operator equals on value types +public readonly struct TextPosition +#pragma warning restore CA1815 // Override equals and operator equals on value types +{ + /// + /// Gets the column position, 0-based. + /// + public long Column { get; } + + /// + /// Gets the line position, 0-based. + /// + public long Line { get; } + + public TextPosition(long column, long line) + { + Column = column; + Line = line; + } +} diff --git a/src/Analyzers/Microsoft.Analyzers.Local/ApiLifecycle/Json/TextScanner.cs b/src/Analyzers/Microsoft.Analyzers.Local/ApiLifecycle/Json/TextScanner.cs new file mode 100644 index 00000000000..20e4beb946e --- /dev/null +++ b/src/Analyzers/Microsoft.Analyzers.Local/ApiLifecycle/Json/TextScanner.cs @@ -0,0 +1,215 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +// Forked from StyleCop.Analyzers repo. + +using System.Globalization; +using System.IO; + +namespace Microsoft.Extensions.LocalAnalyzers.Json; + +/// +/// Represents a text scanner that reads one character at a time. +/// +internal sealed class TextScanner +{ + private readonly TextReader _reader; + + /// + /// Initializes a new instance of the class. + /// + /// The TextReader to read the text. + public TextScanner(TextReader reader) + { + _reader = reader; + } + + /// + /// Gets the position of the scanner within the text. + /// + /// The position of the scanner within the text. + public TextPosition Position { get; private set; } + + /// + /// Reads the next character in the stream without changing the current position. + /// + /// The next character in the stream. + public char Peek() => (char)Peek(throwAtEndOfFile: true); + + /// + /// Reads the next character in the stream without changing the current position. + /// + /// to throw an exception if the end of the file is + /// reached; otherwise, . + /// The next character in the stream, or -1 if the end of the file is reached with + /// set to . + public int Peek(bool throwAtEndOfFile) + { + var next = _reader.Peek(); + + if (next == -1 && throwAtEndOfFile) + { + throw new JsonParseException(ParsingError.IncompleteMessage, Position); + } + + return next; + } + + /// + /// Reads the next character in the stream, advancing the text position. + /// + /// The next character in the stream. + public char Read() + { + var next = _reader.Read(); + + if (next == -1) + { + throw new JsonParseException(ParsingError.IncompleteMessage, Position); + } + else + { + Position = next == '\n' + ? new(0, Position.Line + 1) + : new(Position.Column + 1, Position.Line); + + return (char)next; + } + } + + /// + /// Advances the scanner to next non-whitespace character. + /// + public void SkipWhitespace() + { + while (true) + { + char next = Peek(); + + if (char.IsWhiteSpace(next)) + { + _ = Read(); + continue; + } + else if (next == '/') + { + SkipComment(); + continue; + } + + break; + } + } + + /// + /// Verifies that the given character matches the next character in the stream. + /// If the characters do not match, an exception will be thrown. + /// + /// The expected character. + public void Assert(char next) + { + var errorPosition = Position; + + if (Read() != next) + { + throw new JsonParseException( + string.Format(CultureInfo.InvariantCulture, "Parser expected '{0}'", next), + ParsingError.InvalidOrUnexpectedCharacter, + errorPosition); + } + } + + /// + /// Verifies that the given string matches the next characters in the stream. + /// If the strings do not match, an exception will be thrown. + /// + /// The expected string. + public void Assert(string next) + { + for (var i = 0; i < next.Length; i += 1) + { + Assert(next[i]); + } + } + + private void SkipComment() + { + // First character is the first slash + _ = Read(); + + switch (Peek()) + { + case '/': + SkipLineComment(); + return; + + case '*': + SkipBlockComment(); + return; + + default: + throw new JsonParseException( + string.Format(CultureInfo.InvariantCulture, "Parser expected '{0}'", Peek()), + ParsingError.InvalidOrUnexpectedCharacter, + Position); + } + } + + private void SkipLineComment() + { + // First character is the second '/' of the opening '//' + _ = Read(); + + while (true) + { + switch (_reader.Peek()) + { + case '\n': + // Reached the end of the line + _ = Read(); + return; + case -1: + return; + default: + _ = Read(); + break; + } + } + } + + private void SkipBlockComment() + { + // First character is the '*' of the opening '/*' + _ = Read(); + + bool foundStar = false; + + while (true) + { + switch (_reader.Peek()) + { + case '*': + _ = Read(); + foundStar = true; + break; + + case '/': + _ = Read(); + if (foundStar) + { + return; + } + + foundStar = false; + break; + + case -1: + return; + default: + _ = Read(); + foundStar = false; + break; + } + } + } +} diff --git a/src/Analyzers/Microsoft.Analyzers.Local/ApiLifecycle/Model/Assembly.cs b/src/Analyzers/Microsoft.Analyzers.Local/ApiLifecycle/Model/Assembly.cs index 5708689360d..94c45f1ad52 100644 --- a/src/Analyzers/Microsoft.Analyzers.Local/ApiLifecycle/Model/Assembly.cs +++ b/src/Analyzers/Microsoft.Analyzers.Local/ApiLifecycle/Model/Assembly.cs @@ -2,7 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. using System; -using System.Text.Json.Serialization; +using Microsoft.Extensions.LocalAnalyzers.Json; namespace Microsoft.Extensions.LocalAnalyzers.ApiLifecycle.Model; @@ -10,10 +10,20 @@ internal sealed class Assembly { public static readonly Assembly Empty = new(); - public string Name { get; set; } = string.Empty; + public string Name { get; } + public TypeDef[] Types { get; } - [JsonPropertyName("Types")] - public TypeDef[] Types { get; set; } = Array.Empty(); + public Assembly(JsonObject value) + { + Name = value[nameof(Name)].AsString ?? string.Empty; + Types = value.GetValueArray(nameof(Types)); + } + + private Assembly() + { + Name = string.Empty; + Types = Array.Empty(); + } public override string ToString() => Name; } diff --git a/src/Analyzers/Microsoft.Analyzers.Local/ApiLifecycle/Model/Field.cs b/src/Analyzers/Microsoft.Analyzers.Local/ApiLifecycle/Model/Field.cs index 7b90ebcd2a6..28297bea024 100644 --- a/src/Analyzers/Microsoft.Analyzers.Local/ApiLifecycle/Model/Field.cs +++ b/src/Analyzers/Microsoft.Analyzers.Local/ApiLifecycle/Model/Field.cs @@ -1,13 +1,26 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. +using System; +using Microsoft.Extensions.LocalAnalyzers.Json; + namespace Microsoft.Extensions.LocalAnalyzers.ApiLifecycle.Model; internal sealed class Field { - public Stage Stage { get; set; } = Stage.Experimental; + public Stage Stage { get; } + public string Member { get; } + + public Field(JsonObject value) + { + Member = value[nameof(Member)].AsString ?? string.Empty; + + var enumString = value[nameof(Stage)].AsString; + + _ = Enum.TryParse(enumString, out var stage); - public string Member { get; set; } = string.Empty; + Stage = stage; + } public override string ToString() => $"{Member}:{Stage}"; } diff --git a/src/Analyzers/Microsoft.Analyzers.Local/ApiLifecycle/Model/Method.cs b/src/Analyzers/Microsoft.Analyzers.Local/ApiLifecycle/Model/Method.cs index 7ccc87e08df..362ad0372cf 100644 --- a/src/Analyzers/Microsoft.Analyzers.Local/ApiLifecycle/Model/Method.cs +++ b/src/Analyzers/Microsoft.Analyzers.Local/ApiLifecycle/Model/Method.cs @@ -1,13 +1,31 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. +using System; +using Microsoft.Extensions.LocalAnalyzers.Json; + namespace Microsoft.Extensions.LocalAnalyzers.ApiLifecycle.Model; internal sealed class Method { - public Stage Stage { get; set; } = Stage.Experimental; + public Stage Stage { get; } + public string Member { get; } + + public Method(JsonObject value) + { + Member = value[nameof(Member)].AsString ?? string.Empty; + + var enumString = value[nameof(Stage)].AsString; - public string Member { get; set; } = string.Empty; + if (Enum.TryParse(enumString, out var stage)) + { + Stage = stage; + } + else + { + Stage = Stage.Experimental; + } + } public override string ToString() => $"{Member}:{Stage}"; } diff --git a/src/Analyzers/Microsoft.Analyzers.Local/ApiLifecycle/Model/Prop.cs b/src/Analyzers/Microsoft.Analyzers.Local/ApiLifecycle/Model/Prop.cs index a975817d1fe..4b14779dc24 100644 --- a/src/Analyzers/Microsoft.Analyzers.Local/ApiLifecycle/Model/Prop.cs +++ b/src/Analyzers/Microsoft.Analyzers.Local/ApiLifecycle/Model/Prop.cs @@ -1,13 +1,26 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. +using System; +using Microsoft.Extensions.LocalAnalyzers.Json; + namespace Microsoft.Extensions.LocalAnalyzers.ApiLifecycle.Model; internal sealed class Prop { - public Stage Stage { get; set; } = Stage.Experimental; + public Stage Stage { get; } + public string Member { get; } + + public Prop(JsonObject value) + { + Member = value[nameof(Member)].AsString ?? string.Empty; + + var stageString = value[nameof(Stage)].AsString; + + _ = Enum.TryParse(stageString, out var stage); - public string Member { get; set; } = string.Empty; + Stage = stage; + } public override string ToString() => $"{Member}:{Stage}"; } diff --git a/src/Analyzers/Microsoft.Analyzers.Local/ApiLifecycle/Model/TypeDef.cs b/src/Analyzers/Microsoft.Analyzers.Local/ApiLifecycle/Model/TypeDef.cs index c358c512dd4..d2fe20015b3 100644 --- a/src/Analyzers/Microsoft.Analyzers.Local/ApiLifecycle/Model/TypeDef.cs +++ b/src/Analyzers/Microsoft.Analyzers.Local/ApiLifecycle/Model/TypeDef.cs @@ -2,24 +2,32 @@ // The .NET Foundation licenses this file to you under the MIT license. using System; +using Microsoft.Extensions.LocalAnalyzers.Json; namespace Microsoft.Extensions.LocalAnalyzers.ApiLifecycle.Model; internal sealed class TypeDef { - public string ModifiersAndName { get; set; } = string.Empty; - - public string[] Constraints { get; set; } = Array.Empty(); - - public string[] BaseTypes { get; set; } = Array.Empty(); - - public Stage Stage { get; set; } = Stage.Experimental; - - public Method[] Methods { get; set; } = Array.Empty(); - - public Prop[] Properties { get; set; } = Array.Empty(); - - public Field[] Fields { get; set; } = Array.Empty(); + public string ModifiersAndName { get; } + public string[] Constraints { get; } + public string[] BaseTypes { get; } + public Stage Stage { get; } + public Method[] Methods { get; } + public Prop[] Properties { get; } + public Field[] Fields { get; } + + public TypeDef(JsonObject value) + { + ModifiersAndName = Utils.StripBaseAndConstraints(value["Type"].AsString ?? string.Empty); + Constraints = Utils.GetConstraints(value["Type"].AsString ?? string.Empty); + BaseTypes = Utils.GetBaseTypes(value["Type"].AsString ?? string.Empty); + _ = Enum.TryParse(value[nameof(Stage)].AsString, out var stage); + + Stage = stage; + Methods = value.GetValueArray(nameof(Methods)); + Properties = value.GetValueArray(nameof(Properties)); + Fields = value.GetValueArray(nameof(Fields)); + } public override string ToString() => $"{ModifiersAndName}:{Stage}"; } diff --git a/src/Analyzers/Microsoft.Analyzers.Local/ApiLifecycle/Model/TypeDefConverter.cs b/src/Analyzers/Microsoft.Analyzers.Local/ApiLifecycle/Model/TypeDefConverter.cs deleted file mode 100644 index dd6ca1695e5..00000000000 --- a/src/Analyzers/Microsoft.Analyzers.Local/ApiLifecycle/Model/TypeDefConverter.cs +++ /dev/null @@ -1,63 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -using System; -using System.Text.Json; -using System.Text.Json.Serialization; - -namespace Microsoft.Extensions.LocalAnalyzers.ApiLifecycle.Model; - -internal sealed class TypeDefConverter : JsonConverter -{ - public override TypeDef? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - var r = new TypeDef(); - var currDepth = reader.CurrentDepth; - - while (reader.Read()) - { - if (currDepth == reader.CurrentDepth && reader.TokenType == JsonTokenType.EndObject) - { - break; - } - - if (reader.TokenType == JsonTokenType.PropertyName) - { - if (reader.ValueTextEquals("Type")) - { - _ = reader.Read(); - var value = reader.GetString() ?? string.Empty; - - r.ModifiersAndName = Utils.StripBaseAndConstraints(value); - r.Constraints = Utils.GetConstraints(value); - r.BaseTypes = Utils.GetBaseTypes(value); - } - else if (reader.ValueTextEquals("Stage")) - { - _ = reader.Read(); - var value = reader.GetString() ?? string.Empty; - _ = Enum.TryParse(value, out var stage); - - r.Stage = stage; - - } - else if (reader.ValueTextEquals("Methods")) - { - r.Methods = JsonSerializer.Deserialize(ref reader, options) ?? Array.Empty(); - } - else if (reader.ValueTextEquals("Properties")) - { - r.Properties = JsonSerializer.Deserialize(ref reader, options) ?? Array.Empty(); - } - else if (reader.ValueTextEquals("Fields")) - { - r.Fields = JsonSerializer.Deserialize(ref reader, options) ?? Array.Empty(); - } - } - } - - return r; - } - - public override void Write(Utf8JsonWriter writer, TypeDef value, JsonSerializerOptions options) => throw new NotSupportedException("We don't need this functionality."); -} diff --git a/src/Analyzers/Microsoft.Analyzers.Local/ApiLifecycle/ModelLoader.cs b/src/Analyzers/Microsoft.Analyzers.Local/ApiLifecycle/ModelLoader.cs index 7fa82b60c68..68d25b04dc8 100644 --- a/src/Analyzers/Microsoft.Analyzers.Local/ApiLifecycle/ModelLoader.cs +++ b/src/Analyzers/Microsoft.Analyzers.Local/ApiLifecycle/ModelLoader.cs @@ -4,25 +4,15 @@ using System; using System.IO; using System.Linq; -using System.Text.Json; -using System.Text.Json.Serialization; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.Diagnostics; using Microsoft.Extensions.LocalAnalyzers.ApiLifecycle.Model; +using Microsoft.Extensions.LocalAnalyzers.Json; namespace Microsoft.Extensions.LocalAnalyzers.ApiLifecycle; internal static class ModelLoader { - private static JsonSerializerOptions _serializationOptions = new() - { - Converters = - { - new TypeDefConverter(), - new JsonStringEnumConverter() - } - }; - #pragma warning disable RS1012 // Start action has no registered actions internal static bool TryLoadAssemblyModel(CompilationStartAnalysisContext context, out Assembly? assembly) #pragma warning restore RS1012 // Start action has no registered actions @@ -71,9 +61,11 @@ internal static bool TryLoadAssemblyModel(CompilationStartAnalysisContext contex #pragma warning disable CA1031 // Do not catch general exception types try { - assembly = JsonSerializer.Deserialize(publicInterface!, _serializationOptions); + using var reader = new StringReader(publicInterface); + var value = JsonReader.Parse(reader); - if (assembly == null || !assembly.Name.Contains(assemblyName)) + assembly = new Assembly(value.AsJsonObject!); + if (!assembly.Name.Contains(assemblyName)) { return false; } diff --git a/src/Analyzers/Microsoft.Analyzers.Local/ApiLifecycle/Utils.cs b/src/Analyzers/Microsoft.Analyzers.Local/ApiLifecycle/Utils.cs index 7f7688ec82d..a92db86ee1f 100644 --- a/src/Analyzers/Microsoft.Analyzers.Local/ApiLifecycle/Utils.cs +++ b/src/Analyzers/Microsoft.Analyzers.Local/ApiLifecycle/Utils.cs @@ -3,7 +3,6 @@ using System; using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; using System.Linq; namespace Microsoft.Extensions.LocalAnalyzers.ApiLifecycle; @@ -13,7 +12,6 @@ internal static class Utils private static readonly char[] _colon = { ':' }; private static readonly char[] _comma = { ',' }; - [SuppressMessage("Major Code Smell", "S109:Magic numbers should not be used", Justification = "Would add more burden than context in this case.")] public static string[] GetConstraints(string typeSignature) { var whereClauseIndex = typeSignature.IndexOf(" where ", StringComparison.Ordinal); @@ -25,9 +23,11 @@ public static string[] GetConstraints(string typeSignature) var substrings = typeSignature.Split(_colon); +#pragma warning disable S109 // Magic numbers should not be used return substrings.Length == 2 ? substrings[1].Split(_comma).Select(x => x.Trim()).ToArray() : substrings[2].Split(_comma).Select(x => x.Trim()).ToArray(); +#pragma warning restore S109 // Magic numbers should not be used } public static string StripBaseAndConstraints(string typeSignature) diff --git a/src/Analyzers/Microsoft.Analyzers.Local/Microsoft.Analyzers.Local.csproj b/src/Analyzers/Microsoft.Analyzers.Local/Microsoft.Analyzers.Local.csproj index 505f2d036f4..4380ee70163 100644 --- a/src/Analyzers/Microsoft.Analyzers.Local/Microsoft.Analyzers.Local.csproj +++ b/src/Analyzers/Microsoft.Analyzers.Local/Microsoft.Analyzers.Local.csproj @@ -9,8 +9,6 @@ true cs - true - false @@ -30,10 +28,6 @@ - - - - diff --git a/src/Libraries/Microsoft.Extensions.Diagnostics.ExceptionSummarization/ExceptionSummarizer.cs b/src/Libraries/Microsoft.Extensions.Diagnostics.ExceptionSummarization/ExceptionSummarizer.cs index 65f9cf48f8d..4ef0ea261ff 100644 --- a/src/Libraries/Microsoft.Extensions.Diagnostics.ExceptionSummarization/ExceptionSummarizer.cs +++ b/src/Libraries/Microsoft.Extensions.Diagnostics.ExceptionSummarization/ExceptionSummarizer.cs @@ -31,9 +31,8 @@ public ExceptionSummarizer(IEnumerable providers) public ExceptionSummary Summarize(Exception exception) { _ = Throw.IfNull(exception); - var exceptionType = exception.GetType(); - var exceptionTypeName = exceptionType.Name; + var exceptionTypeName = exception.GetType().Name; // find a match for the exception type or a base type thereof var type = exceptionType; diff --git a/src/Libraries/Microsoft.Extensions.Diagnostics.Testing/README.md b/src/Libraries/Microsoft.Extensions.Diagnostics.Testing/README.md index 641a348f8f8..91c0a956535 100644 --- a/src/Libraries/Microsoft.Extensions.Diagnostics.Testing/README.md +++ b/src/Libraries/Microsoft.Extensions.Diagnostics.Testing/README.md @@ -1,6 +1,6 @@ # Microsoft.Extensions.Diagnostics.Testing -This library provides utilities for convenient testing of logging and metering functionality. +Hand-crafted fakes to make telemetry-related testing easier. ## Install the package @@ -18,85 +18,6 @@ Or directly in the C# project file: ``` -## Usage Example - -### Logs collection - -The `FakeLogger` is the implementation of the `Microsoft.Extensions.Logging.ILogger` that collects log messages -in a list of log records. It is designed to be used for validation that the functionality under -test emits the expected log messages: - -```csharp -[Fact] -public void TestMethod() -{ - var fakeLogger = new FakeLogger(); - - // Run the functionality that is supposed to write log messages - var classUnderTest = new TheClassUnderTest(fakeLogger); - classUnderTest.DoSomething(); - - var loggedRecords = fakeLogger.Collector.GetSnapshot(); - - // Assert that the expected messages were logged - Assert.Equal(2, loggedRecords.Count); - Assert.Equal("Something is executing", loggedRecords[0].Message); - Assert.Equal("Code completed successfully", loggedRecords[1].Message); -} -``` - -The `FakeLoggerServiceCollectionExtensions` and `FakeLoggerBuilderExtensions` types provide extension methods -for integrating the fake logging into the dependency injection container. -These extension methods register the `FakeLogCollector` - the in-memory holder of log messages -and the `FakeLoggerProvider` - the implementation of `Microsoft.Extensions.Logging.ILoggerProvider` that returns `FakeLogger` instances. - -The following example shows the usage of fake logging in combination with the dependency injection container in a unit test: - -```csharp -[Fact] -public void TestMethod() -{ - using var serviceProvider = new ServiceCollection() - .AddFakeLogging() - .AddSingleton() - .BuildServiceProvider(); - - // The "ILogger" is injected by DI as a constructor parameter to "TheClassUnderTest": - var classUnderTest = serviceProvider.GetRequiredService(); - - // Run the functionality that is supposed to write log messages - classUnderTest.DoSomething(); - - var logCollector = serviceProvider.GetFakeLogCollector(); - var loggedRecords = logCollector.GetSnapshot(); - - // Assert that the expected messages were logged - Assert.Equal(2, loggedRecords.Count); - Assert.Equal("Something is executing", loggedRecords[0].Message); - Assert.Equal("Code completed successfully", loggedRecords[1].Message); -} -``` - -### Metrics collection - -The `MetricCollector` is a utility class that can be used to test that metrics are published correctly by a metering instrument: - -```csharp -[Fact] -public void TestMethod() -{ - using var meter = new Meter("MyMeter"); - var counterInstrument = meter.CreateCounter("request.counter"); - using var collector = new MetricCollector(meter, "request.counter"); - - // Record some metric - counterInstrument.Add(3); - - // Assert that the metric was published - Assert.NotNull(collector.LastMeasurement); - Assert.Equal(3, collector.LastMeasurement.Value); -} -``` ## Feedback & Contributing diff --git a/src/Libraries/Microsoft.Extensions.Options.Contextual/README.md b/src/Libraries/Microsoft.Extensions.Options.Contextual/README.md index 7841d293065..3b64bd0c1a3 100644 --- a/src/Libraries/Microsoft.Extensions.Options.Contextual/README.md +++ b/src/Libraries/Microsoft.Extensions.Options.Contextual/README.md @@ -37,18 +37,18 @@ Define a context and a receiver that will be used as inputs to dynamically confi internal partial class WeatherForecastContext // Note class must be partial { public Guid UserId { get; set; } - public string? CountryOrRegion { get; set; } + public string? Country { get; set; } } -internal class CountryOrRegionContextReceiver : IOptionsContextReceiver +internal class CountryContextReceiver : IOptionsContextReceiver { - public string? CountryOrRegion { get; private set; } + public string? Country { get; private set; } public void Receive(string key, T value) { - if (key == nameof(CountryOrRegion)) + if (key == nameof(Country)) { - CountryOrRegion = value?.ToString(); + Country = value?.ToString(); } } } @@ -93,15 +93,15 @@ The options can be configured with both global options (ForecastDays), and optio using var host = FakeHost.CreateBuilder() .ConfigureServices(services => services .Configure(options => options.ForecastDays = 7) - .Configure(ConfigureTemperatureScaleBasedOnCountryOrRegion) + .Configure(ConfigureTemperatureScaleBasedOnCountry) .AddSingleton()) .Build(); -static void ConfigureTemperatureScaleBasedOnCountryOrRegion(IOptionsContext context, WeatherForecastOptions options) +static void ConfigureTemperatureScaleBasedOnCountry(IOptionsContext context, WeatherForecastOptions options) { - CountryOrRegionContextReceiver receiver = new(); + CountryContextReceiver receiver = new(); context.PopulateReceiver(receiver); - if (receiver.CountryOrRegion == "US") + if (receiver.Country == "US") { options.TemperatureScale = "Fahrenheit"; } @@ -113,8 +113,8 @@ And lastly, the service is called with some context. ```csharp var forecastService = host.Services.GetRequiredService(); -var usForcast = await forecastService.GetForecast(new WeatherForecastContext { CountryOrRegion = "US" }, CancellationToken.None); -var caForcast = await forecastService.GetForecast(new WeatherForecastContext { CountryOrRegion = "CA" }, CancellationToken.None); +var usForcast = await forecastService.GetForecast(new WeatherForecastContext { Country = "US" }, CancellationToken.None); +var caForcast = await forecastService.GetForecast(new WeatherForecastContext { Country = "CA" }, CancellationToken.None); ``` ## Feedback & Contributing diff --git a/src/Libraries/Microsoft.Extensions.Telemetry.Abstractions/Enrichment/ILogEnricher.cs b/src/Libraries/Microsoft.Extensions.Telemetry.Abstractions/Enrichment/ILogEnricher.cs index 6f5dd004964..8961b8c5e37 100644 --- a/src/Libraries/Microsoft.Extensions.Telemetry.Abstractions/Enrichment/ILogEnricher.cs +++ b/src/Libraries/Microsoft.Extensions.Telemetry.Abstractions/Enrichment/ILogEnricher.cs @@ -4,7 +4,7 @@ namespace Microsoft.Extensions.Diagnostics.Enrichment; /// -/// Represents a component that augments log records with additional properties. +/// Augments log records with additional properties. /// public interface ILogEnricher { diff --git a/src/Libraries/Microsoft.Extensions.Telemetry.Abstractions/Enrichment/IStaticLogEnricher.cs b/src/Libraries/Microsoft.Extensions.Telemetry.Abstractions/Enrichment/IStaticLogEnricher.cs index af10bc2e92a..2be48d59e25 100644 --- a/src/Libraries/Microsoft.Extensions.Telemetry.Abstractions/Enrichment/IStaticLogEnricher.cs +++ b/src/Libraries/Microsoft.Extensions.Telemetry.Abstractions/Enrichment/IStaticLogEnricher.cs @@ -4,13 +4,13 @@ namespace Microsoft.Extensions.Diagnostics.Enrichment; /// -/// Represents a component that augments log records with additional properties that are unchanging over the life of the object. +/// A component that augments log records with additional properties which are unchanging over the life of the object. /// public interface IStaticLogEnricher { /// - /// Collects tags for a log record. + /// Called to collect tags for a log record. /// - /// Where the enricher puts the tags it produces. + /// Where the enricher puts the tags it is producing. void Enrich(IEnrichmentTagCollector collector); } diff --git a/src/Libraries/Microsoft.Extensions.Telemetry.Abstractions/Logging/ITagCollector.cs b/src/Libraries/Microsoft.Extensions.Telemetry.Abstractions/Logging/ITagCollector.cs index 366ca392bb3..89874a6388f 100644 --- a/src/Libraries/Microsoft.Extensions.Telemetry.Abstractions/Logging/ITagCollector.cs +++ b/src/Libraries/Microsoft.Extensions.Telemetry.Abstractions/Logging/ITagCollector.cs @@ -7,7 +7,7 @@ namespace Microsoft.Extensions.Logging; /// -/// Represents a custom tag provider and enables it to emit tags. +/// Interface given to custom tag providers, enabling them to emit tags. /// /// /// See for details on how this interface is used. @@ -21,7 +21,7 @@ public interface ITagCollector /// The value of the tag to add. /// is . /// is empty or contains exclusively whitespace, - /// or a tag of the same name has already been added. + /// or when a tag of the same name has already been added. /// void Add(string tagName, object? tagValue); @@ -33,7 +33,7 @@ public interface ITagCollector /// The data classifications of the tag value. /// is . /// is empty or contains exclusively whitespace, - /// or a tag of the same name has already been added. + /// or when a tag of the same name has already been added. /// void Add(string tagName, object? tagValue, DataClassificationSet classifications); } diff --git a/src/Libraries/Microsoft.Extensions.Telemetry.Abstractions/Logging/LoggerMessageState.cs b/src/Libraries/Microsoft.Extensions.Telemetry.Abstractions/Logging/LoggerMessageState.cs index f9a5e613382..6cc10f20086 100644 --- a/src/Libraries/Microsoft.Extensions.Telemetry.Abstractions/Logging/LoggerMessageState.cs +++ b/src/Libraries/Microsoft.Extensions.Telemetry.Abstractions/Logging/LoggerMessageState.cs @@ -27,7 +27,7 @@ public sealed partial class LoggerMessageState public KeyValuePair[] TagArray => _tags; /// - /// Gets the array of redacted tags. + /// Gets the array of tags. /// public KeyValuePair[] RedactedTagArray => _redactedTags; @@ -57,7 +57,7 @@ public int ReserveTagSpace(int count) } /// - /// Allocates some room to put some classified tags. + /// Allocates some room to put some tags. /// /// The amount of space to allocate. /// The index in the where to store the classified tags. @@ -113,12 +113,12 @@ public void Clear() } /// - /// Gets the number of unclassified tags currently in this instance. + /// Gets a value indicating the number of unclassified tags currently in this instance. /// public int TagsCount { get; private set; } /// - /// Gets the number of classified tags currently in this instance. + /// Gets a value indicating the number of classified tags currently in this instance. /// public int ClassifiedTagsCount { get; private set; } diff --git a/src/Libraries/Microsoft.Extensions.Telemetry.Abstractions/Metrics/HistogramAttribute.cs b/src/Libraries/Microsoft.Extensions.Telemetry.Abstractions/Metrics/HistogramAttribute.cs index c0a23cefcc9..b7e4473a221 100644 --- a/src/Libraries/Microsoft.Extensions.Telemetry.Abstractions/Metrics/HistogramAttribute.cs +++ b/src/Libraries/Microsoft.Extensions.Telemetry.Abstractions/Metrics/HistogramAttribute.cs @@ -7,10 +7,10 @@ namespace Microsoft.Extensions.Diagnostics.Metrics; /// -/// Provides information to guide the production of a strongly typed histogram metric factory method and associated type. +/// Provides information to guide the production of a strongly-typed histogram metric factory method and associated type. /// /// -/// This attribute is applied to a method that has the following constraints: +/// This attribute is applied to a method which has the following constraints: /// /// Must be a partial method. /// Must return metricName as the type. A class with that name will be generated. @@ -35,7 +35,7 @@ public sealed class HistogramAttribute : Attribute /// /// Initializes a new instance of the class. /// - /// A variable array of tag names. + /// variable array of tag names. public HistogramAttribute(params string[] tagNames) { TagNames = tagNames; @@ -63,7 +63,7 @@ public HistogramAttribute(Type type) /// /// /// - /// In this example, the metric name is SampleMetric. When Name is not provided, + /// In this example the metric name is SampleMetric. When Name is not provided /// the return type of the method is used as metric name. In this example, this would /// be RequestLatency if Name wasn't provided. /// diff --git a/src/Libraries/Microsoft.Extensions.Telemetry.Abstractions/Metrics/HistogramAttributeT.cs b/src/Libraries/Microsoft.Extensions.Telemetry.Abstractions/Metrics/HistogramAttributeT.cs index b1938a47192..68a1b3cc04c 100644 --- a/src/Libraries/Microsoft.Extensions.Telemetry.Abstractions/Metrics/HistogramAttributeT.cs +++ b/src/Libraries/Microsoft.Extensions.Telemetry.Abstractions/Metrics/HistogramAttributeT.cs @@ -9,14 +9,14 @@ namespace Microsoft.Extensions.Diagnostics.Metrics; #pragma warning disable SA1649 // File name should match first type name /// -/// Provides information to guide the production of a strongly typed histogram metric factory method and associated type. +/// Provides information to guide the production of a strongly-typed histogram metric factory method and associated type. /// /// /// The type of value the histogram will hold, which is limited to , , , , /// , , or . /// /// -/// This attribute is applied to a method that has the following constraints: +/// This attribute is applied to a method which has the following constraints: /// /// Must be a partial method. /// Must return metricName as the type. A class with that name will be generated. @@ -42,7 +42,7 @@ public sealed class HistogramAttribute : Attribute /// /// Initializes a new instance of the class. /// - /// A variable array of tag names. + /// variable array of tag names. public HistogramAttribute(params string[] tagNames) { TagNames = tagNames; @@ -72,8 +72,8 @@ public HistogramAttribute(Type type) /// /// /// - /// In this example, the metric name is SampleMetric. When Name is not provided, - /// the return type of the method is used as the metric name. In this example, this would + /// In this example the metric name is SampleMetric. When Name is not provided + /// the return type of the method is used as metric name. In this example, this would /// be RequestLatency if Name wasn't provided. /// public string? Name { get; set; } diff --git a/src/Libraries/Microsoft.Extensions.Telemetry/Logging/LoggerEnrichmentOptions.cs b/src/Libraries/Microsoft.Extensions.Telemetry/Logging/LoggerEnrichmentOptions.cs index c660bbcbdf8..59aba9ac803 100644 --- a/src/Libraries/Microsoft.Extensions.Telemetry/Logging/LoggerEnrichmentOptions.cs +++ b/src/Libraries/Microsoft.Extensions.Telemetry/Logging/LoggerEnrichmentOptions.cs @@ -31,9 +31,6 @@ public class LoggerEnrichmentOptions /// /// Gets or sets a value indicating whether to consult debugging files (PDB files) when producing stack traces. /// - /// - /// The default value is . - /// /// /// Reading available debugging files produces richer stack traces, but can cost a substantial amount of time /// to generate. As a result, this option should only be turned on in development scenarios, not for production use. diff --git a/src/Libraries/Microsoft.Extensions.Telemetry/Logging/LoggingEnrichmentExtensions.cs b/src/Libraries/Microsoft.Extensions.Telemetry/Logging/LoggingEnrichmentExtensions.cs index 795127376b9..1d4262b454e 100644 --- a/src/Libraries/Microsoft.Extensions.Telemetry/Logging/LoggingEnrichmentExtensions.cs +++ b/src/Libraries/Microsoft.Extensions.Telemetry/Logging/LoggingEnrichmentExtensions.cs @@ -27,7 +27,7 @@ public static ILoggingBuilder EnableEnrichment(this ILoggingBuilder builder) /// Enables enrichment functionality within the logging infrastructure. /// /// The dependency injection container to add logging to. - /// Delegate to fine-tune the options. + /// Delegate the fine-tune the options. /// The value of . public static ILoggingBuilder EnableEnrichment(this ILoggingBuilder builder, Action configure) { diff --git a/src/Libraries/Microsoft.Extensions.Telemetry/Microsoft.Extensions.Telemetry.json b/src/Libraries/Microsoft.Extensions.Telemetry/Microsoft.Extensions.Telemetry.json index e115f2d66a7..89b08ce9676 100644 --- a/src/Libraries/Microsoft.Extensions.Telemetry/Microsoft.Extensions.Telemetry.json +++ b/src/Libraries/Microsoft.Extensions.Telemetry/Microsoft.Extensions.Telemetry.json @@ -296,4 +296,4 @@ ] } ] -} +} \ No newline at end of file diff --git a/src/Libraries/Microsoft.Extensions.TimeProvider.Testing/FakeTimeProvider.cs b/src/Libraries/Microsoft.Extensions.TimeProvider.Testing/FakeTimeProvider.cs index 6aedeb0c3f4..c408348842e 100644 --- a/src/Libraries/Microsoft.Extensions.TimeProvider.Testing/FakeTimeProvider.cs +++ b/src/Libraries/Microsoft.Extensions.TimeProvider.Testing/FakeTimeProvider.cs @@ -59,7 +59,7 @@ public FakeTimeProvider(DateTimeOffset startDateTime) /// /// This defaults to . /// - /// The time value is set to less than . + /// if the time value is set to less than . public TimeSpan AutoAdvanceAmount { get => _autoAdvanceAmount; @@ -89,7 +89,7 @@ public override DateTimeOffset GetUtcNow() /// Sets the date and time in the UTC time zone. /// /// The date and time in the UTC time zone. - /// The supplied time value is before the current time. + /// if the supplied time value is before the curent time. public void SetUtcNow(DateTimeOffset value) { lock (Waiters) @@ -115,7 +115,7 @@ public void SetUtcNow(DateTimeOffset value) /// marches forward automatically in hardware, for the fake time provider the application is responsible for /// doing this explicitly by calling this method. /// - /// The time value is less than . + /// if the time value is less than . public void Advance(TimeSpan delta) { _ = Throw.IfLessThan(delta.Ticks, 0); diff --git a/src/Shared/Pools/PooledListPolicy.cs b/src/Shared/Pools/PooledListPolicy.cs index 4525bd54a6f..b74469a0abe 100644 --- a/src/Shared/Pools/PooledListPolicy.cs +++ b/src/Shared/Pools/PooledListPolicy.cs @@ -4,6 +4,7 @@ using System.Collections.Generic; using Microsoft.Extensions.ObjectPool; +#pragma warning disable CA1716 namespace Microsoft.Shared.Pools; /// @@ -18,7 +19,7 @@ private PooledListPolicy() { } - public override List Create() => []; + public override List Create() => new(); public override bool Return(List obj) { diff --git a/test/Analyzers/Microsoft.Analyzers.Extra.Tests/CallAnalysis/ArraysTests.cs b/test/Analyzers/Microsoft.Analyzers.Extra.Tests/CallAnalysis/ArraysTests.cs index 5aa6e3fdeca..9e3afab7b6d 100644 --- a/test/Analyzers/Microsoft.Analyzers.Extra.Tests/CallAnalysis/ArraysTests.cs +++ b/test/Analyzers/Microsoft.Analyzers.Extra.Tests/CallAnalysis/ArraysTests.cs @@ -122,7 +122,7 @@ public void Triggers() Assembly.GetAssembly(typeof(ImmutableDictionary<,>))!, Assembly.GetAssembly(typeof(FrozenDictionary<,>))!, }, - new[] { Source }); + new[] { Source }).ConfigureAwait(false); Assert.Equal(54, d.Count); for (int i = 0; i < d.Count; i++) diff --git a/test/Analyzers/Microsoft.Analyzers.Extra.Tests/CallAnalysis/LegacyCollectionTests.cs b/test/Analyzers/Microsoft.Analyzers.Extra.Tests/CallAnalysis/LegacyCollectionTests.cs index 14f33e3773f..f1922509671 100644 --- a/test/Analyzers/Microsoft.Analyzers.Extra.Tests/CallAnalysis/LegacyCollectionTests.cs +++ b/test/Analyzers/Microsoft.Analyzers.Extra.Tests/CallAnalysis/LegacyCollectionTests.cs @@ -44,7 +44,7 @@ public void Foo() Assembly.GetAssembly(typeof(System.Collections.Queue))!, Assembly.GetAssembly(typeof(System.Collections.Specialized.HybridDictionary))! }, - new[] { Source }); + new[] { Source }).ConfigureAwait(false); Assert.Equal(8, d.Count); for (int i = 0; i < d.Count; i++) diff --git a/test/Analyzers/Microsoft.Analyzers.Extra.Tests/CallAnalysis/LegacyLoggingTests.Extra.cs b/test/Analyzers/Microsoft.Analyzers.Extra.Tests/CallAnalysis/LegacyLoggingTests.Extra.cs index e638f0fb5c8..2b76844d56b 100644 --- a/test/Analyzers/Microsoft.Analyzers.Extra.Tests/CallAnalysis/LegacyLoggingTests.Extra.cs +++ b/test/Analyzers/Microsoft.Analyzers.Extra.Tests/CallAnalysis/LegacyLoggingTests.Extra.cs @@ -92,7 +92,7 @@ static partial class Log new CallAnalyzer(), new LegacyLoggingFixer(), new[] { Assembly.GetAssembly(typeof(ILogger))!, Assembly.GetAssembly(typeof(LoggerMessageAttribute))! }, - new[] { OriginalSource, OriginalTarget }); + new[] { OriginalSource, OriginalTarget }).ConfigureAwait(false); var actualSource = l[0]; var actualTarget = l[1]; @@ -170,7 +170,7 @@ static partial class Log new CallAnalyzer(), new LegacyLoggingFixer(), new[] { Assembly.GetAssembly(typeof(ILogger))! }, - new[] { OriginalSource, OriginalTarget }); + new[] { OriginalSource, OriginalTarget }).ConfigureAwait(false); actualSource = l[0]; actualTarget = l[1]; @@ -234,7 +234,7 @@ static partial class Log new LegacyLoggingFixer(), new[] { Assembly.GetAssembly(typeof(ILogger))!, Assembly.GetAssembly(typeof(LoggerMessageAttribute))! }, new[] { OriginalSource }, - extraFile: "Log.cs"); + extraFile: "Log.cs").ConfigureAwait(false); var actualSource = l[0]; var actualTarget = l[1]; @@ -297,7 +297,7 @@ static partial class Log new LegacyLoggingFixer(), new[] { Assembly.GetAssembly(typeof(ILogger))!, Assembly.GetAssembly(typeof(LoggerMessageAttribute))! }, new[] { OriginalSource }, - extraFile: "Log.cs"); + extraFile: "Log.cs").ConfigureAwait(false); var actualSource = l[0]; var actualTarget = l[1]; @@ -358,7 +358,7 @@ static partial class Log new LegacyLoggingFixer(), new[] { Assembly.GetAssembly(typeof(ILogger))!, Assembly.GetAssembly(typeof(LoggerMessageAttribute))! }, new[] { OriginalSource }, - extraFile: "Log.cs"); + extraFile: "Log.cs").ConfigureAwait(false); var actualSource = l[0]; var actualTarget = l[1]; @@ -434,7 +434,7 @@ static partial class Log new LegacyLoggingFixer(), new[] { Assembly.GetAssembly(typeof(ILogger))!, Assembly.GetAssembly(typeof(LoggerMessageAttribute))! }, new[] { OriginalSource }, - extraFile: "Log.cs"); + extraFile: "Log.cs").ConfigureAwait(false); var actualSource = l[0]; var actualTarget = l[1]; @@ -684,7 +684,7 @@ static partial class Log new CallAnalyzer(), new LegacyLoggingFixer(), new[] { Assembly.GetAssembly(typeof(ILogger))!, Assembly.GetAssembly(typeof(LoggerMessageAttribute))! }, - new[] { OrriginalSource, OrriginalTarget }); + new[] { OrriginalSource, OrriginalTarget }).ConfigureAwait(false); var actualSource = l[0]; var actualTarget = l[1]; @@ -746,7 +746,7 @@ static partial class Log new CallAnalyzer(), new LegacyLoggingFixer(), new[] { Assembly.GetAssembly(typeof(ILogger))!, Assembly.GetAssembly(typeof(LoggerMessageAttribute))! }, - new[] { OrriginalSource, OrriginalTarget }); + new[] { OrriginalSource, OrriginalTarget }).ConfigureAwait(false); var actualSource = l[0]; var actualTarget = l[1]; diff --git a/test/Analyzers/Microsoft.Analyzers.Extra.Tests/CallAnalysis/LegacyLoggingTests.cs b/test/Analyzers/Microsoft.Analyzers.Extra.Tests/CallAnalysis/LegacyLoggingTests.cs index d74f279aef6..afe68ce5685 100644 --- a/test/Analyzers/Microsoft.Analyzers.Extra.Tests/CallAnalysis/LegacyLoggingTests.cs +++ b/test/Analyzers/Microsoft.Analyzers.Extra.Tests/CallAnalysis/LegacyLoggingTests.cs @@ -73,7 +73,7 @@ public static partial class Log new LegacyLoggingFixer(), new[] { Assembly.GetAssembly(typeof(ILogger))!, Assembly.GetAssembly(typeof(LoggerMessageAttribute))! }, new[] { OriginalSource, OriginalTarget }, - defaultNamespace: "Example"); + defaultNamespace: "Example").ConfigureAwait(false); var actualSource = l[0]; var actualTarget = l[1]; @@ -166,7 +166,7 @@ public static partial class Log new LegacyLoggingFixer(), new[] { Assembly.GetAssembly(typeof(ILogger))!, Assembly.GetAssembly(typeof(LoggerMessageAttribute))! }, new[] { OriginalSource, OriginalTarget }, - defaultNamespace: "Example"); + defaultNamespace: "Example").ConfigureAwait(false); var actualSource = l[0]; var actualTarget = l[1]; @@ -230,7 +230,7 @@ static partial class Log new[] { Assembly.GetAssembly(typeof(ILogger))!, Assembly.GetAssembly(typeof(LoggerMessageAttribute))! }, new[] { OriginalSource }, extraFile: "Log.cs", - defaultNamespace: "Example"); + defaultNamespace: "Example").ConfigureAwait(false); var actualSource = l[0]; var actualTarget = l[1]; @@ -290,7 +290,7 @@ public static partial class Log new LegacyLoggingFixer(), new[] { Assembly.GetAssembly(typeof(ILogger))!, Assembly.GetAssembly(typeof(LoggerMessageAttribute))! }, new[] { OriginalSource, OriginalTarget }, - defaultNamespace: "Example"); + defaultNamespace: "Example").ConfigureAwait(false); var actualSource = l[0]; var actualTarget = l[1]; @@ -364,7 +364,7 @@ static partial class Log new LegacyLoggingFixer(), new[] { Assembly.GetAssembly(typeof(ILogger))!, Assembly.GetAssembly(typeof(LoggerMessageAttribute))! }, new[] { OriginalSource, OriginalTarget }, - defaultNamespace: "Example.Example2"); + defaultNamespace: "Example.Example2").ConfigureAwait(false); var actualSource = l[0]; var actualTarget = l[1]; @@ -441,7 +441,7 @@ static partial class Log new[] { Assembly.GetAssembly(typeof(ILogger))!, Assembly.GetAssembly(typeof(LoggerMessageAttribute))! }, new[] { OriginalSource, OriginalTarget }, extraFile: "Log.cs", - defaultNamespace: "Example.Example2"); + defaultNamespace: "Example.Example2").ConfigureAwait(false); var actualSource = l[0]; var actualTarget = l[2]; @@ -523,7 +523,7 @@ public static partial class Log new LegacyLoggingFixer(), new[] { Assembly.GetAssembly(typeof(ILogger))!, Assembly.GetAssembly(typeof(LoggerMessageAttribute))! }, new[] { OriginalSource, OriginalTarget }, - defaultNamespace: "Example"); + defaultNamespace: "Example").ConfigureAwait(false); var actualSource = l[0]; var actualTarget = l[1]; @@ -611,7 +611,7 @@ public static partial class Log new LegacyLoggingFixer(), new[] { Assembly.GetAssembly(typeof(ILogger))!, Assembly.GetAssembly(typeof(LoggerMessageAttribute))! }, new[] { OriginalSource, OriginalTarget }, - defaultNamespace: "Example"); + defaultNamespace: "Example").ConfigureAwait(false); var actualSource = l[0]; var actualTarget = l[1]; @@ -683,7 +683,7 @@ static partial class Log new[] { OriginalSource, OriginalTarget }, sourceNames: new[] { "primary.cs", "Log.cs" }, extraFile: "Log2.cs", - defaultNamespace: "Example"); + defaultNamespace: "Example").ConfigureAwait(false); var actualSource = l[0]; var actualTarget = l[2]; @@ -754,7 +754,7 @@ public static partial class Log }, new[] { Assembly.GetAssembly(typeof(ILogger))!, Assembly.GetAssembly(typeof(LoggerMessageAttribute))! }, new[] { OriginalSource, OriginalTarget }, - defaultNamespace: "Example"); + defaultNamespace: "Example").ConfigureAwait(false); var actualSource = l[0]; var actualTarget = l[1]; @@ -819,7 +819,7 @@ public static void TestMethod(ILogger logger) proj.CommitChanges(); var targetDoc = proj.FindDocument("target.cs"); - var targetRoot = await targetDoc.GetSyntaxRootAsync(CancellationToken.None); + var targetRoot = await targetDoc.GetSyntaxRootAsync(CancellationToken.None).ConfigureAwait(false); var targetClass = targetRoot!.FindNode(RoslynTestUtils.MakeTextSpan(TargetSourceCode, 0)) as ClassDeclarationSyntax; var invocationDoc = proj.FindDocument("invocation.cs"); @@ -828,7 +828,7 @@ public static void TestMethod(ILogger logger) var (invocationExpression, details) = await f.CheckIfCanFixAsync( invocationDoc, InvocationSourceCode.MakeTextSpan(0), - CancellationToken.None); + CancellationToken.None).ConfigureAwait(false); Assert.NotNull(invocationExpression); Assert.NotNull(details); @@ -839,7 +839,7 @@ public static void TestMethod(ILogger logger) invocationDoc, invocationExpression!, details!, - CancellationToken.None); + CancellationToken.None).ConfigureAwait(false); Assert.Equal("TestA", methodName); Assert.False(existing); @@ -852,7 +852,7 @@ public static void TestMethod(ILogger logger) (invocationExpression, details) = await f.CheckIfCanFixAsync( invocationDoc, RoslynTestUtils.MakeTextSpan(InvocationSourceCode, 0), - CancellationToken.None); + CancellationToken.None).ConfigureAwait(false); Assert.Null(invocationExpression); Assert.Null(details); @@ -865,7 +865,7 @@ public static void TestMethod(ILogger logger) (invocationExpression, details) = await f.CheckIfCanFixAsync( invocationDoc, RoslynTestUtils.MakeTextSpan(InvocationSourceCode, 0), - CancellationToken.None); + CancellationToken.None).ConfigureAwait(false); Assert.Null(invocationExpression); Assert.Null(details); @@ -878,7 +878,7 @@ public static void TestMethod(ILogger logger) (invocationExpression, details) = await f.CheckIfCanFixAsync( invocationDoc, RoslynTestUtils.MakeTextSpan(InvocationSourceCode, 0), - CancellationToken.None); + CancellationToken.None).ConfigureAwait(false); Assert.Null(invocationExpression); Assert.Null(details); @@ -891,7 +891,7 @@ public static void TestMethod(ILogger logger) (invocationExpression, details) = await f.CheckIfCanFixAsync( invocationDoc, RoslynTestUtils.MakeTextSpan(InvocationSourceCode, 0), - CancellationToken.None); + CancellationToken.None).ConfigureAwait(false); Assert.NotNull(invocationExpression); Assert.NotNull(details); @@ -902,7 +902,7 @@ public static void TestMethod(ILogger logger) invocationDoc, invocationExpression!, details!, - CancellationToken.None); + CancellationToken.None).ConfigureAwait(false); Assert.Equal("TestA", methodName); Assert.False(existing); @@ -915,7 +915,7 @@ public static void TestMethod(ILogger logger) (invocationExpression, details) = await f.CheckIfCanFixAsync( invocationDoc, RoslynTestUtils.MakeTextSpan(InvocationSourceCode, 0), - CancellationToken.None); + CancellationToken.None).ConfigureAwait(false); Assert.Null(invocationExpression); Assert.Null(details); @@ -928,7 +928,7 @@ public static void TestMethod(ILogger logger) (invocationExpression, details) = await f.CheckIfCanFixAsync( invocationDoc, RoslynTestUtils.MakeTextSpan(InvocationSourceCode, 0), - CancellationToken.None); + CancellationToken.None).ConfigureAwait(false); Assert.NotNull(invocationExpression); Assert.NotNull(details); @@ -939,7 +939,7 @@ public static void TestMethod(ILogger logger) invocationDoc, invocationExpression!, details!, - CancellationToken.None); + CancellationToken.None).ConfigureAwait(false); Assert.Equal("TestA", methodName); Assert.False(existing); diff --git a/test/Analyzers/Microsoft.Analyzers.Extra.Tests/CallAnalysis/SplitTests.cs b/test/Analyzers/Microsoft.Analyzers.Extra.Tests/CallAnalysis/SplitTests.cs index 4572a27a905..cad16f25dea 100644 --- a/test/Analyzers/Microsoft.Analyzers.Extra.Tests/CallAnalysis/SplitTests.cs +++ b/test/Analyzers/Microsoft.Analyzers.Extra.Tests/CallAnalysis/SplitTests.cs @@ -29,11 +29,9 @@ public static void TestMethod() var d = await RoslynTestUtils.RunAnalyzer( new CallAnalyzer(), null, - new[] { Source }); + new[] { Source }).ConfigureAwait(false); -#pragma warning disable xUnit2013 // Do not use equality check to check for collection size. Assert.Equal(1, d.Count); -#pragma warning restore xUnit2013 // Do not use equality check to check for collection size. for (int i = 0; i < d.Count; i++) { Source.AssertDiagnostic(i, DiagDescriptors.Split, d[i]); diff --git a/test/Analyzers/Microsoft.Analyzers.Extra.Tests/CallAnalysis/StartsEndsWithTests.cs b/test/Analyzers/Microsoft.Analyzers.Extra.Tests/CallAnalysis/StartsEndsWithTests.cs index c026aa6be8a..e46a7cb6f7b 100644 --- a/test/Analyzers/Microsoft.Analyzers.Extra.Tests/CallAnalysis/StartsEndsWithTests.cs +++ b/test/Analyzers/Microsoft.Analyzers.Extra.Tests/CallAnalysis/StartsEndsWithTests.cs @@ -56,7 +56,7 @@ public static void DontFlagMe() var d = await RoslynTestUtils.RunAnalyzer( new CallAnalyzer(), null, - new[] { Source }); + new[] { Source }).ConfigureAwait(false); Assert.Equal(8, d.Count); @@ -114,7 +114,7 @@ public static void DontFlagMe() var d = await RoslynTestUtils.RunAnalyzer( new CallAnalyzer(), null, - new[] { Source }); + new[] { Source }).ConfigureAwait(false); Assert.Equal(8, d.Count); diff --git a/test/Analyzers/Microsoft.Analyzers.Extra.Tests/CallAnalysis/StaticTimeTests.cs b/test/Analyzers/Microsoft.Analyzers.Extra.Tests/CallAnalysis/StaticTimeTests.cs index bd8c77f9295..807e097aedc 100644 --- a/test/Analyzers/Microsoft.Analyzers.Extra.Tests/CallAnalysis/StaticTimeTests.cs +++ b/test/Analyzers/Microsoft.Analyzers.Extra.Tests/CallAnalysis/StaticTimeTests.cs @@ -77,7 +77,7 @@ private DateTimeOffset GetTimeOffset(bool condition) var d = await RoslynTestUtils.RunAnalyzer( new CallAnalyzer(), _staticTimeReferences, - new[] { Source }); + new[] { Source }).ConfigureAwait(false); Assert.Equal(17, d.Count); for (int i = 0; i < d.Count; i++) diff --git a/test/Analyzers/Microsoft.Analyzers.Extra.Tests/CallAnalysis/ValueTupleTests.cs b/test/Analyzers/Microsoft.Analyzers.Extra.Tests/CallAnalysis/ValueTupleTests.cs index cf4f7782d1b..2e76eb83d03 100644 --- a/test/Analyzers/Microsoft.Analyzers.Extra.Tests/CallAnalysis/ValueTupleTests.cs +++ b/test/Analyzers/Microsoft.Analyzers.Extra.Tests/CallAnalysis/ValueTupleTests.cs @@ -46,7 +46,7 @@ public void Foo() var d = await RoslynTestUtils.RunAnalyzer( new CallAnalyzer(), null, - new[] { Source }); + new[] { Source }).ConfigureAwait(false); Assert.Equal(16, d.Count); for (int i = 0; i < d.Count; i++) diff --git a/test/Analyzers/Microsoft.Analyzers.Extra.Tests/CoalesceAnalyzerTests.cs b/test/Analyzers/Microsoft.Analyzers.Extra.Tests/CoalesceAnalyzerTests.cs index f4c7a51b6c9..debc2a7272a 100644 --- a/test/Analyzers/Microsoft.Analyzers.Extra.Tests/CoalesceAnalyzerTests.cs +++ b/test/Analyzers/Microsoft.Analyzers.Extra.Tests/CoalesceAnalyzerTests.cs @@ -37,11 +37,9 @@ public class Test var d = await RoslynTestUtils.RunAnalyzer( new CoalesceAnalyzer(), null, - new[] { Source }); + new[] { Source }).ConfigureAwait(false); -#pragma warning disable xUnit2013 // Do not use equality check to check for collection size. Assert.Equal(0, d.Count); -#pragma warning restore xUnit2013 // Do not use equality check to check for collection size. } [Fact] @@ -94,7 +92,7 @@ public void Method() var d = await RoslynTestUtils.RunAnalyzer( new CoalesceAnalyzer(), null, - new[] { Source }); + new[] { Source }).ConfigureAwait(false); Assert.Equal(4, d.Count); for (int i = 0; i < d.Count; i++) @@ -162,7 +160,7 @@ public void Method() var d = await RoslynTestUtils.RunAnalyzer( new CoalesceAnalyzer(), null, - new[] { Source }); + new[] { Source }).ConfigureAwait(false); Assert.Equal(5, d.Count); for (int i = 0; i < d.Count; i++) diff --git a/test/Analyzers/Microsoft.Analyzers.Extra.Tests/ConditionalAccessAnalyzerTests.cs b/test/Analyzers/Microsoft.Analyzers.Extra.Tests/ConditionalAccessAnalyzerTests.cs index d561e32c4a2..bb27a76eb2f 100644 --- a/test/Analyzers/Microsoft.Analyzers.Extra.Tests/ConditionalAccessAnalyzerTests.cs +++ b/test/Analyzers/Microsoft.Analyzers.Extra.Tests/ConditionalAccessAnalyzerTests.cs @@ -104,7 +104,7 @@ public Arg(TParameter arg1) var d = await RoslynTestUtils.RunAnalyzer( new ConditionalAccessAnalyzer(), null, - new[] { Source }); + new[] { Source }).ConfigureAwait(false); #if NET6_0_OR_GREATER Assert.Equal(8, d.Count); diff --git a/test/Analyzers/Microsoft.Analyzers.Extra.Tests/MakeExeTypesInternalTests.cs b/test/Analyzers/Microsoft.Analyzers.Extra.Tests/MakeExeTypesInternalTests.cs index 827f6f90704..204d3e83e69 100644 --- a/test/Analyzers/Microsoft.Analyzers.Extra.Tests/MakeExeTypesInternalTests.cs +++ b/test/Analyzers/Microsoft.Analyzers.Extra.Tests/MakeExeTypesInternalTests.cs @@ -70,7 +70,7 @@ internal class Test4 new MakeExeTypesInternalFixer(), null, new[] { Source }, - asExecutable: true); + asExecutable: true).ConfigureAwait(false); Assert.Equal(ExpectedFixedSource.Replace("\r\n", "\n", StringComparison.Ordinal), actualFixedSources[0]); } @@ -156,11 +156,9 @@ public class Test6 new MakeExeTypesInternalAnalyzer(), null, new[] { Source }, - asExecutable: true); + asExecutable: true).ConfigureAwait(false); -#pragma warning disable xUnit2013 // Do not use equality check to check for collection size. Assert.Equal(1, d.Count); -#pragma warning restore xUnit2013 // Do not use equality check to check for collection size. for (int i = 0; i < d.Count; i++) { Source.AssertDiagnostic(i, DiagDescriptors.MakeExeTypesInternal, d[i]); diff --git a/test/Analyzers/Microsoft.Analyzers.Extra.Tests/Resources/RoslynTestUtils.cs b/test/Analyzers/Microsoft.Analyzers.Extra.Tests/Resources/RoslynTestUtils.cs index f79f67bf0b9..bc80b98281f 100644 --- a/test/Analyzers/Microsoft.Analyzers.Extra.Tests/Resources/RoslynTestUtils.cs +++ b/test/Analyzers/Microsoft.Analyzers.Extra.Tests/Resources/RoslynTestUtils.cs @@ -146,7 +146,7 @@ public static void AssertDiagnostic(this string text, int spanNum, DiagnosticDes } catch (ArgumentOutOfRangeException) { - Assert.Fail($"Unexpected warning {actual}"); + Assert.True(false, $"Unexpected warning {actual}"); } } diff --git a/test/Analyzers/Microsoft.Analyzers.Extra.Tests/UsingToStringInLoggersTests.cs b/test/Analyzers/Microsoft.Analyzers.Extra.Tests/UsingToStringInLoggersTests.cs index 0c55c0d2c86..9f41a1945ea 100644 --- a/test/Analyzers/Microsoft.Analyzers.Extra.Tests/UsingToStringInLoggersTests.cs +++ b/test/Analyzers/Microsoft.Analyzers.Extra.Tests/UsingToStringInLoggersTests.cs @@ -58,16 +58,14 @@ public static void LogTest(ILogger log, object something) var generated = await RoslynTestUtils.RunGenerator( new LoggingGenerator(), References, - new[] { Source }); + new[] { Source }).ConfigureAwait(false); -#pragma warning disable xUnit2013 // Do not use equality check to check for collection size. Assert.Equal(0, generated.diagnostics.Count); -#pragma warning restore xUnit2013 // Do not use equality check to check for collection size. var fullDiags = await RoslynTestUtils.RunAnalyzer( new UsingToStringInLoggersAnalyzer(), References, - new[] { Source, generated.generatedSources[0].SourceText.ToString() }); + new[] { Source, generated.generatedSources[0].SourceText.ToString() }).ConfigureAwait(false); var d = RoslynTestUtils.FilterDiagnostics(fullDiags, DiagDescriptors.UsingToStringInLoggers); @@ -115,10 +113,8 @@ public static void LogTest(ILogger log, object something) var d = await RoslynTestUtils.RunAnalyzer( new UsingToStringInLoggersAnalyzer(), References, - new[] { Source }); + new[] { Source }).ConfigureAwait(false); -#pragma warning disable xUnit2013 // Do not use equality check to check for collection size. Assert.Equal(0, d.Count); -#pragma warning restore xUnit2013 // Do not use equality check to check for collection size. } } diff --git a/test/Analyzers/Microsoft.Analyzers.Local.Tests/ApiLifecycle/AnalysisModelTest.cs b/test/Analyzers/Microsoft.Analyzers.Local.Tests/ApiLifecycle/AnalysisModelTest.cs new file mode 100644 index 00000000000..2501dc537c9 --- /dev/null +++ b/test/Analyzers/Microsoft.Analyzers.Local.Tests/ApiLifecycle/AnalysisModelTest.cs @@ -0,0 +1,78 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System; +using Microsoft.Extensions.LocalAnalyzers.ApiLifecycle.Model; +using Xunit; + +namespace Microsoft.Extensions.LocalAnalyzers.ApiLifecycle.Test; + +public class AnalysisModelTest +{ + [Fact] + public void Field_Fallbacks_To_NotNull_Defaults_When_Value_Not_Found_In_Json() + { + var field = new Field([]); + + Assert.Equal(string.Empty, field.Member); + Assert.Equal(Stage.Experimental, field.Stage); + } + + [Fact] + public void PublicMember_Fallbacks_To_NotNull_Defaults_When_Value_Not_Found_In_Json() + { + var member = new TypeDef([]); + + Assert.Equal(string.Empty, member.ModifiersAndName); + Assert.Equal(Stage.Experimental, member.Stage); + Assert.Equal(Array.Empty(), member.Fields); + Assert.Equal(Array.Empty(), member.BaseTypes); + Assert.Equal(Array.Empty(), member.Constraints); + Assert.Equal(Array.Empty(), member.Methods); + Assert.Equal(Array.Empty(), member.Properties); + } + + [Fact] + public void Prop_Fallbacks_To_NotNull_Defaults_When_Value_Not_Found_In_Json() + { + var prop = new Prop([]); + + Assert.Equal(string.Empty, prop.Member); + Assert.Equal(Stage.Experimental, prop.Stage); + } + + [Fact] + public void PackageAnalysis_Fallbacks_To_NotNull_Defaults_When_Value_Not_Found_In_Json() + { + var analysis = new AssemblyAnalysis(Assembly.Empty); + + Assert.Equal(Assembly.Empty, analysis.Assembly); + Assert.Empty(analysis.MissingProperties); + Assert.Empty(analysis.MissingBaseTypes); + Assert.Empty(analysis.FoundInBaseline); + Assert.Empty(analysis.NotFoundInBaseline); + Assert.Empty(analysis.MissingTypes); + Assert.Empty(analysis.MissingConstraints); + Assert.Empty(analysis.MissingFields); + Assert.Empty(analysis.MissingMethods); + Assert.Empty(analysis.MissingProperties); + } + + [Fact] + public void Package_Fallbacks_To_NotNull_Defaults_When_Value_Not_Found_In_Json() + { + var package = new Assembly([]); + + Assert.Equal(Array.Empty(), package.Types); + Assert.Equal(string.Empty, package.Name); + } + + [Fact] + public void Method_FallbacksTo_NotNull_Defaults_When_Value_Not_Found_In_Json() + { + var method = new Method([]); + + Assert.Equal(string.Empty, method.Member); + Assert.Equal(Stage.Experimental, method.Stage); + } +} diff --git a/test/Analyzers/Microsoft.Analyzers.Local.Tests/ApiLifecycle/ApiLifecycleAnalyzerTest.cs b/test/Analyzers/Microsoft.Analyzers.Local.Tests/ApiLifecycle/ApiLifecycleAnalyzerTest.cs index 12561738e74..87afb05f182 100644 --- a/test/Analyzers/Microsoft.Analyzers.Local.Tests/ApiLifecycle/ApiLifecycleAnalyzerTest.cs +++ b/test/Analyzers/Microsoft.Analyzers.Local.Tests/ApiLifecycle/ApiLifecycleAnalyzerTest.cs @@ -39,7 +39,7 @@ public async Task Analyzer_Reports_Diagnostics_When_Code_Was_Not_Annotated_Corre }, options: options, testAssemblyName: testAssemblyName) -; + .ConfigureAwait(false); Assert.Equal(expectedDiagnostics, diagnostics.Count); @@ -65,7 +65,7 @@ public async Task Analyzer_Reports_Diagnostics_When_StableCode_Was_Not_Found_In_ }, options: options, testAssemblyName: testAssemblyName) -; + .ConfigureAwait(false); Assert.Equal(expectedDiagnostics, diagnostics.Count); @@ -77,7 +77,7 @@ public async Task Analyzer_Reports_Diagnostics_When_StableCode_Was_Not_Found_In_ } } - public static IEnumerable References => new[] + public static IEnumerable References => new[] { Assembly.GetAssembly(typeof(ObsoleteAttribute))!, Assembly.GetAssembly(typeof(EditorBrowsableAttribute))!, diff --git a/test/Analyzers/Microsoft.Analyzers.Local.Tests/CallAnalysis/ToInvariantStringTests.cs b/test/Analyzers/Microsoft.Analyzers.Local.Tests/CallAnalysis/ToInvariantStringTests.cs index 21f920c8f7c..cfc642956e8 100644 --- a/test/Analyzers/Microsoft.Analyzers.Local.Tests/CallAnalysis/ToInvariantStringTests.cs +++ b/test/Analyzers/Microsoft.Analyzers.Local.Tests/CallAnalysis/ToInvariantStringTests.cs @@ -37,7 +37,7 @@ public void Foo() var d = await RoslynTestUtils.RunAnalyzer( new CallAnalyzer(), null, - new[] { Source }); + new[] { Source }).ConfigureAwait(false); Assert.Equal(4, d.Count); for (int i = 0; i < d.Count; i++) diff --git a/test/Analyzers/Microsoft.Analyzers.Local.Tests/CallAnalysis/UseThrowsTests.cs b/test/Analyzers/Microsoft.Analyzers.Local.Tests/CallAnalysis/UseThrowsTests.cs index 4046a680dab..6a07221d3e7 100644 --- a/test/Analyzers/Microsoft.Analyzers.Local.Tests/CallAnalysis/UseThrowsTests.cs +++ b/test/Analyzers/Microsoft.Analyzers.Local.Tests/CallAnalysis/UseThrowsTests.cs @@ -28,7 +28,7 @@ public static async Task ShouldFindSingleWarning(string original, string excepti var d = await RoslynTestUtils.RunAnalyzer( new CallAnalyzer(), _references, - new[] { original }); + new[] { original }).ConfigureAwait(false); Assert.Single(d); original.AssertDiagnostic(0, DiagDescriptors.ThrowsStatement, d[0]); @@ -42,7 +42,7 @@ public static async Task ShouldNotProduceWarnings(string original) var d = await RoslynTestUtils.RunAnalyzer( new CallAnalyzer(), _references, - new[] { original }); + new[] { original }).ConfigureAwait(false); Assert.Empty(d); } @@ -276,7 +276,7 @@ public static async Task Expression_ShouldFindSingleWarning(string original) var d = await RoslynTestUtils.RunAnalyzer( new CallAnalyzer(), _references, - new[] { original }); + new[] { original }).ConfigureAwait(false); Assert.Single(d); original.AssertDiagnostic(0, DiagDescriptors.ThrowsExpression, d[0]); diff --git a/test/Analyzers/Microsoft.Analyzers.Local.Tests/Json/JsonArrayTest.cs b/test/Analyzers/Microsoft.Analyzers.Local.Tests/Json/JsonArrayTest.cs new file mode 100644 index 00000000000..ea18ec2a353 --- /dev/null +++ b/test/Analyzers/Microsoft.Analyzers.Local.Tests/Json/JsonArrayTest.cs @@ -0,0 +1,143 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +// Forked from StyleCop.Analyzers repo. + +using System; +using System.Collections; +using System.Collections.Generic; +using Xunit; + +namespace Microsoft.Extensions.LocalAnalyzers.Json.Test; + +public class JsonArrayTest +{ + [Fact] + public void TestConstructor() + { + var obj = new JsonArray(); + Assert.Equal(0, obj.Count); + + var obj1 = new JsonArray(1, "test1"); + Assert.Equal(2, obj1.Count); + Assert.Equal(1, obj1[0].AsInteger); + Assert.Equal("test1", obj1[1].AsString); + + var obj2 = new JsonArray { 1, "test2" }; + Assert.Equal(2, obj2.Count); + Assert.Equal(1, obj2[0].AsInteger); + Assert.Equal("test2", obj2[1].AsString); + + Assert.Throws("values", () => new JsonArray(default!)); + } + + [Fact] + public void TestIndexer() + { + var obj = new JsonArray(1); + Assert.Equal(1, obj.Count); + Assert.Equal(1, obj[0].AsInteger); + Assert.Equal(JsonValue.Null, obj[1]); + Assert.Equal(JsonValue.Null, obj[-1]); + + obj[0] = 2; + Assert.Equal(2, obj[0].AsInteger); + + Assert.ThrowsAny(() => obj[-1] = 0); + Assert.ThrowsAny(() => obj[1] = 0); + } + + [Fact] + public void TestInsert() + { + var obj = new JsonArray(1); + Assert.Equal(1, obj.Count); + Assert.Equal(1, obj[0].AsInteger); + + // Insert at end + Assert.Same(obj, obj.Insert(obj.Count, 2)); + Assert.Equal(2, obj.Count); + Assert.Equal(1, obj[0].AsInteger); + Assert.Equal(2, obj[1].AsInteger); + + // Insert at beginning + Assert.Same(obj, obj.Insert(0, 0)); + Assert.Equal(3, obj.Count); + Assert.Equal(0, obj[0].AsInteger); + Assert.Equal(1, obj[1].AsInteger); + Assert.Equal(2, obj[2].AsInteger); + + Assert.ThrowsAny(() => obj.Insert(-1, 0)); + Assert.ThrowsAny(() => obj.Insert(obj.Count + 1, 0)); + } + + [Fact] + public void TestRemove() + { + var obj = new JsonArray(0, 1, 2); + Assert.Equal(3, obj.Count); + + Assert.ThrowsAny(() => obj.Remove(-1)); + Assert.ThrowsAny(() => obj.Remove(obj.Count)); + + Assert.Same(obj, obj.Remove(1)); + Assert.Equal(2, obj.Count); + Assert.Equal(0, obj[0].AsInteger); + Assert.Equal(2, obj[1].AsInteger); + } + + [Fact] + public void TestClear() + { + var obj = new JsonArray(0, 1, 2); + Assert.Equal(3, obj.Count); + + Assert.Same(obj, obj.Clear()); + Assert.Equal(0, obj.Count); + + Assert.Same(obj, obj.Clear()); + Assert.Equal(0, obj.Count); + } + + [Fact] + public void TestContains() + { + var obj = new JsonArray("a", "b", "c"); + Assert.True(obj.Contains("b")); + obj.Remove(1); + Assert.False(obj.Contains("b")); + + Assert.False(obj.Contains(JsonValue.Null)); + } + + [Fact] + public void TestIndexOf() + { + var obj = new JsonArray("a", "b", "c"); + Assert.Equal(1, obj.IndexOf("b")); + Assert.Equal(2, obj.IndexOf("c")); + obj.Remove(1); + Assert.Equal(-1, obj.IndexOf("b")); + Assert.Equal(1, obj.IndexOf("c")); + + Assert.Equal(-1, obj.IndexOf(JsonValue.Null)); + } + + [Fact] + public void TestEnumerators() + { + var obj = new JsonArray("a", "b", "c"); + + using var genericEnumerator = obj.GetEnumerator(); + var legacyEnumerator = ((IEnumerable)obj).GetEnumerator(); + + for (int i = 0; i < obj.Count; i++) + { + Assert.True(genericEnumerator.MoveNext()); + Assert.True(legacyEnumerator.MoveNext()); + Assert.Equal(obj[i], genericEnumerator.Current); + Assert.Equal(obj[i], legacyEnumerator.Current); + Assert.Equal(genericEnumerator.Current, legacyEnumerator.Current); + } + } +} diff --git a/test/Analyzers/Microsoft.Analyzers.Local.Tests/Json/JsonObjectTest.cs b/test/Analyzers/Microsoft.Analyzers.Local.Tests/Json/JsonObjectTest.cs new file mode 100644 index 00000000000..bdfedefce88 --- /dev/null +++ b/test/Analyzers/Microsoft.Analyzers.Local.Tests/Json/JsonObjectTest.cs @@ -0,0 +1,112 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +// Forked from StyleCop.Analyzers repo. + +using System; +using System.Collections; +using System.Collections.Generic; +using Xunit; + +namespace Microsoft.Extensions.LocalAnalyzers.Json.Test; + +public class JsonObjectTest +{ + [Fact] + public void TestCount() + { + var obj = new JsonObject(); + Assert.Equal(0, obj.Count); + + obj["x"] = "value"; + Assert.Equal(1, obj.Count); + + obj["y"] = "value"; + Assert.Equal(2, obj.Count); + + obj["x"] = "value2"; + Assert.Equal(2, obj.Count); + + Assert.True(obj.Remove("x")); + Assert.Equal(1, obj.Count); + + Assert.False(obj.Remove("x")); + Assert.Equal(1, obj.Count); + + obj["z"] = "value3"; + Assert.Equal(2, obj.Count); + + Assert.Same(obj, obj.Clear()); + Assert.Equal(0, obj.Count); + } + + [Fact] + public void TestAdd() + { + var obj = new JsonObject(); + Assert.Equal(JsonValue.Null, obj["x"]); + Assert.False(obj.ContainsKey("x")); + + Assert.Same(obj, obj.Add("x")); + Assert.Equal(JsonValue.Null, obj["x"]); + Assert.True(obj.ContainsKey("x")); + } + + [Fact] + public void TestEnumerator() + { + var obj = new JsonObject + { + ["x"] = "x1", + ["y"] = "y1" + }; + + foreach (var value in obj) + { + Assert.Equal(typeof(KeyValuePair), value.GetType()); + Assert.Equal(value.Value, obj[value.Key]); + } + + IEnumerable genericEnumerable = obj; + foreach (var value in genericEnumerable) + { + Assert.True(obj.Contains(value)); + } + + IEnumerable legacyEnumerable = obj; + foreach (var value in legacyEnumerable) + { + Assert.IsType>(value); + Assert.True(obj.Contains(((KeyValuePair)value).Value)); + } + } + + [Fact] + public void TestRename() + { + var obj = new JsonObject { ["x"] = "value1", ["y"] = "value2" }; + Assert.Equal(2, obj.Count); + + var value = obj["x"].AsString; + Assert.False(obj.ContainsKey("z")); + Assert.Same(obj, obj.Rename("x", "z")); + Assert.Same(value, obj["z"].AsString); + Assert.False(obj.ContainsKey("x")); + Assert.Equal(2, obj.Count); + + // Renaming can overwrite a value + Assert.Same(obj, obj.Rename("z", "y")); + Assert.Same(value, obj["y"].AsString); + Assert.Equal(1, obj.Count); + + // Renaming to the same name does nothing + Assert.Same(obj, obj.Rename("y", "y")); + Assert.Same(value, obj["y"].AsString); + Assert.Equal(1, obj.Count); + + // Renaming a non-existent element is not a problem, and does not overwrite the target + Assert.Same(obj, obj.Rename("bogus", "y")); + Assert.Equal(1, obj.Count); + Assert.Same(value, obj["y"].AsString); + } +} diff --git a/test/Analyzers/Microsoft.Analyzers.Local.Tests/Json/JsonParseExceptionTest.cs b/test/Analyzers/Microsoft.Analyzers.Local.Tests/Json/JsonParseExceptionTest.cs new file mode 100644 index 00000000000..dedf163282d --- /dev/null +++ b/test/Analyzers/Microsoft.Analyzers.Local.Tests/Json/JsonParseExceptionTest.cs @@ -0,0 +1,20 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +// Forked from StyleCop.Analyzers repo. + +using System; +using Xunit; + +namespace Microsoft.Extensions.LocalAnalyzers.Json.Test; + +public class JsonParseExceptionTest +{ + [Fact] + public void TestDefaultConstructor() + { + var ex = new JsonParseException(); + Assert.Equal(ParsingError.Unknown, ex.Error); + Assert.False(string.IsNullOrEmpty(ex.Message)); + } +} diff --git a/test/Analyzers/Microsoft.Analyzers.Local.Tests/Json/JsonReaderTest.cs b/test/Analyzers/Microsoft.Analyzers.Local.Tests/Json/JsonReaderTest.cs new file mode 100644 index 00000000000..5f6d1085aad --- /dev/null +++ b/test/Analyzers/Microsoft.Analyzers.Local.Tests/Json/JsonReaderTest.cs @@ -0,0 +1,94 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +// Forked from StyleCop.Analyzers repo. + +using System; +using System.IO; +using Xunit; + +namespace Microsoft.Extensions.LocalAnalyzers.Json.Test; + +public class JsonReaderTest +{ + [Fact] + public void TestKeyMatchesPreviousValue() + { + var jsonObject = JsonValue.Parse("{ \"x\": \"value\", \"value\": \"value\" }"); + Assert.NotEqual(jsonObject, JsonValue.Null); + Assert.Equal("value", jsonObject["x"].AsString); + Assert.Equal("value", jsonObject["value"].AsString); + Assert.Equal(jsonObject["x"], jsonObject["value"]); + } + + [Fact] + public void TestDuplicateKeys() + { + Assert.ThrowsAny(() => JsonValue.Parse("{ \"x\": \"value\", \"x\": \"value\" }")); + } + + [Fact] + public void TestParse() + { + Assert.Equal("true", JsonReader.Parse("true").AsString); + + using (var reader = new StringReader("true")) + { + Assert.Equal("true", JsonReader.Parse(reader).AsString); + } + + Assert.Throws("source", () => JsonReader.Parse(default(string)!)); + Assert.Throws("reader", () => JsonReader.Parse(default(TextReader)!)); + } + + [Fact] + public void TestNumbers() + { + Assert.Equal(0, JsonReader.Parse("0").AsInteger); + Assert.Equal(0, JsonReader.Parse("-0").AsInteger); + Assert.Equal(-1, JsonReader.Parse("-1").AsInteger); + Assert.Equal(-1.0, JsonReader.Parse("-1.0").AsNumber); + Assert.Equal(-1e1, JsonReader.Parse("-1e1").AsNumber); + Assert.Equal(-1E1, JsonReader.Parse("-1E1").AsNumber); + Assert.Equal(-1E+1, JsonReader.Parse("-1E+1").AsNumber); + Assert.Equal(-10E-1, JsonReader.Parse("-10E-1").AsNumber); + } + + [Fact] + public void TestEscapeSequences() + { + Assert.Equal("\"", JsonReader.Parse("\"\\\"\"").AsString); + Assert.Equal("\\", JsonReader.Parse("\"\\\\\"").AsString); + Assert.Equal("/", JsonReader.Parse("\"\\/\"").AsString); + Assert.Equal("\b", JsonReader.Parse("\"\\b\"").AsString); + Assert.Equal("\f", JsonReader.Parse("\"\\f\"").AsString); + Assert.Equal("\n", JsonReader.Parse("\"\\n\"").AsString); + Assert.Equal("\r", JsonReader.Parse("\"\\r\"").AsString); + Assert.Equal("\t", JsonReader.Parse("\"\\t\"").AsString); + Assert.Equal("\u0123\u4567\u89AB\uCDEF", JsonReader.Parse("\"\\u0123\\u4567\\u89AB\\uCDEF\"").AsString); + + var ex = Assert.Throws(() => JsonReader.Parse("\"\\x\"")); + Assert.Equal(ParsingError.InvalidOrUnexpectedCharacter, ex.Error); + Assert.Equal(0, ex.Position.Line); + Assert.Equal(2, ex.Position.Column); + + ex = Assert.Throws(() => JsonReader.Parse("\"\\u11GA\"")); + Assert.Equal(ParsingError.InvalidOrUnexpectedCharacter, ex.Error); + Assert.Equal(0, ex.Position.Line); + Assert.Equal(5, ex.Position.Column); + + ex = Assert.Throws(() => JsonReader.Parse("\"\r\"")); + Assert.Equal(ParsingError.InvalidOrUnexpectedCharacter, ex.Error); + Assert.Equal(0, ex.Position.Line); + Assert.Equal(1, ex.Position.Column); + } + + [Fact] + public void TestArrayMissingComma() + { + var ex = Assert.ThrowsAny(() => JsonReader.Parse("[ 1 2 ]")); + Assert.Equal(ParsingError.InvalidOrUnexpectedCharacter, ex.Error); + Assert.Equal(0, ex.Position.Line); + Assert.Equal(4, ex.Position.Column); + } +} diff --git a/test/Analyzers/Microsoft.Analyzers.Local.Tests/Json/JsonScannerTest.cs b/test/Analyzers/Microsoft.Analyzers.Local.Tests/Json/JsonScannerTest.cs new file mode 100644 index 00000000000..461302e2c04 --- /dev/null +++ b/test/Analyzers/Microsoft.Analyzers.Local.Tests/Json/JsonScannerTest.cs @@ -0,0 +1,56 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +// Forked from StyleCop.Analyzers repo. + +using System; +using Xunit; + +namespace Microsoft.Extensions.LocalAnalyzers.Json.Test; + +public class JsonScannerTest +{ + [Fact] + public void TestUnexpectedLookahead() + { + JsonParseException ex; + + ex = Assert.ThrowsAny(() => JsonValue.Parse("trUe")); + Assert.Equal(ParsingError.InvalidOrUnexpectedCharacter, ex.Error); + Assert.Equal(0, ex.Position.Line); + Assert.Equal(2, ex.Position.Column); + + ex = Assert.ThrowsAny(() => JsonValue.Parse("tr")); + Assert.Equal(ParsingError.IncompleteMessage, ex.Error); + Assert.Equal(0, ex.Position.Line); + Assert.Equal(2, ex.Position.Column); + } + + [Fact] + public void TestIncompleteComment() + { + var ex = Assert.ThrowsAny(() => JsonValue.Parse("{ /1 }")); + + Assert.Equal(ParsingError.InvalidOrUnexpectedCharacter, ex.Error); + Assert.Contains("'1'", ex.Message); + Assert.Equal(0, ex.Position.Line); + Assert.Equal(3, ex.Position.Column); + + ex = Assert.ThrowsAny(() => JsonValue.Parse("{ // ignored text }")); + + Assert.Equal(ParsingError.IncompleteMessage, ex.Error); + + ex = Assert.ThrowsAny(() => JsonValue.Parse("{ /* ignored text }")); + + Assert.Equal(ParsingError.IncompleteMessage, ex.Error); + } + + [Fact] + public void TestBlockCommentTermination() + { + var obj = JsonValue.Parse("{ /* * / */ }"); + + Assert.Equal(JsonValueType.Object, obj.Type); + Assert.Equal(0, obj.AsJsonObject?.Count); + } +} diff --git a/test/Analyzers/Microsoft.Analyzers.Local.Tests/Json/JsonValueTest.cs b/test/Analyzers/Microsoft.Analyzers.Local.Tests/Json/JsonValueTest.cs new file mode 100644 index 00000000000..cf00a31a648 --- /dev/null +++ b/test/Analyzers/Microsoft.Analyzers.Local.Tests/Json/JsonValueTest.cs @@ -0,0 +1,350 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +// Forked from StyleCop.Analyzers repo. + +using System; +using System.Globalization; +using Xunit; + +namespace Microsoft.Extensions.LocalAnalyzers.Json.Test; + +public class JsonValueTest +{ + [Fact] + public void TestJsonValueConstructors() + { + // JsonValue(bool?) + Assert.True(new JsonValue(true).IsBoolean); + Assert.True(new JsonValue(true).AsBoolean); + Assert.True(new JsonValue(false).IsBoolean); + Assert.False(new JsonValue(false).AsBoolean); + Assert.True(new JsonValue(default(bool?)).IsNull); + Assert.False(new JsonValue(default(bool?)).IsBoolean); + Assert.False(new JsonValue(default(bool?)).AsBoolean); + + // JsonValue(double?) + Assert.True(new JsonValue(1.0).IsNumber); + Assert.Equal(1.0, new JsonValue(1.0).AsNumber); + Assert.True(new JsonValue(default(double?)).IsNull); + Assert.False(new JsonValue(default(double?)).IsNumber); + Assert.Equal(0.0, new JsonValue(default(double?)).AsNumber); + + // JsonValue(string) + Assert.True(new JsonValue(string.Empty).IsString); + Assert.True(new JsonValue("text").IsString); + Assert.Equal("text", new JsonValue("text").AsString); + Assert.True(new JsonValue(default(string)).IsNull); + Assert.False(new JsonValue(default(string)).IsString); + Assert.Null(new JsonValue(default(string)).AsString); + + // JsonValue(JsonObject) + Assert.True(new JsonValue(new JsonObject()).IsJsonObject); + Assert.IsType(new JsonValue(new JsonObject()).AsJsonObject); + Assert.True(new JsonValue(default(JsonObject)).IsNull); + Assert.False(new JsonValue(default(JsonObject)).IsJsonObject); + Assert.Null(new JsonValue(default(JsonObject)).AsJsonObject); + + // JsonValue(JsonArray) + Assert.True(new JsonValue(new JsonArray()).IsJsonArray); + Assert.IsType(new JsonValue(new JsonArray()).AsJsonArray); + Assert.True(new JsonValue(default(JsonArray)).IsNull); + Assert.False(new JsonValue(default(JsonArray)).IsJsonArray); + Assert.Null(new JsonValue(default(JsonArray)).AsJsonArray); + + Assert.Equal("interface Microsoft.Extensions.Metrics.IHistogram2 where T : struct", + new JsonValue("interface Microsoft.Extensions.Metrics.IHistogram2 where T : struct").AsString); + } + + [Fact] + public void TestIsInteger() + { + Assert.False(new JsonValue(false).IsInteger); + Assert.True(new JsonValue(1.0).IsInteger); + Assert.False(new JsonValue(1.1).IsInteger); + Assert.False(new JsonValue(double.PositiveInfinity).IsInteger); + } + + [Fact] + public void TestIsDateTime() + { + Assert.False(new JsonValue(false).IsDateTime); + Assert.False(new JsonValue("Some text").IsDateTime); + Assert.True(new JsonValue(DateTime.Now.ToString("o", CultureInfo.InvariantCulture)).IsDateTime); + } + + [Fact] + public void TestAsBoolean() + { + Assert.False(new JsonValue(false).AsBoolean); + Assert.False(new JsonValue(0.0).AsBoolean); + Assert.False(new JsonValue(string.Empty).AsBoolean); + Assert.False(new JsonValue(default(JsonObject)).AsBoolean); + + Assert.True(new JsonValue(true).AsBoolean); + Assert.True(new JsonValue(1.0).AsBoolean); + Assert.True(new JsonValue("text").AsBoolean); + Assert.True(new JsonValue(new JsonObject()).AsBoolean); + Assert.True(new JsonValue(new JsonArray()).AsBoolean); + } + + [Fact] + public void TestAsInteger() + { + Assert.Equal(int.MaxValue, new JsonValue(uint.MaxValue).AsInteger); + Assert.Equal(int.MinValue, new JsonValue(long.MinValue).AsInteger); + Assert.Equal(0, new JsonValue(0.5).AsInteger); + Assert.Equal(1, new JsonValue(1).AsInteger); + } + + [Fact] + public void TestAsNumber() + { + Assert.Equal(0.0, new JsonValue(false).AsNumber); + Assert.Equal(1.0, new JsonValue(true).AsNumber); + Assert.Equal(1.0, new JsonValue(1.0).AsNumber); + Assert.Equal(1.0, new JsonValue("1.0").AsNumber); + Assert.Equal(0, new JsonValue("text").AsNumber); + Assert.Equal(0.0, new JsonValue(new JsonObject()).AsNumber); + Assert.Equal(0.0, new JsonValue(default(JsonObject)).AsNumber); + Assert.Equal(0.0, new JsonValue(new JsonArray()).AsNumber); + } + + [Fact] + public void TestAsNumbersUsingCultureWithNonStandardNumberFormat() + { + Assert.Equal(1.0, new JsonValue("1.0").AsNumber); + } + + [Fact] + public void TestAsString() + { + Assert.Equal("false", new JsonValue(false).AsString); + Assert.Equal("true", new JsonValue(true).AsString); + Assert.Equal("0.5", new JsonValue(0.5).AsString); + Assert.Equal("1", new JsonValue(1.0).AsString); + Assert.Equal("text", new JsonValue("text").AsString); + Assert.Null(new JsonValue(new JsonObject()).AsString); + Assert.Null(new JsonValue(default(JsonObject)).AsString); + Assert.Null(new JsonValue(new JsonArray()).AsString); + } + + [Fact] + public void TestAsStringUsingCultureWithNonStandardNumberFormat() + { + Assert.Equal("0.5", new JsonValue(0.5).AsString); + } + + [Fact] + public void TestAsJsonObject() + { + Assert.Null(new JsonValue(false).AsJsonObject); + Assert.IsType(new JsonValue(new JsonObject()).AsJsonObject); + Assert.Null(new JsonValue(default(JsonObject)).AsJsonObject); + } + + [Fact] + public void TestAsJsonArray() + { + Assert.Null(new JsonValue(false).AsJsonArray); + Assert.IsType(new JsonValue(new JsonArray()).AsJsonArray); + Assert.Null(new JsonValue(default(JsonArray)).AsJsonArray); + } + + [Fact] + public void TestAsDateTime() + { + Assert.Null(new JsonValue(false).AsDateTime); + Assert.Null(new JsonValue("Some text").AsDateTime); + + var now = new DateTime(2016, 1, 20, 5, 12, 33, DateTimeKind.Local); + Assert.Equal(now, new JsonValue(now.ToString("o", CultureInfo.InvariantCulture)).AsDateTime); + } + + [Fact] + public void TestAsObject() + { + Assert.Equal(0.0, new JsonValue(false).AsObject); + Assert.Equal(1.0, new JsonValue(true).AsObject); + Assert.Equal(1.0, new JsonValue(1.0).AsObject); + Assert.Equal("1.0", new JsonValue("1.0").AsObject); + Assert.IsType(new JsonValue(new JsonObject()).AsObject); + Assert.IsType(new JsonValue(new JsonArray()).AsObject); + Assert.Null(new JsonValue(default(JsonObject)).AsObject); + } + + [Fact] + public void TestStringIndexer() + { + Assert.ThrowsAny(() => new JsonValue(false)["key"]); + Assert.ThrowsAny(() => new JsonValue(false)[null!]); + Assert.ThrowsAny(() => new JsonValue(false) { ["key"] = "value" }); + + Assert.Equal(JsonValue.Null, new JsonValue(new JsonObject())["key"]); + var value = new JsonValue(new JsonObject()) { ["key"] = "value" }; + Assert.Equal("value", value["key"].AsString); + Assert.ThrowsAny(() => new JsonValue(new JsonObject())[null!]); + } + + [Fact] + public void TestIntegerIndexer() + { + Assert.ThrowsAny(() => new JsonValue(false)[0]); + Assert.ThrowsAny(() => new JsonValue(false)[-1]); + Assert.ThrowsAny(() => new JsonValue(false) { [0] = "value" }); + + Assert.Equal(JsonValue.Null, new JsonValue(new JsonArray())[0]); + Assert.Equal(JsonValue.Null, new JsonValue(new JsonArray())[-1]); + + var value = new JsonValue(new JsonArray { "initial" }); + Assert.Equal("initial", value[0].AsString); + value[0] = "value"; + Assert.Equal("value", value[0].AsString); + } + + [Fact] + public void TestConversionOperators() + { + // (JsonValue)(DateTime?) + DateTime time = DateTime.Now; + Assert.NotEqual(time, JsonValue.Null); + Assert.Equal(time.ToString("o", CultureInfo.InvariantCulture), ((JsonValue)time).AsString); + Assert.Equal(default(DateTime?), JsonValue.Null); + + // (int)(JsonValue) + Assert.Equal(0, (int)new JsonValue(uint.MaxValue)); + Assert.Equal(0, (int)new JsonValue(long.MinValue)); + Assert.Equal(0, (int)new JsonValue(2.5)); + Assert.Equal(1, (int)new JsonValue(1)); + + // (int?)(JsonValue) + Assert.Equal(0, (int?)new JsonValue(uint.MaxValue)); + Assert.Equal(0, (int?)new JsonValue(long.MinValue)); + Assert.Equal(0, (int?)new JsonValue(2.5)); + Assert.Equal(1, (int?)new JsonValue(1)); + Assert.Null((int?)JsonValue.Null); + Assert.Null((int?)new JsonValue(default(JsonObject))); + + // (bool)(JsonValue) + Assert.False((bool)new JsonValue(false)); + Assert.False((bool)new JsonValue(0.0)); + Assert.False((bool)new JsonValue(string.Empty)); + Assert.False((bool)new JsonValue(default(JsonObject))); + + Assert.True((bool)new JsonValue(true)); + Assert.False((bool)new JsonValue(1.0)); + Assert.False((bool)new JsonValue("text")); + Assert.False((bool)new JsonValue(new JsonObject())); + Assert.False((bool)new JsonValue(new JsonArray())); + + // (bool?)(JsonValue) + Assert.False((bool?)new JsonValue(false)); + Assert.False((bool?)new JsonValue(0.0)); + Assert.False((bool?)new JsonValue(string.Empty)); + + Assert.True((bool?)new JsonValue(true)); + Assert.False((bool?)new JsonValue(1.0)); + Assert.False((bool?)new JsonValue("text")); + Assert.False((bool?)new JsonValue(new JsonObject())); + Assert.False((bool?)new JsonValue(new JsonArray())); + + Assert.Null((bool?)JsonValue.Null); + Assert.Null((bool?)new JsonValue(default(JsonObject))); + + // (double)(JsonValue) + Assert.Equal(double.NaN, (double)new JsonValue(false)); + Assert.Equal(double.NaN, (double)new JsonValue(true)); + Assert.Equal(1.0, (double)new JsonValue(1.0)); + Assert.Equal(double.NaN, (double)new JsonValue("1.0")); + Assert.Equal(double.NaN, (double)new JsonValue(new JsonObject())); + Assert.Equal(double.NaN, (double)new JsonValue(new JsonArray())); + Assert.Equal(double.NaN, (double)JsonValue.Null); + Assert.Equal(double.NaN, (double)new JsonValue(default(JsonObject))); + + // (double?)(JsonValue) + Assert.Equal(double.NaN, (double?)new JsonValue(false)); + Assert.Equal(double.NaN, (double?)new JsonValue(true)); + Assert.Equal(1.0, (double?)new JsonValue(1.0)); + Assert.Equal(double.NaN, (double?)new JsonValue("1.0")); + Assert.Equal(double.NaN, (double?)new JsonValue(new JsonObject())); + Assert.Equal(double.NaN, (double?)new JsonValue(new JsonArray())); + Assert.Null((double?)JsonValue.Null); + Assert.Null((double?)new JsonValue(default(JsonObject))); + + // (string)(JsonValue) + Assert.Null((string?)new JsonValue(false)); + Assert.Null((string?)new JsonValue(true)); + Assert.Null((string?)new JsonValue(1.0)); + Assert.Equal("text", (string?)new JsonValue("text")); + Assert.Null((string?)new JsonValue(new JsonObject())); + Assert.Null((string?)new JsonValue(default(JsonObject))); + Assert.Null((string?)new JsonValue(new JsonArray())); + + // (JsonObject)(JsonValue) + Assert.Null((JsonObject?)new JsonValue(false)); + Assert.IsType((JsonObject?)new JsonValue(new JsonObject())); + Assert.Null((JsonObject?)new JsonValue(default(JsonObject))); + + // (JsonArray)(JsonValue) + Assert.Null((JsonArray?)new JsonValue(false)); + Assert.IsType((JsonArray?)new JsonValue(new JsonArray())); + Assert.Null((JsonArray?)new JsonValue(default(JsonArray))); + + // (DateTime)(JsonValue) + Assert.Equal(DateTime.MinValue, (DateTime)new JsonValue(false)); + Assert.Equal(DateTime.MinValue, (DateTime)new JsonValue("Some text")); + + var now = new DateTime(2016, 1, 20, 5, 12, 33, DateTimeKind.Local); + Assert.Equal(now, (DateTime)new JsonValue(now.ToString("o", CultureInfo.InvariantCulture))); + + // (DateTime?)(JsonValue) + Assert.Null((DateTime?)new JsonValue(false)); + Assert.Null((DateTime?)new JsonValue("Some text")); + Assert.Equal(now, (DateTime?)new JsonValue(now.ToString("o", CultureInfo.InvariantCulture))); + } + + [Fact] + public void TestOpInequality() + { + Assert.False(JsonValue.Null != default); + Assert.True(new JsonValue(true) != new JsonValue(0)); + } + + [Fact] + public void TestEquals() + { + Assert.True(JsonValue.Null.Equals((object?)null)); + Assert.True(JsonValue.Null.Equals(JsonValue.Null)); + Assert.True(JsonValue.Null.Equals(default)); + + Assert.True(new JsonValue(true).Equals(new JsonValue(true))); + Assert.False(new JsonValue(true).Equals(new JsonValue(false))); + + Assert.False(JsonValue.Null.Equals(1)); + Assert.False(JsonValue.Null.Equals(new InvalidOperationException())); + } + + [Fact] + public void TestGetHashCode() + { + Assert.Equal(JsonValue.Null.GetHashCode(), default(JsonValue).GetHashCode()); + Assert.Equal(new JsonValue(1).GetHashCode(), new JsonValue(1).GetHashCode()); + Assert.Equal(new JsonValue("text").GetHashCode(), new JsonValue(new string("text".ToCharArray())).GetHashCode()); + } + + [Fact] + public void TestParse() + { + Assert.True(JsonValue.Parse("true").IsBoolean); + Assert.True(JsonValue.Parse("1").IsInteger); + Assert.True(JsonValue.Parse("1.0").IsInteger); + Assert.True(JsonValue.Parse("1.0").IsNumber); + Assert.True(JsonValue.Parse("\"text\"").IsString); + Assert.True(JsonValue.Parse("null").IsNull); + Assert.True(JsonValue.Parse("{}").IsJsonObject); + Assert.True(JsonValue.Parse("[]").IsJsonArray); + + Assert.ThrowsAny(() => JsonValue.Parse(string.Empty)); + Assert.ThrowsAny(() => JsonValue.Parse("{")); + } +} diff --git a/test/Analyzers/Microsoft.Analyzers.Local.Tests/Resources/RoslynTestUtils.cs b/test/Analyzers/Microsoft.Analyzers.Local.Tests/Resources/RoslynTestUtils.cs index 856bebd2ab6..1f5606d96ef 100644 --- a/test/Analyzers/Microsoft.Analyzers.Local.Tests/Resources/RoslynTestUtils.cs +++ b/test/Analyzers/Microsoft.Analyzers.Local.Tests/Resources/RoslynTestUtils.cs @@ -146,7 +146,7 @@ public static void AssertDiagnostic(this string text, int spanNum, DiagnosticDes } catch (ArgumentOutOfRangeException) { - Assert.Fail($"Unexpected warning {actual}"); + Assert.True(false, $"Unexpected warning {actual}"); } } diff --git a/test/Generators/Microsoft.Gen.ComplianceReports/Unit/GeneratorTests.cs b/test/Generators/Microsoft.Gen.ComplianceReports/Unit/GeneratorTests.cs index 895f6d75d06..ec64e24d623 100644 --- a/test/Generators/Microsoft.Gen.ComplianceReports/Unit/GeneratorTests.cs +++ b/test/Generators/Microsoft.Gen.ComplianceReports/Unit/GeneratorTests.cs @@ -102,7 +102,7 @@ static async Task> RunGenerator(string code, string ou code, TestTaxonomy, }, - new OptionsProvider()); + new OptionsProvider()).ConfigureAwait(false); return d; } @@ -120,11 +120,9 @@ public async Task MissingDataClassificationSymbol() { Source, }, - new OptionsProvider()); + new OptionsProvider()).ConfigureAwait(false); -#pragma warning disable xUnit2013 // Do not use equality check to check for collection size. Assert.Equal(0, d.Count); -#pragma warning restore xUnit2013 // Do not use equality check to check for collection size. } private sealed class Options : AnalyzerConfigOptions diff --git a/test/Generators/Microsoft.Gen.ContextualOptions/Unit/EmitterTests.cs b/test/Generators/Microsoft.Gen.ContextualOptions/Unit/EmitterTests.cs index 1e1c3eb91be..f5fc3d8b87f 100644 --- a/test/Generators/Microsoft.Gen.ContextualOptions/Unit/EmitterTests.cs +++ b/test/Generators/Microsoft.Gen.ContextualOptions/Unit/EmitterTests.cs @@ -141,7 +141,7 @@ public async Task TestEmitter() typeof(ReadOnlySpan<>).Assembly }, sources) -; + .ConfigureAwait(false); Assert.Empty(d); _ = Assert.Single(r); diff --git a/test/Generators/Microsoft.Gen.ContextualOptions/Unit/SyntaxContextReceiverTests.cs b/test/Generators/Microsoft.Gen.ContextualOptions/Unit/SyntaxContextReceiverTests.cs index f2e35bd474d..ef9f094caf9 100644 --- a/test/Generators/Microsoft.Gen.ContextualOptions/Unit/SyntaxContextReceiverTests.cs +++ b/test/Generators/Microsoft.Gen.ContextualOptions/Unit/SyntaxContextReceiverTests.cs @@ -26,7 +26,7 @@ public async Task ShouldCollectTypesWithTheOptionsContextAttribute() File.ReadAllText("TestClasses/Record1.cs"), }; - var comp = await RoslynTestUtils.RunSyntaxContextReceiver(sut, new[] { typeof(OptionsContextAttribute).Assembly }, sources); + var comp = await RoslynTestUtils.RunSyntaxContextReceiver(sut, new[] { typeof(OptionsContextAttribute).Assembly }, sources).ConfigureAwait(true); Assert.True(sut.TryGetTypeDeclarations(comp, out var typeDeclarations)); @@ -49,7 +49,7 @@ public async Task ShouldDoNothingWithoutTheOptionsContextAttributeReferenced() File.ReadAllText("TestClasses/Record1.cs"), }; - var comp = await RoslynTestUtils.RunSyntaxContextReceiver(sut, Enumerable.Empty(), sources); + var comp = await RoslynTestUtils.RunSyntaxContextReceiver(sut, Enumerable.Empty(), sources).ConfigureAwait(true); Assert.False(sut.TryGetTypeDeclarations(comp, out _)); } @@ -64,7 +64,7 @@ public async Task ShouldCollectMultiFileTypesWithTheOptionsContextAttribute() File.ReadAllText("TestClasses/Class2B.cs"), }; - var comp = await RoslynTestUtils.RunSyntaxContextReceiver(sut, new[] { typeof(OptionsContextAttribute).Assembly }, sources); + var comp = await RoslynTestUtils.RunSyntaxContextReceiver(sut, new[] { typeof(OptionsContextAttribute).Assembly }, sources).ConfigureAwait(true); Assert.True(sut.TryGetTypeDeclarations(comp, out var typeDeclarations)); Assert.Single(typeDeclarations!); @@ -82,7 +82,7 @@ public async Task ShouldIgnoreTypesWithoutTheOptionsContextAttribute() var sut = new ContextReceiver(CancellationToken.None); var sources = new[] { File.ReadAllText("TestClasses/ClassWithNoAttribute.cs"), }; - var comp = await RoslynTestUtils.RunSyntaxContextReceiver(sut, new[] { typeof(OptionsContextAttribute).Assembly }, sources); + var comp = await RoslynTestUtils.RunSyntaxContextReceiver(sut, new[] { typeof(OptionsContextAttribute).Assembly }, sources).ConfigureAwait(true); Assert.True(sut.TryGetTypeDeclarations(comp, out var typeDeclarations)); Assert.Empty(typeDeclarations!); diff --git a/test/Generators/Microsoft.Gen.Logging/Unit/EmitterTests.cs b/test/Generators/Microsoft.Gen.Logging/Unit/EmitterTests.cs index 4f2bd8093de..e910a99149e 100644 --- a/test/Generators/Microsoft.Gen.Logging/Unit/EmitterTests.cs +++ b/test/Generators/Microsoft.Gen.Logging/Unit/EmitterTests.cs @@ -47,7 +47,7 @@ public async Task TestEmitter() }, sources, symbols) -; + .ConfigureAwait(false); // we need this "Where()" hack because Roslyn 4.0 doesn't recognize #pragma warning disable for generator-produced warnings #pragma warning disable S1067 // Expressions should not be too complex diff --git a/test/Generators/Microsoft.Gen.Logging/Unit/ParserTests.cs b/test/Generators/Microsoft.Gen.Logging/Unit/ParserTests.cs index a3f6c855d78..bfd7dc44c6c 100644 --- a/test/Generators/Microsoft.Gen.Logging/Unit/ParserTests.cs +++ b/test/Generators/Microsoft.Gen.Logging/Unit/ParserTests.cs @@ -978,7 +978,7 @@ private static async Task RunGenerator( } else if (d.Count > 0) { - Assert.Fail($"Expected no diagnostics, got {d.Count} diagnostics"); + Assert.True(false, $"Expected no diagnostics, got {d.Count} diagnostics"); } } } diff --git a/test/Generators/Microsoft.Gen.Metrics/Unit/EmitterTests.cs b/test/Generators/Microsoft.Gen.Metrics/Unit/EmitterTests.cs index 0bcdb43b0b5..c98d83a5ad7 100644 --- a/test/Generators/Microsoft.Gen.Metrics/Unit/EmitterTests.cs +++ b/test/Generators/Microsoft.Gen.Metrics/Unit/EmitterTests.cs @@ -37,7 +37,7 @@ public async Task TestEmitter() Assembly.GetAssembly(typeof(HistogramAttribute<>))!, }, sources) -; + .ConfigureAwait(false); Assert.Empty(d); Assert.Equal(2, r.Length); diff --git a/test/Generators/Shared/RoslynTestUtils.cs b/test/Generators/Shared/RoslynTestUtils.cs index 175b7d51832..a586d2b93eb 100644 --- a/test/Generators/Shared/RoslynTestUtils.cs +++ b/test/Generators/Shared/RoslynTestUtils.cs @@ -140,7 +140,7 @@ public static void AssertDiagnostic(this string text, int spanNum, DiagnosticDes } else { - Assert.Fail($"Unexpected diagnostics {actual}"); + Assert.True(false, $"Unexpected diagnostics {actual}"); } } @@ -155,7 +155,7 @@ public static void AssertDiagnostics(this string text, DiagnosticDescriptor expe expectedSpan = text.MakeTextSpan(spanNum); if (expectedSpan == null) { - Assert.Fail($"No span detected for diagnostic #{spanNum}, {d}"); + Assert.True(false, $"No span detected for diagnostic #{spanNum}, {d}"); } } @@ -173,7 +173,7 @@ public static void AssertDiagnostics(this string text, DiagnosticDescriptor expe if (text.MakeTextSpan(spanNum) != null) { - Assert.Fail($"Diagnostic {spanNum} was not detected"); + Assert.True(false, $"Diagnostic {spanNum} was not detected"); } } diff --git a/test/Libraries/Microsoft.AspNetCore.AsyncState.Tests/Microsoft.AspNetCore.AsyncState.Tests.csproj b/test/Libraries/Microsoft.AspNetCore.AsyncState.Tests/Microsoft.AspNetCore.AsyncState.Tests.csproj index 8a7574d6ae3..68654cb2b72 100644 --- a/test/Libraries/Microsoft.AspNetCore.AsyncState.Tests/Microsoft.AspNetCore.AsyncState.Tests.csproj +++ b/test/Libraries/Microsoft.AspNetCore.AsyncState.Tests/Microsoft.AspNetCore.AsyncState.Tests.csproj @@ -1,4 +1,4 @@ - + Microsoft.AspNetCore.AsyncState.Test Unit tests for Microsoft.AspNetCore.AsyncState. @@ -6,6 +6,8 @@ $(TestNetCoreTargetFrameworks) + + true diff --git a/test/Libraries/Microsoft.AspNetCore.Diagnostics.Middleware.Tests/Latency/AcceptanceTests.cs b/test/Libraries/Microsoft.AspNetCore.Diagnostics.Middleware.Tests/Latency/AcceptanceTests.cs index 0fa4c0fe6bf..c3184e20372 100644 --- a/test/Libraries/Microsoft.AspNetCore.Diagnostics.Middleware.Tests/Latency/AcceptanceTests.cs +++ b/test/Libraries/Microsoft.AspNetCore.Diagnostics.Middleware.Tests/Latency/AcceptanceTests.cs @@ -56,7 +56,7 @@ public async Task RequestLatency_LatencyContextIsStarted() latencyContext.SetTag(tokenIssuer.GetTagToken(tagName), tagValue); latencyContext.RecordMeasure(tokenIssuer.GetMeasureToken(measureName), measureValue); await Task.Delay(taskTimeMs + 10); // Adding 10 ms buffer - await next.Invoke(); + await next.Invoke().ConfigureAwait(false); var ld = latencyContext!.LatencyData; Assert.True(IsMatchByName(ld.Checkpoints, (c) => c.Name == checkpointName)); @@ -73,9 +73,9 @@ public async Task RequestLatency_LatencyContextIsStarted() }); }); })) - .StartAsync(); + .StartAsync().ConfigureAwait(false); - _ = await host.GetTestClient().GetAsync("/"); + _ = await host.GetTestClient().GetAsync("/").ConfigureAwait(false); await host.StopAsync(); Assert.True(isInLambda); diff --git a/test/Libraries/Microsoft.AspNetCore.Diagnostics.Middleware.Tests/Latency/ChecpointAcceptanceTests.cs b/test/Libraries/Microsoft.AspNetCore.Diagnostics.Middleware.Tests/Latency/ChecpointAcceptanceTests.cs index faf64927e40..f43d52731a6 100644 --- a/test/Libraries/Microsoft.AspNetCore.Diagnostics.Middleware.Tests/Latency/ChecpointAcceptanceTests.cs +++ b/test/Libraries/Microsoft.AspNetCore.Diagnostics.Middleware.Tests/Latency/ChecpointAcceptanceTests.cs @@ -44,7 +44,7 @@ public async Task RequestCheckpoint_CanMeasureMiddlewarePipeTime() app.Use(async (context, next) => { var latencyContext = context.RequestServices.GetRequiredService(); - await next.Invoke(); + await next.Invoke().ConfigureAwait(false); latencyContext.TryGetCheckpoint(RequestCheckpointConstants.ElapsedTillPipelineExitMiddleware, out var exitPipeline, out var exitPipelineFreq); latencyContext.TryGetCheckpoint(RequestCheckpointConstants.ElapsedResponseProcessed, out var responseProcessed, out var responseProcessedFreq); @@ -59,7 +59,7 @@ public async Task RequestCheckpoint_CanMeasureMiddlewarePipeTime() })) .StartAsync(); - _ = await host.GetTestClient().GetAsync("/"); + _ = await host.GetTestClient().GetAsync("/").ConfigureAwait(false); Assert.True(reachedLambda); Assert.InRange(exitPipelineValue, 0, 10_000); @@ -80,7 +80,7 @@ public async Task RequestCheckpointMiddleware_Does_Not_Throw_When_ServerTiming_H app.Use(async (context, next) => { var latencyContext = context.RequestServices.GetRequiredService(); - await next.Invoke(); + await next.Invoke().ConfigureAwait(false); latencyContext.TryGetCheckpoint(RequestCheckpointConstants.ElapsedTillPipelineExitMiddleware, out var exitPipeline, out var exitPipelineFreq); latencyContext.TryGetCheckpoint(RequestCheckpointConstants.ElapsedResponseProcessed, out var responseProcessed, out var responsedProcessedFreq); exitPipelineValue = ((double)exitPipeline / exitPipelineFreq) * 1000; @@ -102,7 +102,7 @@ public async Task RequestCheckpointMiddleware_Does_Not_Throw_When_ServerTiming_H HttpResponseMessage? response = null; - var e = await Record.ExceptionAsync(async () => response = await host.GetTestClient().GetAsync("/")); + var e = await Record.ExceptionAsync(async () => response = await host.GetTestClient().GetAsync("/").ConfigureAwait(false)); Assert.Null(e); Assert.NotNull(response); diff --git a/test/Libraries/Microsoft.AspNetCore.Diagnostics.Middleware.Tests/Logging/AcceptanceTests.Mvc.cs b/test/Libraries/Microsoft.AspNetCore.Diagnostics.Middleware.Tests/Logging/AcceptanceTests.Mvc.cs index 2a457bcb6af..36b4897fba8 100644 --- a/test/Libraries/Microsoft.AspNetCore.Diagnostics.Middleware.Tests/Logging/AcceptanceTests.Mvc.cs +++ b/test/Libraries/Microsoft.AspNetCore.Diagnostics.Middleware.Tests/Logging/AcceptanceTests.Mvc.cs @@ -61,7 +61,7 @@ await RunControllerAsync( async (logCollector, client) => { const string UserId = "testUserId"; - using var response = await client.GetAsync($"/api/users/{UserId}/someTestData?{QueryParamName}=foo"); + using var response = await client.GetAsync($"/api/users/{UserId}/someTestData?{QueryParamName}=foo").ConfigureAwait(false); Assert.True(response.IsSuccessStatusCode); await WaitForLogRecordsAsync(logCollector, TimeSpan.FromSeconds(30)); @@ -96,7 +96,7 @@ await RunControllerAsync( async (logCollector, client) => { const string UserId = "testUserId"; - using var response = await client.GetAsync($"/api/users/{UserId}/someTestData?{QueryParamName}=foo"); + using var response = await client.GetAsync($"/api/users/{UserId}/someTestData?{QueryParamName}=foo").ConfigureAwait(false); Assert.True(response.IsSuccessStatusCode); await WaitForLogRecordsAsync(logCollector, TimeSpan.FromSeconds(30)); @@ -142,7 +142,7 @@ await RunControllerAsync( { const string UserId = "testUserId"; const string NoDataClassParamValue = "someTestData"; - using var response = await client.GetAsync($"/api/users/{UserId}/{NoDataClassParamValue}?{QueryParamName}=foo"); + using var response = await client.GetAsync($"/api/users/{UserId}/{NoDataClassParamValue}?{QueryParamName}=foo").ConfigureAwait(false); Assert.True(response.IsSuccessStatusCode); await WaitForLogRecordsAsync(logCollector, TimeSpan.FromSeconds(30)); @@ -186,7 +186,7 @@ await RunControllerAsync( async (logCollector, client) => { const string UserId = "testUserId"; - using var response = await client.GetAsync($"/api/users/{UserId}/someTestData?{QueryParamName}=foo"); + using var response = await client.GetAsync($"/api/users/{UserId}/someTestData?{QueryParamName}=foo").ConfigureAwait(false); Assert.True(response.IsSuccessStatusCode); await WaitForLogRecordsAsync(logCollector, TimeSpan.FromSeconds(30)); @@ -227,7 +227,7 @@ await RunControllerAsync( }), async (logCollector, client) => { - using var response = await client.GetAsync(RequestPath); + using var response = await client.GetAsync(RequestPath).ConfigureAwait(false); Assert.False(response.IsSuccessStatusCode); await WaitForLogRecordsAsync(logCollector, TimeSpan.FromSeconds(30)); diff --git a/test/Libraries/Microsoft.AspNetCore.Diagnostics.Middleware.Tests/Logging/AcceptanceTests.cs b/test/Libraries/Microsoft.AspNetCore.Diagnostics.Middleware.Tests/Logging/AcceptanceTests.cs index ca854e0d312..6eb305c95a1 100644 --- a/test/Libraries/Microsoft.AspNetCore.Diagnostics.Middleware.Tests/Logging/AcceptanceTests.cs +++ b/test/Libraries/Microsoft.AspNetCore.Diagnostics.Middleware.Tests/Logging/AcceptanceTests.cs @@ -169,7 +169,7 @@ await RunAsync( const string Content = "Client: hello!"; using var content = new StringContent(Content); - using var response = await client.PostAsync("/", content); + using var response = await client.PostAsync("/", content).ConfigureAwait(false); Assert.True(response.IsSuccessStatusCode); await WaitForLogRecordsAsync(logCollector, _defaultLogTimeout); @@ -229,7 +229,7 @@ await RunAsync( const string Content = "Client: hello!"; using var content = new StringContent(Content, null, requestContentType); - using var response = await client.PostAsync("/", content); + using var response = await client.PostAsync("/", content).ConfigureAwait(false); Assert.True(response.IsSuccessStatusCode); await WaitForLogRecordsAsync(logCollector, _defaultLogTimeout); @@ -294,7 +294,7 @@ async static (logCollector, client) => }; request.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(MediaTypeNames.Application.Json)); - using var response = await client.SendAsync(request); + using var response = await client.SendAsync(request).ConfigureAwait(false); Assert.True(response.IsSuccessStatusCode); await WaitForLogRecordsAsync(logCollector, _defaultLogTimeout, expectedRecords: 2); @@ -355,7 +355,7 @@ async static (logCollector, client) => using var httpMessage = new HttpRequestMessage(HttpMethod.Get, "/"); httpMessage.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(MediaTypeNames.Application.Json)); - using var response = await client.SendAsync(httpMessage); + using var response = await client.SendAsync(httpMessage).ConfigureAwait(false); Assert.True(response.IsSuccessStatusCode); await WaitForLogRecordsAsync(logCollector, _defaultLogTimeout); @@ -403,7 +403,7 @@ await RunAsync( }, async static (logCollector, client) => { - using var response = await client.DeleteAsync("/"); + using var response = await client.DeleteAsync("/").ConfigureAwait(false); Assert.True(response.IsSuccessStatusCode); await WaitForLogRecordsAsync(logCollector, _defaultLogTimeout); @@ -445,7 +445,7 @@ await RunAsync( async static (logCollector, client) => { const string RequestPath = "/api/users/123/add-task/345"; - using var response = await client.GetAsync(RequestPath); + using var response = await client.GetAsync(RequestPath).ConfigureAwait(false); Assert.True(response.IsSuccessStatusCode); await WaitForLogRecordsAsync(logCollector, _defaultLogTimeout); @@ -475,7 +475,7 @@ await RunAsync( }, async static (logCollector, client) => { - using var response = await client.DeleteAsync("/"); + using var response = await client.DeleteAsync("/").ConfigureAwait(false); Assert.True(response.IsSuccessStatusCode); await WaitForLogRecordsAsync(logCollector, _defaultLogTimeout, expectedRecords: 2); @@ -508,12 +508,12 @@ await RunAsync( static x => x.AddHttpLoggingRedaction().AddHttpLogging(x => x.CombineLogs = false), async static (logCollector, client) => { - using var firstResponse = await client.DeleteAsync("/"); + using var firstResponse = await client.DeleteAsync("/").ConfigureAwait(false); Assert.True(firstResponse.IsSuccessStatusCode); await WaitForLogRecordsAsync(logCollector, _defaultLogTimeout, expectedRecords: 2); - using var secondResponse = await client.DeleteAsync("/"); + using var secondResponse = await client.DeleteAsync("/").ConfigureAwait(false); Assert.True(secondResponse.IsSuccessStatusCode); await WaitForLogRecordsAsync(logCollector, _defaultLogTimeout, expectedRecords: 4); @@ -533,18 +533,20 @@ async static (logCollector, client) => var sixthRecord = logRecords[5].StructuredState; Assert.Equal(5, firstRecord!.Count); - Assert.Single(secondRecord!); + Assert.Equal(1, secondRecord!.Count); Assert.Equal(5, fourthRecord!.Count); - Assert.Single(fithRecord!); + Assert.Equal(1, fithRecord!.Count); Assert.DoesNotContain(firstRecord, x => x.Key == HttpLoggingTagNames.StatusCode); Assert.DoesNotContain(firstRecord, x => x.Key == HttpLoggingTagNames.Duration); - Assert.DoesNotContain(secondRecord!, x => x.Key == HttpLoggingTagNames.Duration); + Assert.DoesNotContain(secondRecord, x => x.Key == HttpLoggingTagNames.Duration); Assert.DoesNotContain(fourthRecord, x => x.Key == HttpLoggingTagNames.StatusCode); Assert.DoesNotContain(fourthRecord, x => x.Key == HttpLoggingTagNames.Duration); - Assert.DoesNotContain(fithRecord!, x => x.Key == HttpLoggingTagNames.Duration); + Assert.DoesNotContain(fithRecord, x => x.Key == HttpLoggingTagNames.Duration); - Assert.Single(secondRecord!, x => x.Key == HttpLoggingTagNames.StatusCode && x.Value == responseStatus); - Assert.Single(fithRecord!, x => x.Key == HttpLoggingTagNames.StatusCode && x.Value == responseStatus); + Assert.Equal(1, secondRecord!.Count); + Assert.Equal(1, fithRecord!.Count); + Assert.Single(secondRecord, x => x.Key == HttpLoggingTagNames.StatusCode && x.Value == responseStatus); + Assert.Single(fithRecord, x => x.Key == HttpLoggingTagNames.StatusCode && x.Value == responseStatus); Assert.Equal(2, thirdRecord!.Count); Assert.Equal(2, sixthRecord!.Count); @@ -664,7 +666,7 @@ await RunAsync( async static (logCollector, client) => { using var content = new StringContent("Client: hello!"); - using var response = await client.PostAsync("/", content); + using var response = await client.PostAsync("/", content).ConfigureAwait(false); Assert.True(response.IsSuccessStatusCode); @@ -694,7 +696,7 @@ await RunAsync( }), async (logCollector, client) => { - using var response = await client.GetAsync(httpPath); + using var response = await client.GetAsync(httpPath).ConfigureAwait(false); Assert.True(response.IsSuccessStatusCode); @@ -724,7 +726,7 @@ await RunAsync( }), async (logCollector, client) => { - using var response = await client.GetAsync(""); + using var response = await client.GetAsync("").ConfigureAwait(false); Assert.True(response.IsSuccessStatusCode); Assert.Equal(0, logCollector.Count); @@ -740,7 +742,7 @@ await RunAsync( .AddHttpLogEnricher(), async (logCollector, client) => { - using var response = await client.GetAsync(""); + using var response = await client.GetAsync("").ConfigureAwait(false); Assert.True(response.IsSuccessStatusCode); await WaitForLogRecordsAsync(logCollector, _defaultLogTimeout); diff --git a/test/Libraries/Microsoft.AspNetCore.HeaderParsing.Tests/ParserTests.cs b/test/Libraries/Microsoft.AspNetCore.HeaderParsing.Tests/ParserTests.cs index 4d7b5b32f62..c5637869c33 100644 --- a/test/Libraries/Microsoft.AspNetCore.HeaderParsing.Tests/ParserTests.cs +++ b/test/Libraries/Microsoft.AspNetCore.HeaderParsing.Tests/ParserTests.cs @@ -76,9 +76,7 @@ public void Cookkie_ReturnsParsedValue() { var sv = new StringValues("csrftoken=u32t4o3tb3gg43"); Assert.True(CookieHeaderValueListParser.Instance.TryParse(sv, out var result, out var error)); -#pragma warning disable xUnit2013 // Do not use equality check to check for collection size. Assert.Equal(1, result.Count); -#pragma warning restore xUnit2013 // Do not use equality check to check for collection size. Assert.Equal("csrftoken", result[0].Name.Value); Assert.Equal("u32t4o3tb3gg43", result[0].Value.Value); Assert.Null(error); @@ -204,9 +202,7 @@ public void MediaTypes_ReturnsParsedValue() { var sv = new StringValues("text/html; charset=UTF-8"); Assert.True(MediaTypeHeaderValueListParser.Instance.TryParse(sv, out var result, out var error)); -#pragma warning disable xUnit2013 // Do not use equality check to check for collection size. Assert.Equal(1, result.Count); -#pragma warning restore xUnit2013 // Do not use equality check to check for collection size. Assert.Equal("text/html", result[0].MediaType); Assert.Equal("UTF-8", result[0].Charset); Assert.Null(error); @@ -226,9 +222,7 @@ public void EntityTag_ReturnsParsedValue() { var sv = new StringValues("\"HelloWorld\""); Assert.True(EntityTagHeaderValueListParser.Instance.TryParse(sv, out var result, out var error)); -#pragma warning disable xUnit2013 // Do not use equality check to check for collection size. Assert.Equal(1, result!.Count); -#pragma warning restore xUnit2013 // Do not use equality check to check for collection size. Assert.Equal("\"HelloWorld\"", result[0].Tag); Assert.Null(error); } @@ -247,9 +241,7 @@ public void StringQuality_ReturnsParsedValue() { var sv = new StringValues("en-US"); Assert.True(StringWithQualityHeaderValueListParser.Instance.TryParse(sv, out var result, out var error)); -#pragma warning disable xUnit2013 // Do not use equality check to check for collection size. Assert.Equal(1, result!.Count); -#pragma warning restore xUnit2013 // Do not use equality check to check for collection size. Assert.Equal("en-US", result[0].Value); Assert.Null(error); } @@ -309,9 +301,7 @@ public void Range_ReturnsParsedValue() var sv = new StringValues("bytes=200-1000"); Assert.True(RangeHeaderValueParser.Instance.TryParse(sv, out var result, out var error)); Assert.Equal("bytes", result!.Unit); -#pragma warning disable xUnit2013 // Do not use equality check to check for collection size. Assert.Equal(1, result.Ranges.Count); -#pragma warning restore xUnit2013 // Do not use equality check to check for collection size. Assert.Equal(200, result.Ranges.Single().From); Assert.Equal(1000, result.Ranges.Single().To); Assert.Null(error); diff --git a/test/Libraries/Microsoft.Extensions.AsyncState.Tests/AsyncStateTests.cs b/test/Libraries/Microsoft.Extensions.AsyncState.Tests/AsyncStateTests.cs index 371aa55328f..f7a7b050eb1 100644 --- a/test/Libraries/Microsoft.Extensions.AsyncState.Tests/AsyncStateTests.cs +++ b/test/Libraries/Microsoft.Extensions.AsyncState.Tests/AsyncStateTests.cs @@ -29,7 +29,7 @@ static Task SetAsyncContext(AsyncState state, IThing context, AsyncStateToken to return Task.CompletedTask; } - await SetAsyncContext(state, context, token); + await SetAsyncContext(state, context, token).ConfigureAwait(false); Assert.Same(context, state.Get(token)); } diff --git a/test/Libraries/Microsoft.Extensions.Compliance.Testing.Tests/RedactionFakesAcceptanceTests.cs b/test/Libraries/Microsoft.Extensions.Compliance.Testing.Tests/RedactionFakesAcceptanceTests.cs index e287695e120..1ec6b2e71dd 100644 --- a/test/Libraries/Microsoft.Extensions.Compliance.Testing.Tests/RedactionFakesAcceptanceTests.cs +++ b/test/Libraries/Microsoft.Extensions.Compliance.Testing.Tests/RedactionFakesAcceptanceTests.cs @@ -1,4 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System; @@ -220,9 +220,7 @@ public void RedactionFakesEventCollector_Can_Be_Obtained_From_DI_And_Show_Redact Assert.Equal(1, collector.LastRedactorRequested.SequenceNumber); Assert.Equal(dc, collector.LastRedactorRequested.DataClassifications); -#pragma warning disable xUnit2013 // Do not use equality check to check for collection size. Assert.Equal(1, collector.AllRedactorRequests.Count); -#pragma warning restore xUnit2013 // Do not use equality check to check for collection size. } [Fact] diff --git a/test/Libraries/Microsoft.Extensions.Diagnostics.Testing.Tests/Metrics/MetricCollectorTests.cs b/test/Libraries/Microsoft.Extensions.Diagnostics.Testing.Tests/Metrics/MetricCollectorTests.cs index dc17acbd3fd..a21977a9a62 100644 --- a/test/Libraries/Microsoft.Extensions.Diagnostics.Testing.Tests/Metrics/MetricCollectorTests.cs +++ b/test/Libraries/Microsoft.Extensions.Diagnostics.Testing.Tests/Metrics/MetricCollectorTests.cs @@ -413,6 +413,6 @@ public static void Snapshot() snap = collector.GetMeasurementSnapshot(true); Assert.Equal(3, snap.Count); - Assert.Empty(collector.GetMeasurementSnapshot()); + Assert.Equal(0, collector.GetMeasurementSnapshot().Count); } } diff --git a/test/Libraries/Microsoft.Extensions.Http.Diagnostics.Tests/Latency/Internal/HttpLatencyTelemetryHandlerTest.cs b/test/Libraries/Microsoft.Extensions.Http.Diagnostics.Tests/Latency/Internal/HttpLatencyTelemetryHandlerTest.cs index 2f787284b26..546a2bf088b 100644 --- a/test/Libraries/Microsoft.Extensions.Http.Diagnostics.Tests/Latency/Internal/HttpLatencyTelemetryHandlerTest.cs +++ b/test/Libraries/Microsoft.Extensions.Http.Diagnostics.Tests/Latency/Internal/HttpLatencyTelemetryHandlerTest.cs @@ -77,7 +77,7 @@ public async Task HttpLatencyTelemetryHandler_SetsLatencyContext() }; using var client = new System.Net.Http.HttpClient(handler); - await client.SendAsync(req, It.IsAny()); + await client.SendAsync(req, It.IsAny()).ConfigureAwait(false); Assert.Null(context.Get()); } diff --git a/test/Libraries/Microsoft.Extensions.Http.Diagnostics.Tests/Logging/AcceptanceTests.cs b/test/Libraries/Microsoft.Extensions.Http.Diagnostics.Tests/Logging/AcceptanceTests.cs index 2d505050e1b..603f7346d16 100644 --- a/test/Libraries/Microsoft.Extensions.Http.Diagnostics.Tests/Logging/AcceptanceTests.cs +++ b/test/Libraries/Microsoft.Extensions.Http.Diagnostics.Tests/Logging/AcceptanceTests.cs @@ -38,7 +38,7 @@ public async Task AddHttpClientLogEnricher_WhenNullEnricherRegistered_SkipsNullE .BuildServiceProvider(); using var httpClient = sp.GetRequiredService().CreateClient(); - using var _ = await httpClient.GetAsync(_unreachableRequestUri); + using var _ = await httpClient.GetAsync(_unreachableRequestUri).ConfigureAwait(false); var collector = sp.GetFakeLogCollector(); var logRecord = Assert.Single(collector.GetSnapshot()); @@ -69,7 +69,7 @@ public async Task HttpClientLogger_WhenEnricherThrows_EmitsErrorAndKeepsExecutio .BuildServiceProvider(); using var httpClient = sp.GetRequiredService().CreateClient(); - using var _ = await httpClient.GetAsync(_unreachableRequestUri); + using var _ = await httpClient.GetAsync(_unreachableRequestUri).ConfigureAwait(false); var collector = sp.GetFakeLogCollector(); Assert.Collection( collector.GetSnapshot(), @@ -111,7 +111,7 @@ public async Task AddHttpClientLogging_ServiceCollectionAndEnrichers_EnrichesLog RequestUri = _unreachableRequestUri, }; - _ = await httpClient.SendAsync(httpRequestMessage); + _ = await httpClient.SendAsync(httpRequestMessage).ConfigureAwait(false); var collector = sp.GetFakeLogCollector(); var logRecord = collector.GetSnapshot().Single(logRecord => logRecord.Category == LoggingCategory); @@ -248,7 +248,7 @@ public async Task AddHttpClientLogging_WithTypedHttpClients_WorksCorrectly() httpRequestMessage.Headers.Add("requestHeader", "Request Value"); httpRequestMessage.Headers.Add("ReQuEStHeAdEr2", new List { "Request Value 2", "Request Value 3" }); - var content = await firstClient!.SendRequest(httpRequestMessage); + var content = await firstClient!.SendRequest(httpRequestMessage).ConfigureAwait(false); var collector = provider.GetFakeLogCollector(); var responseStream = await content.Content.ReadAsStreamAsync(); var buffer = new byte[10000]; @@ -270,7 +270,7 @@ public async Task AddHttpClientLogging_WithTypedHttpClients_WorksCorrectly() httpRequestMessage2.Headers.Add("requestHeader", "Request Value"); httpRequestMessage2.Headers.Add("ReQuEStHeAdEr2", new List { "Request Value 2", "Request Value 3" }); collector.Clear(); - content = await secondClient!.SendRequest(httpRequestMessage2); + content = await secondClient!.SendRequest(httpRequestMessage2).ConfigureAwait(false); responseStream = await content.Content.ReadAsStreamAsync(); buffer = new byte[20000]; _ = await responseStream.ReadAsync(buffer, 0, 20000); @@ -316,7 +316,7 @@ public async Task AddHttpClientLogging_RedactSensitiveParams(HttpRouteParameterR RequestRoute = "/v1/unit/{unitId}/users/{userId}" }); - _ = await httpClient.SendAsync(httpRequestMessage); + _ = await httpClient.SendAsync(httpRequestMessage).ConfigureAwait(false); var collector = sp.GetFakeLogCollector(); var logRecord = collector.GetSnapshot().Single(logRecord => logRecord.Category == LoggingCategory); @@ -357,7 +357,7 @@ public async Task AddHttpClientLogging_NamedHttpClient_RedactSensitiveParams(Htt RequestRoute = "/v1/unit/{unitId}/users/{userId}" }); - using var _ = await httpClient.SendAsync(httpRequestMessage); + using var _ = await httpClient.SendAsync(httpRequestMessage).ConfigureAwait(false); var collector = sp.GetFakeLogCollector(); var logRecord = collector.GetSnapshot().Single(logRecord => logRecord.Category == LoggingCategory); @@ -518,7 +518,7 @@ public async Task AddHttpClientLogging_DisablesNetScope() var client = provider.GetRequiredService().CreateClient("test"); using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Get, _unreachableRequestUri); - _ = await client.SendAsync(httpRequestMessage, HttpCompletionOption.ResponseHeadersRead); + _ = await client.SendAsync(httpRequestMessage, HttpCompletionOption.ResponseHeadersRead).ConfigureAwait(false); var collector = provider.GetFakeLogCollector(); var logRecord = collector.GetSnapshot().Single(l => l.Category == LoggingCategory); @@ -544,7 +544,7 @@ public async Task AddHttpClientLogging_CallFromOtherClient_HasBuiltInLogging() var client = provider.GetRequiredService().CreateClient("normal"); using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Get, _unreachableRequestUri); - _ = await client.SendAsync(httpRequestMessage, HttpCompletionOption.ResponseHeadersRead); + _ = await client.SendAsync(httpRequestMessage, HttpCompletionOption.ResponseHeadersRead).ConfigureAwait(false); var collector = provider.GetFakeLogCollector(); var logRecords = collector.GetSnapshot().Where(l => l.Category == "System.Net.Http.HttpClient.normal.LogicalHandler").ToList(); @@ -567,7 +567,7 @@ public async Task AddDefaultHttpClientLogging_DisablesNetScope() var client = provider.GetRequiredService().CreateClient("test"); using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Get, _unreachableRequestUri); - _ = await client.SendAsync(httpRequestMessage, HttpCompletionOption.ResponseHeadersRead); + _ = await client.SendAsync(httpRequestMessage, HttpCompletionOption.ResponseHeadersRead).ConfigureAwait(false); var collector = provider.GetFakeLogCollector(); var logRecord = collector.GetSnapshot().Single(l => l.Category == LoggingCategory); @@ -613,7 +613,7 @@ public async Task HttpClientLoggingHandler_LogsBodyDataUpToSpecifiedLimit(int li httpRequestMessage.Headers.Add("requestHeader", "Request Value"); httpRequestMessage.Headers.Add("ReQuEStHeAdEr2", new List { "Request Value 2", "Request Value 3" }); - var content = await client.SendAsync(httpRequestMessage, HttpCompletionOption.ResponseHeadersRead); + var content = await client.SendAsync(httpRequestMessage, HttpCompletionOption.ResponseHeadersRead).ConfigureAwait(false); var responseStream = await content.Content.ReadAsStreamAsync(); var length = (int)responseStream.Length > limit ? limit : (int)responseStream.Length; var buffer = new byte[length]; diff --git a/test/Libraries/Microsoft.Extensions.Http.Diagnostics.Tests/Logging/HttpClientLoggerTest.cs b/test/Libraries/Microsoft.Extensions.Http.Diagnostics.Tests/Logging/HttpClientLoggerTest.cs index 912bf8e9075..bb26597eb53 100644 --- a/test/Libraries/Microsoft.Extensions.Http.Diagnostics.Tests/Logging/HttpClientLoggerTest.cs +++ b/test/Libraries/Microsoft.Extensions.Http.Diagnostics.Tests/Logging/HttpClientLoggerTest.cs @@ -70,7 +70,7 @@ public async Task SendAsync_NullRequest_ThrowsException() using var client = new HttpClient(handler); var act = async () => - await client.SendAsync(null!, It.IsAny()); + await client.SendAsync(null!, It.IsAny()).ConfigureAwait(false); await Assert.ThrowsAsync(act); } @@ -105,7 +105,7 @@ public async Task SendAsync_HttpRequestException_ThrowsException() using var client = new HttpClient(handler); var act = async () => - await client.SendAsync(httpRequestMessage, It.IsAny()); + await client.SendAsync(httpRequestMessage, It.IsAny()).ConfigureAwait(false); var actualException = await Assert.ThrowsAsync(act); Assert.Same(exception, actualException); @@ -148,7 +148,7 @@ public async Task Logger_WhenReadRequestAsyncThrows_DoesntThrow() using var httpClient = new HttpClient(handler); var act = async () => - await httpClient.SendAsync(httpRequestMessage, It.IsAny()); + await httpClient.SendAsync(httpRequestMessage, It.IsAny()).ConfigureAwait(false); var exception = await Record.ExceptionAsync(act); Assert.Null(exception); @@ -234,7 +234,7 @@ public async Task HttpLoggingHandler_AllOptions_LogsOutgoingRequest() new TestingHandlerStub((_, _) => Task.FromResult(httpResponseMessage))); using var client = new HttpClient(handler); - await client.SendAsync(httpRequestMessage, It.IsAny()); + await client.SendAsync(httpRequestMessage, It.IsAny()).ConfigureAwait(false); var logRecords = fakeLogger.Collector.GetSnapshot(); var logRecord = Assert.Single(logRecords); @@ -330,7 +330,7 @@ public async Task HttpLoggingHandler_AllOptionsWithLogRequestStart_LogsOutgoingR new TestingHandlerStub((_, _) => Task.FromResult(httpResponseMessage))); using var client = new HttpClient(handler); - await client.SendAsync(httpRequestMessage, It.IsAny()); + await client.SendAsync(httpRequestMessage, It.IsAny()).ConfigureAwait(false); var logRecords = fakeLogger.Collector.GetSnapshot(); Assert.Equal(2, logRecords.Count); @@ -550,7 +550,7 @@ public async Task HttpLoggingHandler_ReadResponseThrows_LogsException() using var client = new HttpClient(handler); var act = async () => await client .SendAsync(httpRequestMessage, It.IsAny()) -; + .ConfigureAwait(false); await Assert.ThrowsAsync(act); var logRecords = fakeLogger.Collector.GetSnapshot(); @@ -641,7 +641,7 @@ public async Task HttpLoggingHandler_AllOptionsTransferEncodingIsNotChunked_Logs new TestingHandlerStub((_, _) => Task.FromResult(httpResponseMessage))); using var client = new HttpClient(handler); - await client.SendAsync(httpRequestMessage, It.IsAny()); + await client.SendAsync(httpRequestMessage, It.IsAny()).ConfigureAwait(false); var logRecords = fakeLogger.Collector.GetSnapshot(); var logRecord = Assert.Single(logRecords); @@ -690,7 +690,7 @@ public async Task HttpLoggingHandler_WithEnrichers_CallsEnrichMethodExactlyOnce( Content = new StringContent(_fixture.Create(), Encoding.UTF8, TextPlain) }; - await client.SendAsync(httpRequestMessage, It.IsAny()); + await client.SendAsync(httpRequestMessage, It.IsAny()).ConfigureAwait(false); var logRecords = fakeLogger.Collector.GetSnapshot(); _ = Assert.Single(logRecords); @@ -732,7 +732,7 @@ public async Task HttpLoggingHandler_WithEnrichersAndLogRequestStart_CallsEnrich Content = new StringContent(_fixture.Create(), Encoding.UTF8, TextPlain) }; - await client.SendAsync(httpRequestMessage, It.IsAny()); + await client.SendAsync(httpRequestMessage, It.IsAny()).ConfigureAwait(false); var logRecords = fakeLogger.Collector.GetSnapshot(); Assert.Equal(2, logRecords.Count); @@ -770,7 +770,7 @@ public async Task HttpLoggingHandler_WithEnrichers_OneEnricherThrows_LogsEnrichm Content = new StringContent(_fixture.Create(), Encoding.UTF8, TextPlain) }; - await client.SendAsync(httpRequestMessage, It.IsAny()); + await client.SendAsync(httpRequestMessage, It.IsAny()).ConfigureAwait(false); var logRecords = fakeLogger.Collector.GetSnapshot(); Assert.Equal(2, logRecords.Count); @@ -913,7 +913,7 @@ public async Task HttpLoggingHandler_AllOptionsTransferEncodingChunked_LogsOutgo })); using var client = new HttpClient(handler); - await client.SendAsync(httpRequestMessage, It.IsAny()); + await client.SendAsync(httpRequestMessage, It.IsAny()).ConfigureAwait(false); var logRecords = fakeLogger.Collector.GetSnapshot(); var logRecord = Assert.Single(logRecords).GetStructuredState(); @@ -959,7 +959,7 @@ public async Task HttpLoggingHandler_OnDifferentHttpStatusCodes_LogsOutgoingRequ Content = new StringContent("request_content", Encoding.UTF8, TextPlain) }; - await client.SendAsync(httpRequestMessage, It.IsAny()); + await client.SendAsync(httpRequestMessage, It.IsAny()).ConfigureAwait(false); var logRecord = fakeLogger.Collector.GetSnapshot().Single(); Assert.Equal(expectedLogLevel, logRecord.Level); diff --git a/test/Libraries/Microsoft.Extensions.Http.Diagnostics.Tests/Logging/HttpClientLoggingExtensionsTest.cs b/test/Libraries/Microsoft.Extensions.Http.Diagnostics.Tests/Logging/HttpClientLoggingExtensionsTest.cs index 39b3be3b034..e57e817fefc 100644 --- a/test/Libraries/Microsoft.Extensions.Http.Diagnostics.Tests/Logging/HttpClientLoggingExtensionsTest.cs +++ b/test/Libraries/Microsoft.Extensions.Http.Diagnostics.Tests/Logging/HttpClientLoggingExtensionsTest.cs @@ -212,8 +212,8 @@ public async Task AddHttpClientLogging_GivenInvalidOptions_Throws() }) .Build(); - var act = async () => await host.StartAsync(); - await act.Should().ThrowAsync(); + var act = async () => await host.StartAsync().ConfigureAwait(false); + await act.Should().ThrowAsync().ConfigureAwait(false); } [Theory] @@ -325,7 +325,7 @@ public async Task AddHttpClientLogging_ServiceCollection_GivenInvalidOptions_Thr provider .GetRequiredService() .StartAsync(CancellationToken.None); - await act.Should().ThrowAsync(); + await act.Should().ThrowAsync().ConfigureAwait(false); } [Fact] diff --git a/test/Libraries/Microsoft.Extensions.Http.Diagnostics.Tests/Logging/HttpRequestBodyReaderTest.cs b/test/Libraries/Microsoft.Extensions.Http.Diagnostics.Tests/Logging/HttpRequestBodyReaderTest.cs index 695467be96c..cefc586040c 100644 --- a/test/Libraries/Microsoft.Extensions.Http.Diagnostics.Tests/Logging/HttpRequestBodyReaderTest.cs +++ b/test/Libraries/Microsoft.Extensions.Http.Diagnostics.Tests/Logging/HttpRequestBodyReaderTest.cs @@ -43,7 +43,7 @@ public async Task Reader_SimpleContent_ReadsContent() }; var httpRequestBodyReader = new HttpRequestBodyReader(options); - var requestBody = await httpRequestBodyReader.ReadAsync(httpRequest, CancellationToken.None); + var requestBody = await httpRequestBodyReader.ReadAsync(httpRequest, CancellationToken.None).ConfigureAwait(false); requestBody.Should().BeEquivalentTo(input); } @@ -63,7 +63,7 @@ public async Task Reader_EmptyContent_ErrorMessage() }; var httpRequestBodyReader = new HttpRequestBodyReader(options); - var requestBody = await httpRequestBodyReader.ReadAsync(httpRequest, CancellationToken.None); + var requestBody = await httpRequestBodyReader.ReadAsync(httpRequest, CancellationToken.None).ConfigureAwait(false); requestBody.Should().BeEquivalentTo(Constants.NoContent); } @@ -87,7 +87,7 @@ public async Task Reader_UnreadableContent_ErrorMessage( }; var httpRequestBodyReader = new HttpRequestBodyReader(options); - var requestBody = await httpRequestBodyReader.ReadAsync(httpRequest, CancellationToken.None); + var requestBody = await httpRequestBodyReader.ReadAsync(httpRequest, CancellationToken.None).ConfigureAwait(false); requestBody.Should().Be(Constants.UnreadableContent); } @@ -111,7 +111,7 @@ public async Task Reader_OperationCanceled_ThrowsTaskCanceledException() var token = new CancellationToken(true); var act = async () => - await httpRequestBodyReader.ReadAsync(httpRequest, token); + await httpRequestBodyReader.ReadAsync(httpRequest, token).ConfigureAwait(false); await act.Should().ThrowAsync() .Where(e => e.CancellationToken.IsCancellationRequested); @@ -136,7 +136,7 @@ public async Task Reader_BigContent_TrimsAtTheEnd([CombinatorialValues(32, 256, }; var httpRequestBodyReader = new HttpRequestBodyReader(options); - var requestBody = await httpRequestBodyReader.ReadAsync(httpRequest, CancellationToken.None); + var requestBody = await httpRequestBodyReader.ReadAsync(httpRequest, CancellationToken.None).ConfigureAwait(false); requestBody.Should().BeEquivalentTo(input.Substring(0, limit)); } @@ -160,7 +160,7 @@ public async Task Reader_SmallContentBigLimit_ReadsCorrectly([CombinatorialValue }; var httpRequestBodyReader = new HttpRequestBodyReader(options); - var requestBody = await httpRequestBodyReader.ReadAsync(httpRequest, CancellationToken.None); + var requestBody = await httpRequestBodyReader.ReadAsync(httpRequest, CancellationToken.None).ConfigureAwait(false); requestBody.Should().BeEquivalentTo(input.Substring(0, limit / 2)); } @@ -190,7 +190,7 @@ public async Task Reader_ReadingTakesTooLong_Timesout() var httpRequestBodyReader = new HttpRequestBodyReader(options); - var requestBody = await httpRequestBodyReader.ReadAsync(httpRequest, CancellationToken.None); + var requestBody = await httpRequestBodyReader.ReadAsync(httpRequest, CancellationToken.None).ConfigureAwait(false); var returnedValue = requestBody; var expectedValue = Constants.ReadCancelled; @@ -214,7 +214,7 @@ public async Task Reader_NullContent_ReturnsEmpty() var httpRequestBodyReader = new HttpRequestBodyReader(options); - var requestBody = await httpRequestBodyReader.ReadAsync(httpRequest, CancellationToken.None); + var requestBody = await httpRequestBodyReader.ReadAsync(httpRequest, CancellationToken.None).ConfigureAwait(false); requestBody.Should().Be(string.Empty); } @@ -235,7 +235,7 @@ public async Task Reader_MethodIsGet_ReturnsEmpty() var httpRequestBodyReader = new HttpRequestBodyReader(options); - var requestBody = await httpRequestBodyReader.ReadAsync(httpRequest, CancellationToken.None); + var requestBody = await httpRequestBodyReader.ReadAsync(httpRequest, CancellationToken.None).ConfigureAwait(false); requestBody.Should().Be(string.Empty); } diff --git a/test/Libraries/Microsoft.Extensions.Http.Diagnostics.Tests/Logging/HttpRequestReaderTest.cs b/test/Libraries/Microsoft.Extensions.Http.Diagnostics.Tests/Logging/HttpRequestReaderTest.cs index 05199b9f855..cb3b5cabb2f 100644 --- a/test/Libraries/Microsoft.Extensions.Http.Diagnostics.Tests/Logging/HttpRequestReaderTest.cs +++ b/test/Libraries/Microsoft.Extensions.Http.Diagnostics.Tests/Logging/HttpRequestReaderTest.cs @@ -98,8 +98,8 @@ public async Task ReadAsync_AllData_ReturnsLogRecord() var logRecord = new LogRecord(); var requestHeadersBuffer = new List>(); var responseHeadersBuffer = new List>(); - await reader.ReadRequestAsync(logRecord, httpRequestMessage, requestHeadersBuffer, CancellationToken.None); - await reader.ReadResponseAsync(logRecord, httpResponseMessage, responseHeadersBuffer, CancellationToken.None); + await reader.ReadRequestAsync(logRecord, httpRequestMessage, requestHeadersBuffer, CancellationToken.None).ConfigureAwait(false); + await reader.ReadResponseAsync(logRecord, httpResponseMessage, responseHeadersBuffer, CancellationToken.None).ConfigureAwait(false); logRecord.Should().BeEquivalentTo( expectedRecord, @@ -162,8 +162,8 @@ public async Task ReadAsync_NoHost_ReturnsLogRecordWithoutHost() var actualRecord = new LogRecord(); var requestHeadersBuffer = new List>(); var responseHeadersBuffer = new List>(); - await reader.ReadRequestAsync(actualRecord, httpRequestMessage, requestHeadersBuffer, CancellationToken.None); - await reader.ReadResponseAsync(actualRecord, httpResponseMessage, responseHeadersBuffer, CancellationToken.None); + await reader.ReadRequestAsync(actualRecord, httpRequestMessage, requestHeadersBuffer, CancellationToken.None).ConfigureAwait(false); + await reader.ReadResponseAsync(actualRecord, httpResponseMessage, responseHeadersBuffer, CancellationToken.None).ConfigureAwait(false); actualRecord.Should().BeEquivalentTo( expectedRecord, @@ -243,8 +243,8 @@ public async Task ReadAsync_AllDataWithRequestMetadataSet_ReturnsLogRecord() var requestHeadersBuffer = new List>(); var responseHeadersBuffer = new List>(); var actualRecord = new LogRecord(); - await reader.ReadRequestAsync(actualRecord, httpRequestMessage, requestHeadersBuffer, CancellationToken.None); - await reader.ReadResponseAsync(actualRecord, httpResponseMessage, responseHeadersBuffer, CancellationToken.None); + await reader.ReadRequestAsync(actualRecord, httpRequestMessage, requestHeadersBuffer, CancellationToken.None).ConfigureAwait(false); + await reader.ReadResponseAsync(actualRecord, httpResponseMessage, responseHeadersBuffer, CancellationToken.None).ConfigureAwait(false); actualRecord.Should().BeEquivalentTo( expectedRecord, @@ -326,8 +326,8 @@ public async Task ReadAsync_FormatRequestPathDisabled_ReturnsLogRecordWithRoute( var requestHeadersBuffer = new List>(); var responseHeadersBuffer = new List>(); var actualRecord = new LogRecord(); - await reader.ReadRequestAsync(actualRecord, httpRequestMessage, requestHeadersBuffer, CancellationToken.None); - await reader.ReadResponseAsync(actualRecord, httpResponseMessage, responseHeadersBuffer, CancellationToken.None); + await reader.ReadRequestAsync(actualRecord, httpRequestMessage, requestHeadersBuffer, CancellationToken.None).ConfigureAwait(false); + await reader.ReadResponseAsync(actualRecord, httpResponseMessage, responseHeadersBuffer, CancellationToken.None).ConfigureAwait(false); actualRecord.Should().BeEquivalentTo( expectedRecord, @@ -392,7 +392,7 @@ public async Task ReadAsync_RouteParameterRedactionModeNone_ReturnsLogRecordWith var requestHeadersBuffer = new List>(); var responseHeadersBuffer = new List>(); var actualRecord = new LogRecord(); - await reader.ReadRequestAsync(actualRecord, httpRequestMessage, requestHeadersBuffer, CancellationToken.None); + await reader.ReadRequestAsync(actualRecord, httpRequestMessage, requestHeadersBuffer, CancellationToken.None).ConfigureAwait(false); actualRecord.Should().BeEquivalentTo( expectedRecord, @@ -469,8 +469,8 @@ public async Task ReadAsync_RequestMetadataRequestNameSetAndRouteMissing_Returns var requestHeadersBuffer = new List>(); var responseHeadersBuffer = new List>(); var actualRecord = new LogRecord(); - await reader.ReadRequestAsync(actualRecord, httpRequestMessage, requestHeadersBuffer, CancellationToken.None); - await reader.ReadResponseAsync(actualRecord, httpResponseMessage, responseHeadersBuffer, CancellationToken.None); + await reader.ReadRequestAsync(actualRecord, httpRequestMessage, requestHeadersBuffer, CancellationToken.None).ConfigureAwait(false); + await reader.ReadResponseAsync(actualRecord, httpResponseMessage, responseHeadersBuffer, CancellationToken.None).ConfigureAwait(false); actualRecord.Should().BeEquivalentTo( expectedRecord, @@ -546,8 +546,8 @@ public async Task ReadAsync_NoMetadataUsesRedactedString_ReturnsLogRecord() var requestHeadersBuffer = new List>(); var responseHeadersBuffer = new List>(); var actualRecord = new LogRecord(); - await reader.ReadRequestAsync(actualRecord, httpRequestMessage, requestHeadersBuffer, CancellationToken.None); - await reader.ReadResponseAsync(actualRecord, httpResponseMessage, responseHeadersBuffer, CancellationToken.None); + await reader.ReadRequestAsync(actualRecord, httpRequestMessage, requestHeadersBuffer, CancellationToken.None).ConfigureAwait(false); + await reader.ReadResponseAsync(actualRecord, httpResponseMessage, responseHeadersBuffer, CancellationToken.None).ConfigureAwait(false); actualRecord.Should().BeEquivalentTo( expectedRecord, @@ -623,8 +623,8 @@ public async Task ReadAsync_MetadataWithoutRequestRouteOrNameUsesConstants_Retur var requestHeadersBuffer = new List>(); var responseHeadersBuffer = new List>(); var actualRecord = new LogRecord(); - await reader.ReadRequestAsync(actualRecord, httpRequestMessage, requestHeadersBuffer, CancellationToken.None); - await reader.ReadResponseAsync(actualRecord, httpResponseMessage, responseHeadersBuffer, CancellationToken.None); + await reader.ReadRequestAsync(actualRecord, httpRequestMessage, requestHeadersBuffer, CancellationToken.None).ConfigureAwait(false); + await reader.ReadResponseAsync(actualRecord, httpResponseMessage, responseHeadersBuffer, CancellationToken.None).ConfigureAwait(false); actualRecord.Should().BeEquivalentTo( expectedRecord, diff --git a/test/Libraries/Microsoft.Extensions.Http.Diagnostics.Tests/Logging/HttpResponseBodyReaderTest.cs b/test/Libraries/Microsoft.Extensions.Http.Diagnostics.Tests/Logging/HttpResponseBodyReaderTest.cs index c23568ddf80..6f4eebafb39 100644 --- a/test/Libraries/Microsoft.Extensions.Http.Diagnostics.Tests/Logging/HttpResponseBodyReaderTest.cs +++ b/test/Libraries/Microsoft.Extensions.Http.Diagnostics.Tests/Logging/HttpResponseBodyReaderTest.cs @@ -42,7 +42,7 @@ public async Task Reader_SimpleContent_ReadsContent() Content = new StringContent(expectedContentBody, Encoding.UTF8, "text/plain") }; - var responseBody = await httpResponseBodyReader.ReadAsync(httpResponse, CancellationToken.None); + var responseBody = await httpResponseBodyReader.ReadAsync(httpResponse, CancellationToken.None).ConfigureAwait(false); responseBody.Should().BeEquivalentTo(expectedContentBody); } @@ -61,7 +61,7 @@ public async Task Reader_EmptyContent_ErrorMessage() }; var httpResponseBodyReader = new HttpResponseBodyReader(options); - var responseBody = await httpResponseBodyReader.ReadAsync(httpResponse, CancellationToken.None); + var responseBody = await httpResponseBodyReader.ReadAsync(httpResponse, CancellationToken.None).ConfigureAwait(false); responseBody.Should().Be(Constants.NoContent); } @@ -85,7 +85,7 @@ public async Task Reader_UnreadableContent_ErrorMessage( Content = new StringContent(expectedContentBody, Encoding.UTF8, contentType) }; - var responseBody = await httpResponseBodyReader.ReadAsync(httpResponse, CancellationToken.None); + var responseBody = await httpResponseBodyReader.ReadAsync(httpResponse, CancellationToken.None).ConfigureAwait(false); responseBody.Should().Be(Constants.UnreadableContent); } @@ -129,7 +129,7 @@ public async Task Reader_BigContent_TrimsAtTheEnd([CombinatorialValues(32, 256, Content = new StringContent(bigContent, Encoding.UTF8, "text/plain") }; - var responseBody = await httpResponseBodyReader.ReadAsync(httpResponse, CancellationToken.None); + var responseBody = await httpResponseBodyReader.ReadAsync(httpResponse, CancellationToken.None).ConfigureAwait(false); responseBody.Should().Be(bigContent.Substring(0, limit)); } @@ -156,7 +156,7 @@ public async Task Reader_ReadingTakesTooLong_TimesOut() httpResponse.Content.Headers.Add("Content-type", "text/plain"); - var requestBody = await httpResponseBodyReader.ReadAsync(httpResponse, CancellationToken.None); + var requestBody = await httpResponseBodyReader.ReadAsync(httpResponse, CancellationToken.None).ConfigureAwait(false); requestBody.Should().Be(Constants.ReadCancelled); } diff --git a/test/Libraries/Microsoft.Extensions.Telemetry.Abstractions.Tests/Logging/LoggerMessageStateTests.cs b/test/Libraries/Microsoft.Extensions.Telemetry.Abstractions.Tests/Logging/LoggerMessageStateTests.cs index f4aa8b323d2..8a7af10fbf0 100644 --- a/test/Libraries/Microsoft.Extensions.Telemetry.Abstractions.Tests/Logging/LoggerMessageStateTests.cs +++ b/test/Libraries/Microsoft.Extensions.Telemetry.Abstractions.Tests/Logging/LoggerMessageStateTests.cs @@ -129,7 +129,6 @@ public static void CollectorContract() [Fact] public static void ReadOnlyListContract() { -#pragma warning disable xUnit2013 // Do not use equality check to check for collection size. const string PropName = "Property Name"; const string Value = "Value"; @@ -171,6 +170,5 @@ public static void ReadOnlyListContract() } Assert.Equal(1, count); -#pragma warning restore xUnit2013 // Do not use equality check to check for collection size. } } diff --git a/test/Libraries/Microsoft.Extensions.TimeProvider.Testing.Tests/FakeTimeProviderTests.cs b/test/Libraries/Microsoft.Extensions.TimeProvider.Testing.Tests/FakeTimeProviderTests.cs index 04da7822ef0..66561a30af9 100644 --- a/test/Libraries/Microsoft.Extensions.TimeProvider.Testing.Tests/FakeTimeProviderTests.cs +++ b/test/Libraries/Microsoft.Extensions.TimeProvider.Testing.Tests/FakeTimeProviderTests.cs @@ -300,7 +300,7 @@ public async Task WaitAsync_Cancel() cts.Cancel(); #pragma warning disable VSTHRD003 // Avoid awaiting foreign Tasks - await Assert.ThrowsAsync(() => t); + await Assert.ThrowsAsync(() => t).ConfigureAwait(false); #pragma warning restore VSTHRD003 // Avoid awaiting foreign Tasks } diff --git a/test/Libraries/Microsoft.Extensions.TimeProvider.Testing.Tests/TimerTests.cs b/test/Libraries/Microsoft.Extensions.TimeProvider.Testing.Tests/TimerTests.cs index ec59d4a2ddd..4ef71e78ce5 100644 --- a/test/Libraries/Microsoft.Extensions.TimeProvider.Testing.Tests/TimerTests.cs +++ b/test/Libraries/Microsoft.Extensions.TimeProvider.Testing.Tests/TimerTests.cs @@ -138,7 +138,7 @@ public async Task TaskDelayWithFakeTimeProviderAdvanced() var fakeTimeProvider = new FakeTimeProvider(); using var cancellationTokenSource = new CancellationTokenSource(TimeSpan.FromMilliseconds(1000)); - var task = fakeTimeProvider.Delay(TimeSpan.FromMilliseconds(10000), cancellationTokenSource.Token); + var task = fakeTimeProvider.Delay(TimeSpan.FromMilliseconds(10000), cancellationTokenSource.Token).ConfigureAwait(false); fakeTimeProvider.Advance(TimeSpan.FromMilliseconds(10000)); @@ -158,7 +158,7 @@ await Assert.ThrowsAsync(async () => await fakeTimeProvider.Delay( TimeSpan.FromMilliseconds(10000), cancellationTokenSource.Token) -; + .ConfigureAwait(false); }); } From 9a48509f241e45e1ab3f93d09d257d2552795aa6 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Thu, 9 Nov 2023 23:05:31 +0000 Subject: [PATCH 095/172] Update dependencies from https://github.com/dotnet/arcade build 20231106.5 (#4700) [main] Update dependencies from dotnet/arcade --- eng/Version.Details.xml | 8 ++++---- global.json | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index f68eebe5b6d..514de831221 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -170,13 +170,13 @@ - + https://github.com/dotnet/arcade - a57022b44f3ff23de925530ea1d27da9701aed57 + 080141bf0f9f15408bb6eb8e301b23bddf81d054 - + https://github.com/dotnet/arcade - a57022b44f3ff23de925530ea1d27da9701aed57 + 080141bf0f9f15408bb6eb8e301b23bddf81d054 diff --git a/global.json b/global.json index d7d4337e6f6..fe83f439b53 100644 --- a/global.json +++ b/global.json @@ -16,7 +16,7 @@ "msbuild-sdks": { "Microsoft.Build.NoTargets": "3.7.0", "Microsoft.Build.Traversal": "3.2.0", - "Microsoft.DotNet.Arcade.Sdk": "8.0.0-beta.23525.4", - "Microsoft.DotNet.Helix.Sdk": "8.0.0-beta.23525.4" + "Microsoft.DotNet.Arcade.Sdk": "8.0.0-beta.23556.5", + "Microsoft.DotNet.Helix.Sdk": "8.0.0-beta.23556.5" } } From 32b81ebb1d5ce0c3c0eb63c76d01310f31f9b8bc Mon Sep 17 00:00:00 2001 From: Jose Perez Rodriguez Date: Thu, 9 Nov 2023 21:16:06 -0800 Subject: [PATCH 096/172] Bringing back fixes that were done in main (#4705) --- .github/fabricbot.json | 13 +------ .github/workflows/backport.yml | 35 +++++++++++++++++++ .gitignore | 1 + docs/building.md | 30 ++++++++++------ .../ExceptionSummarizer.cs | 3 +- .../Enrichment/ILogEnricher.cs | 2 +- src/Shared/Pools/PooledListPolicy.cs | 3 +- .../CallAnalysis/ArraysTests.cs | 2 +- .../CallAnalysis/LegacyCollectionTests.cs | 2 +- .../CallAnalysis/LegacyLoggingTests.Extra.cs | 16 ++++----- .../Resources/RoslynTestUtils.cs | 2 +- .../Metrics/MetricCollectorTests.cs | 2 +- .../Logging/LoggerMessageStateTests.cs | 2 ++ 13 files changed, 74 insertions(+), 39 deletions(-) create mode 100644 .github/workflows/backport.yml diff --git a/.github/fabricbot.json b/.github/fabricbot.json index 95f3d618c9b..f176f70dc95 100644 --- a/.github/fabricbot.json +++ b/.github/fabricbot.json @@ -565,17 +565,6 @@ }, "disabled": false }, - { - "taskType": "trigger", - "capabilityId": "ReleaseAnnouncement", - "subCapability": "ReleaseAnnouncement", - "version": "1.0", - "config": { - "taskName": "Release announcement", - "prReply": "The fix is included in ${pkgName} ${version}.", - "issueReply": "Fixed in ${pkgName} ${version}." - } - }, { "taskType": "trigger", "capabilityId": "InPrLabel", @@ -637,7 +626,7 @@ { "name": "addMilestone", "parameters": { - "milestoneName": "8.0 RC1" + "milestoneName": "8.1" } } ], diff --git a/.github/workflows/backport.yml b/.github/workflows/backport.yml new file mode 100644 index 00000000000..c9cc8ac2184 --- /dev/null +++ b/.github/workflows/backport.yml @@ -0,0 +1,35 @@ +name: Backport PR to branch +on: + issue_comment: + types: [created] + schedule: + # once a day at 13:00 UTC to cleanup old runs + - cron: '0 13 * * *' + +permissions: + contents: write + issues: write + pull-requests: write + actions: write + +jobs: + backport: + if: ${{ contains(github.event.comment.body, '/backport to') || github.event_name == 'schedule' }} + uses: dotnet/arcade/.github/workflows/backport-base.yml@main + with: + pr_description_template: | + Backport of #%source_pr_number% to %target_branch% + + /cc %cc_users% + + ## Customer Impact + + ## Testing + + ## Risk + + **IMPORTANT**: If this backport is for a servicing release, please verify that: + + - The PR target branch is `release/X.0-staging`, not `release/X.0`. + + - If the change touches code that ships in a NuGet package, you have added the necessary [package authoring](https://github.com/dotnet/runtime/blob/main/docs/project/library-servicing.md) and gotten it explicitly reviewed. \ No newline at end of file diff --git a/.gitignore b/.gitignore index 7025b580ae0..7620aeb9169 100644 --- a/.gitignore +++ b/.gitignore @@ -38,6 +38,7 @@ bld/ .vs/ .build/ .vscode +!.vscode/settings.json # MSTest test Results [Tt]est[Rr]esult*/ diff --git a/docs/building.md b/docs/building.md index 023e951bb57..53dccbe4c3e 100644 --- a/docs/building.md +++ b/docs/building.md @@ -1,15 +1,23 @@ # Build instructions -- [Introduction](#introduction) -- [Ubuntu](#ubuntu) - * [Building from command line](#building-from-command-line) - * [Building from Visual Studio Code](#building-from-visual-studio-code) -- [Windows](#windows) - * [Building from command line](#building-from-command-line-1) - * [Building from Visual Studio](#building-from-visual-studio) - * [Building from Visual Studio Code](#building-from-visual-studio-code-1) -- [Build outputs](#build-outputs) -- [Troubleshooting build errors](#troubleshooting-build-errors) +- [Build instructions](#build-instructions) + - [Introduction](#introduction) + - [Ubuntu](#ubuntu) + - [Building from command line](#building-from-command-line) + - [TL;DR](#tldr) + - [Various scripts to build and test the solution](#various-scripts-to-build-and-test-the-solution) + - [Building from Visual Studio Code](#building-from-visual-studio-code) + - [Windows](#windows) + - [Building from command line](#building-from-command-line-1) + - [TL;DR](#tldr-1) + - [Various scripts to build and test the solution](#various-scripts-to-build-and-test-the-solution-1) + - [Building from Visual Studio](#building-from-visual-studio) + - [TL;DR](#tldr-2) + - [Various scripts to build and test the solution](#various-scripts-to-build-and-test-the-solution-2) + - [Building from Visual Studio Code](#building-from-visual-studio-code-1) + - [Build outputs](#build-outputs) + - [Troubleshooting build errors](#troubleshooting-build-errors) + - [\`\`\`](#) ## Introduction @@ -45,7 +53,7 @@ Here are few commands that you will likely use the most: - `build.sh --restore`: to install the required .NET SDK, .NET tools and the toolset. This is equivalent to running `./restore.sh`. - `build.sh --build`: to build the solution1. - `build.sh --test`: to run all unit tests in the solution1. - - `build.sh --vs `: to generate a "filtered" solution and save it as `SDK.sln`. It also performs the "restore" operation. For example: `./build.sh --vs Http,Fakes`.
+ - `build.sh --vs `: to generate a "filtered" solution and save it as `SDK.sln`. It also performs the "restore" operation. Keywords can be any part of the name or path of project files you want to include. For example: `./build.sh --vs Http,Fakes,AspNetCore`.
If for some reason you wish to generate a solution with all projects you can pass `*` for the keyword, e.g.: `./build.sh --vs '*'` (Note: you have to escape the asterisk or use `set -f` to turn off expansion).
> Under the hood, this invokes `scripts/Slngen.ps1` script, which in turn executes [slngen tool][slngen-tool]. If you want to customize how the "filtered" solution is generated, you will need to invoke `scripts/Slngen.ps1` script directly.
Run `./scripts/Slngen.ps1 -help` for more details. diff --git a/src/Libraries/Microsoft.Extensions.Diagnostics.ExceptionSummarization/ExceptionSummarizer.cs b/src/Libraries/Microsoft.Extensions.Diagnostics.ExceptionSummarization/ExceptionSummarizer.cs index 4ef0ea261ff..65f9cf48f8d 100644 --- a/src/Libraries/Microsoft.Extensions.Diagnostics.ExceptionSummarization/ExceptionSummarizer.cs +++ b/src/Libraries/Microsoft.Extensions.Diagnostics.ExceptionSummarization/ExceptionSummarizer.cs @@ -31,8 +31,9 @@ public ExceptionSummarizer(IEnumerable providers) public ExceptionSummary Summarize(Exception exception) { _ = Throw.IfNull(exception); + var exceptionType = exception.GetType(); - var exceptionTypeName = exception.GetType().Name; + var exceptionTypeName = exceptionType.Name; // find a match for the exception type or a base type thereof var type = exceptionType; diff --git a/src/Libraries/Microsoft.Extensions.Telemetry.Abstractions/Enrichment/ILogEnricher.cs b/src/Libraries/Microsoft.Extensions.Telemetry.Abstractions/Enrichment/ILogEnricher.cs index 8961b8c5e37..6f5dd004964 100644 --- a/src/Libraries/Microsoft.Extensions.Telemetry.Abstractions/Enrichment/ILogEnricher.cs +++ b/src/Libraries/Microsoft.Extensions.Telemetry.Abstractions/Enrichment/ILogEnricher.cs @@ -4,7 +4,7 @@ namespace Microsoft.Extensions.Diagnostics.Enrichment; /// -/// Augments log records with additional properties. +/// Represents a component that augments log records with additional properties. /// public interface ILogEnricher { diff --git a/src/Shared/Pools/PooledListPolicy.cs b/src/Shared/Pools/PooledListPolicy.cs index b74469a0abe..4525bd54a6f 100644 --- a/src/Shared/Pools/PooledListPolicy.cs +++ b/src/Shared/Pools/PooledListPolicy.cs @@ -4,7 +4,6 @@ using System.Collections.Generic; using Microsoft.Extensions.ObjectPool; -#pragma warning disable CA1716 namespace Microsoft.Shared.Pools; /// @@ -19,7 +18,7 @@ private PooledListPolicy() { } - public override List Create() => new(); + public override List Create() => []; public override bool Return(List obj) { diff --git a/test/Analyzers/Microsoft.Analyzers.Extra.Tests/CallAnalysis/ArraysTests.cs b/test/Analyzers/Microsoft.Analyzers.Extra.Tests/CallAnalysis/ArraysTests.cs index 9e3afab7b6d..5aa6e3fdeca 100644 --- a/test/Analyzers/Microsoft.Analyzers.Extra.Tests/CallAnalysis/ArraysTests.cs +++ b/test/Analyzers/Microsoft.Analyzers.Extra.Tests/CallAnalysis/ArraysTests.cs @@ -122,7 +122,7 @@ public void Triggers() Assembly.GetAssembly(typeof(ImmutableDictionary<,>))!, Assembly.GetAssembly(typeof(FrozenDictionary<,>))!, }, - new[] { Source }).ConfigureAwait(false); + new[] { Source }); Assert.Equal(54, d.Count); for (int i = 0; i < d.Count; i++) diff --git a/test/Analyzers/Microsoft.Analyzers.Extra.Tests/CallAnalysis/LegacyCollectionTests.cs b/test/Analyzers/Microsoft.Analyzers.Extra.Tests/CallAnalysis/LegacyCollectionTests.cs index f1922509671..14f33e3773f 100644 --- a/test/Analyzers/Microsoft.Analyzers.Extra.Tests/CallAnalysis/LegacyCollectionTests.cs +++ b/test/Analyzers/Microsoft.Analyzers.Extra.Tests/CallAnalysis/LegacyCollectionTests.cs @@ -44,7 +44,7 @@ public void Foo() Assembly.GetAssembly(typeof(System.Collections.Queue))!, Assembly.GetAssembly(typeof(System.Collections.Specialized.HybridDictionary))! }, - new[] { Source }).ConfigureAwait(false); + new[] { Source }); Assert.Equal(8, d.Count); for (int i = 0; i < d.Count; i++) diff --git a/test/Analyzers/Microsoft.Analyzers.Extra.Tests/CallAnalysis/LegacyLoggingTests.Extra.cs b/test/Analyzers/Microsoft.Analyzers.Extra.Tests/CallAnalysis/LegacyLoggingTests.Extra.cs index 2b76844d56b..e638f0fb5c8 100644 --- a/test/Analyzers/Microsoft.Analyzers.Extra.Tests/CallAnalysis/LegacyLoggingTests.Extra.cs +++ b/test/Analyzers/Microsoft.Analyzers.Extra.Tests/CallAnalysis/LegacyLoggingTests.Extra.cs @@ -92,7 +92,7 @@ static partial class Log new CallAnalyzer(), new LegacyLoggingFixer(), new[] { Assembly.GetAssembly(typeof(ILogger))!, Assembly.GetAssembly(typeof(LoggerMessageAttribute))! }, - new[] { OriginalSource, OriginalTarget }).ConfigureAwait(false); + new[] { OriginalSource, OriginalTarget }); var actualSource = l[0]; var actualTarget = l[1]; @@ -170,7 +170,7 @@ static partial class Log new CallAnalyzer(), new LegacyLoggingFixer(), new[] { Assembly.GetAssembly(typeof(ILogger))! }, - new[] { OriginalSource, OriginalTarget }).ConfigureAwait(false); + new[] { OriginalSource, OriginalTarget }); actualSource = l[0]; actualTarget = l[1]; @@ -234,7 +234,7 @@ static partial class Log new LegacyLoggingFixer(), new[] { Assembly.GetAssembly(typeof(ILogger))!, Assembly.GetAssembly(typeof(LoggerMessageAttribute))! }, new[] { OriginalSource }, - extraFile: "Log.cs").ConfigureAwait(false); + extraFile: "Log.cs"); var actualSource = l[0]; var actualTarget = l[1]; @@ -297,7 +297,7 @@ static partial class Log new LegacyLoggingFixer(), new[] { Assembly.GetAssembly(typeof(ILogger))!, Assembly.GetAssembly(typeof(LoggerMessageAttribute))! }, new[] { OriginalSource }, - extraFile: "Log.cs").ConfigureAwait(false); + extraFile: "Log.cs"); var actualSource = l[0]; var actualTarget = l[1]; @@ -358,7 +358,7 @@ static partial class Log new LegacyLoggingFixer(), new[] { Assembly.GetAssembly(typeof(ILogger))!, Assembly.GetAssembly(typeof(LoggerMessageAttribute))! }, new[] { OriginalSource }, - extraFile: "Log.cs").ConfigureAwait(false); + extraFile: "Log.cs"); var actualSource = l[0]; var actualTarget = l[1]; @@ -434,7 +434,7 @@ static partial class Log new LegacyLoggingFixer(), new[] { Assembly.GetAssembly(typeof(ILogger))!, Assembly.GetAssembly(typeof(LoggerMessageAttribute))! }, new[] { OriginalSource }, - extraFile: "Log.cs").ConfigureAwait(false); + extraFile: "Log.cs"); var actualSource = l[0]; var actualTarget = l[1]; @@ -684,7 +684,7 @@ static partial class Log new CallAnalyzer(), new LegacyLoggingFixer(), new[] { Assembly.GetAssembly(typeof(ILogger))!, Assembly.GetAssembly(typeof(LoggerMessageAttribute))! }, - new[] { OrriginalSource, OrriginalTarget }).ConfigureAwait(false); + new[] { OrriginalSource, OrriginalTarget }); var actualSource = l[0]; var actualTarget = l[1]; @@ -746,7 +746,7 @@ static partial class Log new CallAnalyzer(), new LegacyLoggingFixer(), new[] { Assembly.GetAssembly(typeof(ILogger))!, Assembly.GetAssembly(typeof(LoggerMessageAttribute))! }, - new[] { OrriginalSource, OrriginalTarget }).ConfigureAwait(false); + new[] { OrriginalSource, OrriginalTarget }); var actualSource = l[0]; var actualTarget = l[1]; diff --git a/test/Analyzers/Microsoft.Analyzers.Extra.Tests/Resources/RoslynTestUtils.cs b/test/Analyzers/Microsoft.Analyzers.Extra.Tests/Resources/RoslynTestUtils.cs index bc80b98281f..f79f67bf0b9 100644 --- a/test/Analyzers/Microsoft.Analyzers.Extra.Tests/Resources/RoslynTestUtils.cs +++ b/test/Analyzers/Microsoft.Analyzers.Extra.Tests/Resources/RoslynTestUtils.cs @@ -146,7 +146,7 @@ public static void AssertDiagnostic(this string text, int spanNum, DiagnosticDes } catch (ArgumentOutOfRangeException) { - Assert.True(false, $"Unexpected warning {actual}"); + Assert.Fail($"Unexpected warning {actual}"); } } diff --git a/test/Libraries/Microsoft.Extensions.Diagnostics.Testing.Tests/Metrics/MetricCollectorTests.cs b/test/Libraries/Microsoft.Extensions.Diagnostics.Testing.Tests/Metrics/MetricCollectorTests.cs index a21977a9a62..dc17acbd3fd 100644 --- a/test/Libraries/Microsoft.Extensions.Diagnostics.Testing.Tests/Metrics/MetricCollectorTests.cs +++ b/test/Libraries/Microsoft.Extensions.Diagnostics.Testing.Tests/Metrics/MetricCollectorTests.cs @@ -413,6 +413,6 @@ public static void Snapshot() snap = collector.GetMeasurementSnapshot(true); Assert.Equal(3, snap.Count); - Assert.Equal(0, collector.GetMeasurementSnapshot().Count); + Assert.Empty(collector.GetMeasurementSnapshot()); } } diff --git a/test/Libraries/Microsoft.Extensions.Telemetry.Abstractions.Tests/Logging/LoggerMessageStateTests.cs b/test/Libraries/Microsoft.Extensions.Telemetry.Abstractions.Tests/Logging/LoggerMessageStateTests.cs index 8a7af10fbf0..f4aa8b323d2 100644 --- a/test/Libraries/Microsoft.Extensions.Telemetry.Abstractions.Tests/Logging/LoggerMessageStateTests.cs +++ b/test/Libraries/Microsoft.Extensions.Telemetry.Abstractions.Tests/Logging/LoggerMessageStateTests.cs @@ -129,6 +129,7 @@ public static void CollectorContract() [Fact] public static void ReadOnlyListContract() { +#pragma warning disable xUnit2013 // Do not use equality check to check for collection size. const string PropName = "Property Name"; const string Value = "Value"; @@ -170,5 +171,6 @@ public static void ReadOnlyListContract() } Assert.Equal(1, count); +#pragma warning restore xUnit2013 // Do not use equality check to check for collection size. } } From 0bf528b889cb1195e9a123d6794801fbc7b961e1 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Wed, 15 Nov 2023 17:08:12 +0000 Subject: [PATCH 097/172] Update dependencies from https://github.com/dotnet/arcade build 20231114.4 (#4726) [main] Update dependencies from dotnet/arcade --- NuGet.config | 3 +++ eng/Version.Details.xml | 8 ++++---- global.json | 8 ++++---- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/NuGet.config b/NuGet.config index 616a54902dc..3ac6622678d 100644 --- a/NuGet.config +++ b/NuGet.config @@ -3,6 +3,9 @@ + + + diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 514de831221..7b38bcb0697 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -170,13 +170,13 @@ - + https://github.com/dotnet/arcade - 080141bf0f9f15408bb6eb8e301b23bddf81d054 + 0aaeafef60933f87b0b50350313bb2fd77defb5d - + https://github.com/dotnet/arcade - 080141bf0f9f15408bb6eb8e301b23bddf81d054 + 0aaeafef60933f87b0b50350313bb2fd77defb5d diff --git a/global.json b/global.json index fe83f439b53..c8d8037117f 100644 --- a/global.json +++ b/global.json @@ -1,9 +1,9 @@ { "sdk": { - "version": "8.0.100-rtm.23506.1" + "version": "8.0.100" }, "tools": { - "dotnet": "8.0.100-rtm.23506.1", + "dotnet": "8.0.100", "runtimes": { "dotnet/x64": [ "6.0.22" @@ -16,7 +16,7 @@ "msbuild-sdks": { "Microsoft.Build.NoTargets": "3.7.0", "Microsoft.Build.Traversal": "3.2.0", - "Microsoft.DotNet.Arcade.Sdk": "8.0.0-beta.23556.5", - "Microsoft.DotNet.Helix.Sdk": "8.0.0-beta.23556.5" + "Microsoft.DotNet.Arcade.Sdk": "8.0.0-beta.23564.4", + "Microsoft.DotNet.Helix.Sdk": "8.0.0-beta.23564.4" } } From 0f548a1c4a91c87d15a3d6839a22de69e0cd2433 Mon Sep 17 00:00:00 2001 From: Scott DePouw Date: Fri, 17 Nov 2023 10:54:18 -0500 Subject: [PATCH 098/172] Fix typo in FakeTimeProvider.SetUtcNow doc comment (#4731) --- .../FakeTimeProvider.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Libraries/Microsoft.Extensions.TimeProvider.Testing/FakeTimeProvider.cs b/src/Libraries/Microsoft.Extensions.TimeProvider.Testing/FakeTimeProvider.cs index c408348842e..f6ef2a32fd1 100644 --- a/src/Libraries/Microsoft.Extensions.TimeProvider.Testing/FakeTimeProvider.cs +++ b/src/Libraries/Microsoft.Extensions.TimeProvider.Testing/FakeTimeProvider.cs @@ -89,7 +89,7 @@ public override DateTimeOffset GetUtcNow() /// Sets the date and time in the UTC time zone. /// /// The date and time in the UTC time zone. - /// if the supplied time value is before the curent time. + /// if the supplied time value is before the current time. public void SetUtcNow(DateTimeOffset value) { lock (Waiters) From 0daa893bc100f5aebfde28f086e65b846133cf00 Mon Sep 17 00:00:00 2001 From: Eric Erhardt Date: Sat, 18 Nov 2023 12:34:27 -0600 Subject: [PATCH 099/172] Update Polly to latest (#4729) The latest version has the fixes for native AOT support. --- eng/packages/General.props | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/eng/packages/General.props b/eng/packages/General.props index b128d272acc..c131e61c457 100644 --- a/eng/packages/General.props +++ b/eng/packages/General.props @@ -37,10 +37,10 @@ - - - - + + + + From f34d120d2654057a31dc96d7f86dc42629044472 Mon Sep 17 00:00:00 2001 From: Brennan Date: Sun, 19 Nov 2023 14:57:38 -0800 Subject: [PATCH 100/172] Use supported MVC dependency (#4734) --- eng/packages/TestOnly.props | 4 ++-- .../KubernetesProbesExtensionsTests.cs | 2 -- .../TcpEndpointHealthCheckExtensionsTests.cs | 2 -- 3 files changed, 2 insertions(+), 6 deletions(-) diff --git a/eng/packages/TestOnly.props b/eng/packages/TestOnly.props index b36c628403e..9e548d0c374 100644 --- a/eng/packages/TestOnly.props +++ b/eng/packages/TestOnly.props @@ -16,8 +16,8 @@
- - + + diff --git a/test/Libraries/Microsoft.Extensions.Diagnostics.Probes.Tests/KubernetesProbesExtensionsTests.cs b/test/Libraries/Microsoft.Extensions.Diagnostics.Probes.Tests/KubernetesProbesExtensionsTests.cs index b1ede440e6d..5e283a7bceb 100644 --- a/test/Libraries/Microsoft.Extensions.Diagnostics.Probes.Tests/KubernetesProbesExtensionsTests.cs +++ b/test/Libraries/Microsoft.Extensions.Diagnostics.Probes.Tests/KubernetesProbesExtensionsTests.cs @@ -8,7 +8,6 @@ using Microsoft.AspNetCore.TestHost; #else using Microsoft.AspNetCore.Builder; -using Microsoft.AspNetCore.Internal; #endif using System.Collections.Generic; using Microsoft.Extensions.Configuration; @@ -129,7 +128,6 @@ private static IWebHost CreateWebHost(Action configureServic return new WebHostBuilder() .ConfigureServices(configureServices) .Configure(app => app - .UseEndpointRouting() .UseRouter(routes => { }) .UseMvc()) .Build(); diff --git a/test/Libraries/Microsoft.Extensions.Diagnostics.Probes.Tests/TcpEndpointHealthCheckExtensionsTests.cs b/test/Libraries/Microsoft.Extensions.Diagnostics.Probes.Tests/TcpEndpointHealthCheckExtensionsTests.cs index 87043ae06ab..94ec7cfa4a8 100644 --- a/test/Libraries/Microsoft.Extensions.Diagnostics.Probes.Tests/TcpEndpointHealthCheckExtensionsTests.cs +++ b/test/Libraries/Microsoft.Extensions.Diagnostics.Probes.Tests/TcpEndpointHealthCheckExtensionsTests.cs @@ -6,7 +6,6 @@ #else using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; -using Microsoft.AspNetCore.Internal; #endif using System; using System.Collections.Generic; @@ -187,7 +186,6 @@ private static IWebHost CreateWebHost(Action configureServic return new WebHostBuilder() .ConfigureServices(configureServices) .Configure(app => app - .UseEndpointRouting() .UseRouter(routes => { }) .UseMvc()) .Build(); From c66f9474bed1d0d795a020f4431b8c74443f3750 Mon Sep 17 00:00:00 2001 From: Rafal Mzyk <45458298+rafal-mz@users.noreply.github.com> Date: Wed, 22 Nov 2023 15:12:39 +0100 Subject: [PATCH 101/172] Optimize resource utilization parser for linux (#4744) * Optimize resource utilization parser for linux * Change to remarks --------- Co-authored-by: rafalmzyk --- .../Linux/LinuxUtilizationParser.cs | 86 +++++++++---------- 1 file changed, 39 insertions(+), 47 deletions(-) diff --git a/src/Libraries/Microsoft.Extensions.Diagnostics.ResourceMonitoring/Linux/LinuxUtilizationParser.cs b/src/Libraries/Microsoft.Extensions.Diagnostics.ResourceMonitoring/Linux/LinuxUtilizationParser.cs index c91f7fc15cf..27f9398d506 100644 --- a/src/Libraries/Microsoft.Extensions.Diagnostics.ResourceMonitoring/Linux/LinuxUtilizationParser.cs +++ b/src/Libraries/Microsoft.Extensions.Diagnostics.ResourceMonitoring/Linux/LinuxUtilizationParser.cs @@ -4,15 +4,16 @@ using System; using System.Diagnostics.CodeAnalysis; using System.IO; -using Microsoft.Extensions.ObjectPool; using Microsoft.Shared.Diagnostics; using Microsoft.Shared.Pools; namespace Microsoft.Extensions.Diagnostics.ResourceMonitoring.Linux; -/// +/// /// Parses Linux files to retrieve resource utilization data. -/// +/// This class is not thread safe. +/// When the same instance is called by multiple threads it may return corrupted data. +/// internal sealed class LinuxUtilizationParser { /// @@ -77,21 +78,19 @@ internal sealed class LinuxUtilizationParser private readonly IFileSystem _fileSystem; private readonly long _userHz; - private readonly ObjectPool> _buffers; + private readonly BufferWriter _buffer = new(); public LinuxUtilizationParser(IFileSystem fileSystem, IUserHz userHz) { _fileSystem = fileSystem; _userHz = userHz.Value; - _buffers = BufferWriterPool.CreateBufferWriterPool(maxCapacity: 64); } public long GetCgroupCpuUsageInNanoseconds() { - var buffer = _buffers.Get(); - _fileSystem.ReadAll(_cpuacctUsage, buffer); + _fileSystem.ReadAll(_cpuacctUsage, _buffer); - var usage = buffer.WrittenSpan; + var usage = _buffer.WrittenSpan; _ = GetNextNumber(usage, out var nanoseconds); @@ -100,7 +99,7 @@ public long GetCgroupCpuUsageInNanoseconds() Throw.InvalidOperationException($"Could not get cpu usage from '{_cpuacctUsage}'. Expected positive number, but got '{new string(usage)}'."); } - _buffers.Return(buffer); + _buffer.Reset(); return nanoseconds; } @@ -111,15 +110,14 @@ public long GetHostCpuUsageInNanoseconds() const int NumberOfColumnsRepresentingCpuUsage = 8; const int NanosecondsInSecond = 1_000_000_000; - var buffer = _buffers.Get(); - _fileSystem.ReadFirstLine(_procStat, buffer); + _fileSystem.ReadFirstLine(_procStat, _buffer); - var stat = buffer.WrittenSpan; + var stat = _buffer.WrittenSpan; var total = 0L; - if (!buffer.WrittenSpan.StartsWith(StartingTokens)) + if (!_buffer.WrittenSpan.StartsWith(StartingTokens)) { - Throw.InvalidOperationException($"Expected proc/stat to start with '{StartingTokens}' but it was '{new string(buffer.WrittenSpan)}'."); + Throw.InvalidOperationException($"Expected proc/stat to start with '{StartingTokens}' but it was '{new string(_buffer.WrittenSpan)}'."); } stat = stat.Slice(StartingTokens.Length, stat.Length - StartingTokens.Length); @@ -142,7 +140,7 @@ public long GetHostCpuUsageInNanoseconds() stat = stat.Slice(next, stat.Length - next); } - _buffers.Return(buffer); + _buffer.Reset(); return (long)(total / (double)_userHz * NanosecondsInSecond); } @@ -166,10 +164,9 @@ public ulong GetAvailableMemoryInBytes() { const long UnsetCgroupMemoryLimit = 9_223_372_036_854_771_712; - var buffer = _buffers.Get(); - _fileSystem.ReadAll(_memoryLimitInBytes, buffer); + _fileSystem.ReadAll(_memoryLimitInBytes, _buffer); - var memoryBuffer = buffer.WrittenSpan; + var memoryBuffer = _buffer.WrittenSpan; _ = GetNextNumber(memoryBuffer, out var maybeMemory); if (maybeMemory == -1) @@ -177,23 +174,19 @@ public ulong GetAvailableMemoryInBytes() Throw.InvalidOperationException($"Could not parse '{_memoryLimitInBytes}' content. Expected to find available memory in bytes but got '{new string(memoryBuffer)}' instead."); } - _buffers.Return(buffer); + _buffer.Reset(); - if (maybeMemory == UnsetCgroupMemoryLimit) - { - return GetHostAvailableMemory(); - } - - return (ulong)maybeMemory; + return maybeMemory == UnsetCgroupMemoryLimit + ? GetHostAvailableMemory() + : (ulong)maybeMemory; } public ulong GetMemoryUsageInBytes() { const string TotalInactiveFile = "total_inactive_file"; - var buffer = _buffers.Get(); - _fileSystem.ReadAll(_memoryStat, buffer); - var memoryFile = buffer.WrittenSpan; + _fileSystem.ReadAll(_memoryStat, _buffer); + var memoryFile = _buffer.WrittenSpan; var index = memoryFile.IndexOf(TotalInactiveFile.AsSpan()); @@ -210,11 +203,11 @@ public ulong GetMemoryUsageInBytes() Throw.InvalidOperationException($"The value of total_inactive_file found in '{_memoryStat}' is not a positive number: '{new string(inactiveMemorySlice)}'."); } - buffer.Reset(); + _buffer.Reset(); - _fileSystem.ReadAll(_memoryUsageInBytes, buffer); + _fileSystem.ReadAll(_memoryUsageInBytes, _buffer); - var containerMemoryUsageFile = buffer.WrittenSpan; + var containerMemoryUsageFile = _buffer.WrittenSpan; var next = GetNextNumber(containerMemoryUsageFile, out var containerMemoryUsage); // this file format doesn't expect to contain anything after the number. @@ -224,7 +217,7 @@ public ulong GetMemoryUsageInBytes() $"We tried to read '{_memoryUsageInBytes}', and we expected to get a positive number but instead it was: '{new string(containerMemoryUsageFile)}'."); } - _buffers.Return(buffer); + _buffer.Reset(); var memoryUsage = containerMemoryUsage - inactiveMemory; @@ -243,9 +236,8 @@ public ulong GetHostAvailableMemory() // The value we are interested in starts with this. We just want to make sure it is true. const string MemTotal = "MemTotal:"; - var buffer = _buffers.Get(); - _fileSystem.ReadFirstLine(_memInfo, buffer); - var firstLine = buffer.WrittenSpan; + _fileSystem.ReadFirstLine(_memInfo, _buffer); + var firstLine = _buffer.WrittenSpan; if (!firstLine.StartsWith(MemTotal)) { @@ -279,7 +271,7 @@ public ulong GetHostAvailableMemory() $"We tried to convert total memory usage value from '{_memInfo}' to bytes, but we've got a unit that we don't recognize: '{new string(unit)}'.") }; - _buffers.Return(buffer); + _buffer.Reset(); return u; } @@ -291,9 +283,8 @@ public ulong GetHostAvailableMemory() /// public float GetHostCpuCount() { - var buffer = _buffers.Get(); - _fileSystem.ReadFirstLine(_cpuSetCpus, buffer); - var stats = buffer.WrittenSpan; + _fileSystem.ReadFirstLine(_cpuSetCpus, _buffer); + var stats = _buffer.WrittenSpan; var start = stats.IndexOf("-", StringComparison.Ordinal); @@ -313,7 +304,7 @@ public float GetHostCpuCount() Throw.InvalidOperationException($"Could not parse '{_cpuSetCpus}'. Expected integer based range separated by dash (like 0-8) but got '{new string(stats)}'."); } - _buffers.Return(buffer); + _buffer.Reset(); return endCpu - startCpu + 1; } @@ -354,13 +345,13 @@ private static int GetNextNumber(ReadOnlySpan buffer, out long number) private bool TryGetCpuUnitsFromCgroups(IFileSystem fileSystem, out float cpuUnits) { - var buffer = _buffers.Get(); - fileSystem.ReadFirstLine(_cpuCfsQuotaUs, buffer); + fileSystem.ReadFirstLine(_cpuCfsQuotaUs, _buffer); - var quotaBuffer = buffer.WrittenSpan; + var quotaBuffer = _buffer.WrittenSpan; if (quotaBuffer.IsEmpty || (quotaBuffer.Length == 2 && quotaBuffer[0] == '-' && quotaBuffer[1] == '1')) { + _buffer.Reset(); cpuUnits = -1; return false; } @@ -372,13 +363,14 @@ private bool TryGetCpuUnitsFromCgroups(IFileSystem fileSystem, out float cpuUnit Throw.InvalidOperationException($"Could not parse '{_cpuCfsQuotaUs}'. Expected an integer but got: '{new string(quotaBuffer)}'."); } - buffer.Reset(); + _buffer.Reset(); - fileSystem.ReadFirstLine(_cpuCfsPeriodUs, buffer); - var periodBuffer = buffer.WrittenSpan; + fileSystem.ReadFirstLine(_cpuCfsPeriodUs, _buffer); + var periodBuffer = _buffer.WrittenSpan; if (periodBuffer.IsEmpty || (periodBuffer.Length == 2 && periodBuffer[0] == '-' && periodBuffer[1] == '1')) { + _buffer.Reset(); cpuUnits = -1; return false; } @@ -390,7 +382,7 @@ private bool TryGetCpuUnitsFromCgroups(IFileSystem fileSystem, out float cpuUnit Throw.InvalidOperationException($"Could not parse '{_cpuCfsPeriodUs}'. Expected to get an integer but got: '{new string(periodBuffer)}'."); } - _buffers.Return(buffer); + _buffer.Reset(); cpuUnits = (float)quota / period; return true; From c8383902da237c8efd61a37808e444ac9b838f59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Ros?= Date: Wed, 22 Nov 2023 20:00:48 -0800 Subject: [PATCH 102/172] Fix component governance alerts (#4750) * Fix component governance alerts * Refactor --- eng/packages/General.props | 2 ++ .../Microsoft.Extensions.Diagnostics.Probes.Tests.csproj | 9 ++++++++- .../Microsoft.Extensions.Http.Diagnostics.Tests.csproj | 5 +++++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/eng/packages/General.props b/eng/packages/General.props index c131e61c457..457a789f0b4 100644 --- a/eng/packages/General.props +++ b/eng/packages/General.props @@ -71,6 +71,8 @@ + +
diff --git a/test/Libraries/Microsoft.Extensions.Diagnostics.Probes.Tests/Microsoft.Extensions.Diagnostics.Probes.Tests.csproj b/test/Libraries/Microsoft.Extensions.Diagnostics.Probes.Tests/Microsoft.Extensions.Diagnostics.Probes.Tests.csproj index 721e08d4cb8..d2fece93ad6 100644 --- a/test/Libraries/Microsoft.Extensions.Diagnostics.Probes.Tests/Microsoft.Extensions.Diagnostics.Probes.Tests.csproj +++ b/test/Libraries/Microsoft.Extensions.Diagnostics.Probes.Tests/Microsoft.Extensions.Diagnostics.Probes.Tests.csproj @@ -12,7 +12,14 @@ - + + + + + + + +
diff --git a/test/Libraries/Microsoft.Extensions.Http.Diagnostics.Tests/Microsoft.Extensions.Http.Diagnostics.Tests.csproj b/test/Libraries/Microsoft.Extensions.Http.Diagnostics.Tests/Microsoft.Extensions.Http.Diagnostics.Tests.csproj index a2d00f2e67f..44d17c5b2a4 100644 --- a/test/Libraries/Microsoft.Extensions.Http.Diagnostics.Tests/Microsoft.Extensions.Http.Diagnostics.Tests.csproj +++ b/test/Libraries/Microsoft.Extensions.Http.Diagnostics.Tests/Microsoft.Extensions.Http.Diagnostics.Tests.csproj @@ -30,5 +30,10 @@ + + + + + From 13a6288c9de8d8f83c40ae419803e6a990bf5825 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Ros?= Date: Tue, 28 Nov 2023 16:12:03 -0800 Subject: [PATCH 103/172] Improve AsyncState README (#4764) Co-authored-by: Igor Velikorossov --- src/Libraries/Microsoft.AspNetCore.AsyncState/README.md | 6 +++++- src/Libraries/Microsoft.Extensions.AsyncState/README.md | 7 ++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/Libraries/Microsoft.AspNetCore.AsyncState/README.md b/src/Libraries/Microsoft.AspNetCore.AsyncState/README.md index 1d9b79231e5..d5bc4f0a353 100644 --- a/src/Libraries/Microsoft.AspNetCore.AsyncState/README.md +++ b/src/Libraries/Microsoft.AspNetCore.AsyncState/README.md @@ -1,6 +1,8 @@ # Microsoft.AspNetCore.AsyncState -This provides the ability to store and retrieve state objects that flow with the current `HttpContext` across asynchronous operations. See `Microsoft.Extensions.AsyncState` for additional information. +This provides the ability to store and retrieve state objects that flow with the current `HttpContext` across asynchronous operations. See [Microsoft.Extensions.AsyncState](../Microsoft.Extensions.AsyncState/README.md) for additional information. + +The lifetime of the shared data is controlled automatically and will be the same as of `HttpContext`. ## Install the package @@ -28,6 +30,8 @@ The services can be registered using the following method: public static IServiceCollection AddAsyncStateHttpContext(this IServiceCollection services) ``` +Note: When calling `AddAsyncStateHttpContext()` there is no need to also invoke `AddAsyncState()` from the `Microsoft.Extensions.AsyncState` package. + ### Consuming Services The `IAsyncContext` can be injected wherever async state is needed. For example: diff --git a/src/Libraries/Microsoft.Extensions.AsyncState/README.md b/src/Libraries/Microsoft.Extensions.AsyncState/README.md index 4f855b3b6e6..a58555d0389 100644 --- a/src/Libraries/Microsoft.Extensions.AsyncState/README.md +++ b/src/Libraries/Microsoft.Extensions.AsyncState/README.md @@ -1,6 +1,11 @@ # Microsoft.Extensions.AsyncState -This provides the ability to store and retrieve state objects that flow with the current asynchronous context. +This provides the ability to store and retrieve objects that flow with the current asynchronous context. + +It has a few advantages over using the [`AsyncLocal`](https://learn.microsoft.com/dotnet/api/system.threading.asynclocal-1) class directly: +- By abstracting the way the ambient data is stored we can use more optimized implementations, for instance when using ASP.NET Core, without exposing these components. +- Improves the performance by minimizing the number of `AsyncLocal` instances required when multiple objects are shared. +- Provides a way to manage the lifetime of the ambient data objects. ## Install the package From fb4b1b2ac204a2dfc8ebce260dee2c13e7adb412 Mon Sep 17 00:00:00 2001 From: Jeff Handley Date: Thu, 30 Nov 2023 21:46:58 -0800 Subject: [PATCH 104/172] Migrate to the 'locker' GitHub action for locking closed/stale issues/PRs (#4774) --- .github/fabricbot.json | 106 ----------------------------------- .github/workflows/locker.yml | 36 ++++++++++++ 2 files changed, 36 insertions(+), 106 deletions(-) create mode 100644 .github/workflows/locker.yml diff --git a/.github/fabricbot.json b/.github/fabricbot.json index f176f70dc95..84a4b438bd4 100644 --- a/.github/fabricbot.json +++ b/.github/fabricbot.json @@ -823,112 +823,6 @@ ] } }, - { - "taskType": "scheduled", - "capabilityId": "ScheduledSearch", - "subCapability": "ScheduledSearch", - "version": "1.1", - "config": { - "frequency": [ - { - "weekDay": 0, - "hours": [ - 1, - 7, - 13, - 19 - ], - "timezoneOffset": 0 - }, - { - "weekDay": 1, - "hours": [ - 1, - 7, - 13, - 19 - ], - "timezoneOffset": 0 - }, - { - "weekDay": 2, - "hours": [ - 1, - 7, - 13, - 19 - ], - "timezoneOffset": 0 - }, - { - "weekDay": 3, - "hours": [ - 1, - 7, - 13, - 19 - ], - "timezoneOffset": 0 - }, - { - "weekDay": 4, - "hours": [ - 1, - 7, - 13, - 19 - ], - "timezoneOffset": 0 - }, - { - "weekDay": 5, - "hours": [ - 1, - 7, - 13, - 19 - ], - "timezoneOffset": 0 - }, - { - "weekDay": 6, - "hours": [ - 1, - 7, - 13, - 19 - ], - "timezoneOffset": 0 - } - ], - "searchTerms": [ - { - "name": "isClosed", - "parameters": {} - }, - { - "name": "noActivitySince", - "parameters": { - "days": 30 - } - }, - { - "name": "isUnlocked", - "parameters": {} - } - ], - "actions": [ - { - "name": "lockIssue", - "parameters": { - "reason": "resolved", - "label": "will_lock_this" - } - } - ], - "taskName": "Lock stale issues and PRs" - } - }, { "taskType": "trigger", "capabilityId": "IssueResponder", diff --git a/.github/workflows/locker.yml b/.github/workflows/locker.yml new file mode 100644 index 00000000000..0e7b7715101 --- /dev/null +++ b/.github/workflows/locker.yml @@ -0,0 +1,36 @@ +name: Locker - Lock stale issues and PRs +on: + schedule: + - cron: '0 9 * * *' # Once per day, early morning PT + + workflow_dispatch: + # Manual triggering through the GitHub UI, API, or CLI + inputs: + daysSinceClose: + required: true + default: "30" + daysSinceUpdate: + required: true + default: "30" + +permissions: + issues: write + pull-requests: write + +jobs: + main: + runs-on: ubuntu-latest + steps: + - name: Checkout Actions + uses: actions/checkout@v4 + with: + repository: "microsoft/vscode-github-triage-actions" + path: ./actions + ref: cd16cd2aad6ba2da74bb6c6f7293adddd579a90e # locker action commit sha + - name: Install Actions + run: npm install --production --prefix ./actions + - name: Run Locker + uses: ./actions/locker + with: + daysSinceClose: ${{ fromJson(inputs.daysSinceClose || 30) }} + daysSinceUpdate: ${{ fromJson(inputs.daysSinceUpdate || 30) }} From 686e13c0418bbae381ce76f4cf06cb815faa4af2 Mon Sep 17 00:00:00 2001 From: Martin Taillefer Date: Fri, 1 Dec 2023 11:07:30 -0800 Subject: [PATCH 105/172] Simplify resource utilization service logic (#4779) Co-authored-by: Martin Taillefer --- .../ResourceMonitorService.cs | 33 +++---------------- 1 file changed, 4 insertions(+), 29 deletions(-) diff --git a/src/Libraries/Microsoft.Extensions.Diagnostics.ResourceMonitoring/ResourceMonitorService.cs b/src/Libraries/Microsoft.Extensions.Diagnostics.ResourceMonitoring/ResourceMonitorService.cs index e0725afb205..cafb216e993 100644 --- a/src/Libraries/Microsoft.Extensions.Diagnostics.ResourceMonitoring/ResourceMonitorService.cs +++ b/src/Libraries/Microsoft.Extensions.Diagnostics.ResourceMonitoring/ResourceMonitorService.cs @@ -51,8 +51,6 @@ internal sealed class ResourceMonitorService : BackgroundService, IResourceMonit private readonly TimeSpan _collectionWindow; - private readonly CancellationTokenSource _stoppingTokenSource = new(); - public ResourceMonitorService( ISnapshotProvider provider, ILogger logger, @@ -86,15 +84,6 @@ internal ResourceMonitorService( _snapshotsStore = new CircularBuffer(bufferSize + 1, firstSnapshot); } - /// - /// Dispose the tracker. - /// - public override void Dispose() - { - _stoppingTokenSource.Dispose(); - base.Dispose(); - } - /// public ResourceUtilization GetUtilization(TimeSpan window) { @@ -112,18 +101,6 @@ public ResourceUtilization GetUtilization(TimeSpan window) return Calculator.CalculateUtilization(t.first, t.last, _provider.Resources); } - /// - public override async Task StopAsync(CancellationToken cancellationToken) - { - // Stop the execution. -#if NET8_0_OR_GREATER - await _stoppingTokenSource.CancelAsync().ConfigureAwait(false); -#else - _stoppingTokenSource.Cancel(); -#endif - await base.StopAsync(cancellationToken).ConfigureAwait(false); - } - [SuppressMessage("Design", "CA1031:Do not catch general exception types", Justification = "Intentionally Consume All. Allow no escapes.")] internal async Task PublishUtilizationAsync(CancellationToken cancellationToken) { @@ -144,14 +121,12 @@ internal async Task PublishUtilizationAsync(CancellationToken cancellationToken) } [SuppressMessage("Design", "CA1031:Do not catch general exception types", Justification = "Intentionally Consume All. Allow no escapes.")] + [SuppressMessage("Blocker Bug", "S2190:Loops and recursions should not be infinite", Justification = "Terminate when Delay throws an exception on cancellation")] protected override async Task ExecuteAsync(CancellationToken cancellationToken) { - using var linkedTokenSource = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken, _stoppingTokenSource.Token); - var linkedTokenSourceToken = linkedTokenSource.Token; - - while (!linkedTokenSourceToken.IsCancellationRequested) + while (true) { - await _timeProvider.Delay(_samplingInterval, linkedTokenSourceToken).ConfigureAwait(false); + await _timeProvider.Delay(_samplingInterval, cancellationToken).ConfigureAwait(false); try { @@ -164,7 +139,7 @@ protected override async Task ExecuteAsync(CancellationToken cancellationToken) Log.HandledGatherStatisticsException(_logger, e); } - await PublishUtilizationAsync(linkedTokenSource.Token).ConfigureAwait(false); + await PublishUtilizationAsync(cancellationToken).ConfigureAwait(false); } } } From e7430144e8009f87ed510e7922c8c780fbb0d9ac Mon Sep 17 00:00:00 2001 From: Martin Taillefer Date: Sat, 2 Dec 2023 22:58:08 -0800 Subject: [PATCH 106/172] Fix flaky resource monitoring tests (#4782) Co-authored-by: Martin Taillefer --- .../ResourceMonitoringServiceTests.cs | 42 ++++++++++++++----- 1 file changed, 32 insertions(+), 10 deletions(-) diff --git a/test/Libraries/Microsoft.Extensions.Diagnostics.ResourceMonitoring.Tests/ResourceMonitoringServiceTests.cs b/test/Libraries/Microsoft.Extensions.Diagnostics.ResourceMonitoring.Tests/ResourceMonitoringServiceTests.cs index fdfdf41da2d..6de754a2366 100644 --- a/test/Libraries/Microsoft.Extensions.Diagnostics.ResourceMonitoring.Tests/ResourceMonitoringServiceTests.cs +++ b/test/Libraries/Microsoft.Extensions.Diagnostics.ResourceMonitoring.Tests/ResourceMonitoringServiceTests.cs @@ -245,7 +245,7 @@ public async Task RunTrackerAsync_IfProviderThrows_LogsError() }), new List { - new GenericPublisher((_) => e.Set()) + new GenericPublisher((_) => ResilientSetEvent(e)) }, clock); @@ -322,7 +322,7 @@ public async Task ResourceUtilizationTracker_InitializedProperly_InvokesPublishe new GenericPublisher(_ => { publisherCalled = true; - autoResetEvent.Set(); + ResilientSetEvent(autoResetEvent); }) }, clock); @@ -415,10 +415,7 @@ public async Task ResourceUtilizationTracker_WhenInitializedWithZeroSnapshots_Re Create(options), new List { - new GenericPublisher(_ => - { - autoResetEvent.Set(); - }), + new GenericPublisher(_ => ResilientSetEvent(autoResetEvent)) }, clock); @@ -527,10 +524,7 @@ public async Task ResourceUtilizationTracker_WhenInitializedWithProperSnapshots_ Create(options), new List { - new GenericPublisher(_ => - { - autoResetEvent.Set(); - }), + new GenericPublisher(_ => ResilientSetEvent(autoResetEvent)) }, clock); @@ -711,4 +705,32 @@ public async Task Disposing_Service_Twice_Does_Not_Throw() var type = typ.GetField(name, BindingFlags.NonPublic | BindingFlags.Instance); return (T?)type?.GetValue(tracker); } + + private static void ResilientSetEvent(AutoResetEvent e) + { + try + { + e.Set(); + } +#pragma warning disable CA1031 + catch +#pragma warning restore CA1031 + { + // can happen since test termination is racy and the event might have already been disposed + } + } + + private static void ResilientSetEvent(ManualResetEventSlim e) + { + try + { + e.Set(); + } +#pragma warning disable CA1031 + catch +#pragma warning restore CA1031 + { + // can happen since test termination is racy and the event might have already been disposed + } + } } From ca03b0c72858567f9b668d90fee32ef2d5d8dd74 Mon Sep 17 00:00:00 2001 From: Igor Velikorossov Date: Tue, 5 Dec 2023 08:39:26 +1100 Subject: [PATCH 107/172] Fix missing readme entry in NuSpecs (#4776) Resolves #4722 `$(IsShipping)` is being set in one of the *.targets, which requires the readme setting to be done in a *.targets as well. While at it, move the definitions to Packaging.targets which is the better suited location. --- eng/MSBuild/Packaging.targets | 8 ++++++++ src/Directory.Build.props | 8 -------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/eng/MSBuild/Packaging.targets b/eng/MSBuild/Packaging.targets index be31f30d7d6..e233142f1fa 100644 --- a/eng/MSBuild/Packaging.targets +++ b/eng/MSBuild/Packaging.targets @@ -22,6 +22,14 @@ ($(TargetFrameworks.Contains('$(MinimumSupportedTfmForPackaging)')) and $(TargetFrameworks.Contains('$(ConditionalNet462)')))" /> + + README.md + + + + + + diff --git a/src/Directory.Build.props b/src/Directory.Build.props index 6a8c91e0aa8..b02b401762b 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -9,14 +9,6 @@ $(MSBuildProjectFullPath).$([System.Guid]::NewGuid().ToString().Substring(0,8)).sarif - - README.md - - - - - - all From 83610d7603e88f37781f7f1596fc1eaeaa23b18c Mon Sep 17 00:00:00 2001 From: Genevieve Warren <24882762+gewarren@users.noreply.github.com> Date: Wed, 6 Dec 2023 03:47:51 -0800 Subject: [PATCH 108/172] doc fix-ups (#4793) --- .../Model/StrongTypeConfig.cs | 2 +- ...nMetadataConfigurationBuilderExtensions.cs | 2 +- ...pplicationMetadataHostBuilderExtensions.cs | 4 +- ...tionMetadataServiceCollectionExtensions.cs | 2 +- .../HmacRedactorOptions.cs | 12 ++--- .../RedactionExtensions.cs | 8 +-- .../ExceptionSummary.cs | 6 +-- .../IResourceMonitor.cs | 4 +- .../ResourceMonitoringOptions.cs | 4 +- .../Logging/FakeLogRecord.cs | 4 +- .../Logging/FakeLoggerBuilderExtensions.cs | 6 +-- .../Logging/FakeLoggerProvider.cs | 4 +- .../FakeLoggerServiceCollectionExtensions.cs | 6 +-- .../FakeLoggerServiceProviderExtensions.cs | 2 +- ...StandardHedgingHandlerBuilderExtensions.cs | 2 +- ...dardResiliencePipelineBuilderExtensions.cs | 2 +- .../Routing/UriEndpoint.cs | 4 +- .../Routing/WeightedUriEndpoint.cs | 10 ++-- .../Routing/WeightedUriEndpointGroup.cs | 6 +-- .../ObjectPoolServiceCollectionExtensions.cs | 4 +- .../Enrichment/IEnrichmentTagCollector.cs | 14 ++--- .../Enrichment/IStaticLogEnricher.cs | 6 +-- .../Http/RequestMetadata.cs | 54 +++++++++++++------ .../Latency/Checkpoint.cs | 4 +- .../Latency/ILatencyContext.cs | 8 +-- .../Latency/LatencyData.cs | 2 +- .../Latency/Measure.cs | 6 +-- .../Logging/LoggerMessageState.cs | 6 +-- .../Logging/TagProviderAttribute.cs | 16 +++--- .../Metrics/CounterAttribute.cs | 16 +++--- .../Metrics/CounterAttributeT.cs | 15 +++--- .../Metrics/GaugeAttribute.cs | 15 +++--- .../Metrics/HistogramAttribute.cs | 15 +++--- .../Metrics/HistogramAttributeT.cs | 17 +++--- .../Metrics/TagNameAttribute.cs | 6 +-- .../Latency/LatencyContextOptions.cs | 2 +- src/Shared/RentedSpan/RentedSpan.cs | 2 +- src/Shared/Throw/Throw.cs | 4 +- 38 files changed, 152 insertions(+), 150 deletions(-) diff --git a/src/Generators/Microsoft.Gen.Metrics/Model/StrongTypeConfig.cs b/src/Generators/Microsoft.Gen.Metrics/Model/StrongTypeConfig.cs index 3c316171650..d3a32dd3ecb 100644 --- a/src/Generators/Microsoft.Gen.Metrics/Model/StrongTypeConfig.cs +++ b/src/Generators/Microsoft.Gen.Metrics/Model/StrongTypeConfig.cs @@ -8,7 +8,7 @@ namespace Microsoft.Gen.Metrics.Model; ///
/// /// As an example: -/// +/// /// public class Dims /// { /// public string Dim1 { get; set; } diff --git a/src/Libraries/Microsoft.Extensions.AmbientMetadata.Application/ApplicationMetadataConfigurationBuilderExtensions.cs b/src/Libraries/Microsoft.Extensions.AmbientMetadata.Application/ApplicationMetadataConfigurationBuilderExtensions.cs index 801d2f11a43..4dfacb812de 100644 --- a/src/Libraries/Microsoft.Extensions.AmbientMetadata.Application/ApplicationMetadataConfigurationBuilderExtensions.cs +++ b/src/Libraries/Microsoft.Extensions.AmbientMetadata.Application/ApplicationMetadataConfigurationBuilderExtensions.cs @@ -23,7 +23,7 @@ public static class ApplicationMetadataConfigurationBuilderExtensions /// Section name to save configuration into. Default set to "ambientmetadata:application". /// The value of >. /// or is . - /// is either , empty or whitespace. + /// is either , empty, or whitespace. public static IConfigurationBuilder AddApplicationMetadata(this IConfigurationBuilder builder, IHostEnvironment hostEnvironment, string sectionName = DefaultSectionName) { _ = Throw.IfNull(builder); diff --git a/src/Libraries/Microsoft.Extensions.AmbientMetadata.Application/ApplicationMetadataHostBuilderExtensions.cs b/src/Libraries/Microsoft.Extensions.AmbientMetadata.Application/ApplicationMetadataHostBuilderExtensions.cs index a9e923bd467..9ad46f152cb 100644 --- a/src/Libraries/Microsoft.Extensions.AmbientMetadata.Application/ApplicationMetadataHostBuilderExtensions.cs +++ b/src/Libraries/Microsoft.Extensions.AmbientMetadata.Application/ApplicationMetadataHostBuilderExtensions.cs @@ -22,9 +22,9 @@ public static class ApplicationMetadataHostBuilderExtensions /// /// The host builder. /// Section name to bind configuration from. Default set to "ambientmetadata:application". - /// The value of >. + /// The value of . /// is . - /// is either , empty or whitespace. + /// is either , empty, or whitespace. [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.PublicParameterlessConstructor, typeof(ApplicationMetadata))] [UnconditionalSuppressMessage( "Trimming", diff --git a/src/Libraries/Microsoft.Extensions.AmbientMetadata.Application/ApplicationMetadataServiceCollectionExtensions.cs b/src/Libraries/Microsoft.Extensions.AmbientMetadata.Application/ApplicationMetadataServiceCollectionExtensions.cs index e58f6ca482d..3734d8686f4 100644 --- a/src/Libraries/Microsoft.Extensions.AmbientMetadata.Application/ApplicationMetadataServiceCollectionExtensions.cs +++ b/src/Libraries/Microsoft.Extensions.AmbientMetadata.Application/ApplicationMetadataServiceCollectionExtensions.cs @@ -19,7 +19,7 @@ public static class ApplicationMetadataServiceCollectionExtensions /// /// The dependency injection container to add the instance to. /// The configuration section to bind. - /// The value of >. + /// The value of . /// or is . [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.PublicParameterlessConstructor, typeof(ApplicationMetadata))] [UnconditionalSuppressMessage( diff --git a/src/Libraries/Microsoft.Extensions.Compliance.Redaction/HmacRedactorOptions.cs b/src/Libraries/Microsoft.Extensions.Compliance.Redaction/HmacRedactorOptions.cs index 3f0303c9e4b..a66b6aefd47 100644 --- a/src/Libraries/Microsoft.Extensions.Compliance.Redaction/HmacRedactorOptions.cs +++ b/src/Libraries/Microsoft.Extensions.Compliance.Redaction/HmacRedactorOptions.cs @@ -16,11 +16,11 @@ public class HmacRedactorOptions /// Gets or sets the key ID. /// /// - /// Default set to . + /// The default is . /// /// - /// The key id is appended to each redacted value and is intended to identity the key that was used to hash the data. - /// In general, every distinct key should have a unique id associated with it. When the hashed values have different key ids, + /// The key ID is appended to each redacted value and is intended to identify the key that was used to hash the data. + /// In general, every distinct key should have a unique ID associated with it. When the hashed values have different key IDs, /// it means the values are unrelated and can't be used for correlation. /// public int? KeyId { get; set; } @@ -31,11 +31,11 @@ public class HmacRedactorOptions /// /// The key is specified in base 64 format, and must be a minimum of 44 characters long. /// - /// We recommend using a distinct key for each major deployment of a service (say for each region the service is in). Additionally, - /// the key material should be kept secret, and rotated on a regular basis. + /// We recommend using a distinct key for each major deployment of a service (for example, for each region the service is in). Additionally, + /// the key material should be kept secret and rotated on a regular basis. /// /// - /// Default set to . + /// The default is . /// [StringSyntax("Base64")] #if NET8_0_OR_GREATER diff --git a/src/Libraries/Microsoft.Extensions.Compliance.Redaction/RedactionExtensions.cs b/src/Libraries/Microsoft.Extensions.Compliance.Redaction/RedactionExtensions.cs index 0fcc71622a5..e3bee7e2605 100644 --- a/src/Libraries/Microsoft.Extensions.Compliance.Redaction/RedactionExtensions.cs +++ b/src/Libraries/Microsoft.Extensions.Compliance.Redaction/RedactionExtensions.cs @@ -20,10 +20,10 @@ public static class RedactionExtensions /// Sets the HMAC redactor to use for a set of data classifications. /// /// The builder to attach the redactor to. - /// Configuration function. + /// The configuration function. /// The data classifications for which the redactor type should be used. /// The value of . - /// , or are . + /// , , or is . [Experimental(diagnosticId: DiagnosticIds.Experiments.Compliance, UrlFormat = DiagnosticIds.UrlFormat)] public static IRedactionBuilder SetHmacRedactor(this IRedactionBuilder builder, Action configure, params DataClassificationSet[] classifications) { @@ -43,10 +43,10 @@ public static IRedactionBuilder SetHmacRedactor(this IRedactionBuilder builder, /// Sets the HMAC redactor to use for a set of data classifications. /// /// The builder to attach the redactor to. - /// Configuration section. + /// The configuration section. /// The data classifications for which the redactor type should be used. /// The value of . - /// , or are . + /// , , or is . [Experimental(diagnosticId: DiagnosticIds.Experiments.Compliance, UrlFormat = DiagnosticIds.UrlFormat)] [DynamicDependency(DynamicallyAccessedMemberTypes.All, typeof(HmacRedactorOptions))] [UnconditionalSuppressMessage( diff --git a/src/Libraries/Microsoft.Extensions.Diagnostics.ExceptionSummarization/ExceptionSummary.cs b/src/Libraries/Microsoft.Extensions.Diagnostics.ExceptionSummarization/ExceptionSummary.cs index cd8c40e0d6f..72f911e7b8f 100644 --- a/src/Libraries/Microsoft.Extensions.Diagnostics.ExceptionSummarization/ExceptionSummary.cs +++ b/src/Libraries/Microsoft.Extensions.Diagnostics.ExceptionSummarization/ExceptionSummary.cs @@ -11,12 +11,12 @@ namespace Microsoft.Extensions.Diagnostics.ExceptionSummarization; /// /// /// Metric tags typically support a limited number of distinct values, and as such they are not suitable -/// to represent values which are highly variable, such as the result of . +/// to represent values that are highly variable, such as the result of . /// An exception summary represents a low-cardinality version of an exception's information, suitable for such /// cases. -/// +/// /// The property never includes sensitive information. -/// But the property might contain sensitive information and should thus not be used in telemetry. +/// But the property might contain sensitive information and thus shouldn't be used in telemetry. /// public readonly struct ExceptionSummary : IEquatable { diff --git a/src/Libraries/Microsoft.Extensions.Diagnostics.ResourceMonitoring/IResourceMonitor.cs b/src/Libraries/Microsoft.Extensions.Diagnostics.ResourceMonitoring/IResourceMonitor.cs index c102edae497..bc65ef5298b 100644 --- a/src/Libraries/Microsoft.Extensions.Diagnostics.ResourceMonitoring/IResourceMonitor.cs +++ b/src/Libraries/Microsoft.Extensions.Diagnostics.ResourceMonitoring/IResourceMonitor.cs @@ -15,8 +15,8 @@ public interface IResourceMonitor /// /// A representing the time window for which utilization is requested. /// The utilization during the time window specified by . - /// - /// when is greater than the maximum window size configured while adding the service to the services collection. + /// is greater than the maximum window size + /// configured while adding the service to the services collection. /// ResourceUtilization GetUtilization(TimeSpan window); } diff --git a/src/Libraries/Microsoft.Extensions.Diagnostics.ResourceMonitoring/ResourceMonitoringOptions.cs b/src/Libraries/Microsoft.Extensions.Diagnostics.ResourceMonitoring/ResourceMonitoringOptions.cs index 22d551723bf..68dc7cb9ac3 100644 --- a/src/Libraries/Microsoft.Extensions.Diagnostics.ResourceMonitoring/ResourceMonitoringOptions.cs +++ b/src/Libraries/Microsoft.Extensions.Diagnostics.ResourceMonitoring/ResourceMonitoringOptions.cs @@ -38,7 +38,7 @@ public partial class ResourceMonitoringOptions /// The default value is 1 second. /// /// - /// This value must be <= to . + /// This value must be less than or equal to . /// [TimeSpan(MinimumSamplingPeriod, MaximumSamplingPeriod)] public TimeSpan SamplingInterval { get; set; } = DefaultSamplingInterval; @@ -50,7 +50,7 @@ public partial class ResourceMonitoringOptions /// The default value is 5 seconds. /// /// - /// The value needs to be <= to . + /// The value needs to be less than or equal to . /// [TimeSpan(MinimumSamplingWindow, MaximumSamplingWindow)] public TimeSpan PublishingWindow { get; set; } = DefaultCollectionWindow; diff --git a/src/Libraries/Microsoft.Extensions.Diagnostics.Testing/Logging/FakeLogRecord.cs b/src/Libraries/Microsoft.Extensions.Diagnostics.Testing/Logging/FakeLogRecord.cs index 187c37416de..ee2e7a54a6c 100644 --- a/src/Libraries/Microsoft.Extensions.Diagnostics.Testing/Logging/FakeLogRecord.cs +++ b/src/Libraries/Microsoft.Extensions.Diagnostics.Testing/Logging/FakeLogRecord.cs @@ -17,7 +17,7 @@ public class FakeLogRecord /// Initializes a new instance of the class. /// /// The level used when producing the log record. - /// The id representing the specific log statement. + /// The ID representing the specific log statement. /// The opaque state supplied by the caller when creating the log record. /// An optional exception associated with the log record. /// The formatted message text for the record. @@ -46,7 +46,7 @@ public FakeLogRecord(LogLevel level, EventId id, object? state, Exception? excep public LogLevel Level { get; } /// - /// Gets the id representing the specific log statement. + /// Gets the ID representing the specific log statement. /// public EventId Id { get; } diff --git a/src/Libraries/Microsoft.Extensions.Diagnostics.Testing/Logging/FakeLoggerBuilderExtensions.cs b/src/Libraries/Microsoft.Extensions.Diagnostics.Testing/Logging/FakeLoggerBuilderExtensions.cs index 070982118ca..2701205a496 100644 --- a/src/Libraries/Microsoft.Extensions.Diagnostics.Testing/Logging/FakeLoggerBuilderExtensions.cs +++ b/src/Libraries/Microsoft.Extensions.Diagnostics.Testing/Logging/FakeLoggerBuilderExtensions.cs @@ -18,7 +18,7 @@ namespace Microsoft.Extensions.Logging; public static class FakeLoggerBuilderExtensions { /// - /// Configure fake logging. + /// Configures fake logging. /// /// Logging builder. /// Configuration section that contains . @@ -41,7 +41,7 @@ public static ILoggingBuilder AddFakeLogging(this ILoggingBuilder builder, IConf } /// - /// Configure fake logging. + /// Configures fake logging. /// /// Logging builder. /// Logging configuration options. @@ -59,7 +59,7 @@ public static ILoggingBuilder AddFakeLogging(this ILoggingBuilder builder, Actio } /// - /// Configure fake logging with default options. + /// Configures fake logging with default options. /// /// Logging builder. /// Logging . diff --git a/src/Libraries/Microsoft.Extensions.Diagnostics.Testing/Logging/FakeLoggerProvider.cs b/src/Libraries/Microsoft.Extensions.Diagnostics.Testing/Logging/FakeLoggerProvider.cs index b21a8d28385..3d31a6d6be8 100644 --- a/src/Libraries/Microsoft.Extensions.Diagnostics.Testing/Logging/FakeLoggerProvider.cs +++ b/src/Libraries/Microsoft.Extensions.Diagnostics.Testing/Logging/FakeLoggerProvider.cs @@ -75,7 +75,7 @@ public FakeLogger CreateLogger(string? categoryName) } /// - /// Clean up resources held by this object. + /// Cleans up resources held by this object. /// public void Dispose() { @@ -89,7 +89,7 @@ public void Dispose() public FakeLogCollector Collector { get; } /// - /// Clean up resources held by this object. + /// Cleans up resources held by this object. /// /// when called from the method, when called from a finalizer. protected virtual void Dispose(bool disposing) diff --git a/src/Libraries/Microsoft.Extensions.Diagnostics.Testing/Logging/FakeLoggerServiceCollectionExtensions.cs b/src/Libraries/Microsoft.Extensions.Diagnostics.Testing/Logging/FakeLoggerServiceCollectionExtensions.cs index a49adc8eace..3b0877d7208 100644 --- a/src/Libraries/Microsoft.Extensions.Diagnostics.Testing/Logging/FakeLoggerServiceCollectionExtensions.cs +++ b/src/Libraries/Microsoft.Extensions.Diagnostics.Testing/Logging/FakeLoggerServiceCollectionExtensions.cs @@ -14,7 +14,7 @@ namespace Microsoft.Extensions.DependencyInjection; public static class FakeLoggerServiceCollectionExtensions { /// - /// Configure fake logging. + /// Configures fake logging. /// /// Service collection. /// Configuration section that contains . @@ -23,7 +23,7 @@ public static IServiceCollection AddFakeLogging(this IServiceCollection services => services.AddLogging(x => x.AddFakeLogging(section)); /// - /// Configure fake logging. + /// Configures fake logging. /// /// Service collection. /// Logging configuration options. @@ -32,7 +32,7 @@ public static IServiceCollection AddFakeLogging(this IServiceCollection services => services.AddLogging(x => x.AddFakeLogging(configure)); /// - /// Configure fake logging with default options. + /// Configures fake logging with default options. /// /// Service collection. /// The value of . diff --git a/src/Libraries/Microsoft.Extensions.Diagnostics.Testing/Logging/FakeLoggerServiceProviderExtensions.cs b/src/Libraries/Microsoft.Extensions.Diagnostics.Testing/Logging/FakeLoggerServiceProviderExtensions.cs index 38d2035f775..e0189a2d31b 100644 --- a/src/Libraries/Microsoft.Extensions.Diagnostics.Testing/Logging/FakeLoggerServiceProviderExtensions.cs +++ b/src/Libraries/Microsoft.Extensions.Diagnostics.Testing/Logging/FakeLoggerServiceProviderExtensions.cs @@ -16,7 +16,7 @@ public static class FakeLoggerServiceProviderExtensions /// /// The service provider containing the logger. /// No collector exists in the provider. - /// The collector which tracks records logged to fake loggers. + /// The collector that tracks records logged to fake loggers. public static FakeLogCollector GetFakeLogCollector(this IServiceProvider services) => services.GetService() ?? throw new InvalidOperationException("No fake log collector registered"); } diff --git a/src/Libraries/Microsoft.Extensions.Http.Resilience/Hedging/StandardHedgingHandlerBuilderExtensions.cs b/src/Libraries/Microsoft.Extensions.Http.Resilience/Hedging/StandardHedgingHandlerBuilderExtensions.cs index 5cc5720fcc8..65edeb046fc 100644 --- a/src/Libraries/Microsoft.Extensions.Http.Resilience/Hedging/StandardHedgingHandlerBuilderExtensions.cs +++ b/src/Libraries/Microsoft.Extensions.Http.Resilience/Hedging/StandardHedgingHandlerBuilderExtensions.cs @@ -89,7 +89,7 @@ public static IStandardHedgingHandlerBuilder SelectPipelineByAuthority(this ISta /// The builder instance. /// The factory that returns key selector. /// The value of . - /// The pipeline key is used in metrics and logs, do not return any sensitive value. + /// The pipeline key is used in metrics and logs, so don't return any sensitive values. public static IStandardHedgingHandlerBuilder SelectPipelineBy(this IStandardHedgingHandlerBuilder builder, Func> selectorFactory) { _ = Throw.IfNull(builder); diff --git a/src/Libraries/Microsoft.Extensions.Http.Resilience/Resilience/HttpStandardResiliencePipelineBuilderExtensions.cs b/src/Libraries/Microsoft.Extensions.Http.Resilience/Resilience/HttpStandardResiliencePipelineBuilderExtensions.cs index 37e173c4768..d853e38ba20 100644 --- a/src/Libraries/Microsoft.Extensions.Http.Resilience/Resilience/HttpStandardResiliencePipelineBuilderExtensions.cs +++ b/src/Libraries/Microsoft.Extensions.Http.Resilience/Resilience/HttpStandardResiliencePipelineBuilderExtensions.cs @@ -91,7 +91,7 @@ public static IHttpStandardResiliencePipelineBuilder SelectPipelineByAuthority(t /// The pipeline builder. /// The factory that returns a key selector. /// The value of . - /// The pipeline key is used in metrics and logs, do not return any sensitive value. + /// The pipeline key is used in metrics and logs, so don't return any sensitive values. public static IHttpStandardResiliencePipelineBuilder SelectPipelineBy(this IHttpStandardResiliencePipelineBuilder builder, Func> selectorFactory) { _ = Throw.IfNull(builder); diff --git a/src/Libraries/Microsoft.Extensions.Http.Resilience/Routing/UriEndpoint.cs b/src/Libraries/Microsoft.Extensions.Http.Resilience/Routing/UriEndpoint.cs index 110968999cd..2373144556d 100644 --- a/src/Libraries/Microsoft.Extensions.Http.Resilience/Routing/UriEndpoint.cs +++ b/src/Libraries/Microsoft.Extensions.Http.Resilience/Routing/UriEndpoint.cs @@ -9,7 +9,7 @@ namespace Microsoft.Extensions.Http.Resilience; #pragma warning disable IDE0032 // Use auto property /// -/// Represents an URI based endpoint. +/// Represents a URI-based endpoint. /// public class UriEndpoint { @@ -19,7 +19,7 @@ public class UriEndpoint /// Gets or sets the URL of the endpoint. /// /// - /// Only schema, domain name and, port will be used, rest of the URL is constructed from request URL. + /// Only schema, domain name, and port are used. The rest of the URL is constructed from the request URL. /// [Required] public Uri? Uri diff --git a/src/Libraries/Microsoft.Extensions.Http.Resilience/Routing/WeightedUriEndpoint.cs b/src/Libraries/Microsoft.Extensions.Http.Resilience/Routing/WeightedUriEndpoint.cs index 2e2b602e908..3e082a1503d 100644 --- a/src/Libraries/Microsoft.Extensions.Http.Resilience/Routing/WeightedUriEndpoint.cs +++ b/src/Libraries/Microsoft.Extensions.Http.Resilience/Routing/WeightedUriEndpoint.cs @@ -7,7 +7,7 @@ namespace Microsoft.Extensions.Http.Resilience; /// -/// Represents an URI based endpoint with a weight assigned. +/// Represents a URI-based endpoint with a weight assigned. /// public class WeightedUriEndpoint { @@ -19,7 +19,7 @@ public class WeightedUriEndpoint /// Gets or sets the URL of the endpoint. /// /// - /// Only schema, domain name and, port is used, rest of the URL is constructed from request URL. + /// Only schema, domain name, and port are used. The rest of the URL is constructed from the request URL. /// [Required] public Uri? Uri { get; set; } @@ -27,9 +27,9 @@ public class WeightedUriEndpoint /// /// Gets or sets the weight of the endpoint. /// - /// - /// Default value is 32000. - /// + /// + /// The default is 32000. + /// [Range(MinWeight, MaxWeight)] public int Weight { get; set; } = DefaultWeight; } diff --git a/src/Libraries/Microsoft.Extensions.Http.Resilience/Routing/WeightedUriEndpointGroup.cs b/src/Libraries/Microsoft.Extensions.Http.Resilience/Routing/WeightedUriEndpointGroup.cs index 1ab186f93bf..11329d91a03 100644 --- a/src/Libraries/Microsoft.Extensions.Http.Resilience/Routing/WeightedUriEndpointGroup.cs +++ b/src/Libraries/Microsoft.Extensions.Http.Resilience/Routing/WeightedUriEndpointGroup.cs @@ -17,9 +17,9 @@ public class WeightedUriEndpointGroup : UriEndpointGroup /// /// Gets or sets the weight of the group. /// - /// - /// Default value is 32000. - /// + /// + /// The default is 32000. + /// [Range(MinWeight, MaxWeight)] public int Weight { get; set; } = DefaultWeight; } diff --git a/src/Libraries/Microsoft.Extensions.ObjectPool.DependencyInjection/ObjectPoolServiceCollectionExtensions.cs b/src/Libraries/Microsoft.Extensions.ObjectPool.DependencyInjection/ObjectPoolServiceCollectionExtensions.cs index 9ccaf262196..25132dd1618 100644 --- a/src/Libraries/Microsoft.Extensions.ObjectPool.DependencyInjection/ObjectPoolServiceCollectionExtensions.cs +++ b/src/Libraries/Microsoft.Extensions.ObjectPool.DependencyInjection/ObjectPoolServiceCollectionExtensions.cs @@ -18,7 +18,7 @@ namespace Microsoft.Extensions.DependencyInjection; public static class ObjectPoolServiceCollectionExtensions { /// - /// Adds an and lets DI return scoped instances of TService. + /// Adds an and lets DI return scoped instances of . /// /// The to add to. /// The action used to configure the options of the pool. @@ -38,7 +38,7 @@ public static class ObjectPoolServiceCollectionExtensions } /// - /// Adds an and let DI return scoped instances of TService. + /// Adds an and lets DI return scoped instances of . /// /// The to add to. /// Configuration of the pool. diff --git a/src/Libraries/Microsoft.Extensions.Telemetry.Abstractions/Enrichment/IEnrichmentTagCollector.cs b/src/Libraries/Microsoft.Extensions.Telemetry.Abstractions/Enrichment/IEnrichmentTagCollector.cs index 0a3569a004e..4ca73881168 100644 --- a/src/Libraries/Microsoft.Extensions.Telemetry.Abstractions/Enrichment/IEnrichmentTagCollector.cs +++ b/src/Libraries/Microsoft.Extensions.Telemetry.Abstractions/Enrichment/IEnrichmentTagCollector.cs @@ -23,25 +23,21 @@ public interface IEnrichmentTagCollector /// /// For log enrichment, is serialized as per the rules below: /// - /// - /// Primitive types - /// recognized and efficiently serialized. - /// /// /// Arrays - /// recognized and serialized in a loop. + /// Recognized and serialized in a loop. /// /// /// - /// recognized as IDictionary<string, object> and serialized in a loop. + /// Recognized as IDictionary<string, object> and serialized in a loop. /// /// /// - /// recognized and serialized after converting to . + /// Recognized and serialized after converting to . /// /// - /// All the rest - /// converted to as is and serialized. + /// All other primitive types + /// Converted to as is and serialized. /// /// /// For metric enrichment, is converted to format using method. diff --git a/src/Libraries/Microsoft.Extensions.Telemetry.Abstractions/Enrichment/IStaticLogEnricher.cs b/src/Libraries/Microsoft.Extensions.Telemetry.Abstractions/Enrichment/IStaticLogEnricher.cs index 2be48d59e25..b6e2fc7cbef 100644 --- a/src/Libraries/Microsoft.Extensions.Telemetry.Abstractions/Enrichment/IStaticLogEnricher.cs +++ b/src/Libraries/Microsoft.Extensions.Telemetry.Abstractions/Enrichment/IStaticLogEnricher.cs @@ -4,13 +4,13 @@ namespace Microsoft.Extensions.Diagnostics.Enrichment; /// -/// A component that augments log records with additional properties which are unchanging over the life of the object. +/// Augments log records with additional properties that are unchanging over the life of the object. /// public interface IStaticLogEnricher { /// - /// Called to collect tags for a log record. + /// Collects tags for a log record. /// - /// Where the enricher puts the tags it is producing. + /// The collector where the enricher puts the tags it produces. void Enrich(IEnrichmentTagCollector collector); } diff --git a/src/Libraries/Microsoft.Extensions.Telemetry.Abstractions/Http/RequestMetadata.cs b/src/Libraries/Microsoft.Extensions.Telemetry.Abstractions/Http/RequestMetadata.cs index a5f59caaf0b..60ae8569350 100644 --- a/src/Libraries/Microsoft.Extensions.Telemetry.Abstractions/Http/RequestMetadata.cs +++ b/src/Libraries/Microsoft.Extensions.Telemetry.Abstractions/Http/RequestMetadata.cs @@ -24,7 +24,7 @@ public RequestMetadata() /// /// Initializes a new instance of the class. /// - /// Http method type of the request. + /// HTTP method type of the request. /// Route of the request. /// Name of the request. /// @@ -42,12 +42,18 @@ public RequestMetadata(string methodType, string requestRoute, string requestNam /// Gets or sets request's route template. /// /// - /// Request Route is used for multiple use cases. - /// - For outgoing request metrics, it is used as the request name dimension (if RequestName is not provided). - /// - For Logs and traces, it is used to identify sensitive parameters from the path and redact them in the exported path, so sensitive data leakage can be avoided. - /// If you are using redaction the template should be accurate for the request else redaction won't be applied to sensitive parameters. - /// e.g. A template would look something like /v1/users/{userId}/chats/{chatId}/messages. The sensitive parameter names should match exactly as provided - /// in configuration for outgoing tracing and outgoing logging autocollectors for parameters to be redacted. + /// Request Route is used for multiple use cases: + /// + /// + /// For outgoing request metrics, it is used as the request name dimension (if RequestName is not provided). + /// + /// + /// For Logs and traces, it is used to identify sensitive parameters from the path and redact them in the exported path, so sensitive data leakage can be avoided. + /// If you are using redaction, the template should be accurate for the request else redaction won't be applied to sensitive parameters. + /// For example, the template would look something like /v1/users/{userId}/chats/{chatId}/messages. For parameters to be redacted, the sensitive parameter names should match exactly as provided + /// in configuration for outgoing tracing and outgoing logging autocollectors. + /// + /// /// public string RequestRoute { get; set; } = TelemetryConstants.Unknown; @@ -55,11 +61,21 @@ public RequestMetadata(string methodType, string requestRoute, string requestNam /// Gets or sets name to be logged for the request. /// /// - /// RequestName is used in the following manner by outgoing http request auto collectors: - /// - For outgoing request metrics: RequestName is used as the request name dimension if present, if not provided RequestRoute value would be used instead. - /// - For outgoing request traces: It is used as the Display name for the activity i.e. When looking at the E2E trace flow this name is used in the Tree view of traces. - /// if not provided RequestRoute value would be used instead. - /// - For outgoing request logs: When present it would be added as an additional tag to logs. + /// RequestName is used in the following manner by outgoing HTTP request auto collectors: + /// + /// + /// For outgoing request metrics: RequestName is used as the request name dimension if present. If not provided, the RequestRoute value is used instead. + /// + /// + /// For outgoing request traces: RequestName is used as the Display name for the activity. That is, when looking at the E2E trace flow, this name is used in the Tree view of traces. + /// + /// + /// If RequestName isn't provided, the RequestRoute value is used instead. + /// + /// + /// For outgoing request logs: When present, RequestName is added as an additional tag to logs. + /// + /// /// public string RequestName { get; set; } = TelemetryConstants.Unknown; @@ -68,16 +84,22 @@ public RequestMetadata(string methodType, string requestRoute, string requestNam /// /// /// DependencyName is used in the following manner by outgoing http request auto collectors: - /// - For outgoing request metrics: This is added as dependency name dimension so metrics can be pivoted based on the dependency. - /// - For outgoing request traces and logs: This is added as dependency name dimension for better diagnosability. + /// + /// + /// For outgoing request metrics: This is added as dependency name dimension so metrics can be pivoted based on the dependency. + /// + /// + /// For outgoing request traces and logs: This is added as dependency name dimension for better diagnosability. + /// + /// /// public string DependencyName { get; set; } = TelemetryConstants.Unknown; /// - /// Gets or sets the http method type of the request. + /// Gets or sets the HTTP method type of the request. /// /// - /// Supported types are GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS, TRACE. + /// Supported types are GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS, and TRACE. /// public string MethodType { get; set; } = "GET"; } diff --git a/src/Libraries/Microsoft.Extensions.Telemetry.Abstractions/Latency/Checkpoint.cs b/src/Libraries/Microsoft.Extensions.Telemetry.Abstractions/Latency/Checkpoint.cs index fdfd50f2205..58d7f27f036 100644 --- a/src/Libraries/Microsoft.Extensions.Telemetry.Abstractions/Latency/Checkpoint.cs +++ b/src/Libraries/Microsoft.Extensions.Telemetry.Abstractions/Latency/Checkpoint.cs @@ -47,14 +47,14 @@ public Checkpoint(string name, long elapsed, long frequency) /// Determines whether this and a specified object are identical. /// /// The object to compare. - /// if identical; otherwise. + /// if identical; otherwise. public override bool Equals(object? obj) => obj is Checkpoint m && Equals(m); /// /// Determines whether this and a specified checkpoint are identical. /// /// The other checkpoint. - /// if identical; otherwise. + /// if identical; otherwise. public bool Equals(Checkpoint other) => Elapsed == other.Elapsed && Frequency == other.Frequency && Name.Equals(other.Name, StringComparison.Ordinal); diff --git a/src/Libraries/Microsoft.Extensions.Telemetry.Abstractions/Latency/ILatencyContext.cs b/src/Libraries/Microsoft.Extensions.Telemetry.Abstractions/Latency/ILatencyContext.cs index a03ed68db17..281dce176bf 100644 --- a/src/Libraries/Microsoft.Extensions.Telemetry.Abstractions/Latency/ILatencyContext.cs +++ b/src/Libraries/Microsoft.Extensions.Telemetry.Abstractions/Latency/ILatencyContext.cs @@ -11,7 +11,7 @@ namespace Microsoft.Extensions.Diagnostics.Latency; /// /// The context ties in latency signals such as checkpoints and measures for a scope along with /// mechanisms such as tags that allow describing the scope. For example, a context lets you record -/// tags, checkpoints and measures within the scope of a web request. +/// tags, checkpoints, and measures within the scope of a web request. /// public interface ILatencyContext : IDisposable { @@ -22,8 +22,8 @@ public interface ILatencyContext : IDisposable /// The value of the tag. /// /// Tags are used to provide metadata to the context. These are pivots that are useful to - /// slice and dice the data for analysis. Examples include API, Client, UserType etc. - /// Setting a tag with same name overrides its prior value i.e., last call wins. + /// slice and dice the data for analysis. Examples include API, Client, and UserType. + /// Setting a tag with the same name overrides its prior value, that is, the last call wins. /// /// is . void SetTag(TagToken token, string value); @@ -46,7 +46,7 @@ public interface ILatencyContext : IDisposable /// /// Adds the value to a measure. Measures are used for tracking total latency /// or the count for repeating operations. Example: Latency for all database calls, - /// number of calls to an external service, etc. + /// or number of calls to an external service. void AddMeasure(MeasureToken token, long value); /// diff --git a/src/Libraries/Microsoft.Extensions.Telemetry.Abstractions/Latency/LatencyData.cs b/src/Libraries/Microsoft.Extensions.Telemetry.Abstractions/Latency/LatencyData.cs index 0978342f839..581e95a6b53 100644 --- a/src/Libraries/Microsoft.Extensions.Telemetry.Abstractions/Latency/LatencyData.cs +++ b/src/Libraries/Microsoft.Extensions.Telemetry.Abstractions/Latency/LatencyData.cs @@ -7,7 +7,7 @@ namespace Microsoft.Extensions.Diagnostics.Latency; /// -/// Encapsulates the state accumulated while measuring the latency of an operaiton. +/// Encapsulates the state accumulated while measuring the latency of an operation. /// [SuppressMessage("Performance", "CA1815:Override equals and operator equals on value types", Justification = "Comparing instances is not an expected scenario")] public readonly struct LatencyData diff --git a/src/Libraries/Microsoft.Extensions.Telemetry.Abstractions/Latency/Measure.cs b/src/Libraries/Microsoft.Extensions.Telemetry.Abstractions/Latency/Measure.cs index f671175f000..4831c9d3d7f 100644 --- a/src/Libraries/Microsoft.Extensions.Telemetry.Abstractions/Latency/Measure.cs +++ b/src/Libraries/Microsoft.Extensions.Telemetry.Abstractions/Latency/Measure.cs @@ -11,7 +11,7 @@ namespace Microsoft.Extensions.Diagnostics.Latency; /// /// Measures are used to aggregate or record values. They are used to track /// statistics about recurring operations. Example: number of calls to -/// a database, total latency of database calls etc. +/// a database, or total latency of database calls. /// public readonly struct Measure : IEquatable { @@ -40,14 +40,14 @@ public Measure(string name, long value) /// Determines whether this and a specified object are identical. /// /// /// The object to compare. - /// if identical; otherwise. + /// if identical; otherwise. public override bool Equals(object? obj) => obj is Measure m && Equals(m); /// /// Determines whether this and a specified measure are identical. /// /// The other measure. - /// if identical; otherwise. + /// if identical; otherwise. public bool Equals(Measure other) => Value == other.Value && Name.Equals(other.Name, StringComparison.Ordinal); /// diff --git a/src/Libraries/Microsoft.Extensions.Telemetry.Abstractions/Logging/LoggerMessageState.cs b/src/Libraries/Microsoft.Extensions.Telemetry.Abstractions/Logging/LoggerMessageState.cs index 6cc10f20086..30c79dedcd4 100644 --- a/src/Libraries/Microsoft.Extensions.Telemetry.Abstractions/Logging/LoggerMessageState.cs +++ b/src/Libraries/Microsoft.Extensions.Telemetry.Abstractions/Logging/LoggerMessageState.cs @@ -100,7 +100,7 @@ public void AddClassifiedTag(string name, object? value, DataClassificationSet c } /// - /// Resets state of this object to its initial condition. + /// Resets the state of this object to its initial condition. /// public void Clear() { @@ -113,12 +113,12 @@ public void Clear() } /// - /// Gets a value indicating the number of unclassified tags currently in this instance. + /// Gets the number of unclassified tags currently in this instance. /// public int TagsCount { get; private set; } /// - /// Gets a value indicating the number of classified tags currently in this instance. + /// Gets the number of classified tags currently in this instance. /// public int ClassifiedTagsCount { get; private set; } diff --git a/src/Libraries/Microsoft.Extensions.Telemetry.Abstractions/Logging/TagProviderAttribute.cs b/src/Libraries/Microsoft.Extensions.Telemetry.Abstractions/Logging/TagProviderAttribute.cs index 1e6a9e92c44..dba42dde1ad 100644 --- a/src/Libraries/Microsoft.Extensions.Telemetry.Abstractions/Logging/TagProviderAttribute.cs +++ b/src/Libraries/Microsoft.Extensions.Telemetry.Abstractions/Logging/TagProviderAttribute.cs @@ -19,31 +19,31 @@ public sealed class TagProviderAttribute : Attribute /// Initializes a new instance of the class with custom tags provider. /// /// A type containing a method that provides a custom set of tags to log. - /// The name of a method on the provider type which generates a custom set of tags to log. + /// The name of a method on the provider type that generates a custom set of tags to log. /// - /// When or is . + /// or is . /// /// - /// When is either an empty string or contains only whitespace. + /// is either an empty string or contains only whitespace. /// /// /// You can create your own method that will generate the exact set of tags to log /// for a given input object. /// - /// The method referenced by this constructor should be non-generic, static, public and it should have two parameters: - /// + /// The method referenced by this constructor should be non-generic, static, and public, and it should have two parameters: + /// /// - /// First one of type + /// First parameter of type . /// /// /// - /// Second one of T? type, where T is a type of logging method parameter that you want to log. + /// Second parameter of type T?, where T is the type of logging method parameter that you want to log. /// /// /// /// /// - /// + /// /// [LoggerMessage(1, LogLevel.Warning, "Custom tags for {Param}.")] /// static partial void LogMethod(ILogger logger, /// [TagProvider(typeof(CustomProvider), nameof(CustomProvider.GetTagsToLog))] ClassToLog o); diff --git a/src/Libraries/Microsoft.Extensions.Telemetry.Abstractions/Metrics/CounterAttribute.cs b/src/Libraries/Microsoft.Extensions.Telemetry.Abstractions/Metrics/CounterAttribute.cs index 1efb661946c..00d333c0c12 100644 --- a/src/Libraries/Microsoft.Extensions.Telemetry.Abstractions/Metrics/CounterAttribute.cs +++ b/src/Libraries/Microsoft.Extensions.Telemetry.Abstractions/Metrics/CounterAttribute.cs @@ -7,10 +7,10 @@ namespace Microsoft.Extensions.Diagnostics.Metrics; /// -/// Provides information to guide the production of a strongly-typed 64 bit integer counter metric factory method and associated type. +/// Provides information to guide the production of a strongly typed 64 bit integer counter metric factory method and associated type. /// /// -/// This attribute is applied to a method which has the following constraints: +/// This attribute is applied to a method that has the following constraints: /// /// Must be a partial method. /// Must return metricName as the type. A class with that name will be generated. @@ -20,7 +20,7 @@ namespace Microsoft.Extensions.Diagnostics.Metrics; /// /// /// -/// +/// /// static partial class Metric /// { /// [Counter("RequestName", "RequestStatusCode")] @@ -54,7 +54,10 @@ public CounterAttribute(Type type) /// Gets or sets the name of the metric. /// /// - /// + /// In this example, the metric name is SampleMetric. When Name is not + /// provided, the return type of the method is used as the metric name. In this example, + /// the metric name would be RequestCounter if Name wasn't provided. + /// /// static partial class Metric /// { /// [Counter("RequestName", "RequestStatusCode", Name="SampleMetric")] @@ -62,11 +65,6 @@ public CounterAttribute(Type type) /// } /// /// - /// - /// In this example, the metric name is SampleMetric. When Name is not provided - /// the return type of the method is used as metric name. In this example, this would - /// be RequestCounter if Name wasn't provided. - /// public string? Name { get; set; } /// diff --git a/src/Libraries/Microsoft.Extensions.Telemetry.Abstractions/Metrics/CounterAttributeT.cs b/src/Libraries/Microsoft.Extensions.Telemetry.Abstractions/Metrics/CounterAttributeT.cs index 6537f7c56f4..cc6548f2bf0 100644 --- a/src/Libraries/Microsoft.Extensions.Telemetry.Abstractions/Metrics/CounterAttributeT.cs +++ b/src/Libraries/Microsoft.Extensions.Telemetry.Abstractions/Metrics/CounterAttributeT.cs @@ -9,14 +9,14 @@ namespace Microsoft.Extensions.Diagnostics.Metrics; #pragma warning disable SA1649 // File name should match first type name /// -/// Provides information to guide the production of a strongly-typed 64 bit integer counter metric factory method and associated type. +/// Provides information to guide the production of a strongly typed 64 bit integer counter metric factory method and associated type. /// /// /// The type of value the counter will hold, which is limited to , , , , /// , , or . /// /// -/// This attribute is applied to a method which has the following constraints: +/// This attribute is applied to a method that has the following constraints: /// /// Must be a partial method. /// Must return metricName as the type. A class with that name will be generated. @@ -26,7 +26,7 @@ namespace Microsoft.Extensions.Diagnostics.Metrics; /// /// /// -/// +/// /// static partial class Metric /// { /// [Counter<int>("RequestName", "RequestStatusCode")] @@ -61,7 +61,9 @@ public CounterAttribute(Type type) /// Gets or sets the name of the metric. /// /// - /// + /// In this example, the metric name is SampleMetric. When Name is not provided, the return type of the method is used as the metric name. In this example, + /// the metric name would be RequestCounter if Name wasn't provided. + /// /// static partial class Metric /// { /// [Counter<int>("RequestName", "RequestStatusCode", Name="SampleMetric")] @@ -69,11 +71,6 @@ public CounterAttribute(Type type) /// } /// /// - /// - /// In this example, the metric name is SampleMetric. When Name is not provided - /// the return type of the method is used as metric name. In this example, this would - /// be RequestCounter if Name wasn't provided. - /// public string? Name { get; set; } /// diff --git a/src/Libraries/Microsoft.Extensions.Telemetry.Abstractions/Metrics/GaugeAttribute.cs b/src/Libraries/Microsoft.Extensions.Telemetry.Abstractions/Metrics/GaugeAttribute.cs index 0b49a1274f9..5886c221480 100644 --- a/src/Libraries/Microsoft.Extensions.Telemetry.Abstractions/Metrics/GaugeAttribute.cs +++ b/src/Libraries/Microsoft.Extensions.Telemetry.Abstractions/Metrics/GaugeAttribute.cs @@ -7,10 +7,10 @@ namespace Microsoft.Extensions.Diagnostics.Metrics; /// -/// Provides information to guide the production of a strongly-typed gauge metric factory method and associated type. +/// Provides information to guide the production of a strongly typed gauge metric factory method and associated type. /// /// -/// This attribute is applied to a method which has the following constraints: +/// This attribute is applied to a method that has the following constraints: /// /// Must be a partial method. /// Must return metricName as the type. A class with that name will be generated. @@ -20,7 +20,7 @@ namespace Microsoft.Extensions.Diagnostics.Metrics; /// /// /// -/// +/// /// static partial class Metric /// { /// [Gauge] @@ -54,7 +54,9 @@ public GaugeAttribute(Type type) /// Gets or sets the name of the metric. /// /// - /// + /// In this example, the metric name is SampleMetric. When Name is not provided, the return type of the method is used as metric name. In this example, + /// the metric name would be MemoryUsage if Name wasn't provided. + /// /// static partial class Metric /// { /// [Gauge(Name="SampleMetric")] @@ -62,11 +64,6 @@ public GaugeAttribute(Type type) /// } /// /// - /// - /// In this example the metric name is SampleMetric. When Name is not provided - /// the return type of the method is used as metric name. In this example, this would - /// be MemoryUsage if Name wasn't provided. - /// public string? Name { get; set; } /// diff --git a/src/Libraries/Microsoft.Extensions.Telemetry.Abstractions/Metrics/HistogramAttribute.cs b/src/Libraries/Microsoft.Extensions.Telemetry.Abstractions/Metrics/HistogramAttribute.cs index b7e4473a221..77780e4803c 100644 --- a/src/Libraries/Microsoft.Extensions.Telemetry.Abstractions/Metrics/HistogramAttribute.cs +++ b/src/Libraries/Microsoft.Extensions.Telemetry.Abstractions/Metrics/HistogramAttribute.cs @@ -7,10 +7,10 @@ namespace Microsoft.Extensions.Diagnostics.Metrics; /// -/// Provides information to guide the production of a strongly-typed histogram metric factory method and associated type. +/// Provides information to guide the production of a strongly typed histogram metric factory method and associated type. /// /// -/// This attribute is applied to a method which has the following constraints: +/// This attribute is applied to a method that has the following constraints: /// /// Must be a partial method. /// Must return metricName as the type. A class with that name will be generated. @@ -20,7 +20,7 @@ namespace Microsoft.Extensions.Diagnostics.Metrics; /// /// /// -/// +/// /// static partial class Metric /// { /// [Histogram("RequestName", "RequestStatusCode")] @@ -54,7 +54,9 @@ public HistogramAttribute(Type type) /// Gets or sets the name of the metric. /// /// - /// + /// In this example, the metric name is SampleMetric. When Name is not provided, the return type of the method is used as the metric name. In this example, + /// the metric name would be RequestLatency if Name wasn't provided. + /// /// static partial class Metric /// { /// [Histogram("RequestName", "RequestStatusCode", Name="SampleMetric")] @@ -62,11 +64,6 @@ public HistogramAttribute(Type type) /// } /// /// - /// - /// In this example the metric name is SampleMetric. When Name is not provided - /// the return type of the method is used as metric name. In this example, this would - /// be RequestLatency if Name wasn't provided. - /// public string? Name { get; set; } /// diff --git a/src/Libraries/Microsoft.Extensions.Telemetry.Abstractions/Metrics/HistogramAttributeT.cs b/src/Libraries/Microsoft.Extensions.Telemetry.Abstractions/Metrics/HistogramAttributeT.cs index 68a1b3cc04c..b6207b4477c 100644 --- a/src/Libraries/Microsoft.Extensions.Telemetry.Abstractions/Metrics/HistogramAttributeT.cs +++ b/src/Libraries/Microsoft.Extensions.Telemetry.Abstractions/Metrics/HistogramAttributeT.cs @@ -9,14 +9,14 @@ namespace Microsoft.Extensions.Diagnostics.Metrics; #pragma warning disable SA1649 // File name should match first type name /// -/// Provides information to guide the production of a strongly-typed histogram metric factory method and associated type. +/// Provides information to guide the production of a strongly typed histogram metric factory method and associated type. /// /// /// The type of value the histogram will hold, which is limited to , , , , /// , , or . /// /// -/// This attribute is applied to a method which has the following constraints: +/// This attribute is applied to a method that has the following constraints: /// /// Must be a partial method. /// Must return metricName as the type. A class with that name will be generated. @@ -26,7 +26,7 @@ namespace Microsoft.Extensions.Diagnostics.Metrics; /// /// /// -/// +/// /// static partial class Metric /// { /// [Histogram<int>("RequestName", "RequestStatusCode")] @@ -42,7 +42,7 @@ public sealed class HistogramAttribute : Attribute /// /// Initializes a new instance of the class. /// - /// variable array of tag names. + /// A variable array of tag names. public HistogramAttribute(params string[] tagNames) { TagNames = tagNames; @@ -62,8 +62,8 @@ public HistogramAttribute(Type type) /// /// /// In this example metric name is SampleMetric. - /// If Name wasn't passed, it would be RequestLatency. - /// + /// If Name wasn't passed, the metric name would be RequestLatency. + /// /// static partial class Metric /// { /// [Histogram<int>("RequestName", "RequestStatusCode", Name = "SampleMetric")] @@ -71,11 +71,6 @@ public HistogramAttribute(Type type) /// } /// /// - /// - /// In this example the metric name is SampleMetric. When Name is not provided - /// the return type of the method is used as metric name. In this example, this would - /// be RequestLatency if Name wasn't provided. - /// public string? Name { get; set; } /// diff --git a/src/Libraries/Microsoft.Extensions.Telemetry.Abstractions/Metrics/TagNameAttribute.cs b/src/Libraries/Microsoft.Extensions.Telemetry.Abstractions/Metrics/TagNameAttribute.cs index f7430c81778..77b9811c395 100644 --- a/src/Libraries/Microsoft.Extensions.Telemetry.Abstractions/Metrics/TagNameAttribute.cs +++ b/src/Libraries/Microsoft.Extensions.Telemetry.Abstractions/Metrics/TagNameAttribute.cs @@ -6,15 +6,15 @@ namespace Microsoft.Extensions.Diagnostics.Metrics; /// -/// Provides tag information for strongly-typed metrics. +/// Provides tag information for strongly typed metrics. /// /// /// This attribute is applied to fields or properties of a metric class to override default tag names. By default, -/// the tag name is the same as the respective field or property. Using this attribute you can override the default +/// the tag name is the same as the respective field or property. You can use this attribute to override the default /// and provide a custom tag name. /// /// -/// +/// /// public class MyStrongTypeMetric /// { /// [TagName("tag_name_as_per_some_convention1")] diff --git a/src/Libraries/Microsoft.Extensions.Telemetry/Latency/LatencyContextOptions.cs b/src/Libraries/Microsoft.Extensions.Telemetry/Latency/LatencyContextOptions.cs index 4d2adbdf6e3..3b78abe44b5 100644 --- a/src/Libraries/Microsoft.Extensions.Telemetry/Latency/LatencyContextOptions.cs +++ b/src/Libraries/Microsoft.Extensions.Telemetry/Latency/LatencyContextOptions.cs @@ -12,7 +12,7 @@ public class LatencyContextOptions /// Gets or sets a value indicating whether an exception is thrown when using unregistered names. /// /// - /// if the ILatencyContext APIs throws when using unregistered names. to no-op. The default value is . + /// if the ILatencyContext APIs throws when using unregistered names. if it no-ops. The default value is . /// public bool ThrowOnUnregisteredNames { get; set; } } diff --git a/src/Shared/RentedSpan/RentedSpan.cs b/src/Shared/RentedSpan/RentedSpan.cs index b0fd6d9ed43..6e4a837cf7a 100644 --- a/src/Shared/RentedSpan/RentedSpan.cs +++ b/src/Shared/RentedSpan/RentedSpan.cs @@ -26,7 +26,7 @@ namespace Microsoft.Shared.Pools; /// to get the buffer. /// /// -/// +/// /// using var rental = new RentedSpan<char>(length); /// var span = rental.Rented ? rental.Span : stackalloc char[length]; /// diff --git a/src/Shared/Throw/Throw.cs b/src/Shared/Throw/Throw.cs index 1b864572e18..ee082e2da4a 100644 --- a/src/Shared/Throw/Throw.cs +++ b/src/Shared/Throw/Throw.cs @@ -59,7 +59,7 @@ public static T IfNull([NotNull] T argument, [CallerArgumentExpression(nameof /// The name of the member. /// The original value of . /// - /// + /// /// Throws.IfNullOrMemberNull(myObject, myObject?.MyProperty) /// /// @@ -95,7 +95,7 @@ public static TMember IfNullOrMemberNull( /// The name of the member. /// The original value of . /// - /// + /// /// Throws.IfMemberNull(myObject, myObject.MyProperty) /// /// From 76d601ee863f4f603052518649499943d7ed7b01 Mon Sep 17 00:00:00 2001 From: Martin Taillefer Date: Wed, 6 Dec 2023 03:48:36 -0800 Subject: [PATCH 109/172] Fix some doc xref issues (#4791) Co-authored-by: Martin Taillefer --- .../Http/HttpRouteParameterRedactionMode.cs | 6 ------ .../Latency/LatencyConsoleExtensions.cs | 6 +++--- .../Latency/LatencyContextExtensions.cs | 6 +++--- 3 files changed, 6 insertions(+), 12 deletions(-) diff --git a/src/Libraries/Microsoft.Extensions.Telemetry.Abstractions/Http/HttpRouteParameterRedactionMode.cs b/src/Libraries/Microsoft.Extensions.Telemetry.Abstractions/Http/HttpRouteParameterRedactionMode.cs index d8a9fc7dd5a..08c08ab6da1 100644 --- a/src/Libraries/Microsoft.Extensions.Telemetry.Abstractions/Http/HttpRouteParameterRedactionMode.cs +++ b/src/Libraries/Microsoft.Extensions.Telemetry.Abstractions/Http/HttpRouteParameterRedactionMode.cs @@ -11,17 +11,11 @@ public enum HttpRouteParameterRedactionMode /// /// All parameters are considered as sensitive and are required to be explicitly annotated with a data classification. /// - /// - /// Unannotated parameters are always redacted with the erasing redactor. - /// Strict, /// /// All parameters are considered as non-sensitive and included as-is by default. /// - /// - /// Only parameters explicitly annotated with a data classification are redacted. - /// Loose, /// diff --git a/src/Libraries/Microsoft.Extensions.Telemetry/Latency/LatencyConsoleExtensions.cs b/src/Libraries/Microsoft.Extensions.Telemetry/Latency/LatencyConsoleExtensions.cs index 3c4f0d13858..ba69f80ed0b 100644 --- a/src/Libraries/Microsoft.Extensions.Telemetry/Latency/LatencyConsoleExtensions.cs +++ b/src/Libraries/Microsoft.Extensions.Telemetry/Latency/LatencyConsoleExtensions.cs @@ -20,7 +20,7 @@ public static class LatencyConsoleExtensions /// Add latency data exporter for the console. /// /// Dependency injection container. - /// Provided service collection with added. + /// The value of . /// is . public static IServiceCollection AddConsoleLatencyDataExporter(this IServiceCollection services) { @@ -37,7 +37,7 @@ public static IServiceCollection AddConsoleLatencyDataExporter(this IServiceColl /// /// Dependency injection container. /// configuration delegate. - /// Provided service collection with added. + /// The value of . /// Either or is . public static IServiceCollection AddConsoleLatencyDataExporter(this IServiceCollection services, Action configure) { @@ -54,7 +54,7 @@ public static IServiceCollection AddConsoleLatencyDataExporter(this IServiceColl /// /// Dependency injection container. /// Configuration of . - /// Provided service collection with added. + /// The value of . /// Either or is . [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.PublicParameterlessConstructor, typeof(LatencyConsoleOptions))] [UnconditionalSuppressMessage( diff --git a/src/Libraries/Microsoft.Extensions.Telemetry/Latency/LatencyContextExtensions.cs b/src/Libraries/Microsoft.Extensions.Telemetry/Latency/LatencyContextExtensions.cs index 5b1f8484463..749b5298229 100644 --- a/src/Libraries/Microsoft.Extensions.Telemetry/Latency/LatencyContextExtensions.cs +++ b/src/Libraries/Microsoft.Extensions.Telemetry/Latency/LatencyContextExtensions.cs @@ -20,7 +20,7 @@ public static class LatencyContextExtensions /// Adds latency context. /// /// The dependency injection container. - /// The provided service collection with added. + /// The value of . public static IServiceCollection AddLatencyContext(this IServiceCollection services) { _ = Throw.IfNull(services); @@ -37,7 +37,7 @@ public static IServiceCollection AddLatencyContext(this IServiceCollection servi /// /// The dependency injection container. /// The configuration delegate. - /// The provided service collection with added. + /// The value of . public static IServiceCollection AddLatencyContext(this IServiceCollection services, Action configure) { _ = Throw.IfNull(services); @@ -53,7 +53,7 @@ public static IServiceCollection AddLatencyContext(this IServiceCollection servi /// /// The dependency injection container. /// The configuration of . - /// The provided service collection with added. + /// The value of . [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.PublicParameterlessConstructor, typeof(LatencyContextOptions))] [UnconditionalSuppressMessage( "Trimming", From 40d18dbf4d57d64cf69e43a88d9f6677da8d5006 Mon Sep 17 00:00:00 2001 From: Martin Taillefer Date: Mon, 11 Dec 2023 06:10:26 -0800 Subject: [PATCH 110/172] Address issue with legacy logger's calling ToString on the TState arguments. (#4798) * Fix #4795 And while I was in the neighborhood, also addresses #4637 --------- Co-authored-by: Martin Taillefer Co-authored-by: Igor Velikorossov --- .../Parsing/Resources.Designer.cs | 4 +- .../Parsing/Resources.resx | 4 +- .../Logging/FakeLogRecord.cs | 27 ++++ .../Logging/ExtendedLogger.LegacyTagJoiner.cs | 2 + .../Logging/FakeLoggerTests.cs | 4 + .../Logging/ExtendedLoggerTests.cs | 115 ++++++++++++------ 6 files changed, 112 insertions(+), 44 deletions(-) diff --git a/src/Generators/Microsoft.Gen.Logging/Parsing/Resources.Designer.cs b/src/Generators/Microsoft.Gen.Logging/Parsing/Resources.Designer.cs index 63fce874d64..bde293214c4 100644 --- a/src/Generators/Microsoft.Gen.Logging/Parsing/Resources.Designer.cs +++ b/src/Generators/Microsoft.Gen.Logging/Parsing/Resources.Designer.cs @@ -619,7 +619,7 @@ internal static string TagProviderMethodInaccessibleTitle { } /// - /// Looks up a localized string similar to Property provider method "{0}" in type "{1}" doesn't have a signature compatible with "{2}". + /// Looks up a localized string similar to Tag provider method "{0}" in type "{1}" doesn't have a signature compatible with "{2}". /// internal static string TagProviderMethodInvalidSignatureMessage { get { @@ -628,7 +628,7 @@ internal static string TagProviderMethodInvalidSignatureMessage { } /// - /// Looks up a localized string similar to Property provider method has an invalid signature. + /// Looks up a localized string similar to Tag provider method has an invalid signature. /// internal static string TagProviderMethodInvalidSignatureTitle { get { diff --git a/src/Generators/Microsoft.Gen.Logging/Parsing/Resources.resx b/src/Generators/Microsoft.Gen.Logging/Parsing/Resources.resx index 6273eee7246..344aeb3d034 100644 --- a/src/Generators/Microsoft.Gen.Logging/Parsing/Resources.resx +++ b/src/Generators/Microsoft.Gen.Logging/Parsing/Resources.resx @@ -256,7 +256,7 @@ Tag provider method not found - Property provider method has an invalid signature + Tag provider method has an invalid signature Logging method "{0}" has parameter "{1}" with either "ref" or "out" modifier @@ -295,7 +295,7 @@ Logging method "{0}" doesn't have anything to be logged - Property provider method "{0}" in type "{1}" doesn't have a signature compatible with "{2}" + Tag provider method "{0}" in type "{1}" doesn't have a signature compatible with "{2}" Logging method "{0}" has template(s) that start with "@": {1} diff --git a/src/Libraries/Microsoft.Extensions.Diagnostics.Testing/Logging/FakeLogRecord.cs b/src/Libraries/Microsoft.Extensions.Diagnostics.Testing/Logging/FakeLogRecord.cs index ee2e7a54a6c..e9828cff6a0 100644 --- a/src/Libraries/Microsoft.Extensions.Diagnostics.Testing/Logging/FakeLogRecord.cs +++ b/src/Libraries/Microsoft.Extensions.Diagnostics.Testing/Logging/FakeLogRecord.cs @@ -3,7 +3,9 @@ using System; using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; using Microsoft.Extensions.Logging; +using Microsoft.Shared.DiagnosticIds; using Microsoft.Shared.Diagnostics; namespace Microsoft.Extensions.Logging.Testing; @@ -67,6 +69,31 @@ public FakeLogRecord(LogLevel level, EventId id, object? state, Exception? excep /// The state object is not compatible with supported logging model and is not a read-only list. public IReadOnlyList>? StructuredState => (IReadOnlyList>?)State; + /// + /// Gets the value of a particular key value pair in the record's structured state. + /// + /// The key to search for in the record's structured state. + /// + /// The value associated with the key, or if the key was not found. If the structured + /// state contains multiple entries with the same key, the value associated with the first matching key encountered is returned. + /// + [Experimental(diagnosticId: DiagnosticIds.Experiments.Telemetry, UrlFormat = DiagnosticIds.UrlFormat)] + public string? GetStructuredStateValue(string key) + { + if (StructuredState is not null) + { + foreach (var kvp in StructuredState) + { + if (kvp.Key == key) + { + return kvp.Value; + } + } + } + + return null; + } + /// /// Gets an optional exception associated with the log record. /// diff --git a/src/Libraries/Microsoft.Extensions.Telemetry/Logging/ExtendedLogger.LegacyTagJoiner.cs b/src/Libraries/Microsoft.Extensions.Telemetry/Logging/ExtendedLogger.LegacyTagJoiner.cs index 747e6e3f09d..e72ce6964dc 100644 --- a/src/Libraries/Microsoft.Extensions.Telemetry/Logging/ExtendedLogger.LegacyTagJoiner.cs +++ b/src/Libraries/Microsoft.Extensions.Telemetry/Logging/ExtendedLogger.LegacyTagJoiner.cs @@ -76,5 +76,7 @@ public void SetIncomingTags(IReadOnlyList> value) } IEnumerator IEnumerable.GetEnumerator() => GetEnumerator(); + + public override string? ToString() => State?.ToString(); } } diff --git a/test/Libraries/Microsoft.Extensions.Diagnostics.Testing.Tests/Logging/FakeLoggerTests.cs b/test/Libraries/Microsoft.Extensions.Diagnostics.Testing.Tests/Logging/FakeLoggerTests.cs index 59f3c7e802b..9ba39b4e9aa 100644 --- a/test/Libraries/Microsoft.Extensions.Diagnostics.Testing.Tests/Logging/FakeLoggerTests.cs +++ b/test/Libraries/Microsoft.Extensions.Diagnostics.Testing.Tests/Logging/FakeLoggerTests.cs @@ -91,6 +91,10 @@ public void State() Assert.Null(ss["K2"]); Assert.Equal("[\"0\",\"1\",\"2\"]", ss["K3"]); + Assert.Equal("V0", logger.LatestRecord.GetStructuredStateValue("K0")); + Assert.Equal("V1", logger.LatestRecord.GetStructuredStateValue("K1")); + Assert.Equal("[\"0\",\"1\",\"2\"]", logger.LatestRecord.GetStructuredStateValue("K3")); + logger = new FakeLogger(); logger.Log(LogLevel.Error, new EventId(0), null, null, (_, _) => "MESSAGE"); Assert.Null(logger.LatestRecord.State); diff --git a/test/Libraries/Microsoft.Extensions.Telemetry.Tests/Logging/ExtendedLoggerTests.cs b/test/Libraries/Microsoft.Extensions.Telemetry.Tests/Logging/ExtendedLoggerTests.cs index 9b69b64323c..abc274e2cf0 100644 --- a/test/Libraries/Microsoft.Extensions.Telemetry.Tests/Logging/ExtendedLoggerTests.cs +++ b/test/Libraries/Microsoft.Extensions.Telemetry.Tests/Logging/ExtendedLoggerTests.cs @@ -74,18 +74,18 @@ public static void Basic() Assert.Null(snap[0].Exception); Assert.Equal(new EventId(0), snap[0].Id); Assert.Equal("MSG0", snap[0].Message); - Assert.Equal("EV1", snap[0].StructuredState!.GetValue("EK1")); - Assert.Equal("SEV1", snap[0].StructuredState!.GetValue("SEK1")); + Assert.Equal("EV1", snap[0].GetStructuredStateValue("EK1")); + Assert.Equal("SEV1", snap[0].GetStructuredStateValue("SEK1")); Assert.Equal(Category, snap[1].Category); Assert.Null(snap[1].Exception); Assert.Equal(new EventId(2, "ID2"), snap[1].Id); Assert.Equal("MSG2", snap[1].Message); - Assert.Equal("PV2", snap[1].StructuredState!.GetValue("PK2")); - Assert.Equal("REDACTED", snap[1].StructuredState!.GetValue("PK3")); - Assert.Null(snap[1].StructuredState!.GetValue("PK4")); - Assert.Equal("EV1", snap[1].StructuredState!.GetValue("EK1")); - Assert.Equal("SEV1", snap[1].StructuredState!.GetValue("SEK1")); + Assert.Equal("PV2", snap[1].GetStructuredStateValue("PK2")); + Assert.Equal("REDACTED", snap[1].GetStructuredStateValue("PK3")); + Assert.Null(snap[1].GetStructuredStateValue("PK4")); + Assert.Equal("EV1", snap[1].GetStructuredStateValue("EK1")); + Assert.Equal("SEV1", snap[1].GetStructuredStateValue("SEK1")); } [Theory] @@ -132,16 +132,16 @@ public static void BagAndJoiner(bool objectVersion) Assert.Null(snap[0].Exception); Assert.Equal(new EventId(0), snap[0].Id); Assert.Equal("MSG0", snap[0].Message); - Assert.Equal("EV1", snap[0].StructuredState!.GetValue("EK1")); - Assert.Equal("EV2", snap[0].StructuredState!.GetValue("EK2")); + Assert.Equal("EV1", snap[0].GetStructuredStateValue("EK1")); + Assert.Equal("EV2", snap[0].GetStructuredStateValue("EK2")); Assert.Equal(Category, snap[1].Category); Assert.Null(snap[1].Exception); Assert.Equal(new EventId(2, "ID2"), snap[1].Id); Assert.Equal("MSG2", snap[1].Message); - Assert.Equal("PV2", snap[1].StructuredState!.GetValue("PK2")); - Assert.Equal("EV1", snap[1].StructuredState!.GetValue("EK1")); - Assert.Equal("EV2", snap[1].StructuredState!.GetValue("EK2")); + Assert.Equal("PV2", snap[1].GetStructuredStateValue("PK2")); + Assert.Equal("EV1", snap[1].GetStructuredStateValue("EK1")); + Assert.Equal("EV2", snap[1].GetStructuredStateValue("EK2")); } [Fact] @@ -197,29 +197,29 @@ public static void NullStateObject() Assert.Null(snap[0].Exception); Assert.Equal(new EventId(0, "ID0"), snap[0].Id); Assert.Equal("MSG0", snap[0].Message); - Assert.Equal("EV1", snap[0].StructuredState!.GetValue("EK1")); - Assert.Equal("SEV1", snap[0].StructuredState!.GetValue("SEK1")); + Assert.Equal("EV1", snap[0].GetStructuredStateValue("EK1")); + Assert.Equal("SEV1", snap[0].GetStructuredStateValue("SEK1")); Assert.Equal(Category, snap[1].Category); Assert.Null(snap[1].Exception); Assert.Equal(new EventId(0, "ID0b"), snap[1].Id); Assert.Equal("MSG0b", snap[1].Message); - Assert.Equal("EV1", snap[1].StructuredState!.GetValue("EK1")); - Assert.Equal("SEV1", snap[1].StructuredState!.GetValue("SEK1")); + Assert.Equal("EV1", snap[1].GetStructuredStateValue("EK1")); + Assert.Equal("SEV1", snap[1].GetStructuredStateValue("SEK1")); Assert.Equal(Category, snap[2].Category); Assert.Null(snap[2].Exception); Assert.Equal(new EventId(2, "ID2"), snap[2].Id); Assert.Equal("MSG2", snap[2].Message); - Assert.Equal("EV1", snap[2].StructuredState!.GetValue("EK1")); - Assert.Equal("SEV1", snap[2].StructuredState!.GetValue("SEK1")); + Assert.Equal("EV1", snap[2].GetStructuredStateValue("EK1")); + Assert.Equal("SEV1", snap[2].GetStructuredStateValue("SEK1")); Assert.Equal(Category, snap[3].Category); Assert.Null(snap[3].Exception); Assert.Equal(new EventId(2, "ID2b"), snap[3].Id); Assert.Equal("MSG2b", snap[3].Message); - Assert.Equal("EV1", snap[3].StructuredState!.GetValue("EK1")); - Assert.Equal("SEV1", snap[3].StructuredState!.GetValue("SEK1")); + Assert.Equal("EV1", snap[3].GetStructuredStateValue("EK1")); + Assert.Equal("SEV1", snap[3].GetStructuredStateValue("SEK1")); } [Fact] @@ -257,7 +257,7 @@ public static void EnumerableStateObject() Assert.Null(snap[0].Exception); Assert.Equal(new EventId(0, "ID0"), snap[0].Id); Assert.Equal("MSG0", snap[0].Message); - Assert.Equal("V1", snap[0].StructuredState!.GetValue("K1")); + Assert.Equal("V1", snap[0].GetStructuredStateValue("K1")); } [Fact] @@ -326,7 +326,29 @@ public static void StringStateObject() Assert.Null(snap[0].Exception); Assert.Equal(new EventId(0, "ID0"), snap[0].Id); Assert.Equal("MSG0", snap[0].Message); - Assert.Equal("PAYLOAD", snap[0].StructuredState!.GetValue("{OriginalFormat}")); + Assert.Equal("PAYLOAD", snap[0].GetStructuredStateValue("{OriginalFormat}")); + } + + [Fact] + public static void StateToStringWorks() + { + using var provider = new CapturingProvider(); + using var lf = new ExtendedLoggerFactory( + providers: new[] { provider }, + filterOptions: new StaticOptionsMonitor(new()), + enrichmentOptions: new StaticOptionsMonitor(new()), + redactionOptions: new StaticOptionsMonitor(new()), + enrichers: Array.Empty(), + staticEnrichers: Array.Empty(), + redactorProvider: null, + scopeProvider: null, + factoryOptions: null); + + var logger = lf.CreateLogger("FOO"); + + logger.Log(LogLevel.Information, new EventId(0, "ID0"), "PAYLOAD", null, (_, _) => "MSG0"); + + Assert.Equal("PAYLOAD", provider.State!); } [Theory] @@ -429,12 +451,10 @@ public static void Exceptions(bool includeExceptionMessage) Assert.Equal(new EventId(2, "ID2b"), snap[3].Id); Assert.Equal("MSG2b", snap[3].Message); - var state = snap[3].StructuredState; - - var exceptionType = state!.GetValue("exception.type")!; + var exceptionType = snap[3].GetStructuredStateValue("exception.type")!; Assert.Equal("System.AggregateException", exceptionType); - var stackTrace = state!.GetValue("exception.stacktrace")!; + var stackTrace = snap[3].GetStructuredStateValue("exception.stacktrace")!; Assert.Contains("AggregateException", stackTrace); Assert.Contains("ArgumentNullException", stackTrace); Assert.Contains("ArgumentOutOfRangeException", stackTrace); @@ -442,7 +462,7 @@ public static void Exceptions(bool includeExceptionMessage) if (includeExceptionMessage) { - var exceptionMessage = state!.GetValue("exception.message"); + var exceptionMessage = snap[3].GetStructuredStateValue("exception.message"); Assert.Equal("EM4 (EM1) (EM2) (EM3)", exceptionMessage); Assert.Contains("EM1", stackTrace); @@ -452,6 +472,7 @@ public static void Exceptions(bool includeExceptionMessage) } else { + var state = snap[3].StructuredState; Assert.DoesNotContain(state!, x => x.Key == "exception.message"); Assert.DoesNotContain("EM1", stackTrace); @@ -795,19 +816,6 @@ private enum ThrowExceptionAt IsEnabled } - private static string? GetValue(this IReadOnlyList> state, string name) - { - foreach (var kvp in state) - { - if (kvp.Key == name) - { - return kvp.Value; - } - } - - return null; - } - private sealed class Provider : ILoggerProvider { public FakeLogger? Logger { get; private set; } @@ -824,6 +832,33 @@ public void Dispose() } } + private sealed class CapturingProvider : ILoggerProvider + { + public object? State { get; private set; } + public ILogger CreateLogger(string categoryName) => new Logger(this); + + public void Dispose() + { + // nothing to do + } + + private sealed class Logger : ILogger + { + private readonly CapturingProvider _provider; + + public Logger(CapturingProvider provider) + { + _provider = provider; + } + + public IDisposable? BeginScope(TState state) + where TState : notnull => throw new NotSupportedException(); + + public bool IsEnabled(LogLevel logLevel) => true; + public void Log(LogLevel logLevel, EventId eventId, TState state, Exception? exception, Func formatter) => _provider.State = state?.ToString(); + } + } + private sealed class ForcedEnricher : ILogEnricher, IStaticLogEnricher { private readonly KeyValuePair[] _values; From f992f8736c770ccf57fa7c325120ac7122e3ee81 Mon Sep 17 00:00:00 2001 From: Martin Taillefer Date: Mon, 11 Dec 2023 14:23:59 -0800 Subject: [PATCH 111/172] Add missing [GeneratedCode] attribute (#4802) The logging code generator emits a static lambda. The lambda's containing function is annotated with the [GeneratedCode] attribute, but the lambda itself is not. The result is that code generators can get confused, considering the lambda as being user code. This PR adds the [GeneratedCode] attribute to the lambda. Co-authored-by: Martin Taillefer --- src/Generators/Microsoft.Gen.Logging/Emission/Emitter.Method.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Generators/Microsoft.Gen.Logging/Emission/Emitter.Method.cs b/src/Generators/Microsoft.Gen.Logging/Emission/Emitter.Method.cs index d1f02403682..86ad40de801 100644 --- a/src/Generators/Microsoft.Gen.Logging/Emission/Emitter.Method.cs +++ b/src/Generators/Microsoft.Gen.Logging/Emission/Emitter.Method.cs @@ -99,7 +99,7 @@ private void GenLogMethod(LoggingMethod lm) var lambdaStateName = PickUniqueName("s", lm.TemplateToParameterName.Select(kvp => kvp.Key)); - OutLn($"static ({lambdaStateName}, {exceptionLambdaName}) =>"); + OutLn($"[{GeneratorUtilities.GeneratedCodeAttribute}] static string ({lambdaStateName}, {exceptionLambdaName}) =>"); OutOpenBrace(); if (GenVariableAssignments(lm, lambdaStateName, numReservedUnclassifiedTags, numReservedClassifiedTags)) From cf2ea6b1cb565f42daf888fd0b71ad51937e2e29 Mon Sep 17 00:00:00 2001 From: Jose Perez Rodriguez Date: Tue, 12 Dec 2023 13:56:55 -0800 Subject: [PATCH 112/172] Add more information and sample to Http.Diagnostics Readme (#4808) * Add more information and sample to Http.Diagnostics Readme * Simplify first statement and adding using statements. * Also add extra docs to xml docs --- ...lientLoggingHttpClientBuilderExtensions.cs | 6 +++ .../README.md | 47 +++++++++++++++++-- 2 files changed, 50 insertions(+), 3 deletions(-) diff --git a/src/Libraries/Microsoft.Extensions.Http.Diagnostics/Logging/HttpClientLoggingHttpClientBuilderExtensions.cs b/src/Libraries/Microsoft.Extensions.Http.Diagnostics/Logging/HttpClientLoggingHttpClientBuilderExtensions.cs index a79dd33dd60..b867a767c68 100644 --- a/src/Libraries/Microsoft.Extensions.Http.Diagnostics/Logging/HttpClientLoggingHttpClientBuilderExtensions.cs +++ b/src/Libraries/Microsoft.Extensions.Http.Diagnostics/Logging/HttpClientLoggingHttpClientBuilderExtensions.cs @@ -27,6 +27,8 @@ public static class HttpClientLoggingHttpClientBuilderExtensions /// The value of . /// /// All other loggers are removed - including the default one, registered via . + /// A lot of the information logged by this method (like bodies, methods, host, path, and duration) will be added as enrichment tags to the structured log. Make sure + /// you have a way of viewing structured logs in order to view this extra information. /// /// Argument is . public static IHttpClientBuilder AddExtendedHttpClientLogging(this IHttpClientBuilder builder) @@ -44,6 +46,8 @@ public static IHttpClientBuilder AddExtendedHttpClientLogging(this IHttpClientBu /// The value of . /// /// All other loggers are removed - including the default one, registered via . + /// A lot of the information logged by this method (like bodies, methods, host, path, and duration) will be added as enrichment tags to the structured log. Make sure + /// you have a way of viewing structured logs in order to view this extra information. /// /// Any of the arguments is . [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.PublicParameterlessConstructor, typeof(LoggingOptions))] @@ -66,6 +70,8 @@ public static IHttpClientBuilder AddExtendedHttpClientLogging(this IHttpClientBu /// The value of . /// /// All other loggers are removed - including the default one, registered via . + /// A lot of the information logged by this method (like bodies, methods, host, path, and duration) will be added as enrichment tags to the structured log. Make sure + /// you have a way of viewing structured logs in order to view this extra information. /// /// Any of the arguments is . [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.PublicParameterlessConstructor, typeof(LoggingOptions))] diff --git a/src/Libraries/Microsoft.Extensions.Http.Diagnostics/README.md b/src/Libraries/Microsoft.Extensions.Http.Diagnostics/README.md index 7739f0e50d3..780f407bb1b 100644 --- a/src/Libraries/Microsoft.Extensions.Http.Diagnostics/README.md +++ b/src/Libraries/Microsoft.Extensions.Http.Diagnostics/README.md @@ -1,6 +1,6 @@ # Microsoft.Extensions.Http.Diagnostics -Telemetry support for `HttpClient` that allows tracking latency and enriching and redacting log output. +Telemetry support for `HttpClient` that allows tracking latency and enriching and redacting log output for structured logs. ## Install the package @@ -24,9 +24,9 @@ Or directly in the C# project file: These components enable enriching and redacting `HttpClient` request logs. They remove built-it HTTP Client logging. -In order to use the redaction feature, you need to reference the `Microsoft.Extensions.Compliance.Redaction` package. +When using this package, some of the log properties are redacted by default (like full routes), which means that you will need to make sure that a redactor provider is registered in the Dependency Injection container. You can do this by making sure that you call `builder.Services.AddRedaction()` which requires a reference to the `Microsoft.Extensions.Compliance.Redaction` package. -The services can be registered using the following methods: +The http client logging services can be registered using the following methods: ```csharp public static IServiceCollection AddExtendedHttpClientLogging(this IServiceCollection services) @@ -55,6 +55,47 @@ builder.Services.AddHttpClientLogEnricher(); var host = builder.Build(); ``` +It is important to note that the `AddExtendedHttpClientLogging` method will add information to the logs using *enrichment*. This means that the information will be added as tags to the structured logs, but will not be visible in the log message that is printed by default in the console. To view the information, you will need to use a logging provider that supports structured logs. One quick and built-in way to do this, is to call `AddJsonConsole()` to your logging builder, which will print out the full structured logs to the console. Here is a quick sample that uses the `ExtendedHttpClientLogging()` method to automatically log all `HttpClient` request and response bodies, and then prints the full structured logs to the console: + +```csharp +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Logging; + +var services = new ServiceCollection(); + +services.AddLogging(o => o.SetMinimumLevel(LogLevel.Trace).AddJsonConsole()); // <-- Enable structured logging to the console + +// Adding default redactor provider to the DI container. This is required when using the AddExtendedHttpClientLogging() method. +services.AddRedaction(); + +services.AddHttpClient("foo") + .AddExtendedHttpClientLogging(o => + { + // Enable logging of request and response bodies: + o.LogBody = true; + + // We also need to specify the content types that we want to log: + o.ResponseBodyContentTypes.Add("application/json"); + }); + +var sp = services.BuildServiceProvider(); + +var client = sp.GetRequiredService().CreateClient("foo"); + +var response = await client.GetAsync(new Uri("https://httpbin.org/json")).ConfigureAwait(false); +``` + +By default, request and response routes are redacted for privacy reasons. You can change this behavior by making use of the `RequestPathParameterRedactionMode` option like: + +```csharp + .AddExtendedHttpClientLogging(o => +{ + //.. Other options + + o.RequestPathParameterRedactionMode = HttpRouteParameterRedactionMode.None; // <-- Disable redaction of request/response routes +}); +``` + You can also use the following extension methods to apply the logging to the specific `IHttpClientBuilder`: ```csharp From db802cccca10bb8ba71fecf867f29b3414e6a993 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Ros?= Date: Mon, 18 Dec 2023 11:16:51 -0800 Subject: [PATCH 113/172] Improve code coverage for M.E.Diagnostics.Testing (#4820) --- .../Logging/FakeLoggerTests.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/test/Libraries/Microsoft.Extensions.Diagnostics.Testing.Tests/Logging/FakeLoggerTests.cs b/test/Libraries/Microsoft.Extensions.Diagnostics.Testing.Tests/Logging/FakeLoggerTests.cs index 9ba39b4e9aa..9ec81a36077 100644 --- a/test/Libraries/Microsoft.Extensions.Diagnostics.Testing.Tests/Logging/FakeLoggerTests.cs +++ b/test/Libraries/Microsoft.Extensions.Diagnostics.Testing.Tests/Logging/FakeLoggerTests.cs @@ -106,6 +106,15 @@ public void State() Assert.Equal("Hello {name}", ss["{OriginalFormat}"]); } + [Fact] + public void NullState() + { + var logger = new FakeLogger(); + logger.Log(LogLevel.Error, new EventId(0), null, null, (_, _) => "MESSAGE"); + + Assert.Null(logger.LatestRecord.GetStructuredStateValue("K0")); + } + [Fact] public void StateInvariant() { From e3c2f6774892046cd3a4297e01ec37a47c3890d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Ros?= Date: Tue, 19 Dec 2023 14:57:11 -0800 Subject: [PATCH 114/172] Fix cpuset parser (#4823) Fixes #4822 --- .../Linux/LinuxUtilizationParser.cs | 70 ++++++++++++++----- .../Linux/LinuxUtilizationParserTests.cs | 19 +++-- 2 files changed, 69 insertions(+), 20 deletions(-) diff --git a/src/Libraries/Microsoft.Extensions.Diagnostics.ResourceMonitoring/Linux/LinuxUtilizationParser.cs b/src/Libraries/Microsoft.Extensions.Diagnostics.ResourceMonitoring/Linux/LinuxUtilizationParser.cs index 27f9398d506..69708073722 100644 --- a/src/Libraries/Microsoft.Extensions.Diagnostics.ResourceMonitoring/Linux/LinuxUtilizationParser.cs +++ b/src/Libraries/Microsoft.Extensions.Diagnostics.ResourceMonitoring/Linux/LinuxUtilizationParser.cs @@ -277,40 +277,78 @@ public ulong GetHostAvailableMemory() } /// - /// The file format is the following: - /// 0-18 - /// So, it is array indexed number of cpus. + /// Comma-separated list of integers, with dashes ("-") to represent ranges. For example "0-1,5", or "0", or "1,2,3". + /// Each value represents the zero-based index of a CPU. /// public float GetHostCpuCount() { _fileSystem.ReadFirstLine(_cpuSetCpus, _buffer); var stats = _buffer.WrittenSpan; - var start = stats.IndexOf("-", StringComparison.Ordinal); - - if (stats.IsEmpty || start == -1 || start == 0) + if (stats.IsEmpty) { - Throw.InvalidOperationException($"Could not parse '{_cpuSetCpus}'. Expected integer based range separated by dash (like 0-8) but got '{new string(stats)}'."); + ThrowException(stats); } - var first = stats.Slice(0, start); - var second = stats.Slice(start + 1, stats.Length - start - 1); - - _ = GetNextNumber(first, out var startCpu); - var next = GetNextNumber(second, out var endCpu); + var cpuCount = 0L; - if (startCpu == -1 || endCpu == -1 || endCpu < startCpu || next != -1) + // Iterate over groups (comma-separated) + while (true) { - Throw.InvalidOperationException($"Could not parse '{_cpuSetCpus}'. Expected integer based range separated by dash (like 0-8) but got '{new string(stats)}'."); + var groupIndex = stats.IndexOf(','); + + var group = groupIndex == -1 ? stats : stats.Slice(0, groupIndex); + + var rangeIndex = group.IndexOf('-'); + + if (rangeIndex == -1) + { + // Single number + _ = GetNextNumber(group, out var singleCpu); + + if (singleCpu == -1) + { + ThrowException(stats); + } + + cpuCount += 1; + } + else + { + // Range + var first = group.Slice(0, rangeIndex); + _ = GetNextNumber(first, out var startCpu); + + var second = group.Slice(rangeIndex + 1); + var next = GetNextNumber(second, out var endCpu); + + if (endCpu == -1 || startCpu == -1 || endCpu < startCpu || next != -1) + { + ThrowException(stats); + } + + cpuCount += endCpu - startCpu + 1; + } + + if (groupIndex == -1) + { + break; + } + + stats = stats.Slice(groupIndex + 1); } _buffer.Reset(); - return endCpu - startCpu + 1; + return cpuCount; + + static void ThrowException(ReadOnlySpan content) => + Throw.InvalidOperationException( + $"Could not parse '{_cpuSetCpus}'. Expected comma-separated list of integers, with dashes (\"-\") based ranges (\"0\", \"2-6,12\") but got '{new string(content)}'."); } /// - /// The input must contain only number. If there is something more than whitespace before the number, it will return failure. + /// The input must contain only number. If there is something more than whitespace before the number, it will return failure (-1). /// [SuppressMessage("Major Code Smell", "S109:Magic numbers should not be used", Justification = "We are adding another digit, so we need to multiply by ten.")] diff --git a/test/Libraries/Microsoft.Extensions.Diagnostics.ResourceMonitoring.Tests/Linux/LinuxUtilizationParserTests.cs b/test/Libraries/Microsoft.Extensions.Diagnostics.ResourceMonitoring.Tests/Linux/LinuxUtilizationParserTests.cs index 959dcb99242..559ac792e08 100644 --- a/test/Libraries/Microsoft.Extensions.Diagnostics.ResourceMonitoring.Tests/Linux/LinuxUtilizationParserTests.cs +++ b/test/Libraries/Microsoft.Extensions.Diagnostics.ResourceMonitoring.Tests/Linux/LinuxUtilizationParserTests.cs @@ -177,12 +177,23 @@ public void When_Calling_GetHostAvailableMemory_Parser_Correctly_Transforms_Supp Assert.Equal(bytes, memory); } - [ConditionalFact] - public void When_No_Cgroup_Cpu_Limits_Are_Not_Set_We_Get_Available_Cpus_From_CpuSetCpus() + [ConditionalTheory] + [InlineData("0-11", 12)] + [InlineData("0", 1)] + [InlineData("1000", 1)] + [InlineData("0,1", 2)] + [InlineData("0,1,2", 3)] + [InlineData("0,1,2,4", 4)] + [InlineData("0,1-2,3", 4)] + [InlineData("0,1,2-3,4", 5)] + [InlineData("0-1,2-3", 4)] + [InlineData("0-1,2-3,4-5", 6)] + [InlineData("0-2,3-5,6-8", 9)] + public void When_No_Cgroup_Cpu_Limits_Are_Not_Set_We_Get_Available_Cpus_From_CpuSetCpus(string content, int result) { var f = new HardcodedValueFileSystem(new Dictionary { - { new FileInfo("/sys/fs/cgroup/cpuset/cpuset.cpus"), $"0-11" }, + { new FileInfo("/sys/fs/cgroup/cpuset/cpuset.cpus"), content }, { new FileInfo("/sys/fs/cgroup/cpu/cpu.cfs_quota_us"), "-1" }, { new FileInfo("/sys/fs/cgroup/cpu/cpu.cfs_period_us"), "-1" } }); @@ -190,7 +201,7 @@ public void When_No_Cgroup_Cpu_Limits_Are_Not_Set_We_Get_Available_Cpus_From_Cpu var p = new LinuxUtilizationParser(f, new FakeUserHz(100)); var cpus = p.GetCgroupLimitedCpus(); - Assert.Equal(12, cpus); + Assert.Equal(result, cpus); } [ConditionalTheory] From 40db62a24c597a7b6e3b7b326b769da9277aaae6 Mon Sep 17 00:00:00 2001 From: Martin Taillefer Date: Thu, 21 Dec 2023 10:46:39 -0800 Subject: [PATCH 115/172] Add support to fetch logger objects from properties and base classes. (#4828) - When generating a logging method which doesn't have a logger specified as a parameter, the generator now supports fetching either a field or property from the class or any base class. It also supports either generic or non-generic loggers. Co-authored-by: Martin Taillefer --- .../Emission/Emitter.Method.cs | 4 +- .../Model/LoggingMethod.cs | 4 +- .../Parsing/DiagDescriptors.cs | 14 +-- .../Microsoft.Gen.Logging/Parsing/Parser.cs | 78 +++++++++---- .../Parsing/Resources.Designer.cs | 26 ++--- .../Parsing/Resources.resx | 16 +-- src/Generators/Shared/SymbolHelpers.cs | 36 ++++++ .../Generated/LoggerFromMemberTests.cs | 104 ++++++++++++++++++ .../TestClasses/NonStaticTestClasses.cs | 51 +++++++++ .../Unit/LoggingMethodTests.cs | 2 +- .../Microsoft.Gen.Logging/Unit/ParserTests.cs | 102 ++++++++++++----- 11 files changed, 354 insertions(+), 83 deletions(-) create mode 100644 test/Generators/Microsoft.Gen.Logging/Generated/LoggerFromMemberTests.cs create mode 100644 test/Generators/Microsoft.Gen.Logging/TestClasses/NonStaticTestClasses.cs diff --git a/src/Generators/Microsoft.Gen.Logging/Emission/Emitter.Method.cs b/src/Generators/Microsoft.Gen.Logging/Emission/Emitter.Method.cs index 86ad40de801..2269012bec3 100644 --- a/src/Generators/Microsoft.Gen.Logging/Emission/Emitter.Method.cs +++ b/src/Generators/Microsoft.Gen.Logging/Emission/Emitter.Method.cs @@ -540,8 +540,8 @@ bool GenVariableAssignments(LoggingMethod lm, string lambdaStateName, int numRes static (string name, bool isNullable) GetLogger(LoggingMethod lm) { - string logger = lm.LoggerField; - bool isNullable = lm.LoggerFieldNullable; + string logger = lm.LoggerMember; + bool isNullable = lm.LoggerMemberNullable; foreach (var p in lm.Parameters) { diff --git a/src/Generators/Microsoft.Gen.Logging/Model/LoggingMethod.cs b/src/Generators/Microsoft.Gen.Logging/Model/LoggingMethod.cs index 321aa84180c..72cf4b616a0 100644 --- a/src/Generators/Microsoft.Gen.Logging/Model/LoggingMethod.cs +++ b/src/Generators/Microsoft.Gen.Logging/Model/LoggingMethod.cs @@ -24,8 +24,8 @@ internal sealed class LoggingMethod public bool IsExtensionMethod; public bool IsStatic; public string Modifiers = string.Empty; - public string LoggerField = "_logger"; - public bool LoggerFieldNullable; + public string LoggerMember = "_logger"; + public bool LoggerMemberNullable; public bool HasXmlDocumentation; public string GetParameterNameInTemplate(LoggingMethodParameter parameter) diff --git a/src/Generators/Microsoft.Gen.Logging/Parsing/DiagDescriptors.cs b/src/Generators/Microsoft.Gen.Logging/Parsing/DiagDescriptors.cs index 275fc2dc82c..bac2e7a81e8 100644 --- a/src/Generators/Microsoft.Gen.Logging/Parsing/DiagDescriptors.cs +++ b/src/Generators/Microsoft.Gen.Logging/Parsing/DiagDescriptors.cs @@ -108,16 +108,16 @@ internal sealed class DiagDescriptors : DiagDescriptorsBase category: Category, DiagnosticSeverity.Warning); - public static DiagnosticDescriptor MissingLoggerField { get; } = Make( + public static DiagnosticDescriptor MissingLoggerMember { get; } = Make( id: DiagnosticIds.LoggerMessage.LOGGEN015, - title: Resources.MissingLoggerFieldTitle, - messageFormat: Resources.MissingLoggerFieldMessage, + title: Resources.MissingLoggerMemberTitle, + messageFormat: Resources.MissingLoggerMemberMessage, category: Category); - public static DiagnosticDescriptor MultipleLoggerFields { get; } = Make( + public static DiagnosticDescriptor MultipleLoggerMembers { get; } = Make( id: DiagnosticIds.LoggerMessage.LOGGEN016, - title: Resources.MultipleLoggerFieldsTitle, - messageFormat: Resources.MultipleLoggerFieldsMessage, + title: Resources.MultipleLoggerMembersTitle, + messageFormat: Resources.MultipleLoggerMembersMessage, category: Category); public static DiagnosticDescriptor CantUseDataClassificationWithLogPropertiesOrTagProvider { get; } = Make( @@ -176,7 +176,7 @@ internal sealed class DiagDescriptors : DiagDescriptorsBase messageFormat: Resources.LoggingMethodParameterRefKindMessage, category: Category); - public static DiagnosticDescriptor LogPropertiesProviderWithRedaction { get; } = Make( + public static DiagnosticDescriptor TagProviderWithRedaction { get; } = Make( id: DiagnosticIds.LoggerMessage.LOGGEN026, title: Resources.TagProviderWithRedactionTitle, messageFormat: Resources.TagProviderWithRedactionMessage, diff --git a/src/Generators/Microsoft.Gen.Logging/Parsing/Parser.cs b/src/Generators/Microsoft.Gen.Logging/Parsing/Parser.cs index bc7b101fdcc..4a8793c49b5 100644 --- a/src/Generators/Microsoft.Gen.Logging/Parsing/Parser.cs +++ b/src/Generators/Microsoft.Gen.Logging/Parsing/Parser.cs @@ -58,9 +58,9 @@ public IReadOnlyList GetLogTypes(IEnumerable LoggingType? lt = null; string nspace = string.Empty; - string? loggerField = null; - bool loggerFieldNullable = false; - IFieldSymbol? secondLoggerField = null; + string? loggerMember = null; + bool loggerMemberNullable = false; + ISymbol? secondLoggerMember = null; ids.Clear(); foreach (var method in typeDec.Members.Where(m => m.IsKind(SyntaxKind.MethodDeclaration)).Cast()) @@ -199,25 +199,25 @@ public IReadOnlyList GetLogTypes(IEnumerable { if (!parsingState.FoundLogger) { - if (loggerField == null) + if (loggerMember == null) { - (loggerField, secondLoggerField, loggerFieldNullable) = FindField(sm, typeDec, symbols.ILoggerSymbol); + (loggerMember, secondLoggerMember, loggerMemberNullable) = FindMember(sm, typeDec, symbols.ILoggerSymbol); } - if (secondLoggerField != null) + if (secondLoggerMember != null) { - Diag(DiagDescriptors.MultipleLoggerFields, secondLoggerField.GetLocation(), typeDec.Identifier.Text); + Diag(DiagDescriptors.MultipleLoggerMembers, secondLoggerMember.GetLocation(), typeDec.Identifier.Text); keepMethod = false; } - else if (loggerField == null) + else if (loggerMember == null) { - Diag(DiagDescriptors.MissingLoggerField, method.Identifier.GetLocation(), typeDec.Identifier.Text); + Diag(DiagDescriptors.MissingLoggerMember, method.Identifier.GetLocation(), typeDec.Identifier.Text); keepMethod = false; } else { - lm.LoggerField = loggerField; - lm.LoggerFieldNullable = loggerFieldNullable; + lm.LoggerMember = loggerMember; + lm.LoggerMemberNullable = loggerMemberNullable; } } @@ -592,35 +592,67 @@ private void CheckMethodParametersAreUnique(LoggingMethod lm, Dictionary - /// Looks up a localized string similar to Couldn't find a field of type "Microsoft.Extensions.Logging.ILogger" in type "{0}". + /// Looks up a localized string similar to Couldn't find a field or property of type "Microsoft.Extensions.Logging.ILogger" in type "{0}". /// - internal static string MissingLoggerFieldMessage { + internal static string MissingLoggerMemberMessage { get { - return ResourceManager.GetString("MissingLoggerFieldMessage", resourceCulture); + return ResourceManager.GetString("MissingLoggerMemberMessage", resourceCulture); } } /// - /// Looks up a localized string similar to Couldn't find a field of type "Microsoft.Extensions.Logging.ILogger". + /// Looks up a localized string similar to Couldn't find a field or property of type "Microsoft.Extensions.Logging.ILogger". /// - internal static string MissingLoggerFieldTitle { + internal static string MissingLoggerMemberTitle { get { - return ResourceManager.GetString("MissingLoggerFieldTitle", resourceCulture); + return ResourceManager.GetString("MissingLoggerMemberTitle", resourceCulture); } } @@ -421,20 +421,20 @@ internal static string MissingRequiredTypeTitle { } /// - /// Looks up a localized string similar to Found multiple fields of type "Microsoft.Extensions.Logging.ILogger" in type "{0}". + /// Looks up a localized string similar to Found multiple fields or properties of type "Microsoft.Extensions.Logging.ILogger" in type "{0}". /// - internal static string MultipleLoggerFieldsMessage { + internal static string MultipleLoggerMembersMessage { get { - return ResourceManager.GetString("MultipleLoggerFieldsMessage", resourceCulture); + return ResourceManager.GetString("MultipleLoggerMembersMessage", resourceCulture); } } /// - /// Looks up a localized string similar to Multiple fields of type "Microsoft.Extensions.Logging.ILogger" were found. + /// Looks up a localized string similar to Multiple fields or properties of type "Microsoft.Extensions.Logging.ILogger" were found. /// - internal static string MultipleLoggerFieldsTitle { + internal static string MultipleLoggerMembersTitle { get { - return ResourceManager.GetString("MultipleLoggerFieldsTitle", resourceCulture); + return ResourceManager.GetString("MultipleLoggerMembersTitle", resourceCulture); } } @@ -457,7 +457,7 @@ internal static string ParameterHasNoCorrespondingTemplateTitle { } /// - /// Looks up a localized string similar to Parameter "{0}" of logging method "{1}" has sensitive field/property in its type. + /// Looks up a localized string similar to Parameter "{0}" of logging method "{1}" has a sensitive field/property in its type. /// internal static string RecordTypeSensitiveArgumentIsInTemplateMessage { get { diff --git a/src/Generators/Microsoft.Gen.Logging/Parsing/Resources.resx b/src/Generators/Microsoft.Gen.Logging/Parsing/Resources.resx index 344aeb3d034..1a56b134b3f 100644 --- a/src/Generators/Microsoft.Gen.Logging/Parsing/Resources.resx +++ b/src/Generators/Microsoft.Gen.Logging/Parsing/Resources.resx @@ -207,17 +207,17 @@ Don't include logger parameters as templates - - Couldn't find a field of type "Microsoft.Extensions.Logging.ILogger" in type "{0}" + + Couldn't find a field or property of type "Microsoft.Extensions.Logging.ILogger" in type "{0}" - - Couldn't find a field of type "Microsoft.Extensions.Logging.ILogger" + + Couldn't find a field or property of type "Microsoft.Extensions.Logging.ILogger" - - Found multiple fields of type "Microsoft.Extensions.Logging.ILogger" in type "{0}" + + Found multiple fields or properties of type "Microsoft.Extensions.Logging.ILogger" in type "{0}" - - Multiple fields of type "Microsoft.Extensions.Logging.ILogger" were found + + Multiple fields or properties of type "Microsoft.Extensions.Logging.ILogger" were found Can't log properties of items of type "{0}" diff --git a/src/Generators/Shared/SymbolHelpers.cs b/src/Generators/Shared/SymbolHelpers.cs index d32bbd7c1f2..2f973bd139b 100644 --- a/src/Generators/Shared/SymbolHelpers.cs +++ b/src/Generators/Shared/SymbolHelpers.cs @@ -16,4 +16,40 @@ public static string GetFullNamespace(ISymbol symbol) { return symbol.ContainingNamespace.IsGlobalNamespace ? string.Empty : symbol.ContainingNamespace.ToString(); } + + /// + /// Can code in a given type access a given member? + /// + /// + /// Note that this implementation assumes that the target member is within the origin type + /// or a base class of the origin type. + /// + public static bool CanAccess(this INamedTypeSymbol originType, ISymbol targetMember) + { + if (SymbolEqualityComparer.Default.Equals(originType, targetMember.ContainingType)) + { + // target member is from the origin type, we're good + return true; + } + + if (targetMember.DeclaredAccessibility == Accessibility.Private) + { + // can't access a private member from a different type + return false; + } + + if (SymbolEqualityComparer.Default.Equals(originType.ContainingAssembly, targetMember.ContainingAssembly)) + { + // target member is in the same assembly as the origin type, so we're good + return true; + } + + if (targetMember.DeclaredAccessibility is Accessibility.Internal or Accessibility.ProtectedAndInternal) + { + // can't access internal members of other assemblies (sorry, we don't support IVT right now) + return false; + } + + return true; + } } diff --git a/test/Generators/Microsoft.Gen.Logging/Generated/LoggerFromMemberTests.cs b/test/Generators/Microsoft.Gen.Logging/Generated/LoggerFromMemberTests.cs new file mode 100644 index 00000000000..ee612123f82 --- /dev/null +++ b/test/Generators/Microsoft.Gen.Logging/Generated/LoggerFromMemberTests.cs @@ -0,0 +1,104 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using Microsoft.Extensions.Logging.Testing; +using TestClasses; +using Xunit; + +namespace Microsoft.Gen.Logging.Test; + +public class LoggerFromMemberTests +{ + [Fact] + public void LoggerInPropertyTestClass() + { + using var logger = Utils.GetLogger(); + var collector = logger.FakeLogCollector; + + var o = new LoggerInPropertyTestClass + { + Logger = logger + }; + + o.M0("arg0"); + Assert.Null(collector.LatestRecord.Exception); + Assert.Equal("M0 arg0", collector.LatestRecord.Message); + Assert.Equal(1, collector.Count); + } + + [Fact] + public void LoggerInNullablePropertyTestClass() + { + using var logger = Utils.GetLogger(); + var collector = logger.FakeLogCollector; + + var o = new LoggerInNullablePropertyTestClass + { + Logger = logger + }; + + o.M0("arg0"); + Assert.Null(collector.LatestRecord.Exception); + Assert.Equal("M0 arg0", collector.LatestRecord.Message); + Assert.Equal(1, collector.Count); + + o.Logger = null; + o.M0("arg0"); + Assert.Equal(1, collector.Count); + } + + [Fact] + public void LoggerInPropertyDerivedTestClass() + { + using var logger = Utils.GetLogger(); + var collector = logger.FakeLogCollector; + + var o = new LoggerInPropertyDerivedTestClass + { + Logger = logger + }; + + o.M0("arg0"); + Assert.Null(collector.LatestRecord.Exception); + Assert.Equal("M0 arg0", collector.LatestRecord.Message); + Assert.Equal(1, collector.Count); + } + + [Fact] + public void LoggerInNullablePropertyDerivedTestClass() + { + using var logger = Utils.GetLogger(); + var collector = logger.FakeLogCollector; + + var o = new LoggerInNullablePropertyDerivedTestClass + { + Logger = logger + }; + + o.M0("arg0"); + Assert.Null(collector.LatestRecord.Exception); + Assert.Equal("M0 arg0", collector.LatestRecord.Message); + Assert.Equal(1, collector.Count); + + o.Logger = null; + o.M0("arg0"); + Assert.Equal(1, collector.Count); + } + + [Fact] + public void GenericLoggerInPropertyTestClass() + { + var logger = new FakeLogger(); + var collector = logger.Collector; + + var o = new GenericLoggerInPropertyTestClass + { + Logger = logger + }; + + o.M0("arg0"); + Assert.Null(collector.LatestRecord.Exception); + Assert.Equal("M0 arg0", collector.LatestRecord.Message); + Assert.Equal(1, collector.Count); + } +} diff --git a/test/Generators/Microsoft.Gen.Logging/TestClasses/NonStaticTestClasses.cs b/test/Generators/Microsoft.Gen.Logging/TestClasses/NonStaticTestClasses.cs new file mode 100644 index 00000000000..6c6e7cfcd36 --- /dev/null +++ b/test/Generators/Microsoft.Gen.Logging/TestClasses/NonStaticTestClasses.cs @@ -0,0 +1,51 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using Microsoft.Extensions.Logging; + +#pragma warning disable SA1402 + +namespace TestClasses +{ + public partial class LoggerInPropertyTestClass + { + public ILogger Logger { get; set; } = null!; + + [LoggerMessage(0, LogLevel.Debug, "M0 {p0}")] + public partial void M0(string p0); + } + + public partial class LoggerInNullablePropertyTestClass + { + public ILogger? Logger { get; set; } + + [LoggerMessage(0, LogLevel.Debug, "M0 {p0}")] + public partial void M0(string p0); + } + + public partial class GenericLoggerInPropertyTestClass + { + public ILogger Logger { get; set; } = null!; + + [LoggerMessage(0, LogLevel.Debug, "M0 {p0}")] + public partial void M0(string p0); + } + + public partial class LoggerInPropertyDerivedTestClass : LoggerInPropertyTestClass + { + [LoggerMessage(1, LogLevel.Debug, "M1 {p0}")] + public partial void M1(string p0); + } + + public partial class LoggerInNullablePropertyDerivedTestClass : LoggerInNullablePropertyTestClass + { + [LoggerMessage(1, LogLevel.Debug, "M1 {p0}")] + public partial void M1(string p0); + } + + public partial class GenericLoggerInPropertyDerivedTestClass : LoggerInNullablePropertyTestClass + { + [LoggerMessage(1, LogLevel.Debug, "M1 {p0}")] + public partial void M1(string p0); + } +} diff --git a/test/Generators/Microsoft.Gen.Logging/Unit/LoggingMethodTests.cs b/test/Generators/Microsoft.Gen.Logging/Unit/LoggingMethodTests.cs index 668bf68be74..5c7ff5533a4 100644 --- a/test/Generators/Microsoft.Gen.Logging/Unit/LoggingMethodTests.cs +++ b/test/Generators/Microsoft.Gen.Logging/Unit/LoggingMethodTests.cs @@ -15,7 +15,7 @@ public void Fields_Should_BeInitialized() Assert.Empty(instance.Name); Assert.Empty(instance.Message); Assert.Empty(instance.Modifiers); - Assert.Equal("_logger", instance.LoggerField); + Assert.Equal("_logger", instance.LoggerMember); } [Fact] diff --git a/test/Generators/Microsoft.Gen.Logging/Unit/ParserTests.cs b/test/Generators/Microsoft.Gen.Logging/Unit/ParserTests.cs index bfd7dc44c6c..d2824eb28cc 100644 --- a/test/Generators/Microsoft.Gen.Logging/Unit/ParserTests.cs +++ b/test/Generators/Microsoft.Gen.Logging/Unit/ParserTests.cs @@ -24,37 +24,51 @@ public partial class ParserTests public async Task IncompatibleAttributes() { await RunGenerator(@$" - using Microsoft.Extensions.Compliance.Testing; - - class MyClass2 + namespace TestClasses {{ - public int A {{ get; set; }} - }} + public partial class LoggerInPropertyTestClass + {{ + public ILogger Logger {{ get; set; }} = null!; - class MyClass - {{ - public string P0 {{ get; set; }} = ""Hello""; + [LoggerMessage(0, LogLevel.Debug, ""M0 {{p0}}"")] + public partial void M0(string p0); + }} - [PrivateData, LogProperties] - public MyClass2 /*0+*/P1/*-0*/ {{ get; set; }} = ""Hello""; + public partial class LoggerInNullablePropertyTestClass + {{ + public ILogger? Logger {{ get; set; }} - [PrivateData, TagProvider(typeof(Provider), nameof(Provider.Provide)] - public string /*1+*/P2/*-1*/ {{ get; set; }} = ""Hello""; - }} + [LoggerMessage(0, LogLevel.Debug, ""M0 {{p0}}"")] + public partial void M0(string p0); + }} - static class Provider - {{ - public static void Provide(ITagCollector collector, string value) {{ }} - }} + public partial class GenericLoggerInPropertyTestClass + {{ + public ILogger Logger {{ get; set; }} = null!; - internal partial class C - {{ - [LoggerMessage(0, LogLevel.Debug, ""M0 {{p0}}"")] - partial static void M0(ILogger logger, [PrivateData, LogProperties] MyClass /*2+*/p0/*-2*/); + [LoggerMessage(0, LogLevel.Debug, ""M0 {{p0}}"")] + public partial void M0(string p0); + }} + + public partial class LoggerInPropertyDerivedTestClass : LoggerInPropertyTestClass + {{ + [LoggerMessage(1, LogLevel.Debug, ""M1 {{p0}}"")] + public partial void M1(string p0); + }} - [LoggerMessage(1, LogLevel.Debug, ""M1 {{p0}}"")] - partial static void M1(ILogger logger, [PrivateData, TagProvider(typeof(Provider), nameof(Provider.Provide))] string /*3+*/p0/*-3*/); - }}", DiagDescriptors.CantUseDataClassificationWithLogPropertiesOrTagProvider); + public partial class LoggerInNullablePropertyDerivedTestClass : LoggerInNullablePropertyTestClass + {{ + [LoggerMessage(1, LogLevel.Debug, ""M1 {{p0}}"")] + public partial void M1(string p0); + }} + + public partial class GenericLoggerInPropertyDerivedTestClass : LoggerInNullablePropertyTestClass + {{ + [LoggerMessage(1, LogLevel.Debug, ""M1 {{p0}}"")] + public partial void M1(string p0); + }} + }} + "); } [Fact] @@ -559,11 +573,11 @@ partial class C } "; - await RunGenerator(Source, DiagDescriptors.MissingLoggerField); + await RunGenerator(Source, DiagDescriptors.MissingLoggerMember); } [Fact] - public async Task MultipleILoggerFields() + public async Task MultipleILoggerMembers() { const string Source = @" partial class C @@ -574,9 +588,43 @@ partial class C [LoggerMessage(0, LogLevel.Debug, ""M1"")] public partial void M1(); } + + partial class D + { + public ILogger? Logger { get; set; } = null!; + public ILogger /*1+*/_logger2/*-1*/; + + [LoggerMessage(0, LogLevel.Debug, ""M1"")] + public partial void M1(); + } + + partial class E + { + public ILogger Logger { get; set; } = null!; + public ILogger /*2+*/_logger2/*-2*/; + + [LoggerMessage(0, LogLevel.Debug, ""M1"")] + public partial void M1(); + } + + partial class F + { + public ILogger? /*3+*/Logger/*-3*/ { get; set; } + + [LoggerMessage(0, LogLevel.Debug, ""M1"")] + public partial void M1(); + } + + partial class G : F + { + private readonly ILogger? _logger; + + [LoggerMessage(1, LogLevel.Debug, ""M2"")] + public partial void M2(); + } "; - await RunGenerator(Source, DiagDescriptors.MultipleLoggerFields); + await RunGenerator(Source, DiagDescriptors.MultipleLoggerMembers); } [Fact] From 9f5be484f32d93cf817a7da9090715650e4b6fc5 Mon Sep 17 00:00:00 2001 From: Martin Taillefer Date: Thu, 21 Dec 2023 21:59:21 -0800 Subject: [PATCH 116/172] Add a new local analyzer to detect when internal symbols are mentioned in public docs (#4827) - Adds the analyzer - Address a couple issues reported by the analyzer. Co-authored-by: Martin Taillefer --- .../DiagDescriptors.cs | 8 + .../InternalReferencedInPublicDocAnalyzer.cs | 158 ++++++ .../Resources.Designer.cs | 27 + .../Microsoft.Analyzers.Local/Resources.resx | 11 +- .../Latency/RequestCheckpointConstants.cs | 2 +- .../NullConfigureContextualOptions.cs | 2 +- ...ernalReferencedInPublicDocAnalyzerTests.cs | 491 ++++++++++++++++++ 7 files changed, 696 insertions(+), 3 deletions(-) create mode 100644 src/Analyzers/Microsoft.Analyzers.Local/InternalReferencedInPublicDocAnalyzer.cs create mode 100644 test/Analyzers/Microsoft.Analyzers.Local.Tests/InternalReferencedInPublicDocAnalyzerTests.cs diff --git a/src/Analyzers/Microsoft.Analyzers.Local/DiagDescriptors.cs b/src/Analyzers/Microsoft.Analyzers.Local/DiagDescriptors.cs index b99bf81abaf..46af17c1e0b 100644 --- a/src/Analyzers/Microsoft.Analyzers.Local/DiagDescriptors.cs +++ b/src/Analyzers/Microsoft.Analyzers.Local/DiagDescriptors.cs @@ -104,6 +104,14 @@ internal static class DiagDescriptors description: Resources.PublishedSymbolsCantChangeDescription, defaultSeverity: DiagnosticSeverity.Warning); + public static DiagnosticDescriptor InternalReferencedInPublicDoc { get; } = Make( + id: "LA0008", + messageFormat: Resources.InternalReferencedInPublicDocMessage, + title: Resources.InternalReferencedInPublicDocTitle, + category: Correctness, + description: Resources.InternalReferencedInPublicDocDescription, + defaultSeverity: DiagnosticSeverity.Warning); + private static DiagnosticDescriptor Make(string id, string title, string description, string messageFormat, string category, DiagnosticSeverity defaultSeverity) => new(id, title, messageFormat, category, defaultSeverity, true, description); } diff --git a/src/Analyzers/Microsoft.Analyzers.Local/InternalReferencedInPublicDocAnalyzer.cs b/src/Analyzers/Microsoft.Analyzers.Local/InternalReferencedInPublicDocAnalyzer.cs new file mode 100644 index 00000000000..e83ae1f28f8 --- /dev/null +++ b/src/Analyzers/Microsoft.Analyzers.Local/InternalReferencedInPublicDocAnalyzer.cs @@ -0,0 +1,158 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System; +using System.Collections.Immutable; +using System.Linq; +using Microsoft.CodeAnalysis; +using Microsoft.CodeAnalysis.CSharp; +using Microsoft.CodeAnalysis.CSharp.Syntax; +using Microsoft.CodeAnalysis.Diagnostics; +using Microsoft.Extensions.LocalAnalyzers.Utilities; + +namespace Microsoft.Extensions.LocalAnalyzers; + +/// +/// C# analyzer that warns about referencing internal symbols in public xml documentation. +/// +[DiagnosticAnalyzer(LanguageNames.CSharp)] +public class InternalReferencedInPublicDocAnalyzer : DiagnosticAnalyzer +{ + private static readonly ImmutableArray _supportedDiagnostics = ImmutableArray.Create(DiagDescriptors.InternalReferencedInPublicDoc); + + private static MemberDeclarationSyntax? FindDocumentedSymbol(XmlCrefAttributeSyntax crefNode) + { + // Find the documentation comment the cref node is part of + var documentationComment = crefNode.Ancestors(ascendOutOfTrivia: false).OfType().FirstOrDefault(); + if (documentationComment == null) + { + return null; + } + + // Find documented symbol simply as first parent that is a declaration + // If the comment is not placed above any declaration, this takes the enclosing declaration + var symbolNode = crefNode.Ancestors().OfType().FirstOrDefault(); + if (symbolNode == null) + { + return null; + } + + // To filter out the cases when enclosing declaration is taken, + // make sure that the comment of found symbol is the same as the comment of cref being analyzed + var symbolComment = symbolNode.GetLeadingTrivia() + .Select(trivia => trivia.GetStructure()) + .OfType() + .FirstOrDefault(); + if (symbolComment != documentationComment) + { + return null; + } + + return symbolNode; + } + + private static bool IsNodeExternallyVisible(MemberDeclarationSyntax memberNode) + { + // In a way, the code replicates SymbolExtensions.IsExternallyVisible on syntax tree level + // It traverses up to namespace declaration and checks if all levels are externally visible + MemberDeclarationSyntax? node = memberNode; + while (node != null && !IsNamespace(node)) + { + bool isPublic = false; + bool isProtected = false; + bool isPrivate = false; + bool hasModifiers = false; + foreach (var modifier in node.Modifiers) + { + switch (modifier.Text) + { + case "public": + isPublic = true; + break; + case "protected": + isProtected = true; + break; + case "private": + isPrivate = true; + break; + } + + hasModifiers = true; + } + + if (!hasModifiers // no modifiers => internal, not visible + || isPrivate // private and private protected are both not visible + || (!isPublic && !isProtected) // public and protected are only other externally visible options + ) + { + return false; + } + + node = node.Parent as MemberDeclarationSyntax; + } + + return true; + + static bool IsNamespace(MemberDeclarationSyntax n) => + n is BaseNamespaceDeclarationSyntax; + } + + /// + public override ImmutableArray SupportedDiagnostics => _supportedDiagnostics; + + /// + public override void Initialize(AnalysisContext context) + { + _ = context ?? throw new ArgumentNullException(nameof(context)); + + context.ConfigureGeneratedCodeAnalysis(GeneratedCodeAnalysisFlags.None); + context.EnableConcurrentExecution(); + + context.RegisterSyntaxNodeAction(ValidateCref, SyntaxKind.XmlCrefAttribute); + } + + private void ValidateCref(SyntaxNodeAnalysisContext context) + { + var crefNode = (XmlCrefAttributeSyntax)context.Node; + if (crefNode.IsMissing) + { + return; + } + + var symbolNode = FindDocumentedSymbol(crefNode); + if (symbolNode == null) + { + return; + } + + // Only externally visible symbols should be considered + // Sometimes (for fields and events) the symbol is unknown + // In such a case, use nodes instead of symbols + var symbol = context.SemanticModel.GetDeclaredSymbol(symbolNode); + var isExternallyVisible = symbol?.IsExternallyVisible() ?? IsNodeExternallyVisible(symbolNode); + if (!isExternallyVisible) + { + return; + } + + var referencedName = crefNode.Cref.ToString(); + if (string.IsNullOrWhiteSpace(referencedName)) + { + return; + } + + // Find what the cref attribute references; only successful binding is considered now, candidates aren't analyzed + var referencedSymbol = context.SemanticModel.GetSymbolInfo(crefNode.Cref).Symbol; + if (referencedSymbol == null) + { + return; + } + + // Report referencing a not externally visible symbol + if (!referencedSymbol.IsExternallyVisible()) + { + var diagnostic = Diagnostic.Create(DiagDescriptors.InternalReferencedInPublicDoc, crefNode.Cref.GetLocation(), referencedName); + context.ReportDiagnostic(diagnostic); + } + } +} diff --git a/src/Analyzers/Microsoft.Analyzers.Local/Resources.Designer.cs b/src/Analyzers/Microsoft.Analyzers.Local/Resources.Designer.cs index d19c3e90704..b9868d9fc50 100644 --- a/src/Analyzers/Microsoft.Analyzers.Local/Resources.Designer.cs +++ b/src/Analyzers/Microsoft.Analyzers.Local/Resources.Designer.cs @@ -114,6 +114,33 @@ internal static string ExperimentalSymbolsCantBeMarkedObsoleteTitle { } } + /// + /// Looks up a localized string similar to Externally visible XML documentation references an internal member, this will perplex the readers.. + /// + internal static string InternalReferencedInPublicDocDescription { + get { + return ResourceManager.GetString("InternalReferencedInPublicDocDescription", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Remove the reference or make '{0}' externally visible; also consider making the referencing member private or internal. + /// + internal static string InternalReferencedInPublicDocMessage { + get { + return ResourceManager.GetString("InternalReferencedInPublicDocMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Externally visible documentation references internals. + /// + internal static string InternalReferencedInPublicDocTitle { + get { + return ResourceManager.GetString("InternalReferencedInPublicDocTitle", resourceCulture); + } + } + /// /// Looks up a localized string similar to Symbols being added to the public API of an assembly must be marked as experimental until they have been appoved. /// diff --git a/src/Analyzers/Microsoft.Analyzers.Local/Resources.resx b/src/Analyzers/Microsoft.Analyzers.Local/Resources.resx index 704117a6d59..d438082456b 100644 --- a/src/Analyzers/Microsoft.Analyzers.Local/Resources.resx +++ b/src/Analyzers/Microsoft.Analyzers.Local/Resources.resx @@ -204,4 +204,13 @@ Symbols that have been removed from the public API of an assembly must be marked as obsolete - \ No newline at end of file + + Externally visible XML documentation references an internal member, this will perplex the readers. + + + Remove the reference or make '{0}' externally visible; also consider making the referencing member private or internal + + + Externally visible documentation references internals + + diff --git a/src/Libraries/Microsoft.AspNetCore.Diagnostics.Middleware/Latency/RequestCheckpointConstants.cs b/src/Libraries/Microsoft.AspNetCore.Diagnostics.Middleware/Latency/RequestCheckpointConstants.cs index 02fed943a5e..e03d87bf4c9 100644 --- a/src/Libraries/Microsoft.AspNetCore.Diagnostics.Middleware/Latency/RequestCheckpointConstants.cs +++ b/src/Libraries/Microsoft.AspNetCore.Diagnostics.Middleware/Latency/RequestCheckpointConstants.cs @@ -19,7 +19,7 @@ public static class RequestCheckpointConstants public const string ElapsedTillFinished = "eltltf"; /// - /// The time elapsed before hitting the middleware. + /// The time elapsed before hitting the pipeline exit middleware. /// public const string ElapsedTillPipelineExitMiddleware = "eltexm"; diff --git a/src/Libraries/Microsoft.Extensions.Options.Contextual/NullConfigureContextualOptions.cs b/src/Libraries/Microsoft.Extensions.Options.Contextual/NullConfigureContextualOptions.cs index 19c35c1611a..caaa969ee55 100644 --- a/src/Libraries/Microsoft.Extensions.Options.Contextual/NullConfigureContextualOptions.cs +++ b/src/Libraries/Microsoft.Extensions.Options.Contextual/NullConfigureContextualOptions.cs @@ -9,7 +9,7 @@ namespace Microsoft.Extensions.Options.Contextual; public static class NullConfigureContextualOptions { /// - /// Gets a singleton instance of . + /// Gets a singleton instance of an empty configuration context. /// /// The options type to configure. /// A do-nothing instance of . diff --git a/test/Analyzers/Microsoft.Analyzers.Local.Tests/InternalReferencedInPublicDocAnalyzerTests.cs b/test/Analyzers/Microsoft.Analyzers.Local.Tests/InternalReferencedInPublicDocAnalyzerTests.cs new file mode 100644 index 00000000000..4f6962bbc0b --- /dev/null +++ b/test/Analyzers/Microsoft.Analyzers.Local.Tests/InternalReferencedInPublicDocAnalyzerTests.cs @@ -0,0 +1,491 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using System.Reflection; +using System.Threading.Tasks; +using Microsoft.CodeAnalysis; +using Microsoft.Extensions.LocalAnalyzers.Resource.Test; +using Xunit; + +namespace Microsoft.Extensions.LocalAnalyzers.Test; + +public class InternalReferencedInPublicDocAnalyzerTests +{ + private static readonly string[] _members = + { + "void Method() {}", "int Property {get; set;}", "event System.EventHandler Event;", "int _field;", "string this[int i] { get => string.Empty; set {} }", + }; + private static readonly string[] _membersReferenced = { "void Referenced() {}", "int Referenced {get; set;}", "event System.EventHandler Referenced;", "int Referenced;", }; + private static readonly string[] _typesReferenced = { "class Referenced {}", "struct Referenced {}", "interface Referenced {}", "delegate void Referenced(int value);", "enum Referenced {}", }; + private static readonly string[] _compositeTypeNames = { "class", "struct", "interface" }; + + public static IEnumerable References => new Assembly[] + { + // add references here + }; + + public static IEnumerable GetMemberAndTypePairs(string memberAccessModifier, string typeAccessModifier) + { + return MakePairs(memberAccessModifier, _members, typeAccessModifier, _typesReferenced); + } + + public static IEnumerable GetCompositeTypeAndMemberPairs(string typeAccessModifier, string memberAccessModifier) + { + return MakePairs(typeAccessModifier, _compositeTypeNames, memberAccessModifier, _membersReferenced); + } + + private static IEnumerable MakePairs(string firstPrefix, IReadOnlyList firstList, string secondPrefix, IReadOnlyList secondList) + { + var casesCnt = Math.Max(firstList.Count, secondList.Count); + for (var i = 0; i < casesCnt; i++) + { + var first = $"{firstPrefix} {firstList[i % firstList.Count]}"; + var second = $"{secondPrefix} {secondList[i % secondList.Count]}"; + yield return new object[] { first, second }; + } + } + + private static string MemberReferencesTopLevelTypeLine6(string classAccess, string member, string type) + { + return @" + namespace Example; + + " + classAccess + @" class TestClass + { + /// + /// Does something with . This is line #6. + /// + " + member + @" + } + + " + type + @" + "; + } + + private static string TopLevelTypeReferencesItsMemberLine4(string type, string member) + { + return @" + namespace Example + { + /// + /// Does something with . This is line #4. + /// + " + type + @" Test + { + " + member + @" + } + } + "; + } + + [Fact] + public void CheckExceptionIsThrownWhenNullIsPassedToInitializeCall() + { + var a = new InternalReferencedInPublicDocAnalyzer(); + Assert.Throws(() => a.Initialize(null!)); + } + + [Theory] + [MemberData(nameof(GetMemberAndTypePairs), "public", "internal")] + [MemberData(nameof(GetMemberAndTypePairs), "public", "")] + [MemberData(nameof(GetMemberAndTypePairs), "protected", "internal")] + [MemberData(nameof(GetMemberAndTypePairs), "protected", "")] + [MemberData(nameof(GetMemberAndTypePairs), "protected internal", "internal")] + [MemberData(nameof(GetMemberAndTypePairs), "protected internal", "")] + public async Task ShouldIndicateWhenExternallyVisibleMemberReferencesTopLevelInternalType(string member, string type) + { + var source = MemberReferencesTopLevelTypeLine6("public", member, type); + + var result = await Analyze(source); + + AssertDetected(result, source, 6, "Referenced"); + } + + [Theory] + [MemberData(nameof(GetMemberAndTypePairs), "public", "public")] + [MemberData(nameof(GetMemberAndTypePairs), "protected", "public")] + [MemberData(nameof(GetMemberAndTypePairs), "protected internal", "public")] + [MemberData(nameof(GetMemberAndTypePairs), "private", "internal")] + [MemberData(nameof(GetMemberAndTypePairs), "private", "")] + [MemberData(nameof(GetMemberAndTypePairs), "private protected", "internal")] + [MemberData(nameof(GetMemberAndTypePairs), "private protected", "")] + [MemberData(nameof(GetMemberAndTypePairs), "internal", "internal")] + [MemberData(nameof(GetMemberAndTypePairs), "internal", "")] + public async Task ShouldNotIndicateWhenMemberReferencesTopLevelType(string member, string type) + { + var source = MemberReferencesTopLevelTypeLine6("public", member, type); + + var result = await Analyze(source); + + AssertNotDetected(result); + } + + [Theory] + [MemberData(nameof(GetMemberAndTypePairs), "public", "internal")] + [MemberData(nameof(GetMemberAndTypePairs), "public", "")] + [MemberData(nameof(GetMemberAndTypePairs), "public", "public")] + [MemberData(nameof(GetMemberAndTypePairs), "protected", "internal")] + [MemberData(nameof(GetMemberAndTypePairs), "protected", "")] + [MemberData(nameof(GetMemberAndTypePairs), "protected", "public")] + [MemberData(nameof(GetMemberAndTypePairs), "protected internal", "internal")] + [MemberData(nameof(GetMemberAndTypePairs), "protected internal", "")] + [MemberData(nameof(GetMemberAndTypePairs), "protected internal", "public")] + [MemberData(nameof(GetMemberAndTypePairs), "private", "internal")] + [MemberData(nameof(GetMemberAndTypePairs), "private", "")] + [MemberData(nameof(GetMemberAndTypePairs), "private protected", "internal")] + [MemberData(nameof(GetMemberAndTypePairs), "private protected", "")] + [MemberData(nameof(GetMemberAndTypePairs), "internal", "internal")] + [MemberData(nameof(GetMemberAndTypePairs), "internal", "")] + public async Task ShouldNotIndicateWhenInternalClassMemberReferencesTopLevelType(string member, string type) + { + var source = MemberReferencesTopLevelTypeLine6("internal", member, type); + + var result = await Analyze(source); + + AssertNotDetected(result); + } + + [Theory] + [MemberData(nameof(GetCompositeTypeAndMemberPairs), "public", "internal")] + [MemberData(nameof(GetCompositeTypeAndMemberPairs), "public", "private")] + [MemberData(nameof(GetCompositeTypeAndMemberPairs), "public", "private protected")] + [MemberData(nameof(GetCompositeTypeAndMemberPairs), "protected", "internal")] + [MemberData(nameof(GetCompositeTypeAndMemberPairs), "protected", "private")] + [MemberData(nameof(GetCompositeTypeAndMemberPairs), "protected", "private protected")] + [MemberData(nameof(GetCompositeTypeAndMemberPairs), "protected internal", "internal")] + [MemberData(nameof(GetCompositeTypeAndMemberPairs), "protected internal", "private")] + [MemberData(nameof(GetCompositeTypeAndMemberPairs), "protected internal", "private protected")] + public async Task ShouldIndicateWhenExternallyVisibleTopLevelTypeReferencesItsInvisibleMember(string type, string member) + { + var source = TopLevelTypeReferencesItsMemberLine4(type, member); + + var result = await Analyze(source); + + AssertDetected(result, source, 4, "Referenced"); + } + + [Theory] + [MemberData(nameof(GetCompositeTypeAndMemberPairs), "public", "public")] + [MemberData(nameof(GetCompositeTypeAndMemberPairs), "public", "protected")] + [MemberData(nameof(GetCompositeTypeAndMemberPairs), "public", "protected internal")] + [MemberData(nameof(GetCompositeTypeAndMemberPairs), "protected", "public")] + [MemberData(nameof(GetCompositeTypeAndMemberPairs), "protected", "protected")] + [MemberData(nameof(GetCompositeTypeAndMemberPairs), "protected", "protected internal")] + [MemberData(nameof(GetCompositeTypeAndMemberPairs), "protected internal", "public")] + [MemberData(nameof(GetCompositeTypeAndMemberPairs), "protected internal", "protected")] + [MemberData(nameof(GetCompositeTypeAndMemberPairs), "protected internal", "protected internal")] + [MemberData(nameof(GetCompositeTypeAndMemberPairs), "internal", "public")] + [MemberData(nameof(GetCompositeTypeAndMemberPairs), "internal", "internal")] + [MemberData(nameof(GetCompositeTypeAndMemberPairs), "internal", "protected")] + [MemberData(nameof(GetCompositeTypeAndMemberPairs), "internal", "protected internal")] + [MemberData(nameof(GetCompositeTypeAndMemberPairs), "internal", "private")] + [MemberData(nameof(GetCompositeTypeAndMemberPairs), "internal", "private protected")] + [MemberData(nameof(GetCompositeTypeAndMemberPairs), "", "public")] + [MemberData(nameof(GetCompositeTypeAndMemberPairs), "", "internal")] + [MemberData(nameof(GetCompositeTypeAndMemberPairs), "", "protected")] + [MemberData(nameof(GetCompositeTypeAndMemberPairs), "", "protected internal")] + [MemberData(nameof(GetCompositeTypeAndMemberPairs), "", "private")] + [MemberData(nameof(GetCompositeTypeAndMemberPairs), "", "private protected")] + public async Task ShouldNotIndicateWhenTopLevelTypeReferencesItsMember(string type, string member) + { + var source = TopLevelTypeReferencesItsMemberLine4(type, member); + + var result = await Analyze(source); + + AssertNotDetected(result); + } + + [Theory] + [InlineData("public", false)] + [InlineData("internal", true)] + [InlineData("", true)] + public async Task ShouldSupportReferencesToEnumMembers(string enumAccess, bool shouldIndicate) + { + var source = @" + namespace Example + { + /// + /// Use . This is line #4. + /// + public class TestClass + { + public void Method X() {} + } + + " + enumAccess + @" enum MyEnum + { + Member1, + Member2, + } + } + "; + + var result = await Analyze(source); + + if (shouldIndicate) + { + AssertDetected(result, source, 4, "MyEnum.Member1"); + } + else + { + AssertNotDetected(result); + } + } + + [Theory] + [InlineData("public", "public", false)] + [InlineData("public", "internal", true)] + [InlineData("internal", "public", false)] + [InlineData("", "internal", false)] + public async Task ShouldSupportCommentsOnEnumMembers(string enumAccess, string typeAccess, bool shouldIndicate) + { + var source = @" + namespace Example + { + " + typeAccess + @" class Referenced + { + public void Method X() {} + } + + " + enumAccess + @" enum MyEnum + { + Member1, + + /// + /// Uses . This is line #13. + /// + Member2, + } + } + "; + + var result = await Analyze(source); + + if (shouldIndicate) + { + AssertDetected(result, source, 13, "Referenced"); + } + else + { + AssertNotDetected(result); + } + } + + [Theory] + [InlineData("public", "public", false)] + [InlineData("public", "internal", true)] + [InlineData("public", "private", true)] + [InlineData("public", "protected", false)] + [InlineData("public", "protected internal", false)] + [InlineData("public", "private protected", true)] + [InlineData("internal", "public", true)] + [InlineData("internal", "internal", true)] + [InlineData("internal", "private", true)] + [InlineData("internal", "protected", true)] + [InlineData("internal", "protected internal", true)] + [InlineData("internal", "private protected", true)] + [InlineData("", "public", true)] + [InlineData("", "internal", true)] + [InlineData("", "private", true)] + [InlineData("", "protected", true)] + [InlineData("", "protected internal", true)] + [InlineData("", "private protected", true)] + public async Task ShouldSupportCrefPointingToNestedType(string enclosingTypeAccess, string nestedTypeAccess, bool shouldIndicate) + { + var source = @" + namespace Example + { + " + enclosingTypeAccess + @" class Enclosing + { + " + nestedTypeAccess + @" class Referenced + { + } + } + + /// + /// Uses . This is line #11. + /// + public interface ITest + { + } + } + "; + + var result = await Analyze(source); + + if (shouldIndicate) + { + AssertDetected(result, source, 11, "Enclosing.Referenced"); + } + else + { + AssertNotDetected(result); + } + } + + [Theory] + [InlineData("public", "public", true)] + [InlineData("public", "internal", false)] + [InlineData("public", "private", false)] + [InlineData("public", "protected", true)] + [InlineData("public", "protected internal", true)] + [InlineData("public", "private protected", false)] + [InlineData("internal", "public", false)] + [InlineData("internal", "internal", false)] + [InlineData("internal", "private", false)] + [InlineData("internal", "protected", false)] + [InlineData("internal", "protected internal", false)] + [InlineData("internal", "private protected", false)] + [InlineData("", "public", false)] + [InlineData("", "internal", false)] + [InlineData("", "private", false)] + [InlineData("", "protected", false)] + [InlineData("", "protected internal", false)] + [InlineData("", "private protected", false)] + public async Task ShouldSupportCrefOnNestedType(string enclosingTypeAccess, string nestedTypeAccess, bool shouldIndicate) + { + var source = @" + namespace Example + { + " + enclosingTypeAccess + @" class Enclosing + { + /// + /// Uses . This is line #6. + /// + " + nestedTypeAccess + @" class Test + { + } + } + + internal interface Referenced + { + } + } + "; + + var result = await Analyze(source); + + if (shouldIndicate) + { + AssertDetected(result, source, 6, "Referenced"); + } + else + { + AssertNotDetected(result); + } + } + + [Theory] + [InlineData("")] + [InlineData(" ")] + [InlineData("NotExists")] + [InlineData("this is not a valid reference")] + [InlineData("$^&#@")] + public async Task ShouldNotIndicateWhenCrefIsInvalid(string cref) + { + var source = @" + namespace Example + { + public class TestClass + { + /// + /// Use . + /// + public void Method X() {} + } + } + "; + + var result = await Analyze(source); + + AssertNotDetected(result); + } + + [Fact] + public async Task ShouldNotIndicateWhenCommentIsOrphan() + { + var source = @" + namespace Example + { + public class TestClass + { + /// + /// Use . + /// + } + + internal class Referenced {} + } + "; + + var result = await Analyze(source); + + AssertNotDetected(result); + } + + [Fact] + public async Task ShouldNotIndicateWhenCRefDoesNotBelongToXmlDocumentation() + { + var source = @" + namespace Example + { + /* + Type is referenced + */ + public class TestClass + { + // Use + public void Method() {}; + } + + internal class Referenced {} + } + "; + + var result = await Analyze(source); + + AssertNotDetected(result); + } + + private static void AssertDetected(IReadOnlyList result, string source, int lineNumber, string detectedText) => + AssertDetected(result, source, new[] { lineNumber }, new[] { detectedText }); + + private static void AssertDetected(IReadOnlyList result, string source, int[] lineNumbers, string[] detectedTexts) + { + Debug.Assert(lineNumbers.Length == detectedTexts.Length, "Line numbers and texts should be the same length"); + + var detected = result.Where(IsInternalReferencedInPublicDocDiagnostic).ToList(); + + var expectedNumberOfWarnings = lineNumbers.Length; + Assert.Equal(expectedNumberOfWarnings, detected.Count); + + for (int i = 0; i < detected.Count; i++) + { + var location = detected[i].Location; + Assert.Equal(lineNumbers[i], location.GetLineSpan().StartLinePosition.Line); + + var text = source.Substring(location.SourceSpan.Start, location.SourceSpan.Length); + Assert.Equal(detectedTexts[i], text, StringComparer.Ordinal); + } + } + + private static bool IsInternalReferencedInPublicDocDiagnostic(Diagnostic d) => ReferenceEquals(d.Descriptor, DiagDescriptors.InternalReferencedInPublicDoc); + + private static void AssertNotDetected(IReadOnlyList result) + { + var detected = result.Where(IsInternalReferencedInPublicDocDiagnostic); + Assert.Empty(detected); + } + + private static async Task> Analyze(string source) + { + return await RoslynTestUtils.RunAnalyzer( + new InternalReferencedInPublicDocAnalyzer(), + References, + new[] { source }).ConfigureAwait(false); + } +} From 78a1df99bd21b274e91e1b18c9aeff64cb74ae0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Obr=C3=A1til?= Date: Fri, 22 Dec 2023 16:08:29 +0100 Subject: [PATCH 117/172] Make AsyncState thread safe (#4833) * Replace List with ConcurrentDictionary in AsyncState * Remove unused namespace in FeaturesPooledPolicy.cs * Fixes in tests * Replace ConcurrentDictionary with custom Features class * Remove unused namespace in AsyncState.cs --------- Co-authored-by: Martin Obratil --- .../AsyncState.cs | 31 +++---------- .../Features.cs | 45 +++++++++++++++++++ .../FeaturesPooledPolicy.cs | 15 +++---- .../AsyncStateTests.cs | 25 ----------- .../FeaturesPooledPolicyTests.cs | 17 +++---- 5 files changed, 66 insertions(+), 67 deletions(-) create mode 100644 src/Libraries/Microsoft.Extensions.AsyncState/Features.cs diff --git a/src/Libraries/Microsoft.Extensions.AsyncState/AsyncState.cs b/src/Libraries/Microsoft.Extensions.AsyncState/AsyncState.cs index 4d782409238..9fc79930954 100644 --- a/src/Libraries/Microsoft.Extensions.AsyncState/AsyncState.cs +++ b/src/Libraries/Microsoft.Extensions.AsyncState/AsyncState.cs @@ -2,7 +2,6 @@ // The .NET Foundation licenses this file to you under the MIT license. using System; -using System.Collections.Generic; using System.Threading; using Microsoft.Extensions.ObjectPool; using Microsoft.Shared.Diagnostics; @@ -13,7 +12,7 @@ namespace Microsoft.Extensions.AsyncState; internal sealed class AsyncState : IAsyncState { private static readonly AsyncLocal _asyncContextCurrent = new(); - private static readonly ObjectPool> _featuresPool = PoolFactory.CreatePool(new FeaturesPooledPolicy()); + private static readonly ObjectPool _featuresPool = PoolFactory.CreatePool(new FeaturesPooledPolicy()); private int _contextCount; public void Initialize() @@ -22,12 +21,12 @@ public void Initialize() // Use an object indirection to hold the AsyncContext in the AsyncLocal, // so it can be cleared in all ExecutionContexts when its cleared. - var features = new AsyncStateHolder + var asyncStateHolder = new AsyncStateHolder { Features = _featuresPool.Get() }; - _asyncContextCurrent.Value = features; + _asyncContextCurrent.Value = asyncStateHolder; } public void Reset() @@ -60,9 +59,7 @@ public bool TryGet(AsyncStateToken token, out object? value) return false; } - EnsureCount(_asyncContextCurrent.Value.Features, token.Index + 1); - - value = _asyncContextCurrent.Value.Features[token.Index]; + value = _asyncContextCurrent.Value.Features.Get(token.Index); return true; } @@ -86,28 +83,14 @@ public void Set(AsyncStateToken token, object? value) Throw.InvalidOperationException("Context is not initialized"); } - EnsureCount(_asyncContextCurrent.Value.Features, token.Index + 1); - - _asyncContextCurrent.Value.Features[token.Index] = value; - } - - internal static void EnsureCount(List features, int count) - { -#if NET6_0_OR_GREATER - features.EnsureCapacity(count); -#endif - var difference = count - features.Count; - - for (int i = 0; i < difference; i++) - { - features.Add(null); - } + _asyncContextCurrent.Value.Features.Set(token.Index, value); } internal int ContextCount => Volatile.Read(ref _contextCount); private sealed class AsyncStateHolder { - public List? Features { get; set; } + public Features? Features { get; set; } } + } diff --git a/src/Libraries/Microsoft.Extensions.AsyncState/Features.cs b/src/Libraries/Microsoft.Extensions.AsyncState/Features.cs new file mode 100644 index 00000000000..940efa69c26 --- /dev/null +++ b/src/Libraries/Microsoft.Extensions.AsyncState/Features.cs @@ -0,0 +1,45 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System.Collections.Generic; + +namespace Microsoft.Extensions.AsyncState; + +internal sealed class Features +{ + private readonly List _items = []; + + public object? Get(int index) + { + return _items.Count <= index ? null : _items[index]; + } + + public void Set(int index, object? value) + { + if (_items.Count <= index) + { + lock (_items) + { + var count = index + 1; + +#if NET6_0_OR_GREATER + _items.EnsureCapacity(count); +#endif + + var difference = count - _items.Count; + + for (int i = 0; i < difference; i++) + { + _items.Add(null); + } + } + } + + _items[index] = value; + } + + public void Clear() + { + _items.Clear(); + } +} diff --git a/src/Libraries/Microsoft.Extensions.AsyncState/FeaturesPooledPolicy.cs b/src/Libraries/Microsoft.Extensions.AsyncState/FeaturesPooledPolicy.cs index 3b045465595..6c6f442c817 100644 --- a/src/Libraries/Microsoft.Extensions.AsyncState/FeaturesPooledPolicy.cs +++ b/src/Libraries/Microsoft.Extensions.AsyncState/FeaturesPooledPolicy.cs @@ -1,27 +1,22 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System.Collections.Generic; using Microsoft.Extensions.ObjectPool; namespace Microsoft.Extensions.AsyncState; -internal sealed class FeaturesPooledPolicy : IPooledObjectPolicy> +internal sealed class FeaturesPooledPolicy : IPooledObjectPolicy { /// - public List Create() + public Features Create() { - return []; + return new Features(); } /// - public bool Return(List obj) + public bool Return(Features obj) { - for (int i = 0; i < obj.Count; i++) - { - obj[i] = null; - } - + obj.Clear(); return true; } } diff --git a/test/Libraries/Microsoft.Extensions.AsyncState.Tests/AsyncStateTests.cs b/test/Libraries/Microsoft.Extensions.AsyncState.Tests/AsyncStateTests.cs index f7a7b050eb1..e541ee04865 100644 --- a/test/Libraries/Microsoft.Extensions.AsyncState.Tests/AsyncStateTests.cs +++ b/test/Libraries/Microsoft.Extensions.AsyncState.Tests/AsyncStateTests.cs @@ -2,7 +2,6 @@ // The .NET Foundation licenses this file to you under the MIT license. using System; -using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.Threading; using System.Threading.Tasks; @@ -205,28 +204,4 @@ public void RegisterContextCorrectly() Assert.Equal(3, asyncState.ContextCount); } - - [Fact] - public void EnsureCount_IncreasesCountCorrectly() - { - var l = new List(); - AsyncState.EnsureCount(l, 5); - Assert.Equal(5, l.Count); - } - - [Fact] - public void EnsureCount_WhenCountLessThanExpected() - { - var l = new List(new object?[5]); - AsyncState.EnsureCount(l, 2); - Assert.Equal(5, l.Count); - } - - [Fact] - public void EnsureCount_WhenCountEqualWithExpected() - { - var l = new List(new object?[5]); - AsyncState.EnsureCount(l, 5); - Assert.Equal(5, l.Count); - } } diff --git a/test/Libraries/Microsoft.Extensions.AsyncState.Tests/FeaturesPooledPolicyTests.cs b/test/Libraries/Microsoft.Extensions.AsyncState.Tests/FeaturesPooledPolicyTests.cs index 909389acb95..6e360789cd9 100644 --- a/test/Libraries/Microsoft.Extensions.AsyncState.Tests/FeaturesPooledPolicyTests.cs +++ b/test/Libraries/Microsoft.Extensions.AsyncState.Tests/FeaturesPooledPolicyTests.cs @@ -2,7 +2,6 @@ // The .NET Foundation licenses this file to you under the MIT license. using System; -using System.Collections.Generic; using Xunit; namespace Microsoft.Extensions.AsyncState.Test; @@ -13,7 +12,7 @@ public void Return_ShouldBeTrue() { var policy = new FeaturesPooledPolicy(); - Assert.True(policy.Return([])); + Assert.True(policy.Return(new Features())); } [Fact] @@ -21,12 +20,14 @@ public void Return_ShouldNullList() { var policy = new FeaturesPooledPolicy(); - var list = policy.Create(); - list.Add(string.Empty); - list.Add(Array.Empty()); - list.Add(new object()); + var features = policy.Create(); + features.Set(0, string.Empty); + features.Set(1, Array.Empty()); + features.Set(2, new object()); - Assert.True(policy.Return(list)); - Assert.All(list, el => Assert.Null(el)); + Assert.True(policy.Return(features)); + Assert.Null(features.Get(0)); + Assert.Null(features.Get(1)); + Assert.Null(features.Get(2)); } } From b8c91f255f92e96e26eb32688844aa9ef1ca308e Mon Sep 17 00:00:00 2001 From: Martin Taillefer Date: Wed, 27 Dec 2023 05:56:58 -0800 Subject: [PATCH 118/172] Address some trivial experimental items (#4837) Fixes #4819 Co-authored-by: Martin Taillefer --- .../IAsyncLocalContext.cs | 3 -- .../HmacRedactor.cs | 18 ++++++++--- .../HmacRedactorOptions.cs | 4 +-- ...osoft.Extensions.Compliance.Redaction.json | 32 +++++++++++++++---- .../RedactionExtensions.cs | 3 -- .../Logging/FakeLogRecord.cs | 3 -- ...rosoft.Extensions.Diagnostics.Testing.json | 6 +++- 7 files changed, 45 insertions(+), 24 deletions(-) diff --git a/src/Libraries/Microsoft.Extensions.AsyncState/IAsyncLocalContext.cs b/src/Libraries/Microsoft.Extensions.AsyncState/IAsyncLocalContext.cs index 8934fef1b9d..746909d1b8c 100644 --- a/src/Libraries/Microsoft.Extensions.AsyncState/IAsyncLocalContext.cs +++ b/src/Libraries/Microsoft.Extensions.AsyncState/IAsyncLocalContext.cs @@ -2,8 +2,6 @@ // The .NET Foundation licenses this file to you under the MIT license. using System.ComponentModel; -using System.Diagnostics.CodeAnalysis; -using Microsoft.Shared.DiagnosticIds; namespace Microsoft.Extensions.AsyncState; @@ -12,7 +10,6 @@ namespace Microsoft.Extensions.AsyncState; /// /// The type of the asynchronous state. /// This type is intended for internal use. Use instead. -[Experimental(diagnosticId: DiagnosticIds.Experiments.AsyncState, UrlFormat = DiagnosticIds.UrlFormat)] [EditorBrowsable(EditorBrowsableState.Never)] #pragma warning disable S4023 // Interfaces should not be empty public interface IAsyncLocalContext : IAsyncContext diff --git a/src/Libraries/Microsoft.Extensions.Compliance.Redaction/HmacRedactor.cs b/src/Libraries/Microsoft.Extensions.Compliance.Redaction/HmacRedactor.cs index 0f76e3a9c00..47352c849aa 100644 --- a/src/Libraries/Microsoft.Extensions.Compliance.Redaction/HmacRedactor.cs +++ b/src/Libraries/Microsoft.Extensions.Compliance.Redaction/HmacRedactor.cs @@ -17,7 +17,10 @@ namespace Microsoft.Extensions.Compliance.Redaction; -internal sealed class HmacRedactor : Redactor +/// +/// A redactor using HMACSHA256 to encode data being redacted. +/// +public sealed class HmacRedactor : Redactor { #if NET6_0_OR_GREATER private const int SHA256HashSizeInBytes = 32; @@ -33,18 +36,23 @@ internal sealed class HmacRedactor : Redactor private readonly byte[] _hashKey; private readonly string _keyId; + /// + /// Initializes a new instance of the class. + /// + /// Controls the behavior of the redactor. public HmacRedactor(IOptions options) { - var value = Throw.IfMemberNull(options, options.Value); + var value = Throw.IfMemberNull(options, options?.Value); _hashKey = Convert.FromBase64String(value.Key); _keyId = value.KeyId.HasValue ? value.KeyId.Value.ToInvariantString() + ':' : string.Empty; _redactedLength = Base64HashLength + _keyId.Length; } - public override int GetRedactedLength(ReadOnlySpan source) + /// + public override int GetRedactedLength(ReadOnlySpan input) { - if (source.IsEmpty) + if (input.IsEmpty) { return 0; } @@ -53,6 +61,7 @@ public override int GetRedactedLength(ReadOnlySpan source) } #if NET6_0_OR_GREATER + /// public override int Redact(ReadOnlySpan source, Span destination) { var length = GetRedactedLength(source); @@ -82,6 +91,7 @@ private static int CreateSha256Hash(ReadOnlySpan source, Span destin #else + /// public override int Redact(ReadOnlySpan source, Span destination) { const int RemainingBytesToPadForBase64Hash = BytesOfHashWeUse % 3; diff --git a/src/Libraries/Microsoft.Extensions.Compliance.Redaction/HmacRedactorOptions.cs b/src/Libraries/Microsoft.Extensions.Compliance.Redaction/HmacRedactorOptions.cs index a66b6aefd47..1a110339ad1 100644 --- a/src/Libraries/Microsoft.Extensions.Compliance.Redaction/HmacRedactorOptions.cs +++ b/src/Libraries/Microsoft.Extensions.Compliance.Redaction/HmacRedactorOptions.cs @@ -2,14 +2,12 @@ // The .NET Foundation licenses this file to you under the MIT license. using System.Diagnostics.CodeAnalysis; -using Microsoft.Shared.DiagnosticIds; namespace Microsoft.Extensions.Compliance.Redaction; /// -/// A redactor using HMACSHA256 to encode data being redacted. +/// Options to control the . /// -[Experimental(diagnosticId: DiagnosticIds.Experiments.Compliance, UrlFormat = DiagnosticIds.UrlFormat)] public class HmacRedactorOptions { /// diff --git a/src/Libraries/Microsoft.Extensions.Compliance.Redaction/Microsoft.Extensions.Compliance.Redaction.json b/src/Libraries/Microsoft.Extensions.Compliance.Redaction/Microsoft.Extensions.Compliance.Redaction.json index 88f44e26362..7c646a7e9b1 100644 --- a/src/Libraries/Microsoft.Extensions.Compliance.Redaction/Microsoft.Extensions.Compliance.Redaction.json +++ b/src/Libraries/Microsoft.Extensions.Compliance.Redaction/Microsoft.Extensions.Compliance.Redaction.json @@ -1,5 +1,5 @@ { - "Name": "Microsoft.Extensions.Compliance.Redaction, Version=8.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35", + "Name": "Microsoft.Extensions.Compliance.Redaction, Version=8.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35", "Types": [ { "Type": "sealed class Microsoft.Extensions.Compliance.Redaction.ErasingRedactor : Microsoft.Extensions.Compliance.Redaction.Redactor", @@ -25,23 +25,41 @@ } ] }, + { + "Type": "sealed class Microsoft.Extensions.Compliance.Redaction.HmacRedactor : Microsoft.Extensions.Compliance.Redaction.Redactor", + "Stage": "Stable", + "Methods": [ + { + "Member": "Microsoft.Extensions.Compliance.Redaction.HmacRedactor.HmacRedactor(Microsoft.Extensions.Options.IOptions options);", + "Stage": "Stable" + }, + { + "Member": "override int Microsoft.Extensions.Compliance.Redaction.HmacRedactor.GetRedactedLength(System.ReadOnlySpan input);", + "Stage": "Stable" + }, + { + "Member": "override int Microsoft.Extensions.Compliance.Redaction.HmacRedactor.Redact(System.ReadOnlySpan source, System.Span destination);", + "Stage": "Stable" + } + ] + }, { "Type": "class Microsoft.Extensions.Compliance.Redaction.HmacRedactorOptions", - "Stage": "Experimental", + "Stage": "Stable", "Methods": [ { "Member": "Microsoft.Extensions.Compliance.Redaction.HmacRedactorOptions.HmacRedactorOptions();", - "Stage": "Experimental" + "Stage": "Stable" } ], "Properties": [ { "Member": "string Microsoft.Extensions.Compliance.Redaction.HmacRedactorOptions.Key { get; set; }", - "Stage": "Experimental" + "Stage": "Stable" }, { "Member": "int? Microsoft.Extensions.Compliance.Redaction.HmacRedactorOptions.KeyId { get; set; }", - "Stage": "Experimental" + "Stage": "Stable" } ] }, @@ -51,11 +69,11 @@ "Methods": [ { "Member": "static Microsoft.Extensions.Compliance.Redaction.IRedactionBuilder Microsoft.Extensions.Compliance.Redaction.RedactionExtensions.SetHmacRedactor(this Microsoft.Extensions.Compliance.Redaction.IRedactionBuilder builder, System.Action configure, params Microsoft.Extensions.Compliance.Classification.DataClassificationSet[] classifications);", - "Stage": "Experimental" + "Stage": "Stable" }, { "Member": "static Microsoft.Extensions.Compliance.Redaction.IRedactionBuilder Microsoft.Extensions.Compliance.Redaction.RedactionExtensions.SetHmacRedactor(this Microsoft.Extensions.Compliance.Redaction.IRedactionBuilder builder, Microsoft.Extensions.Configuration.IConfigurationSection section, params Microsoft.Extensions.Compliance.Classification.DataClassificationSet[] classifications);", - "Stage": "Experimental" + "Stage": "Stable" } ] }, diff --git a/src/Libraries/Microsoft.Extensions.Compliance.Redaction/RedactionExtensions.cs b/src/Libraries/Microsoft.Extensions.Compliance.Redaction/RedactionExtensions.cs index e3bee7e2605..191d8af6f55 100644 --- a/src/Libraries/Microsoft.Extensions.Compliance.Redaction/RedactionExtensions.cs +++ b/src/Libraries/Microsoft.Extensions.Compliance.Redaction/RedactionExtensions.cs @@ -6,7 +6,6 @@ using Microsoft.Extensions.Compliance.Classification; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; -using Microsoft.Shared.DiagnosticIds; using Microsoft.Shared.Diagnostics; namespace Microsoft.Extensions.Compliance.Redaction; @@ -24,7 +23,6 @@ public static class RedactionExtensions /// The data classifications for which the redactor type should be used. /// The value of . /// , , or is . - [Experimental(diagnosticId: DiagnosticIds.Experiments.Compliance, UrlFormat = DiagnosticIds.UrlFormat)] public static IRedactionBuilder SetHmacRedactor(this IRedactionBuilder builder, Action configure, params DataClassificationSet[] classifications) { _ = Throw.IfNull(builder); @@ -47,7 +45,6 @@ public static IRedactionBuilder SetHmacRedactor(this IRedactionBuilder builder, /// The data classifications for which the redactor type should be used. /// The value of . /// , , or is . - [Experimental(diagnosticId: DiagnosticIds.Experiments.Compliance, UrlFormat = DiagnosticIds.UrlFormat)] [DynamicDependency(DynamicallyAccessedMemberTypes.All, typeof(HmacRedactorOptions))] [UnconditionalSuppressMessage( "Trimming", diff --git a/src/Libraries/Microsoft.Extensions.Diagnostics.Testing/Logging/FakeLogRecord.cs b/src/Libraries/Microsoft.Extensions.Diagnostics.Testing/Logging/FakeLogRecord.cs index e9828cff6a0..8a3b184732d 100644 --- a/src/Libraries/Microsoft.Extensions.Diagnostics.Testing/Logging/FakeLogRecord.cs +++ b/src/Libraries/Microsoft.Extensions.Diagnostics.Testing/Logging/FakeLogRecord.cs @@ -3,9 +3,7 @@ using System; using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; using Microsoft.Extensions.Logging; -using Microsoft.Shared.DiagnosticIds; using Microsoft.Shared.Diagnostics; namespace Microsoft.Extensions.Logging.Testing; @@ -77,7 +75,6 @@ public FakeLogRecord(LogLevel level, EventId id, object? state, Exception? excep /// The value associated with the key, or if the key was not found. If the structured /// state contains multiple entries with the same key, the value associated with the first matching key encountered is returned. /// - [Experimental(diagnosticId: DiagnosticIds.Experiments.Telemetry, UrlFormat = DiagnosticIds.UrlFormat)] public string? GetStructuredStateValue(string key) { if (StructuredState is not null) diff --git a/src/Libraries/Microsoft.Extensions.Diagnostics.Testing/Microsoft.Extensions.Diagnostics.Testing.json b/src/Libraries/Microsoft.Extensions.Diagnostics.Testing/Microsoft.Extensions.Diagnostics.Testing.json index 4432a3ca1c5..b2e7a70ed15 100644 --- a/src/Libraries/Microsoft.Extensions.Diagnostics.Testing/Microsoft.Extensions.Diagnostics.Testing.json +++ b/src/Libraries/Microsoft.Extensions.Diagnostics.Testing/Microsoft.Extensions.Diagnostics.Testing.json @@ -1,5 +1,5 @@ { - "Name": "Microsoft.Extensions.Diagnostics.Testing, Version=8.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35", + "Name": "Microsoft.Extensions.Diagnostics.Testing, Version=8.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35", "Types": [ { "Type": "sealed class Microsoft.Extensions.Diagnostics.Metrics.Testing.CollectedMeasurement where T : struct", @@ -257,6 +257,10 @@ "Member": "Microsoft.Extensions.Logging.Testing.FakeLogRecord.FakeLogRecord(Microsoft.Extensions.Logging.LogLevel level, Microsoft.Extensions.Logging.EventId id, object? state, System.Exception? exception, string message, System.Collections.Generic.IReadOnlyList scopes, string? category, bool enabled, System.DateTimeOffset timestamp);", "Stage": "Stable" }, + { + "Member": "string? Microsoft.Extensions.Logging.Testing.FakeLogRecord.GetStructuredStateValue(string key);", + "Stage": "Stable" + }, { "Member": "override string Microsoft.Extensions.Logging.Testing.FakeLogRecord.ToString();", "Stage": "Stable" From 40fdaf9b3142ef8506b3012da6b44ba8ced93756 Mon Sep 17 00:00:00 2001 From: Martin Taillefer Date: Wed, 27 Dec 2023 06:17:17 -0800 Subject: [PATCH 119/172] Separate EnableRedaction and EnableEnrichment (#4838) * Separate EnableRedaction and EnableEnrichment - Prior, calling EnableRedaction or EnableEnrichment would always enable both enrichment and redaction together. Now, each call only affects the specific feature it is intended. Fixes #4683 * Update src/Libraries/Microsoft.Extensions.Telemetry/Logging/ExtendedLoggerFactory.cs Co-authored-by: Igor Velikorossov --------- Co-authored-by: Martin Taillefer Co-authored-by: Igor Velikorossov --- .../Logging/ExtendedLoggerFactory.cs | 12 ++++- .../Logging/ExtendedLoggerTests.cs | 49 +++++++++++++++---- 2 files changed, 51 insertions(+), 10 deletions(-) diff --git a/src/Libraries/Microsoft.Extensions.Telemetry/Logging/ExtendedLoggerFactory.cs b/src/Libraries/Microsoft.Extensions.Telemetry/Logging/ExtendedLoggerFactory.cs index 4f3a0525aae..9a98b8446f4 100644 --- a/src/Libraries/Microsoft.Extensions.Telemetry/Logging/ExtendedLoggerFactory.cs +++ b/src/Libraries/Microsoft.Extensions.Telemetry/Logging/ExtendedLoggerFactory.cs @@ -63,6 +63,16 @@ public ExtendedLoggerFactory( _filterOptionsChangeTokenRegistration = filterOptions.OnChange(RefreshFilters); RefreshFilters(filterOptions.CurrentValue); + if (enrichmentOptions is null) + { + // enrichmentOptions is only present if EnableEnrichment was called, so if it's null + // then ignore all the supplied enrichers, we're not doing enrichment +#pragma warning disable S1226 + enrichers = []; + staticEnrichers = []; +#pragma warning restore S1226 + } + _enrichers = enrichers.Select>(e => e.Enrich).ToArray(); _enrichmentOptionsChangeTokenRegistration = enrichmentOptions?.OnChange(UpdateEnrichmentOptions); _redactionOptionsChangeTokenRegistration = redactionOptions?.OnChange(UpdateRedactionOptions); @@ -80,7 +90,7 @@ public ExtendedLoggerFactory( } _staticTags = [.. tags]; - Config = ComputeConfig(enrichmentOptions?.CurrentValue, redactionOptions?.CurrentValue); + Config = ComputeConfig(enrichmentOptions?.CurrentValue ?? new(), redactionOptions?.CurrentValue ?? new() { ApplyDiscriminator = false }); } public void Dispose() diff --git a/test/Libraries/Microsoft.Extensions.Telemetry.Tests/Logging/ExtendedLoggerTests.cs b/test/Libraries/Microsoft.Extensions.Telemetry.Tests/Logging/ExtendedLoggerTests.cs index abc274e2cf0..69d1d0e8f57 100644 --- a/test/Libraries/Microsoft.Extensions.Telemetry.Tests/Logging/ExtendedLoggerTests.cs +++ b/test/Libraries/Microsoft.Extensions.Telemetry.Tests/Logging/ExtendedLoggerTests.cs @@ -16,8 +16,9 @@ namespace Microsoft.Extensions.Logging.Test; public static class ExtendedLoggerTests { - [Fact] - public static void Basic() + [Theory] + [CombinatorialData] + public static void FeatureEnablement(bool enableRedaction, bool enableEnrichment) { const string Category = "C1"; @@ -39,11 +40,14 @@ public static void Basic() RedactionFormat = "REDACTED<{0}>", }); + var enrichmentOptions = enableEnrichment ? new StaticOptionsMonitor(new()) : null; + var redactionOptions = enableRedaction ? new StaticOptionsMonitor(new() { ApplyDiscriminator = false }) : null; + using var lf = new ExtendedLoggerFactory( providers: new[] { provider }, filterOptions: new StaticOptionsMonitor(new()), - enrichmentOptions: new StaticOptionsMonitor(new()), - redactionOptions: new StaticOptionsMonitor(new() { ApplyDiscriminator = false }), + enrichmentOptions: enrichmentOptions, + redactionOptions: redactionOptions, enrichers: new[] { enricher }, staticEnrichers: new[] { staticEnricher }, redactorProvider: redactorProvider, @@ -74,18 +78,45 @@ public static void Basic() Assert.Null(snap[0].Exception); Assert.Equal(new EventId(0), snap[0].Id); Assert.Equal("MSG0", snap[0].Message); - Assert.Equal("EV1", snap[0].GetStructuredStateValue("EK1")); - Assert.Equal("SEV1", snap[0].GetStructuredStateValue("SEK1")); + + if (enableEnrichment) + { + Assert.Equal("SEV1", snap[0].GetStructuredStateValue("SEK1")); + Assert.Equal("EV1", snap[0].GetStructuredStateValue("EK1")); + } + else + { + Assert.Null(snap[0].GetStructuredStateValue("SEK1")); + Assert.Null(snap[0].GetStructuredStateValue("EK1")); + } Assert.Equal(Category, snap[1].Category); Assert.Null(snap[1].Exception); Assert.Equal(new EventId(2, "ID2"), snap[1].Id); Assert.Equal("MSG2", snap[1].Message); Assert.Equal("PV2", snap[1].GetStructuredStateValue("PK2")); - Assert.Equal("REDACTED", snap[1].GetStructuredStateValue("PK3")); + + if (enableRedaction) + { + Assert.Equal("REDACTED", snap[1].GetStructuredStateValue("PK3")); + } + else + { + Assert.Equal("PV3", snap[1].GetStructuredStateValue("PK3")); + } + Assert.Null(snap[1].GetStructuredStateValue("PK4")); - Assert.Equal("EV1", snap[1].GetStructuredStateValue("EK1")); - Assert.Equal("SEV1", snap[1].GetStructuredStateValue("SEK1")); + + if (enableEnrichment) + { + Assert.Equal("SEV1", snap[1].GetStructuredStateValue("SEK1")); + Assert.Equal("EV1", snap[1].GetStructuredStateValue("EK1")); + } + else + { + Assert.Null(snap[1].GetStructuredStateValue("SEK1")); + Assert.Null(snap[1].GetStructuredStateValue("EK1")); + } } [Theory] From f4315cd121a4b4006db2ba5744c602e4fef13508 Mon Sep 17 00:00:00 2001 From: Martin Taillefer Date: Wed, 27 Dec 2023 11:22:32 -0800 Subject: [PATCH 120/172] Work on the logging generator. (#4840) - The generator now produces a warning when asked to log an object which doesn't implement ToString(), IConvertible, or IFormattable. Fixed #4835. - Added support for the Transitive property in the LogProperties attribute. When set to true, this causes automatic transitive traversal of a complex object, instead of requiring manual annotations of individual properties. Fixes #4738. - Introduce the [TagName] attribute to make it possible to control the tag name used when logging a parameter or property. Fixes #4576. - Fixed some situations where unnatural errors were produced as a result of a prior error. The dummy follow-on errors are now avoided. - Fixed handling of cases where parameters or properties were of type of the non-generic IEnumerable. The specific type wasn't being recorgnized and treated as an enumerable. Co-authored-by: Martin Taillefer --- docs/list-of-diagnostics.md | 54 +--------- .../Emission/Emitter.Method.cs | 100 +++++++++--------- .../Emission/Emitter.Utils.cs | 2 +- .../Model/LoggingMethod.cs | 36 ++++++- .../Model/LoggingMethodParameter.cs | 7 +- .../Model/LoggingMethodParameterExtensions.cs | 3 +- .../Model/LoggingProperty.cs | 7 +- .../Parsing/AttributeProcessors.cs | 16 ++- .../Parsing/DiagDescriptors.cs | 13 ++- .../Parsing/Parser.LogProperties.cs | 58 +++++++--- .../Microsoft.Gen.Logging/Parsing/Parser.cs | 90 ++++++++++++---- .../Parsing/Resources.Designer.cs | 54 ++++++---- .../Parsing/Resources.resx | 14 ++- .../Parsing/SymbolHolder.cs | 3 +- .../Parsing/SymbolLoader.cs | 4 + .../Parsing/TemplateExtractor.cs | 17 +-- .../Parsing/TypeSymbolExtensions.cs | 22 +++- .../Logging/LogPropertiesAttribute.cs | 21 +++- .../Logging/TagNameAttribute.cs | 34 ++++++ src/Shared/DiagnosticIds/DiagnosticIds.cs | 28 +---- .../Generated/TagNameTests.cs | 28 +++++ .../Generated/TransitiveTests.cs | 40 +++++++ .../LogPropertiesSpecialTypesExtensions.cs | 2 + .../TestClasses/TagNameExtensions.cs | 13 +++ .../TestClasses/TransitiveTestExtensions.cs | 28 +++++ .../Unit/EmitterTests.cs | 2 + .../Unit/EmitterUtilsTests.cs | 2 +- .../Unit/LogParserUtilitiesTests.cs | 3 + .../Unit/LoggingMethodParameterTests.cs | 8 +- .../Unit/LoggingMethodTests.cs | 18 ---- .../Unit/ParserTests.LogProperties.cs | 62 +++++++++-- .../Microsoft.Gen.Logging/Unit/ParserTests.cs | 2 + .../Logging/LogPropertiesAttributeTests.cs | 10 ++ .../Logging/TagNameAttributeTests.cs | 19 ++++ 34 files changed, 566 insertions(+), 254 deletions(-) create mode 100644 src/Libraries/Microsoft.Extensions.Telemetry.Abstractions/Logging/TagNameAttribute.cs create mode 100644 test/Generators/Microsoft.Gen.Logging/Generated/TagNameTests.cs create mode 100644 test/Generators/Microsoft.Gen.Logging/Generated/TransitiveTests.cs create mode 100644 test/Generators/Microsoft.Gen.Logging/TestClasses/TagNameExtensions.cs create mode 100644 test/Generators/Microsoft.Gen.Logging/TestClasses/TransitiveTestExtensions.cs create mode 100644 test/Libraries/Microsoft.Extensions.Telemetry.Abstractions.Tests/Logging/TagNameAttributeTests.cs diff --git a/docs/list-of-diagnostics.md b/docs/list-of-diagnostics.md index db04bdd4529..47778c3774c 100644 --- a/docs/list-of-diagnostics.md +++ b/docs/list-of-diagnostics.md @@ -8,56 +8,6 @@ | `CTXOPTGEN002` | The options context type does not have usable properties | | `CTXOPTGEN003` | The options context cannot be a ref-like type | - -# Design - -| Diagnostic ID | Description | -| :---------------- | :---------- | -| `AUTOCLIENTGEN001` | API client interfaces must not be nested types | -| `AUTOCLIENTGEN002` | REST API client does not have methods defined | -| `AUTOCLIENTGEN003` | An API method must not contain more than one REST method attribute | -| `AUTOCLIENTGEN004` | Invalid API method return type | -| `AUTOCLIENTGEN005` | API methods can't be generic | -| `AUTOCLIENTGEN006` | The current HTTP method does not support the body tag | -| `AUTOCLIENTGEN007` | API methods must not be static | -| `AUTOCLIENTGEN008` | HTTP method missing | -| `AUTOCLIENTGEN009` | The API interface cannot be generic | -| `AUTOCLIENTGEN010` | Invalid API interface name | -| `AUTOCLIENTGEN011` | Duplicate body attribute | -| `AUTOCLIENTGEN012` | URL parameter missing from path | -| `AUTOCLIENTGEN013` | REST API method has more than one cancellation token | -| `AUTOCLIENTGEN014` | Missing CancellationToken from REST API method | -| `AUTOCLIENTGEN015` | API method path should not contain query | -| `AUTOCLIENTGEN016` | A REST API method's request name must be unique | -| `AUTOCLIENTGEN017` | Invalid HttpClient name | -| `AUTOCLIENTGEN018` | Invalid dependency name | -| `AUTOCLIENTGEN019` | Invalid header name | -| `AUTOCLIENTGEN020` | Invalid header value | -| `AUTOCLIENTGEN021` | Invalid REST method path | -| `AUTOCLIENTGEN022` | Invalid request name | - - -# ExtraAnalyzers - -| Diagnostic ID | Category | Description | -| :---------------- | :---------- | :---------- | -| `EA0000` | Performance | Use source generated logging methods for improved performance | -| `EA0001` | Performance | Perform message formatting in the body of the logging method | -| `EA0002` | Reliability | Use 'System.TimeProvider' to make the code easier to test | -| `EA0003` | Performance | Use the character-based overloads of 'String.StartsWith' or 'String.EndsWith' | -| `EA0004` | Performance | Make types declared in an executable internal | -| `EA0005` | Performance | Consider using an array instead of a collection | -| `EA0006` | Performance | Replace uses of 'Enum.GetName' and 'Enum.ToString' for improved performance | -| `EA0007` | Performance | Use 'System.ValueTuple' instead of 'System.Tuple' for improved performance | -| `EA0008` | Performance | Use generic collections instead of legacy collections for improved performance | -| `EA0009` | Performance | Use 'System.MemoryExtensions.Split' for improved performance | -| `EA0010` | Correctness | Fire-and-forget async call inside a 'using' block | -| `EA0011` | Performance | Consider removing unnecessary conditional access operator (?) | -| `EA0012` | Performance | Consider removing unnecessary null coalescing assignment (??=) | -| `EA0013` | Performance | Consider removing unnecessary null coalescing operator (??) | -| `EA0014` | Resilience | The async method doesn't support cancellation | - - # Experiments As new functionality is introduced to this repo, new in-development APIs are marked as being experimental. Experimental APIs offer no @@ -72,14 +22,12 @@ If you use experimental APIs, you will get one of the diagnostic shown below. Th using such an API so that you can avoid accidentally depending on experimental features. You may suppress these diagnostics if desired. - | Diagnostic ID | Description | | :---------------- | :---------- | | `EXTEXP0001` | Resilience experiments | | `EXTEXP0002` | Compliance experiments | | `EXTEXP0003` | Telemetry experiments | | `EXTEXP0004` | TimeProvider experiments | -| `EXTEXP0005` | AutoClient experiments | | `EXTEXP0006` | AsyncState experiments | | `EXTEXP0007` | Health check experiments | | `EXTEXP0008` | Resource monitoring experiments | @@ -134,7 +82,7 @@ if desired. | `LOGGEN033` | Method parameter can't be used with a tag provider | | `LOGGEN034` | Attribute can't be used in this context | | `LOGGEN035` | The logging method parameter leaks sensitive data | - +| `LOGGEN036` | A value being logged doesn't have an effective way to be converted into a string | # Metrics diff --git a/src/Generators/Microsoft.Gen.Logging/Emission/Emitter.Method.cs b/src/Generators/Microsoft.Gen.Logging/Emission/Emitter.Method.cs index 2269012bec3..33567379bf9 100644 --- a/src/Generators/Microsoft.Gen.Logging/Emission/Emitter.Method.cs +++ b/src/Generators/Microsoft.Gen.Logging/Emission/Emitter.Method.cs @@ -74,10 +74,10 @@ private void GenLogMethod(LoggingMethod lm) OutLn(); } - var stateName = PickUniqueName("state", lm.Parameters.Select(p => p.Name)); + var stateName = PickUniqueName("state", lm.Parameters.Select(p => p.ParameterName)); OutLn($"var {stateName} = {LoggerMessageHelperType}.ThreadLocalState;"); - GenPropertyLoads(lm, stateName, out int numReservedUnclassifiedTags, out int numReservedClassifiedTags); + GenTagWrites(lm, stateName, out int numReservedUnclassifiedTags, out int numReservedClassifiedTags); OutLn(); OutLn($"{logger}.Log("); @@ -97,7 +97,7 @@ private void GenLogMethod(LoggingMethod lm) OutLn($"{stateName},"); OutLn($"{exceptionArg},"); - var lambdaStateName = PickUniqueName("s", lm.TemplateToParameterName.Select(kvp => kvp.Key)); + var lambdaStateName = PickUniqueName("s", lm.Templates); OutLn($"[{GeneratorUtilities.GeneratedCodeAttribute}] static string ({lambdaStateName}, {exceptionLambdaName}) =>"); OutOpenBrace(); @@ -158,7 +158,7 @@ static bool ShouldStringifyProperty(LoggingProperty p) if (p.ImplementsISpanFormattable) { - // pass object as it, it will be formatted directly into the output buffer + // pass object as is, it will be formatted directly into the output buffer return false; } @@ -211,11 +211,11 @@ static string ConvertPropertyToString(LoggingProperty lp, string arg) { if (p.IsException) { - exceptionArg = p.Name; + exceptionArg = p.ParameterName; if (p.UsedAsTemplate) { - exceptionLambdaArg = lm.GetParameterNameInTemplate(p); + exceptionLambdaArg = lm.GetTemplatesForParameter(p)[0]; } break; @@ -235,11 +235,11 @@ static bool NeedsASlot(LoggingMethodParameter p) return p.IsNormalParameter && !p.HasTagProvider && !p.HasProperties; } - void GenPropertyLoads(LoggingMethod lm, string stateName, out int numReservedUnclassifiedTags, out int numReservedClassifiedTags) + void GenTagWrites(LoggingMethod lm, string stateName, out int numReservedUnclassifiedTags, out int numReservedClassifiedTags) { int numUnclassifiedTags = 0; int numClassifiedTags = 0; - var tmpVarName = PickUniqueName("tmp", lm.Parameters.Select(p => p.Name)); + var tmpVarName = PickUniqueName("tmp", lm.Parameters.Select(p => p.ParameterName)); foreach (var p in lm.Parameters) { @@ -288,20 +288,20 @@ void GenPropertyLoads(LoggingMethod lm, string stateName, out int numReservedUnc { if (NeedsASlot(p) && !p.HasDataClassification) { - var key = $"\"{lm.GetParameterNameInTemplate(p)}\""; + var key = $"\"{p.TagName}\""; string value; if (p.IsEnumerable) { value = p.PotentiallyNull - ? $"{p.NameWithAt} != null ? {LoggerMessageHelperType}.Stringify({p.NameWithAt}) : null" - : $"{LoggerMessageHelperType}.Stringify({p.NameWithAt})"; + ? $"{p.ParameterNameWithAt} != null ? {LoggerMessageHelperType}.Stringify({p.ParameterNameWithAt}) : null" + : $"{LoggerMessageHelperType}.Stringify({p.ParameterNameWithAt})"; } else { value = ShouldStringifyParameter(p) - ? ConvertParameterToString(p, p.NameWithAt) - : p.NameWithAt; + ? ConvertParameterToString(p, p.ParameterNameWithAt) + : p.ParameterNameWithAt; } OutLn($"{stateName}.TagArray[{--count}] = new({key}, {value});"); @@ -348,12 +348,12 @@ void GenPropertyLoads(LoggingMethod lm, string stateName, out int numReservedUnc { if (NeedsASlot(p) && p.HasDataClassification) { - var key = $"\"{lm.GetParameterNameInTemplate(p)}\""; + var key = $"\"{p.TagName}\""; var classification = MakeClassificationValue(p.ClassificationAttributeTypes); var value = ShouldStringifyParameter(p) - ? ConvertParameterToString(p, p.NameWithAt) - : p.NameWithAt; + ? ConvertParameterToString(p, p.ParameterNameWithAt) + : p.ParameterNameWithAt; OutLn($"{stateName}.ClassifiedTagArray[{--count}] = new({key}, {value}, {classification});"); } @@ -469,10 +469,10 @@ void GenPropertyLoads(LoggingMethod lm, string stateName, out int numReservedUnc } else { - OutLn($"{stateName}.TagNamePrefix = nameof({p.NameWithAt});"); + OutLn($"{stateName}.TagNamePrefix = nameof({p.ParameterNameWithAt});"); } - OutLn($"{p.TagProvider!.ContainingType}.{p.TagProvider.MethodName}({stateName}, {p.NameWithAt});"); + OutLn($"{p.TagProvider!.ContainingType}.{p.TagProvider.MethodName}({stateName}, {p.ParameterNameWithAt});"); } } } @@ -488,20 +488,22 @@ bool GenVariableAssignments(LoggingMethod lm, string lambdaStateName, int numRes { if (p.UsedAsTemplate) { - var key = lm.GetParameterNameInTemplate(p); - - var atSign = p.NeedsAtSign ? "@" : string.Empty; - if (p.PotentiallyNull) - { - const string Null = "\"(null)\""; - OutLn($"var {atSign}{key} = {lambdaStateName}.TagArray[{index}].Value ?? {Null};"); - } - else + var templates = lm.GetTemplatesForParameter(p); + foreach (var t in templates) { - OutLn($"var {atSign}{key} = {lambdaStateName}.TagArray[{index}].Value;"); - } + var atSign = p.NeedsAtSign ? "@" : string.Empty; + if (p.PotentiallyNull) + { + const string Null = "\"(null)\""; + OutLn($"var {atSign}{t} = {lambdaStateName}.TagArray[{index}].Value ?? {Null};"); + } + else + { + OutLn($"var {atSign}{t} = {lambdaStateName}.TagArray[{index}].Value;"); + } - generatedAssignments = true; + generatedAssignments = true; + } } index--; @@ -515,20 +517,22 @@ bool GenVariableAssignments(LoggingMethod lm, string lambdaStateName, int numRes { if (p.UsedAsTemplate) { - var key = lm.GetParameterNameInTemplate(p); - - var atSign = p.NeedsAtSign ? "@" : string.Empty; - if (p.PotentiallyNull) - { - const string Null = "\"(null)\""; - OutLn($"var {atSign}{key} = {lambdaStateName}.RedactedTagArray[{index}].Value ?? {Null};"); - } - else + var templates = lm.GetTemplatesForParameter(p); + foreach (var t in templates) { - OutLn($"var {atSign}{key} = {lambdaStateName}.RedactedTagArray[{index}].Value;"); - } + var atSign = p.NeedsAtSign ? "@" : string.Empty; + if (p.PotentiallyNull) + { + const string Null = "\"(null)\""; + OutLn($"var {atSign}{t} = {lambdaStateName}.RedactedTagArray[{index}].Value ?? {Null};"); + } + else + { + OutLn($"var {atSign}{t} = {lambdaStateName}.RedactedTagArray[{index}].Value;"); + } - generatedAssignments = true; + generatedAssignments = true; + } } index--; @@ -547,7 +551,7 @@ bool GenVariableAssignments(LoggingMethod lm, string lambdaStateName, int numRes { if (p.IsLogger) { - logger = p.Name; + logger = p.ParameterName; isNullable = p.IsNullable; break; } @@ -597,7 +601,7 @@ private string AddAtSymbolsToTemplates(string template, IEnumerable Parameters = []; - public readonly Dictionary TemplateToParameterName = new(StringComparer.OrdinalIgnoreCase); + public readonly List Templates = []; public string Name = string.Empty; public string Message = string.Empty; public int? Level; @@ -28,8 +29,33 @@ internal sealed class LoggingMethod public bool LoggerMemberNullable; public bool HasXmlDocumentation; - public string GetParameterNameInTemplate(LoggingMethodParameter parameter) - => TemplateToParameterName.TryGetValue(parameter.Name, out var value) - ? value - : parameter.Name; + public LoggingMethodParameter? GetParameterForTemplate(string templateName) + { + foreach (var p in Parameters) + { + if (templateName.Equals(p.ParameterName, StringComparison.OrdinalIgnoreCase)) + { + return p; + } + } + + return null; + } + + public List GetTemplatesForParameter(LoggingMethodParameter lp) + => GetTemplatesForParameter(lp.ParameterName); + + public List GetTemplatesForParameter(string parameterName) + { + HashSet templates = []; + foreach (var t in Templates) + { + if (parameterName.Equals(t, StringComparison.OrdinalIgnoreCase)) + { + _ = templates.Add(t); + } + } + + return templates.ToList(); + } } diff --git a/src/Generators/Microsoft.Gen.Logging/Model/LoggingMethodParameter.cs b/src/Generators/Microsoft.Gen.Logging/Model/LoggingMethodParameter.cs index cf58a1754c9..80021aba766 100644 --- a/src/Generators/Microsoft.Gen.Logging/Model/LoggingMethodParameter.cs +++ b/src/Generators/Microsoft.Gen.Logging/Model/LoggingMethodParameter.cs @@ -13,7 +13,8 @@ namespace Microsoft.Gen.Logging.Model; [DebuggerDisplay("{Name}")] internal sealed class LoggingMethodParameter { - public string Name = string.Empty; + public string ParameterName = string.Empty; + public string TagName = string.Empty; public string Type = string.Empty; public string? Qualifier; public bool NeedsAtSign; @@ -26,6 +27,7 @@ internal sealed class LoggingMethodParameter public bool ImplementsIConvertible; public bool ImplementsIFormattable; public bool ImplementsISpanFormattable; + public bool HasCustomToString; public bool SkipNullProperties; public bool OmitReferenceName; public bool UsedAsTemplate; @@ -33,7 +35,7 @@ internal sealed class LoggingMethodParameter public List Properties = []; public TagProvider? TagProvider; - public string NameWithAt => NeedsAtSign ? "@" + Name : Name; + public string ParameterNameWithAt => NeedsAtSign ? "@" + ParameterName : ParameterName; public string PotentiallyNullableType => (IsReference && !IsNullable) @@ -48,4 +50,5 @@ public string PotentiallyNullableType public bool HasProperties => Properties.Count > 0; public bool HasTagProvider => TagProvider is not null; public bool PotentiallyNull => (IsReference && !IsLogger) || IsNullable; + public bool IsStringifiable => HasCustomToString || ImplementsIConvertible || ImplementsIFormattable || IsEnumerable; } diff --git a/src/Generators/Microsoft.Gen.Logging/Model/LoggingMethodParameterExtensions.cs b/src/Generators/Microsoft.Gen.Logging/Model/LoggingMethodParameterExtensions.cs index 54ace58c21f..d70b8207fc2 100644 --- a/src/Generators/Microsoft.Gen.Logging/Model/LoggingMethodParameterExtensions.cs +++ b/src/Generators/Microsoft.Gen.Logging/Model/LoggingMethodParameterExtensions.cs @@ -16,7 +16,8 @@ internal static void TraverseParameterPropertiesTransitively( var firstProperty = new LoggingProperty { - Name = parameter.Name, + PropertyName = parameter.ParameterName, + TagName = parameter.TagName, NeedsAtSign = parameter.NeedsAtSign, Type = parameter.Type, IsNullable = parameter.IsNullable, diff --git a/src/Generators/Microsoft.Gen.Logging/Model/LoggingProperty.cs b/src/Generators/Microsoft.Gen.Logging/Model/LoggingProperty.cs index ee7871c0a3f..cb954921b78 100644 --- a/src/Generators/Microsoft.Gen.Logging/Model/LoggingProperty.cs +++ b/src/Generators/Microsoft.Gen.Logging/Model/LoggingProperty.cs @@ -9,7 +9,8 @@ namespace Microsoft.Gen.Logging.Model; [DebuggerDisplay("{Name}")] internal sealed class LoggingProperty { - public string Name = string.Empty; + public string PropertyName = string.Empty; + public string TagName = string.Empty; public string Type = string.Empty; public HashSet ClassificationAttributeTypes = []; public bool NeedsAtSign; @@ -19,6 +20,7 @@ internal sealed class LoggingProperty public bool ImplementsIConvertible; public bool ImplementsIFormattable; public bool ImplementsISpanFormattable; + public bool HasCustomToString; public List Properties = []; public bool OmitReferenceName; public TagProvider? TagProvider; @@ -26,6 +28,7 @@ internal sealed class LoggingProperty public bool HasDataClassification => ClassificationAttributeTypes.Count > 0; public bool HasProperties => Properties.Count > 0; public bool HasTagProvider => TagProvider is not null; - public string NameWithAt => NeedsAtSign ? "@" + Name : Name; + public string PropertyNameWithAt => NeedsAtSign ? "@" + PropertyName : PropertyName; public bool PotentiallyNull => IsReference || IsNullable; + public bool IsStringifiable => HasCustomToString || ImplementsIConvertible || ImplementsIFormattable || IsEnumerable; } diff --git a/src/Generators/Microsoft.Gen.Logging/Parsing/AttributeProcessors.cs b/src/Generators/Microsoft.Gen.Logging/Parsing/AttributeProcessors.cs index dcafa051ac1..f20dd59f52b 100644 --- a/src/Generators/Microsoft.Gen.Logging/Parsing/AttributeProcessors.cs +++ b/src/Generators/Microsoft.Gen.Logging/Parsing/AttributeProcessors.cs @@ -15,6 +15,7 @@ internal static class AttributeProcessors private const string SkipEnabledCheckProperty = "SkipEnabledCheck"; private const string SkipNullProperties = "SkipNullProperties"; private const string OmitReferenceName = "OmitReferenceName"; + private const string Transitive = "Transitive"; private const int LogLevelError = 4; private const int LogLevelCritical = 5; @@ -124,10 +125,11 @@ public static (int? eventId, int? level, string message, string? eventName, bool return (eventId, level, message, eventName, skipEnabledCheck); } - public static (bool skipNullProperties, bool omitReferenceName) ExtractLogPropertiesAttributeValues(AttributeData attr) + public static (bool skipNullProperties, bool omitReferenceName, bool transitive) ExtractLogPropertiesAttributeValues(AttributeData attr) { bool skipNullProperties = false; bool omitReferenceName = false; + bool transitive = false; foreach (var a in attr.NamedArguments) { @@ -148,10 +150,17 @@ public static (bool skipNullProperties, bool omitReferenceName) ExtractLogProper omitReferenceName = b; } } + else if (a.Key == Transitive) + { + if (v is bool b) + { + transitive = b; + } + } } } - return (skipNullProperties, omitReferenceName); + return (skipNullProperties, omitReferenceName, transitive); } public static (bool omitReferenceName, ITypeSymbol providerType, string providerMethodName) ExtractTagProviderAttributeValues(AttributeData attr) @@ -180,4 +189,7 @@ public static (bool omitReferenceName, ITypeSymbol providerType, string provider return (omitReferenceName, providerType!, providerMethodName!); } + + public static string ExtractTagNameAttributeValues(AttributeData attr) + => attr.ConstructorArguments[0].Value as string ?? string.Empty; } diff --git a/src/Generators/Microsoft.Gen.Logging/Parsing/DiagDescriptors.cs b/src/Generators/Microsoft.Gen.Logging/Parsing/DiagDescriptors.cs index bac2e7a81e8..081e098ccde 100644 --- a/src/Generators/Microsoft.Gen.Logging/Parsing/DiagDescriptors.cs +++ b/src/Generators/Microsoft.Gen.Logging/Parsing/DiagDescriptors.cs @@ -196,10 +196,10 @@ internal sealed class DiagDescriptors : DiagDescriptorsBase messageFormat: Resources.LogPropertiesHiddenPropertyDetectedMessage, category: Category); - public static DiagnosticDescriptor LogPropertiesNameCollision { get; } = Make( + public static DiagnosticDescriptor TagNameCollision { get; } = Make( id: DiagnosticIds.LoggerMessage.LOGGEN029, - title: Resources.LogPropertiesNameCollisionTitle, - messageFormat: Resources.LogPropertiesNameCollisionMessage, + title: Resources.TagNameCollisionTitle, + messageFormat: Resources.TagNameCollisionMessage, category: Category); public static DiagnosticDescriptor EmptyLoggingMethod { get; } = Make( @@ -237,4 +237,11 @@ internal sealed class DiagDescriptors : DiagDescriptorsBase title: Resources.RecordTypeSensitiveArgumentIsInTemplateTitle, messageFormat: Resources.RecordTypeSensitiveArgumentIsInTemplateMessage, category: Category); + + public static DiagnosticDescriptor DefaultToString { get; } = Make( + id: DiagnosticIds.LoggerMessage.LOGGEN036, + title: Resources.DefaultToStringTitle, + messageFormat: Resources.DefaultToStringMessage, + category: Category, + DiagnosticSeverity.Warning); } diff --git a/src/Generators/Microsoft.Gen.Logging/Parsing/Parser.LogProperties.cs b/src/Generators/Microsoft.Gen.Logging/Parsing/Parser.LogProperties.cs index 4fabb10e603..3f5cf8988ef 100644 --- a/src/Generators/Microsoft.Gen.Logging/Parsing/Parser.LogProperties.cs +++ b/src/Generators/Microsoft.Gen.Logging/Parsing/Parser.LogProperties.cs @@ -47,13 +47,13 @@ internal bool ProcessLogPropertiesForParameter( paramTypeSymbol = ((INamedTypeSymbol)paramTypeSymbol).TypeArguments[0]; } - (lp.SkipNullProperties, lp.OmitReferenceName) = AttributeProcessors.ExtractLogPropertiesAttributeValues(logPropertiesAttribute); + (lp.SkipNullProperties, lp.OmitReferenceName, bool transitive) = AttributeProcessors.ExtractLogPropertiesAttributeValues(logPropertiesAttribute); var typesChain = new HashSet(SymbolEqualityComparer.Default); _ = typesChain.Add(paramTypeSymbol); // Add itself - var props = GetTypePropertiesToLog(paramTypeSymbol, typesChain, symbols, ref foundDataClassificationAttributes); + var props = GetTypePropertiesToLog(paramTypeSymbol, typesChain, symbols, transitive, ref foundDataClassificationAttributes); if (props == null) { return false; @@ -86,6 +86,7 @@ static string GetPropertyIdentifier(IPropertySymbol property, CancellationToken ITypeSymbol type, ISet typesChain, SymbolHolder symbols, + bool transitive, ref bool foundDataClassificationAttributes) { var result = new List(); @@ -182,9 +183,15 @@ static string GetPropertyIdentifier(IPropertySymbol property, CancellationToken extractedType = ((INamedTypeSymbol)extractedType).TypeArguments[0]; } + var tagNameAttribute = ParserUtilities.GetSymbolAttributeAnnotationOrDefault(symbols.TagNameAttribute, property); + var tagName = tagNameAttribute != null + ? AttributeProcessors.ExtractTagNameAttributeValues(tagNameAttribute) + : property.Name; + var lp = new LoggingProperty { - Name = property.Name, + PropertyName = property.Name, + TagName = tagName, Type = property.Type.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat), ClassificationAttributeTypes = classification, IsReference = property.Type.IsReferenceType, @@ -193,6 +200,7 @@ static string GetPropertyIdentifier(IPropertySymbol property, CancellationToken ImplementsIConvertible = property.Type.ImplementsIConvertible(symbols), ImplementsIFormattable = property.Type.ImplementsIFormattable(symbols), ImplementsISpanFormattable = property.Type.ImplementsISpanFormattable(symbols), + HasCustomToString = property.Type.HasCustomToString(), }; if (!property.DeclaringSyntaxReferences.IsDefaultOrEmpty) @@ -233,14 +241,16 @@ static string GetPropertyIdentifier(IPropertySymbol property, CancellationToken return null; } - if (logPropertiesAttribute != null) + if (logPropertiesAttribute != null || (transitive && tagProviderAttribute == null && logPropertyIgnoreAttribute == null)) { - _ = CanLogProperties(property, property.Type, symbols); - if ((property.DeclaredAccessibility != Accessibility.Public || property.IsStatic) || (property.GetMethod == null || property.GetMethod.DeclaredAccessibility != Accessibility.Public)) { - Diag(DiagDescriptors.InvalidAttributeUsage, logPropertiesAttribute.ApplicationSyntaxReference?.GetSyntax(_cancellationToken).GetLocation(), "LogProperties"); + if (logPropertiesAttribute != null) + { + Diag(DiagDescriptors.InvalidAttributeUsage, logPropertiesAttribute.ApplicationSyntaxReference?.GetSyntax(_cancellationToken).GetLocation(), "LogProperties"); + } + continue; } @@ -260,13 +270,16 @@ static string GetPropertyIdentifier(IPropertySymbol property, CancellationToken extractedType = ((INamedTypeSymbol)extractedType).TypeArguments[0]; } - _ = typesChain.Add(namedType); - var props = GetTypePropertiesToLog(extractedType, typesChain, symbols, ref foundDataClassificationAttributes); - _ = typesChain.Remove(namedType); - - if (props != null) + if (CanLogProperties(property, property.Type, symbols, silent: logPropertiesAttribute == null)) { - lp.Properties.AddRange(props); + _ = typesChain.Add(namedType); + var props = GetTypePropertiesToLog(extractedType, typesChain, symbols, transitive, ref foundDataClassificationAttributes); + _ = typesChain.Remove(namedType); + + if (props != null) + { + lp.Properties.AddRange(props); + } } } @@ -284,7 +297,7 @@ static string GetPropertyIdentifier(IPropertySymbol property, CancellationToken } } - if (tagProviderAttribute == null && logPropertiesAttribute == null) + if (tagProviderAttribute == null && logPropertiesAttribute == null && !transitive) { if ((property.DeclaredAccessibility != Accessibility.Public || property.IsStatic) || (property.GetMethod == null || property.GetMethod.DeclaredAccessibility != Accessibility.Public) @@ -301,6 +314,15 @@ static string GetPropertyIdentifier(IPropertySymbol property, CancellationToken lp.ClassificationAttributeTypes.Clear(); } + if ((logPropertiesAttribute is null) + && (tagProviderAttribute is null) + && !lp.IsStringifiable + && property.Type.Kind != SymbolKind.TypeParameter + && !transitive) + { + Diag(DiagDescriptors.DefaultToString, property.GetLocation(), property.Type, property.Name); + } + result.Add(lp); } @@ -311,7 +333,7 @@ static string GetPropertyIdentifier(IPropertySymbol property, CancellationToken return result; } - bool CanLogProperties(ISymbol sym, ITypeSymbol symType, SymbolHolder symbols) + bool CanLogProperties(ISymbol sym, ITypeSymbol symType, SymbolHolder symbols, bool silent = false) { var isRegularType = symType.Kind == SymbolKind.NamedType && @@ -326,7 +348,11 @@ bool CanLogProperties(ISymbol sym, ITypeSymbol symType, SymbolHolder symbols) if (!isRegularType || symType.IsSpecialType(symbols)) { - Diag(DiagDescriptors.InvalidTypeToLogProperties, sym.GetLocation(), symType.ToDisplayString()); + if (!silent) + { + Diag(DiagDescriptors.InvalidTypeToLogProperties, sym.GetLocation(), symType.ToDisplayString()); + } + return false; } diff --git a/src/Generators/Microsoft.Gen.Logging/Parsing/Parser.cs b/src/Generators/Microsoft.Gen.Logging/Parsing/Parser.cs index 4a8793c49b5..00b2f2b2efa 100644 --- a/src/Generators/Microsoft.Gen.Logging/Parsing/Parser.cs +++ b/src/Generators/Microsoft.Gen.Logging/Parsing/Parser.cs @@ -84,7 +84,7 @@ public IReadOnlyList GetLogTypes(IEnumerable foreach (var paramSymbol in methodSymbol.Parameters) { - var lp = ProcessParameter(paramSymbol, symbols, ref parsingState); + var lp = ProcessParameter(lm, paramSymbol, symbols, ref parsingState); if (lp == null) { keepMethod = false; @@ -94,6 +94,7 @@ public IReadOnlyList GetLogTypes(IEnumerable parameterSymbols[lp] = paramSymbol; var foundDataClassificationAttributesInProps = false; + var logPropertiesAttribute = ParserUtilities.GetSymbolAttributeAnnotationOrDefault(symbols.LogPropertiesAttribute, paramSymbol); if (logPropertiesAttribute is not null) { @@ -135,22 +136,43 @@ public IReadOnlyList GetLogTypes(IEnumerable lp.TagProvider = null; } +#pragma warning disable S1067 // Expressions should not be too complex + if (lp.IsNormalParameter + && (logPropertiesAttribute is null) + && (tagProviderAttribute is null) + && !lp.IsStringifiable + && paramSymbol.Type.Kind != SymbolKind.TypeParameter) + { + Diag(DiagDescriptors.DefaultToString, paramSymbol.GetLocation(), paramSymbol.Type, paramSymbol.Name); + } +#pragma warning restore S1067 // Expressions should not be too complex + bool forceAsTemplateParam = false; - bool parameterInTemplate = lm.TemplateToParameterName.ContainsKey(lp.Name); + + bool parameterInTemplate = false; + foreach (var t in lm.Templates) + { + if (lp.ParameterName.Equals(t, StringComparison.OrdinalIgnoreCase)) + { + parameterInTemplate = true; + break; + } + } + var loggingProperties = logPropertiesAttribute != null || tagProviderAttribute != null; if (lp.IsLogger && parameterInTemplate) { - Diag(DiagDescriptors.ShouldntMentionLoggerInMessage, attrLoc, lp.Name); + Diag(DiagDescriptors.ShouldntMentionLoggerInMessage, attrLoc, lp.ParameterName); forceAsTemplateParam = true; } else if (lp.IsException && parameterInTemplate) { - Diag(DiagDescriptors.ShouldntMentionExceptionInMessage, attrLoc, lp.Name); + Diag(DiagDescriptors.ShouldntMentionExceptionInMessage, attrLoc, lp.ParameterName); forceAsTemplateParam = true; } else if (lp.IsLogLevel && parameterInTemplate) { - Diag(DiagDescriptors.ShouldntMentionLogLevelInMessage, attrLoc, lp.Name); + Diag(DiagDescriptors.ShouldntMentionLogLevelInMessage, attrLoc, lp.ParameterName); forceAsTemplateParam = true; } else if (lp.IsNormalParameter @@ -158,7 +180,7 @@ public IReadOnlyList GetLogTypes(IEnumerable && !loggingProperties && !string.IsNullOrEmpty(lm.Message)) { - Diag(DiagDescriptors.ParameterHasNoCorrespondingTemplate, paramSymbol.GetLocation(), lp.Name); + Diag(DiagDescriptors.ParameterHasNoCorrespondingTemplate, paramSymbol.GetLocation(), lp.ParameterName); } var purelyStructuredLoggingParameter = loggingProperties && !parameterInTemplate; @@ -170,7 +192,7 @@ public IReadOnlyList GetLogTypes(IEnumerable if (foundDataClassificationAttributesInProps || RecordHasSensitivePublicMembers(paramSymbol.Type, symbols)) { - Diag(DiagDescriptors.RecordTypeSensitiveArgumentIsInTemplate, paramSymbol.GetLocation(), lp.Name, lm.Name); + Diag(DiagDescriptors.RecordTypeSensitiveArgumentIsInTemplate, paramSymbol.GetLocation(), lp.ParameterName, lm.Name); keepMethod = false; } } @@ -246,12 +268,12 @@ public IReadOnlyList GetLogTypes(IEnumerable } } - foreach (var t in lm.TemplateToParameterName) + foreach (var t in lm.Templates) { bool found = false; foreach (var p in lm.Parameters) { - if (t.Key.Equals(p.Name, StringComparison.OrdinalIgnoreCase)) + if (t.Equals(p.ParameterName, StringComparison.OrdinalIgnoreCase)) { found = true; break; @@ -260,11 +282,11 @@ public IReadOnlyList GetLogTypes(IEnumerable if (!found) { - Diag(DiagDescriptors.TemplateHasNoCorrespondingParameter, attrLoc, t.Key); + Diag(DiagDescriptors.TemplateHasNoCorrespondingParameter, attrLoc, t); } } - CheckMethodParametersAreUnique(lm, parameterSymbols); + CheckTagNamesAreUnique(lm, parameterSymbols); } if (lt == null) @@ -367,8 +389,6 @@ static bool IsAllowedKind(SyntaxKind kind) => HasXmlDocumentation = HasXmlDocumentation(method), }; - TemplateExtractor.ExtractTemplates(message, lm.TemplateToParameterName, out var templatesWithAtSymbol); - var keepMethod = true; if (!methodSymbol.ReturnsVoid) @@ -378,12 +398,26 @@ static bool IsAllowedKind(SyntaxKind kind) => keepMethod = false; } - if (templatesWithAtSymbol.Count > 0) + TemplateExtractor.ExtractTemplates(message, lm.Templates); + +#pragma warning disable EA0003 // Use the character-based overloads of 'String.StartsWith' or 'String.EndsWith' + var templatesWithAtSymbol = lm.Templates.Where(x => x.StartsWith("@", StringComparison.Ordinal)).ToArray(); + if (templatesWithAtSymbol.Length > 0) { // there is/are template(s) that start with @, which is not allowed Diag(DiagDescriptors.TemplateStartsWithAtSymbol, attrLoc, method.Identifier.Text, string.Join("; ", templatesWithAtSymbol)); keepMethod = false; + + for (int i = 0; i < lm.Templates.Count; i++) + { + if (lm.Templates[i].StartsWith("@", StringComparison.Ordinal)) + { + lm.Templates[i] = lm.Templates[i].Substring(1); + } + } + } +#pragma warning restore EA0003 // Use the character-based overloads of 'String.StartsWith' or 'String.EndsWith' if (method.Arity > 0) { @@ -462,15 +496,14 @@ private static List GetDataClassificationAttributes(ISymbol sy .Select(static x => x!) .ToList(); - private void CheckMethodParametersAreUnique(LoggingMethod lm, Dictionary parameterSymbols) + private void CheckTagNamesAreUnique(LoggingMethod lm, Dictionary parameterSymbols) { var names = new HashSet(StringComparer.Ordinal); foreach (var parameter in lm.Parameters) { - var parameterName = lm.GetParameterNameInTemplate(parameter); - if (!names.Add(parameterName)) + if (!parameter.IsNormalParameter) { - Diag(DiagDescriptors.LogPropertiesNameCollision, parameterSymbols[parameter].GetLocation(), parameter.Name, parameterName, lm.Name); + continue; } if (parameter.HasProperties) @@ -482,17 +515,25 @@ private void CheckMethodParametersAreUnique(LoggingMethod lm, Dictionary x.Name)); + var fullName = string.Join("_", chain.Concat(new[] { leaf }).Select(static x => x.TagName)); if (!names.Add(fullName)) { - Diag(DiagDescriptors.LogPropertiesNameCollision, parameterSymbols[parameter].GetLocation(), parameter.Name, fullName, lm.Name); + Diag(DiagDescriptors.TagNameCollision, parameterSymbols[parameter].GetLocation(), parameter.ParameterName, fullName, lm.Name); } }); } + else + { + if (!names.Add(parameter.TagName)) + { + Diag(DiagDescriptors.TagNameCollision, parameterSymbols[parameter].GetLocation(), parameter.ParameterName, parameter.TagName, lm.Name); + } + } } } private LoggingMethodParameter? ProcessParameter( + LoggingMethod lm, IParameterSymbol paramSymbol, SymbolHolder symbols, ref MethodParsingState parsingState) @@ -550,9 +591,15 @@ private void CheckMethodParametersAreUnique(LoggingMethod lm, Dictionary + /// Looks up a localized string similar to The type "{0}" doesn't implement ToString(), IConvertible, or IFormattable (did you forget to apply [LogProperties] or [TagProvider] to "{1}"?). + /// + internal static string DefaultToStringMessage { + get { + return ResourceManager.GetString("DefaultToStringMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to A value being logged doesn't have an effective way to be converted into a string. + /// + internal static string DefaultToStringTitle { + get { + return ResourceManager.GetString("DefaultToStringTitle", resourceCulture); + } + } + /// /// Looks up a localized string similar to Logging method "{0}" doesn't have anything to be logged. /// @@ -312,24 +330,6 @@ internal static string LogPropertiesInvalidUsageTitle { } } - /// - /// Looks up a localized string similar to Parameter "{0}" causes name conflict with name "{1}" within logging method "{2}". - /// - internal static string LogPropertiesNameCollisionMessage { - get { - return ResourceManager.GetString("LogPropertiesNameCollisionMessage", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to A logging method parameter causes name conflicts. - /// - internal static string LogPropertiesNameCollisionTitle { - get { - return ResourceManager.GetString("LogPropertiesNameCollisionTitle", resourceCulture); - } - } - /// /// Looks up a localized string similar to Type "{0}" used with parameter "{1}" doesn't have any public properties to log. /// @@ -582,6 +582,24 @@ internal static string ShouldntReuseEventNamesTitle { } } + /// + /// Looks up a localized string similar to Parameter "{0}" causes a tag name conflict with name "{1}" within logging method "{2}". + /// + internal static string TagNameCollisionMessage { + get { + return ResourceManager.GetString("TagNameCollisionMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to A logging method parameter causes a tag name conflicts. + /// + internal static string TagNameCollisionTitle { + get { + return ResourceManager.GetString("TagNameCollisionTitle", resourceCulture); + } + } + /// /// Looks up a localized string similar to Parameter "{0}" is annotated to use a tag provider but it has special semantics (ILogger, LogLevel, Exception, etc.). /// diff --git a/src/Generators/Microsoft.Gen.Logging/Parsing/Resources.resx b/src/Generators/Microsoft.Gen.Logging/Parsing/Resources.resx index 1a56b134b3f..48c2f6d6de6 100644 --- a/src/Generators/Microsoft.Gen.Logging/Parsing/Resources.resx +++ b/src/Generators/Microsoft.Gen.Logging/Parsing/Resources.resx @@ -282,11 +282,11 @@ Logging method parameter's type has a hidden property - - Parameter "{0}" causes name conflict with name "{1}" within logging method "{2}" + + Parameter "{0}" causes a tag name conflict with name "{1}" within logging method "{2}" - - A logging method parameter causes name conflicts + + A logging method parameter causes a tag name conflicts Logging method doesn't log anything @@ -333,4 +333,10 @@ The logging method parameter leaks sensitive data + + The type "{0}" doesn't implement ToString(), IConvertible, or IFormattable (did you forget to apply [LogProperties] or [TagProvider] to "{1}"?) + + + A value being logged doesn't have an effective way to be converted into a string + \ No newline at end of file diff --git a/src/Generators/Microsoft.Gen.Logging/Parsing/SymbolHolder.cs b/src/Generators/Microsoft.Gen.Logging/Parsing/SymbolHolder.cs index 275938c29e7..f8bfa87c05c 100644 --- a/src/Generators/Microsoft.Gen.Logging/Parsing/SymbolHolder.cs +++ b/src/Generators/Microsoft.Gen.Logging/Parsing/SymbolHolder.cs @@ -13,7 +13,8 @@ internal sealed record class SymbolHolder( INamedTypeSymbol LoggerMessageAttribute, INamedTypeSymbol LogPropertiesAttribute, INamedTypeSymbol TagProviderAttribute, - INamedTypeSymbol? LogPropertyIgnoreAttribute, + INamedTypeSymbol TagNameAttribute, + INamedTypeSymbol LogPropertyIgnoreAttribute, INamedTypeSymbol ITagCollectorSymbol, INamedTypeSymbol ILoggerSymbol, INamedTypeSymbol LogLevelSymbol, diff --git a/src/Generators/Microsoft.Gen.Logging/Parsing/SymbolLoader.cs b/src/Generators/Microsoft.Gen.Logging/Parsing/SymbolLoader.cs index 4dce3561635..6f8d2a93fe9 100644 --- a/src/Generators/Microsoft.Gen.Logging/Parsing/SymbolLoader.cs +++ b/src/Generators/Microsoft.Gen.Logging/Parsing/SymbolLoader.cs @@ -12,6 +12,7 @@ internal static class SymbolLoader internal const string LoggerMessageAttribute = "Microsoft.Extensions.Logging.LoggerMessageAttribute"; internal const string LogPropertiesAttribute = "Microsoft.Extensions.Logging.LogPropertiesAttribute"; internal const string TagProviderAttribute = "Microsoft.Extensions.Logging.TagProviderAttribute"; + internal const string TagNameAttribute = "Microsoft.Extensions.Logging.TagNameAttribute"; internal const string LogPropertyIgnoreAttribute = "Microsoft.Extensions.Logging.LogPropertyIgnoreAttribute"; internal const string ITagCollectorType = "Microsoft.Extensions.Logging.ITagCollector"; internal const string ILoggerType = "Microsoft.Extensions.Logging.ILogger"; @@ -55,6 +56,7 @@ internal static class SymbolLoader var loggerMessageAttributeSymbol = compilation.GetTypeByMetadataName(LoggerMessageAttribute); var logPropertiesAttributeSymbol = compilation.GetTypeByMetadataName(LogPropertiesAttribute); var tagProviderAttributeSymbol = compilation.GetTypeByMetadataName(TagProviderAttribute); + var tagNameAttributeSymbol = compilation.GetTypeByMetadataName(TagNameAttribute); var tagCollectorSymbol = compilation.GetTypeByMetadataName(ITagCollectorType); var logPropertyIgnoreAttributeSymbol = compilation.GetTypeByMetadataName(LogPropertyIgnoreAttribute); var dataClassificationAttribute = compilation.GetTypeByMetadataName(DataClassificationAttribute); @@ -65,6 +67,7 @@ internal static class SymbolLoader || loggerMessageAttributeSymbol == null || logPropertiesAttributeSymbol == null || tagProviderAttributeSymbol == null + || tagNameAttributeSymbol == null || tagCollectorSymbol == null || logPropertyIgnoreAttributeSymbol == null) { @@ -100,6 +103,7 @@ internal static class SymbolLoader loggerMessageAttributeSymbol, logPropertiesAttributeSymbol, tagProviderAttributeSymbol, + tagNameAttributeSymbol, logPropertyIgnoreAttributeSymbol, tagCollectorSymbol, loggerSymbol, diff --git a/src/Generators/Microsoft.Gen.Logging/Parsing/TemplateExtractor.cs b/src/Generators/Microsoft.Gen.Logging/Parsing/TemplateExtractor.cs index bd0015164b8..ddee2884b61 100644 --- a/src/Generators/Microsoft.Gen.Logging/Parsing/TemplateExtractor.cs +++ b/src/Generators/Microsoft.Gen.Logging/Parsing/TemplateExtractor.cs @@ -13,19 +13,15 @@ internal static class TemplateExtractor /// /// Finds the template arguments contained in the message string. /// - internal static void ExtractTemplates(string? message, IDictionary templateToParameterName, out ICollection templatesWithAtSymbol) + internal static void ExtractTemplates(string? message, List templates) { if (string.IsNullOrEmpty(message)) { - templatesWithAtSymbol = Array.Empty(); return; } var scanIndex = 0; var endIndex = message!.Length; -#pragma warning disable CA1859 // Use concrete types when possible for improved performance - ICollection? foundAtTemplates = null; -#pragma warning restore CA1859 // Use concrete types when possible for improved performance while (scanIndex < endIndex) { var openBraceIndex = FindBraceIndex(message, '{', scanIndex, endIndex); @@ -41,19 +37,10 @@ internal static void ExtractTemplates(string? message, IDictionary(); - foundAtTemplates.Add(templateName); - templateName = templateName.Substring(1); - } - - templateToParameterName[templateName] = templateName; + templates.Add(templateName); scanIndex = closeBraceIndex + 1; } } - - templatesWithAtSymbol = foundAtTemplates ?? Array.Empty(); } internal static int FindIndexOfAny(string message, char[] chars, int startIndex, int endIndex) diff --git a/src/Generators/Microsoft.Gen.Logging/Parsing/TypeSymbolExtensions.cs b/src/Generators/Microsoft.Gen.Logging/Parsing/TypeSymbolExtensions.cs index a18dc32e598..d52796e85ca 100644 --- a/src/Generators/Microsoft.Gen.Logging/Parsing/TypeSymbolExtensions.cs +++ b/src/Generators/Microsoft.Gen.Logging/Parsing/TypeSymbolExtensions.cs @@ -10,7 +10,8 @@ namespace Microsoft.Gen.Logging.Parsing; internal static class TypeSymbolExtensions { internal static bool IsEnumerable(this ITypeSymbol sym, SymbolHolder symbols) - => sym.ImplementsInterface(symbols.EnumerableSymbol) && sym.SpecialType != SpecialType.System_String; + => (sym.ImplementsInterface(symbols.EnumerableSymbol) || SymbolEqualityComparer.Default.Equals(sym, symbols.EnumerableSymbol)) + && sym.SpecialType != SpecialType.System_String; internal static bool ImplementsIConvertible(this ITypeSymbol sym, SymbolHolder symbols) { @@ -56,7 +57,7 @@ internal static bool ImplementsIFormattable(this ITypeSymbol sym, SymbolHolder s } internal static bool ImplementsISpanFormattable(this ITypeSymbol sym, SymbolHolder symbols) - => symbols.SpanFormattableSymbol != null && sym.ImplementsInterface(symbols.SpanFormattableSymbol); + => symbols.SpanFormattableSymbol != null && (sym.ImplementsInterface(symbols.SpanFormattableSymbol) || SymbolEqualityComparer.Default.Equals(sym, symbols.SpanFormattableSymbol)); internal static bool IsSpecialType(this ITypeSymbol typeSymbol, SymbolHolder symbols) => typeSymbol.SpecialType != SpecialType.None || @@ -64,4 +65,21 @@ internal static bool IsSpecialType(this ITypeSymbol typeSymbol, SymbolHolder sym #pragma warning disable RS1024 symbols.IgnorePropertiesSymbols.Contains(typeSymbol); #pragma warning restore RS1024 + + internal static bool HasCustomToString(this ITypeSymbol type) + { + ITypeSymbol? current = type; + while (current != null && current.SpecialType != SpecialType.System_Object) + { + if (current.GetMembers("ToString").Where(m => m.Kind == SymbolKind.Method && m.DeclaredAccessibility == Accessibility.Public).Cast().Any(m => m.Parameters.Length == 0)) + { + return true; + } + + current = current.BaseType; + } + + return false; + } + } diff --git a/src/Libraries/Microsoft.Extensions.Telemetry.Abstractions/Logging/LogPropertiesAttribute.cs b/src/Libraries/Microsoft.Extensions.Telemetry.Abstractions/Logging/LogPropertiesAttribute.cs index 80ed7b9a058..c2d6a65cd38 100644 --- a/src/Libraries/Microsoft.Extensions.Telemetry.Abstractions/Logging/LogPropertiesAttribute.cs +++ b/src/Libraries/Microsoft.Extensions.Telemetry.Abstractions/Logging/LogPropertiesAttribute.cs @@ -3,12 +3,14 @@ using System; using System.Diagnostics; +using System.Diagnostics.CodeAnalysis; using Microsoft.Extensions.Logging; +using Microsoft.Shared.DiagnosticIds; namespace Microsoft.Extensions.Logging; /// -/// Marks a logging method parameter whose public tags need to be logged. +/// Marks a logging method parameter whose public properties need to be logged as log tags. /// /// [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Property)] @@ -16,7 +18,7 @@ namespace Microsoft.Extensions.Logging; public sealed class LogPropertiesAttribute : Attribute { /// - /// Gets or sets a value indicating whether tags are logged. + /// Gets or sets a value indicating whether properties are logged. /// /// /// Defaults to . @@ -30,4 +32,19 @@ public sealed class LogPropertiesAttribute : Attribute /// Defaults to . /// public bool OmitReferenceName { get; set; } + + /// + /// Gets or sets a value indicating whether to transitively visit properties which are complex objects. + /// + /// + /// When logging the properties of an object, this property controls the behavior for each encountered property. + /// When this property is , then each property is serialized by calling to + /// generate a string for the property. When this property is , then each property of any complex objects are + /// expanded individually. + /// + /// + /// Defaults to . + /// + [Experimental(diagnosticId: DiagnosticIds.Experiments.Telemetry, UrlFormat = DiagnosticIds.UrlFormat)] + public bool Transitive { get; set; } } diff --git a/src/Libraries/Microsoft.Extensions.Telemetry.Abstractions/Logging/TagNameAttribute.cs b/src/Libraries/Microsoft.Extensions.Telemetry.Abstractions/Logging/TagNameAttribute.cs new file mode 100644 index 00000000000..05d1dc00fca --- /dev/null +++ b/src/Libraries/Microsoft.Extensions.Telemetry.Abstractions/Logging/TagNameAttribute.cs @@ -0,0 +1,34 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System; +using System.Diagnostics; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Shared.DiagnosticIds; +using Microsoft.Shared.Diagnostics; + +namespace Microsoft.Extensions.Logging; + +/// +/// Defines the tag name to use for a logged parameter or property. +/// +/// +[AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Property)] +[Conditional("CODE_GENERATION_ATTRIBUTES")] +[Experimental(diagnosticId: DiagnosticIds.Experiments.Telemetry, UrlFormat = DiagnosticIds.UrlFormat)] +public sealed class TagNameAttribute : Attribute +{ + /// + /// Initializes a new instance of the class. + /// + /// The tag name to use when logging the annotated parameter or property. + public TagNameAttribute(string name) + { + Name = Throw.IfNull(name); + } + + /// + /// Gets the name of the tag to be used when logging the parameter or property. + /// + public string Name { get; } +} diff --git a/src/Shared/DiagnosticIds/DiagnosticIds.cs b/src/Shared/DiagnosticIds/DiagnosticIds.cs index dbc82065488..da7d80a43aa 100644 --- a/src/Shared/DiagnosticIds/DiagnosticIds.cs +++ b/src/Shared/DiagnosticIds/DiagnosticIds.cs @@ -28,32 +28,6 @@ internal static class ContextualOptions internal const string CTXOPTGEN003 = nameof(CTXOPTGEN003); } - internal static class Design - { - internal const string AUTOCLIENTGEN001 = nameof(AUTOCLIENTGEN001); - internal const string AUTOCLIENTGEN002 = nameof(AUTOCLIENTGEN002); - internal const string AUTOCLIENTGEN003 = nameof(AUTOCLIENTGEN003); - internal const string AUTOCLIENTGEN004 = nameof(AUTOCLIENTGEN004); - internal const string AUTOCLIENTGEN005 = nameof(AUTOCLIENTGEN005); - internal const string AUTOCLIENTGEN006 = nameof(AUTOCLIENTGEN006); - internal const string AUTOCLIENTGEN007 = nameof(AUTOCLIENTGEN007); - internal const string AUTOCLIENTGEN008 = nameof(AUTOCLIENTGEN008); - internal const string AUTOCLIENTGEN009 = nameof(AUTOCLIENTGEN009); - internal const string AUTOCLIENTGEN010 = nameof(AUTOCLIENTGEN010); - internal const string AUTOCLIENTGEN011 = nameof(AUTOCLIENTGEN011); - internal const string AUTOCLIENTGEN012 = nameof(AUTOCLIENTGEN012); - internal const string AUTOCLIENTGEN013 = nameof(AUTOCLIENTGEN013); - internal const string AUTOCLIENTGEN014 = nameof(AUTOCLIENTGEN014); - internal const string AUTOCLIENTGEN015 = nameof(AUTOCLIENTGEN015); - internal const string AUTOCLIENTGEN016 = nameof(AUTOCLIENTGEN016); - internal const string AUTOCLIENTGEN017 = nameof(AUTOCLIENTGEN017); - internal const string AUTOCLIENTGEN018 = nameof(AUTOCLIENTGEN018); - internal const string AUTOCLIENTGEN019 = nameof(AUTOCLIENTGEN019); - internal const string AUTOCLIENTGEN020 = nameof(AUTOCLIENTGEN020); - internal const string AUTOCLIENTGEN021 = nameof(AUTOCLIENTGEN021); - internal const string AUTOCLIENTGEN022 = nameof(AUTOCLIENTGEN022); - } - /// /// Experiments supported by this repo. /// @@ -63,7 +37,6 @@ internal static class Experiments internal const string Compliance = "EXTEXP0002"; internal const string Telemetry = "EXTEXP0003"; internal const string TimeProvider = "EXTEXP0004"; - internal const string AutoClient = "EXTEXP0005"; internal const string AsyncState = "EXTEXP0006"; internal const string HealthChecks = "EXTEXP0007"; internal const string ResourceMonitoring = "EXTEXP0008"; @@ -112,6 +85,7 @@ internal static class LoggerMessage internal const string LOGGEN033 = nameof(LOGGEN033); internal const string LOGGEN034 = nameof(LOGGEN034); internal const string LOGGEN035 = nameof(LOGGEN035); + internal const string LOGGEN036 = nameof(LOGGEN036); } internal static class Metrics diff --git a/test/Generators/Microsoft.Gen.Logging/Generated/TagNameTests.cs b/test/Generators/Microsoft.Gen.Logging/Generated/TagNameTests.cs new file mode 100644 index 00000000000..fd9c5f6cba2 --- /dev/null +++ b/test/Generators/Microsoft.Gen.Logging/Generated/TagNameTests.cs @@ -0,0 +1,28 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System.Collections.Generic; +using FluentAssertions; +using Microsoft.Extensions.Logging.Testing; +using TestClasses; +using Xunit; + +namespace Microsoft.Gen.Logging.Test; + +public class TagNameTests +{ + [Fact] + public void Basic() + { + var logger = new FakeLogger(); + + TagNameExtensions.M0(logger, 0); + + var expectedState = new Dictionary + { + ["TN1"] = "0", + }; + + logger.Collector.LatestRecord.StructuredState.Should().NotBeNull().And.Equal(expectedState); + } +} diff --git a/test/Generators/Microsoft.Gen.Logging/Generated/TransitiveTests.cs b/test/Generators/Microsoft.Gen.Logging/Generated/TransitiveTests.cs new file mode 100644 index 00000000000..6540825dd90 --- /dev/null +++ b/test/Generators/Microsoft.Gen.Logging/Generated/TransitiveTests.cs @@ -0,0 +1,40 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System.Collections.Generic; +using FluentAssertions; +using Microsoft.Extensions.Logging.Testing; +using TestClasses; +using Xunit; + +namespace Microsoft.Gen.Logging.Test; + +public class TransitiveTests +{ + [Fact] + public void Basic() + { + var logger = new FakeLogger(); + var c = new TransitiveTestExtensions.C0(); + + TransitiveTestExtensions.M0(logger, c); + + var expectedState = new Dictionary + { + ["p0.P1"] = "V1", + ["p0.P0.P2"] = "V2", + }; + + logger.Collector.LatestRecord.StructuredState.Should().NotBeNull().And.Equal(expectedState); + + TransitiveTestExtensions.M1(logger, c); + + expectedState = new Dictionary + { + ["p0.P1"] = "V1", + ["p0.P0"] = "TS1", + }; + + logger.Collector.LatestRecord.StructuredState.Should().NotBeNull().And.Equal(expectedState); + } +} diff --git a/test/Generators/Microsoft.Gen.Logging/TestClasses/LogPropertiesSpecialTypesExtensions.cs b/test/Generators/Microsoft.Gen.Logging/TestClasses/LogPropertiesSpecialTypesExtensions.cs index f8b16489ce6..45239d41b8a 100644 --- a/test/Generators/Microsoft.Gen.Logging/TestClasses/LogPropertiesSpecialTypesExtensions.cs +++ b/test/Generators/Microsoft.Gen.Logging/TestClasses/LogPropertiesSpecialTypesExtensions.cs @@ -19,7 +19,9 @@ internal class MyProps public Version? P4 { get; set; } public Uri? P5 { get; set; } public IPAddress? P6 { get; set; } +#pragma warning disable LOGGEN036 public EndPoint? P7 { get; set; } +#pragma warning restore LOGGEN036 public IPEndPoint? P8 { get; set; } public DnsEndPoint? P9 { get; set; } public BigInteger P10 { get; set; } diff --git a/test/Generators/Microsoft.Gen.Logging/TestClasses/TagNameExtensions.cs b/test/Generators/Microsoft.Gen.Logging/TestClasses/TagNameExtensions.cs new file mode 100644 index 00000000000..d1d4329041e --- /dev/null +++ b/test/Generators/Microsoft.Gen.Logging/TestClasses/TagNameExtensions.cs @@ -0,0 +1,13 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using Microsoft.Extensions.Logging; + +namespace TestClasses +{ + internal static partial class TagNameExtensions + { + [LoggerMessage(LogLevel.Warning)] + internal static partial void M0(ILogger logger, [TagName("TN1")] int p0); + } +} diff --git a/test/Generators/Microsoft.Gen.Logging/TestClasses/TransitiveTestExtensions.cs b/test/Generators/Microsoft.Gen.Logging/TestClasses/TransitiveTestExtensions.cs new file mode 100644 index 00000000000..964918ae9df --- /dev/null +++ b/test/Generators/Microsoft.Gen.Logging/TestClasses/TransitiveTestExtensions.cs @@ -0,0 +1,28 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using Microsoft.Extensions.Logging; + +namespace TestClasses +{ + internal static partial class TransitiveTestExtensions + { + public class C0 + { + public C1 P0 { get; set; } = new C1(); + public string P1 { get; set; } = "V1"; + } + + public class C1 + { + public string P2 { get; set; } = "V2"; + public override string ToString() => "TS1"; + } + + [LoggerMessage(LogLevel.Debug)] + public static partial void M0(ILogger logger, [LogProperties(Transitive = true)] C0 p0); + + [LoggerMessage(LogLevel.Debug)] + public static partial void M1(ILogger logger, [LogProperties(Transitive = false)] C0 p0); + } +} diff --git a/test/Generators/Microsoft.Gen.Logging/Unit/EmitterTests.cs b/test/Generators/Microsoft.Gen.Logging/Unit/EmitterTests.cs index e910a99149e..c2075b51f8e 100644 --- a/test/Generators/Microsoft.Gen.Logging/Unit/EmitterTests.cs +++ b/test/Generators/Microsoft.Gen.Logging/Unit/EmitterTests.cs @@ -4,6 +4,7 @@ using System.Collections.Generic; using System.IO; using System.Linq; +using System.Numerics; using System.Reflection; using System.Threading.Tasks; using Microsoft.Extensions.Compliance.Classification; @@ -44,6 +45,7 @@ public async Task TestEmitter() Assembly.GetAssembly(typeof(DataClassification))!, Assembly.GetAssembly(typeof(IRedactorProvider))!, Assembly.GetAssembly(typeof(PrivateDataAttribute))!, + Assembly.GetAssembly(typeof(BigInteger))!, }, sources, symbols) diff --git a/test/Generators/Microsoft.Gen.Logging/Unit/EmitterUtilsTests.cs b/test/Generators/Microsoft.Gen.Logging/Unit/EmitterUtilsTests.cs index 88fee7d7739..b4e2652244e 100644 --- a/test/Generators/Microsoft.Gen.Logging/Unit/EmitterUtilsTests.cs +++ b/test/Generators/Microsoft.Gen.Logging/Unit/EmitterUtilsTests.cs @@ -58,7 +58,7 @@ public void ShouldFindLogLevelFromParameter() lm.Parameters.Add(new LoggingMethodParameter { IsLogLevel = true, - Name = ParamName + ParameterName = ParamName }); Assert.Equal(ParamName, Emitter.GetLoggerMethodLogLevel(lm)); diff --git a/test/Generators/Microsoft.Gen.Logging/Unit/LogParserUtilitiesTests.cs b/test/Generators/Microsoft.Gen.Logging/Unit/LogParserUtilitiesTests.cs index 1db966137c3..0647db0791b 100644 --- a/test/Generators/Microsoft.Gen.Logging/Unit/LogParserUtilitiesTests.cs +++ b/test/Generators/Microsoft.Gen.Logging/Unit/LogParserUtilitiesTests.cs @@ -64,6 +64,7 @@ public void RecordHasSensitivePublicMembers_ShouldReturnFalse_WhenNoDataClasses( null!, null!, null!, + null!, null!); var diagMock = new Mock>(); @@ -110,6 +111,7 @@ public void RecordHasSensitivePublicMembers_ShouldNotThrow_WhenNoMembersOnType(b null!, null!, null!, + null!, Mock.Of()); var diagMock = new Mock>(); @@ -134,6 +136,7 @@ public void ProcessLogPropertiesForParameter_ShouldNotThrow_WhenNoMembersOnType( null!, null!, null!, + null!, new HashSet(SymbolEqualityComparer.Default), null!, null!, diff --git a/test/Generators/Microsoft.Gen.Logging/Unit/LoggingMethodParameterTests.cs b/test/Generators/Microsoft.Gen.Logging/Unit/LoggingMethodParameterTests.cs index 34242fba9eb..1820f402246 100644 --- a/test/Generators/Microsoft.Gen.Logging/Unit/LoggingMethodParameterTests.cs +++ b/test/Generators/Microsoft.Gen.Logging/Unit/LoggingMethodParameterTests.cs @@ -14,7 +14,7 @@ public class LoggingMethodParameterTests public void Fields_Should_BeInitialized() { var instance = new LoggingMethodParameter(); - Assert.Empty(instance.Name); + Assert.Empty(instance.ParameterName); Assert.Empty(instance.Type); } @@ -57,13 +57,13 @@ public void Misc() { var lp = new LoggingMethodParameter { - Name = "Foo", + ParameterName = "Foo", NeedsAtSign = false, }; - Assert.Equal(lp.Name, lp.NameWithAt); + Assert.Equal(lp.ParameterName, lp.ParameterNameWithAt); lp.NeedsAtSign = true; - Assert.Equal("@" + lp.Name, lp.NameWithAt); + Assert.Equal("@" + lp.ParameterName, lp.ParameterNameWithAt); lp.Type = "Foo"; lp.IsReference = false; diff --git a/test/Generators/Microsoft.Gen.Logging/Unit/LoggingMethodTests.cs b/test/Generators/Microsoft.Gen.Logging/Unit/LoggingMethodTests.cs index 5c7ff5533a4..2d92e4d9b4c 100644 --- a/test/Generators/Microsoft.Gen.Logging/Unit/LoggingMethodTests.cs +++ b/test/Generators/Microsoft.Gen.Logging/Unit/LoggingMethodTests.cs @@ -17,22 +17,4 @@ public void Fields_Should_BeInitialized() Assert.Empty(instance.Modifiers); Assert.Equal("_logger", instance.LoggerMember); } - - [Fact] - public void ShouldReturnParameterNameIfNotFoundInMap() - { - var p = new LoggingMethodParameter { Name = "paramName" }; - var method = new LoggingMethod(); - Assert.Equal(p.Name, method.GetParameterNameInTemplate(p)); - } - - [Fact] - public void ShouldReturnNameForParameterFromMap() - { - var p = new LoggingMethodParameter { Name = "paramName" }; - var method = new LoggingMethod(); - method.TemplateToParameterName[p.Name] = "Name from the map"; - - Assert.Equal(method.TemplateToParameterName[p.Name], method.GetParameterNameInTemplate(p)); - } } diff --git a/test/Generators/Microsoft.Gen.Logging/Unit/ParserTests.LogProperties.cs b/test/Generators/Microsoft.Gen.Logging/Unit/ParserTests.LogProperties.cs index 98d30ccdd99..a5e663dc57e 100644 --- a/test/Generators/Microsoft.Gen.Logging/Unit/ParserTests.LogProperties.cs +++ b/test/Generators/Microsoft.Gen.Logging/Unit/ParserTests.LogProperties.cs @@ -53,11 +53,11 @@ class MyType partial class C { - [LoggerMessage(0, LogLevel.Debug, ""Parameterless..."")] - static partial void M0(ILogger logger, [LogProperties(OmitReferenceName = true)] MyType /*0+*/p0/*-0*/); + [LoggerMessage(LogLevel.Debug)] + static partial void M0(ILogger logger, int p0, [LogProperties(OmitReferenceName = true)] MyType /*0+*/p1/*-0*/); }"; - await RunGenerator(Source, DiagDescriptors.LogPropertiesNameCollision); + await RunGenerator(Source, DiagDescriptors.TagNameCollision); } [Fact] @@ -207,7 +207,7 @@ partial class C static partial void M(ILogger logger, string param, string /*0+*/Param/*-0*/); }"; - await RunGenerator(Source, DiagDescriptors.LogPropertiesNameCollision); + await RunGenerator(Source, DiagDescriptors.TagNameCollision); } [Fact] @@ -217,15 +217,21 @@ public async Task LogPropertiesNameCollision() class MyClass { public int A { get; set; } + + [LogPropertyIgnore] + public int B { get; set; } } partial class C { - [LoggerMessage(0, LogLevel.Debug, ""{param_A}"")] - static partial void M(ILogger logger, string param_A, [LogProperties] MyClass /*0+*/param/*-0*/); + [LoggerMessage(LogLevel.Debug)] + static partial void M0(ILogger logger, string param_A, [LogProperties] MyClass /*0+*/param/*-0*/); + + [LoggerMessage(LogLevel.Debug)] + static partial void M1(ILogger logger, string param_B, [LogProperties] MyClass param); }"; - await RunGenerator(Source, DiagDescriptors.LogPropertiesNameCollision); + await RunGenerator(Source, DiagDescriptors.TagNameCollision); } [Fact] @@ -251,7 +257,7 @@ partial class C static partial void M(ILogger logger, [LogProperties] MyClass /*0+*/param/*-0*/); }"; - await RunGenerator(Source, DiagDescriptors.LogPropertiesNameCollision); + await RunGenerator(Source, DiagDescriptors.TagNameCollision); } [Theory] @@ -387,4 +393,44 @@ partial class LoggerClass await RunGenerator(Source, DiagDescriptors.LogPropertiesHiddenPropertyDetected); } + + [Fact] + public async Task DefaultToString() + { + await RunGenerator(@" + record class MyRecordClass(int x); + record struct MyRecordStruct(int x); + + class MyClass2 + { + } + + class MyClass3 + { + public override string ToString() => ""FIND ME!""; + } + + class MyClass + { + public object /*0+*/P0/*-0*/ { get; set; } + public MyClass2 /*1+*/P1/*-1*/ { get; set; } + public MyClass3 P2 { get; set; } + public int P3 { get; set; } + public System.Numerics.BigInteger P4 { get; set; } + public T P5 { get; set; } + } + + partial class C + { + [LoggerMessage(LogLevel.Debug)] + static partial void M0(this ILogger logger, + object /*2+*/p0/*-2*/, + MyClass2 /*3+*/p1/*-3*/, + MyClass3 p2, + [LogProperties] MyClass p3, + T p4, + MyRecordClass p5, + MyRecordStruct p6); + }", DiagDescriptors.DefaultToString); + } } diff --git a/test/Generators/Microsoft.Gen.Logging/Unit/ParserTests.cs b/test/Generators/Microsoft.Gen.Logging/Unit/ParserTests.cs index d2824eb28cc..80d401b7ff3 100644 --- a/test/Generators/Microsoft.Gen.Logging/Unit/ParserTests.cs +++ b/test/Generators/Microsoft.Gen.Logging/Unit/ParserTests.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. using System; +using System.Numerics; using System.Reflection; using System.Threading; using System.Threading.Tasks; @@ -1005,6 +1006,7 @@ private static async Task RunGenerator( Assembly.GetAssembly(typeof(IEnrichmentTagCollector))!, Assembly.GetAssembly(typeof(DataClassification))!, Assembly.GetAssembly(typeof(PrivateDataAttribute))!, + Assembly.GetAssembly(typeof(BigInteger))!, }; } diff --git a/test/Libraries/Microsoft.Extensions.Telemetry.Abstractions.Tests/Logging/LogPropertiesAttributeTests.cs b/test/Libraries/Microsoft.Extensions.Telemetry.Abstractions.Tests/Logging/LogPropertiesAttributeTests.cs index b3efaaffa31..cedab2d23ba 100644 --- a/test/Libraries/Microsoft.Extensions.Telemetry.Abstractions.Tests/Logging/LogPropertiesAttributeTests.cs +++ b/test/Libraries/Microsoft.Extensions.Telemetry.Abstractions.Tests/Logging/LogPropertiesAttributeTests.cs @@ -26,4 +26,14 @@ public void OmiReferenceName() lpa.OmitReferenceName = true; Assert.True(lpa.OmitReferenceName); } + + [Fact] + public void Transitive() + { + var lpa = new LogPropertiesAttribute(); + Assert.False(lpa.Transitive); + + lpa.Transitive = true; + Assert.True(lpa.Transitive); + } } diff --git a/test/Libraries/Microsoft.Extensions.Telemetry.Abstractions.Tests/Logging/TagNameAttributeTests.cs b/test/Libraries/Microsoft.Extensions.Telemetry.Abstractions.Tests/Logging/TagNameAttributeTests.cs new file mode 100644 index 00000000000..49cccd6cf3b --- /dev/null +++ b/test/Libraries/Microsoft.Extensions.Telemetry.Abstractions.Tests/Logging/TagNameAttributeTests.cs @@ -0,0 +1,19 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System; +using Xunit; + +namespace Microsoft.Extensions.Logging.Test; + +public class TagNameAttributeTests +{ + [Fact] + public void Basic() + { + var a = new TagNameAttribute("a"); + Assert.Equal("a", a.Name); + + Assert.Throws(() => new TagNameAttribute(null!)); + } +} From b4c110d526ebef7617f29bac27d39ddd042173ad Mon Sep 17 00:00:00 2001 From: Nikita Balabaev Date: Thu, 28 Dec 2023 17:30:48 +0100 Subject: [PATCH 121/172] Ignore statics in metric source-gen --- .../Microsoft.Gen.Metrics/Parser.cs | 59 +++-- .../Generated/MetricTests.Ext.cs | 140 ++++++----- .../Generated/MetricTests.cs | 218 +++++++++--------- .../TestClasses/CounterDimensions.cs | 5 + .../TestClasses/HistogramTestExtensions.cs | 11 + .../Unit/ParserTests.Diagnostics.cs | 21 -- 6 files changed, 232 insertions(+), 222 deletions(-) diff --git a/src/Generators/Microsoft.Gen.Metrics/Parser.cs b/src/Generators/Microsoft.Gen.Metrics/Parser.cs index 20c60fb0529..b9d5697e24e 100644 --- a/src/Generators/Microsoft.Gen.Metrics/Parser.cs +++ b/src/Generators/Microsoft.Gen.Metrics/Parser.cs @@ -215,8 +215,8 @@ private static bool AreTagNamesValid(MetricMethod metricMethod) : symbol.TypeArguments[0]; private static (InstrumentKind instrumentKind, ITypeSymbol? genericType) GetInstrumentType( - INamedTypeSymbol? methodAttributeSymbol, - SymbolHolder symbols) + INamedTypeSymbol? methodAttributeSymbol, + SymbolHolder symbols) { if (methodAttributeSymbol == null) { @@ -492,13 +492,11 @@ private void GetTagDescription( Diag(DiagDescriptors.ErrorMethodHasBody, methodSymbol.GetLocation()); keepMethod = false; } -#pragma warning disable S2583 // Conditionally executed code should be reachable else if (!isPartial) { Diag(DiagDescriptors.ErrorNotPartialMethod, methodSymbol.GetLocation()); keepMethod = false; } -#pragma warning restore S2583 // Conditionally executed code should be reachable // ensure Metric name is not empty and starts with a Capital letter. // ensure there are no duplicate ids. @@ -668,14 +666,14 @@ private StrongTypeAttributeParameters ExtractStrongTypeAttributeParameters( /// /// Called recursively to build all required StrongTypeDimensionConfigs. /// - /// The Symbol being extracted. + /// The Symbol being extracted. /// A set of symbols in the current type chain. /// HashSet of all dimensions seen so far. /// Shared symbols. /// List of all property names when walking down the object model. See StrongTypeDimensionConfigs for an example. /// List of all StrongTypeDimensionConfigs seen so far. private List BuildTagConfigs( - ISymbol symbol, + ISymbol member, ISet typesChain, HashSet tagHashSet, Dictionary tagDescriptionDictionary, @@ -688,15 +686,16 @@ private List BuildTagConfigs( SpecialType specialType; ITypeSymbol typeSymbol; - if (symbol.IsImplicitlyDeclared) + if (member.IsImplicitlyDeclared || + member.IsStatic) { return tagConfigs; } - switch (symbol.Kind) + switch (member.Kind) { case SymbolKind.Property: - var propertySymbol = symbol as IPropertySymbol; + var propertySymbol = member as IPropertySymbol; kind = propertySymbol!.Type.TypeKind; specialType = propertySymbol.Type.SpecialType; @@ -704,7 +703,7 @@ private List BuildTagConfigs( break; case SymbolKind.Field: - var fieldSymbol = symbol as IFieldSymbol; + var fieldSymbol = member as IFieldSymbol; kind = fieldSymbol!.Type.TypeKind; specialType = fieldSymbol.Type.SpecialType; @@ -726,28 +725,28 @@ private List BuildTagConfigs( { if (kind == TypeKind.Enum) { - var name = TryGetTagNameFromAttribute(symbol, symbols, out var tagName) + var name = TryGetTagNameFromAttribute(member, symbols, out var tagName) ? tagName - : symbol.Name; + : member.Name; if (!tagHashSet.Add(name)) { - Diag(DiagDescriptors.ErrorDuplicateTagName, symbol.Locations[0], symbol.Name); + Diag(DiagDescriptors.ErrorDuplicateTagName, member.Locations[0], member.Name); } else { tagConfigs.Add(new StrongTypeConfig { - Name = symbol.Name, + Name = member.Name, Path = stringBuilder.ToString(), TagName = name, StrongTypeMetricObjectType = StrongTypeMetricObjectType.Enum }); - var xmlDefinition = GetSymbolXmlCommentSummary(symbol); + var xmlDefinition = GetSymbolXmlCommentSummary(member); if (!string.IsNullOrEmpty(xmlDefinition)) { - tagDescriptionDictionary.Add(string.IsNullOrEmpty(tagName) ? symbol.Name : tagName, xmlDefinition); + tagDescriptionDictionary.Add(string.IsNullOrEmpty(tagName) ? member.Name : tagName, xmlDefinition); } } @@ -758,28 +757,28 @@ private List BuildTagConfigs( { if (specialType == SpecialType.System_String) { - var name = TryGetTagNameFromAttribute(symbol, symbols, out var tagName) + var name = TryGetTagNameFromAttribute(member, symbols, out var tagName) ? tagName - : symbol.Name; + : member.Name; if (!tagHashSet.Add(name)) { - Diag(DiagDescriptors.ErrorDuplicateTagName, symbol.Locations[0], symbol.Name); + Diag(DiagDescriptors.ErrorDuplicateTagName, member.Locations[0], member.Name); } else { tagConfigs.Add(new StrongTypeConfig { - Name = symbol.Name, + Name = member.Name, Path = stringBuilder.ToString(), TagName = name, StrongTypeMetricObjectType = StrongTypeMetricObjectType.String }); - var xmlDefinition = GetSymbolXmlCommentSummary(symbol); + var xmlDefinition = GetSymbolXmlCommentSummary(member); if (!string.IsNullOrEmpty(xmlDefinition)) { - tagDescriptionDictionary.Add(string.IsNullOrEmpty(tagName) ? symbol.Name : tagName, xmlDefinition); + tagDescriptionDictionary.Add(string.IsNullOrEmpty(tagName) ? member.Name : tagName, xmlDefinition); } } @@ -793,13 +792,13 @@ private List BuildTagConfigs( tagConfigs.Add(new StrongTypeConfig { - Name = symbol.Name, + Name = member.Name, Path = stringBuilder.ToString(), StrongTypeMetricObjectType = StrongTypeMetricObjectType.Class }); tagConfigs.AddRange( - WalkObjectModel(symbol, typesChain, namedTypeSymbol, stringBuilder, + WalkObjectModel(member, typesChain, namedTypeSymbol, stringBuilder, tagHashSet, tagDescriptionDictionary, symbols, true)); return tagConfigs; @@ -807,7 +806,7 @@ private List BuildTagConfigs( } else { - Diag(DiagDescriptors.ErrorInvalidTagNameType, symbol.Locations[0]); + Diag(DiagDescriptors.ErrorInvalidTagNameType, member.Locations[0]); return tagConfigs; } } @@ -816,20 +815,20 @@ private List BuildTagConfigs( { if (typeSymbol is not INamedTypeSymbol namedTypeSymbol) { - Diag(DiagDescriptors.ErrorInvalidTagNameType, symbol.Locations[0]); + Diag(DiagDescriptors.ErrorInvalidTagNameType, member.Locations[0]); } else { // User defined struct. First add into dimensionConfigs, then walk down the rest of the struct. tagConfigs.Add(new StrongTypeConfig { - Name = symbol.Name, + Name = member.Name, Path = stringBuilder.ToString(), StrongTypeMetricObjectType = StrongTypeMetricObjectType.Struct }); tagConfigs.AddRange( - WalkObjectModel(symbol, typesChain, namedTypeSymbol, stringBuilder, + WalkObjectModel(member, typesChain, namedTypeSymbol, stringBuilder, tagHashSet, tagDescriptionDictionary, symbols, false)); } @@ -837,7 +836,7 @@ private List BuildTagConfigs( } else { - Diag(DiagDescriptors.ErrorInvalidTagNameType, symbol.Locations[0]); + Diag(DiagDescriptors.ErrorInvalidTagNameType, member.Locations[0]); return tagConfigs; } } @@ -846,9 +845,9 @@ private List BuildTagConfigs( _builders.ReturnStringBuilder(stringBuilder); } } -#pragma warning disable S107 // Methods should not have too many parameters // we can deal with this warning later +#pragma warning disable S107 // Methods should not have too many parameters private List WalkObjectModel( ISymbol parentSymbol, ISet typesChain, diff --git a/test/Generators/Microsoft.Gen.Metrics/Generated/MetricTests.Ext.cs b/test/Generators/Microsoft.Gen.Metrics/Generated/MetricTests.Ext.cs index a4d33fd9720..9b522d2df0a 100644 --- a/test/Generators/Microsoft.Gen.Metrics/Generated/MetricTests.Ext.cs +++ b/test/Generators/Microsoft.Gen.Metrics/Generated/MetricTests.Ext.cs @@ -1,11 +1,10 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -#if false - using System; using System.Collections.Generic; using System.Linq; +using Microsoft.Extensions.Diagnostics.Metrics.Testing; using TestClasses; using Xunit; @@ -16,94 +15,123 @@ public partial class MetricTests [Fact] public void ThrowsOnNullStrongTypeObjectExt() { - StrongTypeHistogramExt recorder = _meter.CreateHistogramExtStrongType(); - var ex = Assert.Throws(() => recorder.Record(4L, null!)); - Assert.NotNull(ex); + using (var collector = new MetricCollector(_meter, "MyHistogramStrongTypeMetricExt")) + { + StrongTypeHistogramExt recorder = _meter.CreateHistogramExtStrongType(); + var ex = Assert.Throws(() => recorder.Record(4L, null!)); + Assert.NotNull(ex); + } - StrongTypeDecimalCounterExt counter = _meter.CreateStrongTypeDecimalCounterExt(); - ex = Assert.Throws(() => counter.Add(4M, null!)); - Assert.NotNull(ex); + using (var collector = new MetricCollector(_meter, "MyCounterStrongTypeMetricExt")) + { + StrongTypeDecimalCounterExt counter = _meter.CreateStrongTypeDecimalCounterExt(); + var ex = Assert.Throws(() => counter.Add(4M, null!)); + Assert.NotNull(ex); + } } [Fact] - public void NonGenericCounterExtInstrumentTests() + public void NonGenericCounterExtNoDimsInstrumentTests() { + using var collector = new MetricCollector(_meter, nameof(CounterExt0D)); CounterExt0D counter0D = _meter.CreateCounterExt0D(); counter0D.Add(10L); counter0D.Add(5L); - var measurements = _collector.GetSnapshot(); - Assert.Collection(measurements, x => Assert.Equal(10L, x.GetValueOrThrow()), x => Assert.Equal(5L, x.GetValueOrThrow())); + var measurements = collector.GetMeasurementSnapshot(); + Assert.Collection(measurements, x => Assert.Equal(10L, x.Value), x => Assert.Equal(5L, x.Value)); Assert.All(measurements, x => Assert.Empty(x.Tags)); - _collector.Clear(); + } + [Fact] + public void NonGenericCounterExtInstrumentTests() + { + using var collector = new MetricCollector(_meter, nameof(CounterExt2D)); CounterExt2D counter2D = _meter.CreateCounterExt2D(); counter2D.Add(11L, "val1", "val2"); - var measurement = Assert.Single(_collector.GetSnapshot()); - Assert.Equal(11L, measurement.GetValueOrThrow()); + var measurement = Assert.Single(collector.GetMeasurementSnapshot()); + Assert.Equal(11L, measurement.Value); Assert.Equal(new (string, object?)[] { ("s1", "val1"), ("s2", "val2") }, measurement.Tags.Select(x => (x.Key, x.Value))); } [Fact] - public void NonGenericHistogramExtInstrumentTests() + public void NonGenericHistogramExtNoDimsInstrumentTests() { + using var collector = new MetricCollector(_meter, nameof(HistogramExt0D)); HistogramExt0D histogram0D = _meter.CreateHistogramExt0D(); histogram0D.Record(12L); histogram0D.Record(6L); - var measurements = _collector.GetSnapshot(); - Assert.Collection(measurements, x => Assert.Equal(12L, x.GetValueOrThrow()), x => Assert.Equal(6L, x.GetValueOrThrow())); + var measurements = collector.GetMeasurementSnapshot(); + Assert.Collection(measurements, x => Assert.Equal(12L, x.Value), x => Assert.Equal(6L, x.Value)); Assert.All(measurements, x => Assert.Empty(x.Tags)); - _collector.Clear(); + } + + [Fact] + public void NonGenericHistogramExtInstrumentTests() + { + using var collector = new MetricCollector(_meter, nameof(HistogramExt1D)); HistogramExt1D histogram1D = _meter.CreateHistogramExt1D(); histogram1D.Record(17L, "val_1"); - var measurement = Assert.Single(_collector.GetSnapshot()); - Assert.Equal(17L, measurement.GetValueOrThrow()); + var measurement = Assert.Single(collector.GetMeasurementSnapshot()); + Assert.Equal(17L, measurement.Value); var tag = Assert.Single(measurement.Tags); Assert.Equal(new KeyValuePair("s1", "val_1"), tag); } [Fact] - public void GenericCounterExtInstrumentTests() + public void GenericCounterExtNoDimsInstrumentTests() { + using var collector = new MetricCollector(_meter, nameof(GenericIntCounterExt0D)); GenericIntCounterExt0D counter0D = _meter.CreateGenericIntCounterExt0D(); counter0D.Add(10); counter0D.Add(5); - var measurements = _collector.GetSnapshot(); - Assert.Collection(measurements, x => Assert.Equal(10, x.GetValueOrThrow()), x => Assert.Equal(5, x.GetValueOrThrow())); + var measurements = collector.GetMeasurementSnapshot(); + Assert.Collection(measurements, x => Assert.Equal(10, x.Value), x => Assert.Equal(5, x.Value)); Assert.All(measurements, x => Assert.Empty(x.Tags)); - _collector.Clear(); + } + + [Fact] + public void GenericCounterExtInstrumentTests() + { + using var collector = new MetricCollector(_meter, nameof(GenericIntCounterExt1D)); GenericIntCounterExt1D counter2D = _meter.CreateGenericIntCounterExt1D(); counter2D.Add(11, "val1"); - var measurement = Assert.Single(_collector.GetSnapshot()); - Assert.Equal(11, measurement.GetValueOrThrow()); + var measurement = Assert.Single(collector.GetMeasurementSnapshot()); + Assert.Equal(11, measurement.Value); var tag = Assert.Single(measurement.Tags); Assert.Equal(new KeyValuePair("s1", "val1"), tag); } [Fact] - public void GenericHistogramExtInstrumentTests() + public void GenericHistogramExtNoDimsInstrumentTests() { + using var collector = new MetricCollector(_meter, nameof(GenericIntHistogramExt0D)); GenericIntHistogramExt0D histogram0D = _meter.CreateGenericIntHistogramExt0D(); histogram0D.Record(12); histogram0D.Record(6); - var measurements = _collector.GetSnapshot(); - Assert.Collection(measurements, x => Assert.Equal(12, x.GetValueOrThrow()), x => Assert.Equal(6, x.GetValueOrThrow())); + var measurements = collector.GetMeasurementSnapshot(); + Assert.Collection(measurements, x => Assert.Equal(12, x.Value), x => Assert.Equal(6, x.Value)); Assert.All(measurements, x => Assert.Empty(x.Tags)); - _collector.Clear(); + } + + [Fact] + public void GenericHistogramExtInstrumentTests() + { + using var collector = new MetricCollector(_meter, nameof(GenericIntHistogramExt2D)); GenericIntHistogramExt2D histogram1D = _meter.CreateGenericIntHistogramExt2D(); histogram1D.Record(17, "val_1", "val_2"); - var measurement = Assert.Single(_collector.GetSnapshot()); - Assert.Equal(17, measurement.GetValueOrThrow()); + var measurement = Assert.Single(collector.GetMeasurementSnapshot()); + Assert.Equal(17, measurement.Value); Assert.Equal(new (string, object?)[] { ("s1", "val_1"), ("s2", "val_2") }, measurement.Tags.Select(x => (x.Key, x.Value))); } @@ -133,13 +161,12 @@ public void ValidateHistogramExtStrongType() } }; + using var collector = new MetricCollector(_meter, "MyHistogramStrongTypeMetricExt"); StrongTypeHistogramExt recorder = _meter.CreateHistogramExtStrongType(); recorder.Record(1L, histogramDimensionsTest); - var measurement = Assert.Single(_collector.GetSnapshot()); - Assert.Equal(1L, measurement.GetValueOrThrow()); - Assert.NotNull(measurement.Instrument); - Assert.Equal("MyHistogramStrongTypeMetricExt", measurement.Instrument.Name); + var measurement = Assert.Single(collector.GetMeasurementSnapshot()); + Assert.Equal(1L, measurement.Value); Assert.Equal( new (string, object?)[] { @@ -157,13 +184,11 @@ public void ValidateHistogramExtStrongType() measurement.Tags.Select(x => (x.Key, x.Value))); histogramDimensionsTest.ChildDimensionsObject = null!; - _collector.Clear(); + collector.Clear(); recorder.Record(2L, histogramDimensionsTest); - measurement = Assert.Single(_collector.GetSnapshot()); - Assert.Equal(2L, measurement.GetValueOrThrow()); - Assert.NotNull(measurement.Instrument); - Assert.Equal("MyHistogramStrongTypeMetricExt", measurement.Instrument.Name); + measurement = Assert.Single(collector.GetMeasurementSnapshot()); + Assert.Equal(2L, measurement.Value); Assert.Equal( new (string, object?)[] { @@ -181,13 +206,11 @@ public void ValidateHistogramExtStrongType() measurement.Tags.Select(x => (x.Key, x.Value))); histogramDimensionsTest.GrandChildrenDimensionsObject = null!; - _collector.Clear(); + collector.Clear(); recorder.Record(3L, histogramDimensionsTest); - measurement = Assert.Single(_collector.GetSnapshot()); - Assert.Equal(3L, measurement.GetValueOrThrow()); - Assert.NotNull(measurement.Instrument); - Assert.Equal("MyHistogramStrongTypeMetricExt", measurement.Instrument.Name); + measurement = Assert.Single(collector.GetMeasurementSnapshot()); + Assert.Equal(3L, measurement.Value); Assert.Equal( new (string, object?)[] { @@ -231,13 +254,12 @@ public void ValidateCounterExtStrongType() Dim1 = "Dim1", }; + using var collector = new MetricCollector(_meter, "MyCounterStrongTypeMetricExt"); StrongTypeDecimalCounterExt counter = _meter.CreateStrongTypeDecimalCounterExt(); counter.Add(1M, counterDimensionsTest); - var measurement = Assert.Single(_collector.GetSnapshot()); - Assert.Equal(1M, measurement.GetValueOrThrow()); - Assert.NotNull(measurement.Instrument); - Assert.Equal("MyCounterStrongTypeMetricExt", measurement.Instrument.Name); + var measurement = Assert.Single(collector.GetMeasurementSnapshot()); + Assert.Equal(1M, measurement.Value); Assert.Equal( new (string, object?)[] { @@ -255,13 +277,11 @@ public void ValidateCounterExtStrongType() measurement.Tags.Select(x => (x.Key, x.Value))); counterDimensionsTest.ChildDimensionsObject = null!; - _collector.Clear(); + collector.Clear(); counter.Add(2M, counterDimensionsTest); - measurement = Assert.Single(_collector.GetSnapshot()); - Assert.Equal(2M, measurement.GetValueOrThrow()); - Assert.NotNull(measurement.Instrument); - Assert.Equal("MyCounterStrongTypeMetricExt", measurement.Instrument.Name); + measurement = Assert.Single(collector.GetMeasurementSnapshot()); + Assert.Equal(2M, measurement.Value); Assert.Equal( new (string, object?)[] { @@ -279,13 +299,11 @@ public void ValidateCounterExtStrongType() measurement.Tags.Select(x => (x.Key, x.Value))); counterDimensionsTest.GrandChildDimensionsObject = null!; - _collector.Clear(); + collector.Clear(); counter.Add(3M, counterDimensionsTest); - measurement = Assert.Single(_collector.GetSnapshot()); - Assert.Equal(3M, measurement.GetValueOrThrow()); - Assert.NotNull(measurement.Instrument); - Assert.Equal("MyCounterStrongTypeMetricExt", measurement.Instrument.Name); + measurement = Assert.Single(collector.GetMeasurementSnapshot()); + Assert.Equal(3M, measurement.Value); Assert.Equal( new (string, object?)[] { @@ -303,5 +321,3 @@ public void ValidateCounterExtStrongType() measurement.Tags.Select(x => (x.Key, x.Value))); } } - -#endif diff --git a/test/Generators/Microsoft.Gen.Metrics/Generated/MetricTests.cs b/test/Generators/Microsoft.Gen.Metrics/Generated/MetricTests.cs index 2b296e9a423..9dbf84c6d39 100644 --- a/test/Generators/Microsoft.Gen.Metrics/Generated/MetricTests.cs +++ b/test/Generators/Microsoft.Gen.Metrics/Generated/MetricTests.cs @@ -1,14 +1,12 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -#if false - using System; using System.Collections.Generic; using System.Diagnostics.Metrics; using System.Globalization; using System.Linq; -using Microsoft.Extensions.Diagnostics.Metrics; +using Microsoft.Extensions.Diagnostics.Metrics.Testing; using TestClasses; using Xunit; @@ -16,18 +14,15 @@ namespace Microsoft.Gen.Metrics.Test; public partial class MetricTests : IDisposable { - private const string BaseMeterName = "Microsoft.GeneratedCode.Test.Metrics." + nameof(MetricTests) + "."; - - private readonly Meter _meter; - private readonly FakeMetricsCollector _collector; + private const string BaseMeterName = "Microsoft.Gen.Metrics.Test." + nameof(MetricTests) + "."; private readonly string _meterName; + private readonly Meter _meter; private bool _disposedValue; public MetricTests() { _meterName = BaseMeterName + Guid.NewGuid().ToString("d", CultureInfo.InvariantCulture); _meter = new Meter(_meterName); - _collector = new FakeMetricsCollector(new HashSet { _meterName }); } protected virtual void Dispose(bool disposing) @@ -37,7 +32,6 @@ protected virtual void Dispose(bool disposing) if (disposing) { _meter.Dispose(); - _collector.Dispose(); } _disposedValue = true; @@ -53,12 +47,13 @@ public void Dispose() [Fact] public void NonGenericCounter0DInstrumentTests() { + using var collector = new MetricCollector(_meter, nameof(Counter0D)); Counter0D counter0D = CounterTestExtensions.CreateCounter0D(_meter); counter0D.Add(10L); counter0D.Add(5L); - var measurements = _collector.GetSnapshot(); - Assert.Collection(measurements, x => Assert.Equal(10L, x.GetValueOrThrow()), x => Assert.Equal(5L, x.GetValueOrThrow())); + var measurements = collector.GetMeasurementSnapshot(); + Assert.Collection(measurements, x => Assert.Equal(10L, x.Value), x => Assert.Equal(5L, x.Value)); Assert.All(measurements, x => Assert.Empty(x.Tags)); } @@ -67,23 +62,25 @@ public void NonGenericCounter2DInstrumentTests() { const long Value = int.MaxValue + 4L; + using var collector = new MetricCollector(_meter, nameof(Counter2D)); Counter2D counter2D = CounterTestExtensions.CreateCounter2D(_meter); counter2D.Add(Value, "val1", "val2"); - var measurement = Assert.Single(_collector.GetSnapshot()); - Assert.Equal(Value, measurement.GetValueOrThrow()); + var measurement = Assert.Single(collector.GetMeasurementSnapshot()); + Assert.Equal(Value, measurement.Value); Assert.Equal(new (string, object?)[] { ("s1", "val1"), ("s2", "val2") }, measurement.Tags.Select(x => (x.Key, x.Value))); } [Fact] public void NonGenericHistogram0DInstrumentTests() { + using var collector = new MetricCollector(_meter, nameof(Histogram0D)); Histogram0D histogram0D = HistogramTestExtensions.CreateHistogram0D(_meter); histogram0D.Record(12L); histogram0D.Record(6L); - var measurements = _collector.GetSnapshot(); - Assert.Collection(measurements, x => Assert.Equal(12L, x.GetValueOrThrow()), x => Assert.Equal(6L, x.GetValueOrThrow())); + var measurements = collector.GetMeasurementSnapshot(); + Assert.Collection(measurements, x => Assert.Equal(12L, x.Value), x => Assert.Equal(6L, x.Value)); Assert.All(measurements, x => Assert.Empty(x.Tags)); } @@ -92,11 +89,12 @@ public void NonGenericHistogram1DInstrumentTests() { const long Value = int.MaxValue + 3L; + using var collector = new MetricCollector(_meter, nameof(Histogram1D)); Histogram1D histogram1D = HistogramTestExtensions.CreateHistogram1D(_meter); histogram1D.Record(Value, "val_1"); - var measurement = Assert.Single(_collector.GetSnapshot()); - Assert.Equal(Value, measurement.GetValueOrThrow()); + var measurement = Assert.Single(collector.GetMeasurementSnapshot()); + Assert.Equal(Value, measurement.Value); var tag = Assert.Single(measurement.Tags); Assert.Equal(new KeyValuePair("s1", "val_1"), tag); } @@ -104,12 +102,13 @@ public void NonGenericHistogram1DInstrumentTests() [Fact] public void GenericCounter0DInstrumentTests() { + using var collector = new MetricCollector(_meter, nameof(GenericIntCounter0D)); GenericIntCounter0D counter0D = CounterTestExtensions.CreateGenericIntCounter0D(_meter); counter0D.Add(10); counter0D.Add(5); - var measurements = _collector.GetSnapshot(); - Assert.Collection(measurements, x => Assert.Equal(10, x.GetValueOrThrow()), x => Assert.Equal(5, x.GetValueOrThrow())); + var measurements = collector.GetMeasurementSnapshot(); + Assert.Collection(measurements, x => Assert.Equal(10, x.Value), x => Assert.Equal(5, x.Value)); Assert.All(measurements, x => Assert.Empty(x.Tags)); } @@ -118,11 +117,12 @@ public void GenericCounter2DInstrumentTests() { const int Value = int.MaxValue - 1; + using var collector = new MetricCollector(_meter, nameof(GenericIntCounter1D)); GenericIntCounter1D counter2D = CounterTestExtensions.CreateGenericIntCounter1D(_meter); counter2D.Add(Value, "val1"); - var measurement = Assert.Single(_collector.GetSnapshot()); - Assert.Equal(Value, measurement.GetValueOrThrow()); + var measurement = Assert.Single(collector.GetMeasurementSnapshot()); + Assert.Equal(Value, measurement.Value); var tag = Assert.Single(measurement.Tags); Assert.Equal(new KeyValuePair("s1", "val1"), tag); } @@ -130,12 +130,13 @@ public void GenericCounter2DInstrumentTests() [Fact] public void GenericHistogram0DInstrumentTests() { + using var collector = new MetricCollector(_meter, nameof(GenericIntHistogram0D)); GenericIntHistogram0D histogram0D = HistogramTestExtensions.CreateGenericIntHistogram0D(_meter); histogram0D.Record(12); histogram0D.Record(6); - var measurements = _collector.GetSnapshot(); - Assert.Collection(measurements, x => Assert.Equal(12, x.GetValueOrThrow()), x => Assert.Equal(6, x.GetValueOrThrow())); + var measurements = collector.GetMeasurementSnapshot(); + Assert.Collection(measurements, x => Assert.Equal(12, x.Value), x => Assert.Equal(6, x.Value)); Assert.All(measurements, x => Assert.Empty(x.Tags)); } @@ -144,11 +145,12 @@ public void GenericHistogram2DInstrumentTests() { const int Value = short.MaxValue + 2; + using var collector = new MetricCollector(_meter, nameof(GenericIntHistogram2D)); GenericIntHistogram2D histogram1D = HistogramTestExtensions.CreateGenericIntHistogram2D(_meter); histogram1D.Record(Value, "val_1", "val_2"); - var measurement = Assert.Single(_collector.GetSnapshot()); - Assert.Equal(Value, measurement.GetValueOrThrow()); + var measurement = Assert.Single(collector.GetMeasurementSnapshot()); + Assert.Equal(Value, measurement.Value); Assert.Equal(new (string, object?)[] { ("s1", "val_1"), ("s2", "val_2") }, measurement.Tags.Select(x => (x.Key, x.Value))); } @@ -157,6 +159,7 @@ public void CreateOnExistingCounter() { const long Value = int.MaxValue + 2L; + using var collector = new MetricCollector(_meter, nameof(Counter4D)); Counter4D counter4D = CounterTestExtensions.CreateCounter4D(_meter); Counter4D newCounter4D = CounterTestExtensions.CreateCounter4D(_meter); Assert.Same(counter4D, newCounter4D); @@ -164,10 +167,9 @@ public void CreateOnExistingCounter() counter4D.Add(Value, "val1", "val2", "val3", "val4"); newCounter4D.Add(Value, "val3", "val4", "val5", "val6"); - Assert.Equal(2, _collector.Count); - var measurements = _collector.GetSnapshot(); - Assert.All(measurements, x => Assert.Equal(Value, x.GetValueOrThrow())); - Assert.Same(measurements[0].Instrument, measurements[1].Instrument); + var measurements = collector.GetMeasurementSnapshot(); + Assert.Equal(2, measurements.Count); + Assert.All(measurements, x => Assert.Equal(Value, x.Value)); var tags = measurements[0].Tags.Select(x => (x.Key, x.Value)); Assert.Equal(new (string, object?)[] { ("s1", "val1"), ("s2", "val2"), ("s3", "val3"), ("s4", "val4") }, tags); @@ -181,6 +183,7 @@ public void CreateOnExistingHistogram() { const long Value = int.MaxValue + 1L; + using var collector = new MetricCollector(_meter, nameof(Histogram4D)); Histogram4D histogram4D = HistogramTestExtensions.CreateHistogram4D(_meter); Histogram4D newHistogram4D = HistogramTestExtensions.CreateHistogram4D(_meter); Assert.Same(histogram4D, newHistogram4D); @@ -188,10 +191,9 @@ public void CreateOnExistingHistogram() histogram4D.Record(Value, "val1", "val2", "val3", "val4"); newHistogram4D.Record(Value, "val3", "val4", "val5", "val6"); - Assert.Equal(2, _collector.Count); - var measurements = _collector.GetSnapshot(); - Assert.All(measurements, x => Assert.Equal(Value, x.GetValueOrThrow())); - Assert.Same(measurements[0].Instrument, measurements[1].Instrument); + var measurements = collector.GetMeasurementSnapshot(); + Assert.Equal(2, measurements.Count); + Assert.All(measurements, x => Assert.Equal(Value, x.Value)); var tags = measurements[0].Tags.Select(x => (x.Key, x.Value)); Assert.Equal(new (string, object?)[] { ("s1", "val1"), ("s2", "val2"), ("s3", "val3"), ("s4", "val4") }, tags); @@ -241,96 +243,102 @@ public void CreateOnExistingCounter_WithSameMeterName_ShouldReturnDifferentMetri [Fact] public void ValidateCounterWithDifferentDimensions() { + using var collector = new MetricCollector(_meter, nameof(Counter2D)); Counter2D counter2D = CounterTestExtensions.CreateCounter2D(_meter); counter2D.Add(17L, "val1", "val2"); - var measurement = Assert.Single(_collector.GetSnapshot()); - Assert.Equal(17L, measurement.GetValueOrThrow()); + var measurement = Assert.Single(collector.GetMeasurementSnapshot()); + Assert.Equal(17L, measurement.Value); Assert.Equal(new (string, object?)[] { ("s1", "val1"), ("s2", "val2") }, measurement.Tags.Select(x => (x.Key, x.Value))); - _collector.Clear(); + collector.Clear(); counter2D.Add(5L, "val1", "val2"); - measurement = Assert.Single(_collector.GetSnapshot()); - Assert.Equal(5L, measurement.GetValueOrThrow()); + measurement = Assert.Single(collector.GetMeasurementSnapshot()); + Assert.Equal(5L, measurement.Value); Assert.Equal(new (string, object?)[] { ("s1", "val1"), ("s2", "val2") }, measurement.Tags.Select(x => (x.Key, x.Value))); - _collector.Clear(); + collector.Clear(); // Different Dimensions counter2D.Add(5L, "val1", "val4"); - measurement = Assert.Single(_collector.GetSnapshot()); - Assert.Equal(5L, measurement.GetValueOrThrow()); + measurement = Assert.Single(collector.GetMeasurementSnapshot()); + Assert.Equal(5L, measurement.Value); Assert.Equal(new (string, object?)[] { ("s1", "val1"), ("s2", "val4") }, measurement.Tags.Select(x => (x.Key, x.Value))); } [Fact] public void ValidateHistogramWithDifferentDimensions() { + using var collector = new MetricCollector(_meter, nameof(Histogram2D)); Histogram2D histogram = HistogramTestExtensions.CreateHistogram2D(_meter); histogram.Record(10L, "val1", "val2"); - var measurement = Assert.Single(_collector.GetSnapshot()); - Assert.Equal(10L, measurement.GetValueOrThrow()); + var measurement = Assert.Single(collector.GetMeasurementSnapshot()); + Assert.Equal(10L, measurement.Value); Assert.Equal(new (string, object?)[] { ("s1", "val1"), ("s2", "val2") }, measurement.Tags.Select(x => (x.Key, x.Value))); - _collector.Clear(); + collector.Clear(); histogram.Record(5L, "val1", "val2"); - measurement = Assert.Single(_collector.GetSnapshot()); - Assert.Equal(5L, measurement.GetValueOrThrow()); + measurement = Assert.Single(collector.GetMeasurementSnapshot()); + Assert.Equal(5L, measurement.Value); Assert.Equal(new (string, object?)[] { ("s1", "val1"), ("s2", "val2") }, measurement.Tags.Select(x => (x.Key, x.Value))); - _collector.Clear(); + collector.Clear(); // Different Dimensions histogram.Record(5L, "val1", "val4"); - measurement = Assert.Single(_collector.GetSnapshot()); - Assert.Equal(5L, measurement.GetValueOrThrow()); + measurement = Assert.Single(collector.GetMeasurementSnapshot()); + Assert.Equal(5L, measurement.Value); Assert.Equal(new (string, object?)[] { ("s1", "val1"), ("s2", "val4") }, measurement.Tags.Select(x => (x.Key, x.Value))); } [Fact] - public void ValidateCounterWithFileScopedNamespace() + public void ValidateCounterWithFileScopedNamespaceNoDims() { - var longCunter = FileScopedExtensions.CreateCounter(_meter); - longCunter.Add(12L); + using var collector = new MetricCollector(_meter, nameof(FileScopedNamespaceCounter)); + FileScopedNamespaceCounter longCounter = FileScopedExtensions.CreateCounter(_meter); + longCounter.Add(12L); - var measurement = Assert.Single(_collector.GetSnapshot()); - Assert.Equal(12L, measurement.GetValueOrThrow()); + var measurement = Assert.Single(collector.GetMeasurementSnapshot()); + Assert.Equal(12L, measurement.Value); Assert.Empty(measurement.Tags); - _collector.Clear(); + } + + [Fact] + public void ValidateCounterWithFileScopedNamespace() + { + using var collector = new MetricCollector(_meter, nameof(FileScopedNamespaceGenericDoubleCounter)); var genericDoubleCounter = FileScopedExtensions.CreateGenericDoubleCounter(_meter); genericDoubleCounter.Add(1.05D); - measurement = Assert.Single(_collector.GetSnapshot()); - Assert.Equal(1.05D, measurement.GetValueOrThrow()); + var measurement = Assert.Single(collector.GetMeasurementSnapshot()); + Assert.Equal(1.05D, measurement.Value); Assert.Empty(measurement.Tags); } [Fact] public void ValidateCounterWithVariableParamsDimensions() { + using var collector = new MetricCollector(_meter, "MyCounterMetric"); CounterWithVariableParams counter = CounterTestExtensions.CreateCounterWithVariableParams(_meter); counter.Add(100_500L, Dim1: "val1", Dim_2: "val2", Dim_3: "val3"); - var measurement = Assert.Single(_collector.GetSnapshot()); - Assert.Equal(100_500L, measurement.GetValueOrThrow()); - Assert.NotNull(measurement.Instrument); - Assert.Equal("MyCounterMetric", measurement.Instrument.Name); + var measurement = Assert.Single(collector.GetMeasurementSnapshot()); + Assert.Equal(100_500L, measurement.Value); Assert.Equal(new (string, object?)[] { ("Dim1", "val1"), ("Dim_2", "val2"), ("Dim_3", "val3") }, measurement.Tags.Select(x => (x.Key, x.Value))); } [Fact] public void ValidateHistogramWithVariableParamsDimensions() { + using var collector = new MetricCollector(_meter, "MyHistogramMetric"); HistogramWithVariableParams histogram = HistogramTestExtensions.CreateHistogramWithVariableParams(_meter); histogram.Record(100L, Dim1: "val1", Dim_2: "val2", Dim_3: "val3"); - var measurement = Assert.Single(_collector.GetSnapshot()); - Assert.Equal(100L, measurement.GetValueOrThrow()); - Assert.NotNull(measurement.Instrument); - Assert.Equal("MyHistogramMetric", measurement.Instrument.Name); + var measurement = Assert.Single(collector.GetMeasurementSnapshot()); + Assert.Equal(100L, measurement.Value); Assert.Equal(new (string, object?)[] { ("Dim1", "val1"), ("Dim_2", "val2"), ("Dim_3", "val3") }, measurement.Tags.Select(x => (x.Key, x.Value))); } @@ -346,13 +354,12 @@ public void ValidateHistogramStructType() Operations2 = HistogramOperations.Operation1 }; + using var collector = new MetricCollector(_meter, "MyHistogramStructTypeMetric"); StructTypeHistogram recorder = HistogramTestExtensions.CreateHistogramStructType(_meter); recorder.Record(10L, histogramStruct); - var measurement = Assert.Single(_collector.GetSnapshot()); - Assert.Equal(10L, measurement.GetValueOrThrow()); - Assert.NotNull(measurement.Instrument); - Assert.Equal("MyHistogramStructTypeMetric", measurement.Instrument.Name); + var measurement = Assert.Single(collector.GetMeasurementSnapshot()); + Assert.Equal(10L, measurement.Value); Assert.Equal( new (string, object?)[] { @@ -391,13 +398,12 @@ public void ValidateHistogramStrongType() } }; + using var collector = new MetricCollector(_meter, "MyHistogramStrongTypeMetric"); StrongTypeHistogram recorder = HistogramTestExtensions.CreateHistogramStrongType(_meter); recorder.Record(1L, histogramDimensionsTest); - var measurement = Assert.Single(_collector.GetSnapshot()); - Assert.Equal(1L, measurement.GetValueOrThrow()); - Assert.NotNull(measurement.Instrument); - Assert.Equal("MyHistogramStrongTypeMetric", measurement.Instrument.Name); + var measurement = Assert.Single(collector.GetMeasurementSnapshot()); + Assert.Equal(1L, measurement.Value); Assert.Equal( new (string, object?)[] { @@ -415,14 +421,12 @@ public void ValidateHistogramStrongType() measurement.Tags.Select(x => (x.Key, x.Value))); histogramDimensionsTest.ChildDimensionsObject = null!; - _collector.Clear(); + collector.Clear(); recorder.Record(2L, histogramDimensionsTest); - measurement = Assert.Single(_collector.GetSnapshot()); - Assert.Equal(2L, measurement.GetValueOrThrow()); - Assert.NotNull(measurement.Instrument); - Assert.Equal("MyHistogramStrongTypeMetric", measurement.Instrument.Name); + measurement = Assert.Single(collector.GetMeasurementSnapshot()); + Assert.Equal(2L, measurement.Value); Assert.Equal( new (string, object?)[] { @@ -440,14 +444,12 @@ public void ValidateHistogramStrongType() measurement.Tags.Select(x => (x.Key, x.Value))); histogramDimensionsTest.GrandChildrenDimensionsObject = null!; - _collector.Clear(); + collector.Clear(); recorder.Record(3L, histogramDimensionsTest); - measurement = Assert.Single(_collector.GetSnapshot()); - Assert.Equal(3L, measurement.GetValueOrThrow()); - Assert.NotNull(measurement.Instrument); - Assert.Equal("MyHistogramStrongTypeMetric", measurement.Instrument.Name); + measurement = Assert.Single(collector.GetMeasurementSnapshot()); + Assert.Equal(3L, measurement.Value); Assert.Equal( new (string, object?)[] { @@ -468,13 +470,19 @@ public void ValidateHistogramStrongType() [Fact] public void ThrowsOnNullStrongTypeObject() { - StrongTypeHistogram recorder = HistogramTestExtensions.CreateHistogramStrongType(_meter); - var ex = Assert.Throws(() => recorder.Record(4L, null!)); - Assert.NotNull(ex); + using (var collector = new MetricCollector(_meter, "MyHistogramStrongTypeMetric")) + { + StrongTypeHistogram recorder = HistogramTestExtensions.CreateHistogramStrongType(_meter); + var ex = Assert.Throws(() => recorder.Record(4L, null!)); + Assert.NotNull(ex); + } - StrongTypeDecimalCounter counter = CounterTestExtensions.CreateStrongTypeDecimalCounter(_meter); - ex = Assert.Throws(() => counter.Add(4M, null!)); - Assert.NotNull(ex); + using (var collector = new MetricCollector(_meter, "MyCounterStrongTypeMetric")) + { + StrongTypeDecimalCounter counter = CounterTestExtensions.CreateStrongTypeDecimalCounter(_meter); + var ex = Assert.Throws(() => counter.Add(4M, null!)); + Assert.NotNull(ex); + } } [Fact] @@ -489,13 +497,12 @@ public void ValidateCounterStructType() Operations2 = CounterOperations.Operation1 }; + using var collector = new MetricCollector(_meter, "MyCounterStructTypeMetric"); StructTypeCounter recorder = CounterTestExtensions.CreateCounterStructType(_meter); recorder.Add(11L, counterStruct); - var measurement = Assert.Single(_collector.GetSnapshot()); - Assert.Equal(11L, measurement.GetValueOrThrow()); - Assert.NotNull(measurement.Instrument); - Assert.Equal("MyCounterStructTypeMetric", measurement.Instrument.Name); + var measurement = Assert.Single(collector.GetMeasurementSnapshot()); + Assert.Equal(11L, measurement.Value); Assert.Equal( new (string, object?)[] { @@ -534,13 +541,12 @@ public void ValidateCounterStrongType() Dim1 = "Dim1", }; + using var collector = new MetricCollector(_meter, "MyCounterStrongTypeMetric"); StrongTypeDecimalCounter counter = CounterTestExtensions.CreateStrongTypeDecimalCounter(_meter); counter.Add(1M, counterDimensionsTest); - var measurement = Assert.Single(_collector.GetSnapshot()); - Assert.Equal(1M, measurement.GetValueOrThrow()); - Assert.NotNull(measurement.Instrument); - Assert.Equal("MyCounterStrongTypeMetric", measurement.Instrument.Name); + var measurement = Assert.Single(collector.GetMeasurementSnapshot()); + Assert.Equal(1M, measurement.Value); Assert.Equal( new (string, object?)[] { @@ -558,14 +564,12 @@ public void ValidateCounterStrongType() measurement.Tags.Select(x => (x.Key, x.Value))); counterDimensionsTest.ChildDimensionsObject = null!; - _collector.Clear(); + collector.Clear(); counter.Add(2M, counterDimensionsTest); - measurement = Assert.Single(_collector.GetSnapshot()); - Assert.Equal(2M, measurement.GetValueOrThrow()); - Assert.NotNull(measurement.Instrument); - Assert.Equal("MyCounterStrongTypeMetric", measurement.Instrument.Name); + measurement = Assert.Single(collector.GetMeasurementSnapshot()); + Assert.Equal(2M, measurement.Value); Assert.Equal( new (string, object?)[] { @@ -583,13 +587,11 @@ public void ValidateCounterStrongType() measurement.Tags.Select(x => (x.Key, x.Value))); counterDimensionsTest.GrandChildDimensionsObject = null!; - _collector.Clear(); + collector.Clear(); counter.Add(3M, counterDimensionsTest); - measurement = Assert.Single(_collector.GetSnapshot()); - Assert.Equal(3M, measurement.GetValueOrThrow()); - Assert.NotNull(measurement.Instrument); - Assert.Equal("MyCounterStrongTypeMetric", measurement.Instrument.Name); + measurement = Assert.Single(collector.GetMeasurementSnapshot()); + Assert.Equal(3M, measurement.Value); Assert.Equal( new (string, object?)[] { @@ -607,5 +609,3 @@ public void ValidateCounterStrongType() measurement.Tags.Select(x => (x.Key, x.Value))); } } - -#endif diff --git a/test/Generators/Microsoft.Gen.Metrics/TestClasses/CounterDimensions.cs b/test/Generators/Microsoft.Gen.Metrics/TestClasses/CounterDimensions.cs index 1685b7f669d..6b1f26b6d60 100644 --- a/test/Generators/Microsoft.Gen.Metrics/TestClasses/CounterDimensions.cs +++ b/test/Generators/Microsoft.Gen.Metrics/TestClasses/CounterDimensions.cs @@ -8,6 +8,11 @@ namespace TestClasses #pragma warning disable SA1402 // File may only contain a single type public class CounterDimensions : CounterParentDimensions { + // The generator should ignore these statics: + public const string Const = "Constant Value"; + + public static string Static = "Static Value"; + public string? Dim1; public CounterOperations OperationsEnum { get; set; } diff --git a/test/Generators/Microsoft.Gen.Metrics/TestClasses/HistogramTestExtensions.cs b/test/Generators/Microsoft.Gen.Metrics/TestClasses/HistogramTestExtensions.cs index d132c941bb6..d62bfad65c6 100644 --- a/test/Generators/Microsoft.Gen.Metrics/TestClasses/HistogramTestExtensions.cs +++ b/test/Generators/Microsoft.Gen.Metrics/TestClasses/HistogramTestExtensions.cs @@ -107,7 +107,13 @@ internal static partial class HistogramTestExtensions #pragma warning disable SA1402 // File may only contain a single type public class HistogramDimensionsTest : HistogramParentDimensions { + // The generator should ignore these statics: + public const string Const = "Constant Value"; + + public static string Static = "Static Value"; + public string? Dim1; + public HistogramOperations OperationsEnum { get; set; } [TagName("Enum2")] @@ -156,6 +162,11 @@ public class HistogramGrandChildrenDimensions public struct HistogramStruct { + // The generator should ignore these statics: + public const string Const = "Constant Value"; + + public static string Static = "Static Value"; + public string? Dim1 { get; set; } [TagName("DimInField")] diff --git a/test/Generators/Microsoft.Gen.Metrics/Unit/ParserTests.Diagnostics.cs b/test/Generators/Microsoft.Gen.Metrics/Unit/ParserTests.Diagnostics.cs index e9e26ed8b2a..6532476648c 100644 --- a/test/Generators/Microsoft.Gen.Metrics/Unit/ParserTests.Diagnostics.cs +++ b/test/Generators/Microsoft.Gen.Metrics/Unit/ParserTests.Diagnostics.cs @@ -96,27 +96,6 @@ class Transitive Assert.Contains("Test.Transitive ⇆ Test.Interim", diag.GetMessage()); } - [Fact] - public async Task StrongTypeCounter_CyclicReference_Guid() - { - var d = await RunGenerator(@" - public class TypeA - { - public System.Guid TestA { get; set; } - } - - public static partial class MetricClass - { - [Counter(typeof(TypeA), Name=""CyclicTest"")] - public static partial CyclicTest CreateCyclicTestCounter(Meter meter); - }"); - - Assert.NotNull(d); - var diag = Assert.Single(d); - Assert.Equal(DiagDescriptors.ErrorTagTypeCycleDetected.Id, diag.Id); - Assert.Contains("System.Guid ⇆ System.Guid", diag.GetMessage()); - } - [Fact] public async Task StructTypeGauge() { From 3e2405874ed946ede488cc96e162ce62e1825b73 Mon Sep 17 00:00:00 2001 From: Nikita Balabaev Date: Tue, 2 Jan 2024 18:20:40 +0100 Subject: [PATCH 122/172] Log outgoing HTTP path parameters in Structured mode (#4845) * Log outgoing HTTP path parameters in Structured mode --- .../Logging/Internal/HttpRequestReader.cs | 46 +++-- .../Logging/Internal/Log.cs | 22 ++- .../Logging/Internal/LogRecord.cs | 19 ++ .../Internal/LoggerMessageStateExtensions.cs | 27 ++- .../Logging/LoggingOptions.cs | 5 +- ...crosoft.Extensions.Http.Diagnostics.csproj | 1 + .../Http/HttpRouteFormatter.cs | 2 +- .../Http/IHttpRouteParser.cs | 2 - .../Microsoft.Extensions.Telemetry.csproj | 2 +- ...Extensions.Diagnostics.Probes.Tests.csproj | 2 +- .../Logging/AcceptanceTests.cs | 98 +++++++++-- .../Logging/HttpClientLoggerTest.cs | 38 ++-- .../Logging/HttpRequestReaderTest.cs | 163 ++++++------------ 13 files changed, 253 insertions(+), 174 deletions(-) diff --git a/src/Libraries/Microsoft.Extensions.Http.Diagnostics/Logging/Internal/HttpRequestReader.cs b/src/Libraries/Microsoft.Extensions.Http.Diagnostics/Logging/Internal/HttpRequestReader.cs index 5da92a0456f..a9eaf982ac4 100644 --- a/src/Libraries/Microsoft.Extensions.Http.Diagnostics/Logging/Internal/HttpRequestReader.cs +++ b/src/Libraries/Microsoft.Extensions.Http.Diagnostics/Logging/Internal/HttpRequestReader.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. using System; +using System.Buffers; using System.Collections.Frozen; using System.Collections.Generic; using System.Net.Http; @@ -19,6 +20,7 @@ namespace Microsoft.Extensions.Http.Logging.Internal; internal sealed class HttpRequestReader : IHttpRequestReader { private readonly IHttpRouteFormatter _routeFormatter; + private readonly IHttpRouteParser _httpRouteParser; private readonly IHttpHeadersReader _httpHeadersReader; private readonly FrozenDictionary _defaultSensitiveParameters; @@ -44,12 +46,14 @@ public HttpRequestReader( IServiceProvider serviceProvider, IOptionsMonitor optionsMonitor, IHttpRouteFormatter routeFormatter, + IHttpRouteParser httpRouteParser, IOutgoingRequestContext requestMetadataContext, IDownstreamDependencyMetadataManager? downstreamDependencyMetadataManager = null, [ServiceKey] string? serviceKey = null) : this( optionsMonitor.GetKeyedOrCurrent(serviceKey), routeFormatter, + httpRouteParser, serviceProvider.GetRequiredOrKeyedRequiredService(serviceKey), requestMetadataContext, downstreamDependencyMetadataManager) @@ -59,6 +63,7 @@ public HttpRequestReader( internal HttpRequestReader( LoggingOptions options, IHttpRouteFormatter routeFormatter, + IHttpRouteParser httpRouteParser, IHttpHeadersReader httpHeadersReader, IOutgoingRequestContext requestMetadataContext, IDownstreamDependencyMetadataManager? downstreamDependencyMetadataManager = null) @@ -67,6 +72,7 @@ internal HttpRequestReader( _httpHeadersReader = httpHeadersReader; _routeFormatter = routeFormatter; + _httpRouteParser = httpRouteParser; _requestMetadataContext = requestMetadataContext; _downstreamDependencyMetadataManager = downstreamDependencyMetadataManager; @@ -92,7 +98,7 @@ public async Task ReadRequestAsync(LogRecord logRecord, HttpRequestMessage reque { logRecord.Host = request.RequestUri?.Host ?? TelemetryConstants.Unknown; logRecord.Method = request.Method; - logRecord.Path = GetRedactedPath(request); + GetRedactedPathAndParameters(request, logRecord); if (_logRequestHeaders) { @@ -125,16 +131,19 @@ public async Task ReadResponseAsync(LogRecord logRecord, HttpResponseMessage res logRecord.StatusCode = (int)response.StatusCode; } - private string GetRedactedPath(HttpRequestMessage request) + private void GetRedactedPathAndParameters(HttpRequestMessage request, LogRecord logRecord) { + logRecord.PathParameters = null; if (request.RequestUri is null) { - return TelemetryConstants.Unknown; + logRecord.Path = TelemetryConstants.Unknown; + return; } if (_routeParameterRedactionMode == HttpRouteParameterRedactionMode.None) { - return request.RequestUri.AbsolutePath; + logRecord.Path = request.RequestUri.AbsolutePath; + return; } var requestMetadata = request.GetRequestMetadata() ?? @@ -143,19 +152,36 @@ private string GetRedactedPath(HttpRequestMessage request) if (requestMetadata == null) { - return TelemetryConstants.Redacted; + logRecord.Path = TelemetryConstants.Redacted; + return; } var route = requestMetadata.RequestRoute; if (route == TelemetryConstants.Unknown) { - return requestMetadata.RequestName; + logRecord.Path = requestMetadata.RequestName; + return; } - return _outgoingPathLogMode switch + var routeSegments = _httpRouteParser.ParseRoute(route); + + if (_outgoingPathLogMode == OutgoingPathLoggingMode.Formatted) + { + logRecord.Path = _routeFormatter.Format(in routeSegments, request.RequestUri.AbsolutePath, _routeParameterRedactionMode, _defaultSensitiveParameters); + logRecord.PathParameters = null; + } + else { - OutgoingPathLoggingMode.Formatted => _routeFormatter.Format(route, request.RequestUri.AbsolutePath, _routeParameterRedactionMode, _defaultSensitiveParameters), - _ => route - }; + // Case when logging mode is "OutgoingPathLoggingMode.Structured" + logRecord.Path = route; + var routeParams = ArrayPool.Shared.Rent(routeSegments.ParameterCount); + + // Setting this value right away to be able to return it back to pool in a callee's "finally" block: + logRecord.PathParameters = routeParams; + if (_httpRouteParser.TryExtractParameters(request.RequestUri.AbsolutePath, in routeSegments, _routeParameterRedactionMode, _defaultSensitiveParameters, ref routeParams)) + { + logRecord.PathParametersCount = routeSegments.ParameterCount; + } + } } } diff --git a/src/Libraries/Microsoft.Extensions.Http.Diagnostics/Logging/Internal/Log.cs b/src/Libraries/Microsoft.Extensions.Http.Diagnostics/Logging/Internal/Log.cs index f7e6896b14b..2b8a627b687 100644 --- a/src/Libraries/Microsoft.Extensions.Http.Diagnostics/Logging/Internal/Log.cs +++ b/src/Libraries/Microsoft.Extensions.Http.Diagnostics/Logging/Internal/Log.cs @@ -34,7 +34,7 @@ internal static class Log "An error occurred in enricher '{Enricher}' while enriching the logger context for request: " + $"{{{HttpClientLoggingTagNames.Method}}} {{{HttpClientLoggingTagNames.Host}}}/{{{HttpClientLoggingTagNames.Path}}}"; - private static readonly Func _originalFormatValueFMTFunc = OriginalFormatValueFMT; + private static readonly Func _originalFormatValueFMTFunc = OriginalFormatValueFmt; public static void OutgoingRequest(ILogger logger, LogLevel level, LogRecord record) { @@ -115,7 +115,7 @@ public static void LoggerContextMissing(ILogger logger, Exception? exception, st new(0, nameof(LoggerContextMissing)), state, exception, - (s, _) => + static (s, _) => { var requestState = s.TagArray[3].Value ?? NullString; var method = s.TagArray[2].Value ?? NullString; @@ -142,7 +142,7 @@ public static void EnrichmentError(ILogger logger, Exception exception, string? new(0, nameof(EnrichmentError)), state, exception, - (s, _) => + static (s, _) => { var enricher = s.TagArray[4].Value ?? NullString; var method = s.TagArray[3].Value ?? NullString; @@ -171,7 +171,10 @@ private static void OutgoingRequest( var requestHeadersCount = record.RequestHeaders?.Count ?? 0; var responseHeadersCount = record.ResponseHeaders?.Count ?? 0; - var index = loggerMessageState.ReserveTagSpace(MinimalPropertyCount + statusCodePropertyCount + requestHeadersCount + responseHeadersCount); + var spaceToReserve = MinimalPropertyCount + statusCodePropertyCount + requestHeadersCount + responseHeadersCount + + record.PathParametersCount + (record.RequestBody is null ? 0 : 1) + (record.ResponseBody is null ? 0 : 1); + + var index = loggerMessageState.ReserveTagSpace(spaceToReserve); loggerMessageState.TagArray[index++] = new(HttpClientLoggingTagNames.Method, record.Method); loggerMessageState.TagArray[index++] = new(HttpClientLoggingTagNames.Host, record.Host); loggerMessageState.TagArray[index++] = new(HttpClientLoggingTagNames.Path, record.Path); @@ -192,14 +195,19 @@ private static void OutgoingRequest( loggerMessageState.AddResponseHeaders(record.ResponseHeaders!, ref index); } + if (record.PathParameters is not null) + { + loggerMessageState.AddPathParameters(record.PathParameters, record.PathParametersCount, ref index); + } + if (record.RequestBody is not null) { - loggerMessageState.AddTag(HttpClientLoggingTagNames.RequestBody, record.RequestBody); + loggerMessageState.TagArray[index++] = new(HttpClientLoggingTagNames.RequestBody, record.RequestBody); } if (record.ResponseBody is not null) { - loggerMessageState.AddTag(HttpClientLoggingTagNames.ResponseBody, record.ResponseBody); + loggerMessageState.TagArray[index] = new(HttpClientLoggingTagNames.ResponseBody, record.ResponseBody); } logger.Log( @@ -215,7 +223,7 @@ private static void OutgoingRequest( } } - private static string OriginalFormatValueFMT(LoggerMessageState request, Exception? _) + private static string OriginalFormatValueFmt(LoggerMessageState request, Exception? _) { int startIndex = FindStartIndex(request); var httpMethod = request[startIndex].Value; diff --git a/src/Libraries/Microsoft.Extensions.Http.Diagnostics/Logging/Internal/LogRecord.cs b/src/Libraries/Microsoft.Extensions.Http.Diagnostics/Logging/Internal/LogRecord.cs index ada8e9f8134..93238e5809c 100644 --- a/src/Libraries/Microsoft.Extensions.Http.Diagnostics/Logging/Internal/LogRecord.cs +++ b/src/Libraries/Microsoft.Extensions.Http.Diagnostics/Logging/Internal/LogRecord.cs @@ -1,8 +1,10 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. +using System.Buffers; using System.Collections.Generic; using System.Net.Http; +using Microsoft.Extensions.Http.Diagnostics; using Microsoft.Extensions.Logging; using Microsoft.Extensions.ObjectPool; @@ -63,8 +65,24 @@ internal sealed class LogRecord : IResettable /// public LoggerMessageState? EnrichmentTags { get; set; } + /// + /// Gets or sets request path parameters. + /// + public HttpRouteParameter[]? PathParameters { get; set; } + + /// + /// Gets or sets request path parameters count for . + /// + public int PathParametersCount { get; set; } + public bool TryReset() { + if (PathParameters != null) + { + ArrayPool.Shared.Return(PathParameters); + PathParameters = null; + } + Host = string.Empty; Method = null; Path = string.Empty; @@ -75,6 +93,7 @@ public bool TryReset() EnrichmentTags = null; RequestHeaders = null; ResponseHeaders = null; + PathParametersCount = 0; return true; } } diff --git a/src/Libraries/Microsoft.Extensions.Http.Diagnostics/Logging/Internal/LoggerMessageStateExtensions.cs b/src/Libraries/Microsoft.Extensions.Http.Diagnostics/Logging/Internal/LoggerMessageStateExtensions.cs index fa9912be06e..4bda377d865 100644 --- a/src/Libraries/Microsoft.Extensions.Http.Diagnostics/Logging/Internal/LoggerMessageStateExtensions.cs +++ b/src/Libraries/Microsoft.Extensions.Http.Diagnostics/Logging/Internal/LoggerMessageStateExtensions.cs @@ -4,6 +4,7 @@ using System.Collections.Concurrent; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Http.Diagnostics; using Microsoft.Extensions.Logging; namespace Microsoft.Extensions.Http.Logging.Internal; @@ -26,8 +27,7 @@ public static void AddRequestHeaders(this LoggerMessageState state, List p + Normalize(x), - HttpClientLoggingTagNames.RequestHeaderPrefix); + static x => HttpClientLoggingTagNames.RequestHeaderPrefix + Normalize(x)); state.TagArray[index++] = new(key, items[i].Value); } @@ -46,17 +46,30 @@ public static void AddResponseHeaders(this LoggerMessageState state, List p + Normalize(x), - HttpClientLoggingTagNames.ResponseHeaderPrefix); + static x => HttpClientLoggingTagNames.ResponseHeaderPrefix + Normalize(x)); state.TagArray[index++] = new(key, items[i].Value); } } + /// + /// Adds path parameters to . + /// + /// A to be filled. + /// An array with path parameters. + /// A number of path parameters. + /// Represents an index to be used when writing tags into . + /// will be mutated to point to the next item. + public static void AddPathParameters(this LoggerMessageState state, HttpRouteParameter[] parameters, int paramsCount, ref int index) + { + for (var i = 0; i < paramsCount; i++) + { + state.TagArray[index++] = new(parameters[i].Name, parameters[i].Value); + } + } + [SuppressMessage("Globalization", "CA1308:Normalize strings to uppercase", Justification = "Normalization to lower case is required by OTel's semantic conventions")] private static string Normalize(string header) - { - return header.ToLowerInvariant(); - } + => header.ToLowerInvariant(); } diff --git a/src/Libraries/Microsoft.Extensions.Http.Diagnostics/Logging/LoggingOptions.cs b/src/Libraries/Microsoft.Extensions.Http.Diagnostics/Logging/LoggingOptions.cs index 4359f22fb5d..184fca4a061 100644 --- a/src/Libraries/Microsoft.Extensions.Http.Diagnostics/Logging/LoggingOptions.cs +++ b/src/Libraries/Microsoft.Extensions.Http.Diagnostics/Logging/LoggingOptions.cs @@ -123,8 +123,9 @@ public class LoggingOptions /// The default value is . /// /// - /// This option is applied only when the option is not set to , - /// otherwise this setting is ignored and the unredacted HTTP request path is logged. + /// This option is applied only when the option is not set to + /// , + /// otherwise this setting is ignored and the non-redacted HTTP request path is logged. /// public OutgoingPathLoggingMode RequestPathLoggingMode { get; set; } = DefaultPathLoggingMode; diff --git a/src/Libraries/Microsoft.Extensions.Http.Diagnostics/Microsoft.Extensions.Http.Diagnostics.csproj b/src/Libraries/Microsoft.Extensions.Http.Diagnostics/Microsoft.Extensions.Http.Diagnostics.csproj index b85b90b4c6f..dc712fd3275 100644 --- a/src/Libraries/Microsoft.Extensions.Http.Diagnostics/Microsoft.Extensions.Http.Diagnostics.csproj +++ b/src/Libraries/Microsoft.Extensions.Http.Diagnostics/Microsoft.Extensions.Http.Diagnostics.csproj @@ -42,6 +42,7 @@ + diff --git a/src/Libraries/Microsoft.Extensions.Telemetry/Http/HttpRouteFormatter.cs b/src/Libraries/Microsoft.Extensions.Telemetry/Http/HttpRouteFormatter.cs index 6f2a40d5cf1..0ee93b5e851 100644 --- a/src/Libraries/Microsoft.Extensions.Telemetry/Http/HttpRouteFormatter.cs +++ b/src/Libraries/Microsoft.Extensions.Telemetry/Http/HttpRouteFormatter.cs @@ -15,7 +15,7 @@ internal sealed class HttpRouteFormatter : IHttpRouteFormatter { private const char ForwardSlashSymbol = '/'; -#if NETCOREAPP3_1_OR_GREATER +#if NET6_0_OR_GREATER private const char ForwardSlash = ForwardSlashSymbol; #else #pragma warning disable IDE1006 // Naming Styles diff --git a/src/Libraries/Microsoft.Extensions.Telemetry/Http/IHttpRouteParser.cs b/src/Libraries/Microsoft.Extensions.Telemetry/Http/IHttpRouteParser.cs index c95e6a3ce7b..5831935f020 100644 --- a/src/Libraries/Microsoft.Extensions.Telemetry/Http/IHttpRouteParser.cs +++ b/src/Libraries/Microsoft.Extensions.Telemetry/Http/IHttpRouteParser.cs @@ -28,12 +28,10 @@ internal interface IHttpRouteParser /// Dictionary of parameters with their data classification that needs to be redacted. /// Output array where parameters will be stored. Caller must provide the array with enough capacity to hold all parameters in route segment. /// Returns true if parameters were extracted successfully, return false otherwise. -#pragma warning disable CA1045 // Do not pass types by reference bool TryExtractParameters( string httpPath, in ParsedRouteSegments routeSegments, HttpRouteParameterRedactionMode redactionMode, IReadOnlyDictionary parametersToRedact, ref HttpRouteParameter[] httpRouteParameters); -#pragma warning restore CA1045 // Do not pass types by reference } diff --git a/src/Libraries/Microsoft.Extensions.Telemetry/Microsoft.Extensions.Telemetry.csproj b/src/Libraries/Microsoft.Extensions.Telemetry/Microsoft.Extensions.Telemetry.csproj index bebeba6fb9a..21e6baea697 100644 --- a/src/Libraries/Microsoft.Extensions.Telemetry/Microsoft.Extensions.Telemetry.csproj +++ b/src/Libraries/Microsoft.Extensions.Telemetry/Microsoft.Extensions.Telemetry.csproj @@ -24,7 +24,7 @@
- + diff --git a/test/Libraries/Microsoft.Extensions.Diagnostics.Probes.Tests/Microsoft.Extensions.Diagnostics.Probes.Tests.csproj b/test/Libraries/Microsoft.Extensions.Diagnostics.Probes.Tests/Microsoft.Extensions.Diagnostics.Probes.Tests.csproj index d2fece93ad6..5cb8a9f8f62 100644 --- a/test/Libraries/Microsoft.Extensions.Diagnostics.Probes.Tests/Microsoft.Extensions.Diagnostics.Probes.Tests.csproj +++ b/test/Libraries/Microsoft.Extensions.Diagnostics.Probes.Tests/Microsoft.Extensions.Diagnostics.Probes.Tests.csproj @@ -17,7 +17,7 @@ - + diff --git a/test/Libraries/Microsoft.Extensions.Http.Diagnostics.Tests/Logging/AcceptanceTests.cs b/test/Libraries/Microsoft.Extensions.Http.Diagnostics.Tests/Logging/AcceptanceTests.cs index 603f7346d16..8e2df28853b 100644 --- a/test/Libraries/Microsoft.Extensions.Http.Diagnostics.Tests/Logging/AcceptanceTests.cs +++ b/test/Libraries/Microsoft.Extensions.Http.Diagnostics.Tests/Logging/AcceptanceTests.cs @@ -14,7 +14,6 @@ using Microsoft.Extensions.Http.Diagnostics; using Microsoft.Extensions.Http.Logging.Test.Internal; using Microsoft.Extensions.Logging; -using Microsoft.Extensions.Logging.Testing; using Microsoft.Extensions.Options; using Xunit; @@ -23,7 +22,7 @@ namespace Microsoft.Extensions.Http.Logging.Test; public class AcceptanceTests { private const string LoggingCategory = "Microsoft.Extensions.Http.Logging.HttpClientLogger"; - private static readonly Uri _unreachableRequestUri = new("https://we.wont.hit.this.doman.anyway"); + private static readonly Uri _unreachableRequestUri = new("https://we.wont.hit.this.domain.anyway"); [Fact] public async Task AddHttpClientLogEnricher_WhenNullEnricherRegistered_SkipsNullEnrichers() @@ -116,14 +115,15 @@ public async Task AddHttpClientLogging_ServiceCollectionAndEnrichers_EnrichesLog var logRecord = collector.GetSnapshot().Single(logRecord => logRecord.Category == LoggingCategory); Assert.Equal($"{httpRequestMessage.Method} {httpRequestMessage.RequestUri.Host}/{TelemetryConstants.Redacted}", logRecord.Message); - var state = logRecord.StructuredState; var enricher1 = sp.GetServices().SingleOrDefault(enn => enn is EnricherWithCounter) as EnricherWithCounter; var enricher2 = sp.GetServices().SingleOrDefault(enn => enn is TestEnricher) as TestEnricher; enricher1.Should().NotBeNull(); enricher2.Should().NotBeNull(); - enricher1!.TimesCalled.Should().Be(1); + + var state = logRecord.StructuredState; + state.Should().NotBeNull(); state!.Single(kvp => kvp.Key == enricher2!.KvpRequest.Key).Value.Should().Be(enricher2!.KvpRequest.Value!.ToString()); } @@ -170,7 +170,7 @@ public async Task AddHttpClientLogging_WithNamedHttpClients_WorksCorrectly() var responseString = await SendRequest(namedClient1, httpRequestMessage); var collector = provider.GetFakeLogCollector(); var logRecord = collector.GetSnapshot().Single(l => l.Category == LoggingCategory); - var state = logRecord.State as List>; + var state = logRecord.StructuredState; state.Should().Contain(kvp => kvp.Value == responseString); state.Should().Contain(kvp => kvp.Value == "Request Value"); state.Should().Contain(kvp => kvp.Value == "Request Value 2,Request Value 3"); @@ -186,7 +186,7 @@ public async Task AddHttpClientLogging_WithNamedHttpClients_WorksCorrectly() collector.Clear(); responseString = await SendRequest(namedClient2, httpRequestMessage2); logRecord = collector.GetSnapshot().Single(l => l.Category == LoggingCategory); - state = logRecord.State as List>; + state = logRecord.StructuredState; state.Should().Contain(kvp => kvp.Value == responseString); state.Should().Contain(kvp => kvp.Value == "Request Value"); state.Should().Contain(kvp => kvp.Value == "Request Value 2,Request Value 3"); @@ -256,7 +256,8 @@ public async Task AddHttpClientLogging_WithTypedHttpClients_WorksCorrectly() var responseString = Encoding.UTF8.GetString(buffer); var logRecord = collector.GetSnapshot().Single(l => l.Category == LoggingCategory); - var state = logRecord.State as List>; + var state = logRecord.StructuredState; + state.Should().NotBeNull(); state.Should().Contain(kvp => kvp.Value == responseString); state.Should().Contain(kvp => kvp.Value == "Request Value"); state.Should().Contain(kvp => kvp.Value == "Request Value 2,Request Value 3"); @@ -277,7 +278,7 @@ public async Task AddHttpClientLogging_WithTypedHttpClients_WorksCorrectly() responseString = Encoding.UTF8.GetString(buffer); logRecord = collector.GetSnapshot().Single(l => l.Category == LoggingCategory); - state = logRecord.State as List>; + state = logRecord.StructuredState; state.Should().Contain(kvp => kvp.Value == responseString); state.Should().Contain(kvp => kvp.Value == "Request Value"); state.Should().Contain(kvp => kvp.Value == "Request Value 2,Request Value 3"); @@ -320,10 +321,81 @@ public async Task AddHttpClientLogging_RedactSensitiveParams(HttpRouteParameterR var collector = sp.GetFakeLogCollector(); var logRecord = collector.GetSnapshot().Single(logRecord => logRecord.Category == LoggingCategory); - var state = logRecord.State as List>; + var state = logRecord.StructuredState; + state.Should().NotBeNull(); state!.Single(kvp => kvp.Key == HttpClientLoggingTagNames.Path).Value.Should().Be(redactedPath); } + [Theory] + [InlineData(HttpRouteParameterRedactionMode.Strict, "REDACTED", "")] + [InlineData(HttpRouteParameterRedactionMode.Loose, "999", "")] + [InlineData(HttpRouteParameterRedactionMode.None, "999", "123")] + public async Task AddHttpClientLogging_StructuredPathLogging_RedactsSensitiveParams( + HttpRouteParameterRedactionMode parameterRedactionMode, + string expectedUnitId, + string expectedUserId) + { + const string RequestPath = "https://fake.com/v1/unit/999/users/123"; + const string RequestRoute = "/v1/unit/{unitId}/users/{userId}"; + + await using var sp = new ServiceCollection() + .AddFakeLogging() + .AddFakeRedaction(o => o.RedactionFormat = "") + .AddHttpClient() + .AddExtendedHttpClientLogging(o => + { + o.RouteParameterDataClasses.Add("userId", FakeTaxonomy.PrivateData); + o.RequestPathParameterRedactionMode = parameterRedactionMode; + o.RequestPathLoggingMode = OutgoingPathLoggingMode.Structured; + }) + .BlockRemoteCall() + .BuildServiceProvider(); + + using var httpClient = sp.GetRequiredService().CreateClient(); + using var httpRequestMessage = new HttpRequestMessage + { + Method = HttpMethod.Get, + RequestUri = new Uri(RequestPath) + }; + + httpRequestMessage.SetRequestMetadata(new RequestMetadata(httpRequestMessage.Method.ToString(), RequestRoute)); + + using var _ = await httpClient.SendAsync(httpRequestMessage).ConfigureAwait(false); + + var collector = sp.GetFakeLogCollector(); + var logRecord = collector.GetSnapshot().Single(logRecord => logRecord.Category == LoggingCategory); + var state = logRecord.StructuredState; + var loggedPath = state.Should().NotBeNull().And + .ContainSingle(kvp => kvp.Key == HttpClientLoggingTagNames.Path) + .Subject.Value; + + state.Should().ContainSingle(kvp => kvp.Key == HttpClientLoggingTagNames.Host) + .Which.Value.Should().Be(httpRequestMessage.RequestUri.Host); + + state.Should().ContainSingle(kvp => kvp.Key == HttpClientLoggingTagNames.Method) + .Which.Value.Should().Be(httpRequestMessage.Method.ToString()); + + state.Should().ContainSingle(kvp => kvp.Key == HttpClientLoggingTagNames.StatusCode) + .Which.Value.Should().Be("200"); + + state.Should().ContainSingle(kvp => kvp.Key == HttpClientLoggingTagNames.Duration) + .Which.Value.Should().NotBeEmpty(); + + // When the redaction mode is set to "None", the RequestPathLoggingMode is ignored + if (parameterRedactionMode == HttpRouteParameterRedactionMode.None) + { + loggedPath.Should().Be(httpRequestMessage.RequestUri.AbsolutePath); + state.Should().HaveCount(5); + } + else + { + loggedPath.Should().Be(RequestRoute); + state.Should().ContainSingle(kvp => kvp.Key == "userId").Which.Value.Should().Be(expectedUserId); + state.Should().ContainSingle(kvp => kvp.Key == "unitId").Which.Value.Should().Be(expectedUnitId); + state.Should().HaveCount(7); + } + } + [Theory] [InlineData(HttpRouteParameterRedactionMode.Strict, "v1/unit/REDACTED/users/REDACTED:123")] [InlineData(HttpRouteParameterRedactionMode.Loose, "v1/unit/999/users/REDACTED:123")] @@ -361,7 +433,8 @@ public async Task AddHttpClientLogging_NamedHttpClient_RedactSensitiveParams(Htt var collector = sp.GetFakeLogCollector(); var logRecord = collector.GetSnapshot().Single(logRecord => logRecord.Category == LoggingCategory); - var state = logRecord.State as List>; + var state = logRecord.StructuredState; + state.Should().NotBeNull(); state!.Single(kvp => kvp.Key == HttpClientLoggingTagNames.Path).Value.Should().Be(redactedPath); } @@ -514,7 +587,6 @@ public async Task AddHttpClientLogging_DisablesNetScope() .BlockRemoteCall() .BuildServiceProvider(); - var options = provider.GetRequiredService>().Get("test"); var client = provider.GetRequiredService().CreateClient("test"); using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Get, _unreachableRequestUri); @@ -522,7 +594,7 @@ public async Task AddHttpClientLogging_DisablesNetScope() var collector = provider.GetFakeLogCollector(); var logRecord = collector.GetSnapshot().Single(l => l.Category == LoggingCategory); - logRecord.Scopes.Should().HaveCount(0); + logRecord.Scopes.Should().BeEmpty(); } [Fact] @@ -563,7 +635,7 @@ public async Task AddDefaultHttpClientLogging_DisablesNetScope() .AddExtendedHttpClientLogging() .BlockRemoteCall() .BuildServiceProvider(); - var options = provider.GetRequiredService>().Get("test"); + var client = provider.GetRequiredService().CreateClient("test"); using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Get, _unreachableRequestUri); diff --git a/test/Libraries/Microsoft.Extensions.Http.Diagnostics.Tests/Logging/HttpClientLoggerTest.cs b/test/Libraries/Microsoft.Extensions.Http.Diagnostics.Tests/Logging/HttpClientLoggerTest.cs index bb26597eb53..caaeead61ce 100644 --- a/test/Libraries/Microsoft.Extensions.Http.Diagnostics.Tests/Logging/HttpClientLoggerTest.cs +++ b/test/Libraries/Microsoft.Extensions.Http.Diagnostics.Tests/Logging/HttpClientLoggerTest.cs @@ -97,7 +97,7 @@ public async Task SendAsync_HttpRequestException_ThrowsException() using var handler = new TestLoggingHandler( new HttpClientLogger( NullLogger.Instance, - new HttpRequestReader(options, GetHttpRouteFormatter(), headersReader, RequestMetadataContext), + new HttpRequestReader(options, GetHttpRouteFormatter(), Mock.Of(), headersReader, RequestMetadataContext), Enumerable.Empty(), options), new TestingHandlerStub((_, _) => throw exception)); @@ -209,22 +209,23 @@ public async Task HttpLoggingHandler_AllOptions_LogsOutgoingRequest() BodyReadTimeout = TimeSpan.FromMinutes(5), RequestPathLoggingMode = OutgoingPathLoggingMode.Structured, LogRequestStart = false, - LogBody = true, - RouteParameterDataClasses = { { "userId", FakeTaxonomy.PrivateData } }, + LogBody = true }; var mockHeadersRedactor = new Mock(); mockHeadersRedactor.Setup(r => r.Redact(It.IsAny>(), It.IsAny())) .Returns(Redacted); + var headersReader = new HttpHeadersReader(options.ToOptionsMonitor(), mockHeadersRedactor.Object); - var fakeLogger = new FakeLogger(new FakeLogCollector(Options.Options.Create(new FakeLogCollectorOptions()))); + var fakeLogger = new FakeLogger(); var logger = new HttpClientLogger( fakeLogger, new HttpRequestReader( options, GetHttpRouteFormatter(), + Mock.Of(), headersReader, RequestMetadataContext), new List { testEnricher }, options); @@ -300,8 +301,7 @@ public async Task HttpLoggingHandler_AllOptionsWithLogRequestStart_LogsOutgoingR BodyReadTimeout = TimeSpan.FromMinutes(5), RequestPathLoggingMode = OutgoingPathLoggingMode.Structured, LogRequestStart = true, - LogBody = true, - RouteParameterDataClasses = { { "userId", FakeTaxonomy.PrivateData } }, + LogBody = true }; var fakeLogger = new FakeLogger( @@ -321,6 +321,7 @@ public async Task HttpLoggingHandler_AllOptionsWithLogRequestStart_LogsOutgoingR new HttpRequestReader( options, GetHttpRouteFormatter(), + Mock.Of(), headersReader, RequestMetadataContext), new List { testEnricher }, options); @@ -407,8 +408,7 @@ public async Task HttpLoggingHandler_AllOptionsSendAsyncFailed_LogsRequestInform BodyReadTimeout = TimeSpan.FromMinutes(5), RequestPathLoggingMode = OutgoingPathLoggingMode.Structured, LogRequestStart = false, - LogBody = true, - RouteParameterDataClasses = { { "userId", FakeTaxonomy.PrivateData } }, + LogBody = true }; var fakeLogger = new FakeLogger(new FakeLogCollector(Options.Options.Create(new FakeLogCollectorOptions()))); @@ -426,6 +426,7 @@ public async Task HttpLoggingHandler_AllOptionsSendAsyncFailed_LogsRequestInform new HttpRequestReader( options, GetHttpRouteFormatter(), + Mock.Of(), headersReader, RequestMetadataContext), new List { testEnricher }, options), @@ -503,8 +504,7 @@ public async Task HttpLoggingHandler_ReadResponseThrows_LogsException() BodyReadTimeout = TimeSpan.FromMinutes(5), RequestPathLoggingMode = OutgoingPathLoggingMode.Structured, LogRequestStart = false, - LogBody = true, - RouteParameterDataClasses = { { "userId", FakeTaxonomy.PrivateData } }, + LogBody = true }; var fakeLogger = new FakeLogger( @@ -519,7 +519,7 @@ public async Task HttpLoggingHandler_ReadResponseThrows_LogsException() var exception = new InvalidOperationException("test"); - var actualRequestReader = new HttpRequestReader(options, GetHttpRouteFormatter(), headersReader, RequestMetadataContext); + var actualRequestReader = new HttpRequestReader(options, GetHttpRouteFormatter(), Mock.Of(), headersReader, RequestMetadataContext); var mockedRequestReader = new Mock(); mockedRequestReader .Setup(m => @@ -618,8 +618,7 @@ public async Task HttpLoggingHandler_AllOptionsTransferEncodingIsNotChunked_Logs BodyReadTimeout = TimeSpan.FromMinutes(5), RequestPathLoggingMode = OutgoingPathLoggingMode.Structured, LogRequestStart = false, - LogBody = true, - RouteParameterDataClasses = { { "userId", FakeTaxonomy.PrivateData } }, + LogBody = true }; var fakeLogger = new FakeLogger(new FakeLogCollector(Options.Options.Create(new FakeLogCollectorOptions()))); @@ -635,6 +634,7 @@ public async Task HttpLoggingHandler_AllOptionsTransferEncodingIsNotChunked_Logs new HttpRequestReader( options, GetHttpRouteFormatter(), + Mock.Of(), headersReader, RequestMetadataContext), new List { testEnricher }, options), @@ -676,6 +676,7 @@ public async Task HttpLoggingHandler_WithEnrichers_CallsEnrichMethodExactlyOnce( new HttpRequestReader( options, GetHttpRouteFormatter(), + Mock.Of(), new HttpHeadersReader(options.ToOptionsMonitor(), mockHeadersRedactor.Object), RequestMetadataContext), new List { enricher1.Object, enricher2.Object }, @@ -718,6 +719,7 @@ public async Task HttpLoggingHandler_WithEnrichersAndLogRequestStart_CallsEnrich new HttpRequestReader( options, GetHttpRouteFormatter(), + Mock.Of(), new HttpHeadersReader(options.ToOptionsMonitor(), mockHeadersRedactor.Object), RequestMetadataContext), new List { enricher1.Object, enricher2.Object }, @@ -754,7 +756,7 @@ public async Task HttpLoggingHandler_WithEnrichers_OneEnricherThrows_LogsEnrichm var fakeLogger = new FakeLogger(); var options = new LoggingOptions(); var headersReader = new HttpHeadersReader(options.ToOptionsMonitor(), Mock.Of()); - var requestReader = new HttpRequestReader(options, GetHttpRouteFormatter(), headersReader, RequestMetadataContext); + var requestReader = new HttpRequestReader(options, GetHttpRouteFormatter(), Mock.Of(), headersReader, RequestMetadataContext); var enrichers = new List { enricher1.Object, enricher2.Object }; using var handler = new TestLoggingHandler( @@ -886,8 +888,7 @@ public async Task HttpLoggingHandler_AllOptionsTransferEncodingChunked_LogsOutgo BodyReadTimeout = TimeSpan.FromMinutes(5), RequestPathLoggingMode = OutgoingPathLoggingMode.Structured, LogRequestStart = false, - LogBody = true, - RouteParameterDataClasses = { { "userId", FakeTaxonomy.PrivateData } }, + LogBody = true }; var fakeLogger = new FakeLogger(new FakeLogCollector(Options.Options.Create(new FakeLogCollectorOptions()))); @@ -903,6 +904,7 @@ public async Task HttpLoggingHandler_AllOptionsTransferEncodingChunked_LogsOutgo new HttpRequestReader( options, GetHttpRouteFormatter(), + Mock.Of(), headersReader, RequestMetadataContext), new List { testEnricher }, options), @@ -944,7 +946,7 @@ public async Task HttpLoggingHandler_OnDifferentHttpStatusCodes_LogsOutgoingRequ var options = new LoggingOptions(); var headersReader = new HttpHeadersReader(options.ToOptionsMonitor(), new Mock().Object); var requestReader = new HttpRequestReader( - options, GetHttpRouteFormatter(), headersReader, RequestMetadataContext); + options, GetHttpRouteFormatter(), Mock.Of(), headersReader, RequestMetadataContext); using var handler = new TestLoggingHandler( new HttpClientLogger(fakeLogger, requestReader, Array.Empty(), options), @@ -993,7 +995,7 @@ public void SyncMethods_ShouldThrow() var options = new LoggingOptions(); var headersReader = new HttpHeadersReader(options.ToOptionsMonitor(), Mock.Of()); var requestReader = new HttpRequestReader( - options, GetHttpRouteFormatter(), headersReader, RequestMetadataContext); + options, GetHttpRouteFormatter(), Mock.Of(), headersReader, RequestMetadataContext); var logger = new HttpClientLogger(new FakeLogger(), requestReader, Array.Empty(), options); using var httpRequestMessage = new HttpRequestMessage(); diff --git a/test/Libraries/Microsoft.Extensions.Http.Diagnostics.Tests/Logging/HttpRequestReaderTest.cs b/test/Libraries/Microsoft.Extensions.Http.Diagnostics.Tests/Logging/HttpRequestReaderTest.cs index cb3b5cabb2f..9baf3b6a2ff 100644 --- a/test/Libraries/Microsoft.Extensions.Http.Diagnostics.Tests/Logging/HttpRequestReaderTest.cs +++ b/test/Libraries/Microsoft.Extensions.Http.Diagnostics.Tests/Logging/HttpRequestReaderTest.cs @@ -3,8 +3,10 @@ using System; using System.Collections.Generic; +using System.Linq; using System.Net; using System.Net.Http; +using System.Net.Mime; using System.Text; using System.Threading; using System.Threading.Tasks; @@ -25,6 +27,7 @@ namespace Microsoft.Extensions.Http.Logging.Test; public class HttpRequestReaderTest { private const string Redacted = "REDACTED"; + private const string RequestedHost = "default-uri.com"; private readonly Fixture _fixture; @@ -38,14 +41,12 @@ public async Task ReadAsync_AllData_ReturnsLogRecord() { var requestContent = _fixture.Create(); var responseContent = _fixture.Create(); - var host = "default-uri.com"; - var plainTextMedia = "text/plain"; var header1 = new KeyValuePair("Header1", "Value1"); var header2 = new KeyValuePair("Header2", "Value2"); var header3 = new KeyValuePair("Header3", "Value3"); var expectedRecord = new LogRecord { - Host = host, + Host = RequestedHost, Method = HttpMethod.Post, Path = TelemetryConstants.Redacted, StatusCode = 200, @@ -59,8 +60,8 @@ public async Task ReadAsync_AllData_ReturnsLogRecord() { RequestHeadersDataClasses = new Dictionary { { header1.Key, FakeTaxonomy.PrivateData }, { header3.Key, FakeTaxonomy.PrivateData } }, ResponseHeadersDataClasses = new Dictionary { { header2.Key, FakeTaxonomy.PrivateData }, { header3.Key, FakeTaxonomy.PrivateData } }, - RequestBodyContentTypes = new HashSet { plainTextMedia }, - ResponseBodyContentTypes = new HashSet { plainTextMedia }, + RequestBodyContentTypes = new HashSet { MediaTypeNames.Text.Plain }, + ResponseBodyContentTypes = new HashSet { MediaTypeNames.Text.Plain }, BodyReadTimeout = TimeSpan.FromSeconds(100000), LogBody = true, }; @@ -74,7 +75,7 @@ public async Task ReadAsync_AllData_ReturnsLogRecord() using var serviceProvider = GetServiceProvider(headersReader, serviceKey); var reader = new HttpRequestReader(serviceProvider, options.ToOptionsMonitor(serviceKey), serviceProvider.GetRequiredService(), - RequestMetadataContext, serviceKey: serviceKey); + serviceProvider.GetRequiredService(), RequestMetadataContext, serviceKey: serviceKey); using var httpRequestMessage = new HttpRequestMessage { @@ -101,15 +102,7 @@ public async Task ReadAsync_AllData_ReturnsLogRecord() await reader.ReadRequestAsync(logRecord, httpRequestMessage, requestHeadersBuffer, CancellationToken.None).ConfigureAwait(false); await reader.ReadResponseAsync(logRecord, httpResponseMessage, responseHeadersBuffer, CancellationToken.None).ConfigureAwait(false); - logRecord.Should().BeEquivalentTo( - expectedRecord, - o => o - .Excluding(m => m.RequestBody) - .Excluding(m => m.ResponseBody) - .ComparingByMembers()); - - logRecord.RequestBody.Should().BeEquivalentTo(expectedRecord.RequestBody); - logRecord.ResponseBody.Should().BeEquivalentTo(expectedRecord.ResponseBody); + logRecord.Should().BeEquivalentTo(expectedRecord); } [Fact] @@ -144,7 +137,8 @@ public async Task ReadAsync_NoHost_ReturnsLogRecordWithoutHost() var headersReader = new HttpHeadersReader(options.ToOptionsMonitor(), mockHeadersRedactor.Object); using var serviceProvider = GetServiceProvider(headersReader); - var reader = new HttpRequestReader(serviceProvider, options.ToOptionsMonitor(), serviceProvider.GetRequiredService(), RequestMetadataContext); + var reader = new HttpRequestReader(serviceProvider, options.ToOptionsMonitor(), serviceProvider.GetRequiredService(), + serviceProvider.GetRequiredService(), RequestMetadataContext); using var httpRequestMessage = new HttpRequestMessage { @@ -165,15 +159,7 @@ public async Task ReadAsync_NoHost_ReturnsLogRecordWithoutHost() await reader.ReadRequestAsync(actualRecord, httpRequestMessage, requestHeadersBuffer, CancellationToken.None).ConfigureAwait(false); await reader.ReadResponseAsync(actualRecord, httpResponseMessage, responseHeadersBuffer, CancellationToken.None).ConfigureAwait(false); - actualRecord.Should().BeEquivalentTo( - expectedRecord, - o => o - .Excluding(m => m.RequestBody) - .Excluding(m => m.ResponseBody) - .ComparingByMembers()); - - actualRecord.RequestBody.Should().BeEquivalentTo(expectedRecord.RequestBody); - actualRecord.ResponseBody.Should().BeEquivalentTo(expectedRecord.ResponseBody); + actualRecord.Should().BeEquivalentTo(expectedRecord); } [Fact] @@ -181,14 +167,12 @@ public async Task ReadAsync_AllDataWithRequestMetadataSet_ReturnsLogRecord() { var requestContent = _fixture.Create(); var responseContent = _fixture.Create(); - var host = "default-uri.com"; - var plainTextMedia = "text/plain"; var header1 = new KeyValuePair("Header1", "Value1"); var header2 = new KeyValuePair("Header2", "Value2"); var expectedRecord = new LogRecord { - Host = host, + Host = RequestedHost, Method = HttpMethod.Post, Path = "foo/bar/123", StatusCode = 200, @@ -202,8 +186,8 @@ public async Task ReadAsync_AllDataWithRequestMetadataSet_ReturnsLogRecord() { RequestHeadersDataClasses = new Dictionary { { header1.Key, FakeTaxonomy.PrivateData } }, ResponseHeadersDataClasses = new Dictionary { { header2.Key, FakeTaxonomy.PrivateData } }, - RequestBodyContentTypes = new HashSet { plainTextMedia }, - ResponseBodyContentTypes = new HashSet { plainTextMedia }, + RequestBodyContentTypes = new HashSet { MediaTypeNames.Text.Plain }, + ResponseBodyContentTypes = new HashSet { MediaTypeNames.Text.Plain }, BodyReadTimeout = TimeSpan.FromSeconds(10), LogBody = true, }; @@ -217,7 +201,7 @@ public async Task ReadAsync_AllDataWithRequestMetadataSet_ReturnsLogRecord() using var serviceProvider = GetServiceProvider(headersReader); var reader = new HttpRequestReader(serviceProvider, opts.ToOptionsMonitor(), - serviceProvider.GetRequiredService(), RequestMetadataContext); + serviceProvider.GetRequiredService(), serviceProvider.GetRequiredService(), RequestMetadataContext); using var httpRequestMessage = new HttpRequestMessage { @@ -246,14 +230,7 @@ public async Task ReadAsync_AllDataWithRequestMetadataSet_ReturnsLogRecord() await reader.ReadRequestAsync(actualRecord, httpRequestMessage, requestHeadersBuffer, CancellationToken.None).ConfigureAwait(false); await reader.ReadResponseAsync(actualRecord, httpResponseMessage, responseHeadersBuffer, CancellationToken.None).ConfigureAwait(false); - actualRecord.Should().BeEquivalentTo( - expectedRecord, - o => o - .Excluding(m => m.RequestBody) - .Excluding(m => m.ResponseBody) - .ComparingByMembers()); - actualRecord.RequestBody.Should().BeEquivalentTo(expectedRecord.RequestBody); - actualRecord.ResponseBody.Should().BeEquivalentTo(expectedRecord.ResponseBody); + actualRecord.Should().BeEquivalentTo(expectedRecord); } [Fact] @@ -261,14 +238,12 @@ public async Task ReadAsync_FormatRequestPathDisabled_ReturnsLogRecordWithRoute( { var requestContent = _fixture.Create(); var responseContent = _fixture.Create(); - var host = "default-uri.com"; - var plainTextMedia = "text/plain"; var header1 = new KeyValuePair("Header1", "Value1"); var header2 = new KeyValuePair("Header2", "Value2"); var expectedRecord = new LogRecord { - Host = host, + Host = RequestedHost, Method = HttpMethod.Post, Path = "foo/bar/{userId}", StatusCode = 200, @@ -276,6 +251,7 @@ public async Task ReadAsync_FormatRequestPathDisabled_ReturnsLogRecordWithRoute( ResponseHeaders = [new("Header2", Redacted)], RequestBody = requestContent, ResponseBody = responseContent, + PathParametersCount = 1 }; var opts = new LoggingOptions @@ -284,8 +260,8 @@ public async Task ReadAsync_FormatRequestPathDisabled_ReturnsLogRecordWithRoute( LogBody = true, RequestHeadersDataClasses = new Dictionary { { header1.Key, FakeTaxonomy.PrivateData } }, ResponseHeadersDataClasses = new Dictionary { { header2.Key, FakeTaxonomy.PrivateData } }, - RequestBodyContentTypes = new HashSet { plainTextMedia }, - ResponseBodyContentTypes = new HashSet { plainTextMedia }, + RequestBodyContentTypes = new HashSet { MediaTypeNames.Text.Plain }, + ResponseBodyContentTypes = new HashSet { MediaTypeNames.Text.Plain }, BodyReadTimeout = TimeSpan.FromSeconds(10), RequestPathLoggingMode = OutgoingPathLoggingMode.Structured }; @@ -297,15 +273,15 @@ public async Task ReadAsync_FormatRequestPathDisabled_ReturnsLogRecordWithRoute( .Returns(Redacted); var headersReader = new HttpHeadersReader(opts.ToOptionsMonitor(), mockHeadersRedactor.Object); - using var serviceProvider = GetServiceProvider(headersReader); + using var serviceProvider = GetServiceProvider(headersReader, configureRedaction: x => x.RedactionFormat = Redacted); var reader = new HttpRequestReader(serviceProvider, opts.ToOptionsMonitor(), - serviceProvider.GetRequiredService(), RequestMetadataContext); + serviceProvider.GetRequiredService(), serviceProvider.GetRequiredService(), RequestMetadataContext); using var httpRequestMessage = new HttpRequestMessage { Method = HttpMethod.Post, - RequestUri = new Uri("http://default-uri.com/foo/bar/123"), + RequestUri = new Uri($"http://{RequestedHost}/foo/bar/123"), Content = new StringContent(requestContent, Encoding.UTF8), }; @@ -329,28 +305,22 @@ public async Task ReadAsync_FormatRequestPathDisabled_ReturnsLogRecordWithRoute( await reader.ReadRequestAsync(actualRecord, httpRequestMessage, requestHeadersBuffer, CancellationToken.None).ConfigureAwait(false); await reader.ReadResponseAsync(actualRecord, httpResponseMessage, responseHeadersBuffer, CancellationToken.None).ConfigureAwait(false); - actualRecord.Should().BeEquivalentTo( - expectedRecord, - o => o - .Excluding(m => m.RequestBody) - .Excluding(m => m.ResponseBody) - .ComparingByMembers()); - actualRecord.RequestBody.Should().BeEquivalentTo(expectedRecord.RequestBody); - actualRecord.ResponseBody.Should().BeEquivalentTo(expectedRecord.ResponseBody); + actualRecord.Should().BeEquivalentTo(expectedRecord, o => o.Excluding(x => x.PathParameters)); + + HttpRouteParameter[] expectedParameters = [new("userId", Redacted, true)]; + actualRecord.PathParameters.Should().NotBeNull().And.Subject.Take(actualRecord.PathParametersCount).Should().BeEquivalentTo(expectedParameters); } [Fact] public async Task ReadAsync_RouteParameterRedactionModeNone_ReturnsLogRecordWithUnredactedRoute() { var requestContent = _fixture.Create(); - var host = "default-uri.com"; - var plainTextMedia = "text/plain"; var header1 = new KeyValuePair("Header1", "Value1"); var header2 = new KeyValuePair("Header2", "Value2"); var expectedRecord = new LogRecord { - Host = host, + Host = RequestedHost, Method = HttpMethod.Post, Path = "/foo/bar/123", RequestHeaders = [new("Header1", Redacted)], @@ -363,7 +333,7 @@ public async Task ReadAsync_RouteParameterRedactionModeNone_ReturnsLogRecordWith LogBody = true, RequestPathParameterRedactionMode = HttpRouteParameterRedactionMode.None, RequestHeadersDataClasses = new Dictionary { { header1.Key, FakeTaxonomy.PrivateData } }, - RequestBodyContentTypes = new HashSet { plainTextMedia }, + RequestBodyContentTypes = new HashSet { MediaTypeNames.Text.Plain }, BodyReadTimeout = TimeSpan.FromSeconds(10), RequestPathLoggingMode = OutgoingPathLoggingMode.Structured }; @@ -378,7 +348,7 @@ public async Task ReadAsync_RouteParameterRedactionModeNone_ReturnsLogRecordWith using var serviceProvider = GetServiceProvider(headersReader); var reader = new HttpRequestReader(serviceProvider, opts.ToOptionsMonitor(), - serviceProvider.GetRequiredService(), RequestMetadataContext); + serviceProvider.GetRequiredService(), serviceProvider.GetRequiredService(), RequestMetadataContext); using var httpRequestMessage = new HttpRequestMessage { @@ -394,12 +364,7 @@ public async Task ReadAsync_RouteParameterRedactionModeNone_ReturnsLogRecordWith var actualRecord = new LogRecord(); await reader.ReadRequestAsync(actualRecord, httpRequestMessage, requestHeadersBuffer, CancellationToken.None).ConfigureAwait(false); - actualRecord.Should().BeEquivalentTo( - expectedRecord, - o => o - .Excluding(m => m.RequestBody) - .Excluding(m => m.ResponseBody) - .ComparingByMembers()); + actualRecord.Should().BeEquivalentTo(expectedRecord); } [Fact] @@ -407,14 +372,12 @@ public async Task ReadAsync_RequestMetadataRequestNameSetAndRouteMissing_Returns { var requestContent = _fixture.Create(); var responseContent = _fixture.Create(); - var host = "default-uri.com"; - var plainTextMedia = "text/plain"; var header1 = new KeyValuePair("Header1", "Value1"); var header2 = new KeyValuePair("Header2", "Value2"); var expectedRecord = new LogRecord { - Host = host, + Host = RequestedHost, Method = HttpMethod.Post, Path = "TestRequest", StatusCode = 200, @@ -428,8 +391,8 @@ public async Task ReadAsync_RequestMetadataRequestNameSetAndRouteMissing_Returns { RequestHeadersDataClasses = new Dictionary { { header1.Key, FakeTaxonomy.PrivateData } }, ResponseHeadersDataClasses = new Dictionary { { header2.Key, FakeTaxonomy.PrivateData } }, - RequestBodyContentTypes = new HashSet { plainTextMedia }, - ResponseBodyContentTypes = new HashSet { plainTextMedia }, + RequestBodyContentTypes = new HashSet { MediaTypeNames.Text.Plain }, + ResponseBodyContentTypes = new HashSet { MediaTypeNames.Text.Plain }, BodyReadTimeout = TimeSpan.FromSeconds(10), LogBody = true, }; @@ -443,7 +406,7 @@ public async Task ReadAsync_RequestMetadataRequestNameSetAndRouteMissing_Returns using var serviceProvider = GetServiceProvider(headersReader); var reader = new HttpRequestReader(serviceProvider, opts.ToOptionsMonitor(), - serviceProvider.GetRequiredService(), RequestMetadataContext); + serviceProvider.GetRequiredService(), serviceProvider.GetRequiredService(), RequestMetadataContext); using var httpRequestMessage = new HttpRequestMessage { @@ -472,15 +435,7 @@ public async Task ReadAsync_RequestMetadataRequestNameSetAndRouteMissing_Returns await reader.ReadRequestAsync(actualRecord, httpRequestMessage, requestHeadersBuffer, CancellationToken.None).ConfigureAwait(false); await reader.ReadResponseAsync(actualRecord, httpResponseMessage, responseHeadersBuffer, CancellationToken.None).ConfigureAwait(false); - actualRecord.Should().BeEquivalentTo( - expectedRecord, - o => o - .Excluding(m => m.RequestBody) - .Excluding(m => m.ResponseBody) - .ComparingByMembers()); - - actualRecord.RequestBody.Should().BeEquivalentTo(expectedRecord.RequestBody); - actualRecord.ResponseBody.Should().BeEquivalentTo(expectedRecord.ResponseBody); + actualRecord.Should().BeEquivalentTo(expectedRecord); } [Fact] @@ -488,14 +443,12 @@ public async Task ReadAsync_NoMetadataUsesRedactedString_ReturnsLogRecord() { var requestContent = _fixture.Create(); var responseContent = _fixture.Create(); - var host = "default-uri.com"; - var plainTextMedia = "text/plain"; var header1 = new KeyValuePair("Header1", "Value1"); var header2 = new KeyValuePair("Header2", "Value2"); var expectedRecord = new LogRecord { - Host = host, + Host = RequestedHost, Method = HttpMethod.Post, Path = TelemetryConstants.Redacted, StatusCode = 200, @@ -509,8 +462,8 @@ public async Task ReadAsync_NoMetadataUsesRedactedString_ReturnsLogRecord() { RequestHeadersDataClasses = new Dictionary { { header1.Key, FakeTaxonomy.PrivateData } }, ResponseHeadersDataClasses = new Dictionary { { header2.Key, FakeTaxonomy.PrivateData } }, - RequestBodyContentTypes = new HashSet { plainTextMedia }, - ResponseBodyContentTypes = new HashSet { plainTextMedia }, + RequestBodyContentTypes = new HashSet { MediaTypeNames.Text.Plain }, + ResponseBodyContentTypes = new HashSet { MediaTypeNames.Text.Plain }, BodyReadTimeout = TimeSpan.FromSeconds(10), LogBody = true, }; @@ -524,7 +477,7 @@ public async Task ReadAsync_NoMetadataUsesRedactedString_ReturnsLogRecord() using var serviceProvider = GetServiceProvider(headersReader); var reader = new HttpRequestReader(serviceProvider, opts.ToOptionsMonitor(), - serviceProvider.GetRequiredService(), RequestMetadataContext); + serviceProvider.GetRequiredService(), serviceProvider.GetRequiredService(), RequestMetadataContext); using var httpRequestMessage = new HttpRequestMessage { @@ -549,14 +502,7 @@ public async Task ReadAsync_NoMetadataUsesRedactedString_ReturnsLogRecord() await reader.ReadRequestAsync(actualRecord, httpRequestMessage, requestHeadersBuffer, CancellationToken.None).ConfigureAwait(false); await reader.ReadResponseAsync(actualRecord, httpResponseMessage, responseHeadersBuffer, CancellationToken.None).ConfigureAwait(false); - actualRecord.Should().BeEquivalentTo( - expectedRecord, - o => o - .Excluding(m => m.RequestBody) - .Excluding(m => m.ResponseBody) - .ComparingByMembers()); - actualRecord.RequestBody.Should().BeEquivalentTo(expectedRecord.RequestBody); - actualRecord.ResponseBody.Should().BeEquivalentTo(expectedRecord.ResponseBody); + actualRecord.Should().BeEquivalentTo(expectedRecord); } [Fact] @@ -564,14 +510,12 @@ public async Task ReadAsync_MetadataWithoutRequestRouteOrNameUsesConstants_Retur { var requestContent = _fixture.Create(); var responseContent = _fixture.Create(); - var host = "default-uri.com"; - var plainTextMedia = "text/plain"; var header1 = new KeyValuePair("Header1", "Value1"); var header2 = new KeyValuePair("Header2", "Value2"); var expectedRecord = new LogRecord { - Host = host, + Host = RequestedHost, Method = HttpMethod.Post, Path = TelemetryConstants.Unknown, StatusCode = 200, @@ -585,8 +529,8 @@ public async Task ReadAsync_MetadataWithoutRequestRouteOrNameUsesConstants_Retur { RequestHeadersDataClasses = new Dictionary { { header1.Key, FakeTaxonomy.PrivateData } }, ResponseHeadersDataClasses = new Dictionary { { header2.Key, FakeTaxonomy.PrivateData } }, - RequestBodyContentTypes = new HashSet { plainTextMedia }, - ResponseBodyContentTypes = new HashSet { plainTextMedia }, + RequestBodyContentTypes = new HashSet { MediaTypeNames.Text.Plain }, + ResponseBodyContentTypes = new HashSet { MediaTypeNames.Text.Plain }, BodyReadTimeout = TimeSpan.FromSeconds(10), LogBody = true, }; @@ -600,7 +544,7 @@ public async Task ReadAsync_MetadataWithoutRequestRouteOrNameUsesConstants_Retur using var serviceProvider = GetServiceProvider(headersReader); var reader = new HttpRequestReader(serviceProvider, opts.ToOptionsMonitor(), - serviceProvider.GetRequiredService(), RequestMetadataContext); + serviceProvider.GetRequiredService(), serviceProvider.GetRequiredService(), RequestMetadataContext); using var httpRequestMessage = new HttpRequestMessage { @@ -626,18 +570,13 @@ public async Task ReadAsync_MetadataWithoutRequestRouteOrNameUsesConstants_Retur await reader.ReadRequestAsync(actualRecord, httpRequestMessage, requestHeadersBuffer, CancellationToken.None).ConfigureAwait(false); await reader.ReadResponseAsync(actualRecord, httpResponseMessage, responseHeadersBuffer, CancellationToken.None).ConfigureAwait(false); - actualRecord.Should().BeEquivalentTo( - expectedRecord, - o => o - .Excluding(m => m.RequestBody) - .Excluding(m => m.ResponseBody) - .ComparingByMembers()); - - actualRecord.RequestBody.Should().BeEquivalentTo(expectedRecord.RequestBody); - actualRecord.ResponseBody.Should().BeEquivalentTo(expectedRecord.ResponseBody); + actualRecord.Should().BeEquivalentTo(expectedRecord); } - private static ServiceProvider GetServiceProvider(HttpHeadersReader headersReader, string? serviceKey = null) + private static ServiceProvider GetServiceProvider( + HttpHeadersReader headersReader, + string? serviceKey = null, + Action? configureRedaction = null) { var services = new ServiceCollection(); if (serviceKey is null) @@ -650,7 +589,7 @@ private static ServiceProvider GetServiceProvider(HttpHeadersReader headersReade } return services - .AddFakeRedaction() + .AddFakeRedaction(configureRedaction ?? (_ => { })) .AddHttpRouteProcessor() .BuildServiceProvider(); } From bd8f28ab244b884c2af91b670fefa13639c3f761 Mon Sep 17 00:00:00 2001 From: Martin Taillefer Date: Wed, 3 Jan 2024 05:09:46 -0800 Subject: [PATCH 123/172] Leverage an existing Roslyn API instead of rolling my own inferior version (#4850) Co-authored-by: Martin Taillefer --- .../Microsoft.Gen.Logging/Parsing/Parser.cs | 4 +-- src/Generators/Shared/SymbolHelpers.cs | 36 ------------------- 2 files changed, 2 insertions(+), 38 deletions(-) diff --git a/src/Generators/Microsoft.Gen.Logging/Parsing/Parser.cs b/src/Generators/Microsoft.Gen.Logging/Parsing/Parser.cs index 00b2f2b2efa..840e86abb83 100644 --- a/src/Generators/Microsoft.Gen.Logging/Parsing/Parser.cs +++ b/src/Generators/Microsoft.Gen.Logging/Parsing/Parser.cs @@ -658,7 +658,7 @@ private void CheckTagNamesAreUnique(LoggingMethod lm, Dictionary - /// Can code in a given type access a given member? - /// - /// - /// Note that this implementation assumes that the target member is within the origin type - /// or a base class of the origin type. - /// - public static bool CanAccess(this INamedTypeSymbol originType, ISymbol targetMember) - { - if (SymbolEqualityComparer.Default.Equals(originType, targetMember.ContainingType)) - { - // target member is from the origin type, we're good - return true; - } - - if (targetMember.DeclaredAccessibility == Accessibility.Private) - { - // can't access a private member from a different type - return false; - } - - if (SymbolEqualityComparer.Default.Equals(originType.ContainingAssembly, targetMember.ContainingAssembly)) - { - // target member is in the same assembly as the origin type, so we're good - return true; - } - - if (targetMember.DeclaredAccessibility is Accessibility.Internal or Accessibility.ProtectedAndInternal) - { - // can't access internal members of other assemblies (sorry, we don't support IVT right now) - return false; - } - - return true; - } } From bff3814c8e025151088a24ff62f2d5df15695d3d Mon Sep 17 00:00:00 2001 From: Martin Taillefer Date: Wed, 3 Jan 2024 05:33:38 -0800 Subject: [PATCH 124/172] Improve support for [TagName] (#4851) - When using [TagName] to control the name of a logging tag, the expectation is that the logging message (if present) should be using the tag name instead of the parameter name. SO: ``` [LoggerMessage(1, LogLevel.Information, "My message {foo.bar}")] public static partial void Log(this ILogger logger, [TagName("foo.bar") string msg); ``` Fixes #4848 Co-authored-by: Martin Taillefer --- .../Emission/Emitter.Method.cs | 75 +++++++------------ .../Model/LoggingMethod.cs | 20 +++-- .../Model/LoggingMethodParameter.cs | 4 +- .../Microsoft.Gen.Logging/Parsing/Parser.cs | 14 ++-- ...plateExtractor.cs => TemplateProcessor.cs} | 58 +++++++++++--- .../Generated/LogMethodTests.cs | 5 ++ .../Generated/TagNameTests.cs | 15 +++- .../TestClasses/AtSymbolsTestExtensions.cs | 3 + .../TestClasses/TagNameExtensions.cs | 3 + .../Unit/LoggingMethodParameterTests.cs | 4 +- .../Unit/TemplatesExtractorTests.cs | 2 +- 11 files changed, 124 insertions(+), 79 deletions(-) rename src/Generators/Microsoft.Gen.Logging/Parsing/{TemplateExtractor.cs => TemplateProcessor.cs} (59%) diff --git a/src/Generators/Microsoft.Gen.Logging/Emission/Emitter.Method.cs b/src/Generators/Microsoft.Gen.Logging/Emission/Emitter.Method.cs index 33567379bf9..cfd8930233e 100644 --- a/src/Generators/Microsoft.Gen.Logging/Emission/Emitter.Method.cs +++ b/src/Generators/Microsoft.Gen.Logging/Emission/Emitter.Method.cs @@ -104,9 +104,19 @@ private void GenLogMethod(LoggingMethod lm) if (GenVariableAssignments(lm, lambdaStateName, numReservedUnclassifiedTags, numReservedClassifiedTags)) { - var template = EscapeMessageString(lm.Message); - template = AddAtSymbolsToTemplates(template, lm.Parameters); - OutLn($@"return global::System.FormattableString.Invariant(${template});"); + var mapped = Parsing.TemplateProcessor.MapTemplates(lm.Message, t => + { + var p = lm.GetParameterForTemplate(t); + if (p != null) + { + return p.ParameterNameWithAtIfNeeded; + } + + return t; + }); + + var s = EscapeMessageString(mapped!); + OutLn($@"return global::System.FormattableString.Invariant(${s});"); } else if (string.IsNullOrEmpty(lm.Message)) { @@ -294,14 +304,14 @@ void GenTagWrites(LoggingMethod lm, string stateName, out int numReservedUnclass if (p.IsEnumerable) { value = p.PotentiallyNull - ? $"{p.ParameterNameWithAt} != null ? {LoggerMessageHelperType}.Stringify({p.ParameterNameWithAt}) : null" - : $"{LoggerMessageHelperType}.Stringify({p.ParameterNameWithAt})"; + ? $"{p.ParameterNameWithAtIfNeeded} != null ? {LoggerMessageHelperType}.Stringify({p.ParameterNameWithAtIfNeeded}) : null" + : $"{LoggerMessageHelperType}.Stringify({p.ParameterNameWithAtIfNeeded})"; } else { value = ShouldStringifyParameter(p) - ? ConvertParameterToString(p, p.ParameterNameWithAt) - : p.ParameterNameWithAt; + ? ConvertParameterToString(p, p.ParameterNameWithAtIfNeeded) + : p.ParameterNameWithAtIfNeeded; } OutLn($"{stateName}.TagArray[{--count}] = new({key}, {value});"); @@ -352,8 +362,8 @@ void GenTagWrites(LoggingMethod lm, string stateName, out int numReservedUnclass var classification = MakeClassificationValue(p.ClassificationAttributeTypes); var value = ShouldStringifyParameter(p) - ? ConvertParameterToString(p, p.ParameterNameWithAt) - : p.ParameterNameWithAt; + ? ConvertParameterToString(p, p.ParameterNameWithAtIfNeeded) + : p.ParameterNameWithAtIfNeeded; OutLn($"{stateName}.ClassifiedTagArray[{--count}] = new({key}, {value}, {classification});"); } @@ -469,10 +479,10 @@ void GenTagWrites(LoggingMethod lm, string stateName, out int numReservedUnclass } else { - OutLn($"{stateName}.TagNamePrefix = nameof({p.ParameterNameWithAt});"); + OutLn($"{stateName}.TagNamePrefix = nameof({p.ParameterNameWithAtIfNeeded});"); } - OutLn($"{p.TagProvider!.ContainingType}.{p.TagProvider.MethodName}({stateName}, {p.ParameterNameWithAt});"); + OutLn($"{p.TagProvider!.ContainingType}.{p.TagProvider.MethodName}({stateName}, {p.ParameterNameWithAtIfNeeded});"); } } } @@ -495,11 +505,11 @@ bool GenVariableAssignments(LoggingMethod lm, string lambdaStateName, int numRes if (p.PotentiallyNull) { const string Null = "\"(null)\""; - OutLn($"var {atSign}{t} = {lambdaStateName}.TagArray[{index}].Value ?? {Null};"); + OutLn($"var {atSign}{p.ParameterName} = {lambdaStateName}.TagArray[{index}].Value ?? {Null};"); } else { - OutLn($"var {atSign}{t} = {lambdaStateName}.TagArray[{index}].Value;"); + OutLn($"var {atSign}{p.ParameterName} = {lambdaStateName}.TagArray[{index}].Value;"); } generatedAssignments = true; @@ -524,11 +534,11 @@ bool GenVariableAssignments(LoggingMethod lm, string lambdaStateName, int numRes if (p.PotentiallyNull) { const string Null = "\"(null)\""; - OutLn($"var {atSign}{t} = {lambdaStateName}.RedactedTagArray[{index}].Value ?? {Null};"); + OutLn($"var {atSign}{p.ParameterName} = {lambdaStateName}.RedactedTagArray[{index}].Value ?? {Null};"); } else { - OutLn($"var {atSign}{t} = {lambdaStateName}.RedactedTagArray[{index}].Value;"); + OutLn($"var {atSign}{p.ParameterName} = {lambdaStateName}.RedactedTagArray[{index}].Value;"); } generatedAssignments = true; @@ -585,47 +595,16 @@ private string MakeClassificationValue(HashSet classificationTypes) return sb.ToString(); } - private string AddAtSymbolsToTemplates(string template, IEnumerable parameters) - { - StringBuilder? stringBuilder = null; - foreach (var item in parameters.Where(p => p.UsedAsTemplate)) - { - if (!item.NeedsAtSign) - { - continue; - } - - if (stringBuilder is null) - { - stringBuilder = _sbPool.GetStringBuilder(); - _ = stringBuilder.Append(template); - } - - _ = stringBuilder.Replace(item.ParameterName, item.ParameterNameWithAt); - } - - var result = stringBuilder is null - ? template - : stringBuilder.ToString(); - - if (stringBuilder != null) - { - _sbPool.ReturnStringBuilder(stringBuilder); - } - - return result; - } - private void GenParameters(LoggingMethod lm) { OutEnumeration(lm.Parameters.Select(static p => { if (p.Qualifier != null) { - return $"{p.Qualifier} {p.Type} {p.ParameterNameWithAt}"; + return $"{p.Qualifier} {p.Type} {p.ParameterNameWithAtIfNeeded}"; } - return $"{p.Type} {p.ParameterNameWithAt}"; + return $"{p.Type} {p.ParameterNameWithAtIfNeeded}"; })); } diff --git a/src/Generators/Microsoft.Gen.Logging/Model/LoggingMethod.cs b/src/Generators/Microsoft.Gen.Logging/Model/LoggingMethod.cs index 1c200d064a5..f22f1524f50 100644 --- a/src/Generators/Microsoft.Gen.Logging/Model/LoggingMethod.cs +++ b/src/Generators/Microsoft.Gen.Logging/Model/LoggingMethod.cs @@ -33,7 +33,7 @@ internal sealed class LoggingMethod { foreach (var p in Parameters) { - if (templateName.Equals(p.ParameterName, StringComparison.OrdinalIgnoreCase)) + if (templateName.Equals(p.TagName, StringComparison.OrdinalIgnoreCase)) { return p; } @@ -43,14 +43,11 @@ internal sealed class LoggingMethod } public List GetTemplatesForParameter(LoggingMethodParameter lp) - => GetTemplatesForParameter(lp.ParameterName); - - public List GetTemplatesForParameter(string parameterName) { HashSet templates = []; foreach (var t in Templates) { - if (parameterName.Equals(t, StringComparison.OrdinalIgnoreCase)) + if (lp.TagName.Equals(t, StringComparison.OrdinalIgnoreCase)) { _ = templates.Add(t); } @@ -58,4 +55,17 @@ public List GetTemplatesForParameter(string parameterName) return templates.ToList(); } + + public List GetTemplatesForParameter(string parameterName) + { + foreach (var p in Parameters) + { + if (parameterName == p.ParameterName) + { + return GetTemplatesForParameter(p); + } + } + + return []; + } } diff --git a/src/Generators/Microsoft.Gen.Logging/Model/LoggingMethodParameter.cs b/src/Generators/Microsoft.Gen.Logging/Model/LoggingMethodParameter.cs index 80021aba766..7f90823e9a4 100644 --- a/src/Generators/Microsoft.Gen.Logging/Model/LoggingMethodParameter.cs +++ b/src/Generators/Microsoft.Gen.Logging/Model/LoggingMethodParameter.cs @@ -10,7 +10,7 @@ namespace Microsoft.Gen.Logging.Model; /// /// A single parameter to a logger method. /// -[DebuggerDisplay("{Name}")] +[DebuggerDisplay("{ParameterName}")] internal sealed class LoggingMethodParameter { public string ParameterName = string.Empty; @@ -35,7 +35,7 @@ internal sealed class LoggingMethodParameter public List Properties = []; public TagProvider? TagProvider; - public string ParameterNameWithAt => NeedsAtSign ? "@" + ParameterName : ParameterName; + public string ParameterNameWithAtIfNeeded => NeedsAtSign ? "@" + ParameterName : ParameterName; public string PotentiallyNullableType => (IsReference && !IsNullable) diff --git a/src/Generators/Microsoft.Gen.Logging/Parsing/Parser.cs b/src/Generators/Microsoft.Gen.Logging/Parsing/Parser.cs index 840e86abb83..a292249f612 100644 --- a/src/Generators/Microsoft.Gen.Logging/Parsing/Parser.cs +++ b/src/Generators/Microsoft.Gen.Logging/Parsing/Parser.cs @@ -152,7 +152,7 @@ public IReadOnlyList GetLogTypes(IEnumerable bool parameterInTemplate = false; foreach (var t in lm.Templates) { - if (lp.ParameterName.Equals(t, StringComparison.OrdinalIgnoreCase)) + if (lp.TagName.Equals(t, StringComparison.OrdinalIgnoreCase)) { parameterInTemplate = true; break; @@ -273,9 +273,10 @@ public IReadOnlyList GetLogTypes(IEnumerable bool found = false; foreach (var p in lm.Parameters) { - if (t.Equals(p.ParameterName, StringComparison.OrdinalIgnoreCase)) + if (t.Equals(p.TagName, StringComparison.OrdinalIgnoreCase)) { found = true; + p.TagName = t; break; } } @@ -398,7 +399,7 @@ static bool IsAllowedKind(SyntaxKind kind) => keepMethod = false; } - TemplateExtractor.ExtractTemplates(message, lm.Templates); + TemplateProcessor.ExtractTemplates(message, lm.Templates); #pragma warning disable EA0003 // Use the character-based overloads of 'String.StartsWith' or 'String.EndsWith' var templatesWithAtSymbol = lm.Templates.Where(x => x.StartsWith("@", StringComparison.Ordinal)).ToArray(); @@ -522,12 +523,9 @@ private void CheckTagNamesAreUnique(LoggingMethod lm, Dictionary templates) if (closeBraceIndex == endIndex) { - scanIndex = endIndex; + return; } - else - { - // Format item syntax : { index[,alignment][ :formatString] }. - var formatDelimiterIndex = FindIndexOfAny(message, _formatDelimiters, openBraceIndex, closeBraceIndex); - var templateName = message.Substring(openBraceIndex + 1, formatDelimiterIndex - openBraceIndex - 1).Trim(); - templates.Add(templateName); - scanIndex = closeBraceIndex + 1; + // Format item syntax : { index[,alignment][ :formatString] }. + var formatDelimiterIndex = FindIndexOfAny(message, _formatDelimiters, openBraceIndex, closeBraceIndex); + + var templateName = message.Substring(openBraceIndex + 1, formatDelimiterIndex - openBraceIndex - 1).Trim(); + templates.Add(templateName); + scanIndex = closeBraceIndex + 1; + } + } + + /// + /// Allows replacing individual template arguments with different strings. + /// + internal static string? MapTemplates(string? message, Func mapTemplate) + { + if (string.IsNullOrEmpty(message)) + { + return message; + } + + var sb = new StringBuilder(); + + var scanIndex = 0; + var endIndex = message!.Length; + while (scanIndex < endIndex) + { + var openBraceIndex = FindBraceIndex(message, '{', scanIndex, endIndex); + var closeBraceIndex = FindBraceIndex(message, '}', openBraceIndex, endIndex); + + if (closeBraceIndex == endIndex) + { + break; } + + // Format item syntax : { index[,alignment][ :formatString] }. + var formatDelimiterIndex = FindIndexOfAny(message, _formatDelimiters, openBraceIndex, closeBraceIndex); + + var templateName = message.Substring(openBraceIndex + 1, formatDelimiterIndex - openBraceIndex - 1).Trim(); + var mapped = mapTemplate(templateName); + + _ = sb.Append(message, scanIndex, openBraceIndex - scanIndex + 1); + _ = sb.Append(mapped); + _ = sb.Append(message, formatDelimiterIndex, closeBraceIndex - formatDelimiterIndex + 1); + + scanIndex = closeBraceIndex + 1; } + + _ = sb.Append(message, scanIndex, message.Length - scanIndex); + return sb.ToString(); } internal static int FindIndexOfAny(string message, char[] chars, int startIndex, int endIndex) diff --git a/test/Generators/Microsoft.Gen.Logging/Generated/LogMethodTests.cs b/test/Generators/Microsoft.Gen.Logging/Generated/LogMethodTests.cs index 2753fcc9a2b..b4b3e14229f 100644 --- a/test/Generators/Microsoft.Gen.Logging/Generated/LogMethodTests.cs +++ b/test/Generators/Microsoft.Gen.Logging/Generated/LogMethodTests.cs @@ -756,6 +756,11 @@ public void AtSymbolsTest() collector.Clear(); AtSymbolsTestExtensions.M5(logger, LogLevel.Debug, o); Assert.Equal("42", collector.LatestRecord.StructuredState!.GetValue("class")); + + collector.Clear(); + AtSymbolsTestExtensions.M6(logger, "42"); + Assert.Equal("42", collector.LatestRecord.StructuredState!.GetValue("class")); + Assert.Equal("M6 class 42", collector.LatestRecord.Message); } [Fact] diff --git a/test/Generators/Microsoft.Gen.Logging/Generated/TagNameTests.cs b/test/Generators/Microsoft.Gen.Logging/Generated/TagNameTests.cs index fd9c5f6cba2..59acbfae502 100644 --- a/test/Generators/Microsoft.Gen.Logging/Generated/TagNameTests.cs +++ b/test/Generators/Microsoft.Gen.Logging/Generated/TagNameTests.cs @@ -17,12 +17,19 @@ public void Basic() var logger = new FakeLogger(); TagNameExtensions.M0(logger, 0); - - var expectedState = new Dictionary + logger.Collector.LatestRecord.StructuredState.Should().NotBeNull().And.Equal(new Dictionary { ["TN1"] = "0", - }; + }); + + logger.Collector.Clear(); + TagNameExtensions.M1(logger, 0); + logger.Collector.LatestRecord.StructuredState.Should().NotBeNull().And.Equal(new Dictionary + { + ["foo.bar"] = "0", + ["{OriginalFormat}"] = "{foo.bar}", + }); - logger.Collector.LatestRecord.StructuredState.Should().NotBeNull().And.Equal(expectedState); + Assert.Equal("0", logger.Collector.LatestRecord.Message); } } diff --git a/test/Generators/Microsoft.Gen.Logging/TestClasses/AtSymbolsTestExtensions.cs b/test/Generators/Microsoft.Gen.Logging/TestClasses/AtSymbolsTestExtensions.cs index fe3e1e19edb..c3779cae8b2 100644 --- a/test/Generators/Microsoft.Gen.Logging/TestClasses/AtSymbolsTestExtensions.cs +++ b/test/Generators/Microsoft.Gen.Logging/TestClasses/AtSymbolsTestExtensions.cs @@ -32,5 +32,8 @@ public class SpecialNames [LoggerMessage("M5")] internal static partial void M5(ILogger logger, LogLevel level, [LogProperties(OmitReferenceName = true)] SpecialNames @event); + + [LoggerMessage(LogLevel.Information, "M6 class {class}")] + internal static partial void M6(ILogger logger, string @class); } } diff --git a/test/Generators/Microsoft.Gen.Logging/TestClasses/TagNameExtensions.cs b/test/Generators/Microsoft.Gen.Logging/TestClasses/TagNameExtensions.cs index d1d4329041e..7e4e7d3b944 100644 --- a/test/Generators/Microsoft.Gen.Logging/TestClasses/TagNameExtensions.cs +++ b/test/Generators/Microsoft.Gen.Logging/TestClasses/TagNameExtensions.cs @@ -9,5 +9,8 @@ internal static partial class TagNameExtensions { [LoggerMessage(LogLevel.Warning)] internal static partial void M0(ILogger logger, [TagName("TN1")] int p0); + + [LoggerMessage(LogLevel.Warning, Message = "{foo.bar}")] + internal static partial void M1(ILogger logger, [TagName("foo.bar")] int p0); } } diff --git a/test/Generators/Microsoft.Gen.Logging/Unit/LoggingMethodParameterTests.cs b/test/Generators/Microsoft.Gen.Logging/Unit/LoggingMethodParameterTests.cs index 1820f402246..bd80498dfb8 100644 --- a/test/Generators/Microsoft.Gen.Logging/Unit/LoggingMethodParameterTests.cs +++ b/test/Generators/Microsoft.Gen.Logging/Unit/LoggingMethodParameterTests.cs @@ -61,9 +61,9 @@ public void Misc() NeedsAtSign = false, }; - Assert.Equal(lp.ParameterName, lp.ParameterNameWithAt); + Assert.Equal(lp.ParameterName, lp.ParameterNameWithAtIfNeeded); lp.NeedsAtSign = true; - Assert.Equal("@" + lp.ParameterName, lp.ParameterNameWithAt); + Assert.Equal("@" + lp.ParameterName, lp.ParameterNameWithAtIfNeeded); lp.Type = "Foo"; lp.IsReference = false; diff --git a/test/Generators/Microsoft.Gen.Logging/Unit/TemplatesExtractorTests.cs b/test/Generators/Microsoft.Gen.Logging/Unit/TemplatesExtractorTests.cs index 764ca243b79..ec049596764 100644 --- a/test/Generators/Microsoft.Gen.Logging/Unit/TemplatesExtractorTests.cs +++ b/test/Generators/Microsoft.Gen.Logging/Unit/TemplatesExtractorTests.cs @@ -17,7 +17,7 @@ public class TemplatesExtractorTests [InlineData("NewLine \n Test", 8)] public void Should_FindIndexOfAny_Correctly(string message, int expectedResult) { - var result = TemplateExtractor.FindIndexOfAny(message, new[] { '\n', 'a', 'b', 'z' }, 0, message.Length); + var result = TemplateProcessor.FindIndexOfAny(message, new[] { '\n', 'a', 'b', 'z' }, 0, message.Length); Assert.Equal(expectedResult, result); } } From 1e5ad82db35c057611f9743c2a40af074027ea2b Mon Sep 17 00:00:00 2001 From: Nikita Balabaev Date: Thu, 4 Jan 2024 14:44:22 +0100 Subject: [PATCH 125/172] Support content headers in HttpClient logging (#4842) * Support content headers in HttpClient logging * add benchmark * fix xUnit1030 * unblock the build --- .../Benchmarks/ErasingRedactorProvider.cs | 14 ++ .../Benchmarks/HeadersReaderBenchmark.cs | 107 +++++++++++++ .../HugeHttpCLientLoggingBenchmark.cs | 16 +- .../MediumHttpClientLoggingBenchmark.cs | 16 +- .../SmallHttpClientLoggingBenchmark.cs | 16 +- .../HttpClientFactory.cs | 24 +-- ...s.Http.Diagnostics.PerformanceTests.csproj | 3 +- .../NoRemoteCallHandler.cs | 5 +- .../Program.cs | 2 +- .../StaticOptionsMonitor.cs | 23 +++ .../templates/VerifyCoverageReport.yml | 1 + .../FakeRedactorProvider.cs | 2 +- .../Logging/Internal/HttpHeadersReader.cs | 59 ++++++- .../Logging/Internal/Log.cs | 147 +++++------------- .../Logging/LoggingOptions.cs | 15 ++ ...crosoft.Extensions.Http.Diagnostics.csproj | 5 +- .../Logging/AcceptanceTests.cs | 2 +- .../Logging/HttpHeadersReaderTest.cs | 74 ++++++++- ...s.cs => TelemetryCommonExtensionsTests.cs} | 2 +- 19 files changed, 362 insertions(+), 171 deletions(-) create mode 100644 bench/Libraries/Microsoft.Extensions.Http.Diagnostics.PerformanceTests/Benchmarks/ErasingRedactorProvider.cs create mode 100644 bench/Libraries/Microsoft.Extensions.Http.Diagnostics.PerformanceTests/Benchmarks/HeadersReaderBenchmark.cs create mode 100644 bench/Libraries/Microsoft.Extensions.Http.Diagnostics.PerformanceTests/StaticOptionsMonitor.cs rename test/Libraries/Microsoft.Extensions.Http.Diagnostics.Tests/{TelemetryCommonExtensions2Tests.cs => TelemetryCommonExtensionsTests.cs} (98%) diff --git a/bench/Libraries/Microsoft.Extensions.Http.Diagnostics.PerformanceTests/Benchmarks/ErasingRedactorProvider.cs b/bench/Libraries/Microsoft.Extensions.Http.Diagnostics.PerformanceTests/Benchmarks/ErasingRedactorProvider.cs new file mode 100644 index 00000000000..33045d4cda6 --- /dev/null +++ b/bench/Libraries/Microsoft.Extensions.Http.Diagnostics.PerformanceTests/Benchmarks/ErasingRedactorProvider.cs @@ -0,0 +1,14 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using Microsoft.Extensions.Compliance.Classification; +using Microsoft.Extensions.Compliance.Redaction; + +namespace Microsoft.Extensions.Http.Diagnostics.Bench.Benchmarks; + +internal sealed class ErasingRedactorProvider : IRedactorProvider +{ + public static ErasingRedactorProvider Instance { get; } = new(); + + public Redactor GetRedactor(DataClassificationSet classifications) => ErasingRedactor.Instance; +} diff --git a/bench/Libraries/Microsoft.Extensions.Http.Diagnostics.PerformanceTests/Benchmarks/HeadersReaderBenchmark.cs b/bench/Libraries/Microsoft.Extensions.Http.Diagnostics.PerformanceTests/Benchmarks/HeadersReaderBenchmark.cs new file mode 100644 index 00000000000..f13ec8500ce --- /dev/null +++ b/bench/Libraries/Microsoft.Extensions.Http.Diagnostics.PerformanceTests/Benchmarks/HeadersReaderBenchmark.cs @@ -0,0 +1,107 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System.Collections.Generic; +using System.Net.Http; +using BenchmarkDotNet.Attributes; +using Microsoft.Extensions.Compliance.Testing; +using Microsoft.Extensions.Http.Logging; +using Microsoft.Extensions.Http.Logging.Internal; +using Microsoft.Extensions.Telemetry.Internal; + +namespace Microsoft.Extensions.Http.Diagnostics.Bench.Benchmarks; + +public class HeadersReaderBenchmark +{ + private List> _outputBuffer = null!; + private HttpHeadersReader _headersReader = null!; + + [Params(0, 5, 15)] + public int HeadersCount { get; set; } + + // This one can't be 0, because in that case HttpRequestReader simply doesn't call HttpHeadersReader + [Params(1, 3, 5, 10)] + public int HeadersToLogCount { get; set; } + + [Params(false, true)] + public bool LogContentHeaders { get; set; } + + public HttpRequestMessage? Request { get; set; } + + [GlobalSetup] + public void Setup() + { + _outputBuffer = new(capacity: 10240); + Request = new HttpRequestMessage(HttpMethod.Post, "https://www.microsoft.com"); + for (var i = 0; i < HeadersCount; i++) + { + Request.Headers.Add($"Header{i}", $"Value{i}"); + } + + var options = new LoggingOptions { LogContentHeaders = LogContentHeaders }; + for (var i = 0; i < HeadersToLogCount; i++) + { + options.RequestHeadersDataClasses.Add($"Header{i}", FakeTaxonomy.PublicData); + } + + var redactor = new HttpHeadersRedactor(ErasingRedactorProvider.Instance); + _headersReader = new HttpHeadersReader(new StaticOptionsMonitor(options), redactor); + } + + [GlobalCleanup] + public void Cleanup() + { + Request?.Dispose(); + _outputBuffer.Clear(); + _outputBuffer = null!; + } + + [Benchmark] + public void HeadersReader() + { + _headersReader.ReadRequestHeaders(Request!, _outputBuffer); + } +} + +/* + + These results show comparison between a plain logic (when we enumerate over "headersToLog" dictionary), + and an updated logic when we choose the strategy based on the number of headers to read and the number of headers to log. + +BenchmarkDotNet=v0.13.5, OS=Windows 11 (10.0.22631.2861), VM=Hyper-V +Intel Xeon Platinum 8370C CPU 2.80GHz, 1 CPU, 16 logical and 8 physical cores +.NET SDK=8.0.100 + [Host] : .NET 8.0.0 (8.0.23.53103), X64 RyuJIT AVX2 + +Job=MediumRun Jit=RyuJit Platform=X64 +Runtime=.NET 8.0 Server=True Toolchain=InProcessEmitToolchain +IterationCount=15 LaunchCount=2 WarmupCount=10 + +| Method | HeadersCount | HeadersToLogCount | Mean | Error | StdDev | Gen0 | Allocated | +|----------------- |------------- |------------------ |-------------:|-----------:|-----------:|-------:|----------:| +| HeadersReaderNew | 0 | 1 | 4.372 ns | 0.0120 ns | 0.0175 ns | - | - | +| HeadersReaderNew | 0 | 5 | 4.459 ns | 0.0639 ns | 0.0916 ns | - | - | +| HeadersReaderNew | 0 | 3 | 4.648 ns | 0.2073 ns | 0.2972 ns | - | - | +| HeadersReaderNew | 0 | 10 | 4.995 ns | 0.4255 ns | 0.6369 ns | - | - | +| HeadersReaderOld | 0 | 1 | 18.607 ns | 0.0492 ns | 0.0689 ns | - | - | +| HeadersReaderOld | 0 | 3 | 41.269 ns | 0.0759 ns | 0.1088 ns | - | - | +| HeadersReaderOld | 0 | 5 | 63.525 ns | 0.1879 ns | 0.2572 ns | - | - | +| HeadersReaderOld | 0 | 10 | 119.163 ns | 0.6748 ns | 0.9678 ns | - | - | +| HeadersReaderOld | 15 | 1 | 204.099 ns | 1.3834 ns | 1.8936 ns | 0.0100 | 256 B | +| HeadersReaderOld | 5 | 1 | 205.044 ns | 1.7938 ns | 2.4553 ns | 0.0095 | 256 B | +| HeadersReaderNew | 15 | 1 | 216.454 ns | 1.1861 ns | 1.6236 ns | 0.0100 | 256 B | +| HeadersReaderNew | 5 | 1 | 217.499 ns | 1.5149 ns | 2.0736 ns | 0.0100 | 256 B | +| HeadersReaderOld | 5 | 3 | 630.982 ns | 4.4363 ns | 5.9224 ns | 0.0305 | 768 B | +| HeadersReaderOld | 15 | 3 | 641.780 ns | 4.4820 ns | 6.1351 ns | 0.0305 | 768 B | +| HeadersReaderNew | 15 | 3 | 669.542 ns | 3.6006 ns | 4.9285 ns | 0.0305 | 768 B | +| HeadersReaderNew | 5 | 3 | 677.061 ns | 3.8858 ns | 5.3190 ns | 0.0305 | 768 B | +| HeadersReaderNew | 5 | 10 | 981.974 ns | 9.8502 ns | 13.4831 ns | 0.0515 | 1336 B | +| HeadersReaderOld | 5 | 5 | 1,126.471 ns | 7.1361 ns | 9.7680 ns | 0.0496 | 1280 B | +| HeadersReaderOld | 15 | 5 | 1,134.430 ns | 6.2873 ns | 8.3934 ns | 0.0496 | 1280 B | +| HeadersReaderNew | 15 | 5 | 1,153.805 ns | 3.0554 ns | 4.1823 ns | 0.0496 | 1280 B | +| HeadersReaderNew | 5 | 5 | 1,164.717 ns | 9.8121 ns | 13.4310 ns | 0.0496 | 1280 B | +| HeadersReaderOld | 5 | 10 | 1,413.431 ns | 7.9666 ns | 10.9048 ns | 0.0496 | 1280 B | +| HeadersReaderOld | 15 | 10 | 2,489.613 ns | 19.0100 ns | 26.0211 ns | 0.0992 | 2560 B | +| HeadersReaderNew | 15 | 10 | 2,507.523 ns | 10.2106 ns | 13.9763 ns | 0.0992 | 2560 B | + + */ diff --git a/bench/Libraries/Microsoft.Extensions.Http.Diagnostics.PerformanceTests/Benchmarks/HugeHttpCLientLoggingBenchmark.cs b/bench/Libraries/Microsoft.Extensions.Http.Diagnostics.PerformanceTests/Benchmarks/HugeHttpCLientLoggingBenchmark.cs index b889a4e6e3b..edc19460f4b 100644 --- a/bench/Libraries/Microsoft.Extensions.Http.Diagnostics.PerformanceTests/Benchmarks/HugeHttpCLientLoggingBenchmark.cs +++ b/bench/Libraries/Microsoft.Extensions.Http.Diagnostics.PerformanceTests/Benchmarks/HugeHttpCLientLoggingBenchmark.cs @@ -16,28 +16,28 @@ public class HugeHttpClientLoggingBenchmark private const int ReadSizeLimit = 53248; private static HttpRequestMessage Request => new(HttpMethod.Post, "https://www.microsoft.com"); - private static readonly System.Net.Http.HttpClient _hugeNoLog + private static readonly HttpClient _hugeNoLog = HttpClientFactory.CreateWithoutLogging(DataFileName); - private static readonly System.Net.Http.HttpClient _hugeLogAll + private static readonly HttpClient _hugeLogAll = HttpClientFactory.CreateWithLoggingLogAll(DataFileName, ReadSizeLimit); - private static readonly System.Net.Http.HttpClient _hugeLogRequest + private static readonly HttpClient _hugeLogRequest = HttpClientFactory.CreateWithLoggingLogRequest(DataFileName, ReadSizeLimit); - private static readonly System.Net.Http.HttpClient _hugeLogResponse + private static readonly HttpClient _hugeLogResponse = HttpClientFactory.CreateWithLoggingLogResponse(DataFileName, ReadSizeLimit); - private static readonly System.Net.Http.HttpClient _hugeNoLogChunked + private static readonly HttpClient _hugeNoLogChunked = HttpClientFactory.CreateWithoutLogging_ChunkedEncoding(DataFileName); - private static readonly System.Net.Http.HttpClient _hugeLogAllChunked + private static readonly HttpClient _hugeLogAllChunked = HttpClientFactory.CreateWithLoggingLogAll_ChunkedEncoding(DataFileName, ReadSizeLimit); - private static readonly System.Net.Http.HttpClient _hugeLogRequestChunked + private static readonly HttpClient _hugeLogRequestChunked = HttpClientFactory.CreateWithLoggingLogRequest_ChunkedEncoding(DataFileName, ReadSizeLimit); - private static readonly System.Net.Http.HttpClient _hugeLogResponseChunked + private static readonly HttpClient _hugeLogResponseChunked = HttpClientFactory.CreateWithLoggingLogResponse_ChunkedEncoding(DataFileName, ReadSizeLimit); [Benchmark(Baseline = true)] diff --git a/bench/Libraries/Microsoft.Extensions.Http.Diagnostics.PerformanceTests/Benchmarks/MediumHttpClientLoggingBenchmark.cs b/bench/Libraries/Microsoft.Extensions.Http.Diagnostics.PerformanceTests/Benchmarks/MediumHttpClientLoggingBenchmark.cs index cd9b1604bf7..fea8ec17e53 100644 --- a/bench/Libraries/Microsoft.Extensions.Http.Diagnostics.PerformanceTests/Benchmarks/MediumHttpClientLoggingBenchmark.cs +++ b/bench/Libraries/Microsoft.Extensions.Http.Diagnostics.PerformanceTests/Benchmarks/MediumHttpClientLoggingBenchmark.cs @@ -16,28 +16,28 @@ public class MediumHttpClientLoggingBenchmark private const int ReadSizeLimit = 16384; private static HttpRequestMessage Request => new(HttpMethod.Post, "https://www.microsoft.com"); - private static readonly System.Net.Http.HttpClient _mediumNoLog + private static readonly HttpClient _mediumNoLog = HttpClientFactory.CreateWithoutLogging(DataFileName); - private static readonly System.Net.Http.HttpClient _mediumLogAll + private static readonly HttpClient _mediumLogAll = HttpClientFactory.CreateWithLoggingLogAll(DataFileName, ReadSizeLimit); - private static readonly System.Net.Http.HttpClient _mediumLogRequest + private static readonly HttpClient _mediumLogRequest = HttpClientFactory.CreateWithLoggingLogRequest(DataFileName, ReadSizeLimit); - private static readonly System.Net.Http.HttpClient _mediumLogResponse + private static readonly HttpClient _mediumLogResponse = HttpClientFactory.CreateWithLoggingLogResponse(DataFileName, ReadSizeLimit); - private static readonly System.Net.Http.HttpClient _mediumNoLogChunked + private static readonly HttpClient _mediumNoLogChunked = HttpClientFactory.CreateWithoutLogging_ChunkedEncoding(DataFileName); - private static readonly System.Net.Http.HttpClient _mediumLogAllChunked + private static readonly HttpClient _mediumLogAllChunked = HttpClientFactory.CreateWithLoggingLogAll_ChunkedEncoding(DataFileName, ReadSizeLimit); - private static readonly System.Net.Http.HttpClient _mediumLogRequestChunked + private static readonly HttpClient _mediumLogRequestChunked = HttpClientFactory.CreateWithLoggingLogRequest_ChunkedEncoding(DataFileName, ReadSizeLimit); - private static readonly System.Net.Http.HttpClient _mediumLogResponseChunked + private static readonly HttpClient _mediumLogResponseChunked = HttpClientFactory.CreateWithLoggingLogResponse_ChunkedEncoding(DataFileName, ReadSizeLimit); [Benchmark(Baseline = true)] diff --git a/bench/Libraries/Microsoft.Extensions.Http.Diagnostics.PerformanceTests/Benchmarks/SmallHttpClientLoggingBenchmark.cs b/bench/Libraries/Microsoft.Extensions.Http.Diagnostics.PerformanceTests/Benchmarks/SmallHttpClientLoggingBenchmark.cs index e21d0852e60..1689ceada92 100644 --- a/bench/Libraries/Microsoft.Extensions.Http.Diagnostics.PerformanceTests/Benchmarks/SmallHttpClientLoggingBenchmark.cs +++ b/bench/Libraries/Microsoft.Extensions.Http.Diagnostics.PerformanceTests/Benchmarks/SmallHttpClientLoggingBenchmark.cs @@ -16,28 +16,28 @@ public class SmallHttpClientLoggingBenchmark private const int ReadSizeLimit = 8192; private static HttpRequestMessage Request => new(HttpMethod.Post, "https://www.microsoft.com"); - private static readonly System.Net.Http.HttpClient _smallNoLog + private static readonly HttpClient _smallNoLog = HttpClientFactory.CreateWithoutLogging(DataFileName); - private static readonly System.Net.Http.HttpClient _smallLogAll + private static readonly HttpClient _smallLogAll = HttpClientFactory.CreateWithLoggingLogAll(DataFileName, ReadSizeLimit); - private static readonly System.Net.Http.HttpClient _smallLogRequest + private static readonly HttpClient _smallLogRequest = HttpClientFactory.CreateWithLoggingLogRequest(DataFileName, ReadSizeLimit); - private static readonly System.Net.Http.HttpClient _smallLogResponse + private static readonly HttpClient _smallLogResponse = HttpClientFactory.CreateWithLoggingLogResponse(DataFileName, ReadSizeLimit); - private static readonly System.Net.Http.HttpClient _smallNoLogChunked + private static readonly HttpClient _smallNoLogChunked = HttpClientFactory.CreateWithoutLogging_ChunkedEncoding(DataFileName); - private static readonly System.Net.Http.HttpClient _smallLogAllChunked + private static readonly HttpClient _smallLogAllChunked = HttpClientFactory.CreateWithLoggingLogAll_ChunkedEncoding(DataFileName, ReadSizeLimit); - private static readonly System.Net.Http.HttpClient _smallLogRequestChunked + private static readonly HttpClient _smallLogRequestChunked = HttpClientFactory.CreateWithLoggingLogRequest_ChunkedEncoding(DataFileName, ReadSizeLimit); - private static readonly System.Net.Http.HttpClient _smallLogResponseChunked + private static readonly HttpClient _smallLogResponseChunked = HttpClientFactory.CreateWithLoggingLogResponse_ChunkedEncoding(DataFileName, ReadSizeLimit); [Benchmark(Baseline = true)] diff --git a/bench/Libraries/Microsoft.Extensions.Http.Diagnostics.PerformanceTests/HttpClientFactory.cs b/bench/Libraries/Microsoft.Extensions.Http.Diagnostics.PerformanceTests/HttpClientFactory.cs index 8cef086ae76..4aac36f8ccd 100644 --- a/bench/Libraries/Microsoft.Extensions.Http.Diagnostics.PerformanceTests/HttpClientFactory.cs +++ b/bench/Libraries/Microsoft.Extensions.Http.Diagnostics.PerformanceTests/HttpClientFactory.cs @@ -11,7 +11,7 @@ namespace Microsoft.Extensions.Http.Logging.Bench; internal static class HttpClientFactory { - public static System.Net.Http.HttpClient CreateWithLoggingLogRequest(string fileName, int readLimit) + public static HttpClient CreateWithLoggingLogRequest(string fileName, int readLimit) { var services = new ServiceCollection(); @@ -25,7 +25,7 @@ public static System.Net.Http.HttpClient CreateWithLoggingLogRequest(string file .AddExtendedHttpClientLogging(options => { options.BodySizeLimit = readLimit; - options.RequestBodyContentTypes.Add(new("application/json")); + options.RequestBodyContentTypes.Add("application/json"); options.RequestHeadersDataClasses.Add("Content-Type", FakeTaxonomy.PrivateData); }) .AddHttpMessageHandler() @@ -35,7 +35,7 @@ public static System.Net.Http.HttpClient CreateWithLoggingLogRequest(string file .CreateClient(nameof(fileName)); } - public static System.Net.Http.HttpClient CreateWithLoggingLogResponse(string fileName, int readLimit) + public static HttpClient CreateWithLoggingLogResponse(string fileName, int readLimit) { var services = new ServiceCollection(); @@ -48,7 +48,7 @@ public static System.Net.Http.HttpClient CreateWithLoggingLogResponse(string fil .AddExtendedHttpClientLogging(options => { options.BodySizeLimit = readLimit; - options.ResponseBodyContentTypes.Add(new("application/json")); + options.ResponseBodyContentTypes.Add("application/json"); options.ResponseHeadersDataClasses.Add("Content-Type", FakeTaxonomy.PrivateData); }) .AddHttpMessageHandler() @@ -58,7 +58,7 @@ public static System.Net.Http.HttpClient CreateWithLoggingLogResponse(string fil .CreateClient(nameof(fileName)); } - public static System.Net.Http.HttpClient CreateWithLoggingLogAll(string fileName, int readLimit) + public static HttpClient CreateWithLoggingLogAll(string fileName, int readLimit) { var services = new ServiceCollection(); @@ -72,10 +72,10 @@ public static System.Net.Http.HttpClient CreateWithLoggingLogAll(string fileName { options.BodySizeLimit = readLimit; - options.RequestBodyContentTypes.Add(new("application/json")); + options.RequestBodyContentTypes.Add("application/json"); options.RequestHeadersDataClasses.Add("Content-Type", FakeTaxonomy.PrivateData); - options.ResponseBodyContentTypes.Add(new("application/json")); + options.ResponseBodyContentTypes.Add("application/json"); options.ResponseHeadersDataClasses.Add("Content-Type", FakeTaxonomy.PrivateData); }) .AddHttpMessageHandler() @@ -85,7 +85,7 @@ public static System.Net.Http.HttpClient CreateWithLoggingLogAll(string fileName .CreateClient(nameof(fileName)); } - public static System.Net.Http.HttpClient CreateWithLoggingLogRequest_ChunkedEncoding(string fileName, int readLimit) + public static HttpClient CreateWithLoggingLogRequest_ChunkedEncoding(string fileName, int readLimit) { var services = new ServiceCollection(); @@ -108,7 +108,7 @@ public static System.Net.Http.HttpClient CreateWithLoggingLogRequest_ChunkedEnco .CreateClient(nameof(fileName)); } - public static System.Net.Http.HttpClient CreateWithLoggingLogResponse_ChunkedEncoding(string fileName, int readLimit) + public static HttpClient CreateWithLoggingLogResponse_ChunkedEncoding(string fileName, int readLimit) { var services = new ServiceCollection(); @@ -131,7 +131,7 @@ public static System.Net.Http.HttpClient CreateWithLoggingLogResponse_ChunkedEnc .CreateClient(nameof(fileName)); } - public static System.Net.Http.HttpClient CreateWithLoggingLogAll_ChunkedEncoding(string fileName, int readLimit) + public static HttpClient CreateWithLoggingLogAll_ChunkedEncoding(string fileName, int readLimit) { var services = new ServiceCollection(); @@ -158,7 +158,7 @@ public static System.Net.Http.HttpClient CreateWithLoggingLogAll_ChunkedEncoding .CreateClient(nameof(fileName)); } - public static System.Net.Http.HttpClient CreateWithoutLogging(string fileName) + public static HttpClient CreateWithoutLogging(string fileName) => new ServiceCollection() .AddSingleton(_ => NoRemoteCallHandler.Create(fileName)) .AddHttpClient(nameof(fileName)) @@ -168,7 +168,7 @@ public static System.Net.Http.HttpClient CreateWithoutLogging(string fileName) .GetRequiredService() .CreateClient(nameof(fileName)); - public static System.Net.Http.HttpClient CreateWithoutLogging_ChunkedEncoding(string fileName) + public static HttpClient CreateWithoutLogging_ChunkedEncoding(string fileName) => new ServiceCollection() .AddSingleton(_ => NoRemoteCallNotSeekableHandler.Create(fileName)) .AddHttpClient(nameof(fileName)) diff --git a/bench/Libraries/Microsoft.Extensions.Http.Diagnostics.PerformanceTests/Microsoft.Extensions.Http.Diagnostics.PerformanceTests.csproj b/bench/Libraries/Microsoft.Extensions.Http.Diagnostics.PerformanceTests/Microsoft.Extensions.Http.Diagnostics.PerformanceTests.csproj index 5348f6a365a..4c5e8386e9c 100644 --- a/bench/Libraries/Microsoft.Extensions.Http.Diagnostics.PerformanceTests/Microsoft.Extensions.Http.Diagnostics.PerformanceTests.csproj +++ b/bench/Libraries/Microsoft.Extensions.Http.Diagnostics.PerformanceTests/Microsoft.Extensions.Http.Diagnostics.PerformanceTests.csproj @@ -1,4 +1,4 @@ - + Microsoft.Extensions.Http.Diagnostics.Bench Benchmarks for Microsoft.Extensions.Http.Diagnostics. @@ -12,6 +12,7 @@ + \ No newline at end of file diff --git a/bench/Libraries/Microsoft.Extensions.Http.Diagnostics.PerformanceTests/NoRemoteCallHandler.cs b/bench/Libraries/Microsoft.Extensions.Http.Diagnostics.PerformanceTests/NoRemoteCallHandler.cs index 997b1b783da..78d12b285d5 100644 --- a/bench/Libraries/Microsoft.Extensions.Http.Diagnostics.PerformanceTests/NoRemoteCallHandler.cs +++ b/bench/Libraries/Microsoft.Extensions.Http.Diagnostics.PerformanceTests/NoRemoteCallHandler.cs @@ -2,7 +2,6 @@ // The .NET Foundation licenses this file to you under the MIT license. using System; -using System.Diagnostics.CodeAnalysis; using System.IO; using System.Net.Http; using System.Threading; @@ -19,8 +18,6 @@ private NoRemoteCallHandler(byte[] data) _data = data; } - [SuppressMessage("Performance Analysis", "CPR120:File.ReadAllXXX should be replaced by using a StreamReader to avoid adding objects to the large object heap (LOH).", - Justification = "We can live with it here")] public static NoRemoteCallHandler Create(string fileName) { var assemblyFileLocation = Path.GetDirectoryName(typeof(NoRemoteCallHandler).Assembly.Location)!; @@ -41,7 +38,7 @@ protected override Task SendAsync(HttpRequestMessage reques { StatusCode = System.Net.HttpStatusCode.OK, RequestMessage = request, - Content = new StreamContent(new MemoryStream(_data)) + Content = new StreamContent(new MemoryStream(_data, writable: false)) }; response.Content.Headers.ContentType = new("application/json"); diff --git a/bench/Libraries/Microsoft.Extensions.Http.Diagnostics.PerformanceTests/Program.cs b/bench/Libraries/Microsoft.Extensions.Http.Diagnostics.PerformanceTests/Program.cs index 9566c263011..72c9a47de43 100644 --- a/bench/Libraries/Microsoft.Extensions.Http.Diagnostics.PerformanceTests/Program.cs +++ b/bench/Libraries/Microsoft.Extensions.Http.Diagnostics.PerformanceTests/Program.cs @@ -18,7 +18,7 @@ private static void Main(string[] args) var dontRequireSlnToRunBenchmarks = ManualConfig .Create(DefaultConfig.Instance) .AddJob(Job.MediumRun - .WithRuntime(CoreRuntime.Core50) + .WithRuntime(CoreRuntime.Core80) .WithGcServer(true) .WithJit(Jit.RyuJit) .WithPlatform(Platform.X64) diff --git a/bench/Libraries/Microsoft.Extensions.Http.Diagnostics.PerformanceTests/StaticOptionsMonitor.cs b/bench/Libraries/Microsoft.Extensions.Http.Diagnostics.PerformanceTests/StaticOptionsMonitor.cs new file mode 100644 index 00000000000..615fc33cb6c --- /dev/null +++ b/bench/Libraries/Microsoft.Extensions.Http.Diagnostics.PerformanceTests/StaticOptionsMonitor.cs @@ -0,0 +1,23 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System; +using Microsoft.Extensions.Options; + +namespace Microsoft.Extensions.Http.Diagnostics.Bench; + +internal sealed class StaticOptionsMonitor : IOptionsMonitor +{ + public StaticOptionsMonitor(T options) + { + CurrentValue = options; + } + + public T CurrentValue { get; } + + public T Get(string? name) + => CurrentValue; + + public IDisposable OnChange(Action listener) + => throw new NotSupportedException(); +} diff --git a/eng/pipelines/templates/VerifyCoverageReport.yml b/eng/pipelines/templates/VerifyCoverageReport.yml index 5c55d4d42de..d956eac76d1 100644 --- a/eng/pipelines/templates/VerifyCoverageReport.yml +++ b/eng/pipelines/templates/VerifyCoverageReport.yml @@ -39,3 +39,4 @@ steps: repositoryName: '$(Build.Repository.Name)' id: $(System.PullRequest.PullRequestNumber) displayName: Report coverage to GitHub + continueOnError: 'true' # Temporary setting to avoid failing the build if the GitHub comment fails diff --git a/src/Libraries/Microsoft.Extensions.Compliance.Testing/FakeRedactorProvider.cs b/src/Libraries/Microsoft.Extensions.Compliance.Testing/FakeRedactorProvider.cs index 38b186688f4..c306d1d4c86 100644 --- a/src/Libraries/Microsoft.Extensions.Compliance.Testing/FakeRedactorProvider.cs +++ b/src/Libraries/Microsoft.Extensions.Compliance.Testing/FakeRedactorProvider.cs @@ -28,7 +28,7 @@ public class FakeRedactorProvider : IRedactorProvider public FakeRedactorProvider(FakeRedactorOptions? options = null, FakeRedactionCollector? eventCollector = null) { Collector = eventCollector ?? new FakeRedactionCollector(); - _redactor = new FakeRedactor(Microsoft.Extensions.Options.Options.Create(options ?? new FakeRedactorOptions()), Collector); + _redactor = new FakeRedactor(Options.Options.Create(options ?? new FakeRedactorOptions()), Collector); } /// diff --git a/src/Libraries/Microsoft.Extensions.Http.Diagnostics/Logging/Internal/HttpHeadersReader.cs b/src/Libraries/Microsoft.Extensions.Http.Diagnostics/Logging/Internal/HttpHeadersReader.cs index 9044ef4ab02..8e6bcedc4e7 100644 --- a/src/Libraries/Microsoft.Extensions.Http.Diagnostics/Logging/Internal/HttpHeadersReader.cs +++ b/src/Libraries/Microsoft.Extensions.Http.Diagnostics/Logging/Internal/HttpHeadersReader.cs @@ -15,9 +15,13 @@ namespace Microsoft.Extensions.Http.Logging.Internal; internal sealed class HttpHeadersReader : IHttpHeadersReader { - private readonly FrozenDictionary _requestHeaders; - private readonly FrozenDictionary _responseHeaders; + private readonly FrozenDictionary _requestHeadersToLog; + private readonly FrozenDictionary _responseHeadersToLog; private readonly IHttpHeadersRedactor _redactor; + private readonly bool _logContentHeaders; +#if NET6_0_OR_GREATER + private readonly int _headersCountThreshold; +#endif public HttpHeadersReader(IOptionsMonitor optionsMonitor, IHttpHeadersRedactor redactor, [ServiceKey] string? serviceKey = null) { @@ -25,8 +29,13 @@ public HttpHeadersReader(IOptionsMonitor optionsMonitor, IHttpHe _redactor = redactor; - _requestHeaders = options.RequestHeadersDataClasses.ToFrozenDictionary(StringComparer.OrdinalIgnoreCase); - _responseHeaders = options.ResponseHeadersDataClasses.ToFrozenDictionary(StringComparer.OrdinalIgnoreCase); + _requestHeadersToLog = options.RequestHeadersDataClasses.ToFrozenDictionary(StringComparer.OrdinalIgnoreCase); + _responseHeadersToLog = options.ResponseHeadersDataClasses.ToFrozenDictionary(StringComparer.OrdinalIgnoreCase); + _logContentHeaders = options.LogContentHeaders; + +#if NET6_0_OR_GREATER + _headersCountThreshold = _requestHeadersToLog.Count; +#endif } public void ReadRequestHeaders(HttpRequestMessage request, List>? destination) @@ -36,7 +45,11 @@ public void ReadRequestHeaders(HttpRequestMessage request, List>? destination) @@ -46,17 +59,47 @@ public void ReadResponseHeaders(HttpResponseMessage response, List headersToLog, List> destination) + private void ReadHeaders(HttpHeaders headers, FrozenDictionary headersToLog, List> destination) { +#if NET6_0_OR_GREATER + var headersCount = headers.NonValidated.Count; + if (headersCount == 0) + { + return; + } + + if (headersCount < _headersCountThreshold) + { + // We have less headers than registered for logging, iterating over the smaller collection + foreach (var header in headers) + { + if (headersToLog.TryGetValue(header.Key, out var classification)) + { + destination.Add(new(header.Key, _redactor.Redact(header.Value, classification))); + } + } + + return; + } +#endif + foreach (var kvp in headersToLog) { var classification = kvp.Value; var header = kvp.Key; - if (requestHeaders.TryGetValues(header, out var values)) + if (headers.TryGetValues(header, out var values)) { destination.Add(new(header, _redactor.Redact(values, classification))); } diff --git a/src/Libraries/Microsoft.Extensions.Http.Diagnostics/Logging/Internal/Log.cs b/src/Libraries/Microsoft.Extensions.Http.Diagnostics/Logging/Internal/Log.cs index 2b8a627b687..ea60895faf9 100644 --- a/src/Libraries/Microsoft.Extensions.Http.Diagnostics/Logging/Internal/Log.cs +++ b/src/Libraries/Microsoft.Extensions.Http.Diagnostics/Logging/Internal/Log.cs @@ -12,10 +12,9 @@ namespace Microsoft.Extensions.Http.Logging.Internal; /// Logs , and the exceptions due to errors of request/response. /// [SuppressMessage("Major Code Smell", "S109:Magic numbers should not be used", Justification = "Event ID's.")] -internal static class Log +internal static partial class Log { internal const string OriginalFormat = "{OriginalFormat}"; - private const string NullString = "(null)"; private const int MinimalPropertyCount = 4; @@ -34,7 +33,7 @@ internal static class Log "An error occurred in enricher '{Enricher}' while enriching the logger context for request: " + $"{{{HttpClientLoggingTagNames.Method}}} {{{HttpClientLoggingTagNames.Host}}}/{{{HttpClientLoggingTagNames.Path}}}"; - private static readonly Func _originalFormatValueFMTFunc = OriginalFormatValueFmt; + private static readonly Func _originalFormatValueFmtFunc = OriginalFormatValueFmt; public static void OutgoingRequest(ILogger logger, LogLevel level, LogRecord record) { @@ -46,114 +45,38 @@ public static void OutgoingRequestError(ILogger logger, LogRecord record, Except OutgoingRequest(logger, LogLevel.Error, 2, nameof(OutgoingRequestError), record, exception); } - public static void RequestReadError(ILogger logger, Exception exception, HttpMethod method, string? host, string? path) - { - var state = LoggerMessageHelper.ThreadLocalState; - - _ = state.ReserveTagSpace(4); - state.TagArray[3] = new(HttpClientLoggingTagNames.Method, method); - state.TagArray[2] = new(HttpClientLoggingTagNames.Host, host); - state.TagArray[1] = new(HttpClientLoggingTagNames.Path, path); - state.TagArray[0] = new(OriginalFormat, RequestReadErrorMessage); - - logger.Log( - LogLevel.Error, - new(0, nameof(RequestReadError)), - state, - exception, - static (s, _) => - { - var method = s.TagArray[3].Value ?? NullString; - var host = s.TagArray[2].Value ?? NullString; - var path = s.TagArray[1].Value ?? NullString; - return FormattableString.Invariant( - $"An error occurred while reading the request data to fill the logger context for request: {method} {host}/{path}"); - }); - - state.Clear(); - } - - public static void ResponseReadError(ILogger logger, Exception exception, HttpMethod method, string host, string path) - { - var state = LoggerMessageHelper.ThreadLocalState; - - _ = state.ReserveTagSpace(4); - state.TagArray[3] = new(HttpClientLoggingTagNames.Method, method); - state.TagArray[2] = new(HttpClientLoggingTagNames.Host, host); - state.TagArray[1] = new(HttpClientLoggingTagNames.Path, path); - state.TagArray[0] = new(OriginalFormat, ResponseReadErrorMessage); - - logger.Log( - LogLevel.Error, - new(0, nameof(ResponseReadError)), - state, - exception, - static (s, _) => - { - var method = s.TagArray[3].Value ?? NullString; - var host = s.TagArray[2].Value ?? NullString; - var path = s.TagArray[1].Value ?? NullString; - return FormattableString.Invariant( - $"An error occurred while reading the response data to fill the logger context for request: {method} {host}/{path}"); - }); - - state.Clear(); - } - - public static void LoggerContextMissing(ILogger logger, Exception? exception, string requestState, HttpMethod method, string? host) - { - var state = LoggerMessageHelper.ThreadLocalState; - - _ = state.ReserveTagSpace(4); - state.TagArray[3] = new("RequestState", requestState); - state.TagArray[2] = new(HttpClientLoggingTagNames.Method, method); - state.TagArray[1] = new(HttpClientLoggingTagNames.Host, host); - state.TagArray[0] = new(OriginalFormat, LoggerContextMissingMessage); - - logger.Log( - LogLevel.Error, - new(0, nameof(LoggerContextMissing)), - state, - exception, - static (s, _) => - { - var requestState = s.TagArray[3].Value ?? NullString; - var method = s.TagArray[2].Value ?? NullString; - var host = s.TagArray[1].Value ?? NullString; - return FormattableString.Invariant($"The logger couldn't read its context for {requestState} request: {method} {host}"); - }); - - state.Clear(); - } - - public static void EnrichmentError(ILogger logger, Exception exception, string? enricher, HttpMethod method, string host, string path) - { - var state = LoggerMessageHelper.ThreadLocalState; - - _ = state.ReserveTagSpace(5); - state.TagArray[4] = new("Enricher", enricher); - state.TagArray[3] = new(HttpClientLoggingTagNames.Method, method); - state.TagArray[2] = new(HttpClientLoggingTagNames.Host, host); - state.TagArray[1] = new(HttpClientLoggingTagNames.Path, path); - state.TagArray[0] = new(OriginalFormat, EnrichmentErrorMessage); - - logger.Log( - LogLevel.Error, - new(0, nameof(EnrichmentError)), - state, - exception, - static (s, _) => - { - var enricher = s.TagArray[4].Value ?? NullString; - var method = s.TagArray[3].Value ?? NullString; - var host = s.TagArray[2].Value ?? NullString; - var path = s.TagArray[1].Value ?? NullString; - return FormattableString.Invariant( - $"An error occurred in enricher '{enricher}' while enriching the logger context for request: {method} {host}/{path}"); - }); - - state.Clear(); - } + [LoggerMessage(LogLevel.Error, RequestReadErrorMessage)] + public static partial void RequestReadError( + ILogger logger, + Exception exception, + [TagName(HttpClientLoggingTagNames.Method)] HttpMethod method, + [TagName(HttpClientLoggingTagNames.Host)] string? host, + [TagName(HttpClientLoggingTagNames.Path)] string? path); + + [LoggerMessage(LogLevel.Error, ResponseReadErrorMessage)] + public static partial void ResponseReadError( + ILogger logger, + Exception exception, + [TagName(HttpClientLoggingTagNames.Method)] HttpMethod method, + [TagName(HttpClientLoggingTagNames.Host)] string host, + [TagName(HttpClientLoggingTagNames.Path)] string path); + + [LoggerMessage(LogLevel.Error, LoggerContextMissingMessage)] + public static partial void LoggerContextMissing( + ILogger logger, + Exception? exception, + string requestState, + [TagName(HttpClientLoggingTagNames.Method)] HttpMethod method, + [TagName(HttpClientLoggingTagNames.Host)] string? host); + + [LoggerMessage(LogLevel.Error, EnrichmentErrorMessage)] + public static partial void EnrichmentError( + ILogger logger, + Exception exception, + string? enricher, + [TagName(HttpClientLoggingTagNames.Method)] HttpMethod method, + [TagName(HttpClientLoggingTagNames.Host)] string host, + [TagName(HttpClientLoggingTagNames.Path)] string path); // Using the code below instead of generated logging method because we have a custom formatter and custom tag keys for headers. private static void OutgoingRequest( @@ -215,7 +138,7 @@ private static void OutgoingRequest( new(eventId, eventName), loggerMessageState, exception, - _originalFormatValueFMTFunc); + _originalFormatValueFmtFunc); if (record.EnrichmentTags is null) { diff --git a/src/Libraries/Microsoft.Extensions.Http.Diagnostics/Logging/LoggingOptions.cs b/src/Libraries/Microsoft.Extensions.Http.Diagnostics/Logging/LoggingOptions.cs index 184fca4a061..fe2d096f7bc 100644 --- a/src/Libraries/Microsoft.Extensions.Http.Diagnostics/Logging/LoggingOptions.cs +++ b/src/Libraries/Microsoft.Extensions.Http.Diagnostics/Logging/LoggingOptions.cs @@ -8,6 +8,7 @@ using Microsoft.Extensions.Compliance.Classification; using Microsoft.Extensions.Http.Diagnostics; using Microsoft.Shared.Data.Validation; +using Microsoft.Shared.DiagnosticIds; namespace Microsoft.Extensions.Http.Logging; @@ -144,4 +145,18 @@ public class LoggingOptions [SuppressMessage("Usage", "CA2227:Collection properties should be read only", Justification = "Options pattern.")] public IDictionary RouteParameterDataClasses { get; set; } = new Dictionary(); + + /// + /// Gets or sets a value indicating whether the HTTP request and response content headers are logged. + /// + /// + /// The default value is . + /// + /// + /// This property controls whether the logging of HTTP request and response representation headers (e.g. Content-Type) is enabled. + /// Keep this option disabled if or + /// don't contain any representation headers, otherwise it will create unnecessary minor performance impact on the headers logging. + /// + [Experimental(diagnosticId: DiagnosticIds.Experiments.Telemetry, UrlFormat = DiagnosticIds.UrlFormat)] + public bool LogContentHeaders { get; set; } } diff --git a/src/Libraries/Microsoft.Extensions.Http.Diagnostics/Microsoft.Extensions.Http.Diagnostics.csproj b/src/Libraries/Microsoft.Extensions.Http.Diagnostics/Microsoft.Extensions.Http.Diagnostics.csproj index dc712fd3275..00cc5c466d6 100644 --- a/src/Libraries/Microsoft.Extensions.Http.Diagnostics/Microsoft.Extensions.Http.Diagnostics.csproj +++ b/src/Libraries/Microsoft.Extensions.Http.Diagnostics/Microsoft.Extensions.Http.Diagnostics.csproj @@ -1,4 +1,4 @@ - + Microsoft.Extensions.Http.Diagnostics Telemetry support for HTTP Client. @@ -13,7 +13,8 @@ true false true - false + true + true false true false diff --git a/test/Libraries/Microsoft.Extensions.Http.Diagnostics.Tests/Logging/AcceptanceTests.cs b/test/Libraries/Microsoft.Extensions.Http.Diagnostics.Tests/Logging/AcceptanceTests.cs index 8e2df28853b..36ad783c73b 100644 --- a/test/Libraries/Microsoft.Extensions.Http.Diagnostics.Tests/Logging/AcceptanceTests.cs +++ b/test/Libraries/Microsoft.Extensions.Http.Diagnostics.Tests/Logging/AcceptanceTests.cs @@ -360,7 +360,7 @@ public async Task AddHttpClientLogging_StructuredPathLogging_RedactsSensitivePar httpRequestMessage.SetRequestMetadata(new RequestMetadata(httpRequestMessage.Method.ToString(), RequestRoute)); - using var _ = await httpClient.SendAsync(httpRequestMessage).ConfigureAwait(false); + using var _ = await httpClient.SendAsync(httpRequestMessage); var collector = sp.GetFakeLogCollector(); var logRecord = collector.GetSnapshot().Single(logRecord => logRecord.Category == LoggingCategory); diff --git a/test/Libraries/Microsoft.Extensions.Http.Diagnostics.Tests/Logging/HttpHeadersReaderTest.cs b/test/Libraries/Microsoft.Extensions.Http.Diagnostics.Tests/Logging/HttpHeadersReaderTest.cs index a32a649b62e..625342d2468 100644 --- a/test/Libraries/Microsoft.Extensions.Http.Diagnostics.Tests/Logging/HttpHeadersReaderTest.cs +++ b/test/Libraries/Microsoft.Extensions.Http.Diagnostics.Tests/Logging/HttpHeadersReaderTest.cs @@ -1,9 +1,9 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System; using System.Collections.Generic; using System.Net.Http; +using System.Net.Mime; using FluentAssertions; using Microsoft.Extensions.Compliance.Classification; using Microsoft.Extensions.Compliance.Testing; @@ -58,8 +58,8 @@ public void HttpHeadersReader_WhenHeadersProvided_ReadsThem() { { "Header3", FakeTaxonomy.PublicData }, { "Header4", FakeTaxonomy.PublicData }, - { "hEaDeR7", FakeTaxonomy.PrivateData } - }, + { "hEaDeR7", FakeTaxonomy.PrivateData } // This one is to test case-insensitivity + } }; var headersReader = new HttpHeadersReader(options.ToOptionsMonitor(), mockHeadersRedactor.Object); @@ -86,11 +86,12 @@ public void HttpHeadersReader_WhenHeadersProvided_ReadsThem() new KeyValuePair("Header1", Redacted), new KeyValuePair("Header2", Redacted) }; + var expectedResponse = new[] { new KeyValuePair("Header3", "Value.3"), new KeyValuePair("Header4", "Value.4"), - new KeyValuePair("hEaDeR7", Redacted), + new KeyValuePair("hEaDeR7", Redacted) }; headersReader.ReadRequestHeaders(httpRequest, requestBuffer); @@ -100,6 +101,71 @@ public void HttpHeadersReader_WhenHeadersProvided_ReadsThem() responseBuffer.Should().BeEquivalentTo(expectedResponse); } + [Theory] + [CombinatorialData] + public void HttpHeadersReader_WhenProvided_ReadsContentHeaders(bool logContentHeaders) + { + var mockHeadersRedactor = new Mock(); + mockHeadersRedactor.Setup(r => r.Redact(It.IsAny>(), FakeTaxonomy.PublicData)) + .Returns, DataClassification>((x, _) => string.Join(",", x)); + + var options = new LoggingOptions + { + RequestHeadersDataClasses = new Dictionary + { + { "Header1", FakeTaxonomy.PublicData }, + { "Content-Header1", FakeTaxonomy.PublicData }, + { "Content-Type", FakeTaxonomy.PublicData } + }, + ResponseHeadersDataClasses = new Dictionary + { + { "Header3", FakeTaxonomy.PublicData }, + { "Content-Header2", FakeTaxonomy.PublicData }, + { "Content-Length", FakeTaxonomy.PublicData } + }, + LogContentHeaders = logContentHeaders + }; + + var headersReader = new HttpHeadersReader(options.ToOptionsMonitor(), mockHeadersRedactor.Object); + + using var requestContent = new StringContent(string.Empty); + requestContent.Headers.ContentType = new(MediaTypeNames.Application.Soap); + requestContent.Headers.ContentLength = 42; + requestContent.Headers.Add("Content-Header1", "Content.1"); + + using var httpRequest = new HttpRequestMessage { Content = requestContent }; + httpRequest.Headers.Add("Header1", "Value.1"); + httpRequest.Headers.Add("Header2", "Value.2"); + + using var responseContent = new StringContent(string.Empty); + responseContent.Headers.ContentType = new(MediaTypeNames.Text.Html); + responseContent.Headers.ContentLength = 24; + responseContent.Headers.Add("Content-Header2", "Content.2"); + + using var httpResponse = new HttpResponseMessage { Content = responseContent }; + httpResponse.Headers.Add("Header3", "Value.3"); + httpResponse.Headers.Add("Header4", "Value.4"); + + List> expectedRequest = [new KeyValuePair("Header1", "Value.1")]; + List> expectedResponse = [new KeyValuePair("Header3", "Value.3")]; + if (logContentHeaders) + { + expectedRequest.Add(new KeyValuePair("Content-Header1", "Content.1")); + expectedRequest.Add(new KeyValuePair("Content-Type", MediaTypeNames.Application.Soap)); + + expectedResponse.Add(new KeyValuePair("Content-Header2", "Content.2")); + expectedResponse.Add(new KeyValuePair("Content-Length", "24")); + } + + List> requestBuffer = []; + headersReader.ReadRequestHeaders(httpRequest, requestBuffer); + requestBuffer.Should().BeEquivalentTo(expectedRequest); + + List> responseBuffer = []; + headersReader.ReadResponseHeaders(httpResponse, responseBuffer); + responseBuffer.Should().BeEquivalentTo(expectedResponse); + } + [Fact] public void HttpHeadersReader_WhenBufferIsNull_DoesNothing() { diff --git a/test/Libraries/Microsoft.Extensions.Http.Diagnostics.Tests/TelemetryCommonExtensions2Tests.cs b/test/Libraries/Microsoft.Extensions.Http.Diagnostics.Tests/TelemetryCommonExtensionsTests.cs similarity index 98% rename from test/Libraries/Microsoft.Extensions.Http.Diagnostics.Tests/TelemetryCommonExtensions2Tests.cs rename to test/Libraries/Microsoft.Extensions.Http.Diagnostics.Tests/TelemetryCommonExtensionsTests.cs index 85f7791eeb2..a7a404079b6 100644 --- a/test/Libraries/Microsoft.Extensions.Http.Diagnostics.Tests/TelemetryCommonExtensions2Tests.cs +++ b/test/Libraries/Microsoft.Extensions.Http.Diagnostics.Tests/TelemetryCommonExtensionsTests.cs @@ -8,7 +8,7 @@ namespace Microsoft.Extensions.Telemetry.Internal.Test; -public class TelemetryCommonExtensions2Tests +public class TelemetryCommonExtensionsTests { [Fact] public void GetDependencyName_DependencyNameMissing_ReturnsUnknown() From a27945faacbc272094c264b35d1a2bc285ae25d1 Mon Sep 17 00:00:00 2001 From: Jose Perez Rodriguez Date: Fri, 5 Jan 2024 15:51:35 -0800 Subject: [PATCH 126/172] Branding changes for 8.2 (#4855) --- eng/Versions.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/Versions.props b/eng/Versions.props index 1ab4363c0ce..6fb88b03c70 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -1,7 +1,7 @@ 8 - 1 + 2 0 preview From 68c6e87ee12dfc3f5ffe322292fb78abc0ba4a3c Mon Sep 17 00:00:00 2001 From: Martin Taillefer Date: Sun, 7 Jan 2024 10:53:22 -0800 Subject: [PATCH 127/172] Simplify platform check. (#4853) Fixes #4642 Co-authored-by: Martin Taillefer --- ...ceMonitoringServiceCollectionExtensions.cs | 24 +++++++------------ 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/src/Libraries/Microsoft.Extensions.Diagnostics.ResourceMonitoring/ResourceMonitoringServiceCollectionExtensions.cs b/src/Libraries/Microsoft.Extensions.Diagnostics.ResourceMonitoring/ResourceMonitoringServiceCollectionExtensions.cs index 0981bd5a612..06d183536bc 100644 --- a/src/Libraries/Microsoft.Extensions.Diagnostics.ResourceMonitoring/ResourceMonitoringServiceCollectionExtensions.cs +++ b/src/Libraries/Microsoft.Extensions.Diagnostics.ResourceMonitoring/ResourceMonitoringServiceCollectionExtensions.cs @@ -51,6 +51,8 @@ public static IServiceCollection AddResourceMonitoring( return services.AddResourceMonitoringInternal(configure); } + // can't easily test the exception throwing case + [ExcludeFromCodeCoverage] private static IServiceCollection AddResourceMonitoringInternal( this IServiceCollection services, Action configure) @@ -62,14 +64,18 @@ private static IServiceCollection AddResourceMonitoringInternal( #if NETFRAMEWORK _ = builder.AddWindowsProvider(); #else - if (GetPlatform() == PlatformID.Win32NT) + if (OperatingSystem.IsWindows()) { _ = builder.AddWindowsProvider(); } - else + else if (OperatingSystem.IsLinux()) { _ = builder.AddLinuxProvider(); } + else + { + throw new PlatformNotSupportedException(); + } #endif configure.Invoke(builder); @@ -77,20 +83,6 @@ private static IServiceCollection AddResourceMonitoringInternal( return services; } -#if !NETFRAMEWORK - [ExcludeFromCodeCoverage] - private static PlatformID GetPlatform() - { - var os = Environment.OSVersion; - if (os.Platform != PlatformID.Win32NT && os.Platform != PlatformID.Unix) - { - throw new NotSupportedException("Resource monitoring is not supported on this operating system."); - } - - return os.Platform; - } -#endif - private static ResourceMonitorBuilder AddWindowsProvider(this ResourceMonitorBuilder builder) { builder.PickWindowsSnapshotProvider(); From b02e145b3cf7ea3ac5cf6eba34517f79dee1e8a3 Mon Sep 17 00:00:00 2001 From: martintmk <103487740+martintmk@users.noreply.github.com> Date: Sun, 7 Jan 2024 20:21:47 +0100 Subject: [PATCH 128/172] Upgrade Polly to latest version (8.2.1) (#4860) --- eng/packages/General.props | 10 +++++----- eng/packages/TestOnly.props | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/eng/packages/General.props b/eng/packages/General.props index 457a789f0b4..8a3633a72db 100644 --- a/eng/packages/General.props +++ b/eng/packages/General.props @@ -37,10 +37,10 @@ - - - - + + + + @@ -72,7 +72,7 @@ - + diff --git a/eng/packages/TestOnly.props b/eng/packages/TestOnly.props index 9e548d0c374..c04980b381d 100644 --- a/eng/packages/TestOnly.props +++ b/eng/packages/TestOnly.props @@ -8,7 +8,7 @@ - + From 9dc33c219d872eb32f0d8d4f1bbe4c31dad8c2b1 Mon Sep 17 00:00:00 2001 From: Nikita Balabaev Date: Mon, 8 Jan 2024 14:00:39 +0100 Subject: [PATCH 129/172] No suppression on "Report coverage to GitHub" CI task (#4863) --- eng/pipelines/templates/VerifyCoverageReport.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/eng/pipelines/templates/VerifyCoverageReport.yml b/eng/pipelines/templates/VerifyCoverageReport.yml index d956eac76d1..5c55d4d42de 100644 --- a/eng/pipelines/templates/VerifyCoverageReport.yml +++ b/eng/pipelines/templates/VerifyCoverageReport.yml @@ -39,4 +39,3 @@ steps: repositoryName: '$(Build.Repository.Name)' id: $(System.PullRequest.PullRequestNumber) displayName: Report coverage to GitHub - continueOnError: 'true' # Temporary setting to avoid failing the build if the GitHub comment fails From c63655a995fb1dfc8b8fd9cf149d5e6ad225a185 Mon Sep 17 00:00:00 2001 From: Jose Perez Rodriguez Date: Mon, 8 Jan 2024 17:34:27 +0000 Subject: [PATCH 130/172] Merged PR 36248: Update platform dependencies to 8.0.1 servicing and prepare for 8.1 release Update platform dependencies to 8.0.1 servicing and prepare for 8.1 release --- Directory.Build.props | 5 + NuGet.config | 46 ++--- azure-pipelines.yml | 50 ----- eng/Version.Details.xml | 194 +++++++++--------- eng/Versions.props | 30 +-- eng/pipelines/templates/BuildAndTest.yml | 18 ++ .../Directory.Build.props | 3 + 7 files changed, 160 insertions(+), 186 deletions(-) diff --git a/Directory.Build.props b/Directory.Build.props index 24c1bb96cae..c447709a05f 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -34,6 +34,11 @@ $(NetCoreTargetFrameworks) + + + $(NoWarn);NU1507 + + false latest diff --git a/NuGet.config b/NuGet.config index 3ac6622678d..3b23b0d82f9 100644 --- a/NuGet.config +++ b/NuGet.config @@ -3,8 +3,15 @@ + + + + + - + + + @@ -16,27 +23,18 @@ - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + diff --git a/azure-pipelines.yml b/azure-pipelines.yml index a695dd6529a..34222fe99c6 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -206,55 +206,6 @@ stages: warnAsError: 0 -# ---------------------------------------------------------------- -# This stage performs quality gates enforcements -# ---------------------------------------------------------------- -- stage: codecoverage - displayName: CodeCoverage - dependsOn: - - build - condition: and(succeeded('build'), ne(variables['SkipQualityGates'], 'true')) - variables: - - template: /eng/common/templates/variables/pool-providers.yml - jobs: - - template: /eng/common/templates/jobs/jobs.yml - parameters: - enableMicrobuild: true - enableTelemetry: true - runAsPublic: ${{ variables['runAsPublic'] }} - workspace: - clean: all - - # ---------------------------------------------------------------- - # This stage downloads the code coverage reports from the build jobs, - # merges those and validates the combined test coverage. - # ---------------------------------------------------------------- - jobs: - - job: CodeCoverageReport - timeoutInMinutes: 180 - - pool: - ${{ if eq(variables['runAsPublic'], 'true') }}: - name: $(DncEngPublicBuildPool) - demands: ImageOverride -equals build.ubuntu.2004.amd64.open - # Non-public (i.e., official builds) - ${{ else }}: - name: $(DncEngInternalBuildPool) - demands: ImageOverride -equals build.ubuntu.2004.amd64 - - preSteps: - - checkout: self - clean: true - persistCredentials: true - fetchDepth: 1 - - steps: - - script: $(Build.SourcesDirectory)/build.sh --ci --restore - displayName: Init toolset - - - template: /eng/pipelines/templates/VerifyCoverageReport.yml - - # ---------------------------------------------------------------- # This stage only performs a build treating warnings as errors # to detect any kind of code style violations @@ -313,7 +264,6 @@ stages: parameters: validateDependsOn: - build - - codecoverage - correctness publishingInfraVersion: 3 enableSymbolValidation: false diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 7b38bcb0697..4415f2bd7ac 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,172 +1,172 @@ - - https://github.com/dotnet/runtime - 488a8a3521610422e8fbe22d5cc66127f3dce3dc + + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime + bf5e279d9239bfef5bb1b8d6212f1b971c434606 - https://github.com/dotnet/runtime - 488a8a3521610422e8fbe22d5cc66127f3dce3dc + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime + 5535e31a712343a63f5d7d796cd874e563e5ac14 - https://github.com/dotnet/runtime - 488a8a3521610422e8fbe22d5cc66127f3dce3dc + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime + 5535e31a712343a63f5d7d796cd874e563e5ac14 - https://github.com/dotnet/runtime - 488a8a3521610422e8fbe22d5cc66127f3dce3dc + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime + 5535e31a712343a63f5d7d796cd874e563e5ac14 - - https://github.com/dotnet/runtime - 488a8a3521610422e8fbe22d5cc66127f3dce3dc + + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime + bf5e279d9239bfef5bb1b8d6212f1b971c434606 - https://github.com/dotnet/runtime - 488a8a3521610422e8fbe22d5cc66127f3dce3dc + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime + 5535e31a712343a63f5d7d796cd874e563e5ac14 - https://github.com/dotnet/runtime - 488a8a3521610422e8fbe22d5cc66127f3dce3dc + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime + 5535e31a712343a63f5d7d796cd874e563e5ac14 - https://github.com/dotnet/runtime - 488a8a3521610422e8fbe22d5cc66127f3dce3dc + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime + 5535e31a712343a63f5d7d796cd874e563e5ac14 - https://github.com/dotnet/runtime - 488a8a3521610422e8fbe22d5cc66127f3dce3dc + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime + 5535e31a712343a63f5d7d796cd874e563e5ac14 - https://github.com/dotnet/runtime - 488a8a3521610422e8fbe22d5cc66127f3dce3dc + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime + 5535e31a712343a63f5d7d796cd874e563e5ac14 - https://github.com/dotnet/runtime - 488a8a3521610422e8fbe22d5cc66127f3dce3dc + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime + 5535e31a712343a63f5d7d796cd874e563e5ac14 - https://github.com/dotnet/runtime - 488a8a3521610422e8fbe22d5cc66127f3dce3dc + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime + 5535e31a712343a63f5d7d796cd874e563e5ac14 - https://github.com/dotnet/runtime - 488a8a3521610422e8fbe22d5cc66127f3dce3dc + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime + 5535e31a712343a63f5d7d796cd874e563e5ac14 - https://github.com/dotnet/runtime - 488a8a3521610422e8fbe22d5cc66127f3dce3dc + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime + 5535e31a712343a63f5d7d796cd874e563e5ac14 - https://github.com/dotnet/runtime - 488a8a3521610422e8fbe22d5cc66127f3dce3dc + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime + 5535e31a712343a63f5d7d796cd874e563e5ac14 - https://github.com/dotnet/runtime - 488a8a3521610422e8fbe22d5cc66127f3dce3dc + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime + 5535e31a712343a63f5d7d796cd874e563e5ac14 - https://github.com/dotnet/runtime - 488a8a3521610422e8fbe22d5cc66127f3dce3dc + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime + 5535e31a712343a63f5d7d796cd874e563e5ac14 - https://github.com/dotnet/runtime - 488a8a3521610422e8fbe22d5cc66127f3dce3dc + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime + 5535e31a712343a63f5d7d796cd874e563e5ac14 - https://github.com/dotnet/runtime - 488a8a3521610422e8fbe22d5cc66127f3dce3dc + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime + 5535e31a712343a63f5d7d796cd874e563e5ac14 - https://github.com/dotnet/runtime - 488a8a3521610422e8fbe22d5cc66127f3dce3dc + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime + 5535e31a712343a63f5d7d796cd874e563e5ac14 - - https://github.com/dotnet/runtime - 488a8a3521610422e8fbe22d5cc66127f3dce3dc + + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime + bf5e279d9239bfef5bb1b8d6212f1b971c434606 - https://github.com/dotnet/runtime - 488a8a3521610422e8fbe22d5cc66127f3dce3dc + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime + 5535e31a712343a63f5d7d796cd874e563e5ac14 - https://github.com/dotnet/runtime - 488a8a3521610422e8fbe22d5cc66127f3dce3dc + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime + 5535e31a712343a63f5d7d796cd874e563e5ac14 - https://github.com/dotnet/runtime - 488a8a3521610422e8fbe22d5cc66127f3dce3dc + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime + 5535e31a712343a63f5d7d796cd874e563e5ac14 - https://github.com/dotnet/runtime - 488a8a3521610422e8fbe22d5cc66127f3dce3dc + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime + 5535e31a712343a63f5d7d796cd874e563e5ac14 - https://github.com/dotnet/runtime - 488a8a3521610422e8fbe22d5cc66127f3dce3dc + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime + 5535e31a712343a63f5d7d796cd874e563e5ac14 - https://github.com/dotnet/runtime - 488a8a3521610422e8fbe22d5cc66127f3dce3dc + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime + 5535e31a712343a63f5d7d796cd874e563e5ac14 - https://github.com/dotnet/runtime - 488a8a3521610422e8fbe22d5cc66127f3dce3dc + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime + 5535e31a712343a63f5d7d796cd874e563e5ac14 - https://github.com/dotnet/runtime - 488a8a3521610422e8fbe22d5cc66127f3dce3dc + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime + 5535e31a712343a63f5d7d796cd874e563e5ac14 - https://github.com/dotnet/runtime - 488a8a3521610422e8fbe22d5cc66127f3dce3dc + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime + 5535e31a712343a63f5d7d796cd874e563e5ac14 - https://github.com/dotnet/runtime - 488a8a3521610422e8fbe22d5cc66127f3dce3dc + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime + 5535e31a712343a63f5d7d796cd874e563e5ac14 - - https://github.com/dotnet/runtime - 488a8a3521610422e8fbe22d5cc66127f3dce3dc + + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime + bf5e279d9239bfef5bb1b8d6212f1b971c434606 - https://github.com/dotnet/runtime - 488a8a3521610422e8fbe22d5cc66127f3dce3dc + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime + 5535e31a712343a63f5d7d796cd874e563e5ac14 - - https://github.com/dotnet/aspnetcore - 815eb281ecad13eb69cf50516ac7f534b947f2b0 + + https://dev.azure.com/dnceng/internal/_git/dotnet-aspnetcore + 8e941eb42f819adb116b881195158b3887a70a1c - - https://github.com/dotnet/aspnetcore - 815eb281ecad13eb69cf50516ac7f534b947f2b0 + + https://dev.azure.com/dnceng/internal/_git/dotnet-aspnetcore + 8e941eb42f819adb116b881195158b3887a70a1c - - https://github.com/dotnet/aspnetcore - 815eb281ecad13eb69cf50516ac7f534b947f2b0 + + https://dev.azure.com/dnceng/internal/_git/dotnet-aspnetcore + 8e941eb42f819adb116b881195158b3887a70a1c - - https://github.com/dotnet/aspnetcore - 815eb281ecad13eb69cf50516ac7f534b947f2b0 + + https://dev.azure.com/dnceng/internal/_git/dotnet-aspnetcore + 8e941eb42f819adb116b881195158b3887a70a1c - - https://github.com/dotnet/aspnetcore - 815eb281ecad13eb69cf50516ac7f534b947f2b0 + + https://dev.azure.com/dnceng/internal/_git/dotnet-aspnetcore + 8e941eb42f819adb116b881195158b3887a70a1c - - https://github.com/dotnet/aspnetcore - 815eb281ecad13eb69cf50516ac7f534b947f2b0 + + https://dev.azure.com/dnceng/internal/_git/dotnet-aspnetcore + 8e941eb42f819adb116b881195158b3887a70a1c - - https://github.com/dotnet/aspnetcore - 815eb281ecad13eb69cf50516ac7f534b947f2b0 + + https://dev.azure.com/dnceng/internal/_git/dotnet-aspnetcore + 8e941eb42f819adb116b881195158b3887a70a1c - - https://github.com/dotnet/aspnetcore - 815eb281ecad13eb69cf50516ac7f534b947f2b0 + + https://dev.azure.com/dnceng/internal/_git/dotnet-aspnetcore + 8e941eb42f819adb116b881195158b3887a70a1c - - https://github.com/dotnet/aspnetcore - 815eb281ecad13eb69cf50516ac7f534b947f2b0 + + https://dev.azure.com/dnceng/internal/_git/dotnet-aspnetcore + 8e941eb42f819adb116b881195158b3887a70a1c diff --git a/eng/Versions.props b/eng/Versions.props index 1ab4363c0ce..a9f8a9d1694 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -3,7 +3,7 @@ 8 1 0 - preview + rtm $(MajorVersion).$(MinorVersion).$(PatchVersion) @@ -12,7 +12,7 @@ - + release true @@ -28,11 +28,11 @@ --> - 8.0.0 + 8.0.1 8.0.0 8.0.0 8.0.0 - 8.0.0 + 8.0.1 8.0.0 8.0.0 8.0.0 @@ -48,7 +48,7 @@ 8.0.0 8.0.0 8.0.0 - 8.0.0 + 8.0.1 8.0.0 8.0.0 8.0.0 @@ -59,18 +59,18 @@ 8.0.0 8.0.0 8.0.0 - 8.0.0 + 8.0.1 8.0.0 - 8.0.0 - 8.0.0 - 8.0.0 - 8.0.0 - 8.0.0 - 8.0.0 - 8.0.0 - 8.0.0 - 8.0.0 + 8.0.1 + 8.0.1 + 8.0.1 + 8.0.1 + 8.0.1 + 8.0.1 + 8.0.1 + 8.0.1 + 8.0.1 + release From 3654748e14445fa794bcdb0d2ebffa46e758603c Mon Sep 17 00:00:00 2001 From: martintmk <103487740+martintmk@users.noreply.github.com> Date: Mon, 8 Jan 2024 19:32:49 +0100 Subject: [PATCH 131/172] Disable HttpClient's timeout for Standard Resilience and Hedging (#4862) * Disable HttpClient's timeout for Standard Hedging and Standard Resilience --- .../ResilienceHttpClientBuilderExtensions.Hedging.cs | 4 ++++ ...eHttpClientBuilderExtensions.StandardResilience.cs | 4 ++++ .../Hedging/StandardHedgingTests.cs | 8 ++++++++ .../HttpClientBuilderExtensionsTests.Standard.cs | 11 +++++++++++ 4 files changed, 27 insertions(+) diff --git a/src/Libraries/Microsoft.Extensions.Http.Resilience/Hedging/ResilienceHttpClientBuilderExtensions.Hedging.cs b/src/Libraries/Microsoft.Extensions.Http.Resilience/Hedging/ResilienceHttpClientBuilderExtensions.Hedging.cs index 33f496b4c74..b4ffb70eb7d 100644 --- a/src/Libraries/Microsoft.Extensions.Http.Resilience/Hedging/ResilienceHttpClientBuilderExtensions.Hedging.cs +++ b/src/Libraries/Microsoft.Extensions.Http.Resilience/Hedging/ResilienceHttpClientBuilderExtensions.Hedging.cs @@ -3,6 +3,7 @@ using System; using System.Net.Http; +using System.Threading; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection.Extensions; using Microsoft.Extensions.Http.Resilience; @@ -139,6 +140,9 @@ public static IStandardHedgingHandlerBuilder AddStandardHedgingHandler(this IHtt }) .SelectPipelineByAuthority(); + // Disable the HttpClient timeout to allow the timeout strategies to control the timeout. + _ = builder.ConfigureHttpClient(client => client.Timeout = Timeout.InfiniteTimeSpan); + return new StandardHedgingHandlerBuilder(builder.Name, builder.Services, routingBuilder); } diff --git a/src/Libraries/Microsoft.Extensions.Http.Resilience/Resilience/ResilienceHttpClientBuilderExtensions.StandardResilience.cs b/src/Libraries/Microsoft.Extensions.Http.Resilience/Resilience/ResilienceHttpClientBuilderExtensions.StandardResilience.cs index 5f5f80b8abf..06003b80c3f 100644 --- a/src/Libraries/Microsoft.Extensions.Http.Resilience/Resilience/ResilienceHttpClientBuilderExtensions.StandardResilience.cs +++ b/src/Libraries/Microsoft.Extensions.Http.Resilience/Resilience/ResilienceHttpClientBuilderExtensions.StandardResilience.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. using System; +using System.Threading; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Http.Resilience; @@ -86,6 +87,9 @@ public static IHttpStandardResiliencePipelineBuilder AddStandardResilienceHandle .AddTimeout(options.AttemptTimeout); }); + // Disable the HttpClient timeout to allow the timeout strategies to control the timeout. + _ = builder.ConfigureHttpClient(client => client.Timeout = Timeout.InfiniteTimeSpan); + return new HttpStandardResiliencePipelineBuilder(optionsName, builder.Services); } diff --git a/test/Libraries/Microsoft.Extensions.Http.Resilience.Tests/Hedging/StandardHedgingTests.cs b/test/Libraries/Microsoft.Extensions.Http.Resilience.Tests/Hedging/StandardHedgingTests.cs index 61905e8a054..cd53c4d00e2 100644 --- a/test/Libraries/Microsoft.Extensions.Http.Resilience.Tests/Hedging/StandardHedgingTests.cs +++ b/test/Libraries/Microsoft.Extensions.Http.Resilience.Tests/Hedging/StandardHedgingTests.cs @@ -246,6 +246,14 @@ public async Task DynamicReloads_Ok() AssertNoResponse(); } + [Fact] + public void AddStandardResilienceHandler_EnsureHttpClientTimeoutDisabled() + { + var client = CreateClientWithHandler(); + + client.Timeout.Should().Be(Timeout.InfiniteTimeSpan); + } + [Fact] public async Task NoRouting_Ok() { diff --git a/test/Libraries/Microsoft.Extensions.Http.Resilience.Tests/Resilience/HttpClientBuilderExtensionsTests.Standard.cs b/test/Libraries/Microsoft.Extensions.Http.Resilience.Tests/Resilience/HttpClientBuilderExtensionsTests.Standard.cs index 502ac1c5fc2..0ca8b521c40 100644 --- a/test/Libraries/Microsoft.Extensions.Http.Resilience.Tests/Resilience/HttpClientBuilderExtensionsTests.Standard.cs +++ b/test/Libraries/Microsoft.Extensions.Http.Resilience.Tests/Resilience/HttpClientBuilderExtensionsTests.Standard.cs @@ -5,6 +5,7 @@ using System.Collections.Generic; using System.Net; using System.Net.Http; +using System.Threading; using System.Threading.Tasks; using FluentAssertions; using Microsoft.Extensions.Configuration; @@ -234,6 +235,16 @@ public async Task DynamicReloads_Ok() requests.Should().HaveCount(11); } + [Fact] + public void AddStandardResilienceHandler_EnsureHttpClientTimeoutDisabled() + { + var builder = new ServiceCollection().AddLogging().AddMetrics().AddHttpClient("test").AddStandardHedgingHandler(); + + using var client = builder.Services.BuildServiceProvider().GetRequiredService().CreateClient("test"); + + client.Timeout.Should().Be(Timeout.InfiniteTimeSpan); + } + private static void AddStandardResilienceHandler( MethodArgs mode, IHttpClientBuilder builder, From 2750750fa5996d3e7819bbb6425c63f179e5500d Mon Sep 17 00:00:00 2001 From: Nikita Balabaev Date: Mon, 8 Jan 2024 19:36:28 +0100 Subject: [PATCH 132/172] Don't fail the build if the GitHubComment failed (#4864) --- eng/pipelines/templates/VerifyCoverageReport.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/eng/pipelines/templates/VerifyCoverageReport.yml b/eng/pipelines/templates/VerifyCoverageReport.yml index 5c55d4d42de..337402dd399 100644 --- a/eng/pipelines/templates/VerifyCoverageReport.yml +++ b/eng/pipelines/templates/VerifyCoverageReport.yml @@ -39,3 +39,4 @@ steps: repositoryName: '$(Build.Repository.Name)' id: $(System.PullRequest.PullRequestNumber) displayName: Report coverage to GitHub + continueOnError: 'true' # Avoid failing the build if the GitHub comment posting failed From ff43940bf30078eb129512e161851cd1e1b8451a Mon Sep 17 00:00:00 2001 From: Martin Taillefer Date: Mon, 8 Jan 2024 12:53:49 -0600 Subject: [PATCH 133/172] Expose the ResilienceHandler type. (#4858) Fixes #4759 Co-authored-by: Martin Taillefer --- ...icrosoft.Extensions.Http.Resilience.csproj | 1 + .../{Internal => }/ResilienceHandler.cs | 39 ++++++++++++++++--- .../Resilience/ResilienceHandlerTest.cs | 2 +- 3 files changed, 36 insertions(+), 6 deletions(-) rename src/Libraries/Microsoft.Extensions.Http.Resilience/Resilience/{Internal => }/ResilienceHandler.cs (64%) diff --git a/src/Libraries/Microsoft.Extensions.Http.Resilience/Microsoft.Extensions.Http.Resilience.csproj b/src/Libraries/Microsoft.Extensions.Http.Resilience/Microsoft.Extensions.Http.Resilience.csproj index 26ad109d592..ac92ad2d833 100644 --- a/src/Libraries/Microsoft.Extensions.Http.Resilience/Microsoft.Extensions.Http.Resilience.csproj +++ b/src/Libraries/Microsoft.Extensions.Http.Resilience/Microsoft.Extensions.Http.Resilience.csproj @@ -15,6 +15,7 @@ true true true + true diff --git a/src/Libraries/Microsoft.Extensions.Http.Resilience/Resilience/Internal/ResilienceHandler.cs b/src/Libraries/Microsoft.Extensions.Http.Resilience/Resilience/ResilienceHandler.cs similarity index 64% rename from src/Libraries/Microsoft.Extensions.Http.Resilience/Resilience/Internal/ResilienceHandler.cs rename to src/Libraries/Microsoft.Extensions.Http.Resilience/Resilience/ResilienceHandler.cs index 5e979cf835c..a79d62e0975 100644 --- a/src/Libraries/Microsoft.Extensions.Http.Resilience/Resilience/Internal/ResilienceHandler.cs +++ b/src/Libraries/Microsoft.Extensions.Http.Resilience/Resilience/ResilienceHandler.cs @@ -2,29 +2,58 @@ // The .NET Foundation licenses this file to you under the MIT license. using System; +using System.Diagnostics.CodeAnalysis; using System.Net.Http; using System.Threading; using System.Threading.Tasks; using Microsoft.Extensions.Http.Diagnostics; +using Microsoft.Extensions.Http.Resilience.Internal; +using Microsoft.Shared.DiagnosticIds; +using Microsoft.Shared.Diagnostics; using Polly; -namespace Microsoft.Extensions.Http.Resilience.Internal; +namespace Microsoft.Extensions.Http.Resilience; /// -/// Base class for resilience handler, i.e. handlers that use resilience strategies to send the requests. +/// Base class for resilience handler, i.e. handlers that use resilience strategies to send the requests. /// -internal sealed class ResilienceHandler : DelegatingHandler +[Experimental(diagnosticId: DiagnosticIds.Experiments.Resilience, UrlFormat = DiagnosticIds.UrlFormat)] +public class ResilienceHandler : DelegatingHandler { private readonly Func> _pipelineProvider; + /// + /// Initializes a new instance of the class. + /// + /// The pipeline provider that supplies pipelines in response to an http message. + /// If is . public ResilienceHandler(Func> pipelineProvider) { - _pipelineProvider = pipelineProvider; + _pipelineProvider = Throw.IfNull(pipelineProvider); } - /// + /// + /// Initializes a new instance of the class. + /// + /// The pipeline to use for the message. + /// If is . + public ResilienceHandler(ResiliencePipeline pipeline) + { + _ = Throw.IfNull(pipeline); + _pipelineProvider = _ => pipeline; + } + + /// + /// Sends an HTTP request to the inner handler to send to the server as an asynchronous operation. + /// + /// The HTTP request message to send to the server. + /// A cancellation token to cancel operation. + /// The task object representing the asynchronous operation. + /// If is . protected override async Task SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) { + _ = Throw.IfNull(request); + var pipeline = _pipelineProvider(request); var created = false; if (request.GetResilienceContext() is not ResilienceContext context) diff --git a/test/Libraries/Microsoft.Extensions.Http.Resilience.Tests/Resilience/ResilienceHandlerTest.cs b/test/Libraries/Microsoft.Extensions.Http.Resilience.Tests/Resilience/ResilienceHandlerTest.cs index 19413422148..45840010e87 100644 --- a/test/Libraries/Microsoft.Extensions.Http.Resilience.Tests/Resilience/ResilienceHandlerTest.cs +++ b/test/Libraries/Microsoft.Extensions.Http.Resilience.Tests/Resilience/ResilienceHandlerTest.cs @@ -22,7 +22,7 @@ public class ResilienceHandlerTest [Theory] public async Task SendAsync_EnsureRequestMetadataFlows(bool resilienceContextSet) { - using var handler = new ResilienceHandler(_ => ResiliencePipeline.Empty); + using var handler = new ResilienceHandler(ResiliencePipeline.Empty); using var invoker = new HttpMessageInvoker(handler); using var request = new HttpRequestMessage(); From 3330486a761b7e2a17e65325cd79aeb71452a8fd Mon Sep 17 00:00:00 2001 From: Pavel Ivanov Date: Tue, 9 Jan 2024 23:42:49 +0500 Subject: [PATCH 134/172] Context switching can affect timer triggering (#4861) * reset gate under the lock * add a unit test to reproduce the context-switching effect on the timer callback --- .../FakeTimeProvider.cs | 15 ++++++---- .../FakeTimeProviderTests.cs | 28 +++++++++++++++++++ 2 files changed, 37 insertions(+), 6 deletions(-) diff --git a/src/Libraries/Microsoft.Extensions.TimeProvider.Testing/FakeTimeProvider.cs b/src/Libraries/Microsoft.Extensions.TimeProvider.Testing/FakeTimeProvider.cs index f6ef2a32fd1..d4b8caa60ba 100644 --- a/src/Libraries/Microsoft.Extensions.TimeProvider.Testing/FakeTimeProvider.cs +++ b/src/Libraries/Microsoft.Extensions.TimeProvider.Testing/FakeTimeProvider.cs @@ -194,6 +194,8 @@ internal void AddWaiter(Waiter waiter, long dueTime) WakeWaiters(); } + internal event EventHandler? GateOpening; + private void WakeWaiters() { if (Interlocked.CompareExchange(ref _wakeWaitersGate, 1, 0) == 1) @@ -234,13 +236,14 @@ private void WakeWaiters() candidate = waiter; } } - } - if (candidate == null) - { - // didn't find a candidate to wake, we're done - _wakeWaitersGate = 0; - return; + if (candidate == null) + { + // didn't find a candidate to wake, we're done + GateOpening?.Invoke(this, EventArgs.Empty); + _wakeWaitersGate = 0; + return; + } } var oldTicks = _now.Ticks; diff --git a/test/Libraries/Microsoft.Extensions.TimeProvider.Testing.Tests/FakeTimeProviderTests.cs b/test/Libraries/Microsoft.Extensions.TimeProvider.Testing.Tests/FakeTimeProviderTests.cs index 66561a30af9..055ac5dc496 100644 --- a/test/Libraries/Microsoft.Extensions.TimeProvider.Testing.Tests/FakeTimeProviderTests.cs +++ b/test/Libraries/Microsoft.Extensions.TimeProvider.Testing.Tests/FakeTimeProviderTests.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. using System; +using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; using Microsoft.Extensions.Time.Testing; @@ -361,4 +362,31 @@ public void AdvanceTimeInCallback() Assert.True(true, "Yay, we didn't enter an infinite loop!"); } + + [Fact] + public void ShouldResetGateUnderLock_PreventingContextSwitching_AffectionOnTimerCallback() + { + // Arrange + var provider = new FakeTimeProvider { AutoAdvanceAmount = TimeSpan.FromSeconds(2) }; + var calls = new List(); + using var timer = provider.CreateTimer(calls.Add, "timer-1", TimeSpan.FromSeconds(3), TimeSpan.Zero); + var th = new Thread(() => provider.GetUtcNow()); + provider.GateOpening += (_, _) => + { + if (!th.IsAlive) + { + th.Start(); + } + + // use a timeout to prevent deadlock + th.Join(TimeSpan.FromMilliseconds(200)); + }; + + // Act + provider.GetUtcNow(); + th.Join(); + + // Assert + Assert.Single(calls); + } } From d5d15f9fb777ff5572dc3fa1673c2e2704da0193 Mon Sep 17 00:00:00 2001 From: Jose Perez Rodriguez Date: Tue, 9 Jan 2024 16:01:53 -0800 Subject: [PATCH 135/172] Increase minimum code coverage for Microsoft.Extensions.Http.Diagnostics (#4870) Context: https://github.com/dotnet/extensions/pull/4868#issuecomment-1883496153 --- .../Microsoft.Extensions.Http.Diagnostics.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Libraries/Microsoft.Extensions.Http.Diagnostics/Microsoft.Extensions.Http.Diagnostics.csproj b/src/Libraries/Microsoft.Extensions.Http.Diagnostics/Microsoft.Extensions.Http.Diagnostics.csproj index 00cc5c466d6..0ecc1a45bc3 100644 --- a/src/Libraries/Microsoft.Extensions.Http.Diagnostics/Microsoft.Extensions.Http.Diagnostics.csproj +++ b/src/Libraries/Microsoft.Extensions.Http.Diagnostics/Microsoft.Extensions.Http.Diagnostics.csproj @@ -27,7 +27,7 @@ normal - 91 + 94 78 From 7db3a7edc35ae8008c75631da35c01467912cacf Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Wed, 10 Jan 2024 17:55:24 +0000 Subject: [PATCH 136/172] Update dependencies from https://github.com/dotnet/arcade build 20240109.4 (#4872) [main] Update dependencies from dotnet/arcade - Coherency Updates: - Microsoft.Bcl.TimeProvider: from 8.0.1 to 8.0.1 (parent: Microsoft.AspNetCore.App.Runtime.win-x64) - Microsoft.Extensions.Caching.Abstractions: from 8.0.0 to 8.0.0 (parent: Microsoft.AspNetCore.App.Runtime.win-x64) - Microsoft.Extensions.Caching.Memory: from 8.0.0 to 8.0.0 (parent: Microsoft.AspNetCore.App.Runtime.win-x64) - Microsoft.Extensions.Configuration.Abstractions: from 8.0.0 to 8.0.0 (parent: Microsoft.AspNetCore.App.Runtime.win-x64) - Microsoft.Extensions.Configuration.Binder: from 8.0.1 to 8.0.1 (parent: Microsoft.AspNetCore.App.Runtime.win-x64) - Microsoft.Extensions.Configuration.CommandLine: from 8.0.0 to 8.0.0 (parent: Microsoft.AspNetCore.App.Runtime.win-x64) - Microsoft.Extensions.Configuration.Json: from 8.0.0 to 8.0.0 (parent: Microsoft.AspNetCore.App.Runtime.win-x64) - Microsoft.Extensions.Configuration: from 8.0.0 to 8.0.0 (parent: Microsoft.AspNetCore.App.Runtime.win-x64) - Microsoft.Extensions.DependencyInjection.Abstractions: from 8.0.0 to 8.0.0 (parent: Microsoft.AspNetCore.App.Runtime.win-x64) - Microsoft.Extensions.DependencyInjection: from 8.0.0 to 8.0.0 (parent: Microsoft.AspNetCore.App.Runtime.win-x64) - Microsoft.Extensions.Diagnostics: from 8.0.0 to 8.0.0 (parent: Microsoft.AspNetCore.App.Runtime.win-x64) - Microsoft.Extensions.Hosting.Abstractions: from 8.0.0 to 8.0.0 (parent: Microsoft.AspNetCore.App.Runtime.win-x64) - Microsoft.Extensions.Hosting: from 8.0.0 to 8.0.0 (parent: Microsoft.AspNetCore.App.Runtime.win-x64) - Microsoft.Extensions.Http: from 8.0.0 to 8.0.0 (parent: Microsoft.AspNetCore.App.Runtime.win-x64) - Microsoft.Extensions.Logging.Abstractions: from 8.0.0 to 8.0.0 (parent: Microsoft.AspNetCore.App.Runtime.win-x64) - Microsoft.Extensions.Logging.Configuration: from 8.0.0 to 8.0.0 (parent: Microsoft.AspNetCore.App.Runtime.win-x64) - Microsoft.Extensions.Logging.Console: from 8.0.0 to 8.0.0 (parent: Microsoft.AspNetCore.App.Runtime.win-x64) - Microsoft.Extensions.Logging: from 8.0.0 to 8.0.0 (parent: Microsoft.AspNetCore.App.Runtime.win-x64) - Microsoft.Extensions.Options.ConfigurationExtensions: from 8.0.0 to 8.0.0 (parent: Microsoft.AspNetCore.App.Runtime.win-x64) - Microsoft.Extensions.Options.DataAnnotations: from 8.0.0 to 8.0.0 (parent: Microsoft.AspNetCore.App.Runtime.win-x64) - Microsoft.Extensions.Options: from 8.0.1 to 8.0.1 (parent: Microsoft.AspNetCore.App.Runtime.win-x64) - Microsoft.Extensions.Primitives: from 8.0.0 to 8.0.0 (parent: Microsoft.AspNetCore.App.Runtime.win-x64) - System.Collections.Immutable: from 8.0.0 to 8.0.0 (parent: Microsoft.AspNetCore.App.Runtime.win-x64) - System.Configuration.ConfigurationManager: from 8.0.0 to 8.0.0 (parent: Microsoft.AspNetCore.App.Runtime.win-x64) - System.Diagnostics.DiagnosticSource: from 8.0.0 to 8.0.0 (parent: Microsoft.AspNetCore.App.Runtime.win-x64) - System.Diagnostics.PerformanceCounter: from 8.0.0 to 8.0.0 (parent: Microsoft.AspNetCore.App.Runtime.win-x64) - System.IO.Hashing: from 8.0.0 to 8.0.0 (parent: Microsoft.AspNetCore.App.Runtime.win-x64) - System.Net.Http.Json: from 8.0.0 to 8.0.0 (parent: Microsoft.AspNetCore.App.Runtime.win-x64) - System.Security.Cryptography.Pkcs: from 8.0.0 to 8.0.0 (parent: Microsoft.AspNetCore.App.Runtime.win-x64) - System.Security.Cryptography.Xml: from 8.0.0 to 8.0.0 (parent: Microsoft.AspNetCore.App.Runtime.win-x64) - System.Text.Encodings.Web: from 8.0.0 to 8.0.0 (parent: Microsoft.AspNetCore.App.Runtime.win-x64) - System.Text.Json: from 8.0.1 to 8.0.1 (parent: Microsoft.AspNetCore.App.Runtime.win-x64) - System.Runtime.Caching: from 8.0.0 to 8.0.0 (parent: Microsoft.AspNetCore.App.Runtime.win-x64) --- NuGet.config | 24 +++++- eng/Version.Details.xml | 74 +++++++++---------- eng/common/darc-init.ps1 | 2 +- eng/common/darc-init.sh | 2 +- .../post-build/add-build-to-channel.ps1 | 2 +- eng/common/post-build/publish-using-darc.ps1 | 2 +- .../post-build/trigger-subscriptions.ps1 | 2 +- eng/common/templates/job/job.yml | 2 +- .../templates/job/publish-build-assets.yml | 4 +- .../templates/post-build/common-variables.yml | 2 +- .../templates/post-build/post-build.yml | 4 +- eng/common/tools.ps1 | 10 ++- eng/common/tools.sh | 7 +- global.json | 8 +- 14 files changed, 89 insertions(+), 56 deletions(-) diff --git a/NuGet.config b/NuGet.config index 3ac6622678d..0f94a1f6394 100644 --- a/NuGet.config +++ b/NuGet.config @@ -3,8 +3,15 @@ + + + + + - + + + @@ -38,5 +45,18 @@ - + + + + + + + + + + + + + + diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index ca0078f1801..51a4fb0b76b 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,135 +1,135 @@ - https://github.com/dotnet/runtime + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime bf5e279d9239bfef5bb1b8d6212f1b971c434606 - https://github.com/dotnet/runtime + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime 5535e31a712343a63f5d7d796cd874e563e5ac14 - https://github.com/dotnet/runtime + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime 5535e31a712343a63f5d7d796cd874e563e5ac14 - https://github.com/dotnet/runtime + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime 5535e31a712343a63f5d7d796cd874e563e5ac14 - https://github.com/dotnet/runtime + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime bf5e279d9239bfef5bb1b8d6212f1b971c434606 - https://github.com/dotnet/runtime + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime 5535e31a712343a63f5d7d796cd874e563e5ac14 - https://github.com/dotnet/runtime + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime 5535e31a712343a63f5d7d796cd874e563e5ac14 - https://github.com/dotnet/runtime + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime 5535e31a712343a63f5d7d796cd874e563e5ac14 - https://github.com/dotnet/runtime + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime 5535e31a712343a63f5d7d796cd874e563e5ac14 - https://github.com/dotnet/runtime + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime 5535e31a712343a63f5d7d796cd874e563e5ac14 - https://github.com/dotnet/runtime + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime 5535e31a712343a63f5d7d796cd874e563e5ac14 - https://github.com/dotnet/runtime + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime 5535e31a712343a63f5d7d796cd874e563e5ac14 - https://github.com/dotnet/runtime + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime 5535e31a712343a63f5d7d796cd874e563e5ac14 - https://github.com/dotnet/runtime + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime 5535e31a712343a63f5d7d796cd874e563e5ac14 - https://github.com/dotnet/runtime + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime 5535e31a712343a63f5d7d796cd874e563e5ac14 - https://github.com/dotnet/runtime + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime 5535e31a712343a63f5d7d796cd874e563e5ac14 - https://github.com/dotnet/runtime + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime 5535e31a712343a63f5d7d796cd874e563e5ac14 - https://github.com/dotnet/runtime + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime 5535e31a712343a63f5d7d796cd874e563e5ac14 - https://github.com/dotnet/runtime + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime 5535e31a712343a63f5d7d796cd874e563e5ac14 - https://github.com/dotnet/runtime + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime 5535e31a712343a63f5d7d796cd874e563e5ac14 - https://github.com/dotnet/runtime + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime bf5e279d9239bfef5bb1b8d6212f1b971c434606 - https://github.com/dotnet/runtime + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime 5535e31a712343a63f5d7d796cd874e563e5ac14 - https://github.com/dotnet/runtime + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime 5535e31a712343a63f5d7d796cd874e563e5ac14 - https://github.com/dotnet/runtime + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime 5535e31a712343a63f5d7d796cd874e563e5ac14 - https://github.com/dotnet/runtime + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime 5535e31a712343a63f5d7d796cd874e563e5ac14 - https://github.com/dotnet/runtime + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime 5535e31a712343a63f5d7d796cd874e563e5ac14 - https://github.com/dotnet/runtime + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime 5535e31a712343a63f5d7d796cd874e563e5ac14 - https://github.com/dotnet/runtime + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime 5535e31a712343a63f5d7d796cd874e563e5ac14 - https://github.com/dotnet/runtime + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime 5535e31a712343a63f5d7d796cd874e563e5ac14 - https://github.com/dotnet/runtime + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime 5535e31a712343a63f5d7d796cd874e563e5ac14 - https://github.com/dotnet/runtime + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime 5535e31a712343a63f5d7d796cd874e563e5ac14 - https://github.com/dotnet/runtime + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime bf5e279d9239bfef5bb1b8d6212f1b971c434606 - https://github.com/dotnet/runtime + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime 5535e31a712343a63f5d7d796cd874e563e5ac14 @@ -170,13 +170,13 @@ - + https://github.com/dotnet/arcade - 0aaeafef60933f87b0b50350313bb2fd77defb5d + 61ae141d2bf3534619265c8f691fd55dc3e75147 - + https://github.com/dotnet/arcade - 0aaeafef60933f87b0b50350313bb2fd77defb5d + 61ae141d2bf3534619265c8f691fd55dc3e75147 diff --git a/eng/common/darc-init.ps1 b/eng/common/darc-init.ps1 index 435e7641341..8fda30bdce2 100644 --- a/eng/common/darc-init.ps1 +++ b/eng/common/darc-init.ps1 @@ -1,6 +1,6 @@ param ( $darcVersion = $null, - $versionEndpoint = 'https://maestro-prod.westus2.cloudapp.azure.com/api/assets/darc-version?api-version=2019-01-16', + $versionEndpoint = 'https://maestro.dot.net/api/assets/darc-version?api-version=2019-01-16', $verbosity = 'minimal', $toolpath = $null ) diff --git a/eng/common/darc-init.sh b/eng/common/darc-init.sh index 84c1d0cc2e7..c305ae6bd77 100755 --- a/eng/common/darc-init.sh +++ b/eng/common/darc-init.sh @@ -2,7 +2,7 @@ source="${BASH_SOURCE[0]}" darcVersion='' -versionEndpoint='https://maestro-prod.westus2.cloudapp.azure.com/api/assets/darc-version?api-version=2019-01-16' +versionEndpoint='https://maestro.dot.net/api/assets/darc-version?api-version=2019-01-16' verbosity='minimal' while [[ $# > 0 ]]; do diff --git a/eng/common/post-build/add-build-to-channel.ps1 b/eng/common/post-build/add-build-to-channel.ps1 index de2d957922a..49938f0c89f 100644 --- a/eng/common/post-build/add-build-to-channel.ps1 +++ b/eng/common/post-build/add-build-to-channel.ps1 @@ -2,7 +2,7 @@ param( [Parameter(Mandatory=$true)][int] $BuildId, [Parameter(Mandatory=$true)][int] $ChannelId, [Parameter(Mandatory=$true)][string] $MaestroApiAccessToken, - [Parameter(Mandatory=$false)][string] $MaestroApiEndPoint = 'https://maestro-prod.westus2.cloudapp.azure.com', + [Parameter(Mandatory=$false)][string] $MaestroApiEndPoint = 'https://maestro.dot.net', [Parameter(Mandatory=$false)][string] $MaestroApiVersion = '2019-01-16' ) diff --git a/eng/common/post-build/publish-using-darc.ps1 b/eng/common/post-build/publish-using-darc.ps1 index 8508397d776..1e779fec4dd 100644 --- a/eng/common/post-build/publish-using-darc.ps1 +++ b/eng/common/post-build/publish-using-darc.ps1 @@ -3,7 +3,7 @@ param( [Parameter(Mandatory=$true)][int] $PublishingInfraVersion, [Parameter(Mandatory=$true)][string] $AzdoToken, [Parameter(Mandatory=$true)][string] $MaestroToken, - [Parameter(Mandatory=$false)][string] $MaestroApiEndPoint = 'https://maestro-prod.westus2.cloudapp.azure.com', + [Parameter(Mandatory=$false)][string] $MaestroApiEndPoint = 'https://maestro.dot.net', [Parameter(Mandatory=$true)][string] $WaitPublishingFinish, [Parameter(Mandatory=$false)][string] $ArtifactsPublishingAdditionalParameters, [Parameter(Mandatory=$false)][string] $SymbolPublishingAdditionalParameters diff --git a/eng/common/post-build/trigger-subscriptions.ps1 b/eng/common/post-build/trigger-subscriptions.ps1 index 55dea518ac5..ac9a95778fc 100644 --- a/eng/common/post-build/trigger-subscriptions.ps1 +++ b/eng/common/post-build/trigger-subscriptions.ps1 @@ -2,7 +2,7 @@ param( [Parameter(Mandatory=$true)][string] $SourceRepo, [Parameter(Mandatory=$true)][int] $ChannelId, [Parameter(Mandatory=$true)][string] $MaestroApiAccessToken, - [Parameter(Mandatory=$false)][string] $MaestroApiEndPoint = 'https://maestro-prod.westus2.cloudapp.azure.com', + [Parameter(Mandatory=$false)][string] $MaestroApiEndPoint = 'https://maestro.dot.net', [Parameter(Mandatory=$false)][string] $MaestroApiVersion = '2019-01-16' ) diff --git a/eng/common/templates/job/job.yml b/eng/common/templates/job/job.yml index e20ee3a983c..e24ca2f46f9 100644 --- a/eng/common/templates/job/job.yml +++ b/eng/common/templates/job/job.yml @@ -136,7 +136,7 @@ jobs: condition: and(succeeded(), in(variables['_SignType'], 'real', 'test'), eq(variables['Agent.Os'], 'Windows_NT')) - ${{ if and(eq(parameters.runAsPublic, 'false'), eq(variables['System.TeamProject'], 'internal')) }}: - - task: NuGetAuthenticate@0 + - task: NuGetAuthenticate@1 - ${{ if and(ne(parameters.artifacts.download, 'false'), ne(parameters.artifacts.download, '')) }}: - task: DownloadPipelineArtifact@2 diff --git a/eng/common/templates/job/publish-build-assets.yml b/eng/common/templates/job/publish-build-assets.yml index 42017109f37..fa5446c093d 100644 --- a/eng/common/templates/job/publish-build-assets.yml +++ b/eng/common/templates/job/publish-build-assets.yml @@ -72,7 +72,7 @@ jobs: condition: ${{ parameters.condition }} continueOnError: ${{ parameters.continueOnError }} - - task: NuGetAuthenticate@0 + - task: NuGetAuthenticate@1 - task: PowerShell@2 displayName: Publish Build Assets @@ -81,7 +81,7 @@ jobs: arguments: -task PublishBuildAssets -restore -msbuildEngine dotnet /p:ManifestsPath='$(Build.StagingDirectory)/Download/AssetManifests' /p:BuildAssetRegistryToken=$(MaestroAccessToken) - /p:MaestroApiEndpoint=https://maestro-prod.westus2.cloudapp.azure.com + /p:MaestroApiEndpoint=https://maestro.dot.net /p:PublishUsingPipelines=${{ parameters.publishUsingPipelines }} /p:OfficialBuildId=$(Build.BuildNumber) condition: ${{ parameters.condition }} diff --git a/eng/common/templates/post-build/common-variables.yml b/eng/common/templates/post-build/common-variables.yml index c24193acfc9..173914f2364 100644 --- a/eng/common/templates/post-build/common-variables.yml +++ b/eng/common/templates/post-build/common-variables.yml @@ -7,7 +7,7 @@ variables: # Default Maestro++ API Endpoint and API Version - name: MaestroApiEndPoint - value: "https://maestro-prod.westus2.cloudapp.azure.com" + value: "https://maestro.dot.net" - name: MaestroApiAccessToken value: $(MaestroAccessToken) - name: MaestroApiVersion diff --git a/eng/common/templates/post-build/post-build.yml b/eng/common/templates/post-build/post-build.yml index ef720f9d781..3f74abf7ce0 100644 --- a/eng/common/templates/post-build/post-build.yml +++ b/eng/common/templates/post-build/post-build.yml @@ -169,7 +169,7 @@ stages: # This is necessary whenever we want to publish/restore to an AzDO private feed # Since sdk-task.ps1 tries to restore packages we need to do this authentication here # otherwise it'll complain about accessing a private feed. - - task: NuGetAuthenticate@0 + - task: NuGetAuthenticate@1 displayName: 'Authenticate to AzDO Feeds' # Signing validation will optionally work with the buildmanifest file which is downloaded from @@ -266,7 +266,7 @@ stages: BARBuildId: ${{ parameters.BARBuildId }} PromoteToChannelIds: ${{ parameters.PromoteToChannelIds }} - - task: NuGetAuthenticate@0 + - task: NuGetAuthenticate@1 - task: PowerShell@2 displayName: Publish Using Darc diff --git a/eng/common/tools.ps1 b/eng/common/tools.ps1 index fdd0cbb91f8..eb188cfda41 100644 --- a/eng/common/tools.ps1 +++ b/eng/common/tools.ps1 @@ -601,7 +601,15 @@ function InitializeBuildTool() { ExitWithExitCode 1 } $dotnetPath = Join-Path $dotnetRoot (GetExecutableFileName 'dotnet') - $buildTool = @{ Path = $dotnetPath; Command = 'msbuild'; Tool = 'dotnet'; Framework = 'net8.0' } + + # Use override if it exists - commonly set by source-build + if ($null -eq $env:_OverrideArcadeInitializeBuildToolFramework) { + $initializeBuildToolFramework="net8.0" + } else { + $initializeBuildToolFramework=$env:_OverrideArcadeInitializeBuildToolFramework + } + + $buildTool = @{ Path = $dotnetPath; Command = 'msbuild'; Tool = 'dotnet'; Framework = $initializeBuildToolFramework } } elseif ($msbuildEngine -eq "vs") { try { $msbuildPath = InitializeVisualStudioMSBuild -install:$restore diff --git a/eng/common/tools.sh b/eng/common/tools.sh index e8d47894334..3392e3a9992 100755 --- a/eng/common/tools.sh +++ b/eng/common/tools.sh @@ -341,7 +341,12 @@ function InitializeBuildTool { # return values _InitializeBuildTool="$_InitializeDotNetCli/dotnet" _InitializeBuildToolCommand="msbuild" - _InitializeBuildToolFramework="net8.0" + # use override if it exists - commonly set by source-build + if [[ "${_OverrideArcadeInitializeBuildToolFramework:-x}" == "x" ]]; then + _InitializeBuildToolFramework="net8.0" + else + _InitializeBuildToolFramework="${_OverrideArcadeInitializeBuildToolFramework}" + fi } # Set RestoreNoCache as a workaround for https://github.com/NuGet/Home/issues/3116 diff --git a/global.json b/global.json index c8d8037117f..af41c30bd37 100644 --- a/global.json +++ b/global.json @@ -1,9 +1,9 @@ { "sdk": { - "version": "8.0.100" + "version": "8.0.101" }, "tools": { - "dotnet": "8.0.100", + "dotnet": "8.0.101", "runtimes": { "dotnet/x64": [ "6.0.22" @@ -16,7 +16,7 @@ "msbuild-sdks": { "Microsoft.Build.NoTargets": "3.7.0", "Microsoft.Build.Traversal": "3.2.0", - "Microsoft.DotNet.Arcade.Sdk": "8.0.0-beta.23564.4", - "Microsoft.DotNet.Helix.Sdk": "8.0.0-beta.23564.4" + "Microsoft.DotNet.Arcade.Sdk": "8.0.0-beta.24059.4", + "Microsoft.DotNet.Helix.Sdk": "8.0.0-beta.24059.4" } } From d58517b455f1182b555e5cc4ad48cb2936f0221b Mon Sep 17 00:00:00 2001 From: Eric Erhardt Date: Thu, 11 Jan 2024 18:01:52 -0600 Subject: [PATCH 137/172] Enable AOT compatibility for all libraries (#4871) * Enable AOT compatibility for all libraries (#4625) * Enable AOT compatibility for all libraries. Fix warnings. - Enable configuration binder source generator - The only library that can't use the ConfigBinder SG is the HeaderParsing library. - Blocked by https://github.com/dotnet/runtime/issues/94547 * Fix Compliance Redaction. * Explicitly reference Microsoft.Extensions.Configuration.Binder For all libraries that use the Configuration.Binder source generator, explicitly reference the NuGet package. This ensures we get the latest version (8.0.1), which has all the source generator fixes. * Respond to PR feedback. - Change ArgumentNullException to normal ArgumentException - Add tests to LoggingRedactionOptions collection setters to keep 100% code coverage. https://github.com/dotnet/runtime/issues/96873 causes these setters to no longer be called in the existing tests. --- Directory.Build.props | 6 --- src/Libraries/Directory.Build.props | 1 + ...ncyTelemetryServiceCollectionExtensions.cs | 6 --- .../HttpLoggingServiceCollectionExtensions.cs | 2 +- ...t.AspNetCore.Diagnostics.Middleware.csproj | 2 + .../Microsoft.AspNetCore.HeaderParsing.csproj | 2 + ...pplicationMetadataHostBuilderExtensions.cs | 7 ---- ...tionMetadataServiceCollectionExtensions.cs | 6 --- ...ensions.AmbientMetadata.Application.csproj | 5 +++ ...oft.Extensions.Compliance.Redaction.csproj | 2 + .../RedactionExtensions.cs | 6 --- .../FakeRedactionBuilderExtensions.cs | 4 -- ...osoft.Extensions.Compliance.Testing.csproj | 2 + .../AutoActivationExtensions.Keyed.cs | 12 +++--- .../AutoActivationExtensions.cs | 12 +++--- .../HttpExceptionSummaryProvider.cs | 10 +++++ ...ons.Diagnostics.HealthChecks.Common.csproj | 4 +- ...cs.HealthChecks.ResourceUtilization.csproj | 2 + ...esourceUtilizationHealthCheckExtensions.cs | 16 -------- .../KubernetesProbesExtensions.cs | 2 +- ...osoft.Extensions.Diagnostics.Probes.csproj | 2 + ...ions.Diagnostics.ResourceMonitoring.csproj | 2 + .../ResourceMonitoringBuilderExtensions.cs | 5 --- .../Logging/FakeLoggerBuilderExtensions.cs | 6 --- ...soft.Extensions.Diagnostics.Testing.csproj | 3 ++ .../HttpClientLatencyTelemetryExtensions.cs | 6 --- ...lientLoggingHttpClientBuilderExtensions.cs | 9 ----- ...lientLoggingServiceCollectionExtensions.cs | 5 --- ...crosoft.Extensions.Http.Diagnostics.csproj | 2 + ...StandardHedgingHandlerBuilderExtensions.cs | 9 +++-- ...icrosoft.Extensions.Http.Resilience.csproj | 5 +++ ...dardResiliencePipelineBuilderExtensions.cs | 9 +++-- .../ObjectPoolServiceCollectionExtensions.cs | 5 --- ...tionEnricherServiceCollectionExtensions.cs | 6 --- ...cessEnricherServiceCollectionExtensions.cs | 6 --- .../Latency/LatencyConsoleExtensions.cs | 6 --- .../Latency/LatencyContextExtensions.cs | 6 --- .../Microsoft.Extensions.Telemetry.csproj | 2 + .../HttpLoggingServiceExtensionsTests.cs | 39 +++++++++++++++++++ .../Hedging/StandardHedgingTests.cs | 4 +- ...tpClientBuilderExtensionsTests.Standard.cs | 2 +- 41 files changed, 113 insertions(+), 135 deletions(-) diff --git a/Directory.Build.props b/Directory.Build.props index 24c1bb96cae..cea28e22ade 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -90,12 +90,6 @@ $(MicrosoftCodeAnalysisCSharpVersion) - - - - - - diff --git a/src/Libraries/Directory.Build.props b/src/Libraries/Directory.Build.props index 518a00ad5b8..5dabc150a2c 100644 --- a/src/Libraries/Directory.Build.props +++ b/src/Libraries/Directory.Build.props @@ -4,6 +4,7 @@ $(NetCoreTargetFrameworks)$(ConditionalNet462) true + true true true diff --git a/src/Libraries/Microsoft.AspNetCore.Diagnostics.Middleware/Latency/RequestLatencyTelemetryServiceCollectionExtensions.cs b/src/Libraries/Microsoft.AspNetCore.Diagnostics.Middleware/Latency/RequestLatencyTelemetryServiceCollectionExtensions.cs index a6b7876fb8e..db2c76df323 100644 --- a/src/Libraries/Microsoft.AspNetCore.Diagnostics.Middleware/Latency/RequestLatencyTelemetryServiceCollectionExtensions.cs +++ b/src/Libraries/Microsoft.AspNetCore.Diagnostics.Middleware/Latency/RequestLatencyTelemetryServiceCollectionExtensions.cs @@ -2,7 +2,6 @@ // The .NET Foundation licenses this file to you under the MIT license. using System; -using System.Diagnostics.CodeAnalysis; using Microsoft.AspNetCore.Diagnostics.Latency; using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.Configuration; @@ -64,11 +63,6 @@ public static IServiceCollection AddRequestLatencyTelemetry(this IServiceCollect /// Configuration of . /// The value of . /// Either or is . - [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.PublicParameterlessConstructor, type: typeof(RequestLatencyTelemetryOptions))] - [UnconditionalSuppressMessage( - "Trimming", - "IL2026:Members annotated with 'RequiresUnreferencedCodeAttribute' require dynamic access otherwise can break functionality when trimming application code", - Justification = "Addressed with [DynamicDependency]")] public static IServiceCollection AddRequestLatencyTelemetry(this IServiceCollection services, IConfigurationSection section) => Throw.IfNull(services) .Configure(Throw.IfNull(section)) diff --git a/src/Libraries/Microsoft.AspNetCore.Diagnostics.Middleware/Logging/HttpLoggingServiceCollectionExtensions.cs b/src/Libraries/Microsoft.AspNetCore.Diagnostics.Middleware/Logging/HttpLoggingServiceCollectionExtensions.cs index a8c6da4bd75..7de962db012 100644 --- a/src/Libraries/Microsoft.AspNetCore.Diagnostics.Middleware/Logging/HttpLoggingServiceCollectionExtensions.cs +++ b/src/Libraries/Microsoft.AspNetCore.Diagnostics.Middleware/Logging/HttpLoggingServiceCollectionExtensions.cs @@ -60,7 +60,7 @@ public static IServiceCollection AddHttpLoggingRedaction(this IServiceCollection { _ = Throw.IfNull(section); - return services.AddHttpLoggingRedaction(section.Bind); + return services.AddHttpLoggingRedaction(o => section.Bind(o)); } /// diff --git a/src/Libraries/Microsoft.AspNetCore.Diagnostics.Middleware/Microsoft.AspNetCore.Diagnostics.Middleware.csproj b/src/Libraries/Microsoft.AspNetCore.Diagnostics.Middleware/Microsoft.AspNetCore.Diagnostics.Middleware.csproj index 89262b07f64..654e36f481f 100644 --- a/src/Libraries/Microsoft.AspNetCore.Diagnostics.Middleware/Microsoft.AspNetCore.Diagnostics.Middleware.csproj +++ b/src/Libraries/Microsoft.AspNetCore.Diagnostics.Middleware/Microsoft.AspNetCore.Diagnostics.Middleware.csproj @@ -8,6 +8,7 @@ $(NetCoreTargetFrameworks) + true true false false @@ -38,6 +39,7 @@ + diff --git a/src/Libraries/Microsoft.AspNetCore.HeaderParsing/Microsoft.AspNetCore.HeaderParsing.csproj b/src/Libraries/Microsoft.AspNetCore.HeaderParsing/Microsoft.AspNetCore.HeaderParsing.csproj index 1a37baabfdf..70cf5f0290f 100644 --- a/src/Libraries/Microsoft.AspNetCore.HeaderParsing/Microsoft.AspNetCore.HeaderParsing.csproj +++ b/src/Libraries/Microsoft.AspNetCore.HeaderParsing/Microsoft.AspNetCore.HeaderParsing.csproj @@ -8,6 +8,8 @@ $(NetCoreTargetFrameworks) + + false true true true diff --git a/src/Libraries/Microsoft.Extensions.AmbientMetadata.Application/ApplicationMetadataHostBuilderExtensions.cs b/src/Libraries/Microsoft.Extensions.AmbientMetadata.Application/ApplicationMetadataHostBuilderExtensions.cs index 9ad46f152cb..e2635bbcc4d 100644 --- a/src/Libraries/Microsoft.Extensions.AmbientMetadata.Application/ApplicationMetadataHostBuilderExtensions.cs +++ b/src/Libraries/Microsoft.Extensions.AmbientMetadata.Application/ApplicationMetadataHostBuilderExtensions.cs @@ -2,8 +2,6 @@ // The .NET Foundation licenses this file to you under the MIT license. using System; -using System.Diagnostics.CodeAnalysis; -using Microsoft.Extensions.AmbientMetadata; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Shared.Diagnostics; @@ -25,11 +23,6 @@ public static class ApplicationMetadataHostBuilderExtensions /// The value of . /// is . /// is either , empty, or whitespace. - [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.PublicParameterlessConstructor, typeof(ApplicationMetadata))] - [UnconditionalSuppressMessage( - "Trimming", - "IL2026:Members annotated with 'RequiresUnreferencedCodeAttribute' require dynamic access otherwise can break functionality when trimming application code", - Justification = "Addressed with [DynamicDependency]")] public static IHostBuilder UseApplicationMetadata(this IHostBuilder builder, string sectionName = DefaultSectionName) { _ = Throw.IfNull(builder); diff --git a/src/Libraries/Microsoft.Extensions.AmbientMetadata.Application/ApplicationMetadataServiceCollectionExtensions.cs b/src/Libraries/Microsoft.Extensions.AmbientMetadata.Application/ApplicationMetadataServiceCollectionExtensions.cs index 3734d8686f4..bc08c2a60e9 100644 --- a/src/Libraries/Microsoft.Extensions.AmbientMetadata.Application/ApplicationMetadataServiceCollectionExtensions.cs +++ b/src/Libraries/Microsoft.Extensions.AmbientMetadata.Application/ApplicationMetadataServiceCollectionExtensions.cs @@ -2,7 +2,6 @@ // The .NET Foundation licenses this file to you under the MIT license. using System; -using System.Diagnostics.CodeAnalysis; using Microsoft.Extensions.AmbientMetadata; using Microsoft.Extensions.Configuration; using Microsoft.Shared.Diagnostics; @@ -21,11 +20,6 @@ public static class ApplicationMetadataServiceCollectionExtensions /// The configuration section to bind. /// The value of . /// or is . - [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.PublicParameterlessConstructor, typeof(ApplicationMetadata))] - [UnconditionalSuppressMessage( - "Trimming", - "IL2026:Members annotated with 'RequiresUnreferencedCodeAttribute' require dynamic access otherwise can break functionality when trimming application code", - Justification = "Addressed with [DynamicDependency]")] public static IServiceCollection AddApplicationMetadata(this IServiceCollection services, IConfigurationSection section) { _ = Throw.IfNull(services); diff --git a/src/Libraries/Microsoft.Extensions.AmbientMetadata.Application/Microsoft.Extensions.AmbientMetadata.Application.csproj b/src/Libraries/Microsoft.Extensions.AmbientMetadata.Application/Microsoft.Extensions.AmbientMetadata.Application.csproj index 615c7ec6e14..5cc014f22ca 100644 --- a/src/Libraries/Microsoft.Extensions.AmbientMetadata.Application/Microsoft.Extensions.AmbientMetadata.Application.csproj +++ b/src/Libraries/Microsoft.Extensions.AmbientMetadata.Application/Microsoft.Extensions.AmbientMetadata.Application.csproj @@ -5,6 +5,10 @@ Fundamentals + + true + + normal 100 @@ -15,6 +19,7 @@ + diff --git a/src/Libraries/Microsoft.Extensions.Compliance.Redaction/Microsoft.Extensions.Compliance.Redaction.csproj b/src/Libraries/Microsoft.Extensions.Compliance.Redaction/Microsoft.Extensions.Compliance.Redaction.csproj index 9f9f4149ca1..286a14ca69e 100644 --- a/src/Libraries/Microsoft.Extensions.Compliance.Redaction/Microsoft.Extensions.Compliance.Redaction.csproj +++ b/src/Libraries/Microsoft.Extensions.Compliance.Redaction/Microsoft.Extensions.Compliance.Redaction.csproj @@ -7,6 +7,7 @@ true + true true true true @@ -25,6 +26,7 @@ + diff --git a/src/Libraries/Microsoft.Extensions.Compliance.Redaction/RedactionExtensions.cs b/src/Libraries/Microsoft.Extensions.Compliance.Redaction/RedactionExtensions.cs index 191d8af6f55..577cd0e8d7a 100644 --- a/src/Libraries/Microsoft.Extensions.Compliance.Redaction/RedactionExtensions.cs +++ b/src/Libraries/Microsoft.Extensions.Compliance.Redaction/RedactionExtensions.cs @@ -2,7 +2,6 @@ // The .NET Foundation licenses this file to you under the MIT license. using System; -using System.Diagnostics.CodeAnalysis; using Microsoft.Extensions.Compliance.Classification; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; @@ -45,11 +44,6 @@ public static IRedactionBuilder SetHmacRedactor(this IRedactionBuilder builder, /// The data classifications for which the redactor type should be used. /// The value of . /// , , or is . - [DynamicDependency(DynamicallyAccessedMemberTypes.All, typeof(HmacRedactorOptions))] - [UnconditionalSuppressMessage( - "Trimming", - "IL2026:Members annotated with 'RequiresUnreferencedCodeAttribute' require dynamic access otherwise can break functionality when trimming application code", - Justification = "Addressed with [DynamicDependency]")] public static IRedactionBuilder SetHmacRedactor(this IRedactionBuilder builder, IConfigurationSection section, params DataClassificationSet[] classifications) { _ = Throw.IfNull(builder); diff --git a/src/Libraries/Microsoft.Extensions.Compliance.Testing/FakeRedactionBuilderExtensions.cs b/src/Libraries/Microsoft.Extensions.Compliance.Testing/FakeRedactionBuilderExtensions.cs index a954985c881..4c6314ec811 100644 --- a/src/Libraries/Microsoft.Extensions.Compliance.Testing/FakeRedactionBuilderExtensions.cs +++ b/src/Libraries/Microsoft.Extensions.Compliance.Testing/FakeRedactionBuilderExtensions.cs @@ -2,7 +2,6 @@ // The .NET Foundation licenses this file to you under the MIT license. using System; -using System.Diagnostics.CodeAnalysis; using Microsoft.Extensions.Compliance.Classification; using Microsoft.Extensions.Compliance.Redaction; using Microsoft.Extensions.Compliance.Testing; @@ -65,9 +64,6 @@ public static IRedactionBuilder SetFakeRedactor(this IRedactionBuilder builder, /// The data classifications for which the redactor type should be used. /// The value of . /// or is . - [UnconditionalSuppressMessage("Trimming", - "IL2026:Members annotated with 'RequiresUnreferencedCodeAttribute' require dynamic access otherwise can break functionality when trimming application code", - Justification = "The type is FakeRedactorOptions and we know it.")] public static IRedactionBuilder SetFakeRedactor(this IRedactionBuilder builder, IConfigurationSection section, params DataClassificationSet[] classifications) { _ = Throw.IfNull(builder); diff --git a/src/Libraries/Microsoft.Extensions.Compliance.Testing/Microsoft.Extensions.Compliance.Testing.csproj b/src/Libraries/Microsoft.Extensions.Compliance.Testing/Microsoft.Extensions.Compliance.Testing.csproj index 1883b86af55..0da536c5c51 100644 --- a/src/Libraries/Microsoft.Extensions.Compliance.Testing/Microsoft.Extensions.Compliance.Testing.csproj +++ b/src/Libraries/Microsoft.Extensions.Compliance.Testing/Microsoft.Extensions.Compliance.Testing.csproj @@ -7,6 +7,7 @@ + true true true true @@ -24,6 +25,7 @@ + diff --git a/src/Libraries/Microsoft.Extensions.DependencyInjection.AutoActivation/AutoActivationExtensions.Keyed.cs b/src/Libraries/Microsoft.Extensions.DependencyInjection.AutoActivation/AutoActivationExtensions.Keyed.cs index 03a9f17810c..88a4d5d10e4 100644 --- a/src/Libraries/Microsoft.Extensions.DependencyInjection.AutoActivation/AutoActivationExtensions.Keyed.cs +++ b/src/Libraries/Microsoft.Extensions.DependencyInjection.AutoActivation/AutoActivationExtensions.Keyed.cs @@ -55,13 +55,9 @@ public static IServiceCollection ActivateKeyedSingleton( /// The type of the service to activate. /// An object used to uniquely identify the specific service. /// The value of . - [UnconditionalSuppressMessage( - "Trimming", - "IL2026:Members annotated with 'RequiresUnreferencedCodeAttribute' require dynamic access otherwise can break functionality when trimming application code", - Justification = "Addressed with [DynamicallyAccessedMembers]")] public static IServiceCollection ActivateKeyedSingleton( this IServiceCollection services, - [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type serviceType, + Type serviceType, object? serviceKey) { _ = Throw.IfNull(services); @@ -72,7 +68,7 @@ public static IServiceCollection ActivateKeyedSingleton( .AddOptions() .Configure(ao => { - var constructed = typeof(IEnumerable<>).MakeGenericType(serviceType); + var constructed = GetEnumerableServiceType(serviceType); if (ao.KeyedAutoActivators.Contains((constructed, serviceKey))) { return; @@ -85,6 +81,10 @@ public static IServiceCollection ActivateKeyedSingleton( } _ = ao.KeyedAutoActivators.Add((serviceType, serviceKey)); + + [UnconditionalSuppressMessage("AotAnalysis", "IL3050:RequiresDynamicCode", + Justification = "When IsDynamicCodeSupported is not supported, DependencyInjection ensures IEnumerable service types are not a ValueType.")] + static Type GetEnumerableServiceType(Type serviceType) => typeof(IEnumerable<>).MakeGenericType(serviceType); }); return services; diff --git a/src/Libraries/Microsoft.Extensions.DependencyInjection.AutoActivation/AutoActivationExtensions.cs b/src/Libraries/Microsoft.Extensions.DependencyInjection.AutoActivation/AutoActivationExtensions.cs index 136a704ecfd..7b9c5c8a450 100644 --- a/src/Libraries/Microsoft.Extensions.DependencyInjection.AutoActivation/AutoActivationExtensions.cs +++ b/src/Libraries/Microsoft.Extensions.DependencyInjection.AutoActivation/AutoActivationExtensions.cs @@ -55,11 +55,7 @@ public static IServiceCollection ActivateSingleton(this IServiceCollec /// The service collection containing the service. /// The type of the service to activate. /// The value of . - [UnconditionalSuppressMessage( - "Trimming", - "IL2026:Members annotated with 'RequiresUnreferencedCodeAttribute' require dynamic access otherwise can break functionality when trimming application code", - Justification = "Addressed with [DynamicallyAccessedMembers]")] - public static IServiceCollection ActivateSingleton(this IServiceCollection services, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type serviceType) + public static IServiceCollection ActivateSingleton(this IServiceCollection services, Type serviceType) { _ = Throw.IfNull(services); _ = Throw.IfNull(serviceType); @@ -69,7 +65,7 @@ public static IServiceCollection ActivateSingleton(this IServiceCollection servi .AddOptions() .Configure(ao => { - var constructed = typeof(IEnumerable<>).MakeGenericType(serviceType); + var constructed = GetEnumerableServiceType(serviceType); if (ao.AutoActivators.Contains(constructed)) { return; @@ -82,6 +78,10 @@ public static IServiceCollection ActivateSingleton(this IServiceCollection servi } _ = ao.AutoActivators.Add(serviceType); + + [UnconditionalSuppressMessage("AotAnalysis", "IL3050:RequiresDynamicCode", + Justification = "When IsDynamicCodeSupported is not supported, DependencyInjection ensures IEnumerable service types are not a ValueType.")] + static Type GetEnumerableServiceType(Type serviceType) => typeof(IEnumerable<>).MakeGenericType(serviceType); }); return services; diff --git a/src/Libraries/Microsoft.Extensions.Diagnostics.ExceptionSummarization/HttpExceptionSummaryProvider.cs b/src/Libraries/Microsoft.Extensions.Diagnostics.ExceptionSummarization/HttpExceptionSummaryProvider.cs index fa31f2f2b5d..c6cd436a15d 100644 --- a/src/Libraries/Microsoft.Extensions.Diagnostics.ExceptionSummarization/HttpExceptionSummaryProvider.cs +++ b/src/Libraries/Microsoft.Extensions.Diagnostics.ExceptionSummarization/HttpExceptionSummaryProvider.cs @@ -35,9 +35,14 @@ static HttpExceptionSummaryProvider() }; var socketErrors = new Dictionary(); +#if NET5_0_OR_GREATER + foreach (var socketError in Enum.GetValues()) + { +#else foreach (var v in Enum.GetValues(typeof(SocketError))) { var socketError = (SocketError)v!; +#endif var name = socketError.ToString(); socketErrors[socketError] = descriptions.Count; @@ -45,9 +50,14 @@ static HttpExceptionSummaryProvider() } var webStatuses = new Dictionary(); +#if NET5_0_OR_GREATER + foreach (var status in Enum.GetValues()) + { +#else foreach (var v in Enum.GetValues(typeof(WebExceptionStatus))) { var status = (WebExceptionStatus)v!; +#endif var name = status.ToString(); webStatuses[status] = descriptions.Count; diff --git a/src/Libraries/Microsoft.Extensions.Diagnostics.HealthChecks.Common/Microsoft.Extensions.Diagnostics.HealthChecks.Common.csproj b/src/Libraries/Microsoft.Extensions.Diagnostics.HealthChecks.Common/Microsoft.Extensions.Diagnostics.HealthChecks.Common.csproj index 9d98141bfae..9109e0df176 100644 --- a/src/Libraries/Microsoft.Extensions.Diagnostics.HealthChecks.Common/Microsoft.Extensions.Diagnostics.HealthChecks.Common.csproj +++ b/src/Libraries/Microsoft.Extensions.Diagnostics.HealthChecks.Common/Microsoft.Extensions.Diagnostics.HealthChecks.Common.csproj @@ -1,4 +1,4 @@ - + Microsoft.Extensions.Diagnostics.HealthChecks Health check implementations. @@ -6,6 +6,7 @@ + true true true true @@ -22,6 +23,7 @@ + diff --git a/src/Libraries/Microsoft.Extensions.Diagnostics.HealthChecks.ResourceUtilization/Microsoft.Extensions.Diagnostics.HealthChecks.ResourceUtilization.csproj b/src/Libraries/Microsoft.Extensions.Diagnostics.HealthChecks.ResourceUtilization/Microsoft.Extensions.Diagnostics.HealthChecks.ResourceUtilization.csproj index dd73a1da586..183f4b21f41 100644 --- a/src/Libraries/Microsoft.Extensions.Diagnostics.HealthChecks.ResourceUtilization/Microsoft.Extensions.Diagnostics.HealthChecks.ResourceUtilization.csproj +++ b/src/Libraries/Microsoft.Extensions.Diagnostics.HealthChecks.ResourceUtilization/Microsoft.Extensions.Diagnostics.HealthChecks.ResourceUtilization.csproj @@ -6,6 +6,7 @@ + true true true @@ -21,6 +22,7 @@ + diff --git a/src/Libraries/Microsoft.Extensions.Diagnostics.HealthChecks.ResourceUtilization/ResourceUtilizationHealthCheckExtensions.cs b/src/Libraries/Microsoft.Extensions.Diagnostics.HealthChecks.ResourceUtilization/ResourceUtilizationHealthCheckExtensions.cs index e3b6c086605..ee5d466e0a3 100644 --- a/src/Libraries/Microsoft.Extensions.Diagnostics.HealthChecks.ResourceUtilization/ResourceUtilizationHealthCheckExtensions.cs +++ b/src/Libraries/Microsoft.Extensions.Diagnostics.HealthChecks.ResourceUtilization/ResourceUtilizationHealthCheckExtensions.cs @@ -3,7 +3,6 @@ using System; using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Diagnostics.HealthChecks; using Microsoft.Shared.Diagnostics; @@ -56,11 +55,6 @@ public static IHealthChecksBuilder AddResourceUtilizationHealthCheck(this IHealt /// Configuration for . /// The value of . /// or is . - [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.PublicParameterlessConstructor, typeof(ResourceUtilizationHealthCheckOptions))] - [UnconditionalSuppressMessage( - "Trimming", - "IL2026:Members annotated with 'RequiresUnreferencedCodeAttribute' require dynamic access otherwise can break functionality when trimming application code", - Justification = "Addressed by [DynamicDependency]")] public static IHealthChecksBuilder AddResourceUtilizationHealthCheck( this IHealthChecksBuilder builder, IConfigurationSection section) @@ -80,11 +74,6 @@ public static IHealthChecksBuilder AddResourceUtilizationHealthCheck( /// A list of tags that can be used to filter health checks. /// The value of . /// , or is . - [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.PublicParameterlessConstructor, typeof(ResourceUtilizationHealthCheckOptions))] - [UnconditionalSuppressMessage( - "Trimming", - "IL2026:Members annotated with 'RequiresUnreferencedCodeAttribute' require dynamic access otherwise can break functionality when trimming application code", - Justification = "Addressed by [DynamicDependency]")] public static IHealthChecksBuilder AddResourceUtilizationHealthCheck( this IHealthChecksBuilder builder, IConfigurationSection section, @@ -106,11 +95,6 @@ public static IHealthChecksBuilder AddResourceUtilizationHealthCheck( /// A list of tags that can be used to filter health checks. /// The value of . /// , or is . - [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.PublicParameterlessConstructor, typeof(ResourceUtilizationHealthCheckOptions))] - [UnconditionalSuppressMessage( - "Trimming", - "IL2026:Members annotated with 'RequiresUnreferencedCodeAttribute' require dynamic access otherwise can break functionality when trimming application code", - Justification = "Addressed by [DynamicDependency]")] public static IHealthChecksBuilder AddResourceUtilizationHealthCheck( this IHealthChecksBuilder builder, IConfigurationSection section, diff --git a/src/Libraries/Microsoft.Extensions.Diagnostics.Probes/KubernetesProbesExtensions.cs b/src/Libraries/Microsoft.Extensions.Diagnostics.Probes/KubernetesProbesExtensions.cs index 3663cef85d3..f4f60965655 100644 --- a/src/Libraries/Microsoft.Extensions.Diagnostics.Probes/KubernetesProbesExtensions.cs +++ b/src/Libraries/Microsoft.Extensions.Diagnostics.Probes/KubernetesProbesExtensions.cs @@ -33,7 +33,7 @@ public static IServiceCollection AddKubernetesProbes(this IServiceCollection ser _ = Throw.IfNull(services); _ = Throw.IfNull(section); - return services.AddKubernetesProbes(section.Bind); + return services.AddKubernetesProbes(o => section.Bind(o)); } /// diff --git a/src/Libraries/Microsoft.Extensions.Diagnostics.Probes/Microsoft.Extensions.Diagnostics.Probes.csproj b/src/Libraries/Microsoft.Extensions.Diagnostics.Probes/Microsoft.Extensions.Diagnostics.Probes.csproj index 529a9c73fa2..b83ecbbd0fc 100644 --- a/src/Libraries/Microsoft.Extensions.Diagnostics.Probes/Microsoft.Extensions.Diagnostics.Probes.csproj +++ b/src/Libraries/Microsoft.Extensions.Diagnostics.Probes/Microsoft.Extensions.Diagnostics.Probes.csproj @@ -6,6 +6,7 @@ + true true true true @@ -23,6 +24,7 @@ + diff --git a/src/Libraries/Microsoft.Extensions.Diagnostics.ResourceMonitoring/Microsoft.Extensions.Diagnostics.ResourceMonitoring.csproj b/src/Libraries/Microsoft.Extensions.Diagnostics.ResourceMonitoring/Microsoft.Extensions.Diagnostics.ResourceMonitoring.csproj index e9ed2cd0e49..cbc5caad60a 100644 --- a/src/Libraries/Microsoft.Extensions.Diagnostics.ResourceMonitoring/Microsoft.Extensions.Diagnostics.ResourceMonitoring.csproj +++ b/src/Libraries/Microsoft.Extensions.Diagnostics.ResourceMonitoring/Microsoft.Extensions.Diagnostics.ResourceMonitoring.csproj @@ -7,6 +7,7 @@ true + true true true true @@ -32,6 +33,7 @@ + diff --git a/src/Libraries/Microsoft.Extensions.Diagnostics.ResourceMonitoring/ResourceMonitoringBuilderExtensions.cs b/src/Libraries/Microsoft.Extensions.Diagnostics.ResourceMonitoring/ResourceMonitoringBuilderExtensions.cs index ca52cf38c74..43c926cdc81 100644 --- a/src/Libraries/Microsoft.Extensions.Diagnostics.ResourceMonitoring/ResourceMonitoringBuilderExtensions.cs +++ b/src/Libraries/Microsoft.Extensions.Diagnostics.ResourceMonitoring/ResourceMonitoringBuilderExtensions.cs @@ -2,7 +2,6 @@ // The .NET Foundation licenses this file to you under the MIT license. using System; -using System.Diagnostics.CodeAnalysis; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Options; @@ -39,10 +38,6 @@ public static IResourceMonitorBuilder ConfigureMonitor( /// The to use for configuring . /// The value of . /// Either or is . - [UnconditionalSuppressMessage( - "Trimming", - "IL2026:Members annotated with 'RequiresUnreferencedCodeAttribute' require dynamic access otherwise can break functionality when trimming application code", - Justification = "Addressed with [DynamicDependency]")] public static IResourceMonitorBuilder ConfigureMonitor( this IResourceMonitorBuilder builder, IConfigurationSection section) diff --git a/src/Libraries/Microsoft.Extensions.Diagnostics.Testing/Logging/FakeLoggerBuilderExtensions.cs b/src/Libraries/Microsoft.Extensions.Diagnostics.Testing/Logging/FakeLoggerBuilderExtensions.cs index 2701205a496..00f05887aba 100644 --- a/src/Libraries/Microsoft.Extensions.Diagnostics.Testing/Logging/FakeLoggerBuilderExtensions.cs +++ b/src/Libraries/Microsoft.Extensions.Diagnostics.Testing/Logging/FakeLoggerBuilderExtensions.cs @@ -2,7 +2,6 @@ // The .NET Foundation licenses this file to you under the MIT license. using System; -using System.Diagnostics.CodeAnalysis; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection.Extensions; @@ -23,11 +22,6 @@ public static class FakeLoggerBuilderExtensions /// Logging builder. /// Configuration section that contains . /// Logging . - [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.PublicParameterlessConstructor, typeof(FakeLogCollectorOptions))] - [UnconditionalSuppressMessage( - "Trimming", - "IL2026:Members annotated with 'RequiresUnreferencedCodeAttribute' require dynamic access otherwise can break functionality when trimming application code", - Justification = "Addressed by [DynamicDependency]")] public static ILoggingBuilder AddFakeLogging(this ILoggingBuilder builder, IConfigurationSection section) { _ = Throw.IfNull(builder); diff --git a/src/Libraries/Microsoft.Extensions.Diagnostics.Testing/Microsoft.Extensions.Diagnostics.Testing.csproj b/src/Libraries/Microsoft.Extensions.Diagnostics.Testing/Microsoft.Extensions.Diagnostics.Testing.csproj index 9ffe5557c0c..5bd030df5e9 100644 --- a/src/Libraries/Microsoft.Extensions.Diagnostics.Testing/Microsoft.Extensions.Diagnostics.Testing.csproj +++ b/src/Libraries/Microsoft.Extensions.Diagnostics.Testing/Microsoft.Extensions.Diagnostics.Testing.csproj @@ -7,9 +7,11 @@ + true true true true + $(NoWarn);SYSLIB1100;SYSLIB1101 @@ -23,6 +25,7 @@ + diff --git a/src/Libraries/Microsoft.Extensions.Http.Diagnostics/Latency/HttpClientLatencyTelemetryExtensions.cs b/src/Libraries/Microsoft.Extensions.Http.Diagnostics/Latency/HttpClientLatencyTelemetryExtensions.cs index b682de95b21..309f24e1f2d 100644 --- a/src/Libraries/Microsoft.Extensions.Http.Diagnostics/Latency/HttpClientLatencyTelemetryExtensions.cs +++ b/src/Libraries/Microsoft.Extensions.Http.Diagnostics/Latency/HttpClientLatencyTelemetryExtensions.cs @@ -2,13 +2,11 @@ // The .NET Foundation licenses this file to you under the MIT license. using System; -using System.Diagnostics.CodeAnalysis; using System.Net.Http; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Http; using Microsoft.Extensions.Http.Latency; using Microsoft.Extensions.Http.Latency.Internal; -using Microsoft.Extensions.Http.Logging; using Microsoft.Shared.Diagnostics; namespace Microsoft.Extensions.DependencyInjection; @@ -58,10 +56,6 @@ public static IServiceCollection AddHttpClientLatencyTelemetry(this IServiceColl /// The . /// The to use for configuring . /// The value of . - [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.PublicParameterlessConstructor, typeof(LoggingOptions))] - [UnconditionalSuppressMessage("Trimming", - "IL2026:Members annotated with 'RequiresUnreferencedCodeAttribute' require dynamic access otherwise can break functionality when trimming application code", - Justification = "Addressed with [DynamicDependency]")] public static IServiceCollection AddHttpClientLatencyTelemetry(this IServiceCollection services, IConfigurationSection section) { _ = Throw.IfNull(section); diff --git a/src/Libraries/Microsoft.Extensions.Http.Diagnostics/Logging/HttpClientLoggingHttpClientBuilderExtensions.cs b/src/Libraries/Microsoft.Extensions.Http.Diagnostics/Logging/HttpClientLoggingHttpClientBuilderExtensions.cs index b867a767c68..24258bab36f 100644 --- a/src/Libraries/Microsoft.Extensions.Http.Diagnostics/Logging/HttpClientLoggingHttpClientBuilderExtensions.cs +++ b/src/Libraries/Microsoft.Extensions.Http.Diagnostics/Logging/HttpClientLoggingHttpClientBuilderExtensions.cs @@ -2,7 +2,6 @@ // The .NET Foundation licenses this file to you under the MIT license. using System; -using System.Diagnostics.CodeAnalysis; using System.Net.Http; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection.Extensions; @@ -50,10 +49,6 @@ public static IHttpClientBuilder AddExtendedHttpClientLogging(this IHttpClientBu /// you have a way of viewing structured logs in order to view this extra information. /// /// Any of the arguments is . - [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.PublicParameterlessConstructor, typeof(LoggingOptions))] - [UnconditionalSuppressMessage("Trimming", - "IL2026:Members annotated with 'RequiresUnreferencedCodeAttribute' require dynamic access otherwise can break functionality when trimming application code", - Justification = "Addressed with [DynamicDependency]")] public static IHttpClientBuilder AddExtendedHttpClientLogging(this IHttpClientBuilder builder, IConfigurationSection section) { _ = Throw.IfNull(builder); @@ -74,10 +69,6 @@ public static IHttpClientBuilder AddExtendedHttpClientLogging(this IHttpClientBu /// you have a way of viewing structured logs in order to view this extra information. /// /// Any of the arguments is . - [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.PublicParameterlessConstructor, typeof(LoggingOptions))] - [UnconditionalSuppressMessage("Trimming", - "IL2026:Members annotated with 'RequiresUnreferencedCodeAttribute' require dynamic access otherwise can break functionality when trimming application code", - Justification = "Addressed with [DynamicDependency]")] public static IHttpClientBuilder AddExtendedHttpClientLogging(this IHttpClientBuilder builder, Action configure) { _ = Throw.IfNull(builder); diff --git a/src/Libraries/Microsoft.Extensions.Http.Diagnostics/Logging/HttpClientLoggingServiceCollectionExtensions.cs b/src/Libraries/Microsoft.Extensions.Http.Diagnostics/Logging/HttpClientLoggingServiceCollectionExtensions.cs index e6e39b1b54b..748cdad5366 100644 --- a/src/Libraries/Microsoft.Extensions.Http.Diagnostics/Logging/HttpClientLoggingServiceCollectionExtensions.cs +++ b/src/Libraries/Microsoft.Extensions.Http.Diagnostics/Logging/HttpClientLoggingServiceCollectionExtensions.cs @@ -2,7 +2,6 @@ // The .NET Foundation licenses this file to you under the MIT license. using System; -using System.Diagnostics.CodeAnalysis; using System.Net.Http; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection.Extensions; @@ -58,10 +57,6 @@ public static IServiceCollection AddExtendedHttpClientLogging(this IServiceColle /// All other loggers are removed - including the default one, registered via . /// /// Any of the arguments is . - [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.PublicParameterlessConstructor, typeof(LoggingOptions))] - [UnconditionalSuppressMessage("Trimming", - "IL2026:Members annotated with 'RequiresUnreferencedCodeAttribute' require dynamic access otherwise can break functionality when trimming application code", - Justification = "Addressed with [DynamicDependency]")] public static IServiceCollection AddExtendedHttpClientLogging(this IServiceCollection services, IConfigurationSection section) { _ = Throw.IfNull(services); diff --git a/src/Libraries/Microsoft.Extensions.Http.Diagnostics/Microsoft.Extensions.Http.Diagnostics.csproj b/src/Libraries/Microsoft.Extensions.Http.Diagnostics/Microsoft.Extensions.Http.Diagnostics.csproj index 0ecc1a45bc3..223a370cd57 100644 --- a/src/Libraries/Microsoft.Extensions.Http.Diagnostics/Microsoft.Extensions.Http.Diagnostics.csproj +++ b/src/Libraries/Microsoft.Extensions.Http.Diagnostics/Microsoft.Extensions.Http.Diagnostics.csproj @@ -9,6 +9,7 @@ $(NoWarn);LA0006 + true true true false @@ -37,6 +38,7 @@ + diff --git a/src/Libraries/Microsoft.Extensions.Http.Resilience/Hedging/StandardHedgingHandlerBuilderExtensions.cs b/src/Libraries/Microsoft.Extensions.Http.Resilience/Hedging/StandardHedgingHandlerBuilderExtensions.cs index 65edeb046fc..7e2b87c7315 100644 --- a/src/Libraries/Microsoft.Extensions.Http.Resilience/Hedging/StandardHedgingHandlerBuilderExtensions.cs +++ b/src/Libraries/Microsoft.Extensions.Http.Resilience/Hedging/StandardHedgingHandlerBuilderExtensions.cs @@ -2,7 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. using System; -using System.Diagnostics.CodeAnalysis; +using System.Linq; using System.Net.Http; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; @@ -25,13 +25,16 @@ public static class StandardHedgingHandlerBuilderExtensions /// The pipeline builder. /// The section that the options will bind against. /// The value of . - [DynamicDependency(DynamicallyAccessedMemberTypes.All, typeof(HttpStandardHedgingResilienceOptions))] public static IStandardHedgingHandlerBuilder Configure(this IStandardHedgingHandlerBuilder builder, IConfigurationSection section) { _ = Throw.IfNull(builder); _ = Throw.IfNull(section); - var options = Throw.IfNull(section.Get()); + if (!section.GetChildren().Any()) + { + Throw.ArgumentException(nameof(section), "Configuration section cannot be empty."); + } + _ = builder.Services.Configure(builder.Name, section, o => o.ErrorOnUnknownConfiguration = true); return builder; diff --git a/src/Libraries/Microsoft.Extensions.Http.Resilience/Microsoft.Extensions.Http.Resilience.csproj b/src/Libraries/Microsoft.Extensions.Http.Resilience/Microsoft.Extensions.Http.Resilience.csproj index ac92ad2d833..7bf27efddb3 100644 --- a/src/Libraries/Microsoft.Extensions.Http.Resilience/Microsoft.Extensions.Http.Resilience.csproj +++ b/src/Libraries/Microsoft.Extensions.Http.Resilience/Microsoft.Extensions.Http.Resilience.csproj @@ -6,6 +6,7 @@ + true true true true @@ -29,6 +30,10 @@ + + + + diff --git a/src/Libraries/Microsoft.Extensions.Http.Resilience/Resilience/HttpStandardResiliencePipelineBuilderExtensions.cs b/src/Libraries/Microsoft.Extensions.Http.Resilience/Resilience/HttpStandardResiliencePipelineBuilderExtensions.cs index d853e38ba20..e17e975f44b 100644 --- a/src/Libraries/Microsoft.Extensions.Http.Resilience/Resilience/HttpStandardResiliencePipelineBuilderExtensions.cs +++ b/src/Libraries/Microsoft.Extensions.Http.Resilience/Resilience/HttpStandardResiliencePipelineBuilderExtensions.cs @@ -2,7 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. using System; -using System.Diagnostics.CodeAnalysis; +using System.Linq; using System.Net.Http; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; @@ -22,12 +22,15 @@ public static class HttpStandardResiliencePipelineBuilderExtensions /// The pipeline builder. /// The section that the options will bind against. /// The value of . - [DynamicDependency(DynamicallyAccessedMemberTypes.All, typeof(HttpStandardResilienceOptions))] public static IHttpStandardResiliencePipelineBuilder Configure(this IHttpStandardResiliencePipelineBuilder builder, IConfigurationSection section) { _ = Throw.IfNull(builder); _ = Throw.IfNull(section); - var options = Throw.IfNull(section.Get()); + + if (!section.GetChildren().Any()) + { + Throw.ArgumentException(nameof(section), "Configuration section cannot be empty."); + } _ = builder.Services.Configure( builder.PipelineName, diff --git a/src/Libraries/Microsoft.Extensions.ObjectPool.DependencyInjection/ObjectPoolServiceCollectionExtensions.cs b/src/Libraries/Microsoft.Extensions.ObjectPool.DependencyInjection/ObjectPoolServiceCollectionExtensions.cs index 25132dd1618..749b9578311 100644 --- a/src/Libraries/Microsoft.Extensions.ObjectPool.DependencyInjection/ObjectPoolServiceCollectionExtensions.cs +++ b/src/Libraries/Microsoft.Extensions.ObjectPool.DependencyInjection/ObjectPoolServiceCollectionExtensions.cs @@ -78,11 +78,6 @@ public static IServiceCollection ConfigurePool(this IServiceCollection /// The to add to. /// The configuration section to bind. /// The value of . - [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.PublicParameterlessConstructor, typeof(DependencyInjectionPoolOptions))] - [UnconditionalSuppressMessage( - "Trimming", - "IL2026:Members annotated with 'RequiresUnreferencedCodeAttribute' require dynamic access otherwise can break functionality when trimming application code", - Justification = "Addressed by [DynamicDependency]")] public static IServiceCollection ConfigurePools(this IServiceCollection services, IConfigurationSection section) { foreach (var child in Throw.IfNull(section).GetChildren()) diff --git a/src/Libraries/Microsoft.Extensions.Telemetry/Enrichment/ApplicationEnricherServiceCollectionExtensions.cs b/src/Libraries/Microsoft.Extensions.Telemetry/Enrichment/ApplicationEnricherServiceCollectionExtensions.cs index dac5be34bf1..75bb01c4a8b 100644 --- a/src/Libraries/Microsoft.Extensions.Telemetry/Enrichment/ApplicationEnricherServiceCollectionExtensions.cs +++ b/src/Libraries/Microsoft.Extensions.Telemetry/Enrichment/ApplicationEnricherServiceCollectionExtensions.cs @@ -2,7 +2,6 @@ // The .NET Foundation licenses this file to you under the MIT license. using System; -using System.Diagnostics.CodeAnalysis; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Diagnostics.Enrichment; using Microsoft.Shared.Diagnostics; @@ -62,11 +61,6 @@ public static IServiceCollection AddServiceLogEnricher(this IServiceCollection s .AddLogEnricherOptions(_ => { }, section); } - [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.PublicParameterlessConstructor, typeof(ApplicationLogEnricherOptions))] - [UnconditionalSuppressMessage( - "Trimming", - "IL2026:Members annotated with 'RequiresUnreferencedCodeAttribute' require dynamic access otherwise can break functionality when trimming application code", - Justification = "Addressed by [DynamicDependency]")] private static IServiceCollection AddLogEnricherOptions( this IServiceCollection services, Action configure, diff --git a/src/Libraries/Microsoft.Extensions.Telemetry/Enrichment/ProcessEnricherServiceCollectionExtensions.cs b/src/Libraries/Microsoft.Extensions.Telemetry/Enrichment/ProcessEnricherServiceCollectionExtensions.cs index 51d235a05af..bb987eb90bb 100644 --- a/src/Libraries/Microsoft.Extensions.Telemetry/Enrichment/ProcessEnricherServiceCollectionExtensions.cs +++ b/src/Libraries/Microsoft.Extensions.Telemetry/Enrichment/ProcessEnricherServiceCollectionExtensions.cs @@ -2,7 +2,6 @@ // The .NET Foundation licenses this file to you under the MIT license. using System; -using System.Diagnostics.CodeAnalysis; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Diagnostics.Enrichment; using Microsoft.Shared.Diagnostics; @@ -64,11 +63,6 @@ public static IServiceCollection AddProcessLogEnricher(this IServiceCollection s .AddLogEnricherOptions(_ => { }, section); } - [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.PublicParameterlessConstructor, typeof(ProcessLogEnricherOptions))] - [UnconditionalSuppressMessage( - "Trimming", - "IL2026:Members annotated with 'RequiresUnreferencedCodeAttribute' require dynamic access otherwise can break functionality when trimming application code", - Justification = "Addressed by [DynamicDependency]")] private static IServiceCollection AddLogEnricherOptions( this IServiceCollection services, Action configure, diff --git a/src/Libraries/Microsoft.Extensions.Telemetry/Latency/LatencyConsoleExtensions.cs b/src/Libraries/Microsoft.Extensions.Telemetry/Latency/LatencyConsoleExtensions.cs index ba69f80ed0b..aea4a79bbcf 100644 --- a/src/Libraries/Microsoft.Extensions.Telemetry/Latency/LatencyConsoleExtensions.cs +++ b/src/Libraries/Microsoft.Extensions.Telemetry/Latency/LatencyConsoleExtensions.cs @@ -2,7 +2,6 @@ // The .NET Foundation licenses this file to you under the MIT license. using System; -using System.Diagnostics.CodeAnalysis; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection.Extensions; using Microsoft.Extensions.Diagnostics.Latency; @@ -56,11 +55,6 @@ public static IServiceCollection AddConsoleLatencyDataExporter(this IServiceColl /// Configuration of . /// The value of . /// Either or is . - [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.PublicParameterlessConstructor, typeof(LatencyConsoleOptions))] - [UnconditionalSuppressMessage( - "Trimming", - "IL2026:Members annotated with 'RequiresUnreferencedCodeAttribute' require dynamic access otherwise can break functionality when trimming application code", - Justification = "Addressed by [DynamicDependency]")] public static IServiceCollection AddConsoleLatencyDataExporter(this IServiceCollection services, IConfigurationSection section) { _ = Throw.IfNull(services); diff --git a/src/Libraries/Microsoft.Extensions.Telemetry/Latency/LatencyContextExtensions.cs b/src/Libraries/Microsoft.Extensions.Telemetry/Latency/LatencyContextExtensions.cs index 749b5298229..5840da785d2 100644 --- a/src/Libraries/Microsoft.Extensions.Telemetry/Latency/LatencyContextExtensions.cs +++ b/src/Libraries/Microsoft.Extensions.Telemetry/Latency/LatencyContextExtensions.cs @@ -2,7 +2,6 @@ // The .NET Foundation licenses this file to you under the MIT license. using System; -using System.Diagnostics.CodeAnalysis; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection.Extensions; using Microsoft.Extensions.Diagnostics.Latency; @@ -54,11 +53,6 @@ public static IServiceCollection AddLatencyContext(this IServiceCollection servi /// The dependency injection container. /// The configuration of . /// The value of . - [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.PublicParameterlessConstructor, typeof(LatencyContextOptions))] - [UnconditionalSuppressMessage( - "Trimming", - "IL2026:Members annotated with 'RequiresUnreferencedCodeAttribute' require dynamic access otherwise can break functionality when trimming application code", - Justification = "Addressed by [DynamicDependency]")] public static IServiceCollection AddLatencyContext(this IServiceCollection services, IConfigurationSection section) { _ = Throw.IfNull(services); diff --git a/src/Libraries/Microsoft.Extensions.Telemetry/Microsoft.Extensions.Telemetry.csproj b/src/Libraries/Microsoft.Extensions.Telemetry/Microsoft.Extensions.Telemetry.csproj index 21e6baea697..95bb8c20fb2 100644 --- a/src/Libraries/Microsoft.Extensions.Telemetry/Microsoft.Extensions.Telemetry.csproj +++ b/src/Libraries/Microsoft.Extensions.Telemetry/Microsoft.Extensions.Telemetry.csproj @@ -14,6 +14,7 @@ true true true + true true @@ -31,6 +32,7 @@ + diff --git a/test/Libraries/Microsoft.AspNetCore.Diagnostics.Middleware.Tests/Logging/HttpLoggingServiceExtensionsTests.cs b/test/Libraries/Microsoft.AspNetCore.Diagnostics.Middleware.Tests/Logging/HttpLoggingServiceExtensionsTests.cs index 4f9eb15ca78..e480cefb1ed 100644 --- a/test/Libraries/Microsoft.AspNetCore.Diagnostics.Middleware.Tests/Logging/HttpLoggingServiceExtensionsTests.cs +++ b/test/Libraries/Microsoft.AspNetCore.Diagnostics.Middleware.Tests/Logging/HttpLoggingServiceExtensionsTests.cs @@ -5,6 +5,7 @@ using System; using System.Collections.Generic; +using Microsoft.Extensions.Compliance.Classification; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Http.Diagnostics; @@ -50,5 +51,43 @@ public void AddHttpLogging_WhenConfiguredUsingConfigurationSection_IsCorrect() Assert.Contains("/path0toexclude", options.ExcludePathStartsWith); Assert.Contains("/path1toexclude", options.ExcludePathStartsWith); } + + [Fact] + public void AddHttpLogging_CanConfigureDataClasses() + { + var services = new ServiceCollection(); + services.AddHttpLoggingRedaction(o => + { + o.RouteParameterDataClasses = new Dictionary + { + { "one", new DataClassification("Taxonomy1", "Value1") }, + }; + + o.RequestHeadersDataClasses = new Dictionary + { + { "two", new DataClassification("Taxonomy2", "Value2") }, + }; + + o.ResponseHeadersDataClasses = new Dictionary + { + { "three", new DataClassification("Taxonomy3", "Value3") }, + }; + }); + + using var provider = services.BuildServiceProvider(); + var options = provider.GetRequiredService>().Value; + + Assert.Single(options.RouteParameterDataClasses); + Assert.Equal("Taxonomy1", options.RouteParameterDataClasses["one"].TaxonomyName); + Assert.Equal("Value1", options.RouteParameterDataClasses["one"].Value); + + Assert.Single(options.RequestHeadersDataClasses); + Assert.Equal("Taxonomy2", options.RequestHeadersDataClasses["two"].TaxonomyName); + Assert.Equal("Value2", options.RequestHeadersDataClasses["two"].Value); + + Assert.Single(options.ResponseHeadersDataClasses); + Assert.Equal("Taxonomy3", options.ResponseHeadersDataClasses["three"].TaxonomyName); + Assert.Equal("Value3", options.ResponseHeadersDataClasses["three"].Value); + } } #endif diff --git a/test/Libraries/Microsoft.Extensions.Http.Resilience.Tests/Hedging/StandardHedgingTests.cs b/test/Libraries/Microsoft.Extensions.Http.Resilience.Tests/Hedging/StandardHedgingTests.cs index cd53c4d00e2..7ded224a2e4 100644 --- a/test/Libraries/Microsoft.Extensions.Http.Resilience.Tests/Hedging/StandardHedgingTests.cs +++ b/test/Libraries/Microsoft.Extensions.Http.Resilience.Tests/Hedging/StandardHedgingTests.cs @@ -147,7 +147,7 @@ public void Configure_EmptyConfigurationSectionContent_ShouldThrow() { "dummy", "" } }).GetSection("dummy"); - Assert.Throws(() => + Assert.Throws(() => Builder.Configure(section)); } @@ -156,7 +156,7 @@ public void Configure_EmptyConfigurationSection_ShouldThrow() { var section = ConfigurationStubFactory.CreateEmpty().GetSection(string.Empty); - Assert.Throws(() => + Assert.Throws(() => Builder.Configure(section)); } diff --git a/test/Libraries/Microsoft.Extensions.Http.Resilience.Tests/Resilience/HttpClientBuilderExtensionsTests.Standard.cs b/test/Libraries/Microsoft.Extensions.Http.Resilience.Tests/Resilience/HttpClientBuilderExtensionsTests.Standard.cs index 0ca8b521c40..567cceb6466 100644 --- a/test/Libraries/Microsoft.Extensions.Http.Resilience.Tests/Resilience/HttpClientBuilderExtensionsTests.Standard.cs +++ b/test/Libraries/Microsoft.Extensions.Http.Resilience.Tests/Resilience/HttpClientBuilderExtensionsTests.Standard.cs @@ -117,7 +117,7 @@ public void AddStandardResilienceHandler_NullConfigurationSectionContent_Throws( { var builder = new ServiceCollection().AddHttpClient("test"); - Assert.Throws(() => AddStandardResilienceHandler(mode, builder, _emptyConfigurationSection, options => { })); + Assert.Throws(() => AddStandardResilienceHandler(mode, builder, _emptyConfigurationSection, options => { })); } [InlineData(MethodArgs.Configuration)] From c61c342287013d3a3360adfa7f612919f3b95220 Mon Sep 17 00:00:00 2001 From: Martin Obratil Date: Mon, 15 Jan 2024 21:48:05 +0100 Subject: [PATCH 138/172] Updated README.md files with notes mentioning thread-safety considerations --- .../Microsoft.AspNetCore.AsyncState/README.md | 3 ++ .../AsyncState.cs | 31 ++++++++++--- .../Features.cs | 45 ------------------- .../FeaturesPooledPolicy.cs | 15 ++++--- .../Microsoft.Extensions.AsyncState/README.md | 4 +- .../AsyncStateTests.cs | 25 +++++++++++ .../FeaturesPooledPolicyTests.cs | 17 ++++--- 7 files changed, 73 insertions(+), 67 deletions(-) delete mode 100644 src/Libraries/Microsoft.Extensions.AsyncState/Features.cs diff --git a/src/Libraries/Microsoft.AspNetCore.AsyncState/README.md b/src/Libraries/Microsoft.AspNetCore.AsyncState/README.md index d5bc4f0a353..d53fafcbfd5 100644 --- a/src/Libraries/Microsoft.AspNetCore.AsyncState/README.md +++ b/src/Libraries/Microsoft.AspNetCore.AsyncState/README.md @@ -4,6 +4,9 @@ This provides the ability to store and retrieve state objects that flow with the The lifetime of the shared data is controlled automatically and will be the same as of `HttpContext`. +> [!NOTE] +> Please note, the implementation `IAsyncContext` is not designed to be thread-safe. + ## Install the package From the command-line: diff --git a/src/Libraries/Microsoft.Extensions.AsyncState/AsyncState.cs b/src/Libraries/Microsoft.Extensions.AsyncState/AsyncState.cs index 9fc79930954..4d782409238 100644 --- a/src/Libraries/Microsoft.Extensions.AsyncState/AsyncState.cs +++ b/src/Libraries/Microsoft.Extensions.AsyncState/AsyncState.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. using System; +using System.Collections.Generic; using System.Threading; using Microsoft.Extensions.ObjectPool; using Microsoft.Shared.Diagnostics; @@ -12,7 +13,7 @@ namespace Microsoft.Extensions.AsyncState; internal sealed class AsyncState : IAsyncState { private static readonly AsyncLocal _asyncContextCurrent = new(); - private static readonly ObjectPool _featuresPool = PoolFactory.CreatePool(new FeaturesPooledPolicy()); + private static readonly ObjectPool> _featuresPool = PoolFactory.CreatePool(new FeaturesPooledPolicy()); private int _contextCount; public void Initialize() @@ -21,12 +22,12 @@ public void Initialize() // Use an object indirection to hold the AsyncContext in the AsyncLocal, // so it can be cleared in all ExecutionContexts when its cleared. - var asyncStateHolder = new AsyncStateHolder + var features = new AsyncStateHolder { Features = _featuresPool.Get() }; - _asyncContextCurrent.Value = asyncStateHolder; + _asyncContextCurrent.Value = features; } public void Reset() @@ -59,7 +60,9 @@ public bool TryGet(AsyncStateToken token, out object? value) return false; } - value = _asyncContextCurrent.Value.Features.Get(token.Index); + EnsureCount(_asyncContextCurrent.Value.Features, token.Index + 1); + + value = _asyncContextCurrent.Value.Features[token.Index]; return true; } @@ -83,14 +86,28 @@ public void Set(AsyncStateToken token, object? value) Throw.InvalidOperationException("Context is not initialized"); } - _asyncContextCurrent.Value.Features.Set(token.Index, value); + EnsureCount(_asyncContextCurrent.Value.Features, token.Index + 1); + + _asyncContextCurrent.Value.Features[token.Index] = value; + } + + internal static void EnsureCount(List features, int count) + { +#if NET6_0_OR_GREATER + features.EnsureCapacity(count); +#endif + var difference = count - features.Count; + + for (int i = 0; i < difference; i++) + { + features.Add(null); + } } internal int ContextCount => Volatile.Read(ref _contextCount); private sealed class AsyncStateHolder { - public Features? Features { get; set; } + public List? Features { get; set; } } - } diff --git a/src/Libraries/Microsoft.Extensions.AsyncState/Features.cs b/src/Libraries/Microsoft.Extensions.AsyncState/Features.cs deleted file mode 100644 index 940efa69c26..00000000000 --- a/src/Libraries/Microsoft.Extensions.AsyncState/Features.cs +++ /dev/null @@ -1,45 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -using System.Collections.Generic; - -namespace Microsoft.Extensions.AsyncState; - -internal sealed class Features -{ - private readonly List _items = []; - - public object? Get(int index) - { - return _items.Count <= index ? null : _items[index]; - } - - public void Set(int index, object? value) - { - if (_items.Count <= index) - { - lock (_items) - { - var count = index + 1; - -#if NET6_0_OR_GREATER - _items.EnsureCapacity(count); -#endif - - var difference = count - _items.Count; - - for (int i = 0; i < difference; i++) - { - _items.Add(null); - } - } - } - - _items[index] = value; - } - - public void Clear() - { - _items.Clear(); - } -} diff --git a/src/Libraries/Microsoft.Extensions.AsyncState/FeaturesPooledPolicy.cs b/src/Libraries/Microsoft.Extensions.AsyncState/FeaturesPooledPolicy.cs index 6c6f442c817..3b045465595 100644 --- a/src/Libraries/Microsoft.Extensions.AsyncState/FeaturesPooledPolicy.cs +++ b/src/Libraries/Microsoft.Extensions.AsyncState/FeaturesPooledPolicy.cs @@ -1,22 +1,27 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. +using System.Collections.Generic; using Microsoft.Extensions.ObjectPool; namespace Microsoft.Extensions.AsyncState; -internal sealed class FeaturesPooledPolicy : IPooledObjectPolicy +internal sealed class FeaturesPooledPolicy : IPooledObjectPolicy> { /// - public Features Create() + public List Create() { - return new Features(); + return []; } /// - public bool Return(Features obj) + public bool Return(List obj) { - obj.Clear(); + for (int i = 0; i < obj.Count; i++) + { + obj[i] = null; + } + return true; } } diff --git a/src/Libraries/Microsoft.Extensions.AsyncState/README.md b/src/Libraries/Microsoft.Extensions.AsyncState/README.md index a58555d0389..57b93fdc4e1 100644 --- a/src/Libraries/Microsoft.Extensions.AsyncState/README.md +++ b/src/Libraries/Microsoft.Extensions.AsyncState/README.md @@ -1,12 +1,14 @@ # Microsoft.Extensions.AsyncState This provides the ability to store and retrieve objects that flow with the current asynchronous context. - It has a few advantages over using the [`AsyncLocal`](https://learn.microsoft.com/dotnet/api/system.threading.asynclocal-1) class directly: - By abstracting the way the ambient data is stored we can use more optimized implementations, for instance when using ASP.NET Core, without exposing these components. - Improves the performance by minimizing the number of `AsyncLocal` instances required when multiple objects are shared. - Provides a way to manage the lifetime of the ambient data objects. +> [!NOTE] +> Please note, the implementations of `IAsyncState` and `IAsyncContext` are not designed to be thread-safe. + ## Install the package From the command-line: diff --git a/test/Libraries/Microsoft.Extensions.AsyncState.Tests/AsyncStateTests.cs b/test/Libraries/Microsoft.Extensions.AsyncState.Tests/AsyncStateTests.cs index e541ee04865..f7a7b050eb1 100644 --- a/test/Libraries/Microsoft.Extensions.AsyncState.Tests/AsyncStateTests.cs +++ b/test/Libraries/Microsoft.Extensions.AsyncState.Tests/AsyncStateTests.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. using System; +using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.Threading; using System.Threading.Tasks; @@ -204,4 +205,28 @@ public void RegisterContextCorrectly() Assert.Equal(3, asyncState.ContextCount); } + + [Fact] + public void EnsureCount_IncreasesCountCorrectly() + { + var l = new List(); + AsyncState.EnsureCount(l, 5); + Assert.Equal(5, l.Count); + } + + [Fact] + public void EnsureCount_WhenCountLessThanExpected() + { + var l = new List(new object?[5]); + AsyncState.EnsureCount(l, 2); + Assert.Equal(5, l.Count); + } + + [Fact] + public void EnsureCount_WhenCountEqualWithExpected() + { + var l = new List(new object?[5]); + AsyncState.EnsureCount(l, 5); + Assert.Equal(5, l.Count); + } } diff --git a/test/Libraries/Microsoft.Extensions.AsyncState.Tests/FeaturesPooledPolicyTests.cs b/test/Libraries/Microsoft.Extensions.AsyncState.Tests/FeaturesPooledPolicyTests.cs index 6e360789cd9..909389acb95 100644 --- a/test/Libraries/Microsoft.Extensions.AsyncState.Tests/FeaturesPooledPolicyTests.cs +++ b/test/Libraries/Microsoft.Extensions.AsyncState.Tests/FeaturesPooledPolicyTests.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. using System; +using System.Collections.Generic; using Xunit; namespace Microsoft.Extensions.AsyncState.Test; @@ -12,7 +13,7 @@ public void Return_ShouldBeTrue() { var policy = new FeaturesPooledPolicy(); - Assert.True(policy.Return(new Features())); + Assert.True(policy.Return([])); } [Fact] @@ -20,14 +21,12 @@ public void Return_ShouldNullList() { var policy = new FeaturesPooledPolicy(); - var features = policy.Create(); - features.Set(0, string.Empty); - features.Set(1, Array.Empty()); - features.Set(2, new object()); + var list = policy.Create(); + list.Add(string.Empty); + list.Add(Array.Empty()); + list.Add(new object()); - Assert.True(policy.Return(features)); - Assert.Null(features.Get(0)); - Assert.Null(features.Get(1)); - Assert.Null(features.Get(2)); + Assert.True(policy.Return(list)); + Assert.All(list, el => Assert.Null(el)); } } From 0800989c17a7114cc8017c00e6a997c79bbeeaa1 Mon Sep 17 00:00:00 2001 From: Martin Obratil Date: Mon, 15 Jan 2024 22:23:24 +0100 Subject: [PATCH 139/172] Extended XML doc to explicitly mention the implementations of IAsyncContext, IAsyncState and IAsyncLocalContext are not thread safe. --- .../AsyncStateHttpContextExtensions.cs | 1 + src/Libraries/Microsoft.AspNetCore.AsyncState/README.md | 2 +- .../Microsoft.Extensions.AsyncState/AsyncStateExtensions.cs | 1 + src/Libraries/Microsoft.Extensions.AsyncState/IAsyncContext.cs | 1 + .../Microsoft.Extensions.AsyncState/IAsyncLocalContext.cs | 1 + src/Libraries/Microsoft.Extensions.AsyncState/IAsyncState.cs | 1 + 6 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Libraries/Microsoft.AspNetCore.AsyncState/AsyncStateHttpContextExtensions.cs b/src/Libraries/Microsoft.AspNetCore.AsyncState/AsyncStateHttpContextExtensions.cs index 6c289c96f77..d9141dbf83e 100644 --- a/src/Libraries/Microsoft.AspNetCore.AsyncState/AsyncStateHttpContextExtensions.cs +++ b/src/Libraries/Microsoft.AspNetCore.AsyncState/AsyncStateHttpContextExtensions.cs @@ -16,6 +16,7 @@ public static class AsyncStateHttpContextExtensions /// /// Adds default implementations for , , and services, /// scoped to the lifetime of instances. + /// Please note that implementations of these interfaces are not thread safe. /// /// The to add the service to. /// The value of . diff --git a/src/Libraries/Microsoft.AspNetCore.AsyncState/README.md b/src/Libraries/Microsoft.AspNetCore.AsyncState/README.md index d53fafcbfd5..ec93c727704 100644 --- a/src/Libraries/Microsoft.AspNetCore.AsyncState/README.md +++ b/src/Libraries/Microsoft.AspNetCore.AsyncState/README.md @@ -5,7 +5,7 @@ This provides the ability to store and retrieve state objects that flow with the The lifetime of the shared data is controlled automatically and will be the same as of `HttpContext`. > [!NOTE] -> Please note, the implementation `IAsyncContext` is not designed to be thread-safe. +> Please note, the implementation of `IAsyncContext` is not designed to be thread-safe. ## Install the package diff --git a/src/Libraries/Microsoft.Extensions.AsyncState/AsyncStateExtensions.cs b/src/Libraries/Microsoft.Extensions.AsyncState/AsyncStateExtensions.cs index 9baabc82d3a..a25a8156b1a 100644 --- a/src/Libraries/Microsoft.Extensions.AsyncState/AsyncStateExtensions.cs +++ b/src/Libraries/Microsoft.Extensions.AsyncState/AsyncStateExtensions.cs @@ -15,6 +15,7 @@ public static class AsyncStateExtensions { /// /// Adds default implementations for , , and services. + /// Please note that implementations of these interfaces are not thread safe. /// /// The dependency injection container to add the implementations to. /// The value of . diff --git a/src/Libraries/Microsoft.Extensions.AsyncState/IAsyncContext.cs b/src/Libraries/Microsoft.Extensions.AsyncState/IAsyncContext.cs index f1c07ee94f8..aef151f3016 100644 --- a/src/Libraries/Microsoft.Extensions.AsyncState/IAsyncContext.cs +++ b/src/Libraries/Microsoft.Extensions.AsyncState/IAsyncContext.cs @@ -8,6 +8,7 @@ namespace Microsoft.Extensions.AsyncState; /// /// Provides access to the current async context. +/// Some implementations of this interface may not be thread safe. /// /// The type of the asynchronous state. [SuppressMessage("Naming", "CA1716:Identifiers should not match keywords", Justification = "Getter and setter throw exceptions.")] diff --git a/src/Libraries/Microsoft.Extensions.AsyncState/IAsyncLocalContext.cs b/src/Libraries/Microsoft.Extensions.AsyncState/IAsyncLocalContext.cs index 746909d1b8c..9873375a78b 100644 --- a/src/Libraries/Microsoft.Extensions.AsyncState/IAsyncLocalContext.cs +++ b/src/Libraries/Microsoft.Extensions.AsyncState/IAsyncLocalContext.cs @@ -7,6 +7,7 @@ namespace Microsoft.Extensions.AsyncState; /// /// Provides access to the current async context stored outside of the HTTP pipeline. +/// Some implementations of this interface may not be thread safe. /// /// The type of the asynchronous state. /// This type is intended for internal use. Use instead. diff --git a/src/Libraries/Microsoft.Extensions.AsyncState/IAsyncState.cs b/src/Libraries/Microsoft.Extensions.AsyncState/IAsyncState.cs index 960d6672967..ec15b72c2c9 100644 --- a/src/Libraries/Microsoft.Extensions.AsyncState/IAsyncState.cs +++ b/src/Libraries/Microsoft.Extensions.AsyncState/IAsyncState.cs @@ -9,6 +9,7 @@ namespace Microsoft.Extensions.AsyncState; /// /// Encapsulates all information within the asynchronous flow in an variable. +/// Some implementations of this interface may not be thread safe. /// [SuppressMessage("Naming", "CA1716:Identifiers should not match keywords", Justification = "Getter and setter throw exceptions.")] public interface IAsyncState From 6ed0e2c14ca3fd1a07be5c384e243627442fe09e Mon Sep 17 00:00:00 2001 From: Martin Obratil Date: Mon, 15 Jan 2024 22:53:23 +0100 Subject: [PATCH 140/172] Update thread-safety note in docs --- src/Libraries/Microsoft.AspNetCore.AsyncState/README.md | 2 +- src/Libraries/Microsoft.Extensions.AsyncState/README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Libraries/Microsoft.AspNetCore.AsyncState/README.md b/src/Libraries/Microsoft.AspNetCore.AsyncState/README.md index ec93c727704..5bce6aa3a99 100644 --- a/src/Libraries/Microsoft.AspNetCore.AsyncState/README.md +++ b/src/Libraries/Microsoft.AspNetCore.AsyncState/README.md @@ -5,7 +5,7 @@ This provides the ability to store and retrieve state objects that flow with the The lifetime of the shared data is controlled automatically and will be the same as of `HttpContext`. > [!NOTE] -> Please note, the implementation of `IAsyncContext` is not designed to be thread-safe. +> Please note, the implementation of `IAsyncContext` provided by this library is not thread-safe. ## Install the package diff --git a/src/Libraries/Microsoft.Extensions.AsyncState/README.md b/src/Libraries/Microsoft.Extensions.AsyncState/README.md index 57b93fdc4e1..46a0c434d61 100644 --- a/src/Libraries/Microsoft.Extensions.AsyncState/README.md +++ b/src/Libraries/Microsoft.Extensions.AsyncState/README.md @@ -7,7 +7,7 @@ It has a few advantages over using the [`AsyncLocal`](https://learn.microsoft - Provides a way to manage the lifetime of the ambient data objects. > [!NOTE] -> Please note, the implementations of `IAsyncState` and `IAsyncContext` are not designed to be thread-safe. +> Please note, the implementations of `IAsyncState` and `IAsyncContext` are not thread-safe. ## Install the package From 83d87c725dfab75a0b693d5f7a6b4d31aa324ead Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Obr=C3=A1til?= Date: Wed, 17 Jan 2024 20:57:32 +0100 Subject: [PATCH 141/172] Update README to mention cgroups support (#4884) The README file for the Diagnostic Resource Monitoring library has been updated. It has been mentioned that this library uses control groups (cgroups) in Linux to monitor system resources. A note has also been added stating that it currently supports cgroups v1, but there is no support for cgroups v2. Co-authored-by: Martin Obratil --- .../README.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Libraries/Microsoft.Extensions.Diagnostics.ResourceMonitoring/README.md b/src/Libraries/Microsoft.Extensions.Diagnostics.ResourceMonitoring/README.md index 8359fb3f518..563aa937652 100644 --- a/src/Libraries/Microsoft.Extensions.Diagnostics.ResourceMonitoring/README.md +++ b/src/Libraries/Microsoft.Extensions.Diagnostics.ResourceMonitoring/README.md @@ -1,6 +1,9 @@ # Microsoft.Extensions.Diagnostics.ResourceMonitoring -Measures and reports processor and memory usage. +Measures and reports processor and memory usage. This library utilizes control groups (cgroups) in Linux to monitor system resources. + +> [!NOTE] +> Currently, it supports cgroups v1 but does not have support for cgroups v2. ## Install the package From e262cd67ed1365c5b5eee78812fede896e4bfff4 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 18 Jan 2024 07:00:28 +1100 Subject: [PATCH 142/172] [main] Add workflow for automatic SDK updates (#4887) * Add workflow for automatic SDK updates * Update update-sdk.yml --------- Co-authored-by: William Godbe --- .github/workflows/update-sdk.yml | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 .github/workflows/update-sdk.yml diff --git a/.github/workflows/update-sdk.yml b/.github/workflows/update-sdk.yml new file mode 100644 index 00000000000..3097d82f336 --- /dev/null +++ b/.github/workflows/update-sdk.yml @@ -0,0 +1,27 @@ +name: update-dotnet-sdk + +on: + + # Scheduled trigger to check for .NET SDK updates at 12 UTC every Monday + schedule: + - cron: '00 12 * * MON' + + # Manual trigger to update the .NET SDK on-demand. + workflow_dispatch: + +permissions: + contents: write + issues: write + pull-requests: write + +jobs: + update-dotnet-sdk: + name: Update .NET SDK + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: martincostello/update-dotnet-sdk@31f3d5a6c2c4a5a0b7eb0e0d5c30501925d6e790 + with: + quality: 'daily' + repo-token: ${{ secrets.GITHUB_TOKEN }} + branch-name: dev From 855b57b4fe5658009a253e8f6a67915da1121149 Mon Sep 17 00:00:00 2001 From: Martin Costello Date: Thu, 18 Jan 2024 18:25:06 +0000 Subject: [PATCH 143/172] Fix SDK update workflow (#4890) - Checkout the dev branch. - Use the SHA that for the v3.1.1 tag. --- .github/workflows/update-sdk.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/update-sdk.yml b/.github/workflows/update-sdk.yml index 3097d82f336..d81ec1961cc 100644 --- a/.github/workflows/update-sdk.yml +++ b/.github/workflows/update-sdk.yml @@ -20,8 +20,9 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: martincostello/update-dotnet-sdk@31f3d5a6c2c4a5a0b7eb0e0d5c30501925d6e790 + with: + ref: dev + - uses: martincostello/update-dotnet-sdk@b3d5ca8064ec275f7a1d0b9640d28a57ab94090b with: quality: 'daily' repo-token: ${{ secrets.GITHUB_TOKEN }} - branch-name: dev From 62c78eee58287a6030c13ce3e4f21190506d7291 Mon Sep 17 00:00:00 2001 From: joegoldman2 <147369450+joegoldman2@users.noreply.github.com> Date: Sat, 20 Jan 2024 20:29:08 +0200 Subject: [PATCH 144/172] Expose AddTcpEndpointProbe (#4892) * Expose AddTcpEndpointProbe --- .../KubernetesProbesExtensions.cs | 6 +- ...KubernetesProbesOptions.EndpointOptions.cs | 59 ------------------- .../KubernetesProbesOptions.cs | 8 +-- ...ions.cs => TcpEndpointProbesExtensions.cs} | 51 ++++++++-------- .../TcpEndpointProbesOptions.cs | 55 +++++++++++++++++ ...s => TcpEndpointProbesOptionsValidator.cs} | 2 +- ...Service.cs => TcpEndpointProbesService.cs} | 10 ++-- .../KubernetesProbesExtensionsTests.cs | 12 ++-- ...cs => TcpEndpointProbesExtensionsTests.cs} | 56 +++++++++--------- ...ts.cs => TcpEndpointProbesServiceTests.cs} | 26 ++++---- 10 files changed, 141 insertions(+), 144 deletions(-) delete mode 100644 src/Libraries/Microsoft.Extensions.Diagnostics.Probes/KubernetesProbesOptions.EndpointOptions.cs rename src/Libraries/Microsoft.Extensions.Diagnostics.Probes/{TcpEndpointHealthCheckExtensions.cs => TcpEndpointProbesExtensions.cs} (67%) create mode 100644 src/Libraries/Microsoft.Extensions.Diagnostics.Probes/TcpEndpointProbesOptions.cs rename src/Libraries/Microsoft.Extensions.Diagnostics.Probes/{TcpEndpointHealthCheckOptionsValidator.cs => TcpEndpointProbesOptionsValidator.cs} (68%) rename src/Libraries/Microsoft.Extensions.Diagnostics.Probes/{TcpEndpointHealthCheckService.cs => TcpEndpointProbesService.cs} (84%) rename test/Libraries/Microsoft.Extensions.Diagnostics.Probes.Tests/{TcpEndpointHealthCheckExtensionsTests.cs => TcpEndpointProbesExtensionsTests.cs} (75%) rename test/Libraries/Microsoft.Extensions.Diagnostics.Probes.Tests/{TcpEndpointHealthCheckServiceTests.cs => TcpEndpointProbesServiceTests.cs} (75%) diff --git a/src/Libraries/Microsoft.Extensions.Diagnostics.Probes/KubernetesProbesExtensions.cs b/src/Libraries/Microsoft.Extensions.Diagnostics.Probes/KubernetesProbesExtensions.cs index f4f60965655..1eb3faf2ddc 100644 --- a/src/Libraries/Microsoft.Extensions.Diagnostics.Probes/KubernetesProbesExtensions.cs +++ b/src/Libraries/Microsoft.Extensions.Diagnostics.Probes/KubernetesProbesExtensions.cs @@ -50,7 +50,7 @@ public static IServiceCollection AddKubernetesProbes(this IServiceCollection ser var wrapperOptions = new KubernetesProbesOptions(); return services - .AddTcpEndpointHealthCheck(ProbeTags.Liveness, options => + .AddTcpEndpointProbe(ProbeTags.Liveness, options => { wrapperOptions.LivenessProbe = options; configure(wrapperOptions); @@ -64,7 +64,7 @@ public static IServiceCollection AddKubernetesProbes(this IServiceCollection ser options.FilterChecks = (check) => check.Tags.Contains(ProbeTags.Liveness) && originalPredicate(check); } }) - .AddTcpEndpointHealthCheck(ProbeTags.Startup, options => + .AddTcpEndpointProbe(ProbeTags.Startup, options => { wrapperOptions.StartupProbe = options; configure(wrapperOptions); @@ -78,7 +78,7 @@ public static IServiceCollection AddKubernetesProbes(this IServiceCollection ser options.FilterChecks = (check) => check.Tags.Contains(ProbeTags.Startup) && originalPredicate(check); } }) - .AddTcpEndpointHealthCheck(ProbeTags.Readiness, (options) => + .AddTcpEndpointProbe(ProbeTags.Readiness, (options) => { wrapperOptions.ReadinessProbe = options; configure(wrapperOptions); diff --git a/src/Libraries/Microsoft.Extensions.Diagnostics.Probes/KubernetesProbesOptions.EndpointOptions.cs b/src/Libraries/Microsoft.Extensions.Diagnostics.Probes/KubernetesProbesOptions.EndpointOptions.cs deleted file mode 100644 index 43bb7bec48f..00000000000 --- a/src/Libraries/Microsoft.Extensions.Diagnostics.Probes/KubernetesProbesOptions.EndpointOptions.cs +++ /dev/null @@ -1,59 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -using System; -using System.ComponentModel.DataAnnotations; -using System.Diagnostics.CodeAnalysis; -using Microsoft.Extensions.Diagnostics.HealthChecks; -using Microsoft.Shared.Data.Validation; - -namespace Microsoft.Extensions.Diagnostics.Probes; - -public partial class KubernetesProbesOptions -{ - /// - /// Options to control TCP-based health check probes. - /// - [SuppressMessage("Major Code Smell", "S109:Magic numbers should not be used", Justification = "In place numbers make the ranges cleaner")] - [SuppressMessage("Design", "CA1034:Nested types should not be visible", Justification = "It's fine")] - public class EndpointOptions - { - private const int DefaultMaxPendingConnections = 10; - private const int DefaultTcpPort = 2305; - - /// - /// Gets or sets the TCP port that gets opened if the service is healthy and closed otherwise. - /// - /// - /// The default value is 2305. - /// - [Range(1, 65535)] - public int TcpPort { get; set; } = DefaultTcpPort; - - /// - /// Gets or sets the maximum length of the pending connections queue. - /// - /// - /// The default value is 10. - /// - [Range(1, 10000)] - public int MaxPendingConnections { get; set; } = DefaultMaxPendingConnections; - - /// - /// Gets or sets the interval at which the health of the application is assessed. - /// - /// - /// The default value is 30 seconds. - /// - [TimeSpan("00:00:05", "00:05:00")] - public TimeSpan HealthAssessmentPeriod { get; set; } = TimeSpan.FromSeconds(30); - - /// - /// Gets or sets a predicate that is used to include health checks based on user-defined criteria. - /// - /// - /// The default value is , which has the effect of enabling all health checks. - /// - public Func? FilterChecks { get; set; } - } -} diff --git a/src/Libraries/Microsoft.Extensions.Diagnostics.Probes/KubernetesProbesOptions.cs b/src/Libraries/Microsoft.Extensions.Diagnostics.Probes/KubernetesProbesOptions.cs index 59f7fbed4df..8ec7a1c78db 100644 --- a/src/Libraries/Microsoft.Extensions.Diagnostics.Probes/KubernetesProbesOptions.cs +++ b/src/Libraries/Microsoft.Extensions.Diagnostics.Probes/KubernetesProbesOptions.cs @@ -6,7 +6,7 @@ namespace Microsoft.Extensions.Diagnostics.Probes; /// /// Options for Kubernetes probes. /// -public partial class KubernetesProbesOptions +public class KubernetesProbesOptions { private const int DefaultLivenessProbePort = 2305; private const int DefaultStartupProbePort = 2306; @@ -18,7 +18,7 @@ public partial class KubernetesProbesOptions /// /// Default port is 2305. /// - public EndpointOptions LivenessProbe { get; set; } = new EndpointOptions + public TcpEndpointProbesOptions LivenessProbe { get; set; } = new TcpEndpointProbesOptions { TcpPort = DefaultLivenessProbePort, }; @@ -29,7 +29,7 @@ public partial class KubernetesProbesOptions /// /// Default port is 2306. /// - public EndpointOptions StartupProbe { get; set; } = new EndpointOptions + public TcpEndpointProbesOptions StartupProbe { get; set; } = new TcpEndpointProbesOptions { TcpPort = DefaultStartupProbePort, }; @@ -40,7 +40,7 @@ public partial class KubernetesProbesOptions /// /// Default port is 2307. /// - public EndpointOptions ReadinessProbe { get; set; } = new EndpointOptions + public TcpEndpointProbesOptions ReadinessProbe { get; set; } = new TcpEndpointProbesOptions { TcpPort = DefaultReadinessProbePort, }; diff --git a/src/Libraries/Microsoft.Extensions.Diagnostics.Probes/TcpEndpointHealthCheckExtensions.cs b/src/Libraries/Microsoft.Extensions.Diagnostics.Probes/TcpEndpointProbesExtensions.cs similarity index 67% rename from src/Libraries/Microsoft.Extensions.Diagnostics.Probes/TcpEndpointHealthCheckExtensions.cs rename to src/Libraries/Microsoft.Extensions.Diagnostics.Probes/TcpEndpointProbesExtensions.cs index 566b9b6a076..c3b5dbb04d6 100644 --- a/src/Libraries/Microsoft.Extensions.Diagnostics.Probes/TcpEndpointHealthCheckExtensions.cs +++ b/src/Libraries/Microsoft.Extensions.Diagnostics.Probes/TcpEndpointProbesExtensions.cs @@ -5,16 +5,17 @@ using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Diagnostics.HealthChecks; +using Microsoft.Extensions.Diagnostics.Probes; using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Options; using Microsoft.Shared.Diagnostics; -namespace Microsoft.Extensions.Diagnostics.Probes; +namespace Microsoft.Extensions.DependencyInjection; /// -/// Extension methods for for . +/// Extension methods for setting up TCP-based health check probes. /// -internal static class TcpEndpointHealthCheckExtensions +public static class TcpEndpointProbesExtensions { /// /// Registers health status reporting using a TCP port @@ -22,11 +23,11 @@ internal static class TcpEndpointHealthCheckExtensions /// /// The to add the services to. /// The value of . - internal static IServiceCollection AddTcpEndpointHealthCheck(this IServiceCollection services) + public static IServiceCollection AddTcpEndpointProbe(this IServiceCollection services) { _ = Throw.IfNull(services); - return services.AddTcpEndpointHealthCheck(Microsoft.Extensions.Options.Options.DefaultName); + return services.AddTcpEndpointProbe(Microsoft.Extensions.Options.Options.DefaultName); } /// @@ -36,19 +37,19 @@ internal static IServiceCollection AddTcpEndpointHealthCheck(this IServiceCollec /// The to add the services to. /// Name used to retrieve the options. /// The value of . - internal static IServiceCollection AddTcpEndpointHealthCheck(this IServiceCollection services, string name) + public static IServiceCollection AddTcpEndpointProbe(this IServiceCollection services, string name) { _ = Throw.IfNull(services); _ = services.AddHealthChecks(); _ = services - .AddOptionsWithValidateOnStart(name); + .AddOptionsWithValidateOnStart(name); _ = services.AddSingleton(provider => { - var options = provider.GetRequiredService>().Get(name); - return ActivatorUtilities.CreateInstance(provider, options); + var options = provider.GetRequiredService>().Get(name); + return ActivatorUtilities.CreateInstance(provider, options); }); return services; @@ -59,18 +60,18 @@ internal static IServiceCollection AddTcpEndpointHealthCheck(this IServiceCollec /// if service is considered as healthy . /// /// The to add the services to. - /// Configuration for . + /// Configuration for . /// The value of . - internal static IServiceCollection AddTcpEndpointHealthCheck( + public static IServiceCollection AddTcpEndpointProbe( this IServiceCollection services, - Action configure) + Action configure) { _ = Throw.IfNull(services); _ = Throw.IfNull(configure); _ = services.Configure(configure); - return services.AddTcpEndpointHealthCheck(); + return services.AddTcpEndpointProbe(); } /// @@ -79,19 +80,19 @@ internal static IServiceCollection AddTcpEndpointHealthCheck( /// /// The to add the services to. /// Name for the options. - /// Configuration for . + /// Configuration for . /// The value of . - internal static IServiceCollection AddTcpEndpointHealthCheck( + public static IServiceCollection AddTcpEndpointProbe( this IServiceCollection services, string name, - Action configure) + Action configure) { _ = Throw.IfNull(services); _ = Throw.IfNull(configure); _ = services.Configure(name, configure); - return services.AddTcpEndpointHealthCheck(name); + return services.AddTcpEndpointProbe(name); } /// @@ -99,18 +100,18 @@ internal static IServiceCollection AddTcpEndpointHealthCheck( /// if service is considered as healthy . /// /// The to add the services to. - /// Configuration for . + /// Configuration for . /// The value of . - internal static IServiceCollection AddTcpEndpointHealthCheck( + public static IServiceCollection AddTcpEndpointProbe( this IServiceCollection services, IConfigurationSection configurationSection) { _ = Throw.IfNull(services); _ = Throw.IfNull(configurationSection); - _ = services.Configure(configurationSection); + _ = services.Configure(configurationSection); - return services.AddTcpEndpointHealthCheck(); + return services.AddTcpEndpointProbe(); } /// @@ -119,9 +120,9 @@ internal static IServiceCollection AddTcpEndpointHealthCheck( /// /// The to add the services to. /// Name for the options. - /// Configuration for . + /// Configuration for . /// The value of . - internal static IServiceCollection AddTcpEndpointHealthCheck( + public static IServiceCollection AddTcpEndpointProbe( this IServiceCollection services, string name, IConfigurationSection configurationSection) @@ -129,8 +130,8 @@ internal static IServiceCollection AddTcpEndpointHealthCheck( _ = Throw.IfNull(services); _ = Throw.IfNull(configurationSection); - _ = services.Configure(name, configurationSection); + _ = services.Configure(name, configurationSection); - return services.AddTcpEndpointHealthCheck(name); + return services.AddTcpEndpointProbe(name); } } diff --git a/src/Libraries/Microsoft.Extensions.Diagnostics.Probes/TcpEndpointProbesOptions.cs b/src/Libraries/Microsoft.Extensions.Diagnostics.Probes/TcpEndpointProbesOptions.cs new file mode 100644 index 00000000000..af777ea08ab --- /dev/null +++ b/src/Libraries/Microsoft.Extensions.Diagnostics.Probes/TcpEndpointProbesOptions.cs @@ -0,0 +1,55 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System; +using System.ComponentModel.DataAnnotations; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Diagnostics.HealthChecks; +using Microsoft.Shared.Data.Validation; + +namespace Microsoft.Extensions.Diagnostics.Probes; + +/// +/// Options to control TCP-based health check probes. +/// +[SuppressMessage("Major Code Smell", "S109:Magic numbers should not be used", Justification = "In place numbers make the ranges cleaner")] +public class TcpEndpointProbesOptions +{ + private const int DefaultMaxPendingConnections = 10; + private const int DefaultTcpPort = 2305; + + /// + /// Gets or sets the TCP port that gets opened if the service is healthy and closed otherwise. + /// + /// + /// The default value is 2305. + /// + [Range(1, 65535)] + public int TcpPort { get; set; } = DefaultTcpPort; + + /// + /// Gets or sets the maximum length of the pending connections queue. + /// + /// + /// The default value is 10. + /// + [Range(1, 10000)] + public int MaxPendingConnections { get; set; } = DefaultMaxPendingConnections; + + /// + /// Gets or sets the interval at which the health of the application is assessed. + /// + /// + /// The default value is 30 seconds. + /// + [TimeSpan("00:00:05", "00:05:00")] + public TimeSpan HealthAssessmentPeriod { get; set; } = TimeSpan.FromSeconds(30); + + /// + /// Gets or sets a predicate that is used to include health checks based on user-defined criteria. + /// + /// + /// The default value is , which has the effect of enabling all health checks. + /// + public Func? FilterChecks { get; set; } +} diff --git a/src/Libraries/Microsoft.Extensions.Diagnostics.Probes/TcpEndpointHealthCheckOptionsValidator.cs b/src/Libraries/Microsoft.Extensions.Diagnostics.Probes/TcpEndpointProbesOptionsValidator.cs similarity index 68% rename from src/Libraries/Microsoft.Extensions.Diagnostics.Probes/TcpEndpointHealthCheckOptionsValidator.cs rename to src/Libraries/Microsoft.Extensions.Diagnostics.Probes/TcpEndpointProbesOptionsValidator.cs index 0a11191883e..2ae823df7e6 100644 --- a/src/Libraries/Microsoft.Extensions.Diagnostics.Probes/TcpEndpointHealthCheckOptionsValidator.cs +++ b/src/Libraries/Microsoft.Extensions.Diagnostics.Probes/TcpEndpointProbesOptionsValidator.cs @@ -6,6 +6,6 @@ namespace Microsoft.Extensions.Diagnostics.Probes; [OptionsValidator] -internal sealed partial class EndpointOptionsValidator : IValidateOptions +internal sealed partial class TcpEndpointProbesOptionsValidator : IValidateOptions { } diff --git a/src/Libraries/Microsoft.Extensions.Diagnostics.Probes/TcpEndpointHealthCheckService.cs b/src/Libraries/Microsoft.Extensions.Diagnostics.Probes/TcpEndpointProbesService.cs similarity index 84% rename from src/Libraries/Microsoft.Extensions.Diagnostics.Probes/TcpEndpointHealthCheckService.cs rename to src/Libraries/Microsoft.Extensions.Diagnostics.Probes/TcpEndpointProbesService.cs index 77905ee0bfa..8ede62ff92c 100644 --- a/src/Libraries/Microsoft.Extensions.Diagnostics.Probes/TcpEndpointHealthCheckService.cs +++ b/src/Libraries/Microsoft.Extensions.Diagnostics.Probes/TcpEndpointProbesService.cs @@ -16,18 +16,18 @@ namespace Microsoft.Extensions.Diagnostics.Probes; /// /// Opens a TCP port if the service is healthy and closes it otherwise. /// -internal sealed class TcpEndpointHealthCheckService : BackgroundService +internal sealed class TcpEndpointProbesService : BackgroundService { internal TimeProvider TimeProvider { get; set; } = TimeProvider.System; - private readonly ILogger _logger; + private readonly ILogger _logger; private readonly HealthCheckService _healthCheckService; - private readonly KubernetesProbesOptions.EndpointOptions _options; -#pragma warning disable CA2213 // 'TcpEndpointHealthCheckService' contains field '_listener' that is of IDisposable type 'TcpListener' + private readonly TcpEndpointProbesOptions _options; +#pragma warning disable CA2213 // 'TcpEndpointProbesService' contains field '_listener' that is of IDisposable type 'TcpListener' private readonly TcpListener _listener; #pragma warning restore CA2213 - public TcpEndpointHealthCheckService(ILogger logger, HealthCheckService healthCheckService, KubernetesProbesOptions.EndpointOptions options) + public TcpEndpointProbesService(ILogger logger, HealthCheckService healthCheckService, TcpEndpointProbesOptions options) { _logger = logger; _healthCheckService = healthCheckService; diff --git a/test/Libraries/Microsoft.Extensions.Diagnostics.Probes.Tests/KubernetesProbesExtensionsTests.cs b/test/Libraries/Microsoft.Extensions.Diagnostics.Probes.Tests/KubernetesProbesExtensionsTests.cs index 5e283a7bceb..6629dce7ca9 100644 --- a/test/Libraries/Microsoft.Extensions.Diagnostics.Probes.Tests/KubernetesProbesExtensionsTests.cs +++ b/test/Libraries/Microsoft.Extensions.Diagnostics.Probes.Tests/KubernetesProbesExtensionsTests.cs @@ -33,8 +33,8 @@ public void AddKubernetesProbes_RegistersAllProbes() services.AddKubernetesProbes().AddHealthChecks(); }); - var hostedServices = host.Services.GetServices().Where(service => service.GetType().Name == "TcpEndpointHealthCheckService"); - var configurations = host.Services.GetServices>(); + var hostedServices = host.Services.GetServices().Where(service => service.GetType().Name == "TcpEndpointProbesService"); + var configurations = host.Services.GetServices>(); Assert.Equal(3, hostedServices.Count()); Assert.Single(configurations); @@ -74,8 +74,8 @@ public void AddKubernetesProbes_WithConfigureAction_RegistersAllProbes() }).AddHealthChecks(); }); - var hostedServices = host.Services.GetServices().Where(service => service.GetType().Name == "TcpEndpointHealthCheckService"); - var configurations = host.Services.GetServices>(); + var hostedServices = host.Services.GetServices().Where(service => service.GetType().Name == "TcpEndpointProbesService"); + var configurations = host.Services.GetServices>(); Assert.Equal(3, hostedServices.Count()); Assert.Single(configurations); @@ -102,8 +102,8 @@ public void AddKubernetesProbes_WithConfigurationSection_RegistersAllProbes() services.AddKubernetesProbes(configuration.GetSection("KubernetesProbes")).AddHealthChecks(); }); - var hostedServices = host.Services.GetServices().Where(service => service.GetType().Name == "TcpEndpointHealthCheckService"); - var configurations = host.Services.GetServices>(); + var hostedServices = host.Services.GetServices().Where(service => service.GetType().Name == "TcpEndpointProbesService"); + var configurations = host.Services.GetServices>(); Assert.Equal(3, hostedServices.Count()); Assert.Single(configurations); diff --git a/test/Libraries/Microsoft.Extensions.Diagnostics.Probes.Tests/TcpEndpointHealthCheckExtensionsTests.cs b/test/Libraries/Microsoft.Extensions.Diagnostics.Probes.Tests/TcpEndpointProbesExtensionsTests.cs similarity index 75% rename from test/Libraries/Microsoft.Extensions.Diagnostics.Probes.Tests/TcpEndpointHealthCheckExtensionsTests.cs rename to test/Libraries/Microsoft.Extensions.Diagnostics.Probes.Tests/TcpEndpointProbesExtensionsTests.cs index 94ec7cfa4a8..e77df5d3d7a 100644 --- a/test/Libraries/Microsoft.Extensions.Diagnostics.Probes.Tests/TcpEndpointHealthCheckExtensionsTests.cs +++ b/test/Libraries/Microsoft.Extensions.Diagnostics.Probes.Tests/TcpEndpointProbesExtensionsTests.cs @@ -21,39 +21,39 @@ namespace Microsoft.Extensions.Diagnostics.Probes.Test; -public class TcpEndpointHealthCheckExtensionsTests +public class TcpEndpointProbesExtensionsTests { [Fact] - public void AddTcpEndpointHealthCheckTest_WithoutConfig() + public void AddTcpEndpointProbeTest_WithoutConfig() { using var host = CreateWebHost(services => { services .AddRouting() - .AddTcpEndpointHealthCheck(); + .AddTcpEndpointProbe(); }); - var hostedServices = host.Services.GetServices().Where(x => x is TcpEndpointHealthCheckService); + var hostedServices = host.Services.GetServices().Where(x => x is TcpEndpointProbesService); Assert.Single(hostedServices); } [Fact] - public void AddTcpEndpointHealthCheckTest_WithAction() + public void AddTcpEndpointProbeTest_WithAction() { using var host = CreateWebHost(services => { services .AddRouting() - .AddTcpEndpointHealthCheck(o => + .AddTcpEndpointProbe(o => { o.FilterChecks = _ => false; o.HealthAssessmentPeriod = TimeSpan.FromSeconds(15); }); }); - var hostedServices = host.Services.GetServices().Where(x => x is TcpEndpointHealthCheckService); - var configurations = host.Services.GetServices>(); + var hostedServices = host.Services.GetServices().Where(x => x is TcpEndpointProbesService); + var configurations = host.Services.GetServices>(); Assert.Single(hostedServices); var config = Assert.Single(configurations); @@ -61,36 +61,36 @@ public void AddTcpEndpointHealthCheckTest_WithAction() } [Fact] - public void AddTcpEndpointHealthCheckTest_WithName_WithoutConfig() + public void AddTcpEndpointProbeTest_WithName_WithoutConfig() { using var host = CreateWebHost(services => { services .AddRouting() - .AddTcpEndpointHealthCheck("Liveness"); + .AddTcpEndpointProbe("Liveness"); }); - var hostedServices = host.Services.GetServices().Where(x => x is TcpEndpointHealthCheckService); + var hostedServices = host.Services.GetServices().Where(x => x is TcpEndpointProbesService); Assert.Single(hostedServices); } [Fact] - public void AddTcpEndpointHealthCheckTest_WithName_WithAction() + public void AddTcpEndpointProbeTest_WithName_WithAction() { using var host = CreateWebHost(services => { services .AddRouting() - .AddTcpEndpointHealthCheck("Liveness", o => + .AddTcpEndpointProbe("Liveness", o => { o.FilterChecks = _ => false; o.HealthAssessmentPeriod = TimeSpan.FromSeconds(5); }); }); - var hostedServices = host.Services.GetServices().Where(x => x is TcpEndpointHealthCheckService); - var configurations = host.Services.GetServices>(); + var hostedServices = host.Services.GetServices().Where(x => x is TcpEndpointProbesService); + var configurations = host.Services.GetServices>(); Assert.Single(hostedServices); var config = Assert.Single(configurations); @@ -99,7 +99,7 @@ public void AddTcpEndpointHealthCheckTest_WithName_WithAction() } [Fact] - public void AddTcpEndpointHealthCheckTest_WithConfigurationSection() + public void AddTcpEndpointProbeTest_WithConfigurationSection() { var config = new ConfigurationBuilder() .AddInMemoryCollection(new Dictionary @@ -112,11 +112,11 @@ public void AddTcpEndpointHealthCheckTest_WithConfigurationSection() { services .AddRouting() - .AddTcpEndpointHealthCheck(config.GetSection("TcpHealthCheck")); + .AddTcpEndpointProbe(config.GetSection("TcpHealthCheck")); }); - var hostedServices = host.Services.GetServices().Where(x => x is TcpEndpointHealthCheckService); - var configurations = host.Services.GetServices>(); + var hostedServices = host.Services.GetServices().Where(x => x is TcpEndpointProbesService); + var configurations = host.Services.GetServices>(); Assert.Single(hostedServices); var configuration = Assert.Single(configurations); @@ -124,7 +124,7 @@ public void AddTcpEndpointHealthCheckTest_WithConfigurationSection() } [Fact] - public void AddTcpEndpointHealthCheckTest_WithName_WithConfigurationSection() + public void AddTcpEndpointProbeTest_WithName_WithConfigurationSection() { var config = new ConfigurationBuilder() .AddInMemoryCollection(new Dictionary @@ -137,11 +137,11 @@ public void AddTcpEndpointHealthCheckTest_WithName_WithConfigurationSection() { services .AddRouting() - .AddTcpEndpointHealthCheck("Liveness", config.GetSection("TcpHealthCheck")); + .AddTcpEndpointProbe("Liveness", config.GetSection("TcpHealthCheck")); }); - var hostedServices = host.Services.GetServices().Where(x => x is TcpEndpointHealthCheckService); - var configurations = host.Services.GetServices>(); + var hostedServices = host.Services.GetServices().Where(x => x is TcpEndpointProbesService); + var configurations = host.Services.GetServices>(); Assert.Single(hostedServices); Assert.Single(configurations); @@ -151,18 +151,18 @@ public void AddTcpEndpointHealthCheckTest_WithName_WithConfigurationSection() } [Fact] - public void AddTcpEndpointHealthCheckTest_MultipleNamed() + public void AddTcpEndpointProbeTest_MultipleNamed() { using var host = CreateWebHost(services => { services .AddRouting() - .AddTcpEndpointHealthCheck("Liveness") - .AddTcpEndpointHealthCheck("Readiness"); + .AddTcpEndpointProbe("Liveness") + .AddTcpEndpointProbe("Readiness"); }); - var hostedServices = host.Services.GetServices().Where(x => x is TcpEndpointHealthCheckService); - var configurations = host.Services.GetServices>(); + var hostedServices = host.Services.GetServices().Where(x => x is TcpEndpointProbesService); + var configurations = host.Services.GetServices>(); Assert.Equal(2, hostedServices.Count()); Assert.Single(configurations); diff --git a/test/Libraries/Microsoft.Extensions.Diagnostics.Probes.Tests/TcpEndpointHealthCheckServiceTests.cs b/test/Libraries/Microsoft.Extensions.Diagnostics.Probes.Tests/TcpEndpointProbesServiceTests.cs similarity index 75% rename from test/Libraries/Microsoft.Extensions.Diagnostics.Probes.Tests/TcpEndpointHealthCheckServiceTests.cs rename to test/Libraries/Microsoft.Extensions.Diagnostics.Probes.Tests/TcpEndpointProbesServiceTests.cs index ff9c93ff871..ee236aa9d66 100644 --- a/test/Libraries/Microsoft.Extensions.Diagnostics.Probes.Tests/TcpEndpointHealthCheckServiceTests.cs +++ b/test/Libraries/Microsoft.Extensions.Diagnostics.Probes.Tests/TcpEndpointProbesServiceTests.cs @@ -12,8 +12,8 @@ namespace Microsoft.Extensions.Diagnostics.Probes.Test; -[CollectionDefinition(nameof(TcpEndpointHealthCheckServiceTests), DisableParallelization = true)] -public class TcpEndpointHealthCheckServiceTests +[CollectionDefinition(nameof(TcpEndpointProbesServiceTests), DisableParallelization = true)] +public class TcpEndpointProbesServiceTests { [Fact] public async Task ExecuteAsync_CheckListenerOpenAndCloseAfterHealthStatusEvents() @@ -24,13 +24,13 @@ public async Task ExecuteAsync_CheckListenerOpenAndCloseAfterHealthStatusEvents( var healthCheckService = new MockHealthCheckService(); - var options = new KubernetesProbesOptions.EndpointOptions + var options = new TcpEndpointProbesOptions { TcpPort = port, }; var timeProvider = new FakeTimeProvider(); - using var tcpEndpointHealthCheckService = new TcpEndpointHealthCheckService( - new FakeLogger(), + using var tcpEndpointProbesService = new TcpEndpointProbesService( + new FakeLogger(), healthCheckService, options) { @@ -39,8 +39,8 @@ public async Task ExecuteAsync_CheckListenerOpenAndCloseAfterHealthStatusEvents( Assert.False(IsTcpOpened(port)); - await tcpEndpointHealthCheckService.StartAsync(cts.Token); - await tcpEndpointHealthCheckService.UpdateHealthStatusAsync(cts.Token); + await tcpEndpointProbesService.StartAsync(cts.Token); + await tcpEndpointProbesService.UpdateHealthStatusAsync(cts.Token); Assert.True(IsTcpOpened(port)); @@ -49,7 +49,7 @@ public async Task ExecuteAsync_CheckListenerOpenAndCloseAfterHealthStatusEvents( Assert.True(IsTcpOpened(port)); healthCheckService.IsHealthy = false; - await tcpEndpointHealthCheckService.UpdateHealthStatusAsync(cts.Token); + await tcpEndpointProbesService.UpdateHealthStatusAsync(cts.Token); Assert.False(IsTcpOpened(port)); @@ -58,7 +58,7 @@ public async Task ExecuteAsync_CheckListenerOpenAndCloseAfterHealthStatusEvents( Assert.False(IsTcpOpened(port)); healthCheckService.IsHealthy = true; - await tcpEndpointHealthCheckService.UpdateHealthStatusAsync(cts.Token); + await tcpEndpointProbesService.UpdateHealthStatusAsync(cts.Token); Assert.True(IsTcpOpened(port)); @@ -73,13 +73,13 @@ public async Task ExecuteAsync_Does_Nothing_On_Cancellation() var healthCheckService = new MockHealthCheckService(); - var options = new KubernetesProbesOptions.EndpointOptions + var options = new TcpEndpointProbesOptions { TcpPort = port, }; var timeProvider = new FakeTimeProvider(); - using var tcpEndpointHealthCheckService = new TcpEndpointHealthCheckService( - new FakeLogger(), + using var tcpEndpointProbesService = new TcpEndpointProbesService( + new FakeLogger(), healthCheckService, options) { @@ -89,7 +89,7 @@ public async Task ExecuteAsync_Does_Nothing_On_Cancellation() using var cts = new CancellationTokenSource(); cts.Cancel(); - await tcpEndpointHealthCheckService.StartAsync(cts.Token); + await tcpEndpointProbesService.StartAsync(cts.Token); Assert.False(IsTcpOpened(port)); } From 9f25d9d74674483298cd167cf8ff6e9d9026bf20 Mon Sep 17 00:00:00 2001 From: Martin Taillefer Date: Mon, 22 Jan 2024 08:35:52 -0800 Subject: [PATCH 145/172] Address a couple log generator issues. (#4894) - Fix a bug where a tag provider attached to an enumerable parameter or property wouldn't behave as expected. Fixes #4883. - When an event id is not specified, instead of emitting 0 for the the id, we now hash the event name and/or method name. This matches the behavior of the generator in dotnet/runtime and is generally more useful. Co-authored-by: Martin Taillefer --- .../Emission/Emitter.Method.cs | 24 +++++++++++++-- .../Generated/LogMethodTests.cs | 20 ++++++------- .../Generated/LogPropertiesTests.cs | 8 ++--- .../Generated/TagProviderTests.cs | 30 +++++++++++++++---- .../TestClasses/TagProviderExtensions.cs | 17 +++++++++++ 5 files changed, 78 insertions(+), 21 deletions(-) diff --git a/src/Generators/Microsoft.Gen.Logging/Emission/Emitter.Method.cs b/src/Generators/Microsoft.Gen.Logging/Emission/Emitter.Method.cs index cfd8930233e..a7fa6b02e59 100644 --- a/src/Generators/Microsoft.Gen.Logging/Emission/Emitter.Method.cs +++ b/src/Generators/Microsoft.Gen.Logging/Emission/Emitter.Method.cs @@ -91,7 +91,7 @@ private void GenLogMethod(LoggingMethod lm) } else { - OutLn($"new(0, {eventName}),"); + OutLn($"new({GetNonRandomizedHashCode(eventName)}, {eventName}),"); } OutLn($"{stateName},"); @@ -134,6 +134,26 @@ private void GenLogMethod(LoggingMethod lm) OutLn($"{stateName}.Clear();"); OutCloseBrace(); + /// + /// Returns a non-randomized hash code for the given string. + /// + /// + /// We always return a positive value. + /// This code is cloned from the logging generator in dotnet/runtime in + /// order to retain the same event ids when upgrading to this generator. + /// + static int GetNonRandomizedHashCode(string s) + { + const int Mult = 16_777_619; + uint result = 2_166_136_261u; + foreach (char c in s) + { + result = (c ^ result) * Mult; + } + + return Math.Abs((int)result); + } + static bool ShouldStringifyParameter(LoggingMethodParameter p) { if (p.IsReference) @@ -395,7 +415,7 @@ void GenTagWrites(LoggingMethod lm, string stateName, out int numReservedUnclass foreach (var p in lm.Parameters) { - if (p.HasProperties && p.SkipNullProperties) + if (p.HasProperties && p.SkipNullProperties && !p.HasTagProvider) { p.TraverseParameterPropertiesTransitively((propertyChain, member) => { diff --git a/test/Generators/Microsoft.Gen.Logging/Generated/LogMethodTests.cs b/test/Generators/Microsoft.Gen.Logging/Generated/LogMethodTests.cs index b4b3e14229f..61aea4cd380 100644 --- a/test/Generators/Microsoft.Gen.Logging/Generated/LogMethodTests.cs +++ b/test/Generators/Microsoft.Gen.Logging/Generated/LogMethodTests.cs @@ -231,7 +231,7 @@ public void ConstructorVariationsTests() Assert.Null(collector.LatestRecord.Exception); Assert.Equal("M1 One", collector.LatestRecord.Message); Assert.Equal(LogLevel.Error, collector.LatestRecord.Level); - Assert.Equal(0, collector.LatestRecord.Id.Id); + Assert.NotEqual(0, collector.LatestRecord.Id.Id); Assert.Equal(1, collector.Count); collector.Clear(); @@ -239,7 +239,7 @@ public void ConstructorVariationsTests() Assert.Null(collector.LatestRecord.Exception); Assert.Equal(string.Empty, collector.LatestRecord.Message); Assert.Equal(LogLevel.Debug, collector.LatestRecord.Level); - Assert.Equal(0, collector.LatestRecord.Id.Id); + Assert.NotEqual(0, collector.LatestRecord.Id.Id); Assert.Equal(1, collector.Count); collector.Clear(); @@ -247,7 +247,7 @@ public void ConstructorVariationsTests() Assert.Null(collector.LatestRecord.Exception); Assert.Equal(string.Empty, collector.LatestRecord.Message); Assert.Equal(LogLevel.Error, collector.LatestRecord.Level); - Assert.Equal(0, collector.LatestRecord.Id.Id); + Assert.NotEqual(0, collector.LatestRecord.Id.Id); Assert.Equal(1, collector.Count); collector.Clear(); @@ -255,7 +255,7 @@ public void ConstructorVariationsTests() Assert.Null(collector.LatestRecord.Exception); Assert.Equal("M4 Four", collector.LatestRecord.Message); Assert.Equal(LogLevel.Debug, collector.LatestRecord.Level); - Assert.Equal(0, collector.LatestRecord.Id.Id); + Assert.NotEqual(0, collector.LatestRecord.Id.Id); Assert.Equal(1, collector.Count); collector.Clear(); @@ -263,7 +263,7 @@ public void ConstructorVariationsTests() Assert.Null(collector.LatestRecord.Exception); Assert.Equal("M5 Five", collector.LatestRecord.Message); Assert.Equal(LogLevel.Error, collector.LatestRecord.Level); - Assert.Equal(0, collector.LatestRecord.Id.Id); + Assert.NotEqual(0, collector.LatestRecord.Id.Id); Assert.Equal(1, collector.Count); collector.Clear(); @@ -271,7 +271,7 @@ public void ConstructorVariationsTests() Assert.Null(collector.LatestRecord.Exception); Assert.Equal(string.Empty, collector.LatestRecord.Message); Assert.Equal(LogLevel.Debug, collector.LatestRecord.Level); - Assert.Equal(0, collector.LatestRecord.Id.Id); + Assert.NotEqual(0, collector.LatestRecord.Id.Id); Assert.Equal(1, collector.Count); collector.Clear(); @@ -282,7 +282,7 @@ public void ConstructorVariationsTests() Assert.Null(logRecord.Exception); Assert.Equal(string.Empty, logRecord.Message); Assert.Equal(LogLevel.Information, logRecord.Level); - Assert.Equal(0, logRecord.Id.Id); + Assert.NotEqual(0, logRecord.Id.Id); Assert.Equal("M7", logRecord.Id.Name); collector.Clear(); @@ -336,7 +336,7 @@ public void MessageTests() Assert.Null(collector.LatestRecord.Exception); Assert.Equal("\"p\" -> \"q\"", collector.LatestRecord.Message); Assert.Equal(LogLevel.Warning, collector.LatestRecord.Level); - Assert.Equal(0, collector.LatestRecord.Id.Id); + Assert.NotEqual(0, collector.LatestRecord.Id.Id); Assert.Equal(1, collector.Count); collector.Clear(); @@ -344,7 +344,7 @@ public void MessageTests() Assert.Null(collector.LatestRecord.Exception); Assert.Equal("\"\n\r\\", collector.LatestRecord.Message); Assert.Equal(LogLevel.Debug, collector.LatestRecord.Level); - Assert.Equal(0, collector.LatestRecord.Id.Id); + Assert.NotEqual(0, collector.LatestRecord.Id.Id); Assert.Equal(1, collector.Count); } @@ -575,7 +575,7 @@ public void EventNameTests() Assert.Null(logRecord.Exception); Assert.Equal(string.Empty, logRecord.Message); Assert.Equal(LogLevel.Warning, logRecord.Level); - Assert.Equal(0, logRecord.Id.Id); + Assert.NotEqual(0, logRecord.Id.Id); Assert.Equal("M1_Event", logRecord.Id.Name); } diff --git a/test/Generators/Microsoft.Gen.Logging/Generated/LogPropertiesTests.cs b/test/Generators/Microsoft.Gen.Logging/Generated/LogPropertiesTests.cs index a840082f8e6..506d67f7d59 100644 --- a/test/Generators/Microsoft.Gen.Logging/Generated/LogPropertiesTests.cs +++ b/test/Generators/Microsoft.Gen.Logging/Generated/LogPropertiesTests.cs @@ -431,7 +431,7 @@ public void LogPropertiesDefaultAttrCtor() Assert.Equal(1, _logger.Collector.Count); var latestRecord = _logger.Collector.LatestRecord; Assert.Null(latestRecord.Exception); - Assert.Equal(0, latestRecord.Id.Id); + Assert.NotEqual(0, latestRecord.Id.Id); Assert.Equal(LogLevel.Critical, latestRecord.Level); Assert.Equal(string.Empty, latestRecord.Message); @@ -482,7 +482,7 @@ public void LogPropertiesRecordClassArgument() Assert.Equal(1, _logger.Collector.Count); var latestRecord = _logger.Collector.LatestRecord; Assert.Null(latestRecord.Exception); - Assert.Equal(0, latestRecord.Id.Id); + Assert.NotEqual(0, latestRecord.Id.Id); Assert.Equal(LogLevel.Debug, latestRecord.Level); Assert.Empty(latestRecord.Message); @@ -507,7 +507,7 @@ public void LogPropertiesRecordStructArgument() Assert.Equal(1, _logger.Collector.Count); var latestRecord = _logger.Collector.LatestRecord; Assert.Null(latestRecord.Exception); - Assert.Equal(0, latestRecord.Id.Id); + Assert.NotEqual(0, latestRecord.Id.Id); Assert.Equal(LogLevel.Debug, latestRecord.Level); Assert.Equal($"Struct is: {recordToLog}", latestRecord.Message); @@ -533,7 +533,7 @@ public void LogPropertiesReadonlyRecordStructArgument() Assert.Equal(1, _logger.Collector.Count); var latestRecord = _logger.Collector.LatestRecord; Assert.Null(latestRecord.Exception); - Assert.Equal(0, latestRecord.Id.Id); + Assert.NotEqual(0, latestRecord.Id.Id); Assert.Equal(LogLevel.Debug, latestRecord.Level); Assert.Equal($"Readonly struct is: {recordToLog}", latestRecord.Message); diff --git a/test/Generators/Microsoft.Gen.Logging/Generated/TagProviderTests.cs b/test/Generators/Microsoft.Gen.Logging/Generated/TagProviderTests.cs index 1ce9ca8564a..3733499617a 100644 --- a/test/Generators/Microsoft.Gen.Logging/Generated/TagProviderTests.cs +++ b/test/Generators/Microsoft.Gen.Logging/Generated/TagProviderTests.cs @@ -80,7 +80,7 @@ public void LogsWhenDefaultAttrCtorInNonStaticClass() Assert.Equal(1, _logger.Collector.Count); var latestRecord = _logger.Collector.LatestRecord; Assert.Null(latestRecord.Exception); - Assert.Equal(0, latestRecord.Id.Id); + Assert.NotEqual(0, latestRecord.Id.Id); Assert.Equal(LogLevel.Debug, latestRecord.Level); Assert.Equal(string.Empty, latestRecord.Message); @@ -103,7 +103,7 @@ public void LogsWhenDefaultAttrCtorInStaticClass() Assert.Equal(1, _logger.Collector.Count); var latestRecord = _logger.Collector.LatestRecord; Assert.Null(latestRecord.Exception); - Assert.Equal(0, latestRecord.Id.Id); + Assert.NotEqual(0, latestRecord.Id.Id); Assert.Equal(LogLevel.Trace, latestRecord.Level); Assert.Equal(string.Empty, latestRecord.Message); @@ -124,7 +124,7 @@ public void LogsWithNullable() Assert.Equal(1, _logger.Collector.Count); var latestRecord = _logger.Collector.LatestRecord; Assert.Null(latestRecord.Exception); - Assert.Equal(0, latestRecord.Id.Id); + Assert.NotEqual(0, latestRecord.Id.Id); Assert.Equal(LogLevel.Trace, latestRecord.Level); Assert.Equal(string.Empty, latestRecord.Message); Assert.Empty(latestRecord.StructuredState!); @@ -135,7 +135,7 @@ public void LogsWithNullable() Assert.Equal(1, _logger.Collector.Count); latestRecord = _logger.Collector.LatestRecord; Assert.Null(latestRecord.Exception); - Assert.Equal(0, latestRecord.Id.Id); + Assert.NotEqual(0, latestRecord.Id.Id); Assert.Equal(LogLevel.Trace, latestRecord.Level); Assert.Equal(string.Empty, latestRecord.Message); @@ -185,7 +185,7 @@ public void LogsWhenOmitParamNameIsTrueWithDefaultAttrCtor() Assert.Equal(1, _logger.Collector.Count); var latestRecord = _logger.Collector.LatestRecord; Assert.Null(latestRecord.Exception); - Assert.Equal(0, latestRecord.Id.Id); + Assert.NotEqual(0, latestRecord.Id.Id); Assert.Equal(LogLevel.Error, latestRecord.Level); Assert.Equal(string.Empty, latestRecord.Message); @@ -300,6 +300,26 @@ public void LogsWhenInterface() latestRecord.StructuredState.Should().NotBeNull().And.Equal(expectedState); } + [Fact] + public void LogsWhenEnumerable() + { + var a = new[] { "Zero", "One", "Two" }; + TagProviderExtensions.Enumerable(_logger, LogLevel.Debug, a); + + Assert.Equal(1, _logger.Collector.Count); + var latestRecord = _logger.Collector.LatestRecord; + Assert.Equal(LogLevel.Debug, latestRecord.Level); + + var expectedState = new Dictionary + { + ["things.Foo0"] = a[0], + ["things.Foo1"] = a[1], + ["things.Foo2"] = a[2], + }; + + latestRecord.StructuredState.Should().NotBeNull().And.Equal(expectedState); + } + [Fact] public void LogsWhenProviderCombinedWithLogProperties() { diff --git a/test/Generators/Microsoft.Gen.Logging/TestClasses/TagProviderExtensions.cs b/test/Generators/Microsoft.Gen.Logging/TestClasses/TagProviderExtensions.cs index cc0867f3c73..58cb023b44f 100644 --- a/test/Generators/Microsoft.Gen.Logging/TestClasses/TagProviderExtensions.cs +++ b/test/Generators/Microsoft.Gen.Logging/TestClasses/TagProviderExtensions.cs @@ -1,6 +1,7 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. +using System.Collections.Generic; using Microsoft.Extensions.Logging; using Microsoft.Shared.Text; @@ -49,6 +50,12 @@ internal static partial void Nullable( ILogger logger, LogLevel level, [TagProvider(typeof(CustomProvider), nameof(CustomProvider.ProvideTags))] int? param); + + [LoggerMessage] + internal static partial void Enumerable( + ILogger logger, + LogLevel level, + [TagProvider(typeof(CustomProvider), nameof(CustomProvider.ProvideForEnumerable))] IEnumerable things); } internal static class CustomProvider @@ -95,6 +102,16 @@ public static void ProvideForInterface(ITagCollector list, IInterfaceToLog param list.Add(nameof(ClassToLog.MyIntProperty), param.MyIntProperty); list.Add("Custom_property_name", param.MyStringProperty); } + + public static void ProvideForEnumerable(ITagCollector list, IEnumerable e) + { + int i = 0; + foreach (var s in e) + { + list.Add($"Foo{i}", s); + i++; + } + } } internal sealed class ClassToLog From f4e055472daa8442289b074c71fb2085b8cebb53 Mon Sep 17 00:00:00 2001 From: Martin Costello Date: Wed, 24 Jan 2024 23:31:42 +0000 Subject: [PATCH 146/172] Bump update-dotnet-sdk to v3.1.2 (#4900) Update martincostello/update-dotnet-sdk to v3.1.2. --- .github/workflows/update-sdk.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/update-sdk.yml b/.github/workflows/update-sdk.yml index d81ec1961cc..50fdf9cfeef 100644 --- a/.github/workflows/update-sdk.yml +++ b/.github/workflows/update-sdk.yml @@ -22,7 +22,7 @@ jobs: - uses: actions/checkout@v4 with: ref: dev - - uses: martincostello/update-dotnet-sdk@b3d5ca8064ec275f7a1d0b9640d28a57ab94090b + - uses: martincostello/update-dotnet-sdk@65c5f402b15326dd12d7b1dac63abdbb53ed695c # v3.1.2 with: quality: 'daily' repo-token: ${{ secrets.GITHUB_TOKEN }} From 2bdfb76b8585138e1d6d6f25d48c3661e9a57e48 Mon Sep 17 00:00:00 2001 From: "dotnet-policy-service[bot]" <123482357+dotnet-policy-service[bot]@users.noreply.github.com> Date: Thu, 25 Jan 2024 23:50:28 +1100 Subject: [PATCH 147/172] FabricBot: Onboarding to GitOps.ResourceManagement because of FabricBot decommissioning (#4898) * Add prIssueManagement.yml to onboard repo to GitOps.ResourceManagement as FabricBot replacement Details on the replacement service and the syntax of the new yaml configuration file is available publicly at: https://microsoft.github.io/GitOps/policies/resource-management.html Please review and merge this PR to complete the process of onboarding to the new service. * Deleting fabricbot.json --------- Co-authored-by: dotnet-policy-service[bot] <123482357+dotnet-policy-service[bot]@users.noreply.github.com> --- .github/fabricbot.json | 919 ------------------------ .github/policies/resourceManagement.yml | 220 ++++++ 2 files changed, 220 insertions(+), 919 deletions(-) delete mode 100644 .github/fabricbot.json create mode 100644 .github/policies/resourceManagement.yml diff --git a/.github/fabricbot.json b/.github/fabricbot.json deleted file mode 100644 index 84a4b438bd4..00000000000 --- a/.github/fabricbot.json +++ /dev/null @@ -1,919 +0,0 @@ -{ - "version": "1.0", - "tasks": [ - { - "taskType": "trigger", - "capabilityId": "CodeFlowLink", - "subCapability": "CodeFlowLink", - "version": "1.0", - "config": { - "taskName": "Add a CodeFlow link to new pull requests" - } - }, - { - "taskType": "trigger", - "capabilityId": "IssueResponder", - "subCapability": "PullRequestReviewResponder", - "version": "1.0", - "config": { - "taskName": "Add needs author feedback label to pull requests when changes are requested", - "conditions": { - "operator": "and", - "operands": [ - { - "name": "isAction", - "parameters": { - "action": "submitted" - } - }, - { - "name": "isReviewState", - "parameters": { - "state": "changes_requested" - } - } - ] - }, - "actions": [ - { - "name": "addLabel", - "parameters": { - "label": "waiting-author-feedback :mailbox_with_no_mail:" - } - } - ], - "eventType": "pull_request", - "eventNames": [ - "pull_request_review" - ] - } - }, - { - "taskType": "trigger", - "capabilityId": "IssueResponder", - "subCapability": "PullRequestResponder", - "version": "1.0", - "config": { - "taskName": "Remove needs author feedback label when the author responds to a pull request", - "conditions": { - "operator": "and", - "operands": [ - { - "name": "isActivitySender", - "parameters": { - "user": { - "type": "author" - } - } - }, - { - "operator": "not", - "operands": [ - { - "name": "isAction", - "parameters": { - "action": "closed" - } - } - ] - }, - { - "name": "hasLabel", - "parameters": { - "label": "waiting-author-feedback :mailbox_with_no_mail:" - } - } - ] - }, - "actions": [ - { - "name": "removeLabel", - "parameters": { - "label": "waiting-author-feedback :mailbox_with_no_mail:" - } - } - ], - "eventType": "pull_request", - "eventNames": [ - "pull_request", - "issues", - "project_card" - ] - } - }, - { - "taskType": "trigger", - "capabilityId": "IssueResponder", - "subCapability": "PullRequestCommentResponder", - "version": "1.0", - "config": { - "taskName": "Remove needs author feedback label when the author comments on a pull request", - "conditions": { - "operator": "and", - "operands": [ - { - "name": "isActivitySender", - "parameters": { - "user": { - "type": "author" - } - } - }, - { - "name": "hasLabel", - "parameters": { - "label": "waiting-author-feedback :mailbox_with_no_mail:" - } - } - ] - }, - "actions": [ - { - "name": "removeLabel", - "parameters": { - "label": "waiting-author-feedback :mailbox_with_no_mail:" - } - } - ], - "eventType": "pull_request", - "eventNames": [ - "issue_comment" - ] - } - }, - { - "taskType": "trigger", - "capabilityId": "IssueResponder", - "subCapability": "PullRequestReviewResponder", - "version": "1.0", - "config": { - "taskName": "Remove needs author feedback label when the author responds to a pull request review comment", - "conditions": { - "operator": "and", - "operands": [ - { - "name": "isActivitySender", - "parameters": { - "user": { - "type": "author" - } - } - }, - { - "name": "hasLabel", - "parameters": { - "label": "waiting-author-feedback :mailbox_with_no_mail:" - } - } - ] - }, - "actions": [ - { - "name": "removeLabel", - "parameters": { - "label": "waiting-author-feedback :mailbox_with_no_mail:" - } - } - ], - "eventType": "pull_request", - "eventNames": [ - "pull_request_review" - ] - } - }, - { - "taskType": "trigger", - "capabilityId": "IssueResponder", - "subCapability": "PullRequestResponder", - "version": "1.0", - "config": { - "taskName": "Remove no recent activity label from pull requests", - "conditions": { - "operator": "and", - "operands": [ - { - "operator": "not", - "operands": [ - { - "name": "isAction", - "parameters": { - "action": "closed" - } - } - ] - }, - { - "name": "hasLabel", - "parameters": { - "label": "no-recent-activity :zzz:" - } - } - ] - }, - "actions": [ - { - "name": "removeLabel", - "parameters": { - "label": "no-recent-activity :zzz:" - } - } - ], - "eventType": "pull_request", - "eventNames": [ - "pull_request", - "issues", - "project_card" - ] - } - }, - { - "taskType": "trigger", - "capabilityId": "IssueResponder", - "subCapability": "PullRequestCommentResponder", - "version": "1.0", - "config": { - "taskName": "Remove no recent activity label when a pull request is commented on", - "conditions": { - "operator": "and", - "operands": [ - { - "name": "hasLabel", - "parameters": { - "label": "no-recent-activity :zzz:" - } - } - ] - }, - "actions": [ - { - "name": "removeLabel", - "parameters": { - "label": "no-recent-activity :zzz:" - } - } - ], - "eventType": "pull_request", - "eventNames": [ - "issue_comment" - ] - } - }, - { - "taskType": "trigger", - "capabilityId": "IssueResponder", - "subCapability": "PullRequestReviewResponder", - "version": "1.0", - "config": { - "taskName": "Remove no recent activity label when a pull request is reviewed", - "conditions": { - "operator": "and", - "operands": [ - { - "name": "hasLabel", - "parameters": { - "label": "no-recent-activity :zzz:" - } - } - ] - }, - "actions": [ - { - "name": "removeLabel", - "parameters": { - "label": "no-recent-activity :zzz:" - } - } - ], - "eventType": "pull_request", - "eventNames": [ - "pull_request_review" - ] - } - }, - { - "taskType": "scheduled", - "capabilityId": "ScheduledSearch", - "subCapability": "ScheduledSearch", - "version": "1.1", - "config": { - "taskName": "Close stale issues and pull requests", - "frequency": [ - { - "weekDay": 0, - "hours": [ - 2, - 14 - ], - "timezoneOffset": 11 - }, - { - "weekDay": 1, - "hours": [ - 2, - 14 - ], - "timezoneOffset": 11 - }, - { - "weekDay": 2, - "hours": [ - 2, - 14 - ], - "timezoneOffset": 11 - }, - { - "weekDay": 3, - "hours": [ - 2, - 14 - ], - "timezoneOffset": 11 - }, - { - "weekDay": 4, - "hours": [ - 2, - 14 - ], - "timezoneOffset": 11 - }, - { - "weekDay": 5, - "hours": [ - 2, - 14 - ], - "timezoneOffset": 11 - }, - { - "weekDay": 6, - "hours": [ - 2, - 14 - ], - "timezoneOffset": 11 - } - ], - "searchTerms": [ - { - "name": "isOpen", - "parameters": {} - }, - { - "name": "hasLabel", - "parameters": { - "label": "waiting-author-feedback :mailbox_with_no_mail:" - } - }, - { - "name": "hasLabel", - "parameters": { - "label": "no-recent-activity :zzz:" - } - }, - { - "name": "noActivitySince", - "parameters": { - "days": 7 - } - } - ], - "actions": [ - { - "name": "closeIssue", - "parameters": {} - }, - { - "name": "removeMilestone", - "parameters": {} - } - ] - } - }, - { - "taskType": "scheduled", - "capabilityId": "ScheduledSearch", - "subCapability": "ScheduledSearch", - "version": "1.1", - "config": { - "taskName": "Add no recent activity label to issues and pull requests", - "frequency": [ - { - "weekDay": 0, - "hours": [ - 2, - 5, - 8, - 11, - 14, - 17, - 20, - 23 - ], - "timezoneOffset": 10 - }, - { - "weekDay": 1, - "hours": [ - 2, - 5, - 8, - 11, - 14, - 17, - 20, - 23 - ], - "timezoneOffset": 10 - }, - { - "weekDay": 2, - "hours": [ - 2, - 5, - 8, - 11, - 14, - 17, - 20, - 23 - ], - "timezoneOffset": 10 - }, - { - "weekDay": 3, - "hours": [ - 2, - 5, - 8, - 11, - 14, - 17, - 20, - 23 - ], - "timezoneOffset": 10 - }, - { - "weekDay": 4, - "hours": [ - 2, - 5, - 8, - 11, - 14, - 17, - 20, - 23 - ], - "timezoneOffset": 10 - }, - { - "weekDay": 5, - "hours": [ - 2, - 5, - 8, - 11, - 14, - 17, - 20, - 23 - ], - "timezoneOffset": 10 - }, - { - "weekDay": 6, - "hours": [ - 2, - 5, - 8, - 11, - 14, - 17, - 20, - 23 - ], - "timezoneOffset": 10 - } - ], - "searchTerms": [ - { - "name": "isOpen", - "parameters": {} - }, - { - "name": "hasLabel", - "parameters": { - "label": "waiting-author-feedback :mailbox_with_no_mail:" - } - }, - { - "name": "noActivitySince", - "parameters": { - "days": 14 - } - }, - { - "name": "noLabel", - "parameters": { - "label": "no-recent-activity :zzz:" - } - } - ], - "actions": [ - { - "name": "addLabel", - "parameters": { - "label": "no-recent-activity :zzz:" - } - }, - { - "name": "addReply", - "parameters": { - "comment": "This submission has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for **14 days**. \n\nIt will be closed if no further activity occurs **within 7 days of this comment**." - } - } - ] - } - }, - { - "taskType": "trigger", - "capabilityId": "AutoMerge", - "subCapability": "AutoMerge", - "version": "1.0", - "config": { - "taskName": "Automatically merge pull requests", - "label": "automerge :octocat:", - "silentMode": false, - "minMinutesOpen": "60", - "mergeType": "squash", - "deleteBranches": true, - "requireAllStatuses": false, - "removeLabelOnPush": true, - "allowAutoMergeInstructionsWithoutLabel": true, - "conditionalMergeTypes": [ - { - "mergeType": "squash", - "condition": { - "placeholder": "" - } - } - ], - "usePrDescriptionAsCommitMessage": true - }, - "disabled": false - }, - { - "taskType": "trigger", - "capabilityId": "InPrLabel", - "subCapability": "InPrLabel", - "version": "1.0", - "config": { - "taskName": "In-PR label", - "label_inPr": "work in progress :construction:", - "fixedLabelEnabled": false, - "label_fixed": "tell-mode" - } - }, - { - "taskType": "trigger", - "capabilityId": "IssueResponder", - "subCapability": "PullRequestResponder", - "version": "1.0", - "config": { - "conditions": { - "operator": "and", - "operands": [ - { - "name": "prTargetsBranch", - "parameters": { - "branchName": "main" - } - }, - { - "operator": "and", - "operands": [ - { - "name": "isAction", - "parameters": { - "action": "merged" - } - }, - { - "operator": "not", - "operands": [ - { - "name": "titleContains", - "parameters": { - "titlePattern": "[main] Update dependencies" - } - } - ] - } - ] - } - ] - }, - "eventType": "pull_request", - "eventNames": [ - "pull_request", - "issues", - "project_card" - ], - "actions": [ - { - "name": "addMilestone", - "parameters": { - "milestoneName": "8.1" - } - } - ], - "taskName": "Apply milestone to PRs on the main branch", - "dangerZone": { - "respondToBotActions": true, - "acceptRespondToBotActions": true - } - }, - "disabled": false - }, - { - "taskType": "trigger", - "capabilityId": "EmailCleanser", - "subCapability": "EmailCleanser", - "version": "1.0", - "config": { - "taskName": "Cleanse emails" - } - }, - { - "taskType": "trigger", - "capabilityId": "IssueResponder", - "subCapability": "PullRequestResponder", - "version": "1.0", - "config": { - "conditions": { - "operator": "and", - "operands": [] - }, - "eventType": "pull_request", - "eventNames": [ - "pull_request", - "issues", - "project_card" - ], - "actions": [ - { - "name": "assignToUser", - "parameters": { - "user": { - "type": "prAuthor" - } - } - } - ], - "taskName": "Assign PRs to authors" - } - }, - { - "taskType": "trigger", - "capabilityId": "IssueResponder", - "subCapability": "IssueCommentResponder", - "version": "1.0", - "config": { - "conditions": { - "operator": "and", - "operands": [ - { - "name": "isActivitySender", - "parameters": { - "user": { - "type": "author" - } - } - }, - { - "name": "hasLabel", - "parameters": { - "label": "waiting-author-feedback :mailbox_with_no_mail:" - } - } - ] - }, - "eventType": "issue", - "eventNames": [ - "issue_comment" - ], - "taskName": "Remove needs author feedback label when the author comments on an issue", - "actions": [ - { - "name": "removeLabel", - "parameters": { - "label": "waiting-author-feedback :mailbox_with_no_mail:" - } - } - ] - } - }, - { - "taskType": "trigger", - "capabilityId": "IssueResponder", - "subCapability": "IssueCommentResponder", - "version": "1.0", - "config": { - "conditions": { - "operator": "and", - "operands": [ - { - "name": "hasLabel", - "parameters": { - "label": "no-recent-activity :zzz:" - } - } - ] - }, - "eventType": "issue", - "eventNames": [ - "issue_comment" - ], - "taskName": "Remove no recent activity label when an issue is commented on", - "actions": [ - { - "name": "removeLabel", - "parameters": { - "label": "no-recent-activity :zzz:" - } - } - ] - } - }, - { - "taskType": "trigger", - "capabilityId": "IssueResponder", - "subCapability": "IssuesOnlyResponder", - "version": "1.0", - "config": { - "conditions": { - "operator": "and", - "operands": [ - { - "operator": "not", - "operands": [ - { - "name": "isAction", - "parameters": { - "action": "closed" - } - } - ] - }, - { - "name": "hasLabel", - "parameters": { - "label": "no-recent-activity :zzz:" - } - } - ] - }, - "eventType": "issue", - "eventNames": [ - "issues", - "project_card" - ], - "taskName": "Remove no recent activity label from issue", - "actions": [ - { - "name": "removeLabel", - "parameters": { - "label": "no-recent-activity :zzz:" - } - } - ] - } - }, - { - "taskType": "trigger", - "capabilityId": "IssueResponder", - "subCapability": "IssuesOnlyResponder", - "version": "1.0", - "config": { - "conditions": { - "operator": "and", - "operands": [ - { - "name": "isAction", - "parameters": { - "action": "closed" - } - } - ] - }, - "eventType": "issue", - "eventNames": [ - "issues", - "project_card" - ], - "taskName": "Remove closed issues from milestones", - "actions": [ - { - "name": "removeMilestone", - "parameters": {} - } - ] - } - }, - { - "taskType": "trigger", - "capabilityId": "IssueResponder", - "subCapability": "PullRequestResponder", - "version": "1.0", - "config": { - "conditions": { - "operator": "or", - "operands": [ - { - "name": "isAction", - "parameters": { - "action": "merged" - } - }, - { - "name": "isAction", - "parameters": { - "action": "closed" - } - } - ] - }, - "eventType": "pull_request", - "eventNames": [ - "pull_request", - "issues", - "project_card" - ], - "taskName": "Remove intermediate labels after PR is closed or merged", - "actions": [ - { - "name": "removeLabel", - "parameters": { - "label": "work in progress :construction:" - } - }, - { - "name": "removeLabel", - "parameters": { - "label": "waiting-author-feedback :mailbox_with_no_mail:" - } - }, - { - "name": "removeLabel", - "parameters": { - "label": "waiting-on-team :wave:" - } - } - ] - } - }, - { - "taskType": "trigger", - "capabilityId": "IssueResponder", - "subCapability": "IssuesOnlyResponder", - "version": "1.0", - "config": { - "conditions": { - "operator": "or", - "operands": [ - { - "name": "isAction", - "parameters": { - "action": "closed" - } - } - ] - }, - "eventType": "issue", - "eventNames": [ - "issues", - "project_card" - ], - "taskName": "Remove intermediate labels from closed issue", - "actions": [ - { - "name": "removeLabel", - "parameters": { - "label": "untriaged" - } - }, - { - "name": "removeLabel", - "parameters": { - "label": "waiting-author-feedback :mailbox_with_no_mail:" - } - } - ] - } - } - ], - "userGroups": [] -} diff --git a/.github/policies/resourceManagement.yml b/.github/policies/resourceManagement.yml new file mode 100644 index 00000000000..610112662c3 --- /dev/null +++ b/.github/policies/resourceManagement.yml @@ -0,0 +1,220 @@ +id: +name: GitOps.PullRequestIssueManagement +description: GitOps.PullRequestIssueManagement primitive +owner: +resource: repository +disabled: false +where: +configuration: + resourceManagementConfiguration: + scheduledSearches: + - description: Close stale issues and pull requests + frequencies: + - hourly: + hour: 12 + filters: + - isOpen + - hasLabel: + label: 'waiting-author-feedback :mailbox_with_no_mail:' + - hasLabel: + label: 'no-recent-activity :zzz:' + - noActivitySince: + days: 7 + actions: + - closeIssue + - removeMilestone + - description: Add no recent activity label to issues and pull requests + frequencies: + - hourly: + hour: 3 + filters: + - isOpen + - hasLabel: + label: 'waiting-author-feedback :mailbox_with_no_mail:' + - noActivitySince: + days: 14 + - isNotLabeledWith: + label: 'no-recent-activity :zzz:' + actions: + - addLabel: + label: 'no-recent-activity :zzz:' + - addReply: + reply: >- + This submission has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for **14 days**. + + + It will be closed if no further activity occurs **within 7 days of this comment**. + eventResponderTasks: + - if: + - payloadType: Pull_Request + - isAction: + action: Opened + then: + - addCodeFlowLink + description: Add a CodeFlow link to new pull requests + - if: + - payloadType: Pull_Request_Review + - isAction: + action: Submitted + - isReviewState: + reviewState: Changes_requested + then: + - addLabel: + label: 'waiting-author-feedback :mailbox_with_no_mail:' + description: Add needs author feedback label to pull requests when changes are requested + - if: + - payloadType: Pull_Request + - isActivitySender: + issueAuthor: True + - not: + isAction: + action: Closed + - hasLabel: + label: 'waiting-author-feedback :mailbox_with_no_mail:' + then: + - removeLabel: + label: 'waiting-author-feedback :mailbox_with_no_mail:' + description: Remove needs author feedback label when the author responds to a pull request + - if: + - payloadType: Issue_Comment + - isActivitySender: + issueAuthor: True + - hasLabel: + label: 'waiting-author-feedback :mailbox_with_no_mail:' + then: + - removeLabel: + label: 'waiting-author-feedback :mailbox_with_no_mail:' + description: Remove needs author feedback label when the author comments on a pull request + - if: + - payloadType: Pull_Request_Review + - isActivitySender: + issueAuthor: True + - hasLabel: + label: 'waiting-author-feedback :mailbox_with_no_mail:' + then: + - removeLabel: + label: 'waiting-author-feedback :mailbox_with_no_mail:' + description: Remove needs author feedback label when the author responds to a pull request review comment + - if: + - payloadType: Pull_Request + - not: + isAction: + action: Closed + - hasLabel: + label: 'no-recent-activity :zzz:' + then: + - removeLabel: + label: 'no-recent-activity :zzz:' + description: Remove no recent activity label from pull requests + - if: + - payloadType: Issue_Comment + - hasLabel: + label: 'no-recent-activity :zzz:' + then: + - removeLabel: + label: 'no-recent-activity :zzz:' + description: Remove no recent activity label when a pull request is commented on + - if: + - payloadType: Pull_Request_Review + - hasLabel: + label: 'no-recent-activity :zzz:' + then: + - removeLabel: + label: 'no-recent-activity :zzz:' + description: Remove no recent activity label when a pull request is reviewed + - if: + - payloadType: Pull_Request + - hasLabel: + label: 'automerge :octocat:' + then: + - enableAutoMerge: + mergeMethod: Squash + description: Automatically merge pull requests + - if: + - payloadType: Pull_Request + - labelRemoved: + label: 'automerge :octocat:' + then: + - disableAutoMerge + description: Automatically merge pull requests + - if: + - payloadType: Pull_Request + then: + - inPrLabel: + label: 'work in progress :construction:' + description: In-PR label + - if: + - payloadType: Issue_Comment + then: + - cleanEmailReply + description: Cleanse emails + - if: + - payloadType: Pull_Request + then: + - assignTo: + author: True + description: Assign PRs to authors + - if: + - payloadType: Issue_Comment + - isActivitySender: + issueAuthor: True + - hasLabel: + label: 'waiting-author-feedback :mailbox_with_no_mail:' + then: + - removeLabel: + label: 'waiting-author-feedback :mailbox_with_no_mail:' + description: Remove needs author feedback label when the author comments on an issue + - if: + - payloadType: Issue_Comment + - hasLabel: + label: 'no-recent-activity :zzz:' + then: + - removeLabel: + label: 'no-recent-activity :zzz:' + description: Remove no recent activity label when an issue is commented on + - if: + - payloadType: Issues + - not: + isAction: + action: Closed + - hasLabel: + label: 'no-recent-activity :zzz:' + then: + - removeLabel: + label: 'no-recent-activity :zzz:' + description: Remove no recent activity label from issue + - if: + - payloadType: Issues + - isAction: + action: Closed + then: + - removeMilestone + description: Remove closed issues from milestones + - if: + - payloadType: Pull_Request + - or: + - isAction: + action: Null + - isAction: + action: Closed + then: + - removeLabel: + label: 'work in progress :construction:' + - removeLabel: + label: 'waiting-author-feedback :mailbox_with_no_mail:' + - removeLabel: + label: 'waiting-on-team :wave:' + description: Remove intermediate labels after PR is closed or merged + - if: + - payloadType: Issues + - or: + - isAction: + action: Closed + then: + - removeLabel: + label: untriaged + - removeLabel: + label: 'waiting-author-feedback :mailbox_with_no_mail:' + description: Remove intermediate labels from closed issue +onFailure: +onSuccess: From 9eac7a3e459e58317d733c8bd573461c949b0b17 Mon Sep 17 00:00:00 2001 From: Martin Taillefer Date: Fri, 26 Jan 2024 12:49:39 -0800 Subject: [PATCH 148/172] Update analyzer configs and fix a few emergent warnings. (#4903) Co-authored-by: Martin Taillefer --- bench/.editorconfig | 299 +++++- .../MetricsUtil.cs | 2 +- .../ResilienceEnrichmentBenchmark.cs | 4 +- eng/Diags/ILLink.RoslynAnalyzer.yml | 2 +- ...rosoft.AspNetCore.Components.Analyzers.yml | 2 +- ...icrosoft.CodeAnalysis.CSharp.CodeStyle.yml | 74 +- ...osoft.CodeAnalysis.CSharp.NetAnalyzers.yml | 38 +- .../Microsoft.CodeAnalysis.CodeStyle.yml | 2 +- .../Microsoft.CodeAnalysis.NetAnalyzers.yml | 176 ++-- ...isualStudio.Threading.Analyzers.CSharp.yml | 5 +- ...osoft.VisualStudio.Threading.Analyzers.yml | 2 +- eng/Diags/SonarAnalyzer.CSharp.yml | 967 ++++++++++++++---- eng/Diags/StyleCop.Analyzers.yml | 9 +- eng/Diags/xunit.analyzers.yml | 199 +++- eng/Tools/.editorconfig | 283 ++++- scripts/MergeAnalyzerMetadata.ps1 | 16 +- src/Analyzers/.editorconfig | 298 +++++- src/Generators/.editorconfig | 298 +++++- src/LegacySupport/.editorconfig | 298 +++++- src/Libraries/.editorconfig | 302 +++++- ...enceHttpClientBuilderExtensions.Hedging.cs | 2 +- .../Internal/HttpKey.cs | 2 +- .../Internal/Randomizer.cs | 1 + ...eHttpClientBuilderExtensions.Resilience.cs | 2 +- ...entBuilderExtensions.StandardResilience.cs | 2 +- .../Routing/Internal/RequestRoutingOptions.cs | 2 +- .../build/config/Benchmark-Tier1.globalconfig | 251 ++++- .../build/config/Benchmark-Tier2.globalconfig | 270 ++++- .../build/config/Benchmark.globalconfig | 279 ++++- .../build/config/General-Tier1.globalconfig | 243 ++++- .../build/config/General-Tier2.globalconfig | 254 ++++- .../build/config/General.globalconfig | 263 ++++- .../config/NonProdExe-Tier1.globalconfig | 243 ++++- .../config/NonProdExe-Tier2.globalconfig | 254 ++++- .../build/config/NonProdExe.globalconfig | 263 ++++- .../config/NonProdLib-Tier1.globalconfig | 243 ++++- .../config/NonProdLib-Tier2.globalconfig | 254 ++++- .../build/config/NonProdLib.globalconfig | 267 ++++- .../build/config/ProdExe-Tier1.globalconfig | 249 ++++- .../build/config/ProdExe-Tier2.globalconfig | 268 ++++- .../build/config/ProdExe.globalconfig | 278 ++++- .../build/config/ProdLib-Tier1.globalconfig | 249 ++++- .../build/config/ProdLib-Tier2.globalconfig | 268 ++++- .../build/config/ProdLib.globalconfig | 282 ++++- .../build/config/Test-Tier1.globalconfig | 320 +++++- .../build/config/Test-Tier2.globalconfig | 331 +++++- .../build/config/Test.globalconfig | 340 +++++- src/Shared/.editorconfig | 298 +++++- test/.editorconfig | 360 ++++++- .../TestClasses/NonPublicStruct.cs | 2 +- .../TestClasses/Struct1.cs | 2 +- .../TestClasses/FormattableTestExtensions.cs | 38 +- .../TestClasses/InParameterTestExtensions.cs | 2 +- .../LogPropertiesRecordExtensions.cs | 2 +- .../TestClasses/NestedClassTestExtensions.cs | 2 +- .../TestClasses/SignatureTestExtensions.cs | 2 + .../TestClasses/TagProviderExtensions.cs | 2 +- .../Logging/AcceptanceTests.Mvc.cs | 1 + .../Logging/AcceptanceTests.Routing.cs | 1 + .../Logging/AcceptanceTests.cs | 1 + .../Latency/Internal/HttpMockProvider.cs | 2 +- 61 files changed, 8300 insertions(+), 1371 deletions(-) diff --git a/bench/.editorconfig b/bench/.editorconfig index b2c317651b7..bea91a82fa7 100644 --- a/bench/.editorconfig +++ b/bench/.editorconfig @@ -1,5 +1,5 @@ # Created by DiagConfig, the diagnostic config generator -# Generated : 2023-10-22 00:37:47Z +# Generated : 2024-01-25 20:57:45Z # Max Tier : 2147483647 # Attributes: general, performance # Analyzers : ILLink.RoslynAnalyzer, Microsoft.Analyzers.Extra, Microsoft.Analyzers.Local, Microsoft.AspNetCore.App.Analyzers, Microsoft.AspNetCore.Components.Analyzers, Microsoft.CodeAnalysis.CodeStyle, Microsoft.CodeAnalysis.CSharp.CodeStyle, Microsoft.CodeAnalysis.CSharp.NetAnalyzers, Microsoft.CodeAnalysis.NetAnalyzers, Microsoft.VisualStudio.Threading.Analyzers, Microsoft.VisualStudio.Threading.Analyzers.CSharp, SonarAnalyzer.CSharp, StyleCop.Analyzers @@ -107,7 +107,7 @@ dotnet_diagnostic.CA1001.severity = warning # Title : Types that own disposable fields should be disposable # Category : Design # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1001 -dotnet_diagnostic.CA1001.severity = warning +dotnet_diagnostic.CA1001.severity = none # Title : Do not expose generic lists # Category : Design @@ -197,6 +197,7 @@ dotnet_diagnostic.CA1028.severity = none # Category : Design # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1030 dotnet_diagnostic.CA1030.severity = warning +dotnet_code_quality.CA1030.api_surface = public # Title : Do not catch general exception types # Category : Design @@ -276,6 +277,7 @@ dotnet_diagnostic.CA1051.severity = none # Category : Design # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1052 dotnet_diagnostic.CA1052.severity = warning +dotnet_code_quality.CA1052.api_surface = all # Title : URI-like parameters should not be strings # Category : Design @@ -318,6 +320,7 @@ dotnet_diagnostic.CA1062.severity = none # Category : Design # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1063 dotnet_diagnostic.CA1063.severity = warning +dotnet_code_quality.CA1063.api_surface = public # Title : Exceptions should be public # Category : Design @@ -576,6 +579,7 @@ dotnet_diagnostic.CA1724.severity = none # Category : Naming # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1725 dotnet_diagnostic.CA1725.severity = warning +dotnet_code_quality.CA1725.api_surface = public, protected # Title : Use PascalCase for named placeholders # Category : Naming @@ -598,6 +602,7 @@ dotnet_diagnostic.CA1801.severity = none # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1802 dotnet_diagnostic.CA1802.severity = warning +dotnet_code_quality.CA1802.required_modifiers = static # Title : Use literals where appropriate # Category : Performance @@ -645,6 +650,7 @@ dotnet_diagnostic.CA1814.severity = warning # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1815 dotnet_diagnostic.CA1815.severity = warning +dotnet_code_quality.CA1815.api_surface = public # Title : Dispose methods should call SuppressFinalize # Category : Usage @@ -655,6 +661,7 @@ dotnet_diagnostic.CA1816.severity = warning # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1819 dotnet_diagnostic.CA1819.severity = warning +dotnet_code_quality.CA1819.api_surface = public # Title : Test for empty strings using string length # Category : Performance @@ -670,6 +677,7 @@ dotnet_diagnostic.CA1821.severity = warning # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1822 dotnet_diagnostic.CA1822.severity = warning +dotnet_code_quality.CA1822.api_surface = all # Title : Avoid unused private fields # Category : Performance @@ -800,7 +808,7 @@ dotnet_diagnostic.CA1847.severity = warning # Title : Use the LoggerMessage delegates # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1848 -# Comment : Use the code generated model instead. +# Comment : Use R9 logging model instead dotnet_diagnostic.CA1848.severity = none # Title : Call async methods when in an async method @@ -821,7 +829,8 @@ dotnet_diagnostic.CA1851.severity = suggestion # Title : Seal internal types # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1852 -dotnet_diagnostic.CA1852.severity = none +dotnet_diagnostic.CA1852.severity = warning +dotnet_code_quality.CA1852.ignore_internalsvisibleto = true # Title : Unnecessary call to 'Dictionary.ContainsKey(key)' # Category : Performance @@ -851,7 +860,7 @@ dotnet_diagnostic.CA1857.severity = warning # Title : Use 'StartsWith' instead of 'IndexOf' # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1858 -dotnet_diagnostic.CA1858.severity = warning +dotnet_diagnostic.CA1858.severity = suggestion # Title : Use concrete types when possible for improved performance # Category : Performance @@ -861,7 +870,7 @@ dotnet_diagnostic.CA1859.severity = warning # Title : Avoid using 'Enumerable.Any()' extension method # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1860 -dotnet_diagnostic.CA1860.severity = warning +dotnet_diagnostic.CA1860.severity = suggestion # Title : Avoid constant arrays as arguments # Category : Performance @@ -871,17 +880,17 @@ dotnet_diagnostic.CA1861.severity = suggestion # Title : Use the 'StringComparison' method overloads to perform case-insensitive string comparisons # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1862 -dotnet_diagnostic.CA1862.severity = warning +dotnet_diagnostic.CA1862.severity = suggestion # Title : Use 'CompositeFormat' # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1863 -dotnet_diagnostic.CA1863.severity = warning +dotnet_diagnostic.CA1863.severity = none # Title : Prefer the 'IDictionary.TryAdd(TKey, TValue)' method # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1864 -dotnet_diagnostic.CA1864.severity = warning +dotnet_diagnostic.CA1864.severity = suggestion # Title : Use char overload # Category : Performance @@ -901,17 +910,17 @@ dotnet_diagnostic.CA1867.severity = warning # Title : Unnecessary call to 'Contains(item)' # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1868 -dotnet_diagnostic.CA1868.severity = warning +dotnet_diagnostic.CA1868.severity = suggestion # Title : Cache and reuse 'JsonSerializerOptions' instances # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1869 -dotnet_diagnostic.CA1869.severity = warning +dotnet_diagnostic.CA1869.severity = suggestion # Title : Use a cached 'SearchValues' instance # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1870 -dotnet_diagnostic.CA1870.severity = warning +dotnet_diagnostic.CA1870.severity = suggestion # Title : Dispose objects before losing scope # Category : Reliability @@ -927,6 +936,8 @@ dotnet_diagnostic.CA2002.severity = warning # Category : Reliability # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2007 dotnet_diagnostic.CA2007.severity = warning +dotnet_code_quality.CA2007.output_kinds = all +dotnet_code_quality.CA2007.exclude_async_void_methods = false # Title : Do not create tasks without passing a TaskScheduler # Category : Reliability @@ -1047,6 +1058,7 @@ dotnet_diagnostic.CA2207.severity = warning # Category : Usage # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2208 dotnet_diagnostic.CA2208.severity = warning +dotnet_code_quality.CA2208.api_surface = all # Title : Non-constant fields should not be visible # Category : Usage @@ -1110,6 +1122,7 @@ dotnet_diagnostic.CA2229.severity = none # Category : Usage # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2231 dotnet_diagnostic.CA2231.severity = error +dotnet_code_quality.CA2231.api_surface = public # Title : Pass system uri objects instead of strings # Category : Usage @@ -1132,6 +1145,7 @@ dotnet_diagnostic.CA2237.severity = none # Category : Usage # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2241 dotnet_diagnostic.CA2241.severity = warning +dotnet_code_quality.CA2241.try_determine_additional_string_formatting_methods_automatically = false # Title : Test for NaN correctly # Category : Usage @@ -1849,8 +1863,8 @@ dotnet_diagnostic.IDE0005_gen.severity = none # Title : Use implicit type # Category : Style # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0007 -dotnet_diagnostic.IDE0007.severity = silent -csharp_style_var_elsewhere = true +dotnet_diagnostic.IDE0007.severity = suggestion +csharp_style_var_elsewhere = false csharp_style_var_for_built_in_types = false csharp_style_var_when_type_is_apparent = true @@ -1951,19 +1965,19 @@ csharp_style_expression_bodied_accessors = true # Title : Simplify collection initialization # Category : Style # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0028 -dotnet_diagnostic.IDE0028.severity = warning +dotnet_diagnostic.IDE0028.severity = suggestion dotnet_style_collection_initializer = true # Title : Use coalesce expression # Category : Style # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0029 -dotnet_diagnostic.IDE0029.severity = warning +dotnet_diagnostic.IDE0029.severity = suggestion dotnet_style_coalesce_expression = true # Title : Use coalesce expression # Category : Style # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0030 -dotnet_diagnostic.IDE0030.severity = warning +dotnet_diagnostic.IDE0030.severity = suggestion dotnet_style_coalesce_expression = true # Title : Use null propagation @@ -2298,7 +2312,7 @@ csharp_style_prefer_not_pattern = true # Title : Use 'new(...)' # Category : Style # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0090 -dotnet_diagnostic.IDE0090.severity = warning +dotnet_diagnostic.IDE0090.severity = suggestion csharp_style_implicit_object_creation_when_type_is_apparent = true # Title : Remove redundant equality @@ -2401,7 +2415,8 @@ dotnet_diagnostic.IDE0250.severity = warning # Title : Make member 'readonly' # Category : Style # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0251 -dotnet_diagnostic.IDE0251.severity = none +dotnet_diagnostic.IDE0251.severity = warning +csharp_style_prefer_readonly_struct_members = true # Title : Use pattern matching # Category : Style @@ -2431,7 +2446,7 @@ dotnet_diagnostic.IDE0300.severity = none # Title : Simplify collection initialization # Category : Style # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0301 -dotnet_diagnostic.IDE0301.severity = suggestion +dotnet_diagnostic.IDE0301.severity = none # Title : Simplify collection initialization # Category : Style @@ -2899,7 +2914,7 @@ dotnet_diagnostic.S103.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-104 dotnet_diagnostic.S104.severity = warning -# Title : Destructors should not throw exceptions +# Title : Finalizers should not throw exceptions # Category : Blocker Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1048 # Redundant: CA1065 @@ -2975,7 +2990,7 @@ dotnet_diagnostic.S1110.severity = none # Redundant: SA1106 dotnet_diagnostic.S1116.severity = none -# Title : Local variables should not shadow class fields +# Title : Local variables should not shadow class fields or properties # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1117 dotnet_diagnostic.S1117.severity = warning @@ -3018,6 +3033,11 @@ dotnet_diagnostic.S1128.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-113 dotnet_diagnostic.S113.severity = none +# Title : Deprecated code should be removed +# Category : Info Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-1133 +dotnet_diagnostic.S1133.severity = suggestion + # Title : Track uses of "FIXME" tags # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1134 @@ -3090,7 +3110,7 @@ dotnet_diagnostic.S1192.severity = suggestion # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1199 dotnet_diagnostic.S1199.severity = warning -# Title : Classes should not be coupled to too many other classes (Single Responsibility Principle) +# Title : Classes should not be coupled to too many other classes # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1200 dotnet_diagnostic.S1200.severity = none @@ -3271,7 +3291,7 @@ dotnet_diagnostic.S1699.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1751 dotnet_diagnostic.S1751.severity = warning -# Title : Identical expressions should not be used on both sides of a binary operator +# Title : Identical expressions should not be used on both sides of operators # Category : Major Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1764 dotnet_diagnostic.S1764.severity = warning @@ -3323,7 +3343,7 @@ dotnet_diagnostic.S1939.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1940 dotnet_diagnostic.S1940.severity = warning -# Title : Inappropriate casts should not be made +# Title : Invalid casts should be avoided # Category : Critical Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1944 dotnet_diagnostic.S1944.severity = warning @@ -3360,6 +3380,11 @@ dotnet_diagnostic.S2077.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2092 dotnet_diagnostic.S2092.severity = warning +# Title : Classes should not be empty +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2094 +dotnet_diagnostic.S2094.severity = none + # Title : Collections should not be passed as arguments to their own methods # Category : Major Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2114 @@ -3385,6 +3410,11 @@ dotnet_diagnostic.S2148.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2156 dotnet_diagnostic.S2156.severity = warning +# Title : Classes named like "Exception" should extend "Exception" or a subclass +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2166 +dotnet_diagnostic.S2166.severity = warning + # Title : Short-circuit logic should be used in boolean contexts # Category : Blocker Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2178 @@ -3400,12 +3430,12 @@ dotnet_diagnostic.S2183.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2184 dotnet_diagnostic.S2184.severity = warning -# Title : TestCases should contain tests +# Title : Test classes should contain at least one test case # Category : Blocker Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2187 dotnet_diagnostic.S2187.severity = warning -# Title : Recursion should not be infinite +# Title : Loops and recursions should not be infinite # Category : Blocker Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2190 dotnet_diagnostic.S2190.severity = warning @@ -3415,7 +3445,12 @@ dotnet_diagnostic.S2190.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2197 dotnet_diagnostic.S2197.severity = warning -# Title : Return values from functions without side effects should not be ignored +# Title : Unnecessary mathematical comparisons should not be made +# Category : Critical Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2198 +dotnet_diagnostic.S2198.severity = warning + +# Title : Methods without side effects should not have their return values ignored # Category : Major Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2201 # Redundant: CA1806 @@ -3451,7 +3486,7 @@ dotnet_diagnostic.S2225.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2228 dotnet_diagnostic.S2228.severity = none -# Title : Parameters should be passed in the correct order +# Title : Arguments should be passed in the same order as the method parameters # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2234 dotnet_diagnostic.S2234.severity = warning @@ -3628,11 +3663,17 @@ dotnet_diagnostic.S2387.severity = warning # Redundant: CA1005 dotnet_diagnostic.S2436.severity = none -# Title : Silly bit operations should not be performed +# Title : Unnecessary bit operations should not be performed # Category : Blocker Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2437 dotnet_diagnostic.S2437.severity = warning +# Title : Blocks should be synchronized on read-only fields +# Category : Major Bug +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2445 +# Comment : Noise +dotnet_diagnostic.S2445.severity = none + # Title : Whitespace and control characters in string literals should be explicit # Category : Critical Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2479 @@ -3646,8 +3687,7 @@ dotnet_diagnostic.S2486.severity = warning # Title : Shared resources should not be used for locking # Category : Critical Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2551 -# Redundant: CA2002 -dotnet_diagnostic.S2551.severity = none +dotnet_diagnostic.S2551.severity = warning # Title : Conditionally executed code should be reachable # Category : Major Bug @@ -3658,7 +3698,8 @@ dotnet_diagnostic.S2583.severity = none # Title : Boolean expressions should not be gratuitous # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2589 -dotnet_diagnostic.S2589.severity = warning +# Comment : Too many false positives. +dotnet_diagnostic.S2589.severity = none # Title : Setting loose file permissions is security-sensitive # Category : Major Security Hotspot @@ -3715,7 +3756,7 @@ dotnet_diagnostic.S2743.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2755 dotnet_diagnostic.S2755.severity = warning -# Title : "=+" should not be used instead of "+=" +# Title : Non-existent operators like "=+" should not be used # Category : Major Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2757 dotnet_diagnostic.S2757.severity = warning @@ -3740,6 +3781,11 @@ dotnet_diagnostic.S2761.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2857 dotnet_diagnostic.S2857.severity = warning +# Title : "Thread.Sleep" should not be used in tests +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2925 +dotnet_diagnostic.S2925.severity = none + # Title : "IDisposables" should be disposed # Category : Blocker Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2930 @@ -3778,6 +3824,11 @@ dotnet_diagnostic.S2953.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2955 dotnet_diagnostic.S2955.severity = warning +# Title : Assertions should be complete +# Category : Blocker Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2970 +dotnet_diagnostic.S2970.severity = warning + # Title : "IEnumerable" LINQs should be simplified # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2971 @@ -3829,6 +3880,11 @@ dotnet_diagnostic.S3059.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3060 dotnet_diagnostic.S3060.severity = warning +# Title : "StringBuilder" data should be used +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-3063 +dotnet_diagnostic.S3063.severity = warning + # Title : "async" methods should not return "void" # Category : Major Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3168 @@ -3886,7 +3942,7 @@ dotnet_diagnostic.S3235.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3236 dotnet_diagnostic.S3236.severity = warning -# Title : "value" parameters should be used +# Title : "value" contextual keyword should be used # Category : Blocker Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3237 dotnet_diagnostic.S3237.severity = warning @@ -3951,12 +4007,13 @@ dotnet_diagnostic.S3256.severity = warning # Title : Declarations and initializations should be as concise as possible # Category : Minor Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3257 -dotnet_diagnostic.S3257.severity = warning +# Comment : Too many false positives +dotnet_diagnostic.S3257.severity = none # Title : Non-derived "private" classes and records should be "sealed" # Category : Minor Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3260 -# Redundant: CA1852 +# Redundant: R9A013 dotnet_diagnostic.S3260.severity = none # Title : Namespaces should not be empty @@ -4020,6 +4077,11 @@ dotnet_diagnostic.S3353.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3358 dotnet_diagnostic.S3358.severity = warning +# Title : Date and time should not be used as a type for primary keys +# Category : Minor Bug +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-3363 +dotnet_diagnostic.S3363.severity = warning + # Title : "this" should not be exposed from constructors # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3366 @@ -4036,6 +4098,11 @@ dotnet_diagnostic.S3376.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3397 dotnet_diagnostic.S3397.severity = warning +# Title : "private" methods called only by inner classes should be moved to those classes +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-3398 +dotnet_diagnostic.S3398.severity = warning + # Title : Methods should not return constants # Category : Minor Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3400 @@ -4046,7 +4113,7 @@ dotnet_diagnostic.S3400.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3415 dotnet_diagnostic.S3415.severity = warning -# Title : Method overloads with default parameter values should not overlap +# Title : Method overloads with default parameter values should not overlap # Category : Blocker Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3427 dotnet_diagnostic.S3427.severity = warning @@ -4244,6 +4311,11 @@ dotnet_diagnostic.S3876.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3877 dotnet_diagnostic.S3877.severity = none +# Title : Arrays should not be created for params parameters +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-3878 +dotnet_diagnostic.S3878.severity = suggestion + # Title : Finalizers should not be empty # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3880 @@ -4269,7 +4341,7 @@ dotnet_diagnostic.S3885.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3887 dotnet_diagnostic.S3887.severity = warning -# Title : Neither "Thread.Resume" nor "Thread.Suspend" should be used +# Title : "Thread.Resume" and "Thread.Suspend" should not be used # Category : Blocker Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3889 dotnet_diagnostic.S3889.severity = warning @@ -4509,7 +4581,7 @@ dotnet_diagnostic.S4022.severity = warning # Title : Interfaces should not be empty # Category : Minor Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4023 -dotnet_diagnostic.S4023.severity = warning +dotnet_diagnostic.S4023.severity = none # Title : Child class fields should not differ from parent class fields only by capitalization # Category : Critical Code Smell @@ -4647,7 +4719,8 @@ dotnet_diagnostic.S4144.severity = warning # Title : Empty collections should not be accessed or iterated # Category : Minor Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4158 -dotnet_diagnostic.S4158.severity = warning +# Comment : Too many false positives +dotnet_diagnostic.S4158.severity = none # Title : Classes should implement their "ExportAttribute" interfaces # Category : Blocker Bug @@ -4781,6 +4854,11 @@ dotnet_diagnostic.S4507.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4524 dotnet_diagnostic.S4524.severity = warning +# Title : "DebuggerDisplayAttribute" strings should reference existing members +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-4545 +dotnet_diagnostic.S4545.severity = warning + # Title : ASP.NET HTTP request validation feature should not be disabled # Category : Major Vulnerability # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4564 @@ -4801,11 +4879,16 @@ dotnet_diagnostic.S4583.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4586 dotnet_diagnostic.S4586.severity = warning -# Title : String offset-based methods should be preferred for finding substrings from offsets +# Title : Start index should be used instead of calling Substring # Category : Critical Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4635 dotnet_diagnostic.S4635.severity = warning +# Title : Comments should not be empty +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-4663 +dotnet_diagnostic.S4663.severity = suggestion + # Title : Using regular expressions is security-sensitive # Category : Critical Security Hotspot # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4784 @@ -4917,10 +5000,15 @@ dotnet_diagnostic.S5766.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-5773 dotnet_diagnostic.S5773.severity = warning +# Title : Regular expressions should be syntactically valid +# Category : Critical Bug +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-5856 +dotnet_diagnostic.S5856.severity = warning + # Title : Use a testable date/time provider # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-6354 -# Redundant: EA0002 +# Redundant: R9A022 dotnet_diagnostic.S6354.severity = none # Title : Azure Functions should be stateless @@ -4956,7 +5044,120 @@ dotnet_diagnostic.S6424.severity = warning # Title : Not specifying a timeout for regular expressions is security-sensitive # Category : Major Security Hotspot # Help Link: https://rules.sonarsource.com/csharp/RSPEC-6444 -dotnet_diagnostic.S6444.severity = warning +dotnet_diagnostic.S6444.severity = none + +# Title : Blocks should not be synchronized on local variables +# Category : Major Bug +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6507 +# Comment : Too many false positives +dotnet_diagnostic.S6507.severity = none + +# Title : "ExcludeFromCodeCoverage" attributes should include a justification +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6513 +dotnet_diagnostic.S6513.severity = suggestion + +# Title : Avoid using "DateTime.Now" for benchmarking or timing operations +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6561 +dotnet_diagnostic.S6561.severity = warning + +# Title : Always set the "DateTimeKind" when creating new "DateTime" instances +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6562 +# Comment : Noise +dotnet_diagnostic.S6562.severity = none + +# Title : Use UTC when recording DateTime instants +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6563 +dotnet_diagnostic.S6563.severity = none + +# Title : Use "DateTimeOffset" instead of "DateTime" +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6566 +# Comment : Noise +dotnet_diagnostic.S6566.severity = none + +# Title : Use "TimeZoneInfo.FindSystemTimeZoneById" without converting the timezones with "TimezoneConverter" +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6575 +dotnet_diagnostic.S6575.severity = warning + +# Title : Use a format provider when parsing date and time +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6580 +dotnet_diagnostic.S6580.severity = warning + +# Title : Don't hardcode the format when turning dates and times to strings +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6585 +dotnet_diagnostic.S6585.severity = none + +# Title : Use the "UnixEpoch" field instead of creating "DateTime" instances that point to the beginning of the Unix epoch +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6588 +dotnet_diagnostic.S6588.severity = warning + +# Title : "Find" method should be used instead of the "FirstOrDefault" extension +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6602 +dotnet_diagnostic.S6602.severity = warning + +# Title : The collection-specific "TrueForAll" method should be used instead of the "All" extension +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6603 +dotnet_diagnostic.S6603.severity = warning + +# Title : Collection-specific "Exists" method should be used instead of the "Any" extension +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6605 +dotnet_diagnostic.S6605.severity = warning + +# Title : The collection should be filtered before sorting by using "Where" before "OrderBy" +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6607 +dotnet_diagnostic.S6607.severity = warning + +# Title : Prefer indexing instead of "Enumerable" methods on types implementing "IList" +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6608 +dotnet_diagnostic.S6608.severity = warning + +# Title : "Min/Max" properties of "Set" types should be used instead of the "Enumerable" extension methods +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6609 +dotnet_diagnostic.S6609.severity = warning + +# Title : "StartsWith" and "EndsWith" overloads that take a "char" should be used instead of the ones that take a "string" +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6610 +dotnet_diagnostic.S6610.severity = warning + +# Title : The lambda parameter should be used instead of capturing arguments in "ConcurrentDictionary" methods +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6612 +dotnet_diagnostic.S6612.severity = warning + +# Title : "First" and "Last" properties of "LinkedList" should be used instead of the "First()" and "Last()" extension methods +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6613 +dotnet_diagnostic.S6613.severity = warning + +# Title : "Contains" should be used instead of "Any" for simple equality checks +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6617 +dotnet_diagnostic.S6617.severity = warning + +# Title : "string.Create" should be used instead of "FormattableString" +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6618 +dotnet_diagnostic.S6618.severity = warning + +# Title : Using unsafe code blocks is security-sensitive +# Category : Major Security Hotspot +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6640 +dotnet_diagnostic.S6640.severity = warning # Title : Literal suffixes should be upper case # Category : Minor Code Smell @@ -5003,6 +5204,10 @@ dotnet_diagnostic.S9999-symbolRef.severity = warning # Category : dotnet_diagnostic.S9999-token-type.severity = warning +# Title : Analysis Warning generator +# Category : +dotnet_diagnostic.S9999-warning.severity = warning + # Title : XML comment analysis disabled # Category : StyleCop.CSharp.SpecialRules # Help Link: https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA0001.md @@ -5282,7 +5487,8 @@ dotnet_diagnostic.SA1118.severity = warning # Title : Statement should not use unnecessary parenthesis # Category : StyleCop.CSharp.MaintainabilityRules # Help Link: https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1119.md -dotnet_diagnostic.SA1119.severity = warning +# Redundant: IDE0047 +dotnet_diagnostic.SA1119.severity = none # Title : Statement should not use unnecessary parenthesis # Category : StyleCop.CSharp.MaintainabilityRules @@ -6097,7 +6303,8 @@ dotnet_diagnostic.VSTHRD102.severity = suggestion # Title : Call async methods when in an async method # Category : Usage # Help Link: https://github.com/Microsoft/vs-threading/blob/main/doc/analyzers/VSTHRD103.md -dotnet_diagnostic.VSTHRD103.severity = warning +# Redundant: CA1849 +dotnet_diagnostic.VSTHRD103.severity = none # Title : Offer async methods # Category : Usage diff --git a/bench/Libraries/Microsoft.Extensions.Resilience.PerformanceTests/MetricsUtil.cs b/bench/Libraries/Microsoft.Extensions.Resilience.PerformanceTests/MetricsUtil.cs index 2f6b9c10e92..c8dda5ba015 100644 --- a/bench/Libraries/Microsoft.Extensions.Resilience.PerformanceTests/MetricsUtil.cs +++ b/bench/Libraries/Microsoft.Extensions.Resilience.PerformanceTests/MetricsUtil.cs @@ -7,7 +7,7 @@ namespace Microsoft.Extensions.Resilience.Bench; -internal class MetricsUtil +internal sealed class MetricsUtil { public static MeterListener ListenPollyMetrics() { diff --git a/bench/Libraries/Microsoft.Extensions.Resilience.PerformanceTests/ResilienceEnrichmentBenchmark.cs b/bench/Libraries/Microsoft.Extensions.Resilience.PerformanceTests/ResilienceEnrichmentBenchmark.cs index 228a42531f9..3f2c0c020fe 100644 --- a/bench/Libraries/Microsoft.Extensions.Resilience.PerformanceTests/ResilienceEnrichmentBenchmark.cs +++ b/bench/Libraries/Microsoft.Extensions.Resilience.PerformanceTests/ResilienceEnrichmentBenchmark.cs @@ -47,7 +47,7 @@ private static ResiliencePipeline CreateResiliencePipeline(Action>().GetPipeline("my-pipeline"); } - private class DummyStrategy : ResilienceStrategy + private sealed class DummyStrategy : ResilienceStrategy { private readonly ResilienceStrategyTelemetry _telemetry; @@ -67,7 +67,7 @@ protected override ValueTask> ExecuteCore( } } - private class DummyOptions : ResilienceStrategyOptions + private sealed class DummyOptions : ResilienceStrategyOptions { } } diff --git a/eng/Diags/ILLink.RoslynAnalyzer.yml b/eng/Diags/ILLink.RoslynAnalyzer.yml index a86cabf00a2..bf1a0ac320b 100644 --- a/eng/Diags/ILLink.RoslynAnalyzer.yml +++ b/eng/Diags/ILLink.RoslynAnalyzer.yml @@ -1,6 +1,6 @@ Origin: AssemblyName: ILLink.RoslynAnalyzer - Version: 8.0.9.408 + Version: 8.0.9.3103 Diagnostics: IL2026: Metadata: diff --git a/eng/Diags/Microsoft.AspNetCore.Components.Analyzers.yml b/eng/Diags/Microsoft.AspNetCore.Components.Analyzers.yml index 17fa4e09ab7..cdb85b4c6df 100644 --- a/eng/Diags/Microsoft.AspNetCore.Components.Analyzers.yml +++ b/eng/Diags/Microsoft.AspNetCore.Components.Analyzers.yml @@ -1,6 +1,6 @@ Origin: AssemblyName: Microsoft.AspNetCore.Components.Analyzers - Version: 8.0.23.50222 + Version: 8.0.23.53112 Diagnostics: BL0001: Metadata: diff --git a/eng/Diags/Microsoft.CodeAnalysis.CSharp.CodeStyle.yml b/eng/Diags/Microsoft.CodeAnalysis.CSharp.CodeStyle.yml index 2554594006d..351d6e16e81 100644 --- a/eng/Diags/Microsoft.CodeAnalysis.CSharp.CodeStyle.yml +++ b/eng/Diags/Microsoft.CodeAnalysis.CSharp.CodeStyle.yml @@ -1,6 +1,6 @@ Origin: AssemblyName: Microsoft.CodeAnalysis.CSharp.CodeStyle - Version: 4.8.9.404 + Version: 4.8.9.2411 Diagnostics: IDE0001: Metadata: @@ -131,9 +131,9 @@ Diagnostics: Tier: 1 Attributes: general: - Severity: Silent + Severity: Suggestion Options: - - csharp_style_var_elsewhere = true + - csharp_style_var_elsewhere = false - csharp_style_var_for_built_in_types = false - csharp_style_var_when_type_is_apparent = true IDE0008: @@ -400,7 +400,7 @@ Diagnostics: Tier: 1 Attributes: general: - Severity: Warning + Severity: Suggestion Options: - dotnet_style_collection_initializer = true IDE0029: @@ -416,7 +416,7 @@ Diagnostics: Tier: 1 Attributes: general: - Severity: Warning + Severity: Suggestion Options: - dotnet_style_coalesce_expression = true IDE0030: @@ -432,7 +432,7 @@ Diagnostics: Tier: 1 Attributes: general: - Severity: Warning + Severity: Suggestion Options: - dotnet_style_coalesce_expression = true IDE0031: @@ -1289,7 +1289,7 @@ Diagnostics: Tier: 1 Attributes: general: - Severity: Warning + Severity: Suggestion Options: - csharp_style_implicit_object_creation_when_type_is_apparent = true IDE0110: @@ -1715,6 +1715,20 @@ Diagnostics: Attributes: general: Severity: Silent + IDE0290: + Metadata: + Category: Style + Title: Use primary constructor + Description: '' + HelpLinkUri: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0290 + CustomTags: + - Telemetry + - EnforceOnBuild_Recommended + DefaultSeverity: None + Tier: 1 + Attributes: + general: + Severity: None EnableGenerateDocumentationFile: Metadata: Category: Style @@ -1729,12 +1743,12 @@ Diagnostics: Attributes: general: Severity: Warning - IDE0251: + IDE0304: Metadata: Category: Style - Title: Make member 'readonly' + Title: Simplify collection initialization Description: '' - HelpLinkUri: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0251 + HelpLinkUri: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0304 CustomTags: - Telemetry - EnforceOnBuild_Recommended @@ -1743,12 +1757,12 @@ Diagnostics: Attributes: general: Severity: None - IDE0290: + IDE0305: Metadata: Category: Style - Title: Use primary constructor + Title: Simplify collection initialization Description: '' - HelpLinkUri: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0290 + HelpLinkUri: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0305 CustomTags: - Telemetry - EnforceOnBuild_Recommended @@ -1770,7 +1784,7 @@ Diagnostics: Tier: 1 Attributes: general: - Severity: Suggestion + Severity: None IDE0300: Metadata: Category: Style @@ -1785,26 +1799,12 @@ Diagnostics: Attributes: general: Severity: None - IDE0304: - Metadata: - Category: Style - Title: Simplify collection initialization - Description: '' - HelpLinkUri: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0304 - CustomTags: - - Telemetry - - EnforceOnBuild_Recommended - DefaultSeverity: None - Tier: 1 - Attributes: - general: - Severity: None - IDE0305: + IDE0303: Metadata: Category: Style Title: Simplify collection initialization Description: '' - HelpLinkUri: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0305 + HelpLinkUri: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0303 CustomTags: - Telemetry - EnforceOnBuild_Recommended @@ -1813,12 +1813,12 @@ Diagnostics: Attributes: general: Severity: None - IDE0303: + IDE0302: Metadata: Category: Style Title: Simplify collection initialization Description: '' - HelpLinkUri: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0303 + HelpLinkUri: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0302 CustomTags: - Telemetry - EnforceOnBuild_Recommended @@ -1827,12 +1827,12 @@ Diagnostics: Attributes: general: Severity: None - IDE0302: + IDE0251: Metadata: Category: Style - Title: Simplify collection initialization + Title: Make member 'readonly' Description: '' - HelpLinkUri: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0302 + HelpLinkUri: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0251 CustomTags: - Telemetry - EnforceOnBuild_Recommended @@ -1840,4 +1840,6 @@ Diagnostics: Tier: 1 Attributes: general: - Severity: None + Severity: Warning + Options: + - csharp_style_prefer_readonly_struct_members = true diff --git a/eng/Diags/Microsoft.CodeAnalysis.CSharp.NetAnalyzers.yml b/eng/Diags/Microsoft.CodeAnalysis.CSharp.NetAnalyzers.yml index 422d307d8f7..66cf3687245 100644 --- a/eng/Diags/Microsoft.CodeAnalysis.CSharp.NetAnalyzers.yml +++ b/eng/Diags/Microsoft.CodeAnalysis.CSharp.NetAnalyzers.yml @@ -1,6 +1,6 @@ Origin: AssemblyName: Microsoft.CodeAnalysis.CSharp.NetAnalyzers - Version: 8.0.8.47201 + Version: 8.0.9.2502 Diagnostics: CA1001: Metadata: @@ -127,6 +127,8 @@ Diagnostics: Severity: None Comment: S1144 finds more cases and has no false positives Redundant: S1144 + Options: + - ignore_internalsvisibleto = true CA1824: Metadata: Category: Performance @@ -206,6 +208,8 @@ Diagnostics: Severity: None production: Severity: Warning + Options: + - api_surface = all CA3076: Metadata: Category: Security @@ -439,6 +443,8 @@ Diagnostics: Severity: None performance: Severity: Warning + Options: + - required_modifiers = static CA2260: Metadata: Category: Usage @@ -540,6 +546,20 @@ Diagnostics: Attributes: general: Severity: Warning + CA1870: + Metadata: + Category: Performance + Title: Use a cached 'SearchValues' instance + Description: Using a cached 'SearchValues' instance is more efficient than passing values to 'IndexOfAny'/'ContainsAny' directly. + HelpLinkUri: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1870 + CustomTags: + - Telemetry + - EnabledRuleInAggressiveMode + DefaultSeverity: Suggestion + Tier: 1 + Attributes: + general: + Severity: Suggestion CA1865: Metadata: Category: Performance @@ -597,19 +617,3 @@ Diagnostics: Attributes: general: Severity: Warning - CA1870: - Metadata: - Category: Performance - Title: Use a cached 'SearchValues' instance - Description: Using a cached 'SearchValues' instance is more efficient than passing values to 'IndexOfAny'/'ContainsAny' directly. - HelpLinkUri: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1870 - CustomTags: - - Telemetry - - EnabledRuleInAggressiveMode - DefaultSeverity: Suggestion - Tier: 1 - Attributes: - general: - Severity: None - performance: - Severity: Warning diff --git a/eng/Diags/Microsoft.CodeAnalysis.CodeStyle.yml b/eng/Diags/Microsoft.CodeAnalysis.CodeStyle.yml index 5a7aafdcf79..05928d9a4bb 100644 --- a/eng/Diags/Microsoft.CodeAnalysis.CodeStyle.yml +++ b/eng/Diags/Microsoft.CodeAnalysis.CodeStyle.yml @@ -1,6 +1,6 @@ Origin: AssemblyName: Microsoft.CodeAnalysis.CodeStyle - Version: 4.8.9.404 + Version: 4.8.9.2411 Diagnostics: IDE0033: Metadata: diff --git a/eng/Diags/Microsoft.CodeAnalysis.NetAnalyzers.yml b/eng/Diags/Microsoft.CodeAnalysis.NetAnalyzers.yml index 8a8c6e81b2b..689836bbf7d 100644 --- a/eng/Diags/Microsoft.CodeAnalysis.NetAnalyzers.yml +++ b/eng/Diags/Microsoft.CodeAnalysis.NetAnalyzers.yml @@ -1,6 +1,6 @@ Origin: AssemblyName: Microsoft.CodeAnalysis.NetAnalyzers - Version: 8.0.8.47201 + Version: 8.0.9.2502 Diagnostics: CA1000: Metadata: @@ -265,6 +265,8 @@ Diagnostics: Attributes: general: Severity: None + Options: + - api_surface = all CA1030: Metadata: Category: Design @@ -280,6 +282,8 @@ Diagnostics: Attributes: general: Severity: Warning + Options: + - api_surface = public CA1031: Metadata: Category: Design @@ -344,6 +348,8 @@ Diagnostics: Severity: None api: Severity: Warning + Options: + - api_surface = all CA1040: Metadata: Category: Design @@ -516,6 +522,8 @@ Diagnostics: Attributes: general: Severity: Warning + Options: + - api_surface = all CA1054: Metadata: Category: Design @@ -533,6 +541,8 @@ Diagnostics: Severity: None api: Severity: Warning + Options: + - api_surface = public CA1055: Metadata: Category: Design @@ -550,6 +560,8 @@ Diagnostics: Severity: None api: Severity: Warning + Options: + - api_surface = public CA1056: Metadata: Category: Design @@ -567,6 +579,8 @@ Diagnostics: Severity: None api: Severity: Warning + Options: + - api_surface = public CA1058: Metadata: Category: Design @@ -652,6 +666,8 @@ Diagnostics: Attributes: general: Severity: Warning + Options: + - api_surface = public CA1064: Metadata: Category: Design @@ -1024,6 +1040,8 @@ Diagnostics: general: Severity: None Comment: StyleCop handles this + Options: + - api_surface = all CA1708: Metadata: Category: Naming @@ -1127,6 +1145,9 @@ Diagnostics: general: Severity: None Redundant: IDE1006 + Options: + - api_surface = all + - exclude_single_letter_type_parameters = false CA1716: Metadata: Category: Naming @@ -1218,6 +1239,8 @@ Diagnostics: Attributes: general: Severity: Warning + Options: + - api_surface = public, protected CA1801: Metadata: Category: Usage @@ -1233,6 +1256,8 @@ Diagnostics: general: Severity: None Redundant: IDE0060 + Options: + - api_surface = all CA1802: Metadata: Category: Performance @@ -1346,6 +1371,8 @@ Diagnostics: Severity: None performance: Severity: Warning + Options: + - api_surface = public CA1816: Metadata: Category: Usage @@ -1378,6 +1405,8 @@ Diagnostics: Severity: None performance: Severity: Warning + Options: + - api_surface = public CA1820: Metadata: Category: Performance @@ -1427,6 +1456,8 @@ Diagnostics: Attributes: general: Severity: Warning + Options: + - api_surface = all CA1823: Metadata: Category: Performance @@ -1698,6 +1729,9 @@ Diagnostics: Severity: None performance: Severity: Warning + Options: + - output_kinds = all + - exclude_async_void_methods = false CA2008: Metadata: Category: Reliability @@ -1923,6 +1957,8 @@ Diagnostics: Attributes: general: Severity: Warning + Options: + - api_surface = all CA2211: Metadata: Category: Usage @@ -2068,6 +2104,8 @@ Diagnostics: general: Severity: None Redundant: CS0216 + Options: + - api_surface = all CA2227: Metadata: Category: Usage @@ -2116,6 +2154,8 @@ Diagnostics: Attributes: general: Severity: Error + Options: + - api_surface = public CA2235: Metadata: Category: Usage @@ -2163,6 +2203,8 @@ Diagnostics: Attributes: general: Severity: Warning + Options: + - try_determine_additional_string_formatting_methods_automatically = false CA2242: Metadata: Category: Usage @@ -3906,7 +3948,7 @@ Diagnostics: Attributes: general: Severity: None - Comment: Use the code generated model instead. + Comment: Use R9 logging model instead CA2253: Metadata: Category: Usage @@ -4223,7 +4265,9 @@ Diagnostics: general: Severity: None performance: - Redundant: Warning + Severity: Warning + Options: + - ignore_internalsvisibleto = true CA2259: Metadata: Category: Usage @@ -4326,6 +4370,20 @@ Diagnostics: Attributes: general: Severity: Warning + CA2261: + Metadata: + Category: Usage + Title: Do not use ConfigureAwaitOptions.SuppressThrowing with Task + Description: The ConfigureAwaitOptions.SuppressThrowing is only supported with the non-generic Task, not a Task. To use it with a Task, first cast to the base Task. + HelpLinkUri: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2261 + CustomTags: + - Telemetry + - EnabledRuleInAggressiveMode + DefaultSeverity: Warning + Tier: 1 + Attributes: + general: + Severity: Warning CA1861: Metadata: Category: Performance @@ -4417,12 +4475,12 @@ Diagnostics: Attributes: general: Severity: Suggestion - CA1860: + CA1869: Metadata: Category: Performance - Title: Avoid using 'Enumerable.Any()' extension method - Description: Prefer using 'IsEmpty', 'Count' or 'Length' properties whichever available, rather than calling 'Enumerable.Any()'. The intent is clearer and it is more performant than using 'Enumerable.Any()' extension method. - HelpLinkUri: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1860 + Title: Cache and reuse 'JsonSerializerOptions' instances + Description: Avoid creating a new 'JsonSerializerOptions' instance for every serialization operation. Cache and reuse instances instead. Single use 'JsonSerializerOptions' instances can substantially degrade the performance of your application. + HelpLinkUri: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1869 CustomTags: - Telemetry - EnabledRuleInAggressiveMode @@ -4430,15 +4488,13 @@ Diagnostics: Tier: 1 Attributes: general: - Severity: None - performance: - Severity: Warning - CA1859: + Severity: Suggestion + CA1868: Metadata: Category: Performance - Title: Use concrete types when possible for improved performance - Description: Using concrete types avoids virtual or interface call overhead and enables inlining. - HelpLinkUri: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1859 + Title: Unnecessary call to 'Contains(item)' + Description: Do not guard 'Add(item)' or 'Remove(item)' with 'Contains(item)' for the set. The former two already check whether the item exists and will return if it was added or removed. + HelpLinkUri: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1868 CustomTags: - Telemetry - EnabledRuleInAggressiveMode @@ -4446,15 +4502,13 @@ Diagnostics: Tier: 1 Attributes: general: - Severity: None - performance: - Severity: Warning - CA1858: + Severity: Suggestion + CA1864: Metadata: Category: Performance - Title: Use 'StartsWith' instead of 'IndexOf' - Description: It is both clearer and faster to use 'StartsWith' instead of comparing the result of 'IndexOf' to zero. - HelpLinkUri: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1858 + Title: Prefer the 'IDictionary.TryAdd(TKey, TValue)' method + Description: Prefer a 'TryAdd' call over an 'Add' call guarded by a 'ContainsKey' check. 'TryAdd' behaves the same as 'Add', except that when the specified key already exists, it returns 'false' instead of throwing an exception. + HelpLinkUri: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1864 CustomTags: - Telemetry - EnabledRuleInAggressiveMode @@ -4462,29 +4516,27 @@ Diagnostics: Tier: 1 Attributes: general: - Severity: None - performance: - Severity: Warning - CA2261: + Severity: Suggestion + CA1860: Metadata: - Category: Usage - Title: Do not use ConfigureAwaitOptions.SuppressThrowing with Task - Description: The ConfigureAwaitOptions.SuppressThrowing is only supported with the non-generic Task, not a Task. To use it with a Task, first cast to the base Task. - HelpLinkUri: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2261 + Category: Performance + Title: Avoid using 'Enumerable.Any()' extension method + Description: Prefer using 'IsEmpty', 'Count' or 'Length' properties whichever available, rather than calling 'Enumerable.Any()'. The intent is clearer and it is more performant than using 'Enumerable.Any()' extension method. + HelpLinkUri: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1860 CustomTags: - Telemetry - EnabledRuleInAggressiveMode - DefaultSeverity: Warning + DefaultSeverity: Suggestion Tier: 1 Attributes: general: - Severity: Warning - CA1868: + Severity: Suggestion + CA1862: Metadata: Category: Performance - Title: Unnecessary call to 'Contains(item)' - Description: Do not guard 'Add(item)' or 'Remove(item)' with 'Contains(item)' for the set. The former two already check whether the item exists and will return if it was added or removed. - HelpLinkUri: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1868 + Title: Use the 'StringComparison' method overloads to perform case-insensitive string comparisons + Description: Avoid calling 'ToLower', 'ToUpper', 'ToLowerInvariant' and 'ToUpperInvariant' to perform case-insensitive string comparisons, as in 'string.ToLower() == string.ToLower()', because they lead to an allocation. Instead, use 'string.Equals(string, StringComparison)' to perform case-insensitive comparisons. Switching to using an overload that takes a 'StringComparison' might cause subtle changes in behavior, so it's important to conduct thorough testing after applying the suggestion. Additionally, if a culturally sensitive comparison is not required, consider using 'StringComparison.OrdinalIgnoreCase'. + HelpLinkUri: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1862 CustomTags: - Telemetry - EnabledRuleInAggressiveMode @@ -4493,30 +4545,26 @@ Diagnostics: Attributes: general: Severity: Suggestion - performance: - Severity: Warning - CA1864: + CA1863: Metadata: Category: Performance - Title: Prefer the 'IDictionary.TryAdd(TKey, TValue)' method - Description: Prefer a 'TryAdd' call over an 'Add' call guarded by a 'ContainsKey' check. 'TryAdd' behaves the same as 'Add', except that when the specified key already exists, it returns 'false' instead of throwing an exception. - HelpLinkUri: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1864 + Title: Use 'CompositeFormat' + Description: Cache and use a 'CompositeFormat' instance as the argument to this formatting operation, rather than passing in the original format string. This reduces the cost of the formatting operation. + HelpLinkUri: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1863 CustomTags: - Telemetry - EnabledRuleInAggressiveMode - DefaultSeverity: Suggestion + DefaultSeverity: None Tier: 1 Attributes: general: - Severity: Suggestion - performance: - Severity: Warning - CA1862: + Severity: None + CA1859: Metadata: Category: Performance - Title: Use the 'StringComparison' method overloads to perform case-insensitive string comparisons - Description: Avoid calling 'ToLower', 'ToUpper', 'ToLowerInvariant' and 'ToUpperInvariant' to perform case-insensitive string comparisons, as in 'string.ToLower() == string.ToLower()', because they lead to an allocation. Instead, use 'string.Equals(string, StringComparison)' to perform case-insensitive comparisons. Switching to using an overload that takes a 'StringComparison' might cause subtle changes in behavior, so it's important to conduct thorough testing after applying the suggestion. Additionally, if a culturally sensitive comparison is not required, consider using 'StringComparison.OrdinalIgnoreCase'. - HelpLinkUri: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1862 + Title: Use concrete types when possible for improved performance + Description: Using concrete types avoids virtual or interface call overhead and enables inlining. + HelpLinkUri: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1859 CustomTags: - Telemetry - EnabledRuleInAggressiveMode @@ -4527,22 +4575,20 @@ Diagnostics: Severity: None performance: Severity: Warning - CA1863: + CA1858: Metadata: Category: Performance - Title: Use 'CompositeFormat' - Description: Cache and use a 'CompositeFormat' instance as the argument to this formatting operation, rather than passing in the original format string. This reduces the cost of the formatting operation. - HelpLinkUri: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1863 + Title: Use 'StartsWith' instead of 'IndexOf' + Description: It is both clearer and faster to use 'StartsWith' instead of comparing the result of 'IndexOf' to zero. + HelpLinkUri: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1858 CustomTags: - Telemetry - EnabledRuleInAggressiveMode - DefaultSeverity: None + DefaultSeverity: Suggestion Tier: 1 Attributes: general: - Severity: None - performance: - Severity: Warning + Severity: Suggestion CA1001: Metadata: Category: Design @@ -4554,23 +4600,7 @@ Diagnostics: - Telemetry - EnabledRuleInAggressiveMode DefaultSeverity: None - Tier: 2 - Attributes: - general: - Severity: Warning - CA1869: - Metadata: - Category: Performance - Title: Cache and reuse 'JsonSerializerOptions' instances - Description: Avoid creating a new 'JsonSerializerOptions' instance for every serialization operation. Cache and reuse instances instead. Single use 'JsonSerializerOptions' instances can substantially degrade the performance of your application. - HelpLinkUri: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1869 - CustomTags: - - Telemetry - - EnabledRuleInAggressiveMode - DefaultSeverity: Suggestion Tier: 1 Attributes: general: Severity: None - performance: - Severity: Warning diff --git a/eng/Diags/Microsoft.VisualStudio.Threading.Analyzers.CSharp.yml b/eng/Diags/Microsoft.VisualStudio.Threading.Analyzers.CSharp.yml index f8756d83b85..88c489fa2a8 100644 --- a/eng/Diags/Microsoft.VisualStudio.Threading.Analyzers.CSharp.yml +++ b/eng/Diags/Microsoft.VisualStudio.Threading.Analyzers.CSharp.yml @@ -1,6 +1,6 @@ Origin: AssemblyName: Microsoft.VisualStudio.Threading.Analyzers.CSharp - Version: 17.5.22.27812 + Version: 17.7.30.5607 Diagnostics: VSTHRD001: Metadata: @@ -103,8 +103,7 @@ Diagnostics: Attributes: general: Severity: None - performance: - Severity: Warning + Redundant: CA1849 VSTHRD104: Metadata: Category: Usage diff --git a/eng/Diags/Microsoft.VisualStudio.Threading.Analyzers.yml b/eng/Diags/Microsoft.VisualStudio.Threading.Analyzers.yml index 99cd8a87e0f..36711516996 100644 --- a/eng/Diags/Microsoft.VisualStudio.Threading.Analyzers.yml +++ b/eng/Diags/Microsoft.VisualStudio.Threading.Analyzers.yml @@ -1,6 +1,6 @@ Origin: AssemblyName: Microsoft.VisualStudio.Threading.Analyzers - Version: 17.5.22.27812 + Version: 17.7.30.5607 Diagnostics: VSTHRD100: Metadata: diff --git a/eng/Diags/SonarAnalyzer.CSharp.yml b/eng/Diags/SonarAnalyzer.CSharp.yml index aad858b48d3..87c6506b1ee 100644 --- a/eng/Diags/SonarAnalyzer.CSharp.yml +++ b/eng/Diags/SonarAnalyzer.CSharp.yml @@ -1,12 +1,12 @@ Origin: AssemblyName: SonarAnalyzer.CSharp - Version: 8.52.0.60960 + Version: 9.12.0.78982 Diagnostics: S100: Metadata: Category: Minor Code Smell Title: Methods and properties should be named in PascalCase - Description: Shared naming conventions allow teams to collaborate efficiently. This rule checks whether or not method and property names are PascalCased. To reduce noise, two consecutive upper case characters are allowed unless they form the whole name. So, MyXMethod is compliant, but XM on its own is not. + Description: Shared naming conventions allow teams to collaborate efficiently. HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-100 CustomTags: - C# @@ -22,7 +22,7 @@ Diagnostics: Metadata: Category: Critical Code Smell Title: Method overrides should not change parameter defaults - Description: Default arguments are determined by the static type of the object. If a default argument is different for a parameter in an overriding method, the value used in the call will be different when calls are made via the base or derived object, which may be contrary to developer expectations. + Description: Default arguments are determined by the static type of the object. HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-1006 CustomTags: - C# @@ -38,7 +38,7 @@ Diagnostics: Metadata: Category: Minor Code Smell Title: Types should be named in PascalCase - Description: Shared naming conventions allow teams to collaborate efficiently. This rule checks whether or not type names are using PascalCase. To reduce noise, two consecutive upper case characters are allowed unless they form the whole type name. So, MyXClass is compliant, but XC on its own is not. + Description: Shared naming conventions allow teams to collaborate efficiently. HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-101 CustomTags: - C# @@ -55,7 +55,7 @@ Diagnostics: Metadata: Category: Major Code Smell Title: Lines should not be too long - Description: Having to scroll horizontally makes it harder to get a quick overview and understanding of any piece of code. + Description: Scrolling horizontally to see a full line of code lowers the code readability. HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-103 CustomTags: - C# @@ -70,7 +70,7 @@ Diagnostics: Metadata: Category: Major Code Smell Title: Files should not have too many lines of code - Description: A source file that grows too much tends to aggregate too many responsibilities and inevitably becomes harder to understand and therefore to maintain. Above a specific threshold, it is strongly advised to refactor it into smaller pieces of code which focus on well defined tasks. Those smaller files will not only be easier to understand but also probably easier to test. + Description: When a source file grows too much, it can accumulate numerous responsibilities and become challenging to understand and maintain. HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-104 CustomTags: - C# @@ -84,8 +84,8 @@ Diagnostics: S1048: Metadata: Category: Blocker Bug - Title: Destructors should not throw exceptions - Description: If Finalize or an override of Finalize throws an exception, and the runtime is not hosted by an application that overrides the default policy, the runtime terminates the process immediately without graceful cleanup (finally blocks and finalizers are not executed). This behavior ensures process integrity if the finalizer cannot free or destroy resources. + Title: Finalizers should not throw exceptions + Description: The finalizers are used to perform any necessary final clean-up when the garbage collector is collecting a class instance. The programmer has no control over when the finalizer is called; the garbage collector decides when to call it. HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-1048 CustomTags: - C# @@ -101,7 +101,7 @@ Diagnostics: Metadata: Category: Minor Code Smell Title: Tabulation characters should not be used - Description: Developers should not need to configure the tab width of their text editors in order to be able to read source code. + Description: The tab width can differ from one development environment to another. Using tabs may require other developers to configure their environment (text editor, preferences, etc.) to read source code. HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-105 CustomTags: - C# @@ -164,7 +164,7 @@ Diagnostics: Metadata: Category: Major Code Smell Title: Methods should not have too many parameters - Description: A long parameter list can indicate that a new structure should be created to wrap the numerous parameters or that the function is doing too many things. + Description: Methods with a long parameter list are difficult to use, as maintainers must figure out the role of each parameter and keep track of their position. HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-107 CustomTags: - C# @@ -195,7 +195,7 @@ Diagnostics: Metadata: Category: Major Code Smell Title: Nested blocks of code should not be left empty - Description: Most of the time a block of code is empty when a piece of code is really missing. So such empty block must be either filled or removed. + Description: An empty code block is confusing. It will require some effort from maintainers to determine if it is intentional or indicates the implementation is incomplete. HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-108 CustomTags: - C# @@ -225,7 +225,7 @@ Diagnostics: Metadata: Category: Major Code Smell Title: Inheritance tree of classes should not be too deep - Description: Inheritance is certainly one of the most valuable concepts in object-oriented programming. It’s a way to compartmentalize and reuse code by creating collections of attributes and behaviors called classes which can be based on previously created classes. But abusing this concept by creating a deep inheritance tree can lead to very complex and unmaintainable source code. Most of the time a too deep inheritance tree is due to bad object oriented design which has led to systematically use 'inheritance' when for instance 'composition' would suit better. + Description: Inheritance is one of the most valuable concepts in object-oriented programming. It’s a way to categorize and reuse code by creating collections of attributes and behaviors called classes, which can be based on previously created classes. HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-110 CustomTags: - C# @@ -306,8 +306,8 @@ Diagnostics: S1117: Metadata: Category: Major Code Smell - Title: Local variables should not shadow class fields - Description: Overriding or shadowing a variable declared in an outer scope can strongly impact the readability, and therefore the maintainability, of a piece of code. Further, it could lead maintainers to introduce bugs because they think they’re using one variable but are really using another. + Title: Local variables should not shadow class fields or properties + Description: Overriding or shadowing a field or a property declared in an outer scope can strongly impact the readability, and therefore the maintainability, of a piece of code. Developers may mistakenly assume they are modifying or accessing the class field/property when, in fact, they are working with the local variable. HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-1117 CustomTags: - C# @@ -451,7 +451,7 @@ Diagnostics: Metadata: Category: Info Code Smell Title: Track uses of "TODO" tags - Description: TODO tags are commonly used to mark places where some more code is required, but which the developer wants to implement later. + Description: Developers often use TOOO tags to mark areas in the code where additional work or improvements are needed but are not implemented immediately. However, these TODO tags sometimes get overlooked or forgotten, leading to incomplete or unfinished code. This code smell class aims to identify and address such unattended TODO tags to ensure a clean and maintainable codebase. This description will explore why this is a problem and how it can be fixed to improve the overall code quality. HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-1135 CustomTags: - C# @@ -467,15 +467,14 @@ Diagnostics: Metadata: Category: Major Code Smell Title: Unused private types or members should be removed - Description: 'private or internal types or private members that are never executed or referenced are dead code: unnecessary, inoperative code that should be removed. Cleaning out dead code decreases the size of the maintained codebase, making it easier to understand the program and preventing bugs from being introduced.' + Description: 'private or internal types or private members that are never executed or referenced are unused code: unnecessary, inoperative code that should be removed.' HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-1144 CustomTags: - C# - MainSourceScope - TestSourceScope - SonarWay - - Unnecessary - DefaultSeverity: Suggestion + DefaultSeverity: Warning Tier: 2 Attributes: general: @@ -542,7 +541,7 @@ Diagnostics: Metadata: Category: Critical Code Smell Title: Exceptions should not be thrown in finally blocks - Description: Throwing an exception from within a finally block will mask any exception which was previously thrown in the try or catch block, and the masked’s exception message and stack trace will be lost. + Description: If an exception is already being thrown within the try block or caught in a catch block, throwing another exception in the finally block will override the original exception. This means that the original exception’s message and stack trace will be lost, potentially making it challenging to diagnose and troubleshoot the root cause of the problem. HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-1163 CustomTags: - C# @@ -606,7 +605,7 @@ Diagnostics: Metadata: Category: Critical Code Smell Title: Methods should not be empty - Description: 'There are several reasons for a method not to have a method body:' + Description: An empty method is generally considered bad practice and can lead to confusion, readability, and maintenance issues. Empty methods bring no functionality and are misleading to others as they might think the method implementation fulfills a specific and identified requirement. HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-1186 CustomTags: - C# @@ -651,7 +650,7 @@ Diagnostics: S1200: Metadata: Category: Major Code Smell - Title: Classes should not be coupled to too many other classes (Single Responsibility Principle) + Title: Classes should not be coupled to too many other classes Description: 'According to the Single Responsibility Principle, introduced by Robert C. Martin in his book "Principles of Object Oriented Design", a class should have only one responsibility:' HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-1200 CustomTags: @@ -666,7 +665,7 @@ Diagnostics: Metadata: Category: Minor Bug Title: '"Equals(Object)" and "GetHashCode()" should be overridden in pairs' - Description: 'There is a contract between Equals(object) and GetHashCode(): If two objects are equal according to the Equals(object) method, then calling GetHashCode() on each of them must yield the same result. If this is not the case, many collections won’t handle class instances correctly.' + Description: Suppose you override Object.Equals in a type, you must also override Object.GetHashCode. If two objects are equal according to the Equals method, then calling GetHashCode on each of them must yield the same integer. If this is not the case, many collections, such as a Hashtable or a Dictionary won’t handle class instances correctly. HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-1206 CustomTags: - C# @@ -682,7 +681,7 @@ Diagnostics: Metadata: Category: Critical Code Smell Title: Control structures should use curly braces - Description: While not technically incorrect, the omission of curly braces can be misleading, and may lead to the introduction of errors during maintenance. + Description: Control structures are code statements that impact the program’s control flow (e.g., if statements, for loops, etc.) HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-121 CustomTags: - C# @@ -714,7 +713,7 @@ Diagnostics: Metadata: Category: Critical Code Smell Title: '"GC.Collect" should not be called' - Description: Calling GC.Collect is rarely necessary, and can significantly affect application performance. That’s because it triggers a blocking operation that examines every object in memory for cleanup. Further, you don’t have control over when this blocking cleanup will actually run. + Description: GC.Collect is a method that forces or suggests to the garbage collector to run a collection of objects in the managed heap that are no longer being used and free their memory. HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-1215 CustomTags: - C# @@ -732,7 +731,7 @@ Diagnostics: Metadata: Category: Major Code Smell Title: Statements should be on separate lines - Description: For better readability, do not put more than one statement on a single line. + Description: Putting multiple statements on a single line lowers the code readability and makes debugging the code more complex. HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-122 CustomTags: - C# @@ -1066,7 +1065,7 @@ Diagnostics: Metadata: Category: Major Bug Title: Variables should not be self-assigned - Description: There is no reason to re-assign a variable to itself. Either this statement is redundant and should be removed, or the re-assignment is a mistake and some other value or variable was intended for the assignment instead. + Description: 'Re-assigning a variable to itself is a defect as it has no actual effect and indicates meaning to do something else. It usually means that:' HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-1656 CustomTags: - C# @@ -1168,7 +1167,7 @@ Diagnostics: Metadata: Category: Major Bug Title: Loops with at most one iteration should be refactored - Description: A loop with at most one iteration is equivalent to the use of an if statement to conditionally execute one piece of code. If the initial intention of the author was really to conditionally execute one piece of code, an if statement should be used instead. If that was not the initial intention of the author, the body of the loop should be fixed to use the nested return, break or throw statements in a more appropriate way. + Description: A loop statement with at most one iteration is equivalent to an if statement; the following block is executed only once. HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-1751 CustomTags: - C# @@ -1183,8 +1182,8 @@ Diagnostics: S1764: Metadata: Category: Major Bug - Title: Identical expressions should not be used on both sides of a binary operator - Description: Using the same value on either side of a binary operator is almost always a mistake. In the case of logical operators, it is either a copy/paste error and therefore a bug, or it is simply wasted code, and should be simplified. In the case of bitwise operators and most binary mathematical operators, having the same value on both sides of an operator yields predictable results, and should be simplified. + Title: Identical expressions should not be used on both sides of operators + Description: Using the same value on both sides of certain operators is a code defect. In the case of logical operators, it is either a copy/paste error and, therefore, a bug, or it is simply duplicated code and should be simplified. For bitwise operators and most binary mathematical operators, having the same value on both sides of an operator yields predictable results and should be simplified as well to avoid further code defects. HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-1764 CustomTags: - C# @@ -1214,7 +1213,7 @@ Diagnostics: Metadata: Category: Major Bug Title: Objects should not be created to be dropped immediately without being used - Description: There is no good reason to create a new object to not do anything with it. Most of the time, this is due to a missing piece of code and so could lead to an unexpected behavior in production. + Description: Creating objects that are not used is a vulnerability that can lead to unexpected behavior. HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-1848 CustomTags: - C# @@ -1261,7 +1260,7 @@ Diagnostics: Metadata: Category: Major Bug Title: Related "if/else if" statements should not have the same condition - Description: 'A chain of if/else if statements is evaluated from top to bottom. At most, only one branch will be executed: the first one with a condition that evaluates to true.' + Description: 'A chain of if/else if statements is evaluated from top to bottom. At most, only one branch will be executed: the first statement with a condition that evaluates to true. Therefore, duplicating a condition leads to unreachable code inside the duplicated condition block. Usually, this is due to a copy/paste error.' HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-1862 CustomTags: - C# @@ -1340,8 +1339,8 @@ Diagnostics: S1944: Metadata: Category: Critical Code Smell - Title: Inappropriate casts should not be made - Description: Inappropriate casts are issues that will lead to unexpected behavior or runtime errors, such as InvalidCastExceptions. The compiler will catch bad casts from one class to another, but not bad casts to interfaces. Nor will it catch nullable values that are known to be null but that are cast to their underlying value types anyway. + Title: Invalid casts should be avoided + Description: A cast is an explicit conversion, which is a way to tell the compiler the intent to convert from one type to another. HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-1944 CustomTags: - C# @@ -1372,7 +1371,7 @@ Diagnostics: Metadata: Category: Critical Vulnerability Title: Hashes should include an unpredictable salt - Description: In cryptography, a "salt" is an extra piece of data which is included when hashing a password. This makes rainbow-table attacks more difficult. Using a cryptographic hash function without an unpredictable salt increases the likelihood that an attacker could successfully find the hash value in databases of precomputed hashes (called rainbow-tables). + Description: This vulnerability increases the likelihood that attackers are able to compute the cleartext of password hashes. HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-2053 CustomTags: - C# @@ -1447,7 +1446,7 @@ Diagnostics: Metadata: Category: Major Bug Title: Collections should not be passed as arguments to their own methods - Description: Passing a collection as an argument to the collection’s own method is either an error - some other argument was intended - or simply nonsensical code. + Description: Passing a collection as an argument to the collection’s own method is a code defect. Doing so might either have unexpected side effects or always have the same result. HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-2114 CustomTags: - C# @@ -1463,7 +1462,7 @@ Diagnostics: Metadata: Category: Major Bug Title: Values should not be uselessly incremented - Description: A value that is incremented or decremented and then not stored is at best wasted code and at worst a bug. + Description: When using the postfix increment operator, it is important to know that the result of the expression x++ is the value before the operation x. HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-2123 CustomTags: - C# @@ -1509,7 +1508,7 @@ Diagnostics: Metadata: Category: Blocker Code Smell Title: Short-circuit logic should be used in boolean contexts - Description: The use of non-short-circuit logic in a boolean context is likely a mistake - one that could cause serious program errors as conditions are evaluated under the wrong circumstances. + Description: Short-circuit evaluation is an evaluation strategy for Boolean operators, that doesn’t evaluates the second argument of the operator if it is not needed to determine the result of the operation. HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-2178 CustomTags: - C# @@ -1524,7 +1523,7 @@ Diagnostics: Metadata: Category: Minor Bug Title: Integral numbers should not be shifted by zero or more than their number of bits-1 - Description: Shifting an integral number by 0 is equivalent to doing nothing but makes the code confusing for maintainers. + Description: The shifting operators are used to do an arithmetic shift to the bits of an integral numeric value, either to the left or the right. HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-2183 CustomTags: - C# @@ -1555,8 +1554,8 @@ Diagnostics: S2187: Metadata: Category: Blocker Code Smell - Title: TestCases should contain tests - Description: There’s no point in having a test class without any test methods.This could lead a maintainer to assume a class is covered by tests even though it is not. + Title: Test classes should contain at least one test case + Description: To ensure proper testing, it is important to include test cases in a test class. If a test class does not have any test cases, it can give the wrong impression that the class being tested has been thoroughly tested, when in reality, it has not. HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-2187 CustomTags: - C# @@ -1570,8 +1569,8 @@ Diagnostics: S2190: Metadata: Category: Blocker Bug - Title: Recursion should not be infinite - Description: Recursion happens when control enters a loop that has no exit. This can happen a method invokes itself, when a pair of methods invoke each other, or when goto statements are used to move between two segments of code. It can be a useful tool, but unless the method includes a provision to break out of the recursion and return, the recursion will continue until the stack overflows and the program crashes. + Title: Loops and recursions should not be infinite + Description: Having an infinite loop or recursion will lead to a program failure or a program never finishing the execution. HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-2190 CustomTags: - C# @@ -1601,8 +1600,8 @@ Diagnostics: S2201: Metadata: Category: Major Bug - Title: Return values from functions without side effects should not be ignored - Description: When the call to a function doesn’t have any side effects, what is the point of making the call if the results are ignored? In such case, either the function call is useless and should be dropped or the source code doesn’t behave as expected. + Title: Methods without side effects should not have their return values ignored + Description: When you do not use the return value of a method with no side effects, it indicates that something is wrong. Either this method is unnecessary, or the source code does not behave as expected and could lead to code defects. For example, there are methods, such as DateTime.AddYears, that don’t change the value of the input object, but instead, they return a new object whose value is the result of this operation, and as a result that you will have unexpected effects if you do not use the return value. HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-2201 CustomTags: - C# @@ -1648,7 +1647,7 @@ Diagnostics: Metadata: Category: Critical Code Smell Title: Non-constant static fields should not be visible - Description: A static field that is neither constant nor read-only is not thread-safe. Correctly accessing these fields from different threads needs synchronization with locks. Improper synchronization may lead to unexpected results, thus publicly visible static fields are best suited for storing non-changing data shared by many consumers. To enforce this intent, these fields should be marked readonly or converted to constants. + Description: Unlike instance fields, which can only be accessed by code having a hold on the instance, static fields can be accessed by any code having visibility of the field and its type. HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-2223 CustomTags: - C# @@ -1663,7 +1662,7 @@ Diagnostics: Metadata: Category: Major Bug Title: '"ToString()" method should not return null' - Description: Calling ToString() on an object should always return a string. Returning null instead contravenes the method’s implicit contract. + Description: Calling ToString() on an object should always return a string. Thus, overriding the ToString method should never return null, as it breaks the method’s implicit contract, and as a result the consumer’s expectations. HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-2225 CustomTags: - C# @@ -1693,8 +1692,8 @@ Diagnostics: S2234: Metadata: Category: Major Code Smell - Title: Parameters should be passed in the correct order - Description: When the names of parameters in a method call match the names of the method arguments, it contributes to clearer, more readable code. However, when the names match, but are passed in a different order than the method arguments, it indicates a mistake in the parameter order which will likely lead to unexpected results. + Title: Arguments should be passed in the same order as the method parameters + Description: Calling a method with argument variables whose names match the method parameter names but in a different order can cause confusion. It could indicate a mistake in the arguments' order, leading to unexpected results. HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-2234 CustomTags: - C# @@ -1725,7 +1724,7 @@ Diagnostics: Metadata: Category: Major Bug Title: A "for" loop update clause should move the counter in the right direction - Description: A for loop with a counter that moves in the wrong direction is not an infinite loop. Because of wraparound, the loop will eventually reach its stop condition, but in doing so, it will run many, many more times than anticipated, potentially causing unexpected behavior. + Description: A for loop with a counter that moves in the wrong direction, away from the stop condition, is not an infinite loop. Because of wraparound, the loop will eventually reach its stop condition, but in doing so, it will probably run more times than anticipated, potentially causing unexpected behavior. HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-2251 CustomTags: - C# @@ -1741,7 +1740,7 @@ Diagnostics: Metadata: Category: Major Bug Title: For-loop conditions should be true at least once - Description: If a for loop’s condition is false before the first loop iteration, the loop will never be executed. Such loops are almost always bugs, particularly when the initial value and stop conditions are hard-coded. + Description: A for loop is a fundamental programming construct used to execute a block of code repeatedly. However, if the loop’s condition is false before the first iteration, the loop will never execute. HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-2252 CustomTags: - C# @@ -1786,7 +1785,7 @@ Diagnostics: Metadata: Category: Major Bug Title: Null pointers should not be dereferenced - Description: A reference to null should never be dereferenced/accessed. Doing so will cause a NullReferenceException to be thrown. At best, such an exception will cause abrupt program termination. At worst, it could expose debugging information that would be useful to an attacker, or it could allow an attacker to bypass security measures. + Description: Accessing a null value will always throw a NullReferenceException most likely causing an abrupt program termination. HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-2259 CustomTags: - C# @@ -1802,7 +1801,7 @@ Diagnostics: Metadata: Category: Blocker Bug Title: Composite format strings should not lead to unexpected behavior at runtime - Description: Because composite format strings are interpreted at runtime, rather than validated by the compiler, they can contain errors that lead to unexpected behaviors or runtime errors. This rule statically validates the good behavior of composite formats when calling the methods of String.Format, StringBuilder.AppendFormat, Console.Write, Console.WriteLine, TextWriter.Write, TextWriter.WriteLine, Debug.WriteLine(String, Object[]), Trace.TraceError(String, Object[]), Trace.TraceInformation(String, Object[]), Trace.TraceWarning(String, Object[]) and TraceSource.TraceInformation(String, Object[]). + Description: 'Composite format strings in C# are evaluated at runtime, which means they are not verified by the compiler. Introducing an ill-formed format item, or indexing mismatch can lead to unexpected behaviors or runtime errors. The purpose of this rule is to perform static validation on composite format strings used in various string formatting functions to ensure their correct usage. This rule validates the proper behavior of composite formats when invoking the following methods:' HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-2275 CustomTags: - C# @@ -1831,7 +1830,7 @@ Diagnostics: Metadata: Category: Critical Code Smell Title: Field-like events should not be virtual - Description: Field-like events are events that do not have explicit add and remove methods. The compiler generates a private delegate field to back the event, as well as generating the implicit add and remove methods. + Description: Field-like events are events that do not have explicit add and remove accessors. HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-2290 CustomTags: - C# @@ -1847,7 +1846,7 @@ Diagnostics: Metadata: Category: Critical Code Smell Title: Overflow checking should not be disabled for "Enumerable.Sum" - Description: Enumerable.Sum() always executes addition in a checked context, so an OverflowException will be thrown if the value exceeds MaxValue even if an unchecked context was specified. Using an unchecked context anyway represents a misunderstanding of how Sum works. + Description: Enumerable.Sum() always executes addition in a checked context, so an OverflowException will be thrown if the value exceeds MaxValue, even if an unchecked context was specified. Therefore, using this method inside an unchecked context will only make the code more confusing, since the behavior will still be checked. HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-2291 CustomTags: - C# @@ -1893,7 +1892,7 @@ Diagnostics: Metadata: Category: Blocker Code Smell Title: '"async" and "await" should not be used as identifiers' - Description: Since C# 5.0, async and await are contextual keywords. Contextual keywords do have a particular meaning in some contexts, but can still be used as variable names. Keywords, on the other hand, are always reserved, and therefore are not valid variable names. To avoid any confusion though, it is best to not use async and await as identifiers. + Description: Since C# 5.0, async and await are contextual keywords. Contextual keywords do have a particular meaning in some contexts, but are not reserved and therefore can be used as variable names. HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-2306 CustomTags: - C# @@ -2049,7 +2048,7 @@ Diagnostics: Metadata: Category: Minor Bug Title: Flags enumerations should explicitly initialize all their members - Description: Flags enumerations should not rely on the language to initialize the values of their members. Implicit initialization will set the first member to 0, and increment the value by one for each subsequent member. This implicit behavior does not allow members to be combined using the bitwise or operator in a useful way. + Description: When you annotate an Enum with the Flags attribute, you must not rely on the values that are automatically set by the language to the Enum members, but you should define the enumeration constants in powers of two (1, 2, 4, 8, and so on). Automatic value initialization will set the first member to zero and increment the value by one for each subsequent member. As a result, you won’t be able to use the enum members with bitwise operators. HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-2345 CustomTags: - C# @@ -2065,7 +2064,7 @@ Diagnostics: Metadata: Category: Critical Code Smell Title: Flags enumerations zero-value members should be named "None" - Description: Consistent use of "None" in flags enumerations indicates that all flag values are cleared. The value 0 should not be used to indicate any other state, since there is no way to check that the bit 0 is set. + Description: 'An enumeration can be decorated with the FlagsAttribute to indicate that it can be used as a bit field: a set of flags, that can be independently set and reset.' HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-2346 CustomTags: - C# @@ -2112,7 +2111,7 @@ Diagnostics: Metadata: Category: Critical Code Smell Title: Properties should not make collection or array copies - Description: Most developers expect property access to be as efficient as field access. However, if a property returns a copy of an array or collection, it will be much slower than simple field access, contrary to the caller’s likely expectations. Therefore, such properties should be refactored into methods so that callers are not surprised by the unexpectedly poor performance. + Description: Most developers expect property access to be as efficient as field access. However, if a property returns a copy of an array or collection, it will be much slower than a simple field access, contrary to the caller’s likely expectations. Therefore, such properties should be refactored into methods so that callers are not surprised by the unexpectedly poor performance. HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-2365 CustomTags: - C# @@ -2127,7 +2126,7 @@ Diagnostics: Metadata: Category: Blocker Code Smell Title: Public methods should not have multidimensional array parameters - Description: Exposing methods with multidimensional array parameters requires developers to have advanced knowledge about the language in order to be able to use them. Moreover, what exactly to pass to such parameters is not intuitive. Therefore, such methods should not be exposed, but can be used internally. + Description: Using multidimensional and jagged arrays as method parameters in C# can be challenging for developers. HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-2368 CustomTags: - C# @@ -2218,8 +2217,8 @@ Diagnostics: S2437: Metadata: Category: Blocker Code Smell - Title: Silly bit operations should not be performed - Description: Certain bit operations are just silly and should not be performed because their results are predictable. + Title: Unnecessary bit operations should not be performed + Description: Certain bitwise operations are not needed and should not be performed because their results are predictable. HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-2437 CustomTags: - C# @@ -2236,7 +2235,7 @@ Diagnostics: Metadata: Category: Critical Code Smell Title: Whitespace and control characters in string literals should be explicit - Description: 'Non-encoded control characters and whitespace characters are often injected in the source code because of a bad manipulation. They are either invisible or difficult to recognize, which can result in bugs when the string is not what the developer expects. If you actually need to use a control character use their encoded version (ex: ASCII \n,\t,…​ or Unicode U+000D, U+0009,…​).' + Description: 'Non-encoded control characters and whitespace characters are often injected in the source code because of a bad manipulation. They are either invisible or difficult to recognize, which can result in bugs when the string is not what the developer expects. If you actually need to use a control character use their encoded version:' HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-2479 CustomTags: - C# @@ -2266,7 +2265,7 @@ Diagnostics: Metadata: Category: Critical Bug Title: Shared resources should not be used for locking - Description: Shared resources should not be used for locking as it increases the chance of deadlocks. Any other thread could acquire (or attempt to acquire) the same lock for another unrelated purpose. + Description: A shared resource refers to a resource or data that can be accessed or modified by multiple threads or concurrent parts of a program. It could be any piece of data, object, file, database connection, or system resource that needs to be accessed or manipulated by multiple parts of a program concurrently. HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-2551 CustomTags: - C# @@ -2277,13 +2276,12 @@ Diagnostics: Tier: 1 Attributes: general: - Severity: None - Redundant: CA2002 + Severity: Warning S2583: Metadata: Category: Major Bug Title: Conditionally executed code should be reachable - Description: Conditional expressions which are always true or false can lead to dead code. Such code is always buggy and should never be used in production. + Description: Conditional expressions which are always true or false can lead to unreachable code. HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-2583 CustomTags: - C# @@ -2300,7 +2298,7 @@ Diagnostics: Metadata: Category: Major Code Smell Title: Boolean expressions should not be gratuitous - Description: If a boolean expression doesn’t change the evaluation of the condition, then it is entirely unnecessary, and can be removed. If it is gratuitous because it does not match the programmer’s intent, then it’s a bug and the expression should be fixed. + Description: An operand of a boolean expression that never changes the result of the expression might not match the programmer’s intent and can lead to unexpected behavior and potential bugs. HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-2589 CustomTags: - C# @@ -2311,7 +2309,8 @@ Diagnostics: Tier: 1 Attributes: general: - Severity: Warning + Severity: None + Comment: Too many false positives. S2674: Metadata: Category: Minor Bug @@ -2330,7 +2329,7 @@ Diagnostics: Metadata: Category: Major Code Smell Title: Multiline blocks should be enclosed in curly braces - Description: Curly braces can be omitted from a one-line block, such as with an if statement or for loop, but doing so can be misleading and induce bugs. + Description: Having inconsistent indentation and omitting curly braces from a control structure, such as an if statement or for loop, is misleading and can induce bugs. HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-2681 CustomTags: - C# @@ -2346,7 +2345,7 @@ Diagnostics: Metadata: Category: Major Bug Title: '"NaN" should not be used in comparisons' - Description: NaN is not equal to anything, even itself. Testing for equality or inequality against NaN will yield predictable results, but probably not the ones you want. + Description: double.NaN and float.NaN are not equal to anything, not even themselves. HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-2688 CustomTags: - C# @@ -2362,7 +2361,7 @@ Diagnostics: Metadata: Category: Critical Code Smell Title: '"IndexOf" checks should not be for positive numbers' - Description: Most checks against an IndexOf value compare it with -1 because 0 is a valid index. Any checks which look for values > 0 ignore the first element, which is likely a bug. If the intent is merely to check inclusion of a value in a string, List, or an array, consider using the Contains method instead. + Description: Most checks against an IndexOf value compare it with -1 because 0 is a valid index. HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-2692 CustomTags: - C# @@ -2378,7 +2377,7 @@ Diagnostics: Metadata: Category: Critical Code Smell Title: Instance members should not write to "static" fields - Description: Correctly updating a static field from a non-static method is tricky to get right and could easily lead to bugs if there are multiple class instances and/or multiple threads in play. + Description: This rule raises an issue each time a static field is updated from a non-static method or property. HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-2696 CustomTags: - C# @@ -2393,7 +2392,7 @@ Diagnostics: Metadata: Category: Blocker Code Smell Title: Tests should include assertions - Description: A test case without assertions ensures only that no exceptions are thrown. Beyond basic runnability, it ensures nothing about the behavior of the code under test. + Description: The rule targets test methods that lack an assertion and consist solely of an action and, optionally, a setup. HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-2699 CustomTags: - C# @@ -2422,7 +2421,7 @@ Diagnostics: Metadata: Category: Minor Code Smell Title: '"catch" clauses should do more than rethrow' - Description: A catch clause that only rethrows the caught exception has the same effect as omitting the catch altogether and letting it bubble up automatically, but with more code and the additional detriment of leaving maintainers scratching their heads. + Description: A catch clause that only rethrows the caught exception has the same effect as omitting the catch altogether and letting it bubble up automatically. HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-2737 CustomTags: - C# @@ -2453,7 +2452,7 @@ Diagnostics: Metadata: Category: Blocker Vulnerability Title: XML parsers should not be vulnerable to XXE attacks - Description: XML standard allows the use of entities, declared in the DOCTYPE of the document, which can be internal or external. + Description: This vulnerability allows the usage of external entities in XML. HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-2755 CustomTags: - C# @@ -2467,8 +2466,8 @@ Diagnostics: S2757: Metadata: Category: Major Bug - Title: '"=+" should not be used instead of "+="' - Description: The use of operators pairs ( =+, =- or =! ) where the reversed, single operator was meant (+=, -= or !=) will compile and run, but not produce the expected results. + Title: Non-existent operators like "=+" should not be used + Description: Using operator pairs (=+, =-, or =!) that look like reversed single operators (+=, -= or !=) is confusing. They compile and run but do not produce the same result as their mirrored counterpart. HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-2757 CustomTags: - C# @@ -2513,7 +2512,7 @@ Diagnostics: Metadata: Category: Major Bug Title: Doubled prefix operators "!!" and "~~" should not be used - Description: 'Calling the ! or ~ prefix operator twice does nothing: the second invocation undoes the first. Such mistakes are typically caused by accidentally double-tapping the key in question without noticing.' + Description: The repetition of a prefix operator (!, or ~) is usually a typo. The second operator invalidates the first one. HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-2761 CustomTags: - C# @@ -2529,7 +2528,7 @@ Diagnostics: Metadata: Category: Blocker Bug Title: SQL keywords should be delimited by whitespace - Description: Badly formed SQL is likely to cause errors at runtime. + Description: When concatenating strings, it is very easy to forget a whitespace. HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-2857 CustomTags: - C# @@ -2544,7 +2543,7 @@ Diagnostics: Metadata: Category: Blocker Bug Title: '"IDisposables" should be disposed' - Description: "When writing managed code, you don’t need to worry about allocating or freeing memory: The garbage collector takes care of it. For efficiency reasons, some objects such as Bitmap use unmanaged memory, enabling for example the use of pointer arithmetic. Such objects have potentially huge unmanaged memory footprints, but will have tiny managed ones. Unfortunately, the garbage collector only sees the tiny managed footprint, and fails to reclaim the unmanaged memory (by calling Bitmap's finalizer method) in a timely fashion." + Description: When writing managed code, there is no need to worry about memory allocation or deallocation as it is taken care of by the garbage collector. However, certain objects, such as Bitmap, utilize unmanaged memory for specific purposes like pointer arithmetic. These objects may have substantial unmanaged memory footprints while having minimal managed footprints. Unfortunately, the garbage collector only recognizes the small managed footprint and does not promptly reclaim the corresponding unmanaged memory (by invoking the finalizer method of Bitmap) for efficiency reasons. HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-2930 CustomTags: - C# @@ -2594,7 +2593,7 @@ Diagnostics: Metadata: Category: Minor Bug Title: Property assignments should not be made for "readonly" fields not constrained to reference types - Description: While the properties of a readonly reference type field can still be changed after initialization, those of a readonly value field, such as a struct, cannot. + Description: While the properties of a readonly reference type field can still be changed after initialization, those of a readonly value type field, such as a struct, cannot. HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-2934 CustomTags: - C# @@ -2624,7 +2623,7 @@ Diagnostics: Metadata: Category: Blocker Code Smell Title: Methods named "Dispose" should implement "IDisposable.Dispose" - Description: Dispose as a method name should be used exclusively to implement IDisposable.Dispose to prevent any confusion. + Description: IDisposable is an interface implemented by all types which need to provide a mechanism for releasing unmanaged resources. HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-2953 CustomTags: - C# @@ -2670,7 +2669,7 @@ Diagnostics: Metadata: Category: Major Bug Title: '"Object.ReferenceEquals" should not be used for value types' - Description: Using Object.ReferenceEquals to compare the references of two value types simply won’t return the expected results most of the time because such types are passed by value, not by reference. + Description: In C#, the Object.ReferenceEquals method is used to compare two reference type variables. If you use this method to compare two value types, such as int, float, or bool you will not get the expected results because value type variables contain an instance of the type and not a reference to it. HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-2995 CustomTags: - C# @@ -2702,7 +2701,7 @@ Diagnostics: Metadata: Category: Major Bug Title: '"IDisposables" created in a "using" statement should not be returned' - Description: Typically you want to use using to create a local IDisposable variable; it will trigger disposal of the object when control passes out of the block’s scope. The exception to this rule is when your method returns that IDisposable. In that case using disposes of the object before the caller can make use of it, likely causing exceptions at runtime. So you should either remove using or avoid returning the IDisposable. + Description: When you use a using statement, the goal is to ensure the correct disposal of an IDisposable instance when the control leaves the using statement block. HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-2997 CustomTags: - C# @@ -2718,7 +2717,7 @@ Diagnostics: Metadata: Category: Major Bug Title: '"ThreadStatic" should not be used on non-static fields' - Description: When a non-static class field is annotated with ThreadStatic, the code seems to show that the field can have different values for different calling threads, but that’s not the case, since the ThreadStatic attribute is simply ignored on non-static fields. + Description: When you annotate a field with the ThreadStatic attribute, it is an indication that the value of this field is unique for each thread. But if you don’t mark the field as static, then the ThreadStatic attribute is ignored. HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-3005 CustomTags: - C# @@ -2749,7 +2748,7 @@ Diagnostics: Metadata: Category: Major Code Smell Title: Reflection should not be used to increase accessibility of classes, methods, or fields - Description: This rule raises an issue when reflection is used to change the visibility of a class, method or field, and when it is used to directly update a field value. Altering or bypassing the accessibility of classes, methods, or fields violates the encapsulation principle and could lead to run-time errors. + Description: Altering or bypassing the accessibility of classes, methods, or fields through reflection violates the encapsulation principle. This can break the internal contracts of the accessed target and lead to maintainability issues and runtime errors. HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-3011 CustomTags: - C# @@ -2780,7 +2779,7 @@ Diagnostics: Metadata: Category: Blocker Code Smell Title: '"is" should not be used with "this"' - Description: There’s no valid reason to test this with is. The only plausible explanation for such a test is that you’re executing code in a parent class conditionally based on the kind of child class this is. But code that’s specific to a child class should be in that child class, not in the parent. + Description: 'One of the possible ways of performing type-testing is via the is operator: food is Pizza.' HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-3060 CustomTags: - C# @@ -2795,7 +2794,7 @@ Diagnostics: Metadata: Category: Major Bug Title: '"async" methods should not return "void"' - Description: An async method with a void return type is a "fire and forget" method best reserved for event handlers because there’s no way to wait for the method’s execution to complete and respond accordingly. There’s also no way to catch exceptions thrown from the method. + Description: An async method with a void return type does not follow the task asynchronous programming (TAP) model since the return type should be Task or Task HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-3168 CustomTags: - C# @@ -2873,7 +2872,7 @@ Diagnostics: Metadata: Category: Critical Code Smell Title: '"Explicit" conversions of "foreach" loops should not be used' - Description: The foreach statement was introduced in the C# language prior to generics to make it easier to work with the non-generic collections available at that time such as ArrayList. The foreach statements allows you to downcast elements of a collection of Objects to any other type. The problem is that to achieve the cast, the foreach statements silently performs explicit type conversion, which at runtime can result in an InvalidCastException. + Description: The foreach statement was introduced in the C# language prior to generics to make it easier to work with the non-generic collections available at that time such as ArrayList. The foreach statements allow you to downcast elements of a collection of Objects to any other type. HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-3217 CustomTags: - C# @@ -2889,7 +2888,7 @@ Diagnostics: Metadata: Category: Critical Code Smell Title: Inner class members should not shadow outer class "static" or type members - Description: It’s possible to name the members of an inner class the same as the static members of its enclosing class - possible, but a bad idea. That’s because maintainers may be confused about which members are being used where. Instead the inner class' members should be renamed and all the references updated. + Description: Naming the members of an inner class the same as the static members of its enclosing class is possible but generally considered a bad practice. That’s because maintainers may be confused about which members are being used in a given context. Instead the inner class member should be given distinct and descriptive name, and all references to it should be updated accordingly. HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-3218 CustomTags: - C# @@ -2966,8 +2965,8 @@ Diagnostics: S3237: Metadata: Category: Blocker Code Smell - Title: '"value" parameters should be used' - Description: In property and indexer set methods, and in event add and remove methods, the implicit value parameter holds the value the accessor was called with. Not using the value means that the accessor ignores the caller’s intent which could cause unexpected results at runtime. + Title: '"value" contextual keyword should be used' + Description: When you need to get external input for set and init methods defined for properties and indexers or for remove and add methods for events, you should always get this input throught the value contextual keyword. HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-3237 CustomTags: - C# @@ -2999,7 +2998,7 @@ Diagnostics: Metadata: Category: Minor Code Smell Title: Methods should not return values that are never used - Description: Private methods are clearly intended for use only within their own scope. When such methods return values that are never used by any of their callers, then clearly there is no need to actually make the return, and it should be removed in the interests of efficiency and clarity. + Description: Private methods are intended for use only within their scope. If these methods return values that are not utilized by any calling functions, it indicates that the return operation is unnecessary. Removing such returns can enhance both efficiency and code clarity. HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-3241 CustomTags: - C# @@ -3031,7 +3030,7 @@ Diagnostics: Metadata: Category: Major Bug Title: Anonymous delegates should not be used to unsubscribe from Events - Description: 'It is possible to subscribe to events with anonymous delegates, but having done so, it is impossible to unsubscribe from them. That’s because the process of subscribing adds the delegate to a list. The process of unsubscribing essentially says: remove this item from the subscription list. But because an anonymous delegate was used in both cases, the unsubscribe attempt tries to remove a different item from the list than was added. The result: NOOP.' + Description: When working with anonymous functions, it is important to keep in mind that each time you create one, it is a completely new instance. HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-3244 CustomTags: - C# @@ -3078,7 +3077,7 @@ Diagnostics: Metadata: Category: Major Bug Title: Classes directly extending "object" should not call "base" in "GetHashCode" or "Equals" - Description: Making a base call in an overriding method is generally a good idea, but not in GetHashCode and Equals for classes that directly extend object because those methods are based on the object reference. Meaning that no two objects that use those base methods will ever be equal or have the same hash. + Description: Making a base call when overriding a method is generally a good idea, but not in the case of GetHashCode and Equals for classes that directly extend Object. These methods are based on the object’s reference, meaning that no two objects that use those base methods can be equal or have the same hash. HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-3249 CustomTags: - C# @@ -3163,7 +3162,8 @@ Diagnostics: Tier: 3 Attributes: general: - Severity: Warning + Severity: None + Comment: Too many false positives S3261: Metadata: Category: Minor Code Smell @@ -3232,7 +3232,7 @@ Diagnostics: Metadata: Category: Critical Code Smell Title: Non-flags enums should not be used in bitwise operations - Description: enums are usually used to identify distinct elements in a set of values. However enums can be treated as bit fields and bitwise operations can be used on them to combine the values. This is a good way of specifying multiple elements of set with a single value. When enums are used this way, it is a best practice to mark the enum with the FlagsAttribute. + Description: Enumerations are commonly used to identify distinct elements from a set of values. HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-3265 CustomTags: - C# @@ -3248,7 +3248,7 @@ Diagnostics: Metadata: Category: Critical Vulnerability Title: Cipher Block Chaining IVs should be unpredictable - Description: When encrypting data with the Cipher Block Chaining (CBC) mode an Initialization Vector (IV) is used to randomize the encryption, ie under a given key the same plaintext doesn’t always produce the same ciphertext. The IV doesn’t need to be secret but should be unpredictable to avoid "Chosen-Plaintext Attack". + Description: This vulnerability exposes encrypted data to a number of attacks whose goal is to recover the plaintext. HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-3329 CustomTags: - C# @@ -3279,7 +3279,7 @@ Diagnostics: Metadata: Category: Major Bug Title: Caller information parameters should come at the end of the parameter list - Description: 'Caller information attributes (CallerFilePathAttribute, CallerLineNumberAttribute, CallerMemberNameAttribute, and CallerArgumentExpressionAttribute) provide a way to get information about the caller of a method through optional parameters. But they only work right if their values aren’t provided explicitly. So if you define a method with caller info attributes in the middle of the parameter list, you put your callers in a bad position: they are forced to use named arguments if they want to use the method properly.' + Description: Caller information attributes provide a way to get information about the caller of a method through optional parameters. But they only work right if their values aren’t provided explicitly. So if you define a method with caller info attributes in the middle of the parameter list, the caller is forced to use named arguments if they want to use the method properly. HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-3343 CustomTags: - C# @@ -3323,7 +3323,7 @@ Diagnostics: Metadata: Category: Major Code Smell Title: Ternary operators should not be nested - Description: Just because you can do something, doesn’t mean you should, and that’s the case with nested ternary operations. Nesting ternary operators results in the kind of code that may seem clear as day when you write it, but six months later will leave maintainers (or worse - future you) scratching their heads and cursing. + Description: Nested ternaries are hard to read and can make the order of operations complex to understand. HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-3358 CustomTags: - C# @@ -3415,8 +3415,8 @@ Diagnostics: S3427: Metadata: Category: Blocker Code Smell - Title: 'Method overloads with default parameter values should not overlap ' - Description: The rules for method resolution are complex and perhaps not properly understood by all coders. Having overloads with optional parameter values makes the matter even harder to understand. + Title: Method overloads with default parameter values should not overlap + Description: The rules for method resolution can be complex and may not be fully understood by all developers. The situation becomes even more challenging when dealing with method overloads that have optional parameter values. HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-3427 CustomTags: - C# @@ -3446,7 +3446,7 @@ Diagnostics: Metadata: Category: Blocker Code Smell Title: Test method signatures should be correct - Description: A method is detected as test method if marked with one of the following attributes [TestMethod] or [DataTestMethod] (for mstest), [Fact] or [Theory] (for xunit) or [Test], [TestCase], [TestCaseSource] or [Theory] (for nunit). However, whether or not they have a test attribute, non-public methods are not recognized as tests, and therefore not executed. Neither are async void methods, or methods with generics anywhere in their signatures. + Description: 'A method is identified as a test method if it is marked with one of the following attributes:' HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-3433 CustomTags: - C# @@ -3492,7 +3492,7 @@ Diagnostics: Metadata: Category: Major Code Smell Title: '"abstract" classes should not have "public" constructors' - Description: Since abstract classes can’t be instantiated, there’s no point in their having public or internal constructors. If there is basic initialization logic that should run when an extending class instance is created, you can by all means put it in a constructor, but make that constructor private, private protected or protected. + Description: The abstract modifier in a class declaration is used to indicate that a class is intended only to be a base class of other classes, not instantiated on its own. HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-3442 CustomTags: - C# @@ -3508,7 +3508,7 @@ Diagnostics: Metadata: Category: Blocker Code Smell Title: Type should not be examined on "System.Type" instances - Description: If you call GetType() on a Type variable, the return value will always be typeof(System.Type). So there’s no real point in making that call. The same applies to passing a type argument to IsInstanceOfType. In both cases the results are entirely predictable. + Description: Calling GetType on a Type variable will always return the System.Type representation, which is equivalent to typeof(System.Type). This also applies to passing a Type argument to IsInstanceOfType which always returns false. HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-3443 CustomTags: - C# @@ -3539,7 +3539,7 @@ Diagnostics: Metadata: Category: Major Code Smell Title: Exceptions should not be explicitly rethrown - Description: When rethrowing an exception, you should do it by simply calling throw; and not throw exc;, because the stack trace is reset with the second syntax, making debugging a lot harder. + Description: 'In C#, the throw statement can be used in two different ways:' HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-3445 CustomTags: - C# @@ -3554,7 +3554,7 @@ Diagnostics: Metadata: Category: Critical Code Smell Title: '"[Optional]" should not be used on "ref" or "out" parameters' - Description: The use of ref or out in combination with [Optional] is both confusing and contradictory. [Optional] indicates that the parameter doesn’t have to be provided, while out and ref mean that the parameter will be used to return data to the caller (ref additionally indicates that the parameter may also be used to pass data into the method). + Description: The use of ref or out in combination with Optional attribute is both confusing and contradictory. [Optional] indicates that the parameter doesn’t have to be provided, while out and ref mean that the parameter will be used to return data to the caller (ref additionally indicates that the parameter may also be used to pass data into the method). HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-3447 CustomTags: - C# @@ -3570,7 +3570,7 @@ Diagnostics: Metadata: Category: Critical Bug Title: Right operands of shift operators should be integers - Description: Numbers can be shifted with the << and >> operators, but the right operand of the operation needs to be an int or a type that has an implicit conversion to int. However, with dynamic, the compiler’s type checking is turned off, so you can pass anything to a shift operator and have it compile. And if the argument can’t be converted to int at runtime, then a RuntimeBinderException will be raised. + Description: Numbers can be shifted with the << and >> operators, but the right operand of the operation needs to be an int or a type that has an implicit conversion to int. However, when the left operand is dynamic, the compiler’s type checking is turned off, so you can pass anything to the right of a shift operator and have it compile. And if the argument can’t be implicitly converted to int at runtime, then a RuntimeBinderException will be raised. HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-3449 CustomTags: - C# @@ -3602,7 +3602,7 @@ Diagnostics: Metadata: Category: Critical Code Smell Title: '"[DefaultValue]" should not be used when "[DefaultParameterValue]" is meant' - Description: The use of [DefaultValue] with [Optional] has no more effect than [Optional] alone. That’s because [DefaultValue] doesn’t actually do anything; it merely indicates the intent for the value. More than likely, [DefaultValue] was used in confusion instead of [DefaultParameterValue]. + Description: DefaultValue does not make the compiler set the default value, as its name may suggest. What you probably wanted to use is DefaultParameterValue. HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-3451 CustomTags: - C# @@ -3618,7 +3618,7 @@ Diagnostics: Metadata: Category: Major Bug Title: Classes should not have only "private" constructors - Description: A class with only private constructors can’t be instantiated, thus, it seems to be pointless code. + Description: When a class has only a private constructor, it can’t be instantiated except within the class itself. Such classes can be considered dead code and should be fixed HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-3453 CustomTags: - C# @@ -3634,7 +3634,7 @@ Diagnostics: Metadata: Category: Minor Bug Title: '"string.ToCharArray()" and "ReadOnlySpan.ToArray()" should not be called redundantly' - Description: ToCharArray can be omitted when the operation on the array could have been done directly on the string, such as when iterating over the characters in a string, and when accessing a character in a string via an array index. In those cases, explicit ToCharArray calls should be omitted. + Description: The string type offers an indexer property that allows you to treat it as a char array. Therefore, if you just need to access a specific character or iterate over all of them, the ToCharArray call should be omitted. For these cases, not omitting makes the code harder to read and less efficient as ToCharArray copies the characters from the string object into a new Unicode character array. HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-3456 CustomTags: - C# @@ -3698,7 +3698,7 @@ Diagnostics: Metadata: Category: Blocker Bug Title: Type inheritance should not be recursive - Description: Recursion is acceptable in methods, where you can break out of it. But with class types, you end up with code that will compile but not run if you try to instantiate the class. + Description: Recursion is a technique used to define a problem in terms of the problem itself, usually in terms of a simpler version of the problem itself. HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-3464 CustomTags: - C# @@ -3713,7 +3713,7 @@ Diagnostics: Metadata: Category: Major Bug Title: Optional parameters should be passed to "base" calls - Description: Generally, writing the least code that will readably do the job is a good thing, so omitting default parameter values seems to make sense. Unfortunately, when you omit them from the base call in an override, you’re not actually getting the job done thoroughly, because you’re ignoring the value the caller passed in. The result will likely not be what the caller expected. + Description: When optional parameter values are not passed to base method calls, the value passed in by the caller is ignored. This can cause the function to behave differently than expected, leading to errors and making the code difficult to debug. HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-3466 CustomTags: - C# @@ -3760,7 +3760,7 @@ Diagnostics: Metadata: Category: Major Bug Title: One-way "OperationContract" methods should have "void" return type - Description: When declaring a Windows Communication Foundation (WCF) OperationContract method one-way, that service method won’t return any result, not even an underlying empty confirmation message. These are fire-and-forget methods that are useful in event-like communication. Specifying a return type therefore does not make sense. + Description: When declaring a Windows Communication Foundation (WCF) OperationContract method as one-way, that service method won’t return any result, not even an underlying empty confirmation message. These are fire-and-forget methods that are useful in event-like communication. Therefore, specifying a return type has no effect and can confuse readers. HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-3598 CustomTags: - C# @@ -3792,7 +3792,7 @@ Diagnostics: Metadata: Category: Major Bug Title: 'Methods with "Pure" attribute should return a value ' - Description: Marking a method with the Pure attribute specifies that the method doesn’t make any visible changes; thus, the method should return a result, otherwise the call to the method should be equal to no-operation. So Pure on a void method is either a mistake, or the method doesn’t do any meaningful task. + Description: Marking a method with the Pure attribute indicates that the method doesn’t make any visible state changes. Therefore, a Pure method should return a result otherwise it indicates a no-operation call. HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-3603 CustomTags: - C# @@ -3824,7 +3824,7 @@ Diagnostics: Metadata: Category: Major Bug Title: Nullable type comparison should not be redundant - Description: Calling GetType() on a nullable object returns the underlying value type. Thus, comparing the returned Type object to typeof(Nullable) doesn’t make sense. The comparison either throws an exception or the result can be known at compile time. + Description: Calling GetType() on a nullable value type object returns the underlying value type. Therefore, comparing the returned Type object to typeof(Nullable) will either throw an NullReferenceException or the result will always be true or false and can be known at compile time. HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-3610 CustomTags: - C# @@ -3856,7 +3856,7 @@ Diagnostics: Metadata: Category: Major Bug Title: Empty nullable value should not be accessed - Description: Nullable value types can hold either a value or null. The value held in the nullable type can be accessed with the Value property, but .Value throws an InvalidOperationException when the value is null. To avoid the exception, a nullable type should always be tested before .Value is accessed. + Description: Nullable value types can hold either a value or null. HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-3655 CustomTags: - C# @@ -3901,7 +3901,7 @@ Diagnostics: Metadata: Category: Critical Code Smell Title: Cognitive Complexity of methods should not be too high - Description: Cognitive Complexity is a measure of how hard the control flow of a method is to understand. Methods with high Cognitive Complexity will be difficult to maintain. + Description: Cognitive Complexity Complexity is a measure of how hard the control flow of a method is to understand. HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-3776 CustomTags: - C# @@ -3918,7 +3918,7 @@ Diagnostics: Metadata: Category: Blocker Bug Title: '"SafeHandle.DangerousGetHandle" should not be called' - Description: Not surprisingly, the SafeHandle.DangerousGetHandle method is dangerous. That’s because it may not return a valid handle. Using it can lead to leaks and vulnerabilities. While it is possible to use the method successfully, it’s extremely difficult to do correctly, so the method should simply be avoided altogether. + Description: The SafeHandle.DangerousGetHandle method poses significant risks and should be used carefully. This method carries the inherent danger of potentially returning an invalid handle, which can result in resource leaks and security vulnerabilities. Although it is technically possible to utilize this method without encountering issues, doing so correctly requires a high level of expertise. Therefore, it is recommended to avoid using this method altogether. HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-3869 CustomTags: - C# @@ -3982,7 +3982,7 @@ Diagnostics: Metadata: Category: Blocker Code Smell Title: '"operator==" should not be overloaded on reference types' - Description: The use of == to compare two objects is expected to do a reference comparison. That is, it is expected to return true if and only if they are the same object instance. Overloading the operator to do anything else will inevitably lead to the introduction of bugs by callers. On the other hand, overloading it to do exactly that is pointless; that’s what == does by default. + Description: The use of == to compare two objects is expected to do a reference comparison. That is, it is expected to return true if and only if they are the same object instance. Overloading the operator to do anything else will inevitably lead to the introduction of bugs by callers. HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-3875 CustomTags: - C# @@ -4013,7 +4013,7 @@ Diagnostics: Metadata: Category: Blocker Code Smell Title: Exceptions should not be thrown from unexpected methods - Description: It is expected that some methods should be called with caution, but others, such as ToString, are expected to "just work". Throwing an exception from such a method is likely to break callers' code unexpectedly. + Description: The rule is reporting when an exception is thrown from certain methods and constructors. These methods are expected to behave in a specific way and throwing an exception from them can lead to unexpected behavior and break the calling code. HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-3877 CustomTags: - C# @@ -4062,13 +4062,12 @@ Diagnostics: Metadata: Category: Blocker Vulnerability Title: '"CoSetProxyBlanket" and "CoInitializeSecurity" should not be used' - Description: CoSetProxyBlanket and CoInitializeSecurity both work to set the permissions context in which the process invoked immediately after is executed. Calling them from within that process is useless because it’s too late at that point; the permissions context has already been set. + Description: This rule is deprecated, and will eventually be removed. HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-3884 CustomTags: - C# - MainSourceScope - TestSourceScope - - SonarWay DefaultSeverity: Warning Tier: 1 Attributes: @@ -4094,7 +4093,7 @@ Diagnostics: Metadata: Category: Minor Bug Title: Mutable, non-private fields should not be "readonly" - Description: Using the readonly keyword on a field means that it can’t be changed after initialization. However, when applied to collections or arrays, that’s only partly true. readonly enforces that another instance can’t be assigned to the field, but it cannot keep the contents from being updated. That means that in practice, the field value really can be changed, and the use of readonly on such a field is misleading, and you’re likely to not be getting the behavior you expect. + Description: Using the readonly keyword on a field means it can’t be changed after initialization. However, that’s only partly true when applied to collections or arrays. The readonly keyword enforces that another instance can’t be assigned to the field, but it cannot keep the contents from being updated. In practice, the field value can be changed, and the use of readonly on such a field is misleading, and you’re likely not getting the behavior you expect. HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-3887 CustomTags: - C# @@ -4109,8 +4108,8 @@ Diagnostics: S3889: Metadata: Category: Blocker Bug - Title: Neither "Thread.Resume" nor "Thread.Suspend" should be used - Description: Thread.Suspend and Thread.Resume can give unpredictable results, and both methods have been deprecated. Indeed, if Thread.Suspend is not used very carefully, a thread can be suspended while holding a lock, thus leading to a deadlock. Other safer synchronization mechanisms should be used, such as Monitor, Mutex, and Semaphore. + Title: '"Thread.Resume" and "Thread.Suspend" should not be used' + Description: Thread.Suspend and Thread.Resume can give unpredictable results, and both methods have been deprecated. Indeed, if Thread.Suspend is not used very carefully, a thread can be suspended while holding a lock, thus leading to a deadlock. HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-3889 CustomTags: - C# @@ -4157,7 +4156,7 @@ Diagnostics: Metadata: Category: Major Code Smell Title: Arguments of public methods should be validated against null - Description: A publicly accessible method can be called from anywhere, which means you should validate parameters to be within the expected constraints. In general, checking against null is recommended defensive programming. + Description: Methods declared as public, protected, or protected internal can be accessed from other assemblies, which means you should validate parameters to be within the expected constraints. In general, checking against null is recommended in defensive programming. HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-3900 CustomTags: - C# @@ -4205,7 +4204,7 @@ Diagnostics: Metadata: Category: Critical Code Smell Title: Assemblies should have version information - Description: If no AssemblyVersionAttribute is provided, the same default version will be used for every build. Since the version number is used by The .NET Framework to uniquely identify an assembly this can lead to broken dependencies. + Description: The AssemblyVersion attribute is used to specify the version number of an assembly. An assembly is a compiled unit of code, which can be marked with a version number by applying the attribute to an assembly’s source code file. HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-3904 CustomTags: - C# @@ -4266,7 +4265,7 @@ Diagnostics: Metadata: Category: Major Bug Title: All branches in a conditional structure should not have exactly the same implementation - Description: Having all branches in a switch or if chain with the same implementation is an error. Either a copy-paste error was made and something different should be executed, or there shouldn’t be a switch/if chain at all. + Description: Having all branches of a switch or if chain with the same implementation indicates a problem. HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-3923 CustomTags: - C# @@ -4282,7 +4281,7 @@ Diagnostics: Metadata: Category: Major Code Smell Title: '"ISerializable" should be implemented correctly' - Description: The ISerializable interface is the mechanism to control the type serialization process. If not implemented correctly this could result in an invalid serialization and hard to detect bugs. + Description: The ISerializable interface is the mechanism to control the type serialization process. If not implemented correctly this could result in an invalid serialization and hard-to-detect bugs. HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-3925 CustomTags: - C# @@ -4314,7 +4313,7 @@ Diagnostics: Metadata: Category: Major Bug Title: Serialization event handlers should be implemented correctly - Description: Serialization event handlers that don’t have the correct signature will simply not be called, thus bypassing any attempts to augment the automated de/serialization. + Description: Serialization event handlers that don’t have the correct signature will not be called, bypassing augmentations to the automated de/serialization. HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-3927 CustomTags: - C# @@ -4369,8 +4368,8 @@ Diagnostics: - C# - MainSourceScope - TestSourceScope - - Unnecessary - DefaultSeverity: Suggestion + - SonarWay + DefaultSeverity: Warning Tier: 1 Attributes: general: @@ -4427,7 +4426,7 @@ Diagnostics: Metadata: Category: Major Code Smell Title: Objects should not be disposed more than once - Description: Disposing an object twice, either with the using keyword or by calling Dispose directly, in the same method is at best confusing and at worst error-prone. The next developer might see only one of the Dispose/using and try to use an already-disposed object. + Description: Disposing an object twice in the same method, either with the using keyword or by calling Dispose directly, is confusing and error-prone. For example, another developer might try to use an already-disposed object, or there can be runtime errors for specific paths in the code. HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-3966 CustomTags: - C# @@ -4474,7 +4473,7 @@ Diagnostics: Metadata: Category: Critical Code Smell Title: Conditionals should start on new lines - Description: Code is clearest when each statement has its own line. Nonetheless, it is a common pattern to combine on the same line an if and its resulting then statement. However, when an if is placed on the same line as the closing } from a preceding then, else or else if part, it is either an error - else is missing - or the invitation to a future error as maintainers fail to understand that the two statements are unconnected. + Description: Placing an if statement on the same line as the closing } from a preceding if, else, or else if block can lead to confusion and potential errors. It may indicate a missing else statement or create ambiguity for maintainers who might fail to understand that the two statements are unconnected. HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-3972 CustomTags: - C# @@ -4490,7 +4489,7 @@ Diagnostics: Metadata: Category: Critical Code Smell Title: A conditionally executed single line should be denoted by indentation - Description: In the absence of enclosing curly braces, the line immediately after a conditional is the one that is conditionally executed. By both convention and good practice, such lines are indented. In the absence of both curly braces and indentation the intent of the original programmer is entirely unclear and perhaps not actually what is executed. Additionally, such code is highly likely to be confusing to maintainers. + Description: When the line immediately after conditional statements has neither curly braces nor indentation, the intent of the code is unclear and perhaps not executed as expected. Additionally, such code is confusing to maintainers. HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-3973 CustomTags: - C# @@ -4506,7 +4505,7 @@ Diagnostics: Metadata: Category: Major Bug Title: Collection sizes and array length comparisons should make sense - Description: The size of a collection and the length of an array are always greater than or equal to zero. So testing that a size or length is greater than or equal to zero doesn’t make sense, since the result is always true. Similarly testing that it is less than zero will always return false. Perhaps the intent was to check the non-emptiness of the collection or array instead. + Description: The size of a collection and the length of an array are always greater than or equal to zero. Testing it doesn’t make sense, since the result is always true. HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-3981 CustomTags: - C# @@ -4522,7 +4521,7 @@ Diagnostics: Metadata: Category: Major Bug Title: Exceptions should not be created without being thrown - Description: Creating a new Exception without actually throwing it is useless and is probably due to a mistake. + Description: Creating a new Exception without actually throwing does not achieve the intended purpose. HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-3984 CustomTags: - C# @@ -4646,7 +4645,7 @@ Diagnostics: Metadata: Category: Critical Code Smell Title: Threads should not lock on objects with weak identity - Description: 'A thread acquiring a lock on an object that can be accessed across application domain boundaries runs the risk of being blocked by another thread in a different application domain. Objects that can be accessed across application domain boundaries are said to have weak identity. Types with weak identity are:' + Description: Objects that can be accessed across application domain boundaries are said to have weak identity. This means that these objects can be considered shared resources outside of the domain, which can be lead to them being accessed or modified by multiple threads or concurrent parts of a program, outside of the domain. HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-3998 CustomTags: - C# @@ -4724,7 +4723,7 @@ Diagnostics: Metadata: Category: Critical Code Smell Title: Inherited member visibility should not be decreased - Description: Changing an inherited member to private will not prevent access to the base class implementation. + Description: Decreasing the accessibility level of an inherited method that is not overridable to private will shadow the name of the base method and can lead to confusion. HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-4015 CustomTags: - C# @@ -4785,7 +4784,7 @@ Diagnostics: Metadata: Category: Critical Code Smell Title: Base class methods should not be hidden - Description: When a method in a derived class has the same name as a method in the base class but with a signature that only differs by types that are weakly derived (e.g. object vs string), the result is that the base method becomes hidden. + Description: 'When a method in a derived class has:' HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-4019 CustomTags: - C# @@ -4816,7 +4815,7 @@ Diagnostics: Metadata: Category: Minor Code Smell Title: Interfaces should not be empty - Description: Empty interfaces are usually used as a marker or a way to identify groups of types. The preferred way to achieve this is to use custom attributes. + Description: Empty interfaces should be avoided as they do not provide any functional requirements for implementing classes. HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-4023 CustomTags: - C# @@ -4825,7 +4824,9 @@ Diagnostics: Tier: 3 Attributes: general: - Severity: Warning + Severity: None + api: + Severity: Suggestion S4025: Metadata: Category: Critical Code Smell @@ -5180,7 +5181,7 @@ Diagnostics: Metadata: Category: Major Bug Title: Collection elements should not be replaced unconditionally - Description: It is highly suspicious when a value is saved for a key or index and then unconditionally overwritten. Such replacements are likely errors. + Description: Storing a value inside a collection at a given key or index and then unconditionally overwriting it without reading the initial value is a case of a "dead store". HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-4143 CustomTags: - C# @@ -5196,7 +5197,7 @@ Diagnostics: Metadata: Category: Major Code Smell Title: Methods should not have identical implementations - Description: When two methods have the same implementation, either it was a mistake - something else was intended - or the duplication was intentional, but may be confusing to maintainers. In the latter case, one implementation should invoke the other. + Description: Two methods having the same implementation are suspicious. It might be that something else was intended. Or the duplication is intentional, which becomes a maintenance burden. HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-4144 CustomTags: - C# @@ -5212,7 +5213,7 @@ Diagnostics: Metadata: Category: Minor Bug Title: Empty collections should not be accessed or iterated - Description: When a collection is empty it makes no sense to access or iterate it. Doing so anyway is surely an error; either population was accidentally omitted or the developer doesn’t understand the situation. + Description: When a collection is empty, iterating it has no effect. Doing so anyway is likely a bug; either population was accidentally omitted, or the iteration needs to be revised. HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-4158 CustomTags: - C# @@ -5223,12 +5224,13 @@ Diagnostics: Tier: 2 Attributes: general: - Severity: Warning + Severity: None + Comment: Too many false positives S4159: Metadata: Category: Blocker Bug Title: Classes should implement their "ExportAttribute" interfaces - Description: In the Attributed Programming Model, the ExportAttribute declares that a part "exports", or provides to the composition container, an object that fulfills a particular contract. During composition, parts with imports that have matching contracts will have those dependencies filled by the exported object. + Description: The Attributed Programming Model, also known as Attribute-oriented programming (@OP), is a programming model used to embed attributes within codes. HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-4159 CustomTags: - C# @@ -5320,7 +5322,7 @@ Diagnostics: Metadata: Category: Major Code Smell Title: '"P/Invoke" methods should not be visible' - Description: Methods marked with the System.Runtime.InteropServices.DllImportAttribute attribute use Platform Invocation Services to access unmanaged code and should not be exposed. Keeping them private or internal makes sure that their access is controlled and properly managed. + Description: This rule is deprecated; use {rule:csharpsquid:S4200} instead. HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-4214 CustomTags: - C# @@ -5350,7 +5352,7 @@ Diagnostics: Metadata: Category: Minor Code Smell Title: Extension methods should not extend "object" - Description: Creating an extension method that extends object is not recommended because it makes the method available on every type. Extensions should be applied at the most specialized level possible, and that is very unlikely to be object. + Description: Creating an extension method that extends object is not recommended because it makes the method available on every type. Extensions should be applied at the most specialized level possible, and that is very unlikely to be object. HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-4225 CustomTags: - C# @@ -5380,7 +5382,7 @@ Diagnostics: Metadata: Category: Major Bug Title: '"ConstructorArgument" parameters should exist in constructors' - Description: When creating a custom Markup Extension that accepts parameters in WPF, the ConstructorArgument markup must be used to identify the discrete properties that match these parameters. However since this is done via a string, the compiler will not notice if there are typos. + Description: When creating a custom Markup Extension that accepts parameters in WPF, the ConstructorArgument markup must be used to identify the discrete properties that match these parameters. However since this is done via a string, the compiler won’t give you any warning in case there are typos. HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-4260 CustomTags: - C# @@ -5411,7 +5413,7 @@ Diagnostics: Metadata: Category: Critical Bug Title: Getters and setters should access the expected fields - Description: Properties provide a way to enforce encapsulation by providing public, protected or internal methods that give controlled access to private fields. However in classes with multiple fields it is not unusual that cut and paste is used to quickly create the needed properties, which can result in the wrong field being accessed by a getter or setter. + Description: Properties provide a way to enforce encapsulation by providing accessors that give controlled access to private fields. However, in classes with multiple fields, it is not unusual that copy-and-paste is used to quickly create the needed properties, which can result in the wrong field being accessed by a getter or setter. HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-4275 CustomTags: - C# @@ -5442,7 +5444,7 @@ Diagnostics: Metadata: Category: Critical Vulnerability Title: Weak SSL/TLS protocols should not be used - Description: Older versions of SSL/TLS protocol like "SSLv3" have been proven to be insecure. + Description: This vulnerability exposes encrypted data to a number of attacks whose goal is to recover the plaintext. HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-4423 CustomTags: - C# @@ -5457,7 +5459,7 @@ Diagnostics: Metadata: Category: Critical Vulnerability Title: Cryptographic keys should be robust - Description: Most of cryptographic systems require a sufficient key size to be robust against brute-force attacks. + Description: This vulnerability exposes encrypted data to attacks whose goal is to recover the plaintext. HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-4426 CustomTags: - C# @@ -5472,7 +5474,7 @@ Diagnostics: Metadata: Category: Major Bug Title: '"PartCreationPolicyAttribute" should be used with "ExportAttribute"' - Description: The PartCreationPolicyAttribute attribute, which is part of the Managed Extensibility Framework (MEF), is used to specify how the exported object will be created. Therefore it doesn’t make sense not to export this a class with this attribute using the ExportAttribute attribute. + Description: To customize the default behavior for an export in the Managed Extensibility Framework (MEF), applying the PartCreationPolicyAttribute is necessary. For the PartCreationPolicyAttribute to be meaningful in the context of an export, it is required to also annotate the class with the ExportAttribute. HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-4428 CustomTags: - C# @@ -5501,7 +5503,7 @@ Diagnostics: Metadata: Category: Critical Vulnerability Title: LDAP connections should be authenticated - Description: An LDAP client authenticates to an LDAP server with a "bind request" which provides, among other, a simple authentication method. + Description: 'Lightweight Directory Access Protocol (LDAP) servers provide two main authentication methods: the SASL and Simple ones. The Simple Authentication method also breaks down into three different mechanisms:' HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-4433 CustomTags: - C# @@ -5562,15 +5564,14 @@ Diagnostics: Metadata: Category: Critical Code Smell Title: Unread "private" fields should be removed - Description: Private fields only used to store values without reading them later is a case of dead store. So changing the value of such field is useless and most probably indicates a serious error in the code. + Description: Private fields which are written but never read are a case of "dead store". Changing the value of such a field is useless and most probably indicates an error in the code. HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-4487 CustomTags: - C# - MainSourceScope - TestSourceScope - SonarWay - - Unnecessary - DefaultSeverity: Suggestion + DefaultSeverity: Warning Tier: 1 Attributes: general: @@ -5580,7 +5581,7 @@ Diagnostics: Metadata: Category: Minor Security Hotspot Title: Delivering code in production with debug features activated is security-sensitive - Description: 'Delivering code in production with debug features activated is security-sensitive. It has led in the past to the following vulnerabilities:' + Description: Development tools and frameworks usually have options to make debugging easier for developers. Although these features are useful during development, they should never be enabled for applications deployed in production. Debug instructions or error messages can leak detailed information about the system, like the application’s path or file names. HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-4507 CustomTags: - C# @@ -5595,7 +5596,7 @@ Diagnostics: Metadata: Category: Critical Code Smell Title: '"default" clauses should be first or last' - Description: 'switch can contain a default clause for various reasons: to handle unexpected values, to show that all the cases were properly considered.' + Description: The switch statement is a conditional statement that executes a sequence of instructions based on patterns matching the provided value. HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-4524 CustomTags: - C# @@ -5641,7 +5642,7 @@ Diagnostics: Metadata: Category: Critical Bug Title: Calls to delegate's method "BeginInvoke" should be paired with calls to "EndInvoke" - Description: Calling the BeginInvoke method of a delegate will allocate some resources that are only freed-up when EndInvoke is called. This is why you should always pair BeginInvoke with an EndInvoke to complete your asynchronous call. + Description: When calling the BeginInvoke method of a delegate, resources are allocated that are only freed up when EndInvoke is called. Failing to pair BeginInvoke with EndInvoke can lead to resource leaks and incomplete asynchronous calls. HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-4583 CustomTags: - C# @@ -5657,7 +5658,7 @@ Diagnostics: Metadata: Category: Critical Bug Title: Non-async "Task/Task" methods should not return null - Description: Returning null from a non-async Task/Task method will cause a NullReferenceException at runtime. This problem can be avoided by returning Task.FromResult(null) instead. + Description: Returning null from a non-async Task/Task method will cause a NullReferenceException at runtime if the method is awaited. This problem can be avoided by returning Task.CompletedTask or Task.FromResult(null) respectively. HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-4586 CustomTags: - C# @@ -5672,8 +5673,8 @@ Diagnostics: S4635: Metadata: Category: Critical Code Smell - Title: String offset-based methods should be preferred for finding substrings from offsets - Description: 'Looking for a given substring starting from a specified offset can be achieved by such code: str.Substring(startIndex).IndexOf(char1). This works well, but it creates a new string for each call to the Substring method. When this is done in a loop, a lot of strings are created for nothing, which can lead to performance problems if str is large.' + Title: Start index should be used instead of calling Substring + Description: 'It is important to be careful when searching for characters within a substring. Let’s consider the following example:' HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-4635 CustomTags: - C# @@ -5789,7 +5790,7 @@ Diagnostics: Metadata: Category: Critical Vulnerability Title: Server certificates should be verified during SSL/TLS connections - Description: Validation of X.509 certificates is essential to create secure SSL/TLS sessions not vulnerable to man-in-the-middle attacks. + Description: This vulnerability makes it possible that an encrypted communication is intercepted. HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-4830 CustomTags: - C# @@ -5819,7 +5820,7 @@ Diagnostics: Metadata: Category: Critical Code Smell Title: '"ValueTask" should be consumed correctly' - Description: ValueTask was introduced in .NET Core 2.0 to optimize memory allocation when functions return their results synchronously. + Description: ValueTask provides a value type that wraps a Task and the corresponding TResult. It was introduced in .NET Core 2.0 to optimize memory allocation when functions return their results synchronously. HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-5034 CustomTags: - C# @@ -5865,7 +5866,7 @@ Diagnostics: Metadata: Category: Critical Vulnerability Title: Encryption algorithms should be used with secure mode and padding scheme - Description: Encryption algorithms should use secure modes and padding schemes where appropriate to guarantee data confidentiality and integrity. + Description: This vulnerability exposes encrypted data to a number of attacks whose goal is to recover the plaintext. HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-5542 CustomTags: - C# @@ -5880,7 +5881,7 @@ Diagnostics: Metadata: Category: Critical Vulnerability Title: Cipher algorithms should be robust - Description: Strong cipher algorithms are cryptographic systems resistant to cryptanalysis, they are not vulnerable to well-known attacks like brute force attacks for example. + Description: This vulnerability makes it possible that the cleartext of the encrypted message might be recoverable without prior knowledge of the key. HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-5547 CustomTags: - C# @@ -5895,7 +5896,7 @@ Diagnostics: Metadata: Category: Critical Vulnerability Title: JWT should be signed and verified with strong cipher algorithms - Description: If a JSON Web Token (JWT) is not signed with a strong cipher algorithm (or not signed at all) an attacker can forge it and impersonate user identities. + Description: This vulnerability allows forging of JSON Web Tokens to impersonate other users. HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-5659 CustomTags: - C# @@ -5941,7 +5942,7 @@ Diagnostics: Metadata: Category: Major Vulnerability Title: Types allowed to be deserialized should be restricted - Description: During the deserialization process, the state of an object will be reconstructed from the serialized data stream which can contain dangerous operations. + Description: Deserialization is the process of converting serialized data (such as objects or data structures) back into their original form. Types allowed to be unserialized should be strictly controlled. HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-5773 CustomTags: - C# @@ -6003,7 +6004,7 @@ Diagnostics: Metadata: Category: Critical Code Smell Title: Parameter names should match base declaration and other partial definitions - Description: The name of a parameter in an externally visible. This rule raises an issue when method override does not match the name of the parameter in the base declaration of the method, or the name of the parameter in the interface declaration of the method or the name of any other partial definition. + Description: Parameters are part of the method signature and its identity. HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-927 CustomTags: - C# @@ -6141,7 +6142,7 @@ Diagnostics: Metadata: Category: Critical Vulnerability Title: Insecure temporary file creation methods should not be used - Description: 'Creating temporary files using insecure methods exposes the application to race conditions on filenames: a malicious user can try to create a file with a predictable name before the application does. A successful attack can result in other files being accessed, modified, corrupted or deleted. This risk is even higher if the application run with elevated permissions.' + Description: Temporary files are considered insecurely created when the file existence check is performed separately from the actual file creation. Such a situation can occur when creating temporary files using normal file handling functions or when using dedicated temporary file handling functions that are not atomic. HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-5445 CustomTags: - C# @@ -6156,7 +6157,7 @@ Diagnostics: Metadata: Category: Blocker Vulnerability Title: A secure password should be used when connecting to a database - Description: When relying on the password authentication mode for the database connection, a secure password should be chosen. + Description: When accessing a database, an empty password should be avoided as it introduces a weakness. HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-2115 CustomTags: - C# @@ -6231,7 +6232,7 @@ Diagnostics: Metadata: Category: Minor Code Smell Title: Non-derived "private" classes and records should be "sealed" - Description: private classes and records aren’t visible outside of their assemblies anyway, so if they’re not extended inside the assemblies, they should be made explicitly non-extensible with the addition of the sealed keyword. + Description: Classes and records with either private or file access modifiers aren’t visible outside of their assemblies or files, so if they’re not extended inside their scope, they should be made explicitly non-extensible with the addition of the sealed keyword. HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-3260 CustomTags: - C# @@ -6242,7 +6243,7 @@ Diagnostics: Attributes: general: Severity: None - Redundant: CA1852 + Redundant: R9A013 S3059: Metadata: Category: Major Code Smell @@ -6261,7 +6262,7 @@ Diagnostics: Metadata: Category: Critical Bug Title: Locks should be released on all paths - Description: If a lock is held or acquired and then released within a method, it should be released along all execution paths. + Description: To prevent potential deadlocks in an application, it is crucial to release any locks that are acquired within a method along all possible execution paths. HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-2222 CustomTags: - C# @@ -6286,12 +6287,12 @@ Diagnostics: Attributes: general: Severity: None - Redundant: EA0002 + Redundant: R9A022 S6422: Metadata: Category: Blocker Code Smell Title: Calls to "async" methods should not be blocking in Azure Functions - Description: Making blocking calls to async methods transforms code that was intended to be asynchronous into a blocking operation. Doing so inside an Azure Function can lead to thread exhaustion. + Description: Making blocking calls to async methods transforms the code into a synchronous operation. Doing so inside an Azure Function can lead to thread pool exhaustion. HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-6422 CustomTags: - C# @@ -6364,7 +6365,7 @@ Diagnostics: Metadata: Category: Blocker Code Smell Title: Interfaces for durable entities should satisfy the restrictions - Description: The recommended way to access Azure Durable Entities is Interfaces via generated proxy objects. + Description: The recommended way to access Azure Durable Entities is through generated proxy objects with the help of interfaces. HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-6424 CustomTags: - C# @@ -6387,6 +6388,612 @@ Diagnostics: - SonarWay DefaultSeverity: Warning Tier: 1 + Attributes: + general: + Severity: None + production: + Severity: Warning + S6562: + Metadata: + Category: Major Code Smell + Title: Always set the "DateTimeKind" when creating new "DateTime" instances + Description: Not knowing the Kind of the DateTime object that an application is using can lead to misunderstandings when displaying or comparing them. Explicitly setting the Kind property helps the application to stay consistent, and its maintainers understand what kind of date is being managed. To achieve this, when instantiating a new DateTime object you should always use a constructor overload that allows you to define the Kind property. + HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-6562 + CustomTags: + - C# + - MainSourceScope + - TestSourceScope + - SonarWay + DefaultSeverity: Warning + Tier: 1 + Attributes: + general: + Severity: None + Comment: Noise + S3878: + Metadata: + Category: Minor Code Smell + Title: Arrays should not be created for params parameters + Description: There’s no point in creating an array solely for the purpose of passing it to a params parameter. Simply pass the elements directly. They will be consolidated into an array automatically. + HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-3878 + CustomTags: + - C# + - MainSourceScope + - TestSourceScope + - SonarWay + DefaultSeverity: Warning + Tier: 1 + Attributes: + general: + Severity: Suggestion + S2970: + Metadata: + Category: Blocker Code Smell + Title: Assertions should be complete + Description: 'This rule addresses the issue of incomplete assertions that can occur when using certain test frameworks. Incomplete assertions can lead to tests that do not effectively verify anything. The rule enforces the use of complete assertions in specific cases, namely:' + HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-2970 + CustomTags: + - C# + - TestSourceScope + - SonarWay + DefaultSeverity: Warning + Tier: 1 + Attributes: + general: + Severity: Warning + S6561: + Metadata: + Category: Major Code Smell + Title: Avoid using "DateTime.Now" for benchmarking or timing operations + Description: The rule targets the use of DateTime.Now call followed by some arithmetic operation. + HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-6561 + CustomTags: + - C# + - MainSourceScope + - TestSourceScope + - SonarWay + DefaultSeverity: Warning + Tier: 1 + Attributes: + general: + Severity: Warning + S2166: + Metadata: + Category: Major Code Smell + Title: Classes named like "Exception" should extend "Exception" or a subclass + Description: Clear, communicative naming is important in code. It helps maintainers and API users understand the intentions for and uses of a unit of code. Using "exception" in the name of a class that does not extend Exception or one of its subclasses is a clear violation of the expectation that a class' name will indicate what it is and/or does. + HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-2166 + CustomTags: + - C# + - MainSourceScope + - SonarWay + DefaultSeverity: Warning + Tier: 1 + Attributes: + general: + Severity: Warning + S2094: + Metadata: + Category: Minor Code Smell + Title: Classes should not be empty + Description: There is no good excuse for an empty class. If it’s being used simply as a common extension point, it should be replaced with an interface. If it was stubbed in as a placeholder for future development it should be fleshed-out. In any other case, it should be eliminated. + HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-2094 + CustomTags: + - C# + - MainSourceScope + - TestSourceScope + - SonarWay + DefaultSeverity: Warning + Tier: 1 + Attributes: + general: + Severity: None + S4663: + Metadata: + Category: Minor Code Smell + Title: Comments should not be empty + Description: Empty comments like the following don’t improve readability and might indicate an oversight. + HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-4663 + CustomTags: + - C# + - MainSourceScope + - SonarWay + DefaultSeverity: Warning + Tier: 3 + Attributes: + general: + Severity: Suggestion + S3363: + Metadata: + Category: Minor Bug + Title: Date and time should not be used as a type for primary keys + Description: You should only set a property of a temporal type (like DateTime or DateTimeOffset) as the primary key of a table if the values are guaranteed to be unique. + HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-3363 + CustomTags: + - C# + - MainSourceScope + - SonarWay + DefaultSeverity: Warning + Tier: 1 + Attributes: + general: + Severity: Warning + S6585: + Metadata: + Category: Minor Code Smell + Title: Don't hardcode the format when turning dates and times to strings + Description: Hardcoding the date and time format strings can lead to formats that consumers misunderstand. Also, if the same format is meant to be used in multiple places, it is easier to make a mistake when it’s hardcoded instead of using a format provided by an IFormatProvider or using one of the standard format strings. + HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-6585 + CustomTags: + - C# + - MainSourceScope + - TestSourceScope + DefaultSeverity: Warning + Tier: 1 + Attributes: + general: + Severity: None + S4545: + Metadata: + Category: Major Code Smell + Title: '"DebuggerDisplayAttribute" strings should reference existing members' + Description: The DebuggerDisplayAttribute is used to determine how an object is displayed in the debugger window. + HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-4545 + CustomTags: + - C# + - MainSourceScope + - TestSourceScope + - SonarWay + DefaultSeverity: Warning + Tier: 1 + Attributes: + general: + Severity: Warning + S6563: + Metadata: + Category: Major Code Smell + Title: Use UTC when recording DateTime instants + Description: You should avoid recording time instants with the use of property DateTime.Now. The property DateTime.Now returns the current date and time expressed in the machine’s local time without containing any timezone-related information (for example, the offset from Coordinated Universal Time). Not having this information means that if you need to display this DateTime object or use it for computations in another machine placed in a different time zone, you won’t be able to reconstruct it in the second machine’s local time without knowing the origin’s offset. This will likely lead to confusion and potential bugs. + HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-6563 + CustomTags: + - C# + - MainSourceScope + - TestSourceScope + DefaultSeverity: Warning + Tier: 1 + Attributes: + general: + Severity: None + S6513: + Metadata: + Category: Minor Code Smell + Title: '"ExcludeFromCodeCoverage" attributes should include a justification' + Description: The ExcludeFromCodeCoverageAttribute is used to exclude portions of code from code coverage reporting. It is a bad practice to retain code that is not covered by unit tests. In .Net 5, the Justification property was added to the ExcludeFromCodeCoverageAttribute as an opportunity to document the rationale for the exclusion. This rule raises an issue when no such justification is given. + HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-6513 + CustomTags: + - C# + - MainSourceScope + DefaultSeverity: Warning + Tier: 1 + Attributes: + general: + Severity: Suggestion + S6602: + Metadata: + Category: Minor Code Smell + Title: '"Find" method should be used instead of the "FirstOrDefault" extension' + Description: Both the List.Find method and IEnumerable.FirstOrDefault method can be used to find the first element that satisfies a given condition in a collection. However, List.Find can be faster than IEnumerable.FirstOrDefault for List objects. For small collections, the performance difference may be minor, but for large collections, it can make a noticeable difference. The same applies for ImmutableList and arrays too. + HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-6602 + CustomTags: + - C# + - MainSourceScope + - TestSourceScope + - SonarWay + DefaultSeverity: Warning + Tier: 1 + Attributes: + general: + Severity: None + performance: + Severity: Warning + S6640: + Metadata: + Category: Major Security Hotspot + Title: Using unsafe code blocks is security-sensitive + Description: Using unsafe code blocks can lead to unintended security or stability risks. + HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-6640 + CustomTags: + - C# + - MainSourceScope + - TestSourceScope + - SonarWay + DefaultSeverity: Warning + Tier: 1 + Attributes: + general: + Severity: Warning + S6605: + Metadata: + Category: Minor Code Smell + Title: Collection-specific "Exists" method should be used instead of the "Any" extension + Description: Both the List.Exists method and IEnumerable.Any method can be used to find the first element that satisfies a predicate in a collection. However, List.Exists can be faster than IEnumerable.Any for List objects, as well as requires significantly less memory. For small collections, the performance difference may be negligible, but for large collections, it can be noticeable. The same applies to ImmutableList and arrays too. + HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-6605 + CustomTags: + - C# + - MainSourceScope + - TestSourceScope + - SonarWay + DefaultSeverity: Warning + Tier: 1 + Attributes: + general: + Severity: None + performance: + Severity: Warning + S6617: + Metadata: + Category: Minor Code Smell + Title: '"Contains" should be used instead of "Any" for simple equality checks' + Description: 'When testing if a collection contains a specific item by simple equality, both ICollection.Contains(T item) and IEnumerable.Any(x ⇒ x == item) can be used. However, Any searches the data structure in a linear manner using a foreach loop, whereas Contains is considerably faster in some collection types, because of the underlying implementation. More specifically:' + HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-6617 + CustomTags: + - C# + - MainSourceScope + - TestSourceScope + - SonarWay + DefaultSeverity: Warning + Tier: 1 + Attributes: + general: + Severity: None + performance: + Severity: Warning + S6613: + Metadata: + Category: Minor Code Smell + Title: '"First" and "Last" properties of "LinkedList" should be used instead of the "First()" and "Last()" extension methods' + Description: Both the Enumerable.First extension method and the LinkedList.First property can be used to find the first value in a LinkedList. However, LinkedList.First is much faster than Enumerable.First. For small collections, the performance difference may be minor, but for large collections, it can be noticeable. The same applies for the Last property as well. + HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-6613 + CustomTags: + - C# + - MainSourceScope + - TestSourceScope + - SonarWay + DefaultSeverity: Warning + Tier: 1 + Attributes: + general: + Severity: None + performance: + Severity: Warning + S2445: + Metadata: + Category: Major Bug + Title: Blocks should be synchronized on read-only fields + Description: Locking on a class field synchronizes not on the field itself, but on the object assigned to it. Thus, there are some good practices to follow to avoid problems related to thread synchronization. + HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-2445 + CustomTags: + - C# + - MainSourceScope + - TestSourceScope + - SonarWay + DefaultSeverity: Warning + Tier: 1 + Attributes: + general: + Severity: None + Comment: Noise + S6507: + Metadata: + Category: Major Bug + Title: Blocks should not be synchronized on local variables + Description: Locking on a local variable can undermine synchronization because two different threads running the same method in parallel will potentially lock on different instances of the same object, allowing them to access the synchronized block at the same time. + HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-6507 + CustomTags: + - C# + - MainSourceScope + - TestSourceScope + DefaultSeverity: Warning + Tier: 1 + Attributes: + general: + Severity: None + Comment: Too many false positives + S1133: + Metadata: + Category: Info Code Smell + Title: Deprecated code should be removed + Description: This rule is meant to be used as a way to track code which is marked as being deprecated. Deprecated code should eventually be removed. + HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-1133 + CustomTags: + - C# + - MainSourceScope + - TestSourceScope + - SonarWay + DefaultSeverity: Warning + Tier: 1 + Attributes: + general: + Severity: Suggestion + S3398: + Metadata: + Category: Minor Code Smell + Title: '"private" methods called only by inner classes should be moved to those classes' + Description: When a private static method is only invoked by a nested class, there’s no reason not to move it into that class. It will still have the same access to the outer class' static members, but the outer class will be clearer and less cluttered. + HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-3398 + CustomTags: + - C# + - MainSourceScope + - TestSourceScope + - SonarWay + DefaultSeverity: Warning + Tier: 1 + Attributes: + general: + Severity: Warning + S5856: + Metadata: + Category: Critical Bug + Title: Regular expressions should be syntactically valid + Description: Regular expressions have their own syntax that is understood by regular expression engines. Those engines will throw an exception at runtime if they are given a regular expression that does not conform to that syntax. + HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-5856 + CustomTags: + - C# + - MainSourceScope + - TestSourceScope + - SonarWay + DefaultSeverity: Warning + Tier: 1 + Attributes: + general: + Severity: Warning + S6609: + Metadata: + Category: Minor Code Smell + Title: '"Min/Max" properties of "Set" types should be used instead of the "Enumerable" extension methods' + Description: Both the Enumerable.Max extension method and the SortedSet.Max property can be used to find the maximum value in a SortedSet. However, SortedSet.Max is much faster than Enumerable.Max. For small collections, the performance difference may be minor, but for large collections, it can be noticeable. The same applies for the Min property as well. + HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-6609 + CustomTags: + - C# + - MainSourceScope + - TestSourceScope + - SonarWay + DefaultSeverity: Warning + Tier: 1 + Attributes: + general: + Severity: None + performance: + Severity: Warning + S2925: + Metadata: + Category: Major Code Smell + Title: '"Thread.Sleep" should not be used in tests' + Description: Using Thread.Sleep in a test might introduce unpredictable and inconsistent results depending on the environment. Furthermore, it will block the thread, which means the system resources are not being fully used. + HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-2925 + CustomTags: + - C# + - TestSourceScope + - SonarWay + DefaultSeverity: Warning + Tier: 1 + Attributes: + general: + Severity: None + S2198: + Metadata: + Category: Critical Code Smell + Title: Unnecessary mathematical comparisons should not be made + Description: Certain mathematical comparisons will always return the same value, and should not be performed. + HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-2198 + CustomTags: + - C# + - MainSourceScope + - SonarWay + DefaultSeverity: Warning + Tier: 1 + Attributes: + general: + Severity: Warning + S3063: + Metadata: + Category: Major Code Smell + Title: '"StringBuilder" data should be used' + Description: StringBuilder instances that never build a string clutter the code and worse are a drag on performance. Either they should be removed, or the missing ToString() call should be added. + HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-3063 + CustomTags: + - C# + - MainSourceScope + - SonarWay + DefaultSeverity: Warning + Tier: 1 + Attributes: + general: + Severity: Warning + S6610: + Metadata: + Category: Minor Code Smell + Title: '"StartsWith" and "EndsWith" overloads that take a "char" should be used instead of the ones that take a "string"' + Description: With string.StartsWith(char) and string.EndsWith(char), only the first character of the string is compared to the provided character, whereas the string versions of those methods have to do checks about the current StringComparison and CultureInfo. Thus, the char overloads are significantly faster for default comparison scenarios. + HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-6610 + CustomTags: + - C# + - MainSourceScope + - TestSourceScope + - SonarWay + DefaultSeverity: Warning + Tier: 1 + Attributes: + general: + Severity: None + performance: + Severity: Warning + S6566: + Metadata: + Category: Major Code Smell + Title: Use "DateTimeOffset" instead of "DateTime" + Description: This rule recommends using DateTimeOffset instead of DateTime for projects targeting .NET Framework 2.0 or later. + HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-6566 + CustomTags: + - C# + - MainSourceScope + - TestSourceScope + DefaultSeverity: Warning + Tier: 1 + Attributes: + general: + Severity: None + Comment: Noise + S6575: + Metadata: + Category: Major Code Smell + Title: Use "TimeZoneInfo.FindSystemTimeZoneById" without converting the timezones with "TimezoneConverter" + Description: Since .NET 6 you don’t have to use the TimeZoneConverter library to manually do the conversion between IANA and Windows timezones. The .NET 6.0 introduced new Time Zone enhancements, one being the TimeZoneInfo.FindSystemTimeZoneById(string timezone) method now accepts as input both IANA and Windows time zone IDs on any operating system with installed time zone data. TimeZoneInfo.FindSystemTimeZoneById will automatically convert its input from IANA to Windows and vice versa if the requested time zone is not found on the system. + HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-6575 + CustomTags: + - C# + - MainSourceScope + - TestSourceScope + - SonarWay + DefaultSeverity: Warning + Tier: 1 + Attributes: + general: + Severity: Warning + S6580: + Metadata: + Category: Major Code Smell + Title: Use a format provider when parsing date and time + Description: When converting a string representation of a date and time to a DateTime object or any other temporal type with one of the available system parsing methods, you should always provide an IFormatProvider parameter. + HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-6580 + CustomTags: + - C# + - MainSourceScope + - TestSourceScope + - SonarWay + DefaultSeverity: Warning + Tier: 1 + Attributes: + general: + Severity: Warning + S6608: + Metadata: + Category: Minor Code Smell + Title: Prefer indexing instead of "Enumerable" methods on types implementing "IList" + Description: Indexes in C# provide direct access to an element at a specific position within an array or collection. When compared to Enumerable methods, indexing can be more efficient for certain scenarios, such as iterating over a large collection, due to avoiding the overhead of checking the underlying collection type before accessing it. + HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-6608 + CustomTags: + - C# + - MainSourceScope + - TestSourceScope + - SonarWay + DefaultSeverity: Warning + Tier: 1 + Attributes: + general: + Severity: None + performance: + Severity: Warning + S6612: + Metadata: + Category: Minor Code Smell + Title: The lambda parameter should be used instead of capturing arguments in "ConcurrentDictionary" methods + Description: When using the ConcurrentDictionary, there are many overloads of the GetOrAdd and AddOrUpdate methods that take both a TKey argument and a lambda that expects a TKey parameter. This means that the right side of the lambda can be written using either the lambda’s parameter or the method’s argument. However, using the method’s argument leads to the lambda capturing it, and the compiler will need to generate a class and instantiate it before the call. This means memory allocations, as well as more time spend during Garbage Collection. + HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-6612 + CustomTags: + - C# + - MainSourceScope + - TestSourceScope + - SonarWay + DefaultSeverity: Warning + Tier: 1 + Attributes: + general: + Severity: None + performance: + Severity: Warning + S6618: + Metadata: + Category: Minor Code Smell + Title: '"string.Create" should be used instead of "FormattableString"' + Description: In order to produce a formatted string, both string.Create and either FormattableString.Invariant or FormattableString.CurrentCulture can be used. However, string.Create rents array buffers from ArrayPool making it more performant, as well as preventing unnecessary allocations and future stress on the Garbage Collector. + HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-6618 + CustomTags: + - C# + - MainSourceScope + - TestSourceScope + - SonarWay + DefaultSeverity: Warning + Tier: 1 + Attributes: + general: + Severity: None + performance: + Severity: Warning + S6603: + Metadata: + Category: Minor Code Smell + Title: The collection-specific "TrueForAll" method should be used instead of the "All" extension + Description: Both the List.TrueForAll method and the IEnumerable.All method can be used to check if all list elements satisfy a given condition in a collection. However, List.TrueForAll can be faster than IEnumerable.All for List objects. The performance difference may be minor for small collections, but for large collections, it can be noticeable. + HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-6603 + CustomTags: + - C# + - MainSourceScope + - TestSourceScope + - SonarWay + DefaultSeverity: Warning + Tier: 1 + Attributes: + general: + Severity: None + performance: + Severity: Warning + S6588: + Metadata: + Category: Minor Code Smell + Title: Use the "UnixEpoch" field instead of creating "DateTime" instances that point to the beginning of the Unix epoch + Description: With .NET Core the UnixEpoch field was introduced to DateTime and DateTimeOffset types. Using this field clearly states that the intention is to use the beginning of the Unix epoch. + HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-6588 + CustomTags: + - C# + - MainSourceScope + - TestSourceScope + - SonarWay + DefaultSeverity: Warning + Tier: 1 + Attributes: + general: + Severity: Warning + S6607: + Metadata: + Category: Minor Code Smell + Title: The collection should be filtered before sorting by using "Where" before "OrderBy" + Description: When working with LINQ in C#, it is recommended to pay attention to the order in which methods are chained, especially when using Where and OrderBy methods. It is advised to call the Where method before OrderBy because Where filters the elements of the sequence based on a given condition and returns a new sequence containing only the elements that satisfy that condition. Calling OrderBy before Where, may end up sorting elements that will be later discarded, which can lead to inefficiency. Conversely, calling Where before OrderBy, will first filter the sequence to include only the elements of interest, and then sort them based on the specified order. + HelpLinkUri: https://rules.sonarsource.com/csharp/RSPEC-6607 + CustomTags: + - C# + - MainSourceScope + - TestSourceScope + - SonarWay + DefaultSeverity: Warning + Tier: 1 + Attributes: + general: + Severity: None + performance: + Severity: Warning + S9999-warning: + Metadata: + Category: '' + Title: Analysis Warning generator + Description: '' + CustomTags: + - MainSourceScope + - TestSourceScope + - Utility + - NotConfigurable + DefaultSeverity: Warning + Tier: 1 Attributes: general: Severity: Warning diff --git a/eng/Diags/StyleCop.Analyzers.yml b/eng/Diags/StyleCop.Analyzers.yml index bdee2a5d5b4..062097c04cd 100644 --- a/eng/Diags/StyleCop.Analyzers.yml +++ b/eng/Diags/StyleCop.Analyzers.yml @@ -1,6 +1,6 @@ Origin: AssemblyName: StyleCop.Analyzers - Version: 1.2.0.507 + Version: 1.2.0.435 Diagnostics: SA0001: Metadata: @@ -8,8 +8,6 @@ Diagnostics: Title: XML comment analysis disabled Description: XML comment analysis can only be performed when the project is configured to parse documentation comments. To enable this functionality, update the project to produce an XML documentation file as part of the build. HelpLinkUri: https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA0001.md - CustomTags: - - CompilationEnd DefaultSeverity: Warning Tier: 2 Attributes: @@ -25,8 +23,6 @@ Diagnostics: {0} HelpLinkUri: https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA0002.md - CustomTags: - - CompilationEnd DefaultSeverity: Warning Tier: 1 Attributes: @@ -602,7 +598,8 @@ Diagnostics: Tier: 3 Attributes: general: - Severity: Warning + Severity: None + Redundant: IDE0047 SA1119_p: Metadata: Category: StyleCop.CSharp.MaintainabilityRules diff --git a/eng/Diags/xunit.analyzers.yml b/eng/Diags/xunit.analyzers.yml index 14cd9142f48..f3fbadab8a6 100644 --- a/eng/Diags/xunit.analyzers.yml +++ b/eng/Diags/xunit.analyzers.yml @@ -1,6 +1,6 @@ Origin: AssemblyName: xunit.analyzers - Version: 1.1.0 + Version: 1.4.0 Diagnostics: xUnit1000: Metadata: @@ -615,7 +615,7 @@ Diagnostics: xUnit3000: Metadata: Category: Extensibility - Title: Test case classes must derive directly or indirectly from Xunit.LongLivedMarshalByRefObject + Title: Classes which cross AppDomain boundaries must derive directly or indirectly from LongLivedMarshalByRefObject Description: '' HelpLinkUri: https://xunit.net/xunit.analyzers/rules/xUnit3000 DefaultSeverity: Error @@ -664,3 +664,198 @@ Diagnostics: Severity: None test: Severity: Suggestion + xUnit1031: + Metadata: + Category: Usage + Title: Do not use blocking task operations in test method + Description: '' + HelpLinkUri: https://xunit.net/xunit.analyzers/rules/xUnit1031 + DefaultSeverity: Warning + Tier: 1 + Attributes: + general: + Severity: None + test: + Severity: Warning + xUnit1030: + Metadata: + Category: Usage + Title: Do not call ConfigureAwait(false) in test method + Description: '' + HelpLinkUri: https://xunit.net/xunit.analyzers/rules/xUnit1030 + DefaultSeverity: Warning + Tier: 1 + Attributes: + general: + Severity: None + test: + Severity: Warning + xUnit1029: + Metadata: + Category: Usage + Title: Local functions cannot be test functions + Description: '' + HelpLinkUri: https://xunit.net/xunit.analyzers/rules/xUnit1029 + DefaultSeverity: Error + Tier: 1 + Attributes: + general: + Severity: None + test: + Severity: Error + xUnit1034: + Metadata: + Category: Usage + Title: Null should only be used for nullable parameters + Description: '' + HelpLinkUri: https://xunit.net/xunit.analyzers/rules/xUnit1034 + DefaultSeverity: Warning + Tier: 1 + Attributes: + general: + Severity: None + test: + Severity: Warning + xUnit1035: + Metadata: + Category: Usage + Title: The value is not convertible to the method parameter type + Description: '' + HelpLinkUri: https://xunit.net/xunit.analyzers/rules/xUnit1035 + DefaultSeverity: Error + Tier: 1 + Attributes: + general: + Severity: None + test: + Severity: Error + xUnit1036: + Metadata: + Category: Usage + Title: There is no matching method parameter + Description: '' + HelpLinkUri: https://xunit.net/xunit.analyzers/rules/xUnit1036 + DefaultSeverity: Error + Tier: 1 + Attributes: + general: + Severity: None + test: + Severity: Error + xUnit1037: + Metadata: + Category: Usage + Title: There are fewer TheoryData type arguments than required by the parameters of the test method + Description: '' + HelpLinkUri: https://xunit.net/xunit.analyzers/rules/xUnit1037 + DefaultSeverity: Error + Tier: 1 + Attributes: + general: + Severity: None + test: + Severity: Error + xUnit1038: + Metadata: + Category: Usage + Title: There are more TheoryData type arguments than allowed by the parameters of the test method + Description: '' + HelpLinkUri: https://xunit.net/xunit.analyzers/rules/xUnit1038 + DefaultSeverity: Error + Tier: 1 + Attributes: + general: + Severity: None + test: + Severity: Error + xUnit1039: + Metadata: + Category: Usage + Title: The type argument to TheoryData is not compatible with the type of the corresponding test method parameter + Description: '' + HelpLinkUri: https://xunit.net/xunit.analyzers/rules/xUnit1039 + DefaultSeverity: Error + Tier: 1 + Attributes: + general: + Severity: None + test: + Severity: Error + xUnit1040: + Metadata: + Category: Usage + Title: The type argument to TheoryData is nullable, while the type of the corresponding test method parameter is not + Description: '' + HelpLinkUri: https://xunit.net/xunit.analyzers/rules/xUnit1040 + DefaultSeverity: Warning + Tier: 1 + Attributes: + general: + Severity: None + test: + Severity: Warning + xUnit1032: + Metadata: + Category: Usage + Title: Test classes cannot be nested within a generic class + Description: '' + HelpLinkUri: https://xunit.net/xunit.analyzers/rules/xUnit1032 + DefaultSeverity: Error + Tier: 1 + Attributes: + general: + Severity: None + test: + Severity: Error + xUnit1028: + Metadata: + Category: Usage + Title: Test method must have valid return type + Description: '' + HelpLinkUri: https://xunit.net/xunit.analyzers/rules/xUnit1028 + DefaultSeverity: Error + Tier: 1 + Attributes: + general: + Severity: None + test: + Severity: Error + xUnit2021: + Metadata: + Category: Assertions + Title: Async assertions should be awaited + Description: '' + HelpLinkUri: https://xunit.net/xunit.analyzers/rules/xUnit2021 + DefaultSeverity: Error + Tier: 1 + Attributes: + general: + Severity: None + test: + Severity: Error + xUnit2022: + Metadata: + Category: Assertions + Title: Boolean assertions should not be negated + Description: '' + HelpLinkUri: https://xunit.net/xunit.analyzers/rules/xUnit2022 + DefaultSeverity: Suggestion + Tier: 1 + Attributes: + general: + Severity: None + test: + Severity: Suggestion + xUnit2020: + Metadata: + Category: Assertions + Title: Do not use always-failing boolean assertions + Description: '' + HelpLinkUri: https://xunit.net/xunit.analyzers/rules/xUnit2020 + DefaultSeverity: Warning + Tier: 1 + Attributes: + general: + Severity: None + test: + Severity: Warning diff --git a/eng/Tools/.editorconfig b/eng/Tools/.editorconfig index cf14cfec647..9c1ca9d5128 100644 --- a/eng/Tools/.editorconfig +++ b/eng/Tools/.editorconfig @@ -1,5 +1,5 @@ # Created by DiagConfig, the diagnostic config generator -# Generated : 2023-10-22 00:37:48Z +# Generated : 2024-01-25 20:57:45Z # Max Tier : 2147483647 # Attributes: general # Analyzers : ILLink.RoslynAnalyzer, Microsoft.Analyzers.Extra, Microsoft.Analyzers.Local, Microsoft.AspNetCore.App.Analyzers, Microsoft.AspNetCore.Components.Analyzers, Microsoft.CodeAnalysis.CodeStyle, Microsoft.CodeAnalysis.CSharp.CodeStyle, Microsoft.CodeAnalysis.CSharp.NetAnalyzers, Microsoft.CodeAnalysis.NetAnalyzers, Microsoft.VisualStudio.Threading.Analyzers, Microsoft.VisualStudio.Threading.Analyzers.CSharp, SonarAnalyzer.CSharp, StyleCop.Analyzers @@ -107,7 +107,7 @@ dotnet_diagnostic.CA1001.severity = warning # Title : Types that own disposable fields should be disposable # Category : Design # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1001 -dotnet_diagnostic.CA1001.severity = warning +dotnet_diagnostic.CA1001.severity = none # Title : Do not expose generic lists # Category : Design @@ -195,6 +195,7 @@ dotnet_diagnostic.CA1028.severity = none # Category : Design # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1030 dotnet_diagnostic.CA1030.severity = warning +dotnet_code_quality.CA1030.api_surface = public # Title : Do not catch general exception types # Category : Design @@ -274,6 +275,7 @@ dotnet_diagnostic.CA1051.severity = none # Category : Design # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1052 dotnet_diagnostic.CA1052.severity = warning +dotnet_code_quality.CA1052.api_surface = all # Title : URI-like parameters should not be strings # Category : Design @@ -316,6 +318,7 @@ dotnet_diagnostic.CA1062.severity = none # Category : Design # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1063 dotnet_diagnostic.CA1063.severity = warning +dotnet_code_quality.CA1063.api_surface = public # Title : Exceptions should be public # Category : Design @@ -574,6 +577,7 @@ dotnet_diagnostic.CA1724.severity = none # Category : Naming # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1725 dotnet_diagnostic.CA1725.severity = warning +dotnet_code_quality.CA1725.api_surface = public, protected # Title : Use PascalCase for named placeholders # Category : Naming @@ -668,6 +672,7 @@ dotnet_diagnostic.CA1821.severity = none # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1822 dotnet_diagnostic.CA1822.severity = warning +dotnet_code_quality.CA1822.api_surface = all # Title : Avoid unused private fields # Category : Performance @@ -798,7 +803,7 @@ dotnet_diagnostic.CA1847.severity = none # Title : Use the LoggerMessage delegates # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1848 -# Comment : Use the code generated model instead. +# Comment : Use R9 logging model instead dotnet_diagnostic.CA1848.severity = none # Title : Call async methods when in an async method @@ -849,7 +854,7 @@ dotnet_diagnostic.CA1857.severity = warning # Title : Use 'StartsWith' instead of 'IndexOf' # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1858 -dotnet_diagnostic.CA1858.severity = none +dotnet_diagnostic.CA1858.severity = suggestion # Title : Use concrete types when possible for improved performance # Category : Performance @@ -859,7 +864,7 @@ dotnet_diagnostic.CA1859.severity = none # Title : Avoid using 'Enumerable.Any()' extension method # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1860 -dotnet_diagnostic.CA1860.severity = none +dotnet_diagnostic.CA1860.severity = suggestion # Title : Avoid constant arrays as arguments # Category : Performance @@ -869,7 +874,7 @@ dotnet_diagnostic.CA1861.severity = suggestion # Title : Use the 'StringComparison' method overloads to perform case-insensitive string comparisons # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1862 -dotnet_diagnostic.CA1862.severity = none +dotnet_diagnostic.CA1862.severity = suggestion # Title : Use 'CompositeFormat' # Category : Performance @@ -904,12 +909,12 @@ dotnet_diagnostic.CA1868.severity = suggestion # Title : Cache and reuse 'JsonSerializerOptions' instances # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1869 -dotnet_diagnostic.CA1869.severity = none +dotnet_diagnostic.CA1869.severity = suggestion # Title : Use a cached 'SearchValues' instance # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1870 -dotnet_diagnostic.CA1870.severity = none +dotnet_diagnostic.CA1870.severity = suggestion # Title : Dispose objects before losing scope # Category : Reliability @@ -1045,6 +1050,7 @@ dotnet_diagnostic.CA2207.severity = none # Category : Usage # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2208 dotnet_diagnostic.CA2208.severity = warning +dotnet_code_quality.CA2208.api_surface = all # Title : Non-constant fields should not be visible # Category : Usage @@ -1108,6 +1114,7 @@ dotnet_diagnostic.CA2229.severity = none # Category : Usage # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2231 dotnet_diagnostic.CA2231.severity = error +dotnet_code_quality.CA2231.api_surface = public # Title : Pass system uri objects instead of strings # Category : Usage @@ -1130,6 +1137,7 @@ dotnet_diagnostic.CA2237.severity = none # Category : Usage # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2241 dotnet_diagnostic.CA2241.severity = warning +dotnet_code_quality.CA2241.try_determine_additional_string_formatting_methods_automatically = false # Title : Test for NaN correctly # Category : Usage @@ -1847,8 +1855,8 @@ dotnet_diagnostic.IDE0005_gen.severity = none # Title : Use implicit type # Category : Style # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0007 -dotnet_diagnostic.IDE0007.severity = silent -csharp_style_var_elsewhere = true +dotnet_diagnostic.IDE0007.severity = suggestion +csharp_style_var_elsewhere = false csharp_style_var_for_built_in_types = false csharp_style_var_when_type_is_apparent = true @@ -1949,19 +1957,19 @@ csharp_style_expression_bodied_accessors = true # Title : Simplify collection initialization # Category : Style # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0028 -dotnet_diagnostic.IDE0028.severity = warning +dotnet_diagnostic.IDE0028.severity = suggestion dotnet_style_collection_initializer = true # Title : Use coalesce expression # Category : Style # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0029 -dotnet_diagnostic.IDE0029.severity = warning +dotnet_diagnostic.IDE0029.severity = suggestion dotnet_style_coalesce_expression = true # Title : Use coalesce expression # Category : Style # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0030 -dotnet_diagnostic.IDE0030.severity = warning +dotnet_diagnostic.IDE0030.severity = suggestion dotnet_style_coalesce_expression = true # Title : Use null propagation @@ -2296,7 +2304,7 @@ csharp_style_prefer_not_pattern = true # Title : Use 'new(...)' # Category : Style # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0090 -dotnet_diagnostic.IDE0090.severity = warning +dotnet_diagnostic.IDE0090.severity = suggestion csharp_style_implicit_object_creation_when_type_is_apparent = true # Title : Remove redundant equality @@ -2399,7 +2407,8 @@ dotnet_diagnostic.IDE0250.severity = warning # Title : Make member 'readonly' # Category : Style # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0251 -dotnet_diagnostic.IDE0251.severity = none +dotnet_diagnostic.IDE0251.severity = warning +csharp_style_prefer_readonly_struct_members = true # Title : Use pattern matching # Category : Style @@ -2429,7 +2438,7 @@ dotnet_diagnostic.IDE0300.severity = none # Title : Simplify collection initialization # Category : Style # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0301 -dotnet_diagnostic.IDE0301.severity = suggestion +dotnet_diagnostic.IDE0301.severity = none # Title : Simplify collection initialization # Category : Style @@ -2897,7 +2906,7 @@ dotnet_diagnostic.S103.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-104 dotnet_diagnostic.S104.severity = warning -# Title : Destructors should not throw exceptions +# Title : Finalizers should not throw exceptions # Category : Blocker Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1048 # Redundant: CA1065 @@ -2973,7 +2982,7 @@ dotnet_diagnostic.S1110.severity = none # Redundant: SA1106 dotnet_diagnostic.S1116.severity = none -# Title : Local variables should not shadow class fields +# Title : Local variables should not shadow class fields or properties # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1117 dotnet_diagnostic.S1117.severity = warning @@ -3016,6 +3025,11 @@ dotnet_diagnostic.S1128.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-113 dotnet_diagnostic.S113.severity = none +# Title : Deprecated code should be removed +# Category : Info Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-1133 +dotnet_diagnostic.S1133.severity = suggestion + # Title : Track uses of "FIXME" tags # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1134 @@ -3088,7 +3102,7 @@ dotnet_diagnostic.S1192.severity = suggestion # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1199 dotnet_diagnostic.S1199.severity = warning -# Title : Classes should not be coupled to too many other classes (Single Responsibility Principle) +# Title : Classes should not be coupled to too many other classes # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1200 dotnet_diagnostic.S1200.severity = none @@ -3269,7 +3283,7 @@ dotnet_diagnostic.S1699.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1751 dotnet_diagnostic.S1751.severity = warning -# Title : Identical expressions should not be used on both sides of a binary operator +# Title : Identical expressions should not be used on both sides of operators # Category : Major Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1764 dotnet_diagnostic.S1764.severity = warning @@ -3321,7 +3335,7 @@ dotnet_diagnostic.S1939.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1940 dotnet_diagnostic.S1940.severity = warning -# Title : Inappropriate casts should not be made +# Title : Invalid casts should be avoided # Category : Critical Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1944 dotnet_diagnostic.S1944.severity = warning @@ -3358,6 +3372,11 @@ dotnet_diagnostic.S2077.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2092 dotnet_diagnostic.S2092.severity = warning +# Title : Classes should not be empty +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2094 +dotnet_diagnostic.S2094.severity = none + # Title : Collections should not be passed as arguments to their own methods # Category : Major Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2114 @@ -3383,6 +3402,11 @@ dotnet_diagnostic.S2148.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2156 dotnet_diagnostic.S2156.severity = warning +# Title : Classes named like "Exception" should extend "Exception" or a subclass +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2166 +dotnet_diagnostic.S2166.severity = warning + # Title : Short-circuit logic should be used in boolean contexts # Category : Blocker Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2178 @@ -3398,12 +3422,12 @@ dotnet_diagnostic.S2183.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2184 dotnet_diagnostic.S2184.severity = warning -# Title : TestCases should contain tests +# Title : Test classes should contain at least one test case # Category : Blocker Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2187 dotnet_diagnostic.S2187.severity = warning -# Title : Recursion should not be infinite +# Title : Loops and recursions should not be infinite # Category : Blocker Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2190 dotnet_diagnostic.S2190.severity = warning @@ -3413,7 +3437,12 @@ dotnet_diagnostic.S2190.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2197 dotnet_diagnostic.S2197.severity = warning -# Title : Return values from functions without side effects should not be ignored +# Title : Unnecessary mathematical comparisons should not be made +# Category : Critical Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2198 +dotnet_diagnostic.S2198.severity = warning + +# Title : Methods without side effects should not have their return values ignored # Category : Major Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2201 # Redundant: CA1806 @@ -3449,7 +3478,7 @@ dotnet_diagnostic.S2225.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2228 dotnet_diagnostic.S2228.severity = none -# Title : Parameters should be passed in the correct order +# Title : Arguments should be passed in the same order as the method parameters # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2234 dotnet_diagnostic.S2234.severity = warning @@ -3626,11 +3655,17 @@ dotnet_diagnostic.S2387.severity = warning # Redundant: CA1005 dotnet_diagnostic.S2436.severity = none -# Title : Silly bit operations should not be performed +# Title : Unnecessary bit operations should not be performed # Category : Blocker Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2437 dotnet_diagnostic.S2437.severity = warning +# Title : Blocks should be synchronized on read-only fields +# Category : Major Bug +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2445 +# Comment : Noise +dotnet_diagnostic.S2445.severity = none + # Title : Whitespace and control characters in string literals should be explicit # Category : Critical Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2479 @@ -3644,8 +3679,7 @@ dotnet_diagnostic.S2486.severity = warning # Title : Shared resources should not be used for locking # Category : Critical Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2551 -# Redundant: CA2002 -dotnet_diagnostic.S2551.severity = none +dotnet_diagnostic.S2551.severity = warning # Title : Conditionally executed code should be reachable # Category : Major Bug @@ -3656,7 +3690,8 @@ dotnet_diagnostic.S2583.severity = none # Title : Boolean expressions should not be gratuitous # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2589 -dotnet_diagnostic.S2589.severity = warning +# Comment : Too many false positives. +dotnet_diagnostic.S2589.severity = none # Title : Setting loose file permissions is security-sensitive # Category : Major Security Hotspot @@ -3713,7 +3748,7 @@ dotnet_diagnostic.S2743.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2755 dotnet_diagnostic.S2755.severity = warning -# Title : "=+" should not be used instead of "+=" +# Title : Non-existent operators like "=+" should not be used # Category : Major Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2757 dotnet_diagnostic.S2757.severity = warning @@ -3738,6 +3773,11 @@ dotnet_diagnostic.S2761.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2857 dotnet_diagnostic.S2857.severity = warning +# Title : "Thread.Sleep" should not be used in tests +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2925 +dotnet_diagnostic.S2925.severity = none + # Title : "IDisposables" should be disposed # Category : Blocker Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2930 @@ -3776,6 +3816,11 @@ dotnet_diagnostic.S2953.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2955 dotnet_diagnostic.S2955.severity = warning +# Title : Assertions should be complete +# Category : Blocker Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2970 +dotnet_diagnostic.S2970.severity = warning + # Title : "IEnumerable" LINQs should be simplified # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2971 @@ -3827,6 +3872,11 @@ dotnet_diagnostic.S3059.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3060 dotnet_diagnostic.S3060.severity = warning +# Title : "StringBuilder" data should be used +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-3063 +dotnet_diagnostic.S3063.severity = warning + # Title : "async" methods should not return "void" # Category : Major Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3168 @@ -3884,7 +3934,7 @@ dotnet_diagnostic.S3235.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3236 dotnet_diagnostic.S3236.severity = warning -# Title : "value" parameters should be used +# Title : "value" contextual keyword should be used # Category : Blocker Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3237 dotnet_diagnostic.S3237.severity = warning @@ -3949,12 +3999,13 @@ dotnet_diagnostic.S3256.severity = warning # Title : Declarations and initializations should be as concise as possible # Category : Minor Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3257 -dotnet_diagnostic.S3257.severity = warning +# Comment : Too many false positives +dotnet_diagnostic.S3257.severity = none # Title : Non-derived "private" classes and records should be "sealed" # Category : Minor Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3260 -# Redundant: CA1852 +# Redundant: R9A013 dotnet_diagnostic.S3260.severity = none # Title : Namespaces should not be empty @@ -4018,6 +4069,11 @@ dotnet_diagnostic.S3353.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3358 dotnet_diagnostic.S3358.severity = warning +# Title : Date and time should not be used as a type for primary keys +# Category : Minor Bug +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-3363 +dotnet_diagnostic.S3363.severity = warning + # Title : "this" should not be exposed from constructors # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3366 @@ -4034,6 +4090,11 @@ dotnet_diagnostic.S3376.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3397 dotnet_diagnostic.S3397.severity = warning +# Title : "private" methods called only by inner classes should be moved to those classes +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-3398 +dotnet_diagnostic.S3398.severity = warning + # Title : Methods should not return constants # Category : Minor Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3400 @@ -4044,7 +4105,7 @@ dotnet_diagnostic.S3400.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3415 dotnet_diagnostic.S3415.severity = warning -# Title : Method overloads with default parameter values should not overlap +# Title : Method overloads with default parameter values should not overlap # Category : Blocker Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3427 dotnet_diagnostic.S3427.severity = warning @@ -4242,6 +4303,11 @@ dotnet_diagnostic.S3876.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3877 dotnet_diagnostic.S3877.severity = none +# Title : Arrays should not be created for params parameters +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-3878 +dotnet_diagnostic.S3878.severity = suggestion + # Title : Finalizers should not be empty # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3880 @@ -4267,7 +4333,7 @@ dotnet_diagnostic.S3885.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3887 dotnet_diagnostic.S3887.severity = warning -# Title : Neither "Thread.Resume" nor "Thread.Suspend" should be used +# Title : "Thread.Resume" and "Thread.Suspend" should not be used # Category : Blocker Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3889 dotnet_diagnostic.S3889.severity = warning @@ -4507,7 +4573,7 @@ dotnet_diagnostic.S4022.severity = warning # Title : Interfaces should not be empty # Category : Minor Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4023 -dotnet_diagnostic.S4023.severity = warning +dotnet_diagnostic.S4023.severity = none # Title : Child class fields should not differ from parent class fields only by capitalization # Category : Critical Code Smell @@ -4645,7 +4711,8 @@ dotnet_diagnostic.S4144.severity = warning # Title : Empty collections should not be accessed or iterated # Category : Minor Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4158 -dotnet_diagnostic.S4158.severity = warning +# Comment : Too many false positives +dotnet_diagnostic.S4158.severity = none # Title : Classes should implement their "ExportAttribute" interfaces # Category : Blocker Bug @@ -4779,6 +4846,11 @@ dotnet_diagnostic.S4507.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4524 dotnet_diagnostic.S4524.severity = warning +# Title : "DebuggerDisplayAttribute" strings should reference existing members +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-4545 +dotnet_diagnostic.S4545.severity = warning + # Title : ASP.NET HTTP request validation feature should not be disabled # Category : Major Vulnerability # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4564 @@ -4799,11 +4871,16 @@ dotnet_diagnostic.S4583.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4586 dotnet_diagnostic.S4586.severity = warning -# Title : String offset-based methods should be preferred for finding substrings from offsets +# Title : Start index should be used instead of calling Substring # Category : Critical Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4635 dotnet_diagnostic.S4635.severity = warning +# Title : Comments should not be empty +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-4663 +dotnet_diagnostic.S4663.severity = suggestion + # Title : Using regular expressions is security-sensitive # Category : Critical Security Hotspot # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4784 @@ -4915,10 +4992,15 @@ dotnet_diagnostic.S5766.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-5773 dotnet_diagnostic.S5773.severity = warning +# Title : Regular expressions should be syntactically valid +# Category : Critical Bug +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-5856 +dotnet_diagnostic.S5856.severity = warning + # Title : Use a testable date/time provider # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-6354 -# Redundant: EA0002 +# Redundant: R9A022 dotnet_diagnostic.S6354.severity = none # Title : Azure Functions should be stateless @@ -4954,7 +5036,120 @@ dotnet_diagnostic.S6424.severity = warning # Title : Not specifying a timeout for regular expressions is security-sensitive # Category : Major Security Hotspot # Help Link: https://rules.sonarsource.com/csharp/RSPEC-6444 -dotnet_diagnostic.S6444.severity = warning +dotnet_diagnostic.S6444.severity = none + +# Title : Blocks should not be synchronized on local variables +# Category : Major Bug +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6507 +# Comment : Too many false positives +dotnet_diagnostic.S6507.severity = none + +# Title : "ExcludeFromCodeCoverage" attributes should include a justification +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6513 +dotnet_diagnostic.S6513.severity = suggestion + +# Title : Avoid using "DateTime.Now" for benchmarking or timing operations +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6561 +dotnet_diagnostic.S6561.severity = warning + +# Title : Always set the "DateTimeKind" when creating new "DateTime" instances +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6562 +# Comment : Noise +dotnet_diagnostic.S6562.severity = none + +# Title : Use UTC when recording DateTime instants +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6563 +dotnet_diagnostic.S6563.severity = none + +# Title : Use "DateTimeOffset" instead of "DateTime" +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6566 +# Comment : Noise +dotnet_diagnostic.S6566.severity = none + +# Title : Use "TimeZoneInfo.FindSystemTimeZoneById" without converting the timezones with "TimezoneConverter" +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6575 +dotnet_diagnostic.S6575.severity = warning + +# Title : Use a format provider when parsing date and time +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6580 +dotnet_diagnostic.S6580.severity = warning + +# Title : Don't hardcode the format when turning dates and times to strings +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6585 +dotnet_diagnostic.S6585.severity = none + +# Title : Use the "UnixEpoch" field instead of creating "DateTime" instances that point to the beginning of the Unix epoch +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6588 +dotnet_diagnostic.S6588.severity = warning + +# Title : "Find" method should be used instead of the "FirstOrDefault" extension +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6602 +dotnet_diagnostic.S6602.severity = none + +# Title : The collection-specific "TrueForAll" method should be used instead of the "All" extension +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6603 +dotnet_diagnostic.S6603.severity = none + +# Title : Collection-specific "Exists" method should be used instead of the "Any" extension +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6605 +dotnet_diagnostic.S6605.severity = none + +# Title : The collection should be filtered before sorting by using "Where" before "OrderBy" +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6607 +dotnet_diagnostic.S6607.severity = none + +# Title : Prefer indexing instead of "Enumerable" methods on types implementing "IList" +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6608 +dotnet_diagnostic.S6608.severity = none + +# Title : "Min/Max" properties of "Set" types should be used instead of the "Enumerable" extension methods +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6609 +dotnet_diagnostic.S6609.severity = none + +# Title : "StartsWith" and "EndsWith" overloads that take a "char" should be used instead of the ones that take a "string" +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6610 +dotnet_diagnostic.S6610.severity = none + +# Title : The lambda parameter should be used instead of capturing arguments in "ConcurrentDictionary" methods +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6612 +dotnet_diagnostic.S6612.severity = none + +# Title : "First" and "Last" properties of "LinkedList" should be used instead of the "First()" and "Last()" extension methods +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6613 +dotnet_diagnostic.S6613.severity = none + +# Title : "Contains" should be used instead of "Any" for simple equality checks +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6617 +dotnet_diagnostic.S6617.severity = none + +# Title : "string.Create" should be used instead of "FormattableString" +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6618 +dotnet_diagnostic.S6618.severity = none + +# Title : Using unsafe code blocks is security-sensitive +# Category : Major Security Hotspot +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6640 +dotnet_diagnostic.S6640.severity = warning # Title : Literal suffixes should be upper case # Category : Minor Code Smell @@ -5001,6 +5196,10 @@ dotnet_diagnostic.S9999-symbolRef.severity = warning # Category : dotnet_diagnostic.S9999-token-type.severity = warning +# Title : Analysis Warning generator +# Category : +dotnet_diagnostic.S9999-warning.severity = warning + # Title : XML comment analysis disabled # Category : StyleCop.CSharp.SpecialRules # Help Link: https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA0001.md @@ -5280,7 +5479,8 @@ dotnet_diagnostic.SA1118.severity = warning # Title : Statement should not use unnecessary parenthesis # Category : StyleCop.CSharp.MaintainabilityRules # Help Link: https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1119.md -dotnet_diagnostic.SA1119.severity = warning +# Redundant: IDE0047 +dotnet_diagnostic.SA1119.severity = none # Title : Statement should not use unnecessary parenthesis # Category : StyleCop.CSharp.MaintainabilityRules @@ -6095,6 +6295,7 @@ dotnet_diagnostic.VSTHRD102.severity = suggestion # Title : Call async methods when in an async method # Category : Usage # Help Link: https://github.com/Microsoft/vs-threading/blob/main/doc/analyzers/VSTHRD103.md +# Redundant: CA1849 dotnet_diagnostic.VSTHRD103.severity = none # Title : Offer async methods diff --git a/scripts/MergeAnalyzerMetadata.ps1 b/scripts/MergeAnalyzerMetadata.ps1 index 91316d012c8..ead3bdc800b 100644 --- a/scripts/MergeAnalyzerMetadata.ps1 +++ b/scripts/MergeAnalyzerMetadata.ps1 @@ -11,7 +11,7 @@ Write-Output "Building DiagConfig tool" & dotnet build $Project --nologo --verbosity q Write-Output "Creating solution file" -& $SlnGen -all -folders -nolaunch -quiet +& $SlnGen -all -nolaunch -quiet Write-Output "Restoring packages" & dotnet restore --nologo --verbosity q @@ -19,14 +19,17 @@ Write-Output "Restoring packages" $Artifacts = Join-Path -Path $PSScriptRoot -ChildPath "\..\artifacts" -Resolve $DiagToolPath = "$Artifacts\bin\DiagConfig\Debug\net8.0\*" $Diags = (Resolve-Path $PSScriptRoot).Path + "\..\eng\Diags" + # Project which will be used to fetch the analyzer list. -$AsyncStateProjectPath = (Resolve-Path $PSScriptRoot).Path + "\..\test\Libraries\Microsoft.AspNetCore.AsyncState.Tests\Microsoft.AspNetCore.AsyncState.Tests.csproj" +$PrototypicalProjectPath = (Resolve-Path $PSScriptRoot).Path + "\..\test\Libraries\Microsoft.AspNetCore.AsyncState.Tests\Microsoft.AspNetCore.AsyncState.Tests.csproj" # In this section, we dynamically fetch the list of analyzers we should use by calling a target from one project which will return us the full list. To do so, # we must capture the msbuild output of the invocation of that target which returns a list of strings (one string for each line of output). Then we join all of these # lines into a single one, and we use a simple Regex to get the full list of analyzers. -$_outputArray = & dotnet msbuild $AsyncStateProjectPath /t:GetAnalyzersPassedToCompiler /p:TargetFramework=net8.0 +Write-Output "Building prototypical project" +$_outputArray = & dotnet msbuild $PrototypicalProjectPath /t:GetAnalyzersPassedToCompiler /p:TargetFramework=net8.0 $_output = $_outputArray -join "`n" + $analyzers = $_output -match "Analyzers: (.+)$" | ForEach-Object { $matches[1] -split ',' } Write-Output "Processing analyzer assemblies" @@ -41,13 +44,13 @@ Push-Location $tempDir try { + Copy-Item -Path $DiagToolPath -Destination $tempDir + foreach ( $a in $analyzers ) { Copy-Item -Path $a -Destination $tempDir } - Copy-Item -Path $DiagToolPath -Destination $tempDir - & dotnet exec .\DiagConfig.dll $Diags analyzer merge Microsoft.Analyzers.Extra.dll & dotnet exec .\DiagConfig.dll $Diags analyzer merge Microsoft.Analyzers.Local.dll & dotnet exec .\DiagConfig.dll $Diags analyzer merge StyleCop.Analyzers.dll @@ -59,8 +62,7 @@ try { & dotnet exec .\DiagConfig.dll $Diags analyzer merge Microsoft.CodeAnalysis.CSharp.CodeStyle.dll & dotnet exec .\DiagConfig.dll $Diags analyzer merge Microsoft.CodeAnalysis.NetAnalyzers.dll & dotnet exec .\DiagConfig.dll $Diags analyzer merge Microsoft.CodeAnalysis.CSharp.NetAnalyzers.dll - & dotnet exec .\DiagConfig.dll $Diags analyzer merge ILlink.RoslynAnalyzer.dll -# & dotnet exec .\DiagConfig.dll $Diags analyzer merge Microsoft.AspNetCore.App.Analyzers.dll + & dotnet exec .\DiagConfig.dll $Diags analyzer merge ILLink.RoslynAnalyzer.dll & dotnet exec .\DiagConfig.dll $Diags analyzer merge Microsoft.AspNetCore.Components.Analyzers.dll } finally { Pop-Location diff --git a/src/Analyzers/.editorconfig b/src/Analyzers/.editorconfig index 1a5578b4531..e954d5b2cff 100644 --- a/src/Analyzers/.editorconfig +++ b/src/Analyzers/.editorconfig @@ -1,5 +1,5 @@ # Created by DiagConfig, the diagnostic config generator -# Generated : 2023-10-22 00:37:45Z +# Generated : 2024-01-25 20:57:43Z # Max Tier : 2147483647 # Attributes: general, performance, production # Analyzers : ILLink.RoslynAnalyzer, Microsoft.Analyzers.Extra, Microsoft.Analyzers.Local, Microsoft.AspNetCore.App.Analyzers, Microsoft.AspNetCore.Components.Analyzers, Microsoft.CodeAnalysis.CodeStyle, Microsoft.CodeAnalysis.CSharp.CodeStyle, Microsoft.CodeAnalysis.CSharp.NetAnalyzers, Microsoft.CodeAnalysis.NetAnalyzers, Microsoft.VisualStudio.Threading.Analyzers, Microsoft.VisualStudio.Threading.Analyzers.CSharp, SonarAnalyzer.CSharp, StyleCop.Analyzers @@ -107,7 +107,7 @@ dotnet_diagnostic.CA1001.severity = warning # Title : Types that own disposable fields should be disposable # Category : Design # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1001 -dotnet_diagnostic.CA1001.severity = warning +dotnet_diagnostic.CA1001.severity = none # Title : Do not expose generic lists # Category : Design @@ -197,6 +197,7 @@ dotnet_diagnostic.CA1028.severity = none # Category : Design # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1030 dotnet_diagnostic.CA1030.severity = warning +dotnet_code_quality.CA1030.api_surface = public # Title : Do not catch general exception types # Category : Design @@ -276,6 +277,7 @@ dotnet_diagnostic.CA1051.severity = none # Category : Design # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1052 dotnet_diagnostic.CA1052.severity = warning +dotnet_code_quality.CA1052.api_surface = all # Title : URI-like parameters should not be strings # Category : Design @@ -318,6 +320,7 @@ dotnet_diagnostic.CA1062.severity = none # Category : Design # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1063 dotnet_diagnostic.CA1063.severity = warning +dotnet_code_quality.CA1063.api_surface = public # Title : Exceptions should be public # Category : Design @@ -577,6 +580,7 @@ dotnet_diagnostic.CA1724.severity = none # Category : Naming # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1725 dotnet_diagnostic.CA1725.severity = warning +dotnet_code_quality.CA1725.api_surface = public, protected # Title : Use PascalCase for named placeholders # Category : Naming @@ -599,6 +603,7 @@ dotnet_diagnostic.CA1801.severity = none # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1802 dotnet_diagnostic.CA1802.severity = warning +dotnet_code_quality.CA1802.required_modifiers = static # Title : Use literals where appropriate # Category : Performance @@ -646,6 +651,7 @@ dotnet_diagnostic.CA1814.severity = warning # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1815 dotnet_diagnostic.CA1815.severity = warning +dotnet_code_quality.CA1815.api_surface = public # Title : Dispose methods should call SuppressFinalize # Category : Usage @@ -656,6 +662,7 @@ dotnet_diagnostic.CA1816.severity = warning # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1819 dotnet_diagnostic.CA1819.severity = warning +dotnet_code_quality.CA1819.api_surface = public # Title : Test for empty strings using string length # Category : Performance @@ -671,6 +678,7 @@ dotnet_diagnostic.CA1821.severity = warning # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1822 dotnet_diagnostic.CA1822.severity = warning +dotnet_code_quality.CA1822.api_surface = all # Title : Avoid unused private fields # Category : Performance @@ -801,7 +809,7 @@ dotnet_diagnostic.CA1847.severity = warning # Title : Use the LoggerMessage delegates # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1848 -# Comment : Use the code generated model instead. +# Comment : Use R9 logging model instead dotnet_diagnostic.CA1848.severity = none # Title : Call async methods when in an async method @@ -822,7 +830,8 @@ dotnet_diagnostic.CA1851.severity = suggestion # Title : Seal internal types # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1852 -dotnet_diagnostic.CA1852.severity = none +dotnet_diagnostic.CA1852.severity = warning +dotnet_code_quality.CA1852.ignore_internalsvisibleto = true # Title : Unnecessary call to 'Dictionary.ContainsKey(key)' # Category : Performance @@ -852,7 +861,7 @@ dotnet_diagnostic.CA1857.severity = warning # Title : Use 'StartsWith' instead of 'IndexOf' # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1858 -dotnet_diagnostic.CA1858.severity = warning +dotnet_diagnostic.CA1858.severity = suggestion # Title : Use concrete types when possible for improved performance # Category : Performance @@ -862,7 +871,7 @@ dotnet_diagnostic.CA1859.severity = warning # Title : Avoid using 'Enumerable.Any()' extension method # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1860 -dotnet_diagnostic.CA1860.severity = warning +dotnet_diagnostic.CA1860.severity = suggestion # Title : Avoid constant arrays as arguments # Category : Performance @@ -872,17 +881,17 @@ dotnet_diagnostic.CA1861.severity = suggestion # Title : Use the 'StringComparison' method overloads to perform case-insensitive string comparisons # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1862 -dotnet_diagnostic.CA1862.severity = warning +dotnet_diagnostic.CA1862.severity = suggestion # Title : Use 'CompositeFormat' # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1863 -dotnet_diagnostic.CA1863.severity = warning +dotnet_diagnostic.CA1863.severity = none # Title : Prefer the 'IDictionary.TryAdd(TKey, TValue)' method # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1864 -dotnet_diagnostic.CA1864.severity = warning +dotnet_diagnostic.CA1864.severity = suggestion # Title : Use char overload # Category : Performance @@ -902,17 +911,17 @@ dotnet_diagnostic.CA1867.severity = warning # Title : Unnecessary call to 'Contains(item)' # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1868 -dotnet_diagnostic.CA1868.severity = warning +dotnet_diagnostic.CA1868.severity = suggestion # Title : Cache and reuse 'JsonSerializerOptions' instances # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1869 -dotnet_diagnostic.CA1869.severity = warning +dotnet_diagnostic.CA1869.severity = suggestion # Title : Use a cached 'SearchValues' instance # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1870 -dotnet_diagnostic.CA1870.severity = warning +dotnet_diagnostic.CA1870.severity = suggestion # Title : Dispose objects before losing scope # Category : Reliability @@ -928,6 +937,8 @@ dotnet_diagnostic.CA2002.severity = warning # Category : Reliability # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2007 dotnet_diagnostic.CA2007.severity = warning +dotnet_code_quality.CA2007.output_kinds = all +dotnet_code_quality.CA2007.exclude_async_void_methods = false # Title : Do not create tasks without passing a TaskScheduler # Category : Reliability @@ -1048,6 +1059,7 @@ dotnet_diagnostic.CA2207.severity = warning # Category : Usage # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2208 dotnet_diagnostic.CA2208.severity = warning +dotnet_code_quality.CA2208.api_surface = all # Title : Non-constant fields should not be visible # Category : Usage @@ -1111,11 +1123,13 @@ dotnet_diagnostic.CA2229.severity = none # Category : Usage # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2231 dotnet_diagnostic.CA2231.severity = error +dotnet_code_quality.CA2231.api_surface = public # Title : Pass system uri objects instead of strings # Category : Usage # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2234 dotnet_diagnostic.CA2234.severity = warning +dotnet_code_quality.CA2234.api_surface = all # Title : Mark all non-serializable fields # Category : Usage @@ -1133,6 +1147,7 @@ dotnet_diagnostic.CA2237.severity = none # Category : Usage # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2241 dotnet_diagnostic.CA2241.severity = warning +dotnet_code_quality.CA2241.try_determine_additional_string_formatting_methods_automatically = false # Title : Test for NaN correctly # Category : Usage @@ -1850,8 +1865,8 @@ dotnet_diagnostic.IDE0005_gen.severity = none # Title : Use implicit type # Category : Style # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0007 -dotnet_diagnostic.IDE0007.severity = silent -csharp_style_var_elsewhere = true +dotnet_diagnostic.IDE0007.severity = suggestion +csharp_style_var_elsewhere = false csharp_style_var_for_built_in_types = false csharp_style_var_when_type_is_apparent = true @@ -1952,19 +1967,19 @@ csharp_style_expression_bodied_accessors = true # Title : Simplify collection initialization # Category : Style # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0028 -dotnet_diagnostic.IDE0028.severity = warning +dotnet_diagnostic.IDE0028.severity = suggestion dotnet_style_collection_initializer = true # Title : Use coalesce expression # Category : Style # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0029 -dotnet_diagnostic.IDE0029.severity = warning +dotnet_diagnostic.IDE0029.severity = suggestion dotnet_style_coalesce_expression = true # Title : Use coalesce expression # Category : Style # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0030 -dotnet_diagnostic.IDE0030.severity = warning +dotnet_diagnostic.IDE0030.severity = suggestion dotnet_style_coalesce_expression = true # Title : Use null propagation @@ -2300,7 +2315,7 @@ csharp_style_prefer_not_pattern = true # Title : Use 'new(...)' # Category : Style # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0090 -dotnet_diagnostic.IDE0090.severity = warning +dotnet_diagnostic.IDE0090.severity = suggestion csharp_style_implicit_object_creation_when_type_is_apparent = true # Title : Remove redundant equality @@ -2403,7 +2418,8 @@ dotnet_diagnostic.IDE0250.severity = warning # Title : Make member 'readonly' # Category : Style # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0251 -dotnet_diagnostic.IDE0251.severity = none +dotnet_diagnostic.IDE0251.severity = warning +csharp_style_prefer_readonly_struct_members = true # Title : Use pattern matching # Category : Style @@ -2433,7 +2449,7 @@ dotnet_diagnostic.IDE0300.severity = none # Title : Simplify collection initialization # Category : Style # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0301 -dotnet_diagnostic.IDE0301.severity = suggestion +dotnet_diagnostic.IDE0301.severity = none # Title : Simplify collection initialization # Category : Style @@ -2901,7 +2917,7 @@ dotnet_diagnostic.S103.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-104 dotnet_diagnostic.S104.severity = warning -# Title : Destructors should not throw exceptions +# Title : Finalizers should not throw exceptions # Category : Blocker Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1048 # Redundant: CA1065 @@ -2977,7 +2993,7 @@ dotnet_diagnostic.S1110.severity = none # Redundant: SA1106 dotnet_diagnostic.S1116.severity = none -# Title : Local variables should not shadow class fields +# Title : Local variables should not shadow class fields or properties # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1117 dotnet_diagnostic.S1117.severity = warning @@ -3020,6 +3036,11 @@ dotnet_diagnostic.S1128.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-113 dotnet_diagnostic.S113.severity = none +# Title : Deprecated code should be removed +# Category : Info Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-1133 +dotnet_diagnostic.S1133.severity = suggestion + # Title : Track uses of "FIXME" tags # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1134 @@ -3092,7 +3113,7 @@ dotnet_diagnostic.S1192.severity = suggestion # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1199 dotnet_diagnostic.S1199.severity = warning -# Title : Classes should not be coupled to too many other classes (Single Responsibility Principle) +# Title : Classes should not be coupled to too many other classes # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1200 dotnet_diagnostic.S1200.severity = none @@ -3273,7 +3294,7 @@ dotnet_diagnostic.S1699.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1751 dotnet_diagnostic.S1751.severity = warning -# Title : Identical expressions should not be used on both sides of a binary operator +# Title : Identical expressions should not be used on both sides of operators # Category : Major Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1764 dotnet_diagnostic.S1764.severity = warning @@ -3325,7 +3346,7 @@ dotnet_diagnostic.S1939.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1940 dotnet_diagnostic.S1940.severity = warning -# Title : Inappropriate casts should not be made +# Title : Invalid casts should be avoided # Category : Critical Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1944 dotnet_diagnostic.S1944.severity = warning @@ -3362,6 +3383,11 @@ dotnet_diagnostic.S2077.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2092 dotnet_diagnostic.S2092.severity = warning +# Title : Classes should not be empty +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2094 +dotnet_diagnostic.S2094.severity = none + # Title : Collections should not be passed as arguments to their own methods # Category : Major Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2114 @@ -3387,6 +3413,11 @@ dotnet_diagnostic.S2148.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2156 dotnet_diagnostic.S2156.severity = warning +# Title : Classes named like "Exception" should extend "Exception" or a subclass +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2166 +dotnet_diagnostic.S2166.severity = warning + # Title : Short-circuit logic should be used in boolean contexts # Category : Blocker Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2178 @@ -3402,12 +3433,12 @@ dotnet_diagnostic.S2183.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2184 dotnet_diagnostic.S2184.severity = warning -# Title : TestCases should contain tests +# Title : Test classes should contain at least one test case # Category : Blocker Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2187 dotnet_diagnostic.S2187.severity = warning -# Title : Recursion should not be infinite +# Title : Loops and recursions should not be infinite # Category : Blocker Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2190 dotnet_diagnostic.S2190.severity = warning @@ -3417,7 +3448,12 @@ dotnet_diagnostic.S2190.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2197 dotnet_diagnostic.S2197.severity = warning -# Title : Return values from functions without side effects should not be ignored +# Title : Unnecessary mathematical comparisons should not be made +# Category : Critical Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2198 +dotnet_diagnostic.S2198.severity = warning + +# Title : Methods without side effects should not have their return values ignored # Category : Major Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2201 # Redundant: CA1806 @@ -3453,7 +3489,7 @@ dotnet_diagnostic.S2225.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2228 dotnet_diagnostic.S2228.severity = warning -# Title : Parameters should be passed in the correct order +# Title : Arguments should be passed in the same order as the method parameters # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2234 dotnet_diagnostic.S2234.severity = warning @@ -3630,11 +3666,17 @@ dotnet_diagnostic.S2387.severity = warning # Redundant: CA1005 dotnet_diagnostic.S2436.severity = none -# Title : Silly bit operations should not be performed +# Title : Unnecessary bit operations should not be performed # Category : Blocker Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2437 dotnet_diagnostic.S2437.severity = warning +# Title : Blocks should be synchronized on read-only fields +# Category : Major Bug +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2445 +# Comment : Noise +dotnet_diagnostic.S2445.severity = none + # Title : Whitespace and control characters in string literals should be explicit # Category : Critical Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2479 @@ -3648,8 +3690,7 @@ dotnet_diagnostic.S2486.severity = warning # Title : Shared resources should not be used for locking # Category : Critical Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2551 -# Redundant: CA2002 -dotnet_diagnostic.S2551.severity = none +dotnet_diagnostic.S2551.severity = warning # Title : Conditionally executed code should be reachable # Category : Major Bug @@ -3660,7 +3701,8 @@ dotnet_diagnostic.S2583.severity = none # Title : Boolean expressions should not be gratuitous # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2589 -dotnet_diagnostic.S2589.severity = warning +# Comment : Too many false positives. +dotnet_diagnostic.S2589.severity = none # Title : Setting loose file permissions is security-sensitive # Category : Major Security Hotspot @@ -3717,7 +3759,7 @@ dotnet_diagnostic.S2743.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2755 dotnet_diagnostic.S2755.severity = warning -# Title : "=+" should not be used instead of "+=" +# Title : Non-existent operators like "=+" should not be used # Category : Major Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2757 dotnet_diagnostic.S2757.severity = warning @@ -3742,6 +3784,11 @@ dotnet_diagnostic.S2761.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2857 dotnet_diagnostic.S2857.severity = warning +# Title : "Thread.Sleep" should not be used in tests +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2925 +dotnet_diagnostic.S2925.severity = none + # Title : "IDisposables" should be disposed # Category : Blocker Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2930 @@ -3780,6 +3827,11 @@ dotnet_diagnostic.S2953.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2955 dotnet_diagnostic.S2955.severity = warning +# Title : Assertions should be complete +# Category : Blocker Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2970 +dotnet_diagnostic.S2970.severity = warning + # Title : "IEnumerable" LINQs should be simplified # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2971 @@ -3831,6 +3883,11 @@ dotnet_diagnostic.S3059.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3060 dotnet_diagnostic.S3060.severity = warning +# Title : "StringBuilder" data should be used +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-3063 +dotnet_diagnostic.S3063.severity = warning + # Title : "async" methods should not return "void" # Category : Major Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3168 @@ -3888,7 +3945,7 @@ dotnet_diagnostic.S3235.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3236 dotnet_diagnostic.S3236.severity = warning -# Title : "value" parameters should be used +# Title : "value" contextual keyword should be used # Category : Blocker Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3237 dotnet_diagnostic.S3237.severity = warning @@ -3953,12 +4010,13 @@ dotnet_diagnostic.S3256.severity = warning # Title : Declarations and initializations should be as concise as possible # Category : Minor Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3257 -dotnet_diagnostic.S3257.severity = warning +# Comment : Too many false positives +dotnet_diagnostic.S3257.severity = none # Title : Non-derived "private" classes and records should be "sealed" # Category : Minor Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3260 -# Redundant: CA1852 +# Redundant: R9A013 dotnet_diagnostic.S3260.severity = none # Title : Namespaces should not be empty @@ -4022,6 +4080,11 @@ dotnet_diagnostic.S3353.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3358 dotnet_diagnostic.S3358.severity = warning +# Title : Date and time should not be used as a type for primary keys +# Category : Minor Bug +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-3363 +dotnet_diagnostic.S3363.severity = warning + # Title : "this" should not be exposed from constructors # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3366 @@ -4038,6 +4101,11 @@ dotnet_diagnostic.S3376.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3397 dotnet_diagnostic.S3397.severity = warning +# Title : "private" methods called only by inner classes should be moved to those classes +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-3398 +dotnet_diagnostic.S3398.severity = warning + # Title : Methods should not return constants # Category : Minor Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3400 @@ -4048,7 +4116,7 @@ dotnet_diagnostic.S3400.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3415 dotnet_diagnostic.S3415.severity = warning -# Title : Method overloads with default parameter values should not overlap +# Title : Method overloads with default parameter values should not overlap # Category : Blocker Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3427 dotnet_diagnostic.S3427.severity = warning @@ -4246,6 +4314,11 @@ dotnet_diagnostic.S3876.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3877 dotnet_diagnostic.S3877.severity = warning +# Title : Arrays should not be created for params parameters +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-3878 +dotnet_diagnostic.S3878.severity = suggestion + # Title : Finalizers should not be empty # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3880 @@ -4271,7 +4344,7 @@ dotnet_diagnostic.S3885.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3887 dotnet_diagnostic.S3887.severity = warning -# Title : Neither "Thread.Resume" nor "Thread.Suspend" should be used +# Title : "Thread.Resume" and "Thread.Suspend" should not be used # Category : Blocker Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3889 dotnet_diagnostic.S3889.severity = warning @@ -4511,7 +4584,7 @@ dotnet_diagnostic.S4022.severity = warning # Title : Interfaces should not be empty # Category : Minor Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4023 -dotnet_diagnostic.S4023.severity = warning +dotnet_diagnostic.S4023.severity = none # Title : Child class fields should not differ from parent class fields only by capitalization # Category : Critical Code Smell @@ -4649,7 +4722,8 @@ dotnet_diagnostic.S4144.severity = warning # Title : Empty collections should not be accessed or iterated # Category : Minor Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4158 -dotnet_diagnostic.S4158.severity = warning +# Comment : Too many false positives +dotnet_diagnostic.S4158.severity = none # Title : Classes should implement their "ExportAttribute" interfaces # Category : Blocker Bug @@ -4783,6 +4857,11 @@ dotnet_diagnostic.S4507.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4524 dotnet_diagnostic.S4524.severity = warning +# Title : "DebuggerDisplayAttribute" strings should reference existing members +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-4545 +dotnet_diagnostic.S4545.severity = warning + # Title : ASP.NET HTTP request validation feature should not be disabled # Category : Major Vulnerability # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4564 @@ -4803,11 +4882,16 @@ dotnet_diagnostic.S4583.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4586 dotnet_diagnostic.S4586.severity = warning -# Title : String offset-based methods should be preferred for finding substrings from offsets +# Title : Start index should be used instead of calling Substring # Category : Critical Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4635 dotnet_diagnostic.S4635.severity = warning +# Title : Comments should not be empty +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-4663 +dotnet_diagnostic.S4663.severity = suggestion + # Title : Using regular expressions is security-sensitive # Category : Critical Security Hotspot # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4784 @@ -4919,10 +5003,15 @@ dotnet_diagnostic.S5766.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-5773 dotnet_diagnostic.S5773.severity = warning +# Title : Regular expressions should be syntactically valid +# Category : Critical Bug +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-5856 +dotnet_diagnostic.S5856.severity = warning + # Title : Use a testable date/time provider # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-6354 -# Redundant: EA0002 +# Redundant: R9A022 dotnet_diagnostic.S6354.severity = none # Title : Azure Functions should be stateless @@ -4960,6 +5049,119 @@ dotnet_diagnostic.S6424.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-6444 dotnet_diagnostic.S6444.severity = warning +# Title : Blocks should not be synchronized on local variables +# Category : Major Bug +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6507 +# Comment : Too many false positives +dotnet_diagnostic.S6507.severity = none + +# Title : "ExcludeFromCodeCoverage" attributes should include a justification +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6513 +dotnet_diagnostic.S6513.severity = suggestion + +# Title : Avoid using "DateTime.Now" for benchmarking or timing operations +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6561 +dotnet_diagnostic.S6561.severity = warning + +# Title : Always set the "DateTimeKind" when creating new "DateTime" instances +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6562 +# Comment : Noise +dotnet_diagnostic.S6562.severity = none + +# Title : Use UTC when recording DateTime instants +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6563 +dotnet_diagnostic.S6563.severity = none + +# Title : Use "DateTimeOffset" instead of "DateTime" +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6566 +# Comment : Noise +dotnet_diagnostic.S6566.severity = none + +# Title : Use "TimeZoneInfo.FindSystemTimeZoneById" without converting the timezones with "TimezoneConverter" +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6575 +dotnet_diagnostic.S6575.severity = warning + +# Title : Use a format provider when parsing date and time +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6580 +dotnet_diagnostic.S6580.severity = warning + +# Title : Don't hardcode the format when turning dates and times to strings +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6585 +dotnet_diagnostic.S6585.severity = none + +# Title : Use the "UnixEpoch" field instead of creating "DateTime" instances that point to the beginning of the Unix epoch +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6588 +dotnet_diagnostic.S6588.severity = warning + +# Title : "Find" method should be used instead of the "FirstOrDefault" extension +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6602 +dotnet_diagnostic.S6602.severity = warning + +# Title : The collection-specific "TrueForAll" method should be used instead of the "All" extension +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6603 +dotnet_diagnostic.S6603.severity = warning + +# Title : Collection-specific "Exists" method should be used instead of the "Any" extension +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6605 +dotnet_diagnostic.S6605.severity = warning + +# Title : The collection should be filtered before sorting by using "Where" before "OrderBy" +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6607 +dotnet_diagnostic.S6607.severity = warning + +# Title : Prefer indexing instead of "Enumerable" methods on types implementing "IList" +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6608 +dotnet_diagnostic.S6608.severity = warning + +# Title : "Min/Max" properties of "Set" types should be used instead of the "Enumerable" extension methods +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6609 +dotnet_diagnostic.S6609.severity = warning + +# Title : "StartsWith" and "EndsWith" overloads that take a "char" should be used instead of the ones that take a "string" +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6610 +dotnet_diagnostic.S6610.severity = warning + +# Title : The lambda parameter should be used instead of capturing arguments in "ConcurrentDictionary" methods +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6612 +dotnet_diagnostic.S6612.severity = warning + +# Title : "First" and "Last" properties of "LinkedList" should be used instead of the "First()" and "Last()" extension methods +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6613 +dotnet_diagnostic.S6613.severity = warning + +# Title : "Contains" should be used instead of "Any" for simple equality checks +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6617 +dotnet_diagnostic.S6617.severity = warning + +# Title : "string.Create" should be used instead of "FormattableString" +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6618 +dotnet_diagnostic.S6618.severity = warning + +# Title : Using unsafe code blocks is security-sensitive +# Category : Major Security Hotspot +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6640 +dotnet_diagnostic.S6640.severity = warning + # Title : Literal suffixes should be upper case # Category : Minor Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-818 @@ -5005,6 +5207,10 @@ dotnet_diagnostic.S9999-symbolRef.severity = warning # Category : dotnet_diagnostic.S9999-token-type.severity = warning +# Title : Analysis Warning generator +# Category : +dotnet_diagnostic.S9999-warning.severity = warning + # Title : XML comment analysis disabled # Category : StyleCop.CSharp.SpecialRules # Help Link: https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA0001.md @@ -5284,7 +5490,8 @@ dotnet_diagnostic.SA1118.severity = warning # Title : Statement should not use unnecessary parenthesis # Category : StyleCop.CSharp.MaintainabilityRules # Help Link: https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1119.md -dotnet_diagnostic.SA1119.severity = warning +# Redundant: IDE0047 +dotnet_diagnostic.SA1119.severity = none # Title : Statement should not use unnecessary parenthesis # Category : StyleCop.CSharp.MaintainabilityRules @@ -6099,7 +6306,8 @@ dotnet_diagnostic.VSTHRD102.severity = suggestion # Title : Call async methods when in an async method # Category : Usage # Help Link: https://github.com/Microsoft/vs-threading/blob/main/doc/analyzers/VSTHRD103.md -dotnet_diagnostic.VSTHRD103.severity = warning +# Redundant: CA1849 +dotnet_diagnostic.VSTHRD103.severity = none # Title : Offer async methods # Category : Usage diff --git a/src/Generators/.editorconfig b/src/Generators/.editorconfig index 1a5578b4531..e954d5b2cff 100644 --- a/src/Generators/.editorconfig +++ b/src/Generators/.editorconfig @@ -1,5 +1,5 @@ # Created by DiagConfig, the diagnostic config generator -# Generated : 2023-10-22 00:37:45Z +# Generated : 2024-01-25 20:57:43Z # Max Tier : 2147483647 # Attributes: general, performance, production # Analyzers : ILLink.RoslynAnalyzer, Microsoft.Analyzers.Extra, Microsoft.Analyzers.Local, Microsoft.AspNetCore.App.Analyzers, Microsoft.AspNetCore.Components.Analyzers, Microsoft.CodeAnalysis.CodeStyle, Microsoft.CodeAnalysis.CSharp.CodeStyle, Microsoft.CodeAnalysis.CSharp.NetAnalyzers, Microsoft.CodeAnalysis.NetAnalyzers, Microsoft.VisualStudio.Threading.Analyzers, Microsoft.VisualStudio.Threading.Analyzers.CSharp, SonarAnalyzer.CSharp, StyleCop.Analyzers @@ -107,7 +107,7 @@ dotnet_diagnostic.CA1001.severity = warning # Title : Types that own disposable fields should be disposable # Category : Design # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1001 -dotnet_diagnostic.CA1001.severity = warning +dotnet_diagnostic.CA1001.severity = none # Title : Do not expose generic lists # Category : Design @@ -197,6 +197,7 @@ dotnet_diagnostic.CA1028.severity = none # Category : Design # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1030 dotnet_diagnostic.CA1030.severity = warning +dotnet_code_quality.CA1030.api_surface = public # Title : Do not catch general exception types # Category : Design @@ -276,6 +277,7 @@ dotnet_diagnostic.CA1051.severity = none # Category : Design # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1052 dotnet_diagnostic.CA1052.severity = warning +dotnet_code_quality.CA1052.api_surface = all # Title : URI-like parameters should not be strings # Category : Design @@ -318,6 +320,7 @@ dotnet_diagnostic.CA1062.severity = none # Category : Design # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1063 dotnet_diagnostic.CA1063.severity = warning +dotnet_code_quality.CA1063.api_surface = public # Title : Exceptions should be public # Category : Design @@ -577,6 +580,7 @@ dotnet_diagnostic.CA1724.severity = none # Category : Naming # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1725 dotnet_diagnostic.CA1725.severity = warning +dotnet_code_quality.CA1725.api_surface = public, protected # Title : Use PascalCase for named placeholders # Category : Naming @@ -599,6 +603,7 @@ dotnet_diagnostic.CA1801.severity = none # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1802 dotnet_diagnostic.CA1802.severity = warning +dotnet_code_quality.CA1802.required_modifiers = static # Title : Use literals where appropriate # Category : Performance @@ -646,6 +651,7 @@ dotnet_diagnostic.CA1814.severity = warning # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1815 dotnet_diagnostic.CA1815.severity = warning +dotnet_code_quality.CA1815.api_surface = public # Title : Dispose methods should call SuppressFinalize # Category : Usage @@ -656,6 +662,7 @@ dotnet_diagnostic.CA1816.severity = warning # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1819 dotnet_diagnostic.CA1819.severity = warning +dotnet_code_quality.CA1819.api_surface = public # Title : Test for empty strings using string length # Category : Performance @@ -671,6 +678,7 @@ dotnet_diagnostic.CA1821.severity = warning # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1822 dotnet_diagnostic.CA1822.severity = warning +dotnet_code_quality.CA1822.api_surface = all # Title : Avoid unused private fields # Category : Performance @@ -801,7 +809,7 @@ dotnet_diagnostic.CA1847.severity = warning # Title : Use the LoggerMessage delegates # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1848 -# Comment : Use the code generated model instead. +# Comment : Use R9 logging model instead dotnet_diagnostic.CA1848.severity = none # Title : Call async methods when in an async method @@ -822,7 +830,8 @@ dotnet_diagnostic.CA1851.severity = suggestion # Title : Seal internal types # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1852 -dotnet_diagnostic.CA1852.severity = none +dotnet_diagnostic.CA1852.severity = warning +dotnet_code_quality.CA1852.ignore_internalsvisibleto = true # Title : Unnecessary call to 'Dictionary.ContainsKey(key)' # Category : Performance @@ -852,7 +861,7 @@ dotnet_diagnostic.CA1857.severity = warning # Title : Use 'StartsWith' instead of 'IndexOf' # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1858 -dotnet_diagnostic.CA1858.severity = warning +dotnet_diagnostic.CA1858.severity = suggestion # Title : Use concrete types when possible for improved performance # Category : Performance @@ -862,7 +871,7 @@ dotnet_diagnostic.CA1859.severity = warning # Title : Avoid using 'Enumerable.Any()' extension method # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1860 -dotnet_diagnostic.CA1860.severity = warning +dotnet_diagnostic.CA1860.severity = suggestion # Title : Avoid constant arrays as arguments # Category : Performance @@ -872,17 +881,17 @@ dotnet_diagnostic.CA1861.severity = suggestion # Title : Use the 'StringComparison' method overloads to perform case-insensitive string comparisons # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1862 -dotnet_diagnostic.CA1862.severity = warning +dotnet_diagnostic.CA1862.severity = suggestion # Title : Use 'CompositeFormat' # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1863 -dotnet_diagnostic.CA1863.severity = warning +dotnet_diagnostic.CA1863.severity = none # Title : Prefer the 'IDictionary.TryAdd(TKey, TValue)' method # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1864 -dotnet_diagnostic.CA1864.severity = warning +dotnet_diagnostic.CA1864.severity = suggestion # Title : Use char overload # Category : Performance @@ -902,17 +911,17 @@ dotnet_diagnostic.CA1867.severity = warning # Title : Unnecessary call to 'Contains(item)' # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1868 -dotnet_diagnostic.CA1868.severity = warning +dotnet_diagnostic.CA1868.severity = suggestion # Title : Cache and reuse 'JsonSerializerOptions' instances # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1869 -dotnet_diagnostic.CA1869.severity = warning +dotnet_diagnostic.CA1869.severity = suggestion # Title : Use a cached 'SearchValues' instance # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1870 -dotnet_diagnostic.CA1870.severity = warning +dotnet_diagnostic.CA1870.severity = suggestion # Title : Dispose objects before losing scope # Category : Reliability @@ -928,6 +937,8 @@ dotnet_diagnostic.CA2002.severity = warning # Category : Reliability # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2007 dotnet_diagnostic.CA2007.severity = warning +dotnet_code_quality.CA2007.output_kinds = all +dotnet_code_quality.CA2007.exclude_async_void_methods = false # Title : Do not create tasks without passing a TaskScheduler # Category : Reliability @@ -1048,6 +1059,7 @@ dotnet_diagnostic.CA2207.severity = warning # Category : Usage # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2208 dotnet_diagnostic.CA2208.severity = warning +dotnet_code_quality.CA2208.api_surface = all # Title : Non-constant fields should not be visible # Category : Usage @@ -1111,11 +1123,13 @@ dotnet_diagnostic.CA2229.severity = none # Category : Usage # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2231 dotnet_diagnostic.CA2231.severity = error +dotnet_code_quality.CA2231.api_surface = public # Title : Pass system uri objects instead of strings # Category : Usage # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2234 dotnet_diagnostic.CA2234.severity = warning +dotnet_code_quality.CA2234.api_surface = all # Title : Mark all non-serializable fields # Category : Usage @@ -1133,6 +1147,7 @@ dotnet_diagnostic.CA2237.severity = none # Category : Usage # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2241 dotnet_diagnostic.CA2241.severity = warning +dotnet_code_quality.CA2241.try_determine_additional_string_formatting_methods_automatically = false # Title : Test for NaN correctly # Category : Usage @@ -1850,8 +1865,8 @@ dotnet_diagnostic.IDE0005_gen.severity = none # Title : Use implicit type # Category : Style # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0007 -dotnet_diagnostic.IDE0007.severity = silent -csharp_style_var_elsewhere = true +dotnet_diagnostic.IDE0007.severity = suggestion +csharp_style_var_elsewhere = false csharp_style_var_for_built_in_types = false csharp_style_var_when_type_is_apparent = true @@ -1952,19 +1967,19 @@ csharp_style_expression_bodied_accessors = true # Title : Simplify collection initialization # Category : Style # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0028 -dotnet_diagnostic.IDE0028.severity = warning +dotnet_diagnostic.IDE0028.severity = suggestion dotnet_style_collection_initializer = true # Title : Use coalesce expression # Category : Style # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0029 -dotnet_diagnostic.IDE0029.severity = warning +dotnet_diagnostic.IDE0029.severity = suggestion dotnet_style_coalesce_expression = true # Title : Use coalesce expression # Category : Style # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0030 -dotnet_diagnostic.IDE0030.severity = warning +dotnet_diagnostic.IDE0030.severity = suggestion dotnet_style_coalesce_expression = true # Title : Use null propagation @@ -2300,7 +2315,7 @@ csharp_style_prefer_not_pattern = true # Title : Use 'new(...)' # Category : Style # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0090 -dotnet_diagnostic.IDE0090.severity = warning +dotnet_diagnostic.IDE0090.severity = suggestion csharp_style_implicit_object_creation_when_type_is_apparent = true # Title : Remove redundant equality @@ -2403,7 +2418,8 @@ dotnet_diagnostic.IDE0250.severity = warning # Title : Make member 'readonly' # Category : Style # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0251 -dotnet_diagnostic.IDE0251.severity = none +dotnet_diagnostic.IDE0251.severity = warning +csharp_style_prefer_readonly_struct_members = true # Title : Use pattern matching # Category : Style @@ -2433,7 +2449,7 @@ dotnet_diagnostic.IDE0300.severity = none # Title : Simplify collection initialization # Category : Style # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0301 -dotnet_diagnostic.IDE0301.severity = suggestion +dotnet_diagnostic.IDE0301.severity = none # Title : Simplify collection initialization # Category : Style @@ -2901,7 +2917,7 @@ dotnet_diagnostic.S103.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-104 dotnet_diagnostic.S104.severity = warning -# Title : Destructors should not throw exceptions +# Title : Finalizers should not throw exceptions # Category : Blocker Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1048 # Redundant: CA1065 @@ -2977,7 +2993,7 @@ dotnet_diagnostic.S1110.severity = none # Redundant: SA1106 dotnet_diagnostic.S1116.severity = none -# Title : Local variables should not shadow class fields +# Title : Local variables should not shadow class fields or properties # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1117 dotnet_diagnostic.S1117.severity = warning @@ -3020,6 +3036,11 @@ dotnet_diagnostic.S1128.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-113 dotnet_diagnostic.S113.severity = none +# Title : Deprecated code should be removed +# Category : Info Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-1133 +dotnet_diagnostic.S1133.severity = suggestion + # Title : Track uses of "FIXME" tags # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1134 @@ -3092,7 +3113,7 @@ dotnet_diagnostic.S1192.severity = suggestion # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1199 dotnet_diagnostic.S1199.severity = warning -# Title : Classes should not be coupled to too many other classes (Single Responsibility Principle) +# Title : Classes should not be coupled to too many other classes # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1200 dotnet_diagnostic.S1200.severity = none @@ -3273,7 +3294,7 @@ dotnet_diagnostic.S1699.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1751 dotnet_diagnostic.S1751.severity = warning -# Title : Identical expressions should not be used on both sides of a binary operator +# Title : Identical expressions should not be used on both sides of operators # Category : Major Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1764 dotnet_diagnostic.S1764.severity = warning @@ -3325,7 +3346,7 @@ dotnet_diagnostic.S1939.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1940 dotnet_diagnostic.S1940.severity = warning -# Title : Inappropriate casts should not be made +# Title : Invalid casts should be avoided # Category : Critical Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1944 dotnet_diagnostic.S1944.severity = warning @@ -3362,6 +3383,11 @@ dotnet_diagnostic.S2077.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2092 dotnet_diagnostic.S2092.severity = warning +# Title : Classes should not be empty +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2094 +dotnet_diagnostic.S2094.severity = none + # Title : Collections should not be passed as arguments to their own methods # Category : Major Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2114 @@ -3387,6 +3413,11 @@ dotnet_diagnostic.S2148.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2156 dotnet_diagnostic.S2156.severity = warning +# Title : Classes named like "Exception" should extend "Exception" or a subclass +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2166 +dotnet_diagnostic.S2166.severity = warning + # Title : Short-circuit logic should be used in boolean contexts # Category : Blocker Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2178 @@ -3402,12 +3433,12 @@ dotnet_diagnostic.S2183.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2184 dotnet_diagnostic.S2184.severity = warning -# Title : TestCases should contain tests +# Title : Test classes should contain at least one test case # Category : Blocker Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2187 dotnet_diagnostic.S2187.severity = warning -# Title : Recursion should not be infinite +# Title : Loops and recursions should not be infinite # Category : Blocker Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2190 dotnet_diagnostic.S2190.severity = warning @@ -3417,7 +3448,12 @@ dotnet_diagnostic.S2190.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2197 dotnet_diagnostic.S2197.severity = warning -# Title : Return values from functions without side effects should not be ignored +# Title : Unnecessary mathematical comparisons should not be made +# Category : Critical Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2198 +dotnet_diagnostic.S2198.severity = warning + +# Title : Methods without side effects should not have their return values ignored # Category : Major Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2201 # Redundant: CA1806 @@ -3453,7 +3489,7 @@ dotnet_diagnostic.S2225.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2228 dotnet_diagnostic.S2228.severity = warning -# Title : Parameters should be passed in the correct order +# Title : Arguments should be passed in the same order as the method parameters # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2234 dotnet_diagnostic.S2234.severity = warning @@ -3630,11 +3666,17 @@ dotnet_diagnostic.S2387.severity = warning # Redundant: CA1005 dotnet_diagnostic.S2436.severity = none -# Title : Silly bit operations should not be performed +# Title : Unnecessary bit operations should not be performed # Category : Blocker Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2437 dotnet_diagnostic.S2437.severity = warning +# Title : Blocks should be synchronized on read-only fields +# Category : Major Bug +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2445 +# Comment : Noise +dotnet_diagnostic.S2445.severity = none + # Title : Whitespace and control characters in string literals should be explicit # Category : Critical Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2479 @@ -3648,8 +3690,7 @@ dotnet_diagnostic.S2486.severity = warning # Title : Shared resources should not be used for locking # Category : Critical Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2551 -# Redundant: CA2002 -dotnet_diagnostic.S2551.severity = none +dotnet_diagnostic.S2551.severity = warning # Title : Conditionally executed code should be reachable # Category : Major Bug @@ -3660,7 +3701,8 @@ dotnet_diagnostic.S2583.severity = none # Title : Boolean expressions should not be gratuitous # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2589 -dotnet_diagnostic.S2589.severity = warning +# Comment : Too many false positives. +dotnet_diagnostic.S2589.severity = none # Title : Setting loose file permissions is security-sensitive # Category : Major Security Hotspot @@ -3717,7 +3759,7 @@ dotnet_diagnostic.S2743.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2755 dotnet_diagnostic.S2755.severity = warning -# Title : "=+" should not be used instead of "+=" +# Title : Non-existent operators like "=+" should not be used # Category : Major Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2757 dotnet_diagnostic.S2757.severity = warning @@ -3742,6 +3784,11 @@ dotnet_diagnostic.S2761.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2857 dotnet_diagnostic.S2857.severity = warning +# Title : "Thread.Sleep" should not be used in tests +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2925 +dotnet_diagnostic.S2925.severity = none + # Title : "IDisposables" should be disposed # Category : Blocker Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2930 @@ -3780,6 +3827,11 @@ dotnet_diagnostic.S2953.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2955 dotnet_diagnostic.S2955.severity = warning +# Title : Assertions should be complete +# Category : Blocker Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2970 +dotnet_diagnostic.S2970.severity = warning + # Title : "IEnumerable" LINQs should be simplified # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2971 @@ -3831,6 +3883,11 @@ dotnet_diagnostic.S3059.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3060 dotnet_diagnostic.S3060.severity = warning +# Title : "StringBuilder" data should be used +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-3063 +dotnet_diagnostic.S3063.severity = warning + # Title : "async" methods should not return "void" # Category : Major Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3168 @@ -3888,7 +3945,7 @@ dotnet_diagnostic.S3235.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3236 dotnet_diagnostic.S3236.severity = warning -# Title : "value" parameters should be used +# Title : "value" contextual keyword should be used # Category : Blocker Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3237 dotnet_diagnostic.S3237.severity = warning @@ -3953,12 +4010,13 @@ dotnet_diagnostic.S3256.severity = warning # Title : Declarations and initializations should be as concise as possible # Category : Minor Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3257 -dotnet_diagnostic.S3257.severity = warning +# Comment : Too many false positives +dotnet_diagnostic.S3257.severity = none # Title : Non-derived "private" classes and records should be "sealed" # Category : Minor Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3260 -# Redundant: CA1852 +# Redundant: R9A013 dotnet_diagnostic.S3260.severity = none # Title : Namespaces should not be empty @@ -4022,6 +4080,11 @@ dotnet_diagnostic.S3353.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3358 dotnet_diagnostic.S3358.severity = warning +# Title : Date and time should not be used as a type for primary keys +# Category : Minor Bug +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-3363 +dotnet_diagnostic.S3363.severity = warning + # Title : "this" should not be exposed from constructors # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3366 @@ -4038,6 +4101,11 @@ dotnet_diagnostic.S3376.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3397 dotnet_diagnostic.S3397.severity = warning +# Title : "private" methods called only by inner classes should be moved to those classes +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-3398 +dotnet_diagnostic.S3398.severity = warning + # Title : Methods should not return constants # Category : Minor Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3400 @@ -4048,7 +4116,7 @@ dotnet_diagnostic.S3400.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3415 dotnet_diagnostic.S3415.severity = warning -# Title : Method overloads with default parameter values should not overlap +# Title : Method overloads with default parameter values should not overlap # Category : Blocker Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3427 dotnet_diagnostic.S3427.severity = warning @@ -4246,6 +4314,11 @@ dotnet_diagnostic.S3876.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3877 dotnet_diagnostic.S3877.severity = warning +# Title : Arrays should not be created for params parameters +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-3878 +dotnet_diagnostic.S3878.severity = suggestion + # Title : Finalizers should not be empty # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3880 @@ -4271,7 +4344,7 @@ dotnet_diagnostic.S3885.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3887 dotnet_diagnostic.S3887.severity = warning -# Title : Neither "Thread.Resume" nor "Thread.Suspend" should be used +# Title : "Thread.Resume" and "Thread.Suspend" should not be used # Category : Blocker Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3889 dotnet_diagnostic.S3889.severity = warning @@ -4511,7 +4584,7 @@ dotnet_diagnostic.S4022.severity = warning # Title : Interfaces should not be empty # Category : Minor Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4023 -dotnet_diagnostic.S4023.severity = warning +dotnet_diagnostic.S4023.severity = none # Title : Child class fields should not differ from parent class fields only by capitalization # Category : Critical Code Smell @@ -4649,7 +4722,8 @@ dotnet_diagnostic.S4144.severity = warning # Title : Empty collections should not be accessed or iterated # Category : Minor Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4158 -dotnet_diagnostic.S4158.severity = warning +# Comment : Too many false positives +dotnet_diagnostic.S4158.severity = none # Title : Classes should implement their "ExportAttribute" interfaces # Category : Blocker Bug @@ -4783,6 +4857,11 @@ dotnet_diagnostic.S4507.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4524 dotnet_diagnostic.S4524.severity = warning +# Title : "DebuggerDisplayAttribute" strings should reference existing members +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-4545 +dotnet_diagnostic.S4545.severity = warning + # Title : ASP.NET HTTP request validation feature should not be disabled # Category : Major Vulnerability # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4564 @@ -4803,11 +4882,16 @@ dotnet_diagnostic.S4583.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4586 dotnet_diagnostic.S4586.severity = warning -# Title : String offset-based methods should be preferred for finding substrings from offsets +# Title : Start index should be used instead of calling Substring # Category : Critical Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4635 dotnet_diagnostic.S4635.severity = warning +# Title : Comments should not be empty +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-4663 +dotnet_diagnostic.S4663.severity = suggestion + # Title : Using regular expressions is security-sensitive # Category : Critical Security Hotspot # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4784 @@ -4919,10 +5003,15 @@ dotnet_diagnostic.S5766.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-5773 dotnet_diagnostic.S5773.severity = warning +# Title : Regular expressions should be syntactically valid +# Category : Critical Bug +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-5856 +dotnet_diagnostic.S5856.severity = warning + # Title : Use a testable date/time provider # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-6354 -# Redundant: EA0002 +# Redundant: R9A022 dotnet_diagnostic.S6354.severity = none # Title : Azure Functions should be stateless @@ -4960,6 +5049,119 @@ dotnet_diagnostic.S6424.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-6444 dotnet_diagnostic.S6444.severity = warning +# Title : Blocks should not be synchronized on local variables +# Category : Major Bug +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6507 +# Comment : Too many false positives +dotnet_diagnostic.S6507.severity = none + +# Title : "ExcludeFromCodeCoverage" attributes should include a justification +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6513 +dotnet_diagnostic.S6513.severity = suggestion + +# Title : Avoid using "DateTime.Now" for benchmarking or timing operations +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6561 +dotnet_diagnostic.S6561.severity = warning + +# Title : Always set the "DateTimeKind" when creating new "DateTime" instances +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6562 +# Comment : Noise +dotnet_diagnostic.S6562.severity = none + +# Title : Use UTC when recording DateTime instants +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6563 +dotnet_diagnostic.S6563.severity = none + +# Title : Use "DateTimeOffset" instead of "DateTime" +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6566 +# Comment : Noise +dotnet_diagnostic.S6566.severity = none + +# Title : Use "TimeZoneInfo.FindSystemTimeZoneById" without converting the timezones with "TimezoneConverter" +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6575 +dotnet_diagnostic.S6575.severity = warning + +# Title : Use a format provider when parsing date and time +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6580 +dotnet_diagnostic.S6580.severity = warning + +# Title : Don't hardcode the format when turning dates and times to strings +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6585 +dotnet_diagnostic.S6585.severity = none + +# Title : Use the "UnixEpoch" field instead of creating "DateTime" instances that point to the beginning of the Unix epoch +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6588 +dotnet_diagnostic.S6588.severity = warning + +# Title : "Find" method should be used instead of the "FirstOrDefault" extension +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6602 +dotnet_diagnostic.S6602.severity = warning + +# Title : The collection-specific "TrueForAll" method should be used instead of the "All" extension +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6603 +dotnet_diagnostic.S6603.severity = warning + +# Title : Collection-specific "Exists" method should be used instead of the "Any" extension +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6605 +dotnet_diagnostic.S6605.severity = warning + +# Title : The collection should be filtered before sorting by using "Where" before "OrderBy" +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6607 +dotnet_diagnostic.S6607.severity = warning + +# Title : Prefer indexing instead of "Enumerable" methods on types implementing "IList" +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6608 +dotnet_diagnostic.S6608.severity = warning + +# Title : "Min/Max" properties of "Set" types should be used instead of the "Enumerable" extension methods +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6609 +dotnet_diagnostic.S6609.severity = warning + +# Title : "StartsWith" and "EndsWith" overloads that take a "char" should be used instead of the ones that take a "string" +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6610 +dotnet_diagnostic.S6610.severity = warning + +# Title : The lambda parameter should be used instead of capturing arguments in "ConcurrentDictionary" methods +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6612 +dotnet_diagnostic.S6612.severity = warning + +# Title : "First" and "Last" properties of "LinkedList" should be used instead of the "First()" and "Last()" extension methods +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6613 +dotnet_diagnostic.S6613.severity = warning + +# Title : "Contains" should be used instead of "Any" for simple equality checks +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6617 +dotnet_diagnostic.S6617.severity = warning + +# Title : "string.Create" should be used instead of "FormattableString" +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6618 +dotnet_diagnostic.S6618.severity = warning + +# Title : Using unsafe code blocks is security-sensitive +# Category : Major Security Hotspot +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6640 +dotnet_diagnostic.S6640.severity = warning + # Title : Literal suffixes should be upper case # Category : Minor Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-818 @@ -5005,6 +5207,10 @@ dotnet_diagnostic.S9999-symbolRef.severity = warning # Category : dotnet_diagnostic.S9999-token-type.severity = warning +# Title : Analysis Warning generator +# Category : +dotnet_diagnostic.S9999-warning.severity = warning + # Title : XML comment analysis disabled # Category : StyleCop.CSharp.SpecialRules # Help Link: https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA0001.md @@ -5284,7 +5490,8 @@ dotnet_diagnostic.SA1118.severity = warning # Title : Statement should not use unnecessary parenthesis # Category : StyleCop.CSharp.MaintainabilityRules # Help Link: https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1119.md -dotnet_diagnostic.SA1119.severity = warning +# Redundant: IDE0047 +dotnet_diagnostic.SA1119.severity = none # Title : Statement should not use unnecessary parenthesis # Category : StyleCop.CSharp.MaintainabilityRules @@ -6099,7 +6306,8 @@ dotnet_diagnostic.VSTHRD102.severity = suggestion # Title : Call async methods when in an async method # Category : Usage # Help Link: https://github.com/Microsoft/vs-threading/blob/main/doc/analyzers/VSTHRD103.md -dotnet_diagnostic.VSTHRD103.severity = warning +# Redundant: CA1849 +dotnet_diagnostic.VSTHRD103.severity = none # Title : Offer async methods # Category : Usage diff --git a/src/LegacySupport/.editorconfig b/src/LegacySupport/.editorconfig index 4ae3d209188..a65272c4a60 100644 --- a/src/LegacySupport/.editorconfig +++ b/src/LegacySupport/.editorconfig @@ -1,5 +1,5 @@ # Created by DiagConfig, the diagnostic config generator -# Generated : 2023-10-22 00:37:46Z +# Generated : 2024-01-25 20:57:44Z # Max Tier : 2147483647 # Attributes: general, performance, production # Analyzers : ILLink.RoslynAnalyzer, Microsoft.Analyzers.Extra, Microsoft.Analyzers.Local, Microsoft.AspNetCore.App.Analyzers, Microsoft.AspNetCore.Components.Analyzers, Microsoft.CodeAnalysis.CodeStyle, Microsoft.CodeAnalysis.CSharp.CodeStyle, Microsoft.CodeAnalysis.CSharp.NetAnalyzers, Microsoft.CodeAnalysis.NetAnalyzers, Microsoft.VisualStudio.Threading.Analyzers, Microsoft.VisualStudio.Threading.Analyzers.CSharp, SonarAnalyzer.CSharp, StyleCop.Analyzers @@ -107,7 +107,7 @@ dotnet_diagnostic.CA1001.severity = warning # Title : Types that own disposable fields should be disposable # Category : Design # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1001 -dotnet_diagnostic.CA1001.severity = warning +dotnet_diagnostic.CA1001.severity = none # Title : Do not expose generic lists # Category : Design @@ -197,6 +197,7 @@ dotnet_diagnostic.CA1028.severity = none # Category : Design # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1030 dotnet_diagnostic.CA1030.severity = warning +dotnet_code_quality.CA1030.api_surface = public # Title : Do not catch general exception types # Category : Design @@ -276,6 +277,7 @@ dotnet_diagnostic.CA1051.severity = none # Category : Design # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1052 dotnet_diagnostic.CA1052.severity = warning +dotnet_code_quality.CA1052.api_surface = all # Title : URI-like parameters should not be strings # Category : Design @@ -318,6 +320,7 @@ dotnet_diagnostic.CA1062.severity = none # Category : Design # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1063 dotnet_diagnostic.CA1063.severity = warning +dotnet_code_quality.CA1063.api_surface = public # Title : Exceptions should be public # Category : Design @@ -577,6 +580,7 @@ dotnet_diagnostic.CA1724.severity = none # Category : Naming # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1725 dotnet_diagnostic.CA1725.severity = warning +dotnet_code_quality.CA1725.api_surface = public, protected # Title : Use PascalCase for named placeholders # Category : Naming @@ -599,6 +603,7 @@ dotnet_diagnostic.CA1801.severity = none # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1802 dotnet_diagnostic.CA1802.severity = warning +dotnet_code_quality.CA1802.required_modifiers = static # Title : Use literals where appropriate # Category : Performance @@ -646,6 +651,7 @@ dotnet_diagnostic.CA1814.severity = warning # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1815 dotnet_diagnostic.CA1815.severity = warning +dotnet_code_quality.CA1815.api_surface = public # Title : Dispose methods should call SuppressFinalize # Category : Usage @@ -656,6 +662,7 @@ dotnet_diagnostic.CA1816.severity = warning # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1819 dotnet_diagnostic.CA1819.severity = warning +dotnet_code_quality.CA1819.api_surface = public # Title : Test for empty strings using string length # Category : Performance @@ -671,6 +678,7 @@ dotnet_diagnostic.CA1821.severity = warning # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1822 dotnet_diagnostic.CA1822.severity = warning +dotnet_code_quality.CA1822.api_surface = all # Title : Avoid unused private fields # Category : Performance @@ -801,7 +809,7 @@ dotnet_diagnostic.CA1847.severity = warning # Title : Use the LoggerMessage delegates # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1848 -# Comment : Use the code generated model instead. +# Comment : Use R9 logging model instead dotnet_diagnostic.CA1848.severity = none # Title : Call async methods when in an async method @@ -822,7 +830,8 @@ dotnet_diagnostic.CA1851.severity = suggestion # Title : Seal internal types # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1852 -dotnet_diagnostic.CA1852.severity = none +dotnet_diagnostic.CA1852.severity = warning +dotnet_code_quality.CA1852.ignore_internalsvisibleto = true # Title : Unnecessary call to 'Dictionary.ContainsKey(key)' # Category : Performance @@ -852,7 +861,7 @@ dotnet_diagnostic.CA1857.severity = warning # Title : Use 'StartsWith' instead of 'IndexOf' # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1858 -dotnet_diagnostic.CA1858.severity = warning +dotnet_diagnostic.CA1858.severity = suggestion # Title : Use concrete types when possible for improved performance # Category : Performance @@ -862,7 +871,7 @@ dotnet_diagnostic.CA1859.severity = warning # Title : Avoid using 'Enumerable.Any()' extension method # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1860 -dotnet_diagnostic.CA1860.severity = warning +dotnet_diagnostic.CA1860.severity = suggestion # Title : Avoid constant arrays as arguments # Category : Performance @@ -872,17 +881,17 @@ dotnet_diagnostic.CA1861.severity = suggestion # Title : Use the 'StringComparison' method overloads to perform case-insensitive string comparisons # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1862 -dotnet_diagnostic.CA1862.severity = warning +dotnet_diagnostic.CA1862.severity = suggestion # Title : Use 'CompositeFormat' # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1863 -dotnet_diagnostic.CA1863.severity = warning +dotnet_diagnostic.CA1863.severity = none # Title : Prefer the 'IDictionary.TryAdd(TKey, TValue)' method # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1864 -dotnet_diagnostic.CA1864.severity = warning +dotnet_diagnostic.CA1864.severity = suggestion # Title : Use char overload # Category : Performance @@ -902,17 +911,17 @@ dotnet_diagnostic.CA1867.severity = warning # Title : Unnecessary call to 'Contains(item)' # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1868 -dotnet_diagnostic.CA1868.severity = warning +dotnet_diagnostic.CA1868.severity = suggestion # Title : Cache and reuse 'JsonSerializerOptions' instances # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1869 -dotnet_diagnostic.CA1869.severity = warning +dotnet_diagnostic.CA1869.severity = suggestion # Title : Use a cached 'SearchValues' instance # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1870 -dotnet_diagnostic.CA1870.severity = warning +dotnet_diagnostic.CA1870.severity = suggestion # Title : Dispose objects before losing scope # Category : Reliability @@ -928,6 +937,8 @@ dotnet_diagnostic.CA2002.severity = warning # Category : Reliability # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2007 dotnet_diagnostic.CA2007.severity = warning +dotnet_code_quality.CA2007.output_kinds = all +dotnet_code_quality.CA2007.exclude_async_void_methods = false # Title : Do not create tasks without passing a TaskScheduler # Category : Reliability @@ -1048,6 +1059,7 @@ dotnet_diagnostic.CA2207.severity = warning # Category : Usage # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2208 dotnet_diagnostic.CA2208.severity = warning +dotnet_code_quality.CA2208.api_surface = all # Title : Non-constant fields should not be visible # Category : Usage @@ -1111,11 +1123,13 @@ dotnet_diagnostic.CA2229.severity = none # Category : Usage # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2231 dotnet_diagnostic.CA2231.severity = error +dotnet_code_quality.CA2231.api_surface = public # Title : Pass system uri objects instead of strings # Category : Usage # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2234 dotnet_diagnostic.CA2234.severity = warning +dotnet_code_quality.CA2234.api_surface = all # Title : Mark all non-serializable fields # Category : Usage @@ -1133,6 +1147,7 @@ dotnet_diagnostic.CA2237.severity = none # Category : Usage # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2241 dotnet_diagnostic.CA2241.severity = warning +dotnet_code_quality.CA2241.try_determine_additional_string_formatting_methods_automatically = false # Title : Test for NaN correctly # Category : Usage @@ -1850,8 +1865,8 @@ dotnet_diagnostic.IDE0005_gen.severity = none # Title : Use implicit type # Category : Style # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0007 -dotnet_diagnostic.IDE0007.severity = silent -csharp_style_var_elsewhere = true +dotnet_diagnostic.IDE0007.severity = suggestion +csharp_style_var_elsewhere = false csharp_style_var_for_built_in_types = false csharp_style_var_when_type_is_apparent = true @@ -1952,19 +1967,19 @@ csharp_style_expression_bodied_accessors = true # Title : Simplify collection initialization # Category : Style # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0028 -dotnet_diagnostic.IDE0028.severity = warning +dotnet_diagnostic.IDE0028.severity = suggestion dotnet_style_collection_initializer = true # Title : Use coalesce expression # Category : Style # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0029 -dotnet_diagnostic.IDE0029.severity = warning +dotnet_diagnostic.IDE0029.severity = suggestion dotnet_style_coalesce_expression = true # Title : Use coalesce expression # Category : Style # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0030 -dotnet_diagnostic.IDE0030.severity = warning +dotnet_diagnostic.IDE0030.severity = suggestion dotnet_style_coalesce_expression = true # Title : Use null propagation @@ -2300,7 +2315,7 @@ csharp_style_prefer_not_pattern = true # Title : Use 'new(...)' # Category : Style # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0090 -dotnet_diagnostic.IDE0090.severity = warning +dotnet_diagnostic.IDE0090.severity = suggestion csharp_style_implicit_object_creation_when_type_is_apparent = true # Title : Remove redundant equality @@ -2403,7 +2418,8 @@ dotnet_diagnostic.IDE0250.severity = warning # Title : Make member 'readonly' # Category : Style # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0251 -dotnet_diagnostic.IDE0251.severity = none +dotnet_diagnostic.IDE0251.severity = warning +csharp_style_prefer_readonly_struct_members = true # Title : Use pattern matching # Category : Style @@ -2433,7 +2449,7 @@ dotnet_diagnostic.IDE0300.severity = none # Title : Simplify collection initialization # Category : Style # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0301 -dotnet_diagnostic.IDE0301.severity = suggestion +dotnet_diagnostic.IDE0301.severity = none # Title : Simplify collection initialization # Category : Style @@ -2901,7 +2917,7 @@ dotnet_diagnostic.S103.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-104 dotnet_diagnostic.S104.severity = warning -# Title : Destructors should not throw exceptions +# Title : Finalizers should not throw exceptions # Category : Blocker Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1048 # Redundant: CA1065 @@ -2977,7 +2993,7 @@ dotnet_diagnostic.S1110.severity = none # Redundant: SA1106 dotnet_diagnostic.S1116.severity = none -# Title : Local variables should not shadow class fields +# Title : Local variables should not shadow class fields or properties # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1117 dotnet_diagnostic.S1117.severity = warning @@ -3020,6 +3036,11 @@ dotnet_diagnostic.S1128.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-113 dotnet_diagnostic.S113.severity = none +# Title : Deprecated code should be removed +# Category : Info Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-1133 +dotnet_diagnostic.S1133.severity = suggestion + # Title : Track uses of "FIXME" tags # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1134 @@ -3092,7 +3113,7 @@ dotnet_diagnostic.S1192.severity = suggestion # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1199 dotnet_diagnostic.S1199.severity = warning -# Title : Classes should not be coupled to too many other classes (Single Responsibility Principle) +# Title : Classes should not be coupled to too many other classes # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1200 dotnet_diagnostic.S1200.severity = none @@ -3273,7 +3294,7 @@ dotnet_diagnostic.S1699.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1751 dotnet_diagnostic.S1751.severity = warning -# Title : Identical expressions should not be used on both sides of a binary operator +# Title : Identical expressions should not be used on both sides of operators # Category : Major Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1764 dotnet_diagnostic.S1764.severity = warning @@ -3325,7 +3346,7 @@ dotnet_diagnostic.S1939.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1940 dotnet_diagnostic.S1940.severity = warning -# Title : Inappropriate casts should not be made +# Title : Invalid casts should be avoided # Category : Critical Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1944 dotnet_diagnostic.S1944.severity = warning @@ -3362,6 +3383,11 @@ dotnet_diagnostic.S2077.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2092 dotnet_diagnostic.S2092.severity = warning +# Title : Classes should not be empty +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2094 +dotnet_diagnostic.S2094.severity = none + # Title : Collections should not be passed as arguments to their own methods # Category : Major Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2114 @@ -3387,6 +3413,11 @@ dotnet_diagnostic.S2148.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2156 dotnet_diagnostic.S2156.severity = warning +# Title : Classes named like "Exception" should extend "Exception" or a subclass +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2166 +dotnet_diagnostic.S2166.severity = warning + # Title : Short-circuit logic should be used in boolean contexts # Category : Blocker Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2178 @@ -3402,12 +3433,12 @@ dotnet_diagnostic.S2183.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2184 dotnet_diagnostic.S2184.severity = warning -# Title : TestCases should contain tests +# Title : Test classes should contain at least one test case # Category : Blocker Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2187 dotnet_diagnostic.S2187.severity = warning -# Title : Recursion should not be infinite +# Title : Loops and recursions should not be infinite # Category : Blocker Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2190 dotnet_diagnostic.S2190.severity = warning @@ -3417,7 +3448,12 @@ dotnet_diagnostic.S2190.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2197 dotnet_diagnostic.S2197.severity = warning -# Title : Return values from functions without side effects should not be ignored +# Title : Unnecessary mathematical comparisons should not be made +# Category : Critical Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2198 +dotnet_diagnostic.S2198.severity = warning + +# Title : Methods without side effects should not have their return values ignored # Category : Major Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2201 # Redundant: CA1806 @@ -3453,7 +3489,7 @@ dotnet_diagnostic.S2225.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2228 dotnet_diagnostic.S2228.severity = warning -# Title : Parameters should be passed in the correct order +# Title : Arguments should be passed in the same order as the method parameters # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2234 dotnet_diagnostic.S2234.severity = warning @@ -3630,11 +3666,17 @@ dotnet_diagnostic.S2387.severity = warning # Redundant: CA1005 dotnet_diagnostic.S2436.severity = none -# Title : Silly bit operations should not be performed +# Title : Unnecessary bit operations should not be performed # Category : Blocker Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2437 dotnet_diagnostic.S2437.severity = warning +# Title : Blocks should be synchronized on read-only fields +# Category : Major Bug +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2445 +# Comment : Noise +dotnet_diagnostic.S2445.severity = none + # Title : Whitespace and control characters in string literals should be explicit # Category : Critical Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2479 @@ -3648,8 +3690,7 @@ dotnet_diagnostic.S2486.severity = warning # Title : Shared resources should not be used for locking # Category : Critical Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2551 -# Redundant: CA2002 -dotnet_diagnostic.S2551.severity = none +dotnet_diagnostic.S2551.severity = warning # Title : Conditionally executed code should be reachable # Category : Major Bug @@ -3660,7 +3701,8 @@ dotnet_diagnostic.S2583.severity = none # Title : Boolean expressions should not be gratuitous # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2589 -dotnet_diagnostic.S2589.severity = warning +# Comment : Too many false positives. +dotnet_diagnostic.S2589.severity = none # Title : Setting loose file permissions is security-sensitive # Category : Major Security Hotspot @@ -3717,7 +3759,7 @@ dotnet_diagnostic.S2743.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2755 dotnet_diagnostic.S2755.severity = warning -# Title : "=+" should not be used instead of "+=" +# Title : Non-existent operators like "=+" should not be used # Category : Major Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2757 dotnet_diagnostic.S2757.severity = warning @@ -3742,6 +3784,11 @@ dotnet_diagnostic.S2761.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2857 dotnet_diagnostic.S2857.severity = warning +# Title : "Thread.Sleep" should not be used in tests +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2925 +dotnet_diagnostic.S2925.severity = none + # Title : "IDisposables" should be disposed # Category : Blocker Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2930 @@ -3780,6 +3827,11 @@ dotnet_diagnostic.S2953.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2955 dotnet_diagnostic.S2955.severity = warning +# Title : Assertions should be complete +# Category : Blocker Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2970 +dotnet_diagnostic.S2970.severity = warning + # Title : "IEnumerable" LINQs should be simplified # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2971 @@ -3831,6 +3883,11 @@ dotnet_diagnostic.S3059.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3060 dotnet_diagnostic.S3060.severity = warning +# Title : "StringBuilder" data should be used +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-3063 +dotnet_diagnostic.S3063.severity = warning + # Title : "async" methods should not return "void" # Category : Major Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3168 @@ -3888,7 +3945,7 @@ dotnet_diagnostic.S3235.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3236 dotnet_diagnostic.S3236.severity = warning -# Title : "value" parameters should be used +# Title : "value" contextual keyword should be used # Category : Blocker Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3237 dotnet_diagnostic.S3237.severity = warning @@ -3953,12 +4010,13 @@ dotnet_diagnostic.S3256.severity = warning # Title : Declarations and initializations should be as concise as possible # Category : Minor Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3257 -dotnet_diagnostic.S3257.severity = warning +# Comment : Too many false positives +dotnet_diagnostic.S3257.severity = none # Title : Non-derived "private" classes and records should be "sealed" # Category : Minor Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3260 -# Redundant: CA1852 +# Redundant: R9A013 dotnet_diagnostic.S3260.severity = none # Title : Namespaces should not be empty @@ -4022,6 +4080,11 @@ dotnet_diagnostic.S3353.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3358 dotnet_diagnostic.S3358.severity = warning +# Title : Date and time should not be used as a type for primary keys +# Category : Minor Bug +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-3363 +dotnet_diagnostic.S3363.severity = warning + # Title : "this" should not be exposed from constructors # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3366 @@ -4038,6 +4101,11 @@ dotnet_diagnostic.S3376.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3397 dotnet_diagnostic.S3397.severity = warning +# Title : "private" methods called only by inner classes should be moved to those classes +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-3398 +dotnet_diagnostic.S3398.severity = warning + # Title : Methods should not return constants # Category : Minor Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3400 @@ -4048,7 +4116,7 @@ dotnet_diagnostic.S3400.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3415 dotnet_diagnostic.S3415.severity = warning -# Title : Method overloads with default parameter values should not overlap +# Title : Method overloads with default parameter values should not overlap # Category : Blocker Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3427 dotnet_diagnostic.S3427.severity = warning @@ -4246,6 +4314,11 @@ dotnet_diagnostic.S3876.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3877 dotnet_diagnostic.S3877.severity = warning +# Title : Arrays should not be created for params parameters +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-3878 +dotnet_diagnostic.S3878.severity = suggestion + # Title : Finalizers should not be empty # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3880 @@ -4271,7 +4344,7 @@ dotnet_diagnostic.S3885.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3887 dotnet_diagnostic.S3887.severity = warning -# Title : Neither "Thread.Resume" nor "Thread.Suspend" should be used +# Title : "Thread.Resume" and "Thread.Suspend" should not be used # Category : Blocker Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3889 dotnet_diagnostic.S3889.severity = warning @@ -4511,7 +4584,7 @@ dotnet_diagnostic.S4022.severity = warning # Title : Interfaces should not be empty # Category : Minor Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4023 -dotnet_diagnostic.S4023.severity = warning +dotnet_diagnostic.S4023.severity = none # Title : Child class fields should not differ from parent class fields only by capitalization # Category : Critical Code Smell @@ -4649,7 +4722,8 @@ dotnet_diagnostic.S4144.severity = warning # Title : Empty collections should not be accessed or iterated # Category : Minor Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4158 -dotnet_diagnostic.S4158.severity = warning +# Comment : Too many false positives +dotnet_diagnostic.S4158.severity = none # Title : Classes should implement their "ExportAttribute" interfaces # Category : Blocker Bug @@ -4783,6 +4857,11 @@ dotnet_diagnostic.S4507.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4524 dotnet_diagnostic.S4524.severity = warning +# Title : "DebuggerDisplayAttribute" strings should reference existing members +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-4545 +dotnet_diagnostic.S4545.severity = warning + # Title : ASP.NET HTTP request validation feature should not be disabled # Category : Major Vulnerability # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4564 @@ -4803,11 +4882,16 @@ dotnet_diagnostic.S4583.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4586 dotnet_diagnostic.S4586.severity = warning -# Title : String offset-based methods should be preferred for finding substrings from offsets +# Title : Start index should be used instead of calling Substring # Category : Critical Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4635 dotnet_diagnostic.S4635.severity = warning +# Title : Comments should not be empty +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-4663 +dotnet_diagnostic.S4663.severity = suggestion + # Title : Using regular expressions is security-sensitive # Category : Critical Security Hotspot # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4784 @@ -4919,10 +5003,15 @@ dotnet_diagnostic.S5766.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-5773 dotnet_diagnostic.S5773.severity = warning +# Title : Regular expressions should be syntactically valid +# Category : Critical Bug +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-5856 +dotnet_diagnostic.S5856.severity = warning + # Title : Use a testable date/time provider # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-6354 -# Redundant: EA0002 +# Redundant: R9A022 dotnet_diagnostic.S6354.severity = none # Title : Azure Functions should be stateless @@ -4960,6 +5049,119 @@ dotnet_diagnostic.S6424.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-6444 dotnet_diagnostic.S6444.severity = warning +# Title : Blocks should not be synchronized on local variables +# Category : Major Bug +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6507 +# Comment : Too many false positives +dotnet_diagnostic.S6507.severity = none + +# Title : "ExcludeFromCodeCoverage" attributes should include a justification +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6513 +dotnet_diagnostic.S6513.severity = suggestion + +# Title : Avoid using "DateTime.Now" for benchmarking or timing operations +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6561 +dotnet_diagnostic.S6561.severity = warning + +# Title : Always set the "DateTimeKind" when creating new "DateTime" instances +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6562 +# Comment : Noise +dotnet_diagnostic.S6562.severity = none + +# Title : Use UTC when recording DateTime instants +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6563 +dotnet_diagnostic.S6563.severity = none + +# Title : Use "DateTimeOffset" instead of "DateTime" +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6566 +# Comment : Noise +dotnet_diagnostic.S6566.severity = none + +# Title : Use "TimeZoneInfo.FindSystemTimeZoneById" without converting the timezones with "TimezoneConverter" +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6575 +dotnet_diagnostic.S6575.severity = warning + +# Title : Use a format provider when parsing date and time +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6580 +dotnet_diagnostic.S6580.severity = warning + +# Title : Don't hardcode the format when turning dates and times to strings +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6585 +dotnet_diagnostic.S6585.severity = none + +# Title : Use the "UnixEpoch" field instead of creating "DateTime" instances that point to the beginning of the Unix epoch +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6588 +dotnet_diagnostic.S6588.severity = warning + +# Title : "Find" method should be used instead of the "FirstOrDefault" extension +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6602 +dotnet_diagnostic.S6602.severity = warning + +# Title : The collection-specific "TrueForAll" method should be used instead of the "All" extension +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6603 +dotnet_diagnostic.S6603.severity = warning + +# Title : Collection-specific "Exists" method should be used instead of the "Any" extension +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6605 +dotnet_diagnostic.S6605.severity = warning + +# Title : The collection should be filtered before sorting by using "Where" before "OrderBy" +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6607 +dotnet_diagnostic.S6607.severity = warning + +# Title : Prefer indexing instead of "Enumerable" methods on types implementing "IList" +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6608 +dotnet_diagnostic.S6608.severity = warning + +# Title : "Min/Max" properties of "Set" types should be used instead of the "Enumerable" extension methods +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6609 +dotnet_diagnostic.S6609.severity = warning + +# Title : "StartsWith" and "EndsWith" overloads that take a "char" should be used instead of the ones that take a "string" +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6610 +dotnet_diagnostic.S6610.severity = warning + +# Title : The lambda parameter should be used instead of capturing arguments in "ConcurrentDictionary" methods +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6612 +dotnet_diagnostic.S6612.severity = warning + +# Title : "First" and "Last" properties of "LinkedList" should be used instead of the "First()" and "Last()" extension methods +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6613 +dotnet_diagnostic.S6613.severity = warning + +# Title : "Contains" should be used instead of "Any" for simple equality checks +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6617 +dotnet_diagnostic.S6617.severity = warning + +# Title : "string.Create" should be used instead of "FormattableString" +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6618 +dotnet_diagnostic.S6618.severity = warning + +# Title : Using unsafe code blocks is security-sensitive +# Category : Major Security Hotspot +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6640 +dotnet_diagnostic.S6640.severity = warning + # Title : Literal suffixes should be upper case # Category : Minor Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-818 @@ -5005,6 +5207,10 @@ dotnet_diagnostic.S9999-symbolRef.severity = warning # Category : dotnet_diagnostic.S9999-token-type.severity = warning +# Title : Analysis Warning generator +# Category : +dotnet_diagnostic.S9999-warning.severity = warning + # Title : XML comment analysis disabled # Category : StyleCop.CSharp.SpecialRules # Help Link: https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA0001.md @@ -5284,7 +5490,8 @@ dotnet_diagnostic.SA1118.severity = warning # Title : Statement should not use unnecessary parenthesis # Category : StyleCop.CSharp.MaintainabilityRules # Help Link: https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1119.md -dotnet_diagnostic.SA1119.severity = warning +# Redundant: IDE0047 +dotnet_diagnostic.SA1119.severity = none # Title : Statement should not use unnecessary parenthesis # Category : StyleCop.CSharp.MaintainabilityRules @@ -6099,7 +6306,8 @@ dotnet_diagnostic.VSTHRD102.severity = suggestion # Title : Call async methods when in an async method # Category : Usage # Help Link: https://github.com/Microsoft/vs-threading/blob/main/doc/analyzers/VSTHRD103.md -dotnet_diagnostic.VSTHRD103.severity = warning +# Redundant: CA1849 +dotnet_diagnostic.VSTHRD103.severity = none # Title : Offer async methods # Category : Usage diff --git a/src/Libraries/.editorconfig b/src/Libraries/.editorconfig index 30a0b07945d..6df7713e424 100644 --- a/src/Libraries/.editorconfig +++ b/src/Libraries/.editorconfig @@ -1,5 +1,5 @@ # Created by DiagConfig, the diagnostic config generator -# Generated : 2023-10-22 00:37:46Z +# Generated : 2024-01-25 20:57:44Z # Max Tier : 2147483647 # Attributes: api, general, performance, production # Analyzers : ILLink.RoslynAnalyzer, Microsoft.Analyzers.Extra, Microsoft.Analyzers.Local, Microsoft.AspNetCore.App.Analyzers, Microsoft.AspNetCore.Components.Analyzers, Microsoft.CodeAnalysis.CodeStyle, Microsoft.CodeAnalysis.CSharp.CodeStyle, Microsoft.CodeAnalysis.CSharp.NetAnalyzers, Microsoft.CodeAnalysis.NetAnalyzers, Microsoft.VisualStudio.Threading.Analyzers, Microsoft.VisualStudio.Threading.Analyzers.CSharp, SonarAnalyzer.CSharp, StyleCop.Analyzers @@ -108,7 +108,7 @@ dotnet_diagnostic.CA1001.severity = warning # Title : Types that own disposable fields should be disposable # Category : Design # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1001 -dotnet_diagnostic.CA1001.severity = warning +dotnet_diagnostic.CA1001.severity = none # Title : Do not expose generic lists # Category : Design @@ -203,6 +203,7 @@ dotnet_diagnostic.CA1028.severity = none # Category : Design # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1030 dotnet_diagnostic.CA1030.severity = warning +dotnet_code_quality.CA1030.api_surface = public # Title : Do not catch general exception types # Category : Design @@ -228,6 +229,7 @@ dotnet_diagnostic.CA1034.severity = warning # Category : Design # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1036 dotnet_diagnostic.CA1036.severity = warning +dotnet_code_quality.CA1036.api_surface = all # Title : Avoid empty interfaces # Category : Design @@ -286,21 +288,25 @@ dotnet_code_quality.CA1051.api_surface = public # Category : Design # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1052 dotnet_diagnostic.CA1052.severity = warning +dotnet_code_quality.CA1052.api_surface = all # Title : URI-like parameters should not be strings # Category : Design # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1054 dotnet_diagnostic.CA1054.severity = warning +dotnet_code_quality.CA1054.api_surface = public # Title : URI-like return values should not be strings # Category : Design # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1055 dotnet_diagnostic.CA1055.severity = warning +dotnet_code_quality.CA1055.api_surface = public # Title : URI-like properties should not be strings # Category : Design # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1056 dotnet_diagnostic.CA1056.severity = warning +dotnet_code_quality.CA1056.api_surface = public # Title : Types should not extend certain base types # Category : Design @@ -331,6 +337,7 @@ dotnet_code_quality.CA1062.null_check_validation_methods = IfNull|IfNullOrEmpty| # Category : Design # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1063 dotnet_diagnostic.CA1063.severity = warning +dotnet_code_quality.CA1063.api_surface = public # Title : Exceptions should be public # Category : Design @@ -597,6 +604,7 @@ dotnet_code_quality.CA1724.api_surface = public # Category : Naming # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1725 dotnet_diagnostic.CA1725.severity = warning +dotnet_code_quality.CA1725.api_surface = public, protected # Title : Use PascalCase for named placeholders # Category : Naming @@ -619,6 +627,7 @@ dotnet_diagnostic.CA1801.severity = none # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1802 dotnet_diagnostic.CA1802.severity = warning +dotnet_code_quality.CA1802.required_modifiers = static # Title : Use literals where appropriate # Category : Performance @@ -666,6 +675,7 @@ dotnet_diagnostic.CA1814.severity = warning # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1815 dotnet_diagnostic.CA1815.severity = warning +dotnet_code_quality.CA1815.api_surface = public # Title : Dispose methods should call SuppressFinalize # Category : Usage @@ -676,6 +686,7 @@ dotnet_diagnostic.CA1816.severity = warning # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1819 dotnet_diagnostic.CA1819.severity = warning +dotnet_code_quality.CA1819.api_surface = public # Title : Test for empty strings using string length # Category : Performance @@ -691,6 +702,7 @@ dotnet_diagnostic.CA1821.severity = warning # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1822 dotnet_diagnostic.CA1822.severity = warning +dotnet_code_quality.CA1822.api_surface = all # Title : Avoid unused private fields # Category : Performance @@ -821,7 +833,7 @@ dotnet_diagnostic.CA1847.severity = warning # Title : Use the LoggerMessage delegates # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1848 -# Comment : Use the code generated model instead. +# Comment : Use R9 logging model instead dotnet_diagnostic.CA1848.severity = none # Title : Call async methods when in an async method @@ -842,7 +854,8 @@ dotnet_diagnostic.CA1851.severity = suggestion # Title : Seal internal types # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1852 -dotnet_diagnostic.CA1852.severity = none +dotnet_diagnostic.CA1852.severity = warning +dotnet_code_quality.CA1852.ignore_internalsvisibleto = true # Title : Unnecessary call to 'Dictionary.ContainsKey(key)' # Category : Performance @@ -872,7 +885,7 @@ dotnet_diagnostic.CA1857.severity = warning # Title : Use 'StartsWith' instead of 'IndexOf' # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1858 -dotnet_diagnostic.CA1858.severity = warning +dotnet_diagnostic.CA1858.severity = suggestion # Title : Use concrete types when possible for improved performance # Category : Performance @@ -882,7 +895,7 @@ dotnet_diagnostic.CA1859.severity = warning # Title : Avoid using 'Enumerable.Any()' extension method # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1860 -dotnet_diagnostic.CA1860.severity = warning +dotnet_diagnostic.CA1860.severity = suggestion # Title : Avoid constant arrays as arguments # Category : Performance @@ -892,17 +905,17 @@ dotnet_diagnostic.CA1861.severity = suggestion # Title : Use the 'StringComparison' method overloads to perform case-insensitive string comparisons # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1862 -dotnet_diagnostic.CA1862.severity = warning +dotnet_diagnostic.CA1862.severity = suggestion # Title : Use 'CompositeFormat' # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1863 -dotnet_diagnostic.CA1863.severity = warning +dotnet_diagnostic.CA1863.severity = none # Title : Prefer the 'IDictionary.TryAdd(TKey, TValue)' method # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1864 -dotnet_diagnostic.CA1864.severity = warning +dotnet_diagnostic.CA1864.severity = suggestion # Title : Use char overload # Category : Performance @@ -922,17 +935,17 @@ dotnet_diagnostic.CA1867.severity = warning # Title : Unnecessary call to 'Contains(item)' # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1868 -dotnet_diagnostic.CA1868.severity = warning +dotnet_diagnostic.CA1868.severity = suggestion # Title : Cache and reuse 'JsonSerializerOptions' instances # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1869 -dotnet_diagnostic.CA1869.severity = warning +dotnet_diagnostic.CA1869.severity = suggestion # Title : Use a cached 'SearchValues' instance # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1870 -dotnet_diagnostic.CA1870.severity = warning +dotnet_diagnostic.CA1870.severity = suggestion # Title : Dispose objects before losing scope # Category : Reliability @@ -948,6 +961,8 @@ dotnet_diagnostic.CA2002.severity = warning # Category : Reliability # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2007 dotnet_diagnostic.CA2007.severity = warning +dotnet_code_quality.CA2007.output_kinds = all +dotnet_code_quality.CA2007.exclude_async_void_methods = false # Title : Do not create tasks without passing a TaskScheduler # Category : Reliability @@ -1069,6 +1084,7 @@ dotnet_diagnostic.CA2207.severity = warning # Category : Usage # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2208 dotnet_diagnostic.CA2208.severity = warning +dotnet_code_quality.CA2208.api_surface = all # Title : Non-constant fields should not be visible # Category : Usage @@ -1133,11 +1149,13 @@ dotnet_diagnostic.CA2229.severity = none # Category : Usage # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2231 dotnet_diagnostic.CA2231.severity = error +dotnet_code_quality.CA2231.api_surface = public # Title : Pass system uri objects instead of strings # Category : Usage # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2234 dotnet_diagnostic.CA2234.severity = warning +dotnet_code_quality.CA2234.api_surface = all # Title : Mark all non-serializable fields # Category : Usage @@ -1155,6 +1173,7 @@ dotnet_diagnostic.CA2237.severity = none # Category : Usage # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2241 dotnet_diagnostic.CA2241.severity = warning +dotnet_code_quality.CA2241.try_determine_additional_string_formatting_methods_automatically = false # Title : Test for NaN correctly # Category : Usage @@ -1872,8 +1891,8 @@ dotnet_diagnostic.IDE0005_gen.severity = none # Title : Use implicit type # Category : Style # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0007 -dotnet_diagnostic.IDE0007.severity = silent -csharp_style_var_elsewhere = true +dotnet_diagnostic.IDE0007.severity = suggestion +csharp_style_var_elsewhere = false csharp_style_var_for_built_in_types = false csharp_style_var_when_type_is_apparent = true @@ -1974,19 +1993,19 @@ csharp_style_expression_bodied_accessors = true # Title : Simplify collection initialization # Category : Style # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0028 -dotnet_diagnostic.IDE0028.severity = warning +dotnet_diagnostic.IDE0028.severity = suggestion dotnet_style_collection_initializer = true # Title : Use coalesce expression # Category : Style # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0029 -dotnet_diagnostic.IDE0029.severity = warning +dotnet_diagnostic.IDE0029.severity = suggestion dotnet_style_coalesce_expression = true # Title : Use coalesce expression # Category : Style # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0030 -dotnet_diagnostic.IDE0030.severity = warning +dotnet_diagnostic.IDE0030.severity = suggestion dotnet_style_coalesce_expression = true # Title : Use null propagation @@ -2322,7 +2341,7 @@ csharp_style_prefer_not_pattern = true # Title : Use 'new(...)' # Category : Style # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0090 -dotnet_diagnostic.IDE0090.severity = warning +dotnet_diagnostic.IDE0090.severity = suggestion csharp_style_implicit_object_creation_when_type_is_apparent = true # Title : Remove redundant equality @@ -2425,7 +2444,8 @@ dotnet_diagnostic.IDE0250.severity = warning # Title : Make member 'readonly' # Category : Style # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0251 -dotnet_diagnostic.IDE0251.severity = none +dotnet_diagnostic.IDE0251.severity = warning +csharp_style_prefer_readonly_struct_members = true # Title : Use pattern matching # Category : Style @@ -2455,7 +2475,7 @@ dotnet_diagnostic.IDE0300.severity = none # Title : Simplify collection initialization # Category : Style # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0301 -dotnet_diagnostic.IDE0301.severity = suggestion +dotnet_diagnostic.IDE0301.severity = none # Title : Simplify collection initialization # Category : Style @@ -2923,7 +2943,7 @@ dotnet_diagnostic.S103.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-104 dotnet_diagnostic.S104.severity = warning -# Title : Destructors should not throw exceptions +# Title : Finalizers should not throw exceptions # Category : Blocker Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1048 # Redundant: CA1065 @@ -2999,7 +3019,7 @@ dotnet_diagnostic.S1110.severity = none # Redundant: SA1106 dotnet_diagnostic.S1116.severity = none -# Title : Local variables should not shadow class fields +# Title : Local variables should not shadow class fields or properties # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1117 dotnet_diagnostic.S1117.severity = warning @@ -3042,6 +3062,11 @@ dotnet_diagnostic.S1128.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-113 dotnet_diagnostic.S113.severity = none +# Title : Deprecated code should be removed +# Category : Info Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-1133 +dotnet_diagnostic.S1133.severity = suggestion + # Title : Track uses of "FIXME" tags # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1134 @@ -3114,7 +3139,7 @@ dotnet_diagnostic.S1192.severity = suggestion # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1199 dotnet_diagnostic.S1199.severity = warning -# Title : Classes should not be coupled to too many other classes (Single Responsibility Principle) +# Title : Classes should not be coupled to too many other classes # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1200 dotnet_diagnostic.S1200.severity = none @@ -3295,7 +3320,7 @@ dotnet_diagnostic.S1699.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1751 dotnet_diagnostic.S1751.severity = warning -# Title : Identical expressions should not be used on both sides of a binary operator +# Title : Identical expressions should not be used on both sides of operators # Category : Major Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1764 dotnet_diagnostic.S1764.severity = warning @@ -3347,7 +3372,7 @@ dotnet_diagnostic.S1939.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1940 dotnet_diagnostic.S1940.severity = warning -# Title : Inappropriate casts should not be made +# Title : Invalid casts should be avoided # Category : Critical Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1944 dotnet_diagnostic.S1944.severity = warning @@ -3384,6 +3409,11 @@ dotnet_diagnostic.S2077.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2092 dotnet_diagnostic.S2092.severity = warning +# Title : Classes should not be empty +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2094 +dotnet_diagnostic.S2094.severity = none + # Title : Collections should not be passed as arguments to their own methods # Category : Major Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2114 @@ -3409,6 +3439,11 @@ dotnet_diagnostic.S2148.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2156 dotnet_diagnostic.S2156.severity = warning +# Title : Classes named like "Exception" should extend "Exception" or a subclass +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2166 +dotnet_diagnostic.S2166.severity = warning + # Title : Short-circuit logic should be used in boolean contexts # Category : Blocker Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2178 @@ -3424,12 +3459,12 @@ dotnet_diagnostic.S2183.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2184 dotnet_diagnostic.S2184.severity = warning -# Title : TestCases should contain tests +# Title : Test classes should contain at least one test case # Category : Blocker Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2187 dotnet_diagnostic.S2187.severity = warning -# Title : Recursion should not be infinite +# Title : Loops and recursions should not be infinite # Category : Blocker Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2190 dotnet_diagnostic.S2190.severity = warning @@ -3439,7 +3474,12 @@ dotnet_diagnostic.S2190.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2197 dotnet_diagnostic.S2197.severity = warning -# Title : Return values from functions without side effects should not be ignored +# Title : Unnecessary mathematical comparisons should not be made +# Category : Critical Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2198 +dotnet_diagnostic.S2198.severity = warning + +# Title : Methods without side effects should not have their return values ignored # Category : Major Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2201 # Redundant: CA1806 @@ -3475,7 +3515,7 @@ dotnet_diagnostic.S2225.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2228 dotnet_diagnostic.S2228.severity = warning -# Title : Parameters should be passed in the correct order +# Title : Arguments should be passed in the same order as the method parameters # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2234 dotnet_diagnostic.S2234.severity = warning @@ -3652,11 +3692,17 @@ dotnet_diagnostic.S2387.severity = warning # Redundant: CA1005 dotnet_diagnostic.S2436.severity = none -# Title : Silly bit operations should not be performed +# Title : Unnecessary bit operations should not be performed # Category : Blocker Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2437 dotnet_diagnostic.S2437.severity = warning +# Title : Blocks should be synchronized on read-only fields +# Category : Major Bug +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2445 +# Comment : Noise +dotnet_diagnostic.S2445.severity = none + # Title : Whitespace and control characters in string literals should be explicit # Category : Critical Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2479 @@ -3670,8 +3716,7 @@ dotnet_diagnostic.S2486.severity = warning # Title : Shared resources should not be used for locking # Category : Critical Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2551 -# Redundant: CA2002 -dotnet_diagnostic.S2551.severity = none +dotnet_diagnostic.S2551.severity = warning # Title : Conditionally executed code should be reachable # Category : Major Bug @@ -3682,7 +3727,8 @@ dotnet_diagnostic.S2583.severity = none # Title : Boolean expressions should not be gratuitous # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2589 -dotnet_diagnostic.S2589.severity = warning +# Comment : Too many false positives. +dotnet_diagnostic.S2589.severity = none # Title : Setting loose file permissions is security-sensitive # Category : Major Security Hotspot @@ -3739,7 +3785,7 @@ dotnet_diagnostic.S2743.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2755 dotnet_diagnostic.S2755.severity = warning -# Title : "=+" should not be used instead of "+=" +# Title : Non-existent operators like "=+" should not be used # Category : Major Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2757 dotnet_diagnostic.S2757.severity = warning @@ -3764,6 +3810,11 @@ dotnet_diagnostic.S2761.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2857 dotnet_diagnostic.S2857.severity = warning +# Title : "Thread.Sleep" should not be used in tests +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2925 +dotnet_diagnostic.S2925.severity = none + # Title : "IDisposables" should be disposed # Category : Blocker Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2930 @@ -3802,6 +3853,11 @@ dotnet_diagnostic.S2953.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2955 dotnet_diagnostic.S2955.severity = warning +# Title : Assertions should be complete +# Category : Blocker Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2970 +dotnet_diagnostic.S2970.severity = warning + # Title : "IEnumerable" LINQs should be simplified # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2971 @@ -3853,6 +3909,11 @@ dotnet_diagnostic.S3059.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3060 dotnet_diagnostic.S3060.severity = warning +# Title : "StringBuilder" data should be used +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-3063 +dotnet_diagnostic.S3063.severity = warning + # Title : "async" methods should not return "void" # Category : Major Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3168 @@ -3910,7 +3971,7 @@ dotnet_diagnostic.S3235.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3236 dotnet_diagnostic.S3236.severity = warning -# Title : "value" parameters should be used +# Title : "value" contextual keyword should be used # Category : Blocker Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3237 dotnet_diagnostic.S3237.severity = warning @@ -3975,12 +4036,13 @@ dotnet_diagnostic.S3256.severity = warning # Title : Declarations and initializations should be as concise as possible # Category : Minor Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3257 -dotnet_diagnostic.S3257.severity = warning +# Comment : Too many false positives +dotnet_diagnostic.S3257.severity = none # Title : Non-derived "private" classes and records should be "sealed" # Category : Minor Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3260 -# Redundant: CA1852 +# Redundant: R9A013 dotnet_diagnostic.S3260.severity = none # Title : Namespaces should not be empty @@ -4044,6 +4106,11 @@ dotnet_diagnostic.S3353.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3358 dotnet_diagnostic.S3358.severity = warning +# Title : Date and time should not be used as a type for primary keys +# Category : Minor Bug +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-3363 +dotnet_diagnostic.S3363.severity = warning + # Title : "this" should not be exposed from constructors # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3366 @@ -4060,6 +4127,11 @@ dotnet_diagnostic.S3376.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3397 dotnet_diagnostic.S3397.severity = warning +# Title : "private" methods called only by inner classes should be moved to those classes +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-3398 +dotnet_diagnostic.S3398.severity = warning + # Title : Methods should not return constants # Category : Minor Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3400 @@ -4070,7 +4142,7 @@ dotnet_diagnostic.S3400.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3415 dotnet_diagnostic.S3415.severity = warning -# Title : Method overloads with default parameter values should not overlap +# Title : Method overloads with default parameter values should not overlap # Category : Blocker Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3427 dotnet_diagnostic.S3427.severity = warning @@ -4268,6 +4340,11 @@ dotnet_diagnostic.S3876.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3877 dotnet_diagnostic.S3877.severity = warning +# Title : Arrays should not be created for params parameters +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-3878 +dotnet_diagnostic.S3878.severity = suggestion + # Title : Finalizers should not be empty # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3880 @@ -4293,7 +4370,7 @@ dotnet_diagnostic.S3885.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3887 dotnet_diagnostic.S3887.severity = warning -# Title : Neither "Thread.Resume" nor "Thread.Suspend" should be used +# Title : "Thread.Resume" and "Thread.Suspend" should not be used # Category : Blocker Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3889 dotnet_diagnostic.S3889.severity = warning @@ -4533,7 +4610,7 @@ dotnet_diagnostic.S4022.severity = warning # Title : Interfaces should not be empty # Category : Minor Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4023 -dotnet_diagnostic.S4023.severity = warning +dotnet_diagnostic.S4023.severity = suggestion # Title : Child class fields should not differ from parent class fields only by capitalization # Category : Critical Code Smell @@ -4671,7 +4748,8 @@ dotnet_diagnostic.S4144.severity = warning # Title : Empty collections should not be accessed or iterated # Category : Minor Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4158 -dotnet_diagnostic.S4158.severity = warning +# Comment : Too many false positives +dotnet_diagnostic.S4158.severity = none # Title : Classes should implement their "ExportAttribute" interfaces # Category : Blocker Bug @@ -4805,6 +4883,11 @@ dotnet_diagnostic.S4507.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4524 dotnet_diagnostic.S4524.severity = warning +# Title : "DebuggerDisplayAttribute" strings should reference existing members +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-4545 +dotnet_diagnostic.S4545.severity = warning + # Title : ASP.NET HTTP request validation feature should not be disabled # Category : Major Vulnerability # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4564 @@ -4825,11 +4908,16 @@ dotnet_diagnostic.S4583.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4586 dotnet_diagnostic.S4586.severity = warning -# Title : String offset-based methods should be preferred for finding substrings from offsets +# Title : Start index should be used instead of calling Substring # Category : Critical Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4635 dotnet_diagnostic.S4635.severity = warning +# Title : Comments should not be empty +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-4663 +dotnet_diagnostic.S4663.severity = suggestion + # Title : Using regular expressions is security-sensitive # Category : Critical Security Hotspot # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4784 @@ -4941,10 +5029,15 @@ dotnet_diagnostic.S5766.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-5773 dotnet_diagnostic.S5773.severity = warning +# Title : Regular expressions should be syntactically valid +# Category : Critical Bug +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-5856 +dotnet_diagnostic.S5856.severity = warning + # Title : Use a testable date/time provider # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-6354 -# Redundant: EA0002 +# Redundant: R9A022 dotnet_diagnostic.S6354.severity = none # Title : Azure Functions should be stateless @@ -4982,6 +5075,119 @@ dotnet_diagnostic.S6424.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-6444 dotnet_diagnostic.S6444.severity = warning +# Title : Blocks should not be synchronized on local variables +# Category : Major Bug +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6507 +# Comment : Too many false positives +dotnet_diagnostic.S6507.severity = none + +# Title : "ExcludeFromCodeCoverage" attributes should include a justification +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6513 +dotnet_diagnostic.S6513.severity = suggestion + +# Title : Avoid using "DateTime.Now" for benchmarking or timing operations +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6561 +dotnet_diagnostic.S6561.severity = warning + +# Title : Always set the "DateTimeKind" when creating new "DateTime" instances +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6562 +# Comment : Noise +dotnet_diagnostic.S6562.severity = none + +# Title : Use UTC when recording DateTime instants +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6563 +dotnet_diagnostic.S6563.severity = none + +# Title : Use "DateTimeOffset" instead of "DateTime" +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6566 +# Comment : Noise +dotnet_diagnostic.S6566.severity = none + +# Title : Use "TimeZoneInfo.FindSystemTimeZoneById" without converting the timezones with "TimezoneConverter" +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6575 +dotnet_diagnostic.S6575.severity = warning + +# Title : Use a format provider when parsing date and time +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6580 +dotnet_diagnostic.S6580.severity = warning + +# Title : Don't hardcode the format when turning dates and times to strings +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6585 +dotnet_diagnostic.S6585.severity = none + +# Title : Use the "UnixEpoch" field instead of creating "DateTime" instances that point to the beginning of the Unix epoch +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6588 +dotnet_diagnostic.S6588.severity = warning + +# Title : "Find" method should be used instead of the "FirstOrDefault" extension +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6602 +dotnet_diagnostic.S6602.severity = warning + +# Title : The collection-specific "TrueForAll" method should be used instead of the "All" extension +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6603 +dotnet_diagnostic.S6603.severity = warning + +# Title : Collection-specific "Exists" method should be used instead of the "Any" extension +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6605 +dotnet_diagnostic.S6605.severity = warning + +# Title : The collection should be filtered before sorting by using "Where" before "OrderBy" +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6607 +dotnet_diagnostic.S6607.severity = warning + +# Title : Prefer indexing instead of "Enumerable" methods on types implementing "IList" +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6608 +dotnet_diagnostic.S6608.severity = warning + +# Title : "Min/Max" properties of "Set" types should be used instead of the "Enumerable" extension methods +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6609 +dotnet_diagnostic.S6609.severity = warning + +# Title : "StartsWith" and "EndsWith" overloads that take a "char" should be used instead of the ones that take a "string" +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6610 +dotnet_diagnostic.S6610.severity = warning + +# Title : The lambda parameter should be used instead of capturing arguments in "ConcurrentDictionary" methods +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6612 +dotnet_diagnostic.S6612.severity = warning + +# Title : "First" and "Last" properties of "LinkedList" should be used instead of the "First()" and "Last()" extension methods +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6613 +dotnet_diagnostic.S6613.severity = warning + +# Title : "Contains" should be used instead of "Any" for simple equality checks +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6617 +dotnet_diagnostic.S6617.severity = warning + +# Title : "string.Create" should be used instead of "FormattableString" +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6618 +dotnet_diagnostic.S6618.severity = warning + +# Title : Using unsafe code blocks is security-sensitive +# Category : Major Security Hotspot +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6640 +dotnet_diagnostic.S6640.severity = warning + # Title : Literal suffixes should be upper case # Category : Minor Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-818 @@ -5027,6 +5233,10 @@ dotnet_diagnostic.S9999-symbolRef.severity = warning # Category : dotnet_diagnostic.S9999-token-type.severity = warning +# Title : Analysis Warning generator +# Category : +dotnet_diagnostic.S9999-warning.severity = warning + # Title : XML comment analysis disabled # Category : StyleCop.CSharp.SpecialRules # Help Link: https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA0001.md @@ -5306,7 +5516,8 @@ dotnet_diagnostic.SA1118.severity = warning # Title : Statement should not use unnecessary parenthesis # Category : StyleCop.CSharp.MaintainabilityRules # Help Link: https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1119.md -dotnet_diagnostic.SA1119.severity = warning +# Redundant: IDE0047 +dotnet_diagnostic.SA1119.severity = none # Title : Statement should not use unnecessary parenthesis # Category : StyleCop.CSharp.MaintainabilityRules @@ -6121,7 +6332,8 @@ dotnet_diagnostic.VSTHRD102.severity = suggestion # Title : Call async methods when in an async method # Category : Usage # Help Link: https://github.com/Microsoft/vs-threading/blob/main/doc/analyzers/VSTHRD103.md -dotnet_diagnostic.VSTHRD103.severity = warning +# Redundant: CA1849 +dotnet_diagnostic.VSTHRD103.severity = none # Title : Offer async methods # Category : Usage diff --git a/src/Libraries/Microsoft.Extensions.Http.Resilience/Hedging/ResilienceHttpClientBuilderExtensions.Hedging.cs b/src/Libraries/Microsoft.Extensions.Http.Resilience/Hedging/ResilienceHttpClientBuilderExtensions.Hedging.cs index b4ffb70eb7d..8e789e400cc 100644 --- a/src/Libraries/Microsoft.Extensions.Http.Resilience/Hedging/ResilienceHttpClientBuilderExtensions.Hedging.cs +++ b/src/Libraries/Microsoft.Extensions.Http.Resilience/Hedging/ResilienceHttpClientBuilderExtensions.Hedging.cs @@ -146,7 +146,7 @@ public static IStandardHedgingHandlerBuilder AddStandardHedgingHandler(this IHtt return new StandardHedgingHandlerBuilder(builder.Name, builder.Services, routingBuilder); } - private record StandardHedgingHandlerBuilder( + private sealed record StandardHedgingHandlerBuilder( string Name, IServiceCollection Services, IRoutingStrategyBuilder RoutingStrategyBuilder) : IStandardHedgingHandlerBuilder; diff --git a/src/Libraries/Microsoft.Extensions.Http.Resilience/Internal/HttpKey.cs b/src/Libraries/Microsoft.Extensions.Http.Resilience/Internal/HttpKey.cs index 9ce06c3875d..7776054a630 100644 --- a/src/Libraries/Microsoft.Extensions.Http.Resilience/Internal/HttpKey.cs +++ b/src/Libraries/Microsoft.Extensions.Http.Resilience/Internal/HttpKey.cs @@ -11,7 +11,7 @@ internal readonly record struct HttpKey(string Name, string InstanceName) { public static readonly IEqualityComparer BuilderComparer = new BuilderEqualityComparer(); - private class BuilderEqualityComparer : IEqualityComparer + private sealed class BuilderEqualityComparer : IEqualityComparer { public bool Equals(HttpKey x, HttpKey y) => StringComparer.Ordinal.Equals(x.Name, y.Name); diff --git a/src/Libraries/Microsoft.Extensions.Http.Resilience/Internal/Randomizer.cs b/src/Libraries/Microsoft.Extensions.Http.Resilience/Internal/Randomizer.cs index 89f248d835e..bf9fba95ebb 100644 --- a/src/Libraries/Microsoft.Extensions.Http.Resilience/Internal/Randomizer.cs +++ b/src/Libraries/Microsoft.Extensions.Http.Resilience/Internal/Randomizer.cs @@ -7,6 +7,7 @@ namespace Microsoft.Extensions.Http.Resilience.Internal; #pragma warning disable CA5394 // Do not use insecure randomness +#pragma warning disable CA1852 // Seal internal types internal class Randomizer { diff --git a/src/Libraries/Microsoft.Extensions.Http.Resilience/Resilience/ResilienceHttpClientBuilderExtensions.Resilience.cs b/src/Libraries/Microsoft.Extensions.Http.Resilience/Resilience/ResilienceHttpClientBuilderExtensions.Resilience.cs index e78f4130690..1829aefa101 100644 --- a/src/Libraries/Microsoft.Extensions.Http.Resilience/Resilience/ResilienceHttpClientBuilderExtensions.Resilience.cs +++ b/src/Libraries/Microsoft.Extensions.Http.Resilience/Resilience/ResilienceHttpClientBuilderExtensions.Resilience.cs @@ -150,5 +150,5 @@ private sealed class Marker public static readonly ServiceDescriptor ServiceDescriptor = ServiceDescriptor.Singleton(); } - private record HttpResiliencePipelineBuilder(string PipelineName, IServiceCollection Services) : IHttpResiliencePipelineBuilder; + private sealed record HttpResiliencePipelineBuilder(string PipelineName, IServiceCollection Services) : IHttpResiliencePipelineBuilder; } diff --git a/src/Libraries/Microsoft.Extensions.Http.Resilience/Resilience/ResilienceHttpClientBuilderExtensions.StandardResilience.cs b/src/Libraries/Microsoft.Extensions.Http.Resilience/Resilience/ResilienceHttpClientBuilderExtensions.StandardResilience.cs index 06003b80c3f..a4315eaa006 100644 --- a/src/Libraries/Microsoft.Extensions.Http.Resilience/Resilience/ResilienceHttpClientBuilderExtensions.StandardResilience.cs +++ b/src/Libraries/Microsoft.Extensions.Http.Resilience/Resilience/ResilienceHttpClientBuilderExtensions.StandardResilience.cs @@ -93,5 +93,5 @@ public static IHttpStandardResiliencePipelineBuilder AddStandardResilienceHandle return new HttpStandardResiliencePipelineBuilder(optionsName, builder.Services); } - private record HttpStandardResiliencePipelineBuilder(string PipelineName, IServiceCollection Services) : IHttpStandardResiliencePipelineBuilder; + private sealed record HttpStandardResiliencePipelineBuilder(string PipelineName, IServiceCollection Services) : IHttpStandardResiliencePipelineBuilder; } diff --git a/src/Libraries/Microsoft.Extensions.Http.Resilience/Routing/Internal/RequestRoutingOptions.cs b/src/Libraries/Microsoft.Extensions.Http.Resilience/Routing/Internal/RequestRoutingOptions.cs index 9f1bc21f960..505cfae9db1 100644 --- a/src/Libraries/Microsoft.Extensions.Http.Resilience/Routing/Internal/RequestRoutingOptions.cs +++ b/src/Libraries/Microsoft.Extensions.Http.Resilience/Routing/Internal/RequestRoutingOptions.cs @@ -5,7 +5,7 @@ namespace Microsoft.Extensions.Http.Resilience.Routing.Internal; -internal class RequestRoutingOptions +internal sealed class RequestRoutingOptions { public Func? RoutingStrategyProvider { get; set; } } diff --git a/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/Benchmark-Tier1.globalconfig b/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/Benchmark-Tier1.globalconfig index e03e875307b..8b933e32e7b 100644 --- a/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/Benchmark-Tier1.globalconfig +++ b/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/Benchmark-Tier1.globalconfig @@ -1,5 +1,5 @@ # Created by DiagConfig, the diagnostic config generator -# Generated : 2023-10-22 00:37:51Z +# Generated : 2024-01-25 20:57:49Z # Max Tier : 1 # Attributes: general, performance # Analyzers : ILLink.RoslynAnalyzer, Microsoft.Analyzers.Extra, Microsoft.Analyzers.Local, Microsoft.AspNetCore.App.Analyzers, Microsoft.AspNetCore.Components.Analyzers, Microsoft.CodeAnalysis.CSharp.NetAnalyzers, Microsoft.CodeAnalysis.NetAnalyzers, Microsoft.VisualStudio.Threading.Analyzers, Microsoft.VisualStudio.Threading.Analyzers.CSharp, SonarAnalyzer.CSharp @@ -309,6 +309,7 @@ dotnet_diagnostic.CA1062.severity = none # Category : Design # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1063 dotnet_diagnostic.CA1063.severity = warning +dotnet_code_quality.CA1063.api_surface = public # Title : Exceptions should be public # Category : Design @@ -828,7 +829,7 @@ dotnet_diagnostic.CA1857.severity = warning # Title : Use 'StartsWith' instead of 'IndexOf' # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1858 -dotnet_diagnostic.CA1858.severity = warning +dotnet_diagnostic.CA1858.severity = suggestion # Title : Use concrete types when possible for improved performance # Category : Performance @@ -838,7 +839,7 @@ dotnet_diagnostic.CA1859.severity = warning # Title : Avoid using 'Enumerable.Any()' extension method # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1860 -dotnet_diagnostic.CA1860.severity = warning +dotnet_diagnostic.CA1860.severity = suggestion # Title : Avoid constant arrays as arguments # Category : Performance @@ -848,17 +849,17 @@ dotnet_diagnostic.CA1861.severity = suggestion # Title : Use the 'StringComparison' method overloads to perform case-insensitive string comparisons # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1862 -dotnet_diagnostic.CA1862.severity = warning +dotnet_diagnostic.CA1862.severity = suggestion # Title : Use 'CompositeFormat' # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1863 -dotnet_diagnostic.CA1863.severity = warning +dotnet_diagnostic.CA1863.severity = none # Title : Prefer the 'IDictionary.TryAdd(TKey, TValue)' method # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1864 -dotnet_diagnostic.CA1864.severity = warning +dotnet_diagnostic.CA1864.severity = suggestion # Title : Use char overload # Category : Performance @@ -878,17 +879,17 @@ dotnet_diagnostic.CA1867.severity = warning # Title : Unnecessary call to 'Contains(item)' # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1868 -dotnet_diagnostic.CA1868.severity = warning +dotnet_diagnostic.CA1868.severity = suggestion # Title : Cache and reuse 'JsonSerializerOptions' instances # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1869 -dotnet_diagnostic.CA1869.severity = warning +dotnet_diagnostic.CA1869.severity = suggestion # Title : Use a cached 'SearchValues' instance # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1870 -dotnet_diagnostic.CA1870.severity = warning +dotnet_diagnostic.CA1870.severity = suggestion # Title : Dispose objects before losing scope # Category : Reliability @@ -1105,6 +1106,7 @@ dotnet_diagnostic.CA2237.severity = none # Category : Usage # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2241 dotnet_diagnostic.CA2241.severity = warning +dotnet_code_quality.CA2241.try_determine_additional_string_formatting_methods_automatically = false # Title : Test for NaN correctly # Category : Usage @@ -2095,7 +2097,7 @@ dotnet_diagnostic.S103.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-104 dotnet_diagnostic.S104.severity = none -# Title : Destructors should not throw exceptions +# Title : Finalizers should not throw exceptions # Category : Blocker Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1048 # Redundant: CA1065 @@ -2166,7 +2168,7 @@ dotnet_diagnostic.S1110.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1116 dotnet_diagnostic.S1116.severity = none -# Title : Local variables should not shadow class fields +# Title : Local variables should not shadow class fields or properties # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1117 dotnet_diagnostic.S1117.severity = warning @@ -2206,6 +2208,11 @@ dotnet_diagnostic.S1128.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-113 dotnet_diagnostic.S113.severity = none +# Title : Deprecated code should be removed +# Category : Info Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-1133 +dotnet_diagnostic.S1133.severity = suggestion + # Title : Track uses of "FIXME" tags # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1134 @@ -2277,7 +2284,7 @@ dotnet_diagnostic.S1192.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1199 dotnet_diagnostic.S1199.severity = none -# Title : Classes should not be coupled to too many other classes (Single Responsibility Principle) +# Title : Classes should not be coupled to too many other classes # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1200 dotnet_diagnostic.S1200.severity = none @@ -2454,7 +2461,7 @@ dotnet_diagnostic.S1699.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1751 dotnet_diagnostic.S1751.severity = warning -# Title : Identical expressions should not be used on both sides of a binary operator +# Title : Identical expressions should not be used on both sides of operators # Category : Major Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1764 dotnet_diagnostic.S1764.severity = warning @@ -2505,7 +2512,7 @@ dotnet_diagnostic.S1939.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1940 dotnet_diagnostic.S1940.severity = none -# Title : Inappropriate casts should not be made +# Title : Invalid casts should be avoided # Category : Critical Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1944 dotnet_diagnostic.S1944.severity = warning @@ -2542,6 +2549,11 @@ dotnet_diagnostic.S2077.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2092 dotnet_diagnostic.S2092.severity = none +# Title : Classes should not be empty +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2094 +dotnet_diagnostic.S2094.severity = none + # Title : Collections should not be passed as arguments to their own methods # Category : Major Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2114 @@ -2567,6 +2579,11 @@ dotnet_diagnostic.S2148.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2156 dotnet_diagnostic.S2156.severity = none +# Title : Classes named like "Exception" should extend "Exception" or a subclass +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2166 +dotnet_diagnostic.S2166.severity = warning + # Title : Short-circuit logic should be used in boolean contexts # Category : Blocker Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2178 @@ -2582,12 +2599,12 @@ dotnet_diagnostic.S2183.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2184 dotnet_diagnostic.S2184.severity = none -# Title : TestCases should contain tests +# Title : Test classes should contain at least one test case # Category : Blocker Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2187 dotnet_diagnostic.S2187.severity = none -# Title : Recursion should not be infinite +# Title : Loops and recursions should not be infinite # Category : Blocker Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2190 dotnet_diagnostic.S2190.severity = none @@ -2597,7 +2614,12 @@ dotnet_diagnostic.S2190.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2197 dotnet_diagnostic.S2197.severity = warning -# Title : Return values from functions without side effects should not be ignored +# Title : Unnecessary mathematical comparisons should not be made +# Category : Critical Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2198 +dotnet_diagnostic.S2198.severity = warning + +# Title : Methods without side effects should not have their return values ignored # Category : Major Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2201 # Redundant: CA1806 @@ -2633,7 +2655,7 @@ dotnet_diagnostic.S2225.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2228 dotnet_diagnostic.S2228.severity = none -# Title : Parameters should be passed in the correct order +# Title : Arguments should be passed in the same order as the method parameters # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2234 dotnet_diagnostic.S2234.severity = warning @@ -2807,11 +2829,17 @@ dotnet_diagnostic.S2387.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2436 dotnet_diagnostic.S2436.severity = none -# Title : Silly bit operations should not be performed +# Title : Unnecessary bit operations should not be performed # Category : Blocker Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2437 dotnet_diagnostic.S2437.severity = warning +# Title : Blocks should be synchronized on read-only fields +# Category : Major Bug +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2445 +# Comment : Noise +dotnet_diagnostic.S2445.severity = none + # Title : Whitespace and control characters in string literals should be explicit # Category : Critical Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2479 @@ -2825,8 +2853,7 @@ dotnet_diagnostic.S2486.severity = none # Title : Shared resources should not be used for locking # Category : Critical Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2551 -# Redundant: CA2002 -dotnet_diagnostic.S2551.severity = none +dotnet_diagnostic.S2551.severity = warning # Title : Conditionally executed code should be reachable # Category : Major Bug @@ -2837,7 +2864,8 @@ dotnet_diagnostic.S2583.severity = none # Title : Boolean expressions should not be gratuitous # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2589 -dotnet_diagnostic.S2589.severity = warning +# Comment : Too many false positives. +dotnet_diagnostic.S2589.severity = none # Title : Setting loose file permissions is security-sensitive # Category : Major Security Hotspot @@ -2894,7 +2922,7 @@ dotnet_diagnostic.S2743.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2755 dotnet_diagnostic.S2755.severity = warning -# Title : "=+" should not be used instead of "+=" +# Title : Non-existent operators like "=+" should not be used # Category : Major Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2757 dotnet_diagnostic.S2757.severity = warning @@ -2919,6 +2947,11 @@ dotnet_diagnostic.S2761.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2857 dotnet_diagnostic.S2857.severity = warning +# Title : "Thread.Sleep" should not be used in tests +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2925 +dotnet_diagnostic.S2925.severity = none + # Title : "IDisposables" should be disposed # Category : Blocker Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2930 @@ -2957,6 +2990,11 @@ dotnet_diagnostic.S2953.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2955 dotnet_diagnostic.S2955.severity = none +# Title : Assertions should be complete +# Category : Blocker Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2970 +dotnet_diagnostic.S2970.severity = warning + # Title : "IEnumerable" LINQs should be simplified # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2971 @@ -3007,6 +3045,11 @@ dotnet_diagnostic.S3059.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3060 dotnet_diagnostic.S3060.severity = none +# Title : "StringBuilder" data should be used +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-3063 +dotnet_diagnostic.S3063.severity = warning + # Title : "async" methods should not return "void" # Category : Major Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3168 @@ -3063,7 +3106,7 @@ dotnet_diagnostic.S3235.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3236 dotnet_diagnostic.S3236.severity = none -# Title : "value" parameters should be used +# Title : "value" contextual keyword should be used # Category : Blocker Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3237 dotnet_diagnostic.S3237.severity = warning @@ -3194,6 +3237,11 @@ dotnet_diagnostic.S3353.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3358 dotnet_diagnostic.S3358.severity = warning +# Title : Date and time should not be used as a type for primary keys +# Category : Minor Bug +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-3363 +dotnet_diagnostic.S3363.severity = warning + # Title : "this" should not be exposed from constructors # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3366 @@ -3210,6 +3258,11 @@ dotnet_diagnostic.S3376.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3397 dotnet_diagnostic.S3397.severity = none +# Title : "private" methods called only by inner classes should be moved to those classes +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-3398 +dotnet_diagnostic.S3398.severity = warning + # Title : Methods should not return constants # Category : Minor Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3400 @@ -3220,7 +3273,7 @@ dotnet_diagnostic.S3400.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3415 dotnet_diagnostic.S3415.severity = warning -# Title : Method overloads with default parameter values should not overlap +# Title : Method overloads with default parameter values should not overlap # Category : Blocker Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3427 dotnet_diagnostic.S3427.severity = warning @@ -3416,6 +3469,11 @@ dotnet_diagnostic.S3876.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3877 dotnet_diagnostic.S3877.severity = none +# Title : Arrays should not be created for params parameters +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-3878 +dotnet_diagnostic.S3878.severity = suggestion + # Title : Finalizers should not be empty # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3880 @@ -3441,7 +3499,7 @@ dotnet_diagnostic.S3885.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3887 dotnet_diagnostic.S3887.severity = warning -# Title : Neither "Thread.Resume" nor "Thread.Suspend" should be used +# Title : "Thread.Resume" and "Thread.Suspend" should not be used # Category : Blocker Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3889 dotnet_diagnostic.S3889.severity = warning @@ -3940,6 +3998,11 @@ dotnet_diagnostic.S4507.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4524 dotnet_diagnostic.S4524.severity = warning +# Title : "DebuggerDisplayAttribute" strings should reference existing members +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-4545 +dotnet_diagnostic.S4545.severity = warning + # Title : ASP.NET HTTP request validation feature should not be disabled # Category : Major Vulnerability # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4564 @@ -3960,11 +4023,16 @@ dotnet_diagnostic.S4583.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4586 dotnet_diagnostic.S4586.severity = warning -# Title : String offset-based methods should be preferred for finding substrings from offsets +# Title : Start index should be used instead of calling Substring # Category : Critical Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4635 dotnet_diagnostic.S4635.severity = warning +# Title : Comments should not be empty +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-4663 +dotnet_diagnostic.S4663.severity = none + # Title : Using regular expressions is security-sensitive # Category : Critical Security Hotspot # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4784 @@ -4076,10 +4144,15 @@ dotnet_diagnostic.S5766.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-5773 dotnet_diagnostic.S5773.severity = none +# Title : Regular expressions should be syntactically valid +# Category : Critical Bug +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-5856 +dotnet_diagnostic.S5856.severity = warning + # Title : Use a testable date/time provider # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-6354 -# Redundant: EA0002 +# Redundant: R9A022 dotnet_diagnostic.S6354.severity = none # Title : Azure Functions should be stateless @@ -4115,7 +4188,120 @@ dotnet_diagnostic.S6424.severity = none # Title : Not specifying a timeout for regular expressions is security-sensitive # Category : Major Security Hotspot # Help Link: https://rules.sonarsource.com/csharp/RSPEC-6444 -dotnet_diagnostic.S6444.severity = warning +dotnet_diagnostic.S6444.severity = none + +# Title : Blocks should not be synchronized on local variables +# Category : Major Bug +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6507 +# Comment : Too many false positives +dotnet_diagnostic.S6507.severity = none + +# Title : "ExcludeFromCodeCoverage" attributes should include a justification +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6513 +dotnet_diagnostic.S6513.severity = suggestion + +# Title : Avoid using "DateTime.Now" for benchmarking or timing operations +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6561 +dotnet_diagnostic.S6561.severity = warning + +# Title : Always set the "DateTimeKind" when creating new "DateTime" instances +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6562 +# Comment : Noise +dotnet_diagnostic.S6562.severity = none + +# Title : Use UTC when recording DateTime instants +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6563 +dotnet_diagnostic.S6563.severity = none + +# Title : Use "DateTimeOffset" instead of "DateTime" +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6566 +# Comment : Noise +dotnet_diagnostic.S6566.severity = none + +# Title : Use "TimeZoneInfo.FindSystemTimeZoneById" without converting the timezones with "TimezoneConverter" +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6575 +dotnet_diagnostic.S6575.severity = warning + +# Title : Use a format provider when parsing date and time +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6580 +dotnet_diagnostic.S6580.severity = warning + +# Title : Don't hardcode the format when turning dates and times to strings +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6585 +dotnet_diagnostic.S6585.severity = none + +# Title : Use the "UnixEpoch" field instead of creating "DateTime" instances that point to the beginning of the Unix epoch +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6588 +dotnet_diagnostic.S6588.severity = warning + +# Title : "Find" method should be used instead of the "FirstOrDefault" extension +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6602 +dotnet_diagnostic.S6602.severity = warning + +# Title : The collection-specific "TrueForAll" method should be used instead of the "All" extension +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6603 +dotnet_diagnostic.S6603.severity = warning + +# Title : Collection-specific "Exists" method should be used instead of the "Any" extension +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6605 +dotnet_diagnostic.S6605.severity = warning + +# Title : The collection should be filtered before sorting by using "Where" before "OrderBy" +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6607 +dotnet_diagnostic.S6607.severity = warning + +# Title : Prefer indexing instead of "Enumerable" methods on types implementing "IList" +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6608 +dotnet_diagnostic.S6608.severity = warning + +# Title : "Min/Max" properties of "Set" types should be used instead of the "Enumerable" extension methods +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6609 +dotnet_diagnostic.S6609.severity = warning + +# Title : "StartsWith" and "EndsWith" overloads that take a "char" should be used instead of the ones that take a "string" +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6610 +dotnet_diagnostic.S6610.severity = warning + +# Title : The lambda parameter should be used instead of capturing arguments in "ConcurrentDictionary" methods +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6612 +dotnet_diagnostic.S6612.severity = warning + +# Title : "First" and "Last" properties of "LinkedList" should be used instead of the "First()" and "Last()" extension methods +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6613 +dotnet_diagnostic.S6613.severity = warning + +# Title : "Contains" should be used instead of "Any" for simple equality checks +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6617 +dotnet_diagnostic.S6617.severity = warning + +# Title : "string.Create" should be used instead of "FormattableString" +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6618 +dotnet_diagnostic.S6618.severity = warning + +# Title : Using unsafe code blocks is security-sensitive +# Category : Major Security Hotspot +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6640 +dotnet_diagnostic.S6640.severity = warning # Title : Literal suffixes should be upper case # Category : Minor Code Smell @@ -4162,6 +4348,10 @@ dotnet_diagnostic.S9999-symbolRef.severity = warning # Category : dotnet_diagnostic.S9999-token-type.severity = warning +# Title : Analysis Warning generator +# Category : +dotnet_diagnostic.S9999-warning.severity = warning + # Title : Avoid legacy thread switching APIs # Category : Usage # Help Link: https://github.com/Microsoft/vs-threading/blob/main/doc/analyzers/VSTHRD001.md @@ -4215,7 +4405,8 @@ dotnet_diagnostic.VSTHRD102.severity = none # Title : Call async methods when in an async method # Category : Usage # Help Link: https://github.com/Microsoft/vs-threading/blob/main/doc/analyzers/VSTHRD103.md -dotnet_diagnostic.VSTHRD103.severity = warning +# Redundant: CA1849 +dotnet_diagnostic.VSTHRD103.severity = none # Title : Offer async methods # Category : Usage diff --git a/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/Benchmark-Tier2.globalconfig b/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/Benchmark-Tier2.globalconfig index 0dcd9c2e177..97f83a3dbff 100644 --- a/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/Benchmark-Tier2.globalconfig +++ b/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/Benchmark-Tier2.globalconfig @@ -1,5 +1,5 @@ # Created by DiagConfig, the diagnostic config generator -# Generated : 2023-10-22 00:37:55Z +# Generated : 2024-01-25 20:57:52Z # Max Tier : 2 # Attributes: general, performance # Analyzers : ILLink.RoslynAnalyzer, Microsoft.Analyzers.Extra, Microsoft.Analyzers.Local, Microsoft.AspNetCore.App.Analyzers, Microsoft.AspNetCore.Components.Analyzers, Microsoft.CodeAnalysis.CSharp.NetAnalyzers, Microsoft.CodeAnalysis.NetAnalyzers, Microsoft.VisualStudio.Threading.Analyzers, Microsoft.VisualStudio.Threading.Analyzers.CSharp, SonarAnalyzer.CSharp @@ -108,7 +108,7 @@ dotnet_diagnostic.CA1001.severity = warning # Title : Types that own disposable fields should be disposable # Category : Design # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1001 -dotnet_diagnostic.CA1001.severity = warning +dotnet_diagnostic.CA1001.severity = none # Title : Do not expose generic lists # Category : Design @@ -313,6 +313,7 @@ dotnet_diagnostic.CA1062.severity = none # Category : Design # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1063 dotnet_diagnostic.CA1063.severity = warning +dotnet_code_quality.CA1063.api_surface = public # Title : Exceptions should be public # Category : Design @@ -588,6 +589,7 @@ dotnet_diagnostic.CA1801.severity = none # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1802 dotnet_diagnostic.CA1802.severity = warning +dotnet_code_quality.CA1802.required_modifiers = static # Title : Use literals where appropriate # Category : Performance @@ -635,6 +637,7 @@ dotnet_diagnostic.CA1814.severity = none # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1815 dotnet_diagnostic.CA1815.severity = warning +dotnet_code_quality.CA1815.api_surface = public # Title : Dispose methods should call SuppressFinalize # Category : Usage @@ -645,6 +648,7 @@ dotnet_diagnostic.CA1816.severity = none # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1819 dotnet_diagnostic.CA1819.severity = warning +dotnet_code_quality.CA1819.api_surface = public # Title : Test for empty strings using string length # Category : Performance @@ -660,6 +664,7 @@ dotnet_diagnostic.CA1821.severity = none # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1822 dotnet_diagnostic.CA1822.severity = warning +dotnet_code_quality.CA1822.api_surface = all # Title : Avoid unused private fields # Category : Performance @@ -789,7 +794,7 @@ dotnet_diagnostic.CA1847.severity = none # Title : Use the LoggerMessage delegates # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1848 -# Comment : Use the code generated model instead. +# Comment : Use R9 logging model instead dotnet_diagnostic.CA1848.severity = none # Title : Call async methods when in an async method @@ -810,7 +815,8 @@ dotnet_diagnostic.CA1851.severity = suggestion # Title : Seal internal types # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1852 -dotnet_diagnostic.CA1852.severity = none +dotnet_diagnostic.CA1852.severity = warning +dotnet_code_quality.CA1852.ignore_internalsvisibleto = true # Title : Unnecessary call to 'Dictionary.ContainsKey(key)' # Category : Performance @@ -840,7 +846,7 @@ dotnet_diagnostic.CA1857.severity = warning # Title : Use 'StartsWith' instead of 'IndexOf' # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1858 -dotnet_diagnostic.CA1858.severity = warning +dotnet_diagnostic.CA1858.severity = suggestion # Title : Use concrete types when possible for improved performance # Category : Performance @@ -850,7 +856,7 @@ dotnet_diagnostic.CA1859.severity = warning # Title : Avoid using 'Enumerable.Any()' extension method # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1860 -dotnet_diagnostic.CA1860.severity = warning +dotnet_diagnostic.CA1860.severity = suggestion # Title : Avoid constant arrays as arguments # Category : Performance @@ -860,17 +866,17 @@ dotnet_diagnostic.CA1861.severity = suggestion # Title : Use the 'StringComparison' method overloads to perform case-insensitive string comparisons # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1862 -dotnet_diagnostic.CA1862.severity = warning +dotnet_diagnostic.CA1862.severity = suggestion # Title : Use 'CompositeFormat' # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1863 -dotnet_diagnostic.CA1863.severity = warning +dotnet_diagnostic.CA1863.severity = none # Title : Prefer the 'IDictionary.TryAdd(TKey, TValue)' method # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1864 -dotnet_diagnostic.CA1864.severity = warning +dotnet_diagnostic.CA1864.severity = suggestion # Title : Use char overload # Category : Performance @@ -890,17 +896,17 @@ dotnet_diagnostic.CA1867.severity = warning # Title : Unnecessary call to 'Contains(item)' # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1868 -dotnet_diagnostic.CA1868.severity = warning +dotnet_diagnostic.CA1868.severity = suggestion # Title : Cache and reuse 'JsonSerializerOptions' instances # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1869 -dotnet_diagnostic.CA1869.severity = warning +dotnet_diagnostic.CA1869.severity = suggestion # Title : Use a cached 'SearchValues' instance # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1870 -dotnet_diagnostic.CA1870.severity = warning +dotnet_diagnostic.CA1870.severity = suggestion # Title : Dispose objects before losing scope # Category : Reliability @@ -916,6 +922,8 @@ dotnet_diagnostic.CA2002.severity = warning # Category : Reliability # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2007 dotnet_diagnostic.CA2007.severity = warning +dotnet_code_quality.CA2007.output_kinds = all +dotnet_code_quality.CA2007.exclude_async_void_methods = false # Title : Do not create tasks without passing a TaskScheduler # Category : Reliability @@ -1036,6 +1044,7 @@ dotnet_diagnostic.CA2207.severity = warning # Category : Usage # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2208 dotnet_diagnostic.CA2208.severity = warning +dotnet_code_quality.CA2208.api_surface = all # Title : Non-constant fields should not be visible # Category : Usage @@ -1118,6 +1127,7 @@ dotnet_diagnostic.CA2237.severity = none # Category : Usage # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2241 dotnet_diagnostic.CA2241.severity = warning +dotnet_code_quality.CA2241.try_determine_additional_string_formatting_methods_automatically = false # Title : Test for NaN correctly # Category : Usage @@ -2108,7 +2118,7 @@ dotnet_diagnostic.S103.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-104 dotnet_diagnostic.S104.severity = warning -# Title : Destructors should not throw exceptions +# Title : Finalizers should not throw exceptions # Category : Blocker Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1048 # Redundant: CA1065 @@ -2183,7 +2193,7 @@ dotnet_diagnostic.S1110.severity = none # Redundant: SA1106 dotnet_diagnostic.S1116.severity = none -# Title : Local variables should not shadow class fields +# Title : Local variables should not shadow class fields or properties # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1117 dotnet_diagnostic.S1117.severity = warning @@ -2226,6 +2236,11 @@ dotnet_diagnostic.S1128.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-113 dotnet_diagnostic.S113.severity = none +# Title : Deprecated code should be removed +# Category : Info Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-1133 +dotnet_diagnostic.S1133.severity = suggestion + # Title : Track uses of "FIXME" tags # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1134 @@ -2297,7 +2312,7 @@ dotnet_diagnostic.S1192.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1199 dotnet_diagnostic.S1199.severity = none -# Title : Classes should not be coupled to too many other classes (Single Responsibility Principle) +# Title : Classes should not be coupled to too many other classes # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1200 dotnet_diagnostic.S1200.severity = none @@ -2478,7 +2493,7 @@ dotnet_diagnostic.S1699.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1751 dotnet_diagnostic.S1751.severity = warning -# Title : Identical expressions should not be used on both sides of a binary operator +# Title : Identical expressions should not be used on both sides of operators # Category : Major Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1764 dotnet_diagnostic.S1764.severity = warning @@ -2530,7 +2545,7 @@ dotnet_diagnostic.S1939.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1940 dotnet_diagnostic.S1940.severity = warning -# Title : Inappropriate casts should not be made +# Title : Invalid casts should be avoided # Category : Critical Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1944 dotnet_diagnostic.S1944.severity = warning @@ -2567,6 +2582,11 @@ dotnet_diagnostic.S2077.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2092 dotnet_diagnostic.S2092.severity = warning +# Title : Classes should not be empty +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2094 +dotnet_diagnostic.S2094.severity = none + # Title : Collections should not be passed as arguments to their own methods # Category : Major Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2114 @@ -2592,6 +2612,11 @@ dotnet_diagnostic.S2148.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2156 dotnet_diagnostic.S2156.severity = warning +# Title : Classes named like "Exception" should extend "Exception" or a subclass +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2166 +dotnet_diagnostic.S2166.severity = warning + # Title : Short-circuit logic should be used in boolean contexts # Category : Blocker Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2178 @@ -2607,12 +2632,12 @@ dotnet_diagnostic.S2183.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2184 dotnet_diagnostic.S2184.severity = warning -# Title : TestCases should contain tests +# Title : Test classes should contain at least one test case # Category : Blocker Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2187 dotnet_diagnostic.S2187.severity = warning -# Title : Recursion should not be infinite +# Title : Loops and recursions should not be infinite # Category : Blocker Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2190 dotnet_diagnostic.S2190.severity = warning @@ -2622,7 +2647,12 @@ dotnet_diagnostic.S2190.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2197 dotnet_diagnostic.S2197.severity = warning -# Title : Return values from functions without side effects should not be ignored +# Title : Unnecessary mathematical comparisons should not be made +# Category : Critical Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2198 +dotnet_diagnostic.S2198.severity = warning + +# Title : Methods without side effects should not have their return values ignored # Category : Major Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2201 # Redundant: CA1806 @@ -2658,7 +2688,7 @@ dotnet_diagnostic.S2225.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2228 dotnet_diagnostic.S2228.severity = none -# Title : Parameters should be passed in the correct order +# Title : Arguments should be passed in the same order as the method parameters # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2234 dotnet_diagnostic.S2234.severity = warning @@ -2833,11 +2863,17 @@ dotnet_diagnostic.S2387.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2436 dotnet_diagnostic.S2436.severity = none -# Title : Silly bit operations should not be performed +# Title : Unnecessary bit operations should not be performed # Category : Blocker Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2437 dotnet_diagnostic.S2437.severity = warning +# Title : Blocks should be synchronized on read-only fields +# Category : Major Bug +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2445 +# Comment : Noise +dotnet_diagnostic.S2445.severity = none + # Title : Whitespace and control characters in string literals should be explicit # Category : Critical Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2479 @@ -2851,8 +2887,7 @@ dotnet_diagnostic.S2486.severity = warning # Title : Shared resources should not be used for locking # Category : Critical Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2551 -# Redundant: CA2002 -dotnet_diagnostic.S2551.severity = none +dotnet_diagnostic.S2551.severity = warning # Title : Conditionally executed code should be reachable # Category : Major Bug @@ -2863,7 +2898,8 @@ dotnet_diagnostic.S2583.severity = none # Title : Boolean expressions should not be gratuitous # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2589 -dotnet_diagnostic.S2589.severity = warning +# Comment : Too many false positives. +dotnet_diagnostic.S2589.severity = none # Title : Setting loose file permissions is security-sensitive # Category : Major Security Hotspot @@ -2920,7 +2956,7 @@ dotnet_diagnostic.S2743.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2755 dotnet_diagnostic.S2755.severity = warning -# Title : "=+" should not be used instead of "+=" +# Title : Non-existent operators like "=+" should not be used # Category : Major Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2757 dotnet_diagnostic.S2757.severity = warning @@ -2945,6 +2981,11 @@ dotnet_diagnostic.S2761.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2857 dotnet_diagnostic.S2857.severity = warning +# Title : "Thread.Sleep" should not be used in tests +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2925 +dotnet_diagnostic.S2925.severity = none + # Title : "IDisposables" should be disposed # Category : Blocker Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2930 @@ -2983,6 +3024,11 @@ dotnet_diagnostic.S2953.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2955 dotnet_diagnostic.S2955.severity = warning +# Title : Assertions should be complete +# Category : Blocker Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2970 +dotnet_diagnostic.S2970.severity = warning + # Title : "IEnumerable" LINQs should be simplified # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2971 @@ -3033,6 +3079,11 @@ dotnet_diagnostic.S3059.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3060 dotnet_diagnostic.S3060.severity = warning +# Title : "StringBuilder" data should be used +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-3063 +dotnet_diagnostic.S3063.severity = warning + # Title : "async" methods should not return "void" # Category : Major Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3168 @@ -3090,7 +3141,7 @@ dotnet_diagnostic.S3235.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3236 dotnet_diagnostic.S3236.severity = none -# Title : "value" parameters should be used +# Title : "value" contextual keyword should be used # Category : Blocker Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3237 dotnet_diagnostic.S3237.severity = warning @@ -3159,7 +3210,7 @@ dotnet_diagnostic.S3257.severity = none # Title : Non-derived "private" classes and records should be "sealed" # Category : Minor Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3260 -# Redundant: CA1852 +# Redundant: R9A013 dotnet_diagnostic.S3260.severity = none # Title : Namespaces should not be empty @@ -3223,6 +3274,11 @@ dotnet_diagnostic.S3353.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3358 dotnet_diagnostic.S3358.severity = warning +# Title : Date and time should not be used as a type for primary keys +# Category : Minor Bug +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-3363 +dotnet_diagnostic.S3363.severity = warning + # Title : "this" should not be exposed from constructors # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3366 @@ -3239,6 +3295,11 @@ dotnet_diagnostic.S3376.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3397 dotnet_diagnostic.S3397.severity = warning +# Title : "private" methods called only by inner classes should be moved to those classes +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-3398 +dotnet_diagnostic.S3398.severity = warning + # Title : Methods should not return constants # Category : Minor Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3400 @@ -3249,7 +3310,7 @@ dotnet_diagnostic.S3400.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3415 dotnet_diagnostic.S3415.severity = warning -# Title : Method overloads with default parameter values should not overlap +# Title : Method overloads with default parameter values should not overlap # Category : Blocker Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3427 dotnet_diagnostic.S3427.severity = warning @@ -3447,6 +3508,11 @@ dotnet_diagnostic.S3876.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3877 dotnet_diagnostic.S3877.severity = none +# Title : Arrays should not be created for params parameters +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-3878 +dotnet_diagnostic.S3878.severity = suggestion + # Title : Finalizers should not be empty # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3880 @@ -3472,7 +3538,7 @@ dotnet_diagnostic.S3885.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3887 dotnet_diagnostic.S3887.severity = warning -# Title : Neither "Thread.Resume" nor "Thread.Suspend" should be used +# Title : "Thread.Resume" and "Thread.Suspend" should not be used # Category : Blocker Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3889 dotnet_diagnostic.S3889.severity = warning @@ -3846,7 +3912,8 @@ dotnet_diagnostic.S4144.severity = warning # Title : Empty collections should not be accessed or iterated # Category : Minor Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4158 -dotnet_diagnostic.S4158.severity = warning +# Comment : Too many false positives +dotnet_diagnostic.S4158.severity = none # Title : Classes should implement their "ExportAttribute" interfaces # Category : Blocker Bug @@ -3980,6 +4047,11 @@ dotnet_diagnostic.S4507.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4524 dotnet_diagnostic.S4524.severity = warning +# Title : "DebuggerDisplayAttribute" strings should reference existing members +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-4545 +dotnet_diagnostic.S4545.severity = warning + # Title : ASP.NET HTTP request validation feature should not be disabled # Category : Major Vulnerability # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4564 @@ -4000,11 +4072,16 @@ dotnet_diagnostic.S4583.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4586 dotnet_diagnostic.S4586.severity = warning -# Title : String offset-based methods should be preferred for finding substrings from offsets +# Title : Start index should be used instead of calling Substring # Category : Critical Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4635 dotnet_diagnostic.S4635.severity = warning +# Title : Comments should not be empty +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-4663 +dotnet_diagnostic.S4663.severity = none + # Title : Using regular expressions is security-sensitive # Category : Critical Security Hotspot # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4784 @@ -4116,10 +4193,15 @@ dotnet_diagnostic.S5766.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-5773 dotnet_diagnostic.S5773.severity = warning +# Title : Regular expressions should be syntactically valid +# Category : Critical Bug +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-5856 +dotnet_diagnostic.S5856.severity = warning + # Title : Use a testable date/time provider # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-6354 -# Redundant: EA0002 +# Redundant: R9A022 dotnet_diagnostic.S6354.severity = none # Title : Azure Functions should be stateless @@ -4155,7 +4237,120 @@ dotnet_diagnostic.S6424.severity = warning # Title : Not specifying a timeout for regular expressions is security-sensitive # Category : Major Security Hotspot # Help Link: https://rules.sonarsource.com/csharp/RSPEC-6444 -dotnet_diagnostic.S6444.severity = warning +dotnet_diagnostic.S6444.severity = none + +# Title : Blocks should not be synchronized on local variables +# Category : Major Bug +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6507 +# Comment : Too many false positives +dotnet_diagnostic.S6507.severity = none + +# Title : "ExcludeFromCodeCoverage" attributes should include a justification +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6513 +dotnet_diagnostic.S6513.severity = suggestion + +# Title : Avoid using "DateTime.Now" for benchmarking or timing operations +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6561 +dotnet_diagnostic.S6561.severity = warning + +# Title : Always set the "DateTimeKind" when creating new "DateTime" instances +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6562 +# Comment : Noise +dotnet_diagnostic.S6562.severity = none + +# Title : Use UTC when recording DateTime instants +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6563 +dotnet_diagnostic.S6563.severity = none + +# Title : Use "DateTimeOffset" instead of "DateTime" +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6566 +# Comment : Noise +dotnet_diagnostic.S6566.severity = none + +# Title : Use "TimeZoneInfo.FindSystemTimeZoneById" without converting the timezones with "TimezoneConverter" +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6575 +dotnet_diagnostic.S6575.severity = warning + +# Title : Use a format provider when parsing date and time +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6580 +dotnet_diagnostic.S6580.severity = warning + +# Title : Don't hardcode the format when turning dates and times to strings +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6585 +dotnet_diagnostic.S6585.severity = none + +# Title : Use the "UnixEpoch" field instead of creating "DateTime" instances that point to the beginning of the Unix epoch +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6588 +dotnet_diagnostic.S6588.severity = warning + +# Title : "Find" method should be used instead of the "FirstOrDefault" extension +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6602 +dotnet_diagnostic.S6602.severity = warning + +# Title : The collection-specific "TrueForAll" method should be used instead of the "All" extension +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6603 +dotnet_diagnostic.S6603.severity = warning + +# Title : Collection-specific "Exists" method should be used instead of the "Any" extension +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6605 +dotnet_diagnostic.S6605.severity = warning + +# Title : The collection should be filtered before sorting by using "Where" before "OrderBy" +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6607 +dotnet_diagnostic.S6607.severity = warning + +# Title : Prefer indexing instead of "Enumerable" methods on types implementing "IList" +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6608 +dotnet_diagnostic.S6608.severity = warning + +# Title : "Min/Max" properties of "Set" types should be used instead of the "Enumerable" extension methods +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6609 +dotnet_diagnostic.S6609.severity = warning + +# Title : "StartsWith" and "EndsWith" overloads that take a "char" should be used instead of the ones that take a "string" +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6610 +dotnet_diagnostic.S6610.severity = warning + +# Title : The lambda parameter should be used instead of capturing arguments in "ConcurrentDictionary" methods +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6612 +dotnet_diagnostic.S6612.severity = warning + +# Title : "First" and "Last" properties of "LinkedList" should be used instead of the "First()" and "Last()" extension methods +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6613 +dotnet_diagnostic.S6613.severity = warning + +# Title : "Contains" should be used instead of "Any" for simple equality checks +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6617 +dotnet_diagnostic.S6617.severity = warning + +# Title : "string.Create" should be used instead of "FormattableString" +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6618 +dotnet_diagnostic.S6618.severity = warning + +# Title : Using unsafe code blocks is security-sensitive +# Category : Major Security Hotspot +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6640 +dotnet_diagnostic.S6640.severity = warning # Title : Literal suffixes should be upper case # Category : Minor Code Smell @@ -4202,6 +4397,10 @@ dotnet_diagnostic.S9999-symbolRef.severity = warning # Category : dotnet_diagnostic.S9999-token-type.severity = warning +# Title : Analysis Warning generator +# Category : +dotnet_diagnostic.S9999-warning.severity = warning + # Title : Avoid legacy thread switching APIs # Category : Usage # Help Link: https://github.com/Microsoft/vs-threading/blob/main/doc/analyzers/VSTHRD001.md @@ -4255,7 +4454,8 @@ dotnet_diagnostic.VSTHRD102.severity = suggestion # Title : Call async methods when in an async method # Category : Usage # Help Link: https://github.com/Microsoft/vs-threading/blob/main/doc/analyzers/VSTHRD103.md -dotnet_diagnostic.VSTHRD103.severity = warning +# Redundant: CA1849 +dotnet_diagnostic.VSTHRD103.severity = none # Title : Offer async methods # Category : Usage diff --git a/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/Benchmark.globalconfig b/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/Benchmark.globalconfig index a5f42c1d9b6..081db65eeec 100644 --- a/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/Benchmark.globalconfig +++ b/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/Benchmark.globalconfig @@ -1,5 +1,5 @@ # Created by DiagConfig, the diagnostic config generator -# Generated : 2023-10-22 00:37:58Z +# Generated : 2024-01-25 20:57:55Z # Max Tier : 3 # Attributes: general, performance # Analyzers : ILLink.RoslynAnalyzer, Microsoft.Analyzers.Extra, Microsoft.Analyzers.Local, Microsoft.AspNetCore.App.Analyzers, Microsoft.AspNetCore.Components.Analyzers, Microsoft.CodeAnalysis.CSharp.NetAnalyzers, Microsoft.CodeAnalysis.NetAnalyzers, Microsoft.VisualStudio.Threading.Analyzers, Microsoft.VisualStudio.Threading.Analyzers.CSharp, SonarAnalyzer.CSharp @@ -108,7 +108,7 @@ dotnet_diagnostic.CA1001.severity = warning # Title : Types that own disposable fields should be disposable # Category : Design # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1001 -dotnet_diagnostic.CA1001.severity = warning +dotnet_diagnostic.CA1001.severity = none # Title : Do not expose generic lists # Category : Design @@ -198,6 +198,7 @@ dotnet_diagnostic.CA1028.severity = none # Category : Design # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1030 dotnet_diagnostic.CA1030.severity = warning +dotnet_code_quality.CA1030.api_surface = public # Title : Do not catch general exception types # Category : Design @@ -277,6 +278,7 @@ dotnet_diagnostic.CA1051.severity = none # Category : Design # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1052 dotnet_diagnostic.CA1052.severity = warning +dotnet_code_quality.CA1052.api_surface = all # Title : URI-like parameters should not be strings # Category : Design @@ -319,6 +321,7 @@ dotnet_diagnostic.CA1062.severity = none # Category : Design # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1063 dotnet_diagnostic.CA1063.severity = warning +dotnet_code_quality.CA1063.api_surface = public # Title : Exceptions should be public # Category : Design @@ -577,6 +580,7 @@ dotnet_diagnostic.CA1724.severity = none # Category : Naming # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1725 dotnet_diagnostic.CA1725.severity = warning +dotnet_code_quality.CA1725.api_surface = public, protected # Title : Use PascalCase for named placeholders # Category : Naming @@ -599,6 +603,7 @@ dotnet_diagnostic.CA1801.severity = none # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1802 dotnet_diagnostic.CA1802.severity = warning +dotnet_code_quality.CA1802.required_modifiers = static # Title : Use literals where appropriate # Category : Performance @@ -646,6 +651,7 @@ dotnet_diagnostic.CA1814.severity = warning # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1815 dotnet_diagnostic.CA1815.severity = warning +dotnet_code_quality.CA1815.api_surface = public # Title : Dispose methods should call SuppressFinalize # Category : Usage @@ -656,6 +662,7 @@ dotnet_diagnostic.CA1816.severity = warning # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1819 dotnet_diagnostic.CA1819.severity = warning +dotnet_code_quality.CA1819.api_surface = public # Title : Test for empty strings using string length # Category : Performance @@ -671,6 +678,7 @@ dotnet_diagnostic.CA1821.severity = warning # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1822 dotnet_diagnostic.CA1822.severity = warning +dotnet_code_quality.CA1822.api_surface = all # Title : Avoid unused private fields # Category : Performance @@ -800,7 +808,7 @@ dotnet_diagnostic.CA1847.severity = warning # Title : Use the LoggerMessage delegates # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1848 -# Comment : Use the code generated model instead. +# Comment : Use R9 logging model instead dotnet_diagnostic.CA1848.severity = none # Title : Call async methods when in an async method @@ -821,7 +829,8 @@ dotnet_diagnostic.CA1851.severity = suggestion # Title : Seal internal types # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1852 -dotnet_diagnostic.CA1852.severity = none +dotnet_diagnostic.CA1852.severity = warning +dotnet_code_quality.CA1852.ignore_internalsvisibleto = true # Title : Unnecessary call to 'Dictionary.ContainsKey(key)' # Category : Performance @@ -851,7 +860,7 @@ dotnet_diagnostic.CA1857.severity = warning # Title : Use 'StartsWith' instead of 'IndexOf' # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1858 -dotnet_diagnostic.CA1858.severity = warning +dotnet_diagnostic.CA1858.severity = suggestion # Title : Use concrete types when possible for improved performance # Category : Performance @@ -861,7 +870,7 @@ dotnet_diagnostic.CA1859.severity = warning # Title : Avoid using 'Enumerable.Any()' extension method # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1860 -dotnet_diagnostic.CA1860.severity = warning +dotnet_diagnostic.CA1860.severity = suggestion # Title : Avoid constant arrays as arguments # Category : Performance @@ -871,17 +880,17 @@ dotnet_diagnostic.CA1861.severity = suggestion # Title : Use the 'StringComparison' method overloads to perform case-insensitive string comparisons # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1862 -dotnet_diagnostic.CA1862.severity = warning +dotnet_diagnostic.CA1862.severity = suggestion # Title : Use 'CompositeFormat' # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1863 -dotnet_diagnostic.CA1863.severity = warning +dotnet_diagnostic.CA1863.severity = none # Title : Prefer the 'IDictionary.TryAdd(TKey, TValue)' method # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1864 -dotnet_diagnostic.CA1864.severity = warning +dotnet_diagnostic.CA1864.severity = suggestion # Title : Use char overload # Category : Performance @@ -901,17 +910,17 @@ dotnet_diagnostic.CA1867.severity = warning # Title : Unnecessary call to 'Contains(item)' # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1868 -dotnet_diagnostic.CA1868.severity = warning +dotnet_diagnostic.CA1868.severity = suggestion # Title : Cache and reuse 'JsonSerializerOptions' instances # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1869 -dotnet_diagnostic.CA1869.severity = warning +dotnet_diagnostic.CA1869.severity = suggestion # Title : Use a cached 'SearchValues' instance # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1870 -dotnet_diagnostic.CA1870.severity = warning +dotnet_diagnostic.CA1870.severity = suggestion # Title : Dispose objects before losing scope # Category : Reliability @@ -927,6 +936,8 @@ dotnet_diagnostic.CA2002.severity = warning # Category : Reliability # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2007 dotnet_diagnostic.CA2007.severity = warning +dotnet_code_quality.CA2007.output_kinds = all +dotnet_code_quality.CA2007.exclude_async_void_methods = false # Title : Do not create tasks without passing a TaskScheduler # Category : Reliability @@ -1047,6 +1058,7 @@ dotnet_diagnostic.CA2207.severity = warning # Category : Usage # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2208 dotnet_diagnostic.CA2208.severity = warning +dotnet_code_quality.CA2208.api_surface = all # Title : Non-constant fields should not be visible # Category : Usage @@ -1110,6 +1122,7 @@ dotnet_diagnostic.CA2229.severity = none # Category : Usage # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2231 dotnet_diagnostic.CA2231.severity = error +dotnet_code_quality.CA2231.api_surface = public # Title : Pass system uri objects instead of strings # Category : Usage @@ -1132,6 +1145,7 @@ dotnet_diagnostic.CA2237.severity = none # Category : Usage # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2241 dotnet_diagnostic.CA2241.severity = warning +dotnet_code_quality.CA2241.try_determine_additional_string_formatting_methods_automatically = false # Title : Test for NaN correctly # Category : Usage @@ -2124,7 +2138,7 @@ dotnet_diagnostic.S103.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-104 dotnet_diagnostic.S104.severity = warning -# Title : Destructors should not throw exceptions +# Title : Finalizers should not throw exceptions # Category : Blocker Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1048 # Redundant: CA1065 @@ -2200,7 +2214,7 @@ dotnet_diagnostic.S1110.severity = none # Redundant: SA1106 dotnet_diagnostic.S1116.severity = none -# Title : Local variables should not shadow class fields +# Title : Local variables should not shadow class fields or properties # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1117 dotnet_diagnostic.S1117.severity = warning @@ -2243,6 +2257,11 @@ dotnet_diagnostic.S1128.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-113 dotnet_diagnostic.S113.severity = none +# Title : Deprecated code should be removed +# Category : Info Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-1133 +dotnet_diagnostic.S1133.severity = suggestion + # Title : Track uses of "FIXME" tags # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1134 @@ -2315,7 +2334,7 @@ dotnet_diagnostic.S1192.severity = suggestion # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1199 dotnet_diagnostic.S1199.severity = warning -# Title : Classes should not be coupled to too many other classes (Single Responsibility Principle) +# Title : Classes should not be coupled to too many other classes # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1200 dotnet_diagnostic.S1200.severity = none @@ -2496,7 +2515,7 @@ dotnet_diagnostic.S1699.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1751 dotnet_diagnostic.S1751.severity = warning -# Title : Identical expressions should not be used on both sides of a binary operator +# Title : Identical expressions should not be used on both sides of operators # Category : Major Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1764 dotnet_diagnostic.S1764.severity = warning @@ -2548,7 +2567,7 @@ dotnet_diagnostic.S1939.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1940 dotnet_diagnostic.S1940.severity = warning -# Title : Inappropriate casts should not be made +# Title : Invalid casts should be avoided # Category : Critical Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1944 dotnet_diagnostic.S1944.severity = warning @@ -2585,6 +2604,11 @@ dotnet_diagnostic.S2077.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2092 dotnet_diagnostic.S2092.severity = warning +# Title : Classes should not be empty +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2094 +dotnet_diagnostic.S2094.severity = none + # Title : Collections should not be passed as arguments to their own methods # Category : Major Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2114 @@ -2610,6 +2634,11 @@ dotnet_diagnostic.S2148.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2156 dotnet_diagnostic.S2156.severity = warning +# Title : Classes named like "Exception" should extend "Exception" or a subclass +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2166 +dotnet_diagnostic.S2166.severity = warning + # Title : Short-circuit logic should be used in boolean contexts # Category : Blocker Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2178 @@ -2625,12 +2654,12 @@ dotnet_diagnostic.S2183.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2184 dotnet_diagnostic.S2184.severity = warning -# Title : TestCases should contain tests +# Title : Test classes should contain at least one test case # Category : Blocker Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2187 dotnet_diagnostic.S2187.severity = warning -# Title : Recursion should not be infinite +# Title : Loops and recursions should not be infinite # Category : Blocker Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2190 dotnet_diagnostic.S2190.severity = warning @@ -2640,7 +2669,12 @@ dotnet_diagnostic.S2190.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2197 dotnet_diagnostic.S2197.severity = warning -# Title : Return values from functions without side effects should not be ignored +# Title : Unnecessary mathematical comparisons should not be made +# Category : Critical Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2198 +dotnet_diagnostic.S2198.severity = warning + +# Title : Methods without side effects should not have their return values ignored # Category : Major Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2201 # Redundant: CA1806 @@ -2676,7 +2710,7 @@ dotnet_diagnostic.S2225.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2228 dotnet_diagnostic.S2228.severity = none -# Title : Parameters should be passed in the correct order +# Title : Arguments should be passed in the same order as the method parameters # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2234 dotnet_diagnostic.S2234.severity = warning @@ -2853,11 +2887,17 @@ dotnet_diagnostic.S2387.severity = warning # Redundant: CA1005 dotnet_diagnostic.S2436.severity = none -# Title : Silly bit operations should not be performed +# Title : Unnecessary bit operations should not be performed # Category : Blocker Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2437 dotnet_diagnostic.S2437.severity = warning +# Title : Blocks should be synchronized on read-only fields +# Category : Major Bug +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2445 +# Comment : Noise +dotnet_diagnostic.S2445.severity = none + # Title : Whitespace and control characters in string literals should be explicit # Category : Critical Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2479 @@ -2871,8 +2911,7 @@ dotnet_diagnostic.S2486.severity = warning # Title : Shared resources should not be used for locking # Category : Critical Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2551 -# Redundant: CA2002 -dotnet_diagnostic.S2551.severity = none +dotnet_diagnostic.S2551.severity = warning # Title : Conditionally executed code should be reachable # Category : Major Bug @@ -2883,7 +2922,8 @@ dotnet_diagnostic.S2583.severity = none # Title : Boolean expressions should not be gratuitous # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2589 -dotnet_diagnostic.S2589.severity = warning +# Comment : Too many false positives. +dotnet_diagnostic.S2589.severity = none # Title : Setting loose file permissions is security-sensitive # Category : Major Security Hotspot @@ -2940,7 +2980,7 @@ dotnet_diagnostic.S2743.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2755 dotnet_diagnostic.S2755.severity = warning -# Title : "=+" should not be used instead of "+=" +# Title : Non-existent operators like "=+" should not be used # Category : Major Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2757 dotnet_diagnostic.S2757.severity = warning @@ -2965,6 +3005,11 @@ dotnet_diagnostic.S2761.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2857 dotnet_diagnostic.S2857.severity = warning +# Title : "Thread.Sleep" should not be used in tests +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2925 +dotnet_diagnostic.S2925.severity = none + # Title : "IDisposables" should be disposed # Category : Blocker Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2930 @@ -3003,6 +3048,11 @@ dotnet_diagnostic.S2953.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2955 dotnet_diagnostic.S2955.severity = warning +# Title : Assertions should be complete +# Category : Blocker Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2970 +dotnet_diagnostic.S2970.severity = warning + # Title : "IEnumerable" LINQs should be simplified # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2971 @@ -3054,6 +3104,11 @@ dotnet_diagnostic.S3059.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3060 dotnet_diagnostic.S3060.severity = warning +# Title : "StringBuilder" data should be used +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-3063 +dotnet_diagnostic.S3063.severity = warning + # Title : "async" methods should not return "void" # Category : Major Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3168 @@ -3111,7 +3166,7 @@ dotnet_diagnostic.S3235.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3236 dotnet_diagnostic.S3236.severity = warning -# Title : "value" parameters should be used +# Title : "value" contextual keyword should be used # Category : Blocker Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3237 dotnet_diagnostic.S3237.severity = warning @@ -3176,12 +3231,13 @@ dotnet_diagnostic.S3256.severity = warning # Title : Declarations and initializations should be as concise as possible # Category : Minor Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3257 -dotnet_diagnostic.S3257.severity = warning +# Comment : Too many false positives +dotnet_diagnostic.S3257.severity = none # Title : Non-derived "private" classes and records should be "sealed" # Category : Minor Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3260 -# Redundant: CA1852 +# Redundant: R9A013 dotnet_diagnostic.S3260.severity = none # Title : Namespaces should not be empty @@ -3245,6 +3301,11 @@ dotnet_diagnostic.S3353.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3358 dotnet_diagnostic.S3358.severity = warning +# Title : Date and time should not be used as a type for primary keys +# Category : Minor Bug +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-3363 +dotnet_diagnostic.S3363.severity = warning + # Title : "this" should not be exposed from constructors # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3366 @@ -3261,6 +3322,11 @@ dotnet_diagnostic.S3376.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3397 dotnet_diagnostic.S3397.severity = warning +# Title : "private" methods called only by inner classes should be moved to those classes +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-3398 +dotnet_diagnostic.S3398.severity = warning + # Title : Methods should not return constants # Category : Minor Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3400 @@ -3271,7 +3337,7 @@ dotnet_diagnostic.S3400.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3415 dotnet_diagnostic.S3415.severity = warning -# Title : Method overloads with default parameter values should not overlap +# Title : Method overloads with default parameter values should not overlap # Category : Blocker Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3427 dotnet_diagnostic.S3427.severity = warning @@ -3469,6 +3535,11 @@ dotnet_diagnostic.S3876.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3877 dotnet_diagnostic.S3877.severity = none +# Title : Arrays should not be created for params parameters +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-3878 +dotnet_diagnostic.S3878.severity = suggestion + # Title : Finalizers should not be empty # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3880 @@ -3494,7 +3565,7 @@ dotnet_diagnostic.S3885.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3887 dotnet_diagnostic.S3887.severity = warning -# Title : Neither "Thread.Resume" nor "Thread.Suspend" should be used +# Title : "Thread.Resume" and "Thread.Suspend" should not be used # Category : Blocker Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3889 dotnet_diagnostic.S3889.severity = warning @@ -3734,7 +3805,7 @@ dotnet_diagnostic.S4022.severity = warning # Title : Interfaces should not be empty # Category : Minor Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4023 -dotnet_diagnostic.S4023.severity = warning +dotnet_diagnostic.S4023.severity = none # Title : Child class fields should not differ from parent class fields only by capitalization # Category : Critical Code Smell @@ -3872,7 +3943,8 @@ dotnet_diagnostic.S4144.severity = warning # Title : Empty collections should not be accessed or iterated # Category : Minor Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4158 -dotnet_diagnostic.S4158.severity = warning +# Comment : Too many false positives +dotnet_diagnostic.S4158.severity = none # Title : Classes should implement their "ExportAttribute" interfaces # Category : Blocker Bug @@ -4006,6 +4078,11 @@ dotnet_diagnostic.S4507.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4524 dotnet_diagnostic.S4524.severity = warning +# Title : "DebuggerDisplayAttribute" strings should reference existing members +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-4545 +dotnet_diagnostic.S4545.severity = warning + # Title : ASP.NET HTTP request validation feature should not be disabled # Category : Major Vulnerability # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4564 @@ -4026,11 +4103,16 @@ dotnet_diagnostic.S4583.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4586 dotnet_diagnostic.S4586.severity = warning -# Title : String offset-based methods should be preferred for finding substrings from offsets +# Title : Start index should be used instead of calling Substring # Category : Critical Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4635 dotnet_diagnostic.S4635.severity = warning +# Title : Comments should not be empty +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-4663 +dotnet_diagnostic.S4663.severity = suggestion + # Title : Using regular expressions is security-sensitive # Category : Critical Security Hotspot # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4784 @@ -4142,10 +4224,15 @@ dotnet_diagnostic.S5766.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-5773 dotnet_diagnostic.S5773.severity = warning +# Title : Regular expressions should be syntactically valid +# Category : Critical Bug +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-5856 +dotnet_diagnostic.S5856.severity = warning + # Title : Use a testable date/time provider # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-6354 -# Redundant: EA0002 +# Redundant: R9A022 dotnet_diagnostic.S6354.severity = none # Title : Azure Functions should be stateless @@ -4181,7 +4268,120 @@ dotnet_diagnostic.S6424.severity = warning # Title : Not specifying a timeout for regular expressions is security-sensitive # Category : Major Security Hotspot # Help Link: https://rules.sonarsource.com/csharp/RSPEC-6444 -dotnet_diagnostic.S6444.severity = warning +dotnet_diagnostic.S6444.severity = none + +# Title : Blocks should not be synchronized on local variables +# Category : Major Bug +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6507 +# Comment : Too many false positives +dotnet_diagnostic.S6507.severity = none + +# Title : "ExcludeFromCodeCoverage" attributes should include a justification +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6513 +dotnet_diagnostic.S6513.severity = suggestion + +# Title : Avoid using "DateTime.Now" for benchmarking or timing operations +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6561 +dotnet_diagnostic.S6561.severity = warning + +# Title : Always set the "DateTimeKind" when creating new "DateTime" instances +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6562 +# Comment : Noise +dotnet_diagnostic.S6562.severity = none + +# Title : Use UTC when recording DateTime instants +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6563 +dotnet_diagnostic.S6563.severity = none + +# Title : Use "DateTimeOffset" instead of "DateTime" +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6566 +# Comment : Noise +dotnet_diagnostic.S6566.severity = none + +# Title : Use "TimeZoneInfo.FindSystemTimeZoneById" without converting the timezones with "TimezoneConverter" +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6575 +dotnet_diagnostic.S6575.severity = warning + +# Title : Use a format provider when parsing date and time +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6580 +dotnet_diagnostic.S6580.severity = warning + +# Title : Don't hardcode the format when turning dates and times to strings +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6585 +dotnet_diagnostic.S6585.severity = none + +# Title : Use the "UnixEpoch" field instead of creating "DateTime" instances that point to the beginning of the Unix epoch +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6588 +dotnet_diagnostic.S6588.severity = warning + +# Title : "Find" method should be used instead of the "FirstOrDefault" extension +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6602 +dotnet_diagnostic.S6602.severity = warning + +# Title : The collection-specific "TrueForAll" method should be used instead of the "All" extension +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6603 +dotnet_diagnostic.S6603.severity = warning + +# Title : Collection-specific "Exists" method should be used instead of the "Any" extension +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6605 +dotnet_diagnostic.S6605.severity = warning + +# Title : The collection should be filtered before sorting by using "Where" before "OrderBy" +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6607 +dotnet_diagnostic.S6607.severity = warning + +# Title : Prefer indexing instead of "Enumerable" methods on types implementing "IList" +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6608 +dotnet_diagnostic.S6608.severity = warning + +# Title : "Min/Max" properties of "Set" types should be used instead of the "Enumerable" extension methods +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6609 +dotnet_diagnostic.S6609.severity = warning + +# Title : "StartsWith" and "EndsWith" overloads that take a "char" should be used instead of the ones that take a "string" +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6610 +dotnet_diagnostic.S6610.severity = warning + +# Title : The lambda parameter should be used instead of capturing arguments in "ConcurrentDictionary" methods +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6612 +dotnet_diagnostic.S6612.severity = warning + +# Title : "First" and "Last" properties of "LinkedList" should be used instead of the "First()" and "Last()" extension methods +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6613 +dotnet_diagnostic.S6613.severity = warning + +# Title : "Contains" should be used instead of "Any" for simple equality checks +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6617 +dotnet_diagnostic.S6617.severity = warning + +# Title : "string.Create" should be used instead of "FormattableString" +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6618 +dotnet_diagnostic.S6618.severity = warning + +# Title : Using unsafe code blocks is security-sensitive +# Category : Major Security Hotspot +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6640 +dotnet_diagnostic.S6640.severity = warning # Title : Literal suffixes should be upper case # Category : Minor Code Smell @@ -4228,6 +4428,10 @@ dotnet_diagnostic.S9999-symbolRef.severity = warning # Category : dotnet_diagnostic.S9999-token-type.severity = warning +# Title : Analysis Warning generator +# Category : +dotnet_diagnostic.S9999-warning.severity = warning + # Title : Avoid legacy thread switching APIs # Category : Usage # Help Link: https://github.com/Microsoft/vs-threading/blob/main/doc/analyzers/VSTHRD001.md @@ -4281,7 +4485,8 @@ dotnet_diagnostic.VSTHRD102.severity = suggestion # Title : Call async methods when in an async method # Category : Usage # Help Link: https://github.com/Microsoft/vs-threading/blob/main/doc/analyzers/VSTHRD103.md -dotnet_diagnostic.VSTHRD103.severity = warning +# Redundant: CA1849 +dotnet_diagnostic.VSTHRD103.severity = none # Title : Offer async methods # Category : Usage diff --git a/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/General-Tier1.globalconfig b/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/General-Tier1.globalconfig index 03ffd63fd58..802eae68a5e 100644 --- a/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/General-Tier1.globalconfig +++ b/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/General-Tier1.globalconfig @@ -1,5 +1,5 @@ # Created by DiagConfig, the diagnostic config generator -# Generated : 2023-10-22 00:37:49Z +# Generated : 2024-01-25 20:57:46Z # Max Tier : 1 # Attributes: general # Analyzers : ILLink.RoslynAnalyzer, Microsoft.Analyzers.Extra, Microsoft.Analyzers.Local, Microsoft.AspNetCore.App.Analyzers, Microsoft.AspNetCore.Components.Analyzers, Microsoft.CodeAnalysis.CSharp.NetAnalyzers, Microsoft.CodeAnalysis.NetAnalyzers, Microsoft.VisualStudio.Threading.Analyzers, Microsoft.VisualStudio.Threading.Analyzers.CSharp, SonarAnalyzer.CSharp @@ -309,6 +309,7 @@ dotnet_diagnostic.CA1062.severity = none # Category : Design # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1063 dotnet_diagnostic.CA1063.severity = warning +dotnet_code_quality.CA1063.api_surface = public # Title : Exceptions should be public # Category : Design @@ -828,7 +829,7 @@ dotnet_diagnostic.CA1857.severity = warning # Title : Use 'StartsWith' instead of 'IndexOf' # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1858 -dotnet_diagnostic.CA1858.severity = none +dotnet_diagnostic.CA1858.severity = suggestion # Title : Use concrete types when possible for improved performance # Category : Performance @@ -838,7 +839,7 @@ dotnet_diagnostic.CA1859.severity = none # Title : Avoid using 'Enumerable.Any()' extension method # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1860 -dotnet_diagnostic.CA1860.severity = none +dotnet_diagnostic.CA1860.severity = suggestion # Title : Avoid constant arrays as arguments # Category : Performance @@ -848,7 +849,7 @@ dotnet_diagnostic.CA1861.severity = suggestion # Title : Use the 'StringComparison' method overloads to perform case-insensitive string comparisons # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1862 -dotnet_diagnostic.CA1862.severity = none +dotnet_diagnostic.CA1862.severity = suggestion # Title : Use 'CompositeFormat' # Category : Performance @@ -883,12 +884,12 @@ dotnet_diagnostic.CA1868.severity = suggestion # Title : Cache and reuse 'JsonSerializerOptions' instances # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1869 -dotnet_diagnostic.CA1869.severity = none +dotnet_diagnostic.CA1869.severity = suggestion # Title : Use a cached 'SearchValues' instance # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1870 -dotnet_diagnostic.CA1870.severity = none +dotnet_diagnostic.CA1870.severity = suggestion # Title : Dispose objects before losing scope # Category : Reliability @@ -1105,6 +1106,7 @@ dotnet_diagnostic.CA2237.severity = none # Category : Usage # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2241 dotnet_diagnostic.CA2241.severity = warning +dotnet_code_quality.CA2241.try_determine_additional_string_formatting_methods_automatically = false # Title : Test for NaN correctly # Category : Usage @@ -2095,7 +2097,7 @@ dotnet_diagnostic.S103.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-104 dotnet_diagnostic.S104.severity = none -# Title : Destructors should not throw exceptions +# Title : Finalizers should not throw exceptions # Category : Blocker Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1048 # Redundant: CA1065 @@ -2166,7 +2168,7 @@ dotnet_diagnostic.S1110.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1116 dotnet_diagnostic.S1116.severity = none -# Title : Local variables should not shadow class fields +# Title : Local variables should not shadow class fields or properties # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1117 dotnet_diagnostic.S1117.severity = warning @@ -2206,6 +2208,11 @@ dotnet_diagnostic.S1128.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-113 dotnet_diagnostic.S113.severity = none +# Title : Deprecated code should be removed +# Category : Info Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-1133 +dotnet_diagnostic.S1133.severity = suggestion + # Title : Track uses of "FIXME" tags # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1134 @@ -2277,7 +2284,7 @@ dotnet_diagnostic.S1192.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1199 dotnet_diagnostic.S1199.severity = none -# Title : Classes should not be coupled to too many other classes (Single Responsibility Principle) +# Title : Classes should not be coupled to too many other classes # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1200 dotnet_diagnostic.S1200.severity = none @@ -2454,7 +2461,7 @@ dotnet_diagnostic.S1699.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1751 dotnet_diagnostic.S1751.severity = warning -# Title : Identical expressions should not be used on both sides of a binary operator +# Title : Identical expressions should not be used on both sides of operators # Category : Major Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1764 dotnet_diagnostic.S1764.severity = warning @@ -2505,7 +2512,7 @@ dotnet_diagnostic.S1939.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1940 dotnet_diagnostic.S1940.severity = none -# Title : Inappropriate casts should not be made +# Title : Invalid casts should be avoided # Category : Critical Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1944 dotnet_diagnostic.S1944.severity = warning @@ -2542,6 +2549,11 @@ dotnet_diagnostic.S2077.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2092 dotnet_diagnostic.S2092.severity = none +# Title : Classes should not be empty +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2094 +dotnet_diagnostic.S2094.severity = none + # Title : Collections should not be passed as arguments to their own methods # Category : Major Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2114 @@ -2567,6 +2579,11 @@ dotnet_diagnostic.S2148.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2156 dotnet_diagnostic.S2156.severity = none +# Title : Classes named like "Exception" should extend "Exception" or a subclass +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2166 +dotnet_diagnostic.S2166.severity = warning + # Title : Short-circuit logic should be used in boolean contexts # Category : Blocker Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2178 @@ -2582,12 +2599,12 @@ dotnet_diagnostic.S2183.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2184 dotnet_diagnostic.S2184.severity = none -# Title : TestCases should contain tests +# Title : Test classes should contain at least one test case # Category : Blocker Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2187 dotnet_diagnostic.S2187.severity = none -# Title : Recursion should not be infinite +# Title : Loops and recursions should not be infinite # Category : Blocker Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2190 dotnet_diagnostic.S2190.severity = none @@ -2597,7 +2614,12 @@ dotnet_diagnostic.S2190.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2197 dotnet_diagnostic.S2197.severity = warning -# Title : Return values from functions without side effects should not be ignored +# Title : Unnecessary mathematical comparisons should not be made +# Category : Critical Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2198 +dotnet_diagnostic.S2198.severity = warning + +# Title : Methods without side effects should not have their return values ignored # Category : Major Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2201 # Redundant: CA1806 @@ -2633,7 +2655,7 @@ dotnet_diagnostic.S2225.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2228 dotnet_diagnostic.S2228.severity = none -# Title : Parameters should be passed in the correct order +# Title : Arguments should be passed in the same order as the method parameters # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2234 dotnet_diagnostic.S2234.severity = warning @@ -2807,11 +2829,17 @@ dotnet_diagnostic.S2387.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2436 dotnet_diagnostic.S2436.severity = none -# Title : Silly bit operations should not be performed +# Title : Unnecessary bit operations should not be performed # Category : Blocker Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2437 dotnet_diagnostic.S2437.severity = warning +# Title : Blocks should be synchronized on read-only fields +# Category : Major Bug +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2445 +# Comment : Noise +dotnet_diagnostic.S2445.severity = none + # Title : Whitespace and control characters in string literals should be explicit # Category : Critical Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2479 @@ -2825,8 +2853,7 @@ dotnet_diagnostic.S2486.severity = none # Title : Shared resources should not be used for locking # Category : Critical Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2551 -# Redundant: CA2002 -dotnet_diagnostic.S2551.severity = none +dotnet_diagnostic.S2551.severity = warning # Title : Conditionally executed code should be reachable # Category : Major Bug @@ -2837,7 +2864,8 @@ dotnet_diagnostic.S2583.severity = none # Title : Boolean expressions should not be gratuitous # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2589 -dotnet_diagnostic.S2589.severity = warning +# Comment : Too many false positives. +dotnet_diagnostic.S2589.severity = none # Title : Setting loose file permissions is security-sensitive # Category : Major Security Hotspot @@ -2894,7 +2922,7 @@ dotnet_diagnostic.S2743.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2755 dotnet_diagnostic.S2755.severity = warning -# Title : "=+" should not be used instead of "+=" +# Title : Non-existent operators like "=+" should not be used # Category : Major Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2757 dotnet_diagnostic.S2757.severity = warning @@ -2919,6 +2947,11 @@ dotnet_diagnostic.S2761.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2857 dotnet_diagnostic.S2857.severity = warning +# Title : "Thread.Sleep" should not be used in tests +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2925 +dotnet_diagnostic.S2925.severity = none + # Title : "IDisposables" should be disposed # Category : Blocker Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2930 @@ -2957,6 +2990,11 @@ dotnet_diagnostic.S2953.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2955 dotnet_diagnostic.S2955.severity = none +# Title : Assertions should be complete +# Category : Blocker Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2970 +dotnet_diagnostic.S2970.severity = warning + # Title : "IEnumerable" LINQs should be simplified # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2971 @@ -3007,6 +3045,11 @@ dotnet_diagnostic.S3059.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3060 dotnet_diagnostic.S3060.severity = none +# Title : "StringBuilder" data should be used +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-3063 +dotnet_diagnostic.S3063.severity = warning + # Title : "async" methods should not return "void" # Category : Major Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3168 @@ -3063,7 +3106,7 @@ dotnet_diagnostic.S3235.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3236 dotnet_diagnostic.S3236.severity = none -# Title : "value" parameters should be used +# Title : "value" contextual keyword should be used # Category : Blocker Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3237 dotnet_diagnostic.S3237.severity = warning @@ -3194,6 +3237,11 @@ dotnet_diagnostic.S3353.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3358 dotnet_diagnostic.S3358.severity = warning +# Title : Date and time should not be used as a type for primary keys +# Category : Minor Bug +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-3363 +dotnet_diagnostic.S3363.severity = warning + # Title : "this" should not be exposed from constructors # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3366 @@ -3210,6 +3258,11 @@ dotnet_diagnostic.S3376.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3397 dotnet_diagnostic.S3397.severity = none +# Title : "private" methods called only by inner classes should be moved to those classes +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-3398 +dotnet_diagnostic.S3398.severity = warning + # Title : Methods should not return constants # Category : Minor Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3400 @@ -3220,7 +3273,7 @@ dotnet_diagnostic.S3400.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3415 dotnet_diagnostic.S3415.severity = warning -# Title : Method overloads with default parameter values should not overlap +# Title : Method overloads with default parameter values should not overlap # Category : Blocker Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3427 dotnet_diagnostic.S3427.severity = warning @@ -3416,6 +3469,11 @@ dotnet_diagnostic.S3876.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3877 dotnet_diagnostic.S3877.severity = none +# Title : Arrays should not be created for params parameters +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-3878 +dotnet_diagnostic.S3878.severity = suggestion + # Title : Finalizers should not be empty # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3880 @@ -3441,7 +3499,7 @@ dotnet_diagnostic.S3885.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3887 dotnet_diagnostic.S3887.severity = warning -# Title : Neither "Thread.Resume" nor "Thread.Suspend" should be used +# Title : "Thread.Resume" and "Thread.Suspend" should not be used # Category : Blocker Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3889 dotnet_diagnostic.S3889.severity = warning @@ -3940,6 +3998,11 @@ dotnet_diagnostic.S4507.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4524 dotnet_diagnostic.S4524.severity = warning +# Title : "DebuggerDisplayAttribute" strings should reference existing members +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-4545 +dotnet_diagnostic.S4545.severity = warning + # Title : ASP.NET HTTP request validation feature should not be disabled # Category : Major Vulnerability # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4564 @@ -3960,11 +4023,16 @@ dotnet_diagnostic.S4583.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4586 dotnet_diagnostic.S4586.severity = warning -# Title : String offset-based methods should be preferred for finding substrings from offsets +# Title : Start index should be used instead of calling Substring # Category : Critical Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4635 dotnet_diagnostic.S4635.severity = warning +# Title : Comments should not be empty +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-4663 +dotnet_diagnostic.S4663.severity = none + # Title : Using regular expressions is security-sensitive # Category : Critical Security Hotspot # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4784 @@ -4076,10 +4144,15 @@ dotnet_diagnostic.S5766.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-5773 dotnet_diagnostic.S5773.severity = none +# Title : Regular expressions should be syntactically valid +# Category : Critical Bug +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-5856 +dotnet_diagnostic.S5856.severity = warning + # Title : Use a testable date/time provider # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-6354 -# Redundant: EA0002 +# Redundant: R9A022 dotnet_diagnostic.S6354.severity = none # Title : Azure Functions should be stateless @@ -4115,7 +4188,120 @@ dotnet_diagnostic.S6424.severity = none # Title : Not specifying a timeout for regular expressions is security-sensitive # Category : Major Security Hotspot # Help Link: https://rules.sonarsource.com/csharp/RSPEC-6444 -dotnet_diagnostic.S6444.severity = warning +dotnet_diagnostic.S6444.severity = none + +# Title : Blocks should not be synchronized on local variables +# Category : Major Bug +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6507 +# Comment : Too many false positives +dotnet_diagnostic.S6507.severity = none + +# Title : "ExcludeFromCodeCoverage" attributes should include a justification +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6513 +dotnet_diagnostic.S6513.severity = suggestion + +# Title : Avoid using "DateTime.Now" for benchmarking or timing operations +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6561 +dotnet_diagnostic.S6561.severity = warning + +# Title : Always set the "DateTimeKind" when creating new "DateTime" instances +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6562 +# Comment : Noise +dotnet_diagnostic.S6562.severity = none + +# Title : Use UTC when recording DateTime instants +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6563 +dotnet_diagnostic.S6563.severity = none + +# Title : Use "DateTimeOffset" instead of "DateTime" +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6566 +# Comment : Noise +dotnet_diagnostic.S6566.severity = none + +# Title : Use "TimeZoneInfo.FindSystemTimeZoneById" without converting the timezones with "TimezoneConverter" +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6575 +dotnet_diagnostic.S6575.severity = warning + +# Title : Use a format provider when parsing date and time +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6580 +dotnet_diagnostic.S6580.severity = warning + +# Title : Don't hardcode the format when turning dates and times to strings +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6585 +dotnet_diagnostic.S6585.severity = none + +# Title : Use the "UnixEpoch" field instead of creating "DateTime" instances that point to the beginning of the Unix epoch +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6588 +dotnet_diagnostic.S6588.severity = warning + +# Title : "Find" method should be used instead of the "FirstOrDefault" extension +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6602 +dotnet_diagnostic.S6602.severity = none + +# Title : The collection-specific "TrueForAll" method should be used instead of the "All" extension +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6603 +dotnet_diagnostic.S6603.severity = none + +# Title : Collection-specific "Exists" method should be used instead of the "Any" extension +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6605 +dotnet_diagnostic.S6605.severity = none + +# Title : The collection should be filtered before sorting by using "Where" before "OrderBy" +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6607 +dotnet_diagnostic.S6607.severity = none + +# Title : Prefer indexing instead of "Enumerable" methods on types implementing "IList" +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6608 +dotnet_diagnostic.S6608.severity = none + +# Title : "Min/Max" properties of "Set" types should be used instead of the "Enumerable" extension methods +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6609 +dotnet_diagnostic.S6609.severity = none + +# Title : "StartsWith" and "EndsWith" overloads that take a "char" should be used instead of the ones that take a "string" +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6610 +dotnet_diagnostic.S6610.severity = none + +# Title : The lambda parameter should be used instead of capturing arguments in "ConcurrentDictionary" methods +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6612 +dotnet_diagnostic.S6612.severity = none + +# Title : "First" and "Last" properties of "LinkedList" should be used instead of the "First()" and "Last()" extension methods +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6613 +dotnet_diagnostic.S6613.severity = none + +# Title : "Contains" should be used instead of "Any" for simple equality checks +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6617 +dotnet_diagnostic.S6617.severity = none + +# Title : "string.Create" should be used instead of "FormattableString" +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6618 +dotnet_diagnostic.S6618.severity = none + +# Title : Using unsafe code blocks is security-sensitive +# Category : Major Security Hotspot +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6640 +dotnet_diagnostic.S6640.severity = warning # Title : Literal suffixes should be upper case # Category : Minor Code Smell @@ -4162,6 +4348,10 @@ dotnet_diagnostic.S9999-symbolRef.severity = warning # Category : dotnet_diagnostic.S9999-token-type.severity = warning +# Title : Analysis Warning generator +# Category : +dotnet_diagnostic.S9999-warning.severity = warning + # Title : Avoid legacy thread switching APIs # Category : Usage # Help Link: https://github.com/Microsoft/vs-threading/blob/main/doc/analyzers/VSTHRD001.md @@ -4215,6 +4405,7 @@ dotnet_diagnostic.VSTHRD102.severity = none # Title : Call async methods when in an async method # Category : Usage # Help Link: https://github.com/Microsoft/vs-threading/blob/main/doc/analyzers/VSTHRD103.md +# Redundant: CA1849 dotnet_diagnostic.VSTHRD103.severity = none # Title : Offer async methods diff --git a/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/General-Tier2.globalconfig b/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/General-Tier2.globalconfig index 1746e78a5a8..e90793c42c4 100644 --- a/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/General-Tier2.globalconfig +++ b/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/General-Tier2.globalconfig @@ -1,5 +1,5 @@ # Created by DiagConfig, the diagnostic config generator -# Generated : 2023-10-22 00:37:52Z +# Generated : 2024-01-25 20:57:50Z # Max Tier : 2 # Attributes: general # Analyzers : ILLink.RoslynAnalyzer, Microsoft.Analyzers.Extra, Microsoft.Analyzers.Local, Microsoft.AspNetCore.App.Analyzers, Microsoft.AspNetCore.Components.Analyzers, Microsoft.CodeAnalysis.CSharp.NetAnalyzers, Microsoft.CodeAnalysis.NetAnalyzers, Microsoft.VisualStudio.Threading.Analyzers, Microsoft.VisualStudio.Threading.Analyzers.CSharp, SonarAnalyzer.CSharp @@ -108,7 +108,7 @@ dotnet_diagnostic.CA1001.severity = warning # Title : Types that own disposable fields should be disposable # Category : Design # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1001 -dotnet_diagnostic.CA1001.severity = warning +dotnet_diagnostic.CA1001.severity = none # Title : Do not expose generic lists # Category : Design @@ -313,6 +313,7 @@ dotnet_diagnostic.CA1062.severity = none # Category : Design # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1063 dotnet_diagnostic.CA1063.severity = warning +dotnet_code_quality.CA1063.api_surface = public # Title : Exceptions should be public # Category : Design @@ -660,6 +661,7 @@ dotnet_diagnostic.CA1821.severity = none # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1822 dotnet_diagnostic.CA1822.severity = warning +dotnet_code_quality.CA1822.api_surface = all # Title : Avoid unused private fields # Category : Performance @@ -789,7 +791,7 @@ dotnet_diagnostic.CA1847.severity = none # Title : Use the LoggerMessage delegates # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1848 -# Comment : Use the code generated model instead. +# Comment : Use R9 logging model instead dotnet_diagnostic.CA1848.severity = none # Title : Call async methods when in an async method @@ -840,7 +842,7 @@ dotnet_diagnostic.CA1857.severity = warning # Title : Use 'StartsWith' instead of 'IndexOf' # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1858 -dotnet_diagnostic.CA1858.severity = none +dotnet_diagnostic.CA1858.severity = suggestion # Title : Use concrete types when possible for improved performance # Category : Performance @@ -850,7 +852,7 @@ dotnet_diagnostic.CA1859.severity = none # Title : Avoid using 'Enumerable.Any()' extension method # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1860 -dotnet_diagnostic.CA1860.severity = none +dotnet_diagnostic.CA1860.severity = suggestion # Title : Avoid constant arrays as arguments # Category : Performance @@ -860,7 +862,7 @@ dotnet_diagnostic.CA1861.severity = suggestion # Title : Use the 'StringComparison' method overloads to perform case-insensitive string comparisons # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1862 -dotnet_diagnostic.CA1862.severity = none +dotnet_diagnostic.CA1862.severity = suggestion # Title : Use 'CompositeFormat' # Category : Performance @@ -895,12 +897,12 @@ dotnet_diagnostic.CA1868.severity = suggestion # Title : Cache and reuse 'JsonSerializerOptions' instances # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1869 -dotnet_diagnostic.CA1869.severity = none +dotnet_diagnostic.CA1869.severity = suggestion # Title : Use a cached 'SearchValues' instance # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1870 -dotnet_diagnostic.CA1870.severity = none +dotnet_diagnostic.CA1870.severity = suggestion # Title : Dispose objects before losing scope # Category : Reliability @@ -1036,6 +1038,7 @@ dotnet_diagnostic.CA2207.severity = none # Category : Usage # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2208 dotnet_diagnostic.CA2208.severity = warning +dotnet_code_quality.CA2208.api_surface = all # Title : Non-constant fields should not be visible # Category : Usage @@ -1118,6 +1121,7 @@ dotnet_diagnostic.CA2237.severity = none # Category : Usage # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2241 dotnet_diagnostic.CA2241.severity = warning +dotnet_code_quality.CA2241.try_determine_additional_string_formatting_methods_automatically = false # Title : Test for NaN correctly # Category : Usage @@ -2108,7 +2112,7 @@ dotnet_diagnostic.S103.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-104 dotnet_diagnostic.S104.severity = warning -# Title : Destructors should not throw exceptions +# Title : Finalizers should not throw exceptions # Category : Blocker Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1048 # Redundant: CA1065 @@ -2183,7 +2187,7 @@ dotnet_diagnostic.S1110.severity = none # Redundant: SA1106 dotnet_diagnostic.S1116.severity = none -# Title : Local variables should not shadow class fields +# Title : Local variables should not shadow class fields or properties # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1117 dotnet_diagnostic.S1117.severity = warning @@ -2226,6 +2230,11 @@ dotnet_diagnostic.S1128.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-113 dotnet_diagnostic.S113.severity = none +# Title : Deprecated code should be removed +# Category : Info Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-1133 +dotnet_diagnostic.S1133.severity = suggestion + # Title : Track uses of "FIXME" tags # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1134 @@ -2297,7 +2306,7 @@ dotnet_diagnostic.S1192.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1199 dotnet_diagnostic.S1199.severity = none -# Title : Classes should not be coupled to too many other classes (Single Responsibility Principle) +# Title : Classes should not be coupled to too many other classes # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1200 dotnet_diagnostic.S1200.severity = none @@ -2478,7 +2487,7 @@ dotnet_diagnostic.S1699.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1751 dotnet_diagnostic.S1751.severity = warning -# Title : Identical expressions should not be used on both sides of a binary operator +# Title : Identical expressions should not be used on both sides of operators # Category : Major Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1764 dotnet_diagnostic.S1764.severity = warning @@ -2530,7 +2539,7 @@ dotnet_diagnostic.S1939.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1940 dotnet_diagnostic.S1940.severity = warning -# Title : Inappropriate casts should not be made +# Title : Invalid casts should be avoided # Category : Critical Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1944 dotnet_diagnostic.S1944.severity = warning @@ -2567,6 +2576,11 @@ dotnet_diagnostic.S2077.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2092 dotnet_diagnostic.S2092.severity = warning +# Title : Classes should not be empty +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2094 +dotnet_diagnostic.S2094.severity = none + # Title : Collections should not be passed as arguments to their own methods # Category : Major Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2114 @@ -2592,6 +2606,11 @@ dotnet_diagnostic.S2148.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2156 dotnet_diagnostic.S2156.severity = warning +# Title : Classes named like "Exception" should extend "Exception" or a subclass +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2166 +dotnet_diagnostic.S2166.severity = warning + # Title : Short-circuit logic should be used in boolean contexts # Category : Blocker Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2178 @@ -2607,12 +2626,12 @@ dotnet_diagnostic.S2183.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2184 dotnet_diagnostic.S2184.severity = warning -# Title : TestCases should contain tests +# Title : Test classes should contain at least one test case # Category : Blocker Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2187 dotnet_diagnostic.S2187.severity = warning -# Title : Recursion should not be infinite +# Title : Loops and recursions should not be infinite # Category : Blocker Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2190 dotnet_diagnostic.S2190.severity = warning @@ -2622,7 +2641,12 @@ dotnet_diagnostic.S2190.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2197 dotnet_diagnostic.S2197.severity = warning -# Title : Return values from functions without side effects should not be ignored +# Title : Unnecessary mathematical comparisons should not be made +# Category : Critical Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2198 +dotnet_diagnostic.S2198.severity = warning + +# Title : Methods without side effects should not have their return values ignored # Category : Major Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2201 # Redundant: CA1806 @@ -2658,7 +2682,7 @@ dotnet_diagnostic.S2225.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2228 dotnet_diagnostic.S2228.severity = none -# Title : Parameters should be passed in the correct order +# Title : Arguments should be passed in the same order as the method parameters # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2234 dotnet_diagnostic.S2234.severity = warning @@ -2833,11 +2857,17 @@ dotnet_diagnostic.S2387.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2436 dotnet_diagnostic.S2436.severity = none -# Title : Silly bit operations should not be performed +# Title : Unnecessary bit operations should not be performed # Category : Blocker Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2437 dotnet_diagnostic.S2437.severity = warning +# Title : Blocks should be synchronized on read-only fields +# Category : Major Bug +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2445 +# Comment : Noise +dotnet_diagnostic.S2445.severity = none + # Title : Whitespace and control characters in string literals should be explicit # Category : Critical Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2479 @@ -2851,8 +2881,7 @@ dotnet_diagnostic.S2486.severity = warning # Title : Shared resources should not be used for locking # Category : Critical Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2551 -# Redundant: CA2002 -dotnet_diagnostic.S2551.severity = none +dotnet_diagnostic.S2551.severity = warning # Title : Conditionally executed code should be reachable # Category : Major Bug @@ -2863,7 +2892,8 @@ dotnet_diagnostic.S2583.severity = none # Title : Boolean expressions should not be gratuitous # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2589 -dotnet_diagnostic.S2589.severity = warning +# Comment : Too many false positives. +dotnet_diagnostic.S2589.severity = none # Title : Setting loose file permissions is security-sensitive # Category : Major Security Hotspot @@ -2920,7 +2950,7 @@ dotnet_diagnostic.S2743.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2755 dotnet_diagnostic.S2755.severity = warning -# Title : "=+" should not be used instead of "+=" +# Title : Non-existent operators like "=+" should not be used # Category : Major Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2757 dotnet_diagnostic.S2757.severity = warning @@ -2945,6 +2975,11 @@ dotnet_diagnostic.S2761.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2857 dotnet_diagnostic.S2857.severity = warning +# Title : "Thread.Sleep" should not be used in tests +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2925 +dotnet_diagnostic.S2925.severity = none + # Title : "IDisposables" should be disposed # Category : Blocker Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2930 @@ -2983,6 +3018,11 @@ dotnet_diagnostic.S2953.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2955 dotnet_diagnostic.S2955.severity = warning +# Title : Assertions should be complete +# Category : Blocker Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2970 +dotnet_diagnostic.S2970.severity = warning + # Title : "IEnumerable" LINQs should be simplified # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2971 @@ -3033,6 +3073,11 @@ dotnet_diagnostic.S3059.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3060 dotnet_diagnostic.S3060.severity = warning +# Title : "StringBuilder" data should be used +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-3063 +dotnet_diagnostic.S3063.severity = warning + # Title : "async" methods should not return "void" # Category : Major Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3168 @@ -3090,7 +3135,7 @@ dotnet_diagnostic.S3235.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3236 dotnet_diagnostic.S3236.severity = none -# Title : "value" parameters should be used +# Title : "value" contextual keyword should be used # Category : Blocker Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3237 dotnet_diagnostic.S3237.severity = warning @@ -3159,7 +3204,7 @@ dotnet_diagnostic.S3257.severity = none # Title : Non-derived "private" classes and records should be "sealed" # Category : Minor Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3260 -# Redundant: CA1852 +# Redundant: R9A013 dotnet_diagnostic.S3260.severity = none # Title : Namespaces should not be empty @@ -3223,6 +3268,11 @@ dotnet_diagnostic.S3353.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3358 dotnet_diagnostic.S3358.severity = warning +# Title : Date and time should not be used as a type for primary keys +# Category : Minor Bug +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-3363 +dotnet_diagnostic.S3363.severity = warning + # Title : "this" should not be exposed from constructors # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3366 @@ -3239,6 +3289,11 @@ dotnet_diagnostic.S3376.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3397 dotnet_diagnostic.S3397.severity = warning +# Title : "private" methods called only by inner classes should be moved to those classes +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-3398 +dotnet_diagnostic.S3398.severity = warning + # Title : Methods should not return constants # Category : Minor Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3400 @@ -3249,7 +3304,7 @@ dotnet_diagnostic.S3400.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3415 dotnet_diagnostic.S3415.severity = warning -# Title : Method overloads with default parameter values should not overlap +# Title : Method overloads with default parameter values should not overlap # Category : Blocker Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3427 dotnet_diagnostic.S3427.severity = warning @@ -3447,6 +3502,11 @@ dotnet_diagnostic.S3876.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3877 dotnet_diagnostic.S3877.severity = none +# Title : Arrays should not be created for params parameters +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-3878 +dotnet_diagnostic.S3878.severity = suggestion + # Title : Finalizers should not be empty # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3880 @@ -3472,7 +3532,7 @@ dotnet_diagnostic.S3885.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3887 dotnet_diagnostic.S3887.severity = warning -# Title : Neither "Thread.Resume" nor "Thread.Suspend" should be used +# Title : "Thread.Resume" and "Thread.Suspend" should not be used # Category : Blocker Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3889 dotnet_diagnostic.S3889.severity = warning @@ -3846,7 +3906,8 @@ dotnet_diagnostic.S4144.severity = warning # Title : Empty collections should not be accessed or iterated # Category : Minor Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4158 -dotnet_diagnostic.S4158.severity = warning +# Comment : Too many false positives +dotnet_diagnostic.S4158.severity = none # Title : Classes should implement their "ExportAttribute" interfaces # Category : Blocker Bug @@ -3980,6 +4041,11 @@ dotnet_diagnostic.S4507.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4524 dotnet_diagnostic.S4524.severity = warning +# Title : "DebuggerDisplayAttribute" strings should reference existing members +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-4545 +dotnet_diagnostic.S4545.severity = warning + # Title : ASP.NET HTTP request validation feature should not be disabled # Category : Major Vulnerability # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4564 @@ -4000,11 +4066,16 @@ dotnet_diagnostic.S4583.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4586 dotnet_diagnostic.S4586.severity = warning -# Title : String offset-based methods should be preferred for finding substrings from offsets +# Title : Start index should be used instead of calling Substring # Category : Critical Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4635 dotnet_diagnostic.S4635.severity = warning +# Title : Comments should not be empty +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-4663 +dotnet_diagnostic.S4663.severity = none + # Title : Using regular expressions is security-sensitive # Category : Critical Security Hotspot # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4784 @@ -4116,10 +4187,15 @@ dotnet_diagnostic.S5766.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-5773 dotnet_diagnostic.S5773.severity = warning +# Title : Regular expressions should be syntactically valid +# Category : Critical Bug +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-5856 +dotnet_diagnostic.S5856.severity = warning + # Title : Use a testable date/time provider # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-6354 -# Redundant: EA0002 +# Redundant: R9A022 dotnet_diagnostic.S6354.severity = none # Title : Azure Functions should be stateless @@ -4155,7 +4231,120 @@ dotnet_diagnostic.S6424.severity = warning # Title : Not specifying a timeout for regular expressions is security-sensitive # Category : Major Security Hotspot # Help Link: https://rules.sonarsource.com/csharp/RSPEC-6444 -dotnet_diagnostic.S6444.severity = warning +dotnet_diagnostic.S6444.severity = none + +# Title : Blocks should not be synchronized on local variables +# Category : Major Bug +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6507 +# Comment : Too many false positives +dotnet_diagnostic.S6507.severity = none + +# Title : "ExcludeFromCodeCoverage" attributes should include a justification +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6513 +dotnet_diagnostic.S6513.severity = suggestion + +# Title : Avoid using "DateTime.Now" for benchmarking or timing operations +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6561 +dotnet_diagnostic.S6561.severity = warning + +# Title : Always set the "DateTimeKind" when creating new "DateTime" instances +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6562 +# Comment : Noise +dotnet_diagnostic.S6562.severity = none + +# Title : Use UTC when recording DateTime instants +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6563 +dotnet_diagnostic.S6563.severity = none + +# Title : Use "DateTimeOffset" instead of "DateTime" +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6566 +# Comment : Noise +dotnet_diagnostic.S6566.severity = none + +# Title : Use "TimeZoneInfo.FindSystemTimeZoneById" without converting the timezones with "TimezoneConverter" +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6575 +dotnet_diagnostic.S6575.severity = warning + +# Title : Use a format provider when parsing date and time +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6580 +dotnet_diagnostic.S6580.severity = warning + +# Title : Don't hardcode the format when turning dates and times to strings +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6585 +dotnet_diagnostic.S6585.severity = none + +# Title : Use the "UnixEpoch" field instead of creating "DateTime" instances that point to the beginning of the Unix epoch +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6588 +dotnet_diagnostic.S6588.severity = warning + +# Title : "Find" method should be used instead of the "FirstOrDefault" extension +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6602 +dotnet_diagnostic.S6602.severity = none + +# Title : The collection-specific "TrueForAll" method should be used instead of the "All" extension +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6603 +dotnet_diagnostic.S6603.severity = none + +# Title : Collection-specific "Exists" method should be used instead of the "Any" extension +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6605 +dotnet_diagnostic.S6605.severity = none + +# Title : The collection should be filtered before sorting by using "Where" before "OrderBy" +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6607 +dotnet_diagnostic.S6607.severity = none + +# Title : Prefer indexing instead of "Enumerable" methods on types implementing "IList" +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6608 +dotnet_diagnostic.S6608.severity = none + +# Title : "Min/Max" properties of "Set" types should be used instead of the "Enumerable" extension methods +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6609 +dotnet_diagnostic.S6609.severity = none + +# Title : "StartsWith" and "EndsWith" overloads that take a "char" should be used instead of the ones that take a "string" +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6610 +dotnet_diagnostic.S6610.severity = none + +# Title : The lambda parameter should be used instead of capturing arguments in "ConcurrentDictionary" methods +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6612 +dotnet_diagnostic.S6612.severity = none + +# Title : "First" and "Last" properties of "LinkedList" should be used instead of the "First()" and "Last()" extension methods +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6613 +dotnet_diagnostic.S6613.severity = none + +# Title : "Contains" should be used instead of "Any" for simple equality checks +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6617 +dotnet_diagnostic.S6617.severity = none + +# Title : "string.Create" should be used instead of "FormattableString" +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6618 +dotnet_diagnostic.S6618.severity = none + +# Title : Using unsafe code blocks is security-sensitive +# Category : Major Security Hotspot +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6640 +dotnet_diagnostic.S6640.severity = warning # Title : Literal suffixes should be upper case # Category : Minor Code Smell @@ -4202,6 +4391,10 @@ dotnet_diagnostic.S9999-symbolRef.severity = warning # Category : dotnet_diagnostic.S9999-token-type.severity = warning +# Title : Analysis Warning generator +# Category : +dotnet_diagnostic.S9999-warning.severity = warning + # Title : Avoid legacy thread switching APIs # Category : Usage # Help Link: https://github.com/Microsoft/vs-threading/blob/main/doc/analyzers/VSTHRD001.md @@ -4255,6 +4448,7 @@ dotnet_diagnostic.VSTHRD102.severity = suggestion # Title : Call async methods when in an async method # Category : Usage # Help Link: https://github.com/Microsoft/vs-threading/blob/main/doc/analyzers/VSTHRD103.md +# Redundant: CA1849 dotnet_diagnostic.VSTHRD103.severity = none # Title : Offer async methods diff --git a/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/General.globalconfig b/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/General.globalconfig index 3bb10ed18e3..329158eee37 100644 --- a/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/General.globalconfig +++ b/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/General.globalconfig @@ -1,5 +1,5 @@ # Created by DiagConfig, the diagnostic config generator -# Generated : 2023-10-22 00:37:56Z +# Generated : 2024-01-25 20:57:53Z # Max Tier : 3 # Attributes: general # Analyzers : ILLink.RoslynAnalyzer, Microsoft.Analyzers.Extra, Microsoft.Analyzers.Local, Microsoft.AspNetCore.App.Analyzers, Microsoft.AspNetCore.Components.Analyzers, Microsoft.CodeAnalysis.CSharp.NetAnalyzers, Microsoft.CodeAnalysis.NetAnalyzers, Microsoft.VisualStudio.Threading.Analyzers, Microsoft.VisualStudio.Threading.Analyzers.CSharp, SonarAnalyzer.CSharp @@ -108,7 +108,7 @@ dotnet_diagnostic.CA1001.severity = warning # Title : Types that own disposable fields should be disposable # Category : Design # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1001 -dotnet_diagnostic.CA1001.severity = warning +dotnet_diagnostic.CA1001.severity = none # Title : Do not expose generic lists # Category : Design @@ -196,6 +196,7 @@ dotnet_diagnostic.CA1028.severity = none # Category : Design # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1030 dotnet_diagnostic.CA1030.severity = warning +dotnet_code_quality.CA1030.api_surface = public # Title : Do not catch general exception types # Category : Design @@ -275,6 +276,7 @@ dotnet_diagnostic.CA1051.severity = none # Category : Design # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1052 dotnet_diagnostic.CA1052.severity = warning +dotnet_code_quality.CA1052.api_surface = all # Title : URI-like parameters should not be strings # Category : Design @@ -317,6 +319,7 @@ dotnet_diagnostic.CA1062.severity = none # Category : Design # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1063 dotnet_diagnostic.CA1063.severity = warning +dotnet_code_quality.CA1063.api_surface = public # Title : Exceptions should be public # Category : Design @@ -575,6 +578,7 @@ dotnet_diagnostic.CA1724.severity = none # Category : Naming # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1725 dotnet_diagnostic.CA1725.severity = warning +dotnet_code_quality.CA1725.api_surface = public, protected # Title : Use PascalCase for named placeholders # Category : Naming @@ -669,6 +673,7 @@ dotnet_diagnostic.CA1821.severity = none # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1822 dotnet_diagnostic.CA1822.severity = warning +dotnet_code_quality.CA1822.api_surface = all # Title : Avoid unused private fields # Category : Performance @@ -798,7 +803,7 @@ dotnet_diagnostic.CA1847.severity = none # Title : Use the LoggerMessage delegates # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1848 -# Comment : Use the code generated model instead. +# Comment : Use R9 logging model instead dotnet_diagnostic.CA1848.severity = none # Title : Call async methods when in an async method @@ -849,7 +854,7 @@ dotnet_diagnostic.CA1857.severity = warning # Title : Use 'StartsWith' instead of 'IndexOf' # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1858 -dotnet_diagnostic.CA1858.severity = none +dotnet_diagnostic.CA1858.severity = suggestion # Title : Use concrete types when possible for improved performance # Category : Performance @@ -859,7 +864,7 @@ dotnet_diagnostic.CA1859.severity = none # Title : Avoid using 'Enumerable.Any()' extension method # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1860 -dotnet_diagnostic.CA1860.severity = none +dotnet_diagnostic.CA1860.severity = suggestion # Title : Avoid constant arrays as arguments # Category : Performance @@ -869,7 +874,7 @@ dotnet_diagnostic.CA1861.severity = suggestion # Title : Use the 'StringComparison' method overloads to perform case-insensitive string comparisons # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1862 -dotnet_diagnostic.CA1862.severity = none +dotnet_diagnostic.CA1862.severity = suggestion # Title : Use 'CompositeFormat' # Category : Performance @@ -904,12 +909,12 @@ dotnet_diagnostic.CA1868.severity = suggestion # Title : Cache and reuse 'JsonSerializerOptions' instances # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1869 -dotnet_diagnostic.CA1869.severity = none +dotnet_diagnostic.CA1869.severity = suggestion # Title : Use a cached 'SearchValues' instance # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1870 -dotnet_diagnostic.CA1870.severity = none +dotnet_diagnostic.CA1870.severity = suggestion # Title : Dispose objects before losing scope # Category : Reliability @@ -1045,6 +1050,7 @@ dotnet_diagnostic.CA2207.severity = none # Category : Usage # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2208 dotnet_diagnostic.CA2208.severity = warning +dotnet_code_quality.CA2208.api_surface = all # Title : Non-constant fields should not be visible # Category : Usage @@ -1108,6 +1114,7 @@ dotnet_diagnostic.CA2229.severity = none # Category : Usage # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2231 dotnet_diagnostic.CA2231.severity = error +dotnet_code_quality.CA2231.api_surface = public # Title : Pass system uri objects instead of strings # Category : Usage @@ -1130,6 +1137,7 @@ dotnet_diagnostic.CA2237.severity = none # Category : Usage # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2241 dotnet_diagnostic.CA2241.severity = warning +dotnet_code_quality.CA2241.try_determine_additional_string_formatting_methods_automatically = false # Title : Test for NaN correctly # Category : Usage @@ -2122,7 +2130,7 @@ dotnet_diagnostic.S103.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-104 dotnet_diagnostic.S104.severity = warning -# Title : Destructors should not throw exceptions +# Title : Finalizers should not throw exceptions # Category : Blocker Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1048 # Redundant: CA1065 @@ -2198,7 +2206,7 @@ dotnet_diagnostic.S1110.severity = none # Redundant: SA1106 dotnet_diagnostic.S1116.severity = none -# Title : Local variables should not shadow class fields +# Title : Local variables should not shadow class fields or properties # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1117 dotnet_diagnostic.S1117.severity = warning @@ -2241,6 +2249,11 @@ dotnet_diagnostic.S1128.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-113 dotnet_diagnostic.S113.severity = none +# Title : Deprecated code should be removed +# Category : Info Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-1133 +dotnet_diagnostic.S1133.severity = suggestion + # Title : Track uses of "FIXME" tags # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1134 @@ -2313,7 +2326,7 @@ dotnet_diagnostic.S1192.severity = suggestion # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1199 dotnet_diagnostic.S1199.severity = warning -# Title : Classes should not be coupled to too many other classes (Single Responsibility Principle) +# Title : Classes should not be coupled to too many other classes # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1200 dotnet_diagnostic.S1200.severity = none @@ -2494,7 +2507,7 @@ dotnet_diagnostic.S1699.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1751 dotnet_diagnostic.S1751.severity = warning -# Title : Identical expressions should not be used on both sides of a binary operator +# Title : Identical expressions should not be used on both sides of operators # Category : Major Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1764 dotnet_diagnostic.S1764.severity = warning @@ -2546,7 +2559,7 @@ dotnet_diagnostic.S1939.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1940 dotnet_diagnostic.S1940.severity = warning -# Title : Inappropriate casts should not be made +# Title : Invalid casts should be avoided # Category : Critical Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1944 dotnet_diagnostic.S1944.severity = warning @@ -2583,6 +2596,11 @@ dotnet_diagnostic.S2077.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2092 dotnet_diagnostic.S2092.severity = warning +# Title : Classes should not be empty +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2094 +dotnet_diagnostic.S2094.severity = none + # Title : Collections should not be passed as arguments to their own methods # Category : Major Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2114 @@ -2608,6 +2626,11 @@ dotnet_diagnostic.S2148.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2156 dotnet_diagnostic.S2156.severity = warning +# Title : Classes named like "Exception" should extend "Exception" or a subclass +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2166 +dotnet_diagnostic.S2166.severity = warning + # Title : Short-circuit logic should be used in boolean contexts # Category : Blocker Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2178 @@ -2623,12 +2646,12 @@ dotnet_diagnostic.S2183.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2184 dotnet_diagnostic.S2184.severity = warning -# Title : TestCases should contain tests +# Title : Test classes should contain at least one test case # Category : Blocker Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2187 dotnet_diagnostic.S2187.severity = warning -# Title : Recursion should not be infinite +# Title : Loops and recursions should not be infinite # Category : Blocker Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2190 dotnet_diagnostic.S2190.severity = warning @@ -2638,7 +2661,12 @@ dotnet_diagnostic.S2190.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2197 dotnet_diagnostic.S2197.severity = warning -# Title : Return values from functions without side effects should not be ignored +# Title : Unnecessary mathematical comparisons should not be made +# Category : Critical Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2198 +dotnet_diagnostic.S2198.severity = warning + +# Title : Methods without side effects should not have their return values ignored # Category : Major Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2201 # Redundant: CA1806 @@ -2674,7 +2702,7 @@ dotnet_diagnostic.S2225.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2228 dotnet_diagnostic.S2228.severity = none -# Title : Parameters should be passed in the correct order +# Title : Arguments should be passed in the same order as the method parameters # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2234 dotnet_diagnostic.S2234.severity = warning @@ -2851,11 +2879,17 @@ dotnet_diagnostic.S2387.severity = warning # Redundant: CA1005 dotnet_diagnostic.S2436.severity = none -# Title : Silly bit operations should not be performed +# Title : Unnecessary bit operations should not be performed # Category : Blocker Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2437 dotnet_diagnostic.S2437.severity = warning +# Title : Blocks should be synchronized on read-only fields +# Category : Major Bug +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2445 +# Comment : Noise +dotnet_diagnostic.S2445.severity = none + # Title : Whitespace and control characters in string literals should be explicit # Category : Critical Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2479 @@ -2869,8 +2903,7 @@ dotnet_diagnostic.S2486.severity = warning # Title : Shared resources should not be used for locking # Category : Critical Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2551 -# Redundant: CA2002 -dotnet_diagnostic.S2551.severity = none +dotnet_diagnostic.S2551.severity = warning # Title : Conditionally executed code should be reachable # Category : Major Bug @@ -2881,7 +2914,8 @@ dotnet_diagnostic.S2583.severity = none # Title : Boolean expressions should not be gratuitous # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2589 -dotnet_diagnostic.S2589.severity = warning +# Comment : Too many false positives. +dotnet_diagnostic.S2589.severity = none # Title : Setting loose file permissions is security-sensitive # Category : Major Security Hotspot @@ -2938,7 +2972,7 @@ dotnet_diagnostic.S2743.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2755 dotnet_diagnostic.S2755.severity = warning -# Title : "=+" should not be used instead of "+=" +# Title : Non-existent operators like "=+" should not be used # Category : Major Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2757 dotnet_diagnostic.S2757.severity = warning @@ -2963,6 +2997,11 @@ dotnet_diagnostic.S2761.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2857 dotnet_diagnostic.S2857.severity = warning +# Title : "Thread.Sleep" should not be used in tests +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2925 +dotnet_diagnostic.S2925.severity = none + # Title : "IDisposables" should be disposed # Category : Blocker Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2930 @@ -3001,6 +3040,11 @@ dotnet_diagnostic.S2953.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2955 dotnet_diagnostic.S2955.severity = warning +# Title : Assertions should be complete +# Category : Blocker Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2970 +dotnet_diagnostic.S2970.severity = warning + # Title : "IEnumerable" LINQs should be simplified # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2971 @@ -3052,6 +3096,11 @@ dotnet_diagnostic.S3059.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3060 dotnet_diagnostic.S3060.severity = warning +# Title : "StringBuilder" data should be used +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-3063 +dotnet_diagnostic.S3063.severity = warning + # Title : "async" methods should not return "void" # Category : Major Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3168 @@ -3109,7 +3158,7 @@ dotnet_diagnostic.S3235.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3236 dotnet_diagnostic.S3236.severity = warning -# Title : "value" parameters should be used +# Title : "value" contextual keyword should be used # Category : Blocker Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3237 dotnet_diagnostic.S3237.severity = warning @@ -3174,12 +3223,13 @@ dotnet_diagnostic.S3256.severity = warning # Title : Declarations and initializations should be as concise as possible # Category : Minor Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3257 -dotnet_diagnostic.S3257.severity = warning +# Comment : Too many false positives +dotnet_diagnostic.S3257.severity = none # Title : Non-derived "private" classes and records should be "sealed" # Category : Minor Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3260 -# Redundant: CA1852 +# Redundant: R9A013 dotnet_diagnostic.S3260.severity = none # Title : Namespaces should not be empty @@ -3243,6 +3293,11 @@ dotnet_diagnostic.S3353.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3358 dotnet_diagnostic.S3358.severity = warning +# Title : Date and time should not be used as a type for primary keys +# Category : Minor Bug +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-3363 +dotnet_diagnostic.S3363.severity = warning + # Title : "this" should not be exposed from constructors # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3366 @@ -3259,6 +3314,11 @@ dotnet_diagnostic.S3376.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3397 dotnet_diagnostic.S3397.severity = warning +# Title : "private" methods called only by inner classes should be moved to those classes +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-3398 +dotnet_diagnostic.S3398.severity = warning + # Title : Methods should not return constants # Category : Minor Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3400 @@ -3269,7 +3329,7 @@ dotnet_diagnostic.S3400.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3415 dotnet_diagnostic.S3415.severity = warning -# Title : Method overloads with default parameter values should not overlap +# Title : Method overloads with default parameter values should not overlap # Category : Blocker Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3427 dotnet_diagnostic.S3427.severity = warning @@ -3467,6 +3527,11 @@ dotnet_diagnostic.S3876.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3877 dotnet_diagnostic.S3877.severity = none +# Title : Arrays should not be created for params parameters +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-3878 +dotnet_diagnostic.S3878.severity = suggestion + # Title : Finalizers should not be empty # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3880 @@ -3492,7 +3557,7 @@ dotnet_diagnostic.S3885.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3887 dotnet_diagnostic.S3887.severity = warning -# Title : Neither "Thread.Resume" nor "Thread.Suspend" should be used +# Title : "Thread.Resume" and "Thread.Suspend" should not be used # Category : Blocker Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3889 dotnet_diagnostic.S3889.severity = warning @@ -3732,7 +3797,7 @@ dotnet_diagnostic.S4022.severity = warning # Title : Interfaces should not be empty # Category : Minor Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4023 -dotnet_diagnostic.S4023.severity = warning +dotnet_diagnostic.S4023.severity = none # Title : Child class fields should not differ from parent class fields only by capitalization # Category : Critical Code Smell @@ -3870,7 +3935,8 @@ dotnet_diagnostic.S4144.severity = warning # Title : Empty collections should not be accessed or iterated # Category : Minor Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4158 -dotnet_diagnostic.S4158.severity = warning +# Comment : Too many false positives +dotnet_diagnostic.S4158.severity = none # Title : Classes should implement their "ExportAttribute" interfaces # Category : Blocker Bug @@ -4004,6 +4070,11 @@ dotnet_diagnostic.S4507.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4524 dotnet_diagnostic.S4524.severity = warning +# Title : "DebuggerDisplayAttribute" strings should reference existing members +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-4545 +dotnet_diagnostic.S4545.severity = warning + # Title : ASP.NET HTTP request validation feature should not be disabled # Category : Major Vulnerability # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4564 @@ -4024,11 +4095,16 @@ dotnet_diagnostic.S4583.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4586 dotnet_diagnostic.S4586.severity = warning -# Title : String offset-based methods should be preferred for finding substrings from offsets +# Title : Start index should be used instead of calling Substring # Category : Critical Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4635 dotnet_diagnostic.S4635.severity = warning +# Title : Comments should not be empty +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-4663 +dotnet_diagnostic.S4663.severity = suggestion + # Title : Using regular expressions is security-sensitive # Category : Critical Security Hotspot # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4784 @@ -4140,10 +4216,15 @@ dotnet_diagnostic.S5766.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-5773 dotnet_diagnostic.S5773.severity = warning +# Title : Regular expressions should be syntactically valid +# Category : Critical Bug +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-5856 +dotnet_diagnostic.S5856.severity = warning + # Title : Use a testable date/time provider # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-6354 -# Redundant: EA0002 +# Redundant: R9A022 dotnet_diagnostic.S6354.severity = none # Title : Azure Functions should be stateless @@ -4179,7 +4260,120 @@ dotnet_diagnostic.S6424.severity = warning # Title : Not specifying a timeout for regular expressions is security-sensitive # Category : Major Security Hotspot # Help Link: https://rules.sonarsource.com/csharp/RSPEC-6444 -dotnet_diagnostic.S6444.severity = warning +dotnet_diagnostic.S6444.severity = none + +# Title : Blocks should not be synchronized on local variables +# Category : Major Bug +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6507 +# Comment : Too many false positives +dotnet_diagnostic.S6507.severity = none + +# Title : "ExcludeFromCodeCoverage" attributes should include a justification +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6513 +dotnet_diagnostic.S6513.severity = suggestion + +# Title : Avoid using "DateTime.Now" for benchmarking or timing operations +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6561 +dotnet_diagnostic.S6561.severity = warning + +# Title : Always set the "DateTimeKind" when creating new "DateTime" instances +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6562 +# Comment : Noise +dotnet_diagnostic.S6562.severity = none + +# Title : Use UTC when recording DateTime instants +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6563 +dotnet_diagnostic.S6563.severity = none + +# Title : Use "DateTimeOffset" instead of "DateTime" +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6566 +# Comment : Noise +dotnet_diagnostic.S6566.severity = none + +# Title : Use "TimeZoneInfo.FindSystemTimeZoneById" without converting the timezones with "TimezoneConverter" +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6575 +dotnet_diagnostic.S6575.severity = warning + +# Title : Use a format provider when parsing date and time +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6580 +dotnet_diagnostic.S6580.severity = warning + +# Title : Don't hardcode the format when turning dates and times to strings +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6585 +dotnet_diagnostic.S6585.severity = none + +# Title : Use the "UnixEpoch" field instead of creating "DateTime" instances that point to the beginning of the Unix epoch +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6588 +dotnet_diagnostic.S6588.severity = warning + +# Title : "Find" method should be used instead of the "FirstOrDefault" extension +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6602 +dotnet_diagnostic.S6602.severity = none + +# Title : The collection-specific "TrueForAll" method should be used instead of the "All" extension +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6603 +dotnet_diagnostic.S6603.severity = none + +# Title : Collection-specific "Exists" method should be used instead of the "Any" extension +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6605 +dotnet_diagnostic.S6605.severity = none + +# Title : The collection should be filtered before sorting by using "Where" before "OrderBy" +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6607 +dotnet_diagnostic.S6607.severity = none + +# Title : Prefer indexing instead of "Enumerable" methods on types implementing "IList" +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6608 +dotnet_diagnostic.S6608.severity = none + +# Title : "Min/Max" properties of "Set" types should be used instead of the "Enumerable" extension methods +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6609 +dotnet_diagnostic.S6609.severity = none + +# Title : "StartsWith" and "EndsWith" overloads that take a "char" should be used instead of the ones that take a "string" +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6610 +dotnet_diagnostic.S6610.severity = none + +# Title : The lambda parameter should be used instead of capturing arguments in "ConcurrentDictionary" methods +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6612 +dotnet_diagnostic.S6612.severity = none + +# Title : "First" and "Last" properties of "LinkedList" should be used instead of the "First()" and "Last()" extension methods +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6613 +dotnet_diagnostic.S6613.severity = none + +# Title : "Contains" should be used instead of "Any" for simple equality checks +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6617 +dotnet_diagnostic.S6617.severity = none + +# Title : "string.Create" should be used instead of "FormattableString" +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6618 +dotnet_diagnostic.S6618.severity = none + +# Title : Using unsafe code blocks is security-sensitive +# Category : Major Security Hotspot +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6640 +dotnet_diagnostic.S6640.severity = warning # Title : Literal suffixes should be upper case # Category : Minor Code Smell @@ -4226,6 +4420,10 @@ dotnet_diagnostic.S9999-symbolRef.severity = warning # Category : dotnet_diagnostic.S9999-token-type.severity = warning +# Title : Analysis Warning generator +# Category : +dotnet_diagnostic.S9999-warning.severity = warning + # Title : Avoid legacy thread switching APIs # Category : Usage # Help Link: https://github.com/Microsoft/vs-threading/blob/main/doc/analyzers/VSTHRD001.md @@ -4279,6 +4477,7 @@ dotnet_diagnostic.VSTHRD102.severity = suggestion # Title : Call async methods when in an async method # Category : Usage # Help Link: https://github.com/Microsoft/vs-threading/blob/main/doc/analyzers/VSTHRD103.md +# Redundant: CA1849 dotnet_diagnostic.VSTHRD103.severity = none # Title : Offer async methods diff --git a/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/NonProdExe-Tier1.globalconfig b/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/NonProdExe-Tier1.globalconfig index 027b5368f1a..8651b023cd8 100644 --- a/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/NonProdExe-Tier1.globalconfig +++ b/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/NonProdExe-Tier1.globalconfig @@ -1,5 +1,5 @@ # Created by DiagConfig, the diagnostic config generator -# Generated : 2023-10-22 00:37:51Z +# Generated : 2024-01-25 20:57:48Z # Max Tier : 1 # Attributes: general # Analyzers : ILLink.RoslynAnalyzer, Microsoft.Analyzers.Extra, Microsoft.Analyzers.Local, Microsoft.AspNetCore.App.Analyzers, Microsoft.AspNetCore.Components.Analyzers, Microsoft.CodeAnalysis.CSharp.NetAnalyzers, Microsoft.CodeAnalysis.NetAnalyzers, Microsoft.VisualStudio.Threading.Analyzers, Microsoft.VisualStudio.Threading.Analyzers.CSharp, SonarAnalyzer.CSharp @@ -309,6 +309,7 @@ dotnet_diagnostic.CA1062.severity = none # Category : Design # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1063 dotnet_diagnostic.CA1063.severity = warning +dotnet_code_quality.CA1063.api_surface = public # Title : Exceptions should be public # Category : Design @@ -828,7 +829,7 @@ dotnet_diagnostic.CA1857.severity = warning # Title : Use 'StartsWith' instead of 'IndexOf' # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1858 -dotnet_diagnostic.CA1858.severity = none +dotnet_diagnostic.CA1858.severity = suggestion # Title : Use concrete types when possible for improved performance # Category : Performance @@ -838,7 +839,7 @@ dotnet_diagnostic.CA1859.severity = none # Title : Avoid using 'Enumerable.Any()' extension method # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1860 -dotnet_diagnostic.CA1860.severity = none +dotnet_diagnostic.CA1860.severity = suggestion # Title : Avoid constant arrays as arguments # Category : Performance @@ -848,7 +849,7 @@ dotnet_diagnostic.CA1861.severity = suggestion # Title : Use the 'StringComparison' method overloads to perform case-insensitive string comparisons # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1862 -dotnet_diagnostic.CA1862.severity = none +dotnet_diagnostic.CA1862.severity = suggestion # Title : Use 'CompositeFormat' # Category : Performance @@ -883,12 +884,12 @@ dotnet_diagnostic.CA1868.severity = suggestion # Title : Cache and reuse 'JsonSerializerOptions' instances # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1869 -dotnet_diagnostic.CA1869.severity = none +dotnet_diagnostic.CA1869.severity = suggestion # Title : Use a cached 'SearchValues' instance # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1870 -dotnet_diagnostic.CA1870.severity = none +dotnet_diagnostic.CA1870.severity = suggestion # Title : Dispose objects before losing scope # Category : Reliability @@ -1105,6 +1106,7 @@ dotnet_diagnostic.CA2237.severity = none # Category : Usage # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2241 dotnet_diagnostic.CA2241.severity = warning +dotnet_code_quality.CA2241.try_determine_additional_string_formatting_methods_automatically = false # Title : Test for NaN correctly # Category : Usage @@ -2095,7 +2097,7 @@ dotnet_diagnostic.S103.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-104 dotnet_diagnostic.S104.severity = none -# Title : Destructors should not throw exceptions +# Title : Finalizers should not throw exceptions # Category : Blocker Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1048 # Redundant: CA1065 @@ -2166,7 +2168,7 @@ dotnet_diagnostic.S1110.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1116 dotnet_diagnostic.S1116.severity = none -# Title : Local variables should not shadow class fields +# Title : Local variables should not shadow class fields or properties # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1117 dotnet_diagnostic.S1117.severity = warning @@ -2206,6 +2208,11 @@ dotnet_diagnostic.S1128.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-113 dotnet_diagnostic.S113.severity = none +# Title : Deprecated code should be removed +# Category : Info Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-1133 +dotnet_diagnostic.S1133.severity = suggestion + # Title : Track uses of "FIXME" tags # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1134 @@ -2277,7 +2284,7 @@ dotnet_diagnostic.S1192.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1199 dotnet_diagnostic.S1199.severity = none -# Title : Classes should not be coupled to too many other classes (Single Responsibility Principle) +# Title : Classes should not be coupled to too many other classes # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1200 dotnet_diagnostic.S1200.severity = none @@ -2454,7 +2461,7 @@ dotnet_diagnostic.S1699.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1751 dotnet_diagnostic.S1751.severity = warning -# Title : Identical expressions should not be used on both sides of a binary operator +# Title : Identical expressions should not be used on both sides of operators # Category : Major Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1764 dotnet_diagnostic.S1764.severity = warning @@ -2505,7 +2512,7 @@ dotnet_diagnostic.S1939.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1940 dotnet_diagnostic.S1940.severity = none -# Title : Inappropriate casts should not be made +# Title : Invalid casts should be avoided # Category : Critical Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1944 dotnet_diagnostic.S1944.severity = warning @@ -2542,6 +2549,11 @@ dotnet_diagnostic.S2077.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2092 dotnet_diagnostic.S2092.severity = none +# Title : Classes should not be empty +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2094 +dotnet_diagnostic.S2094.severity = none + # Title : Collections should not be passed as arguments to their own methods # Category : Major Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2114 @@ -2567,6 +2579,11 @@ dotnet_diagnostic.S2148.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2156 dotnet_diagnostic.S2156.severity = none +# Title : Classes named like "Exception" should extend "Exception" or a subclass +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2166 +dotnet_diagnostic.S2166.severity = warning + # Title : Short-circuit logic should be used in boolean contexts # Category : Blocker Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2178 @@ -2582,12 +2599,12 @@ dotnet_diagnostic.S2183.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2184 dotnet_diagnostic.S2184.severity = none -# Title : TestCases should contain tests +# Title : Test classes should contain at least one test case # Category : Blocker Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2187 dotnet_diagnostic.S2187.severity = none -# Title : Recursion should not be infinite +# Title : Loops and recursions should not be infinite # Category : Blocker Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2190 dotnet_diagnostic.S2190.severity = none @@ -2597,7 +2614,12 @@ dotnet_diagnostic.S2190.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2197 dotnet_diagnostic.S2197.severity = warning -# Title : Return values from functions without side effects should not be ignored +# Title : Unnecessary mathematical comparisons should not be made +# Category : Critical Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2198 +dotnet_diagnostic.S2198.severity = warning + +# Title : Methods without side effects should not have their return values ignored # Category : Major Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2201 # Redundant: CA1806 @@ -2633,7 +2655,7 @@ dotnet_diagnostic.S2225.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2228 dotnet_diagnostic.S2228.severity = none -# Title : Parameters should be passed in the correct order +# Title : Arguments should be passed in the same order as the method parameters # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2234 dotnet_diagnostic.S2234.severity = warning @@ -2807,11 +2829,17 @@ dotnet_diagnostic.S2387.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2436 dotnet_diagnostic.S2436.severity = none -# Title : Silly bit operations should not be performed +# Title : Unnecessary bit operations should not be performed # Category : Blocker Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2437 dotnet_diagnostic.S2437.severity = warning +# Title : Blocks should be synchronized on read-only fields +# Category : Major Bug +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2445 +# Comment : Noise +dotnet_diagnostic.S2445.severity = none + # Title : Whitespace and control characters in string literals should be explicit # Category : Critical Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2479 @@ -2825,8 +2853,7 @@ dotnet_diagnostic.S2486.severity = none # Title : Shared resources should not be used for locking # Category : Critical Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2551 -# Redundant: CA2002 -dotnet_diagnostic.S2551.severity = none +dotnet_diagnostic.S2551.severity = warning # Title : Conditionally executed code should be reachable # Category : Major Bug @@ -2837,7 +2864,8 @@ dotnet_diagnostic.S2583.severity = none # Title : Boolean expressions should not be gratuitous # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2589 -dotnet_diagnostic.S2589.severity = warning +# Comment : Too many false positives. +dotnet_diagnostic.S2589.severity = none # Title : Setting loose file permissions is security-sensitive # Category : Major Security Hotspot @@ -2894,7 +2922,7 @@ dotnet_diagnostic.S2743.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2755 dotnet_diagnostic.S2755.severity = warning -# Title : "=+" should not be used instead of "+=" +# Title : Non-existent operators like "=+" should not be used # Category : Major Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2757 dotnet_diagnostic.S2757.severity = warning @@ -2919,6 +2947,11 @@ dotnet_diagnostic.S2761.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2857 dotnet_diagnostic.S2857.severity = warning +# Title : "Thread.Sleep" should not be used in tests +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2925 +dotnet_diagnostic.S2925.severity = none + # Title : "IDisposables" should be disposed # Category : Blocker Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2930 @@ -2957,6 +2990,11 @@ dotnet_diagnostic.S2953.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2955 dotnet_diagnostic.S2955.severity = none +# Title : Assertions should be complete +# Category : Blocker Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2970 +dotnet_diagnostic.S2970.severity = warning + # Title : "IEnumerable" LINQs should be simplified # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2971 @@ -3007,6 +3045,11 @@ dotnet_diagnostic.S3059.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3060 dotnet_diagnostic.S3060.severity = none +# Title : "StringBuilder" data should be used +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-3063 +dotnet_diagnostic.S3063.severity = warning + # Title : "async" methods should not return "void" # Category : Major Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3168 @@ -3063,7 +3106,7 @@ dotnet_diagnostic.S3235.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3236 dotnet_diagnostic.S3236.severity = none -# Title : "value" parameters should be used +# Title : "value" contextual keyword should be used # Category : Blocker Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3237 dotnet_diagnostic.S3237.severity = warning @@ -3194,6 +3237,11 @@ dotnet_diagnostic.S3353.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3358 dotnet_diagnostic.S3358.severity = warning +# Title : Date and time should not be used as a type for primary keys +# Category : Minor Bug +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-3363 +dotnet_diagnostic.S3363.severity = warning + # Title : "this" should not be exposed from constructors # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3366 @@ -3210,6 +3258,11 @@ dotnet_diagnostic.S3376.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3397 dotnet_diagnostic.S3397.severity = none +# Title : "private" methods called only by inner classes should be moved to those classes +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-3398 +dotnet_diagnostic.S3398.severity = warning + # Title : Methods should not return constants # Category : Minor Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3400 @@ -3220,7 +3273,7 @@ dotnet_diagnostic.S3400.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3415 dotnet_diagnostic.S3415.severity = warning -# Title : Method overloads with default parameter values should not overlap +# Title : Method overloads with default parameter values should not overlap # Category : Blocker Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3427 dotnet_diagnostic.S3427.severity = warning @@ -3416,6 +3469,11 @@ dotnet_diagnostic.S3876.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3877 dotnet_diagnostic.S3877.severity = none +# Title : Arrays should not be created for params parameters +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-3878 +dotnet_diagnostic.S3878.severity = suggestion + # Title : Finalizers should not be empty # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3880 @@ -3441,7 +3499,7 @@ dotnet_diagnostic.S3885.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3887 dotnet_diagnostic.S3887.severity = warning -# Title : Neither "Thread.Resume" nor "Thread.Suspend" should be used +# Title : "Thread.Resume" and "Thread.Suspend" should not be used # Category : Blocker Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3889 dotnet_diagnostic.S3889.severity = warning @@ -3940,6 +3998,11 @@ dotnet_diagnostic.S4507.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4524 dotnet_diagnostic.S4524.severity = warning +# Title : "DebuggerDisplayAttribute" strings should reference existing members +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-4545 +dotnet_diagnostic.S4545.severity = warning + # Title : ASP.NET HTTP request validation feature should not be disabled # Category : Major Vulnerability # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4564 @@ -3960,11 +4023,16 @@ dotnet_diagnostic.S4583.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4586 dotnet_diagnostic.S4586.severity = warning -# Title : String offset-based methods should be preferred for finding substrings from offsets +# Title : Start index should be used instead of calling Substring # Category : Critical Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4635 dotnet_diagnostic.S4635.severity = warning +# Title : Comments should not be empty +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-4663 +dotnet_diagnostic.S4663.severity = none + # Title : Using regular expressions is security-sensitive # Category : Critical Security Hotspot # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4784 @@ -4076,10 +4144,15 @@ dotnet_diagnostic.S5766.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-5773 dotnet_diagnostic.S5773.severity = none +# Title : Regular expressions should be syntactically valid +# Category : Critical Bug +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-5856 +dotnet_diagnostic.S5856.severity = warning + # Title : Use a testable date/time provider # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-6354 -# Redundant: EA0002 +# Redundant: R9A022 dotnet_diagnostic.S6354.severity = none # Title : Azure Functions should be stateless @@ -4115,7 +4188,120 @@ dotnet_diagnostic.S6424.severity = none # Title : Not specifying a timeout for regular expressions is security-sensitive # Category : Major Security Hotspot # Help Link: https://rules.sonarsource.com/csharp/RSPEC-6444 -dotnet_diagnostic.S6444.severity = warning +dotnet_diagnostic.S6444.severity = none + +# Title : Blocks should not be synchronized on local variables +# Category : Major Bug +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6507 +# Comment : Too many false positives +dotnet_diagnostic.S6507.severity = none + +# Title : "ExcludeFromCodeCoverage" attributes should include a justification +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6513 +dotnet_diagnostic.S6513.severity = suggestion + +# Title : Avoid using "DateTime.Now" for benchmarking or timing operations +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6561 +dotnet_diagnostic.S6561.severity = warning + +# Title : Always set the "DateTimeKind" when creating new "DateTime" instances +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6562 +# Comment : Noise +dotnet_diagnostic.S6562.severity = none + +# Title : Use UTC when recording DateTime instants +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6563 +dotnet_diagnostic.S6563.severity = none + +# Title : Use "DateTimeOffset" instead of "DateTime" +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6566 +# Comment : Noise +dotnet_diagnostic.S6566.severity = none + +# Title : Use "TimeZoneInfo.FindSystemTimeZoneById" without converting the timezones with "TimezoneConverter" +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6575 +dotnet_diagnostic.S6575.severity = warning + +# Title : Use a format provider when parsing date and time +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6580 +dotnet_diagnostic.S6580.severity = warning + +# Title : Don't hardcode the format when turning dates and times to strings +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6585 +dotnet_diagnostic.S6585.severity = none + +# Title : Use the "UnixEpoch" field instead of creating "DateTime" instances that point to the beginning of the Unix epoch +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6588 +dotnet_diagnostic.S6588.severity = warning + +# Title : "Find" method should be used instead of the "FirstOrDefault" extension +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6602 +dotnet_diagnostic.S6602.severity = none + +# Title : The collection-specific "TrueForAll" method should be used instead of the "All" extension +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6603 +dotnet_diagnostic.S6603.severity = none + +# Title : Collection-specific "Exists" method should be used instead of the "Any" extension +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6605 +dotnet_diagnostic.S6605.severity = none + +# Title : The collection should be filtered before sorting by using "Where" before "OrderBy" +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6607 +dotnet_diagnostic.S6607.severity = none + +# Title : Prefer indexing instead of "Enumerable" methods on types implementing "IList" +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6608 +dotnet_diagnostic.S6608.severity = none + +# Title : "Min/Max" properties of "Set" types should be used instead of the "Enumerable" extension methods +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6609 +dotnet_diagnostic.S6609.severity = none + +# Title : "StartsWith" and "EndsWith" overloads that take a "char" should be used instead of the ones that take a "string" +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6610 +dotnet_diagnostic.S6610.severity = none + +# Title : The lambda parameter should be used instead of capturing arguments in "ConcurrentDictionary" methods +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6612 +dotnet_diagnostic.S6612.severity = none + +# Title : "First" and "Last" properties of "LinkedList" should be used instead of the "First()" and "Last()" extension methods +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6613 +dotnet_diagnostic.S6613.severity = none + +# Title : "Contains" should be used instead of "Any" for simple equality checks +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6617 +dotnet_diagnostic.S6617.severity = none + +# Title : "string.Create" should be used instead of "FormattableString" +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6618 +dotnet_diagnostic.S6618.severity = none + +# Title : Using unsafe code blocks is security-sensitive +# Category : Major Security Hotspot +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6640 +dotnet_diagnostic.S6640.severity = warning # Title : Literal suffixes should be upper case # Category : Minor Code Smell @@ -4162,6 +4348,10 @@ dotnet_diagnostic.S9999-symbolRef.severity = warning # Category : dotnet_diagnostic.S9999-token-type.severity = warning +# Title : Analysis Warning generator +# Category : +dotnet_diagnostic.S9999-warning.severity = warning + # Title : Avoid legacy thread switching APIs # Category : Usage # Help Link: https://github.com/Microsoft/vs-threading/blob/main/doc/analyzers/VSTHRD001.md @@ -4215,6 +4405,7 @@ dotnet_diagnostic.VSTHRD102.severity = none # Title : Call async methods when in an async method # Category : Usage # Help Link: https://github.com/Microsoft/vs-threading/blob/main/doc/analyzers/VSTHRD103.md +# Redundant: CA1849 dotnet_diagnostic.VSTHRD103.severity = none # Title : Offer async methods diff --git a/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/NonProdExe-Tier2.globalconfig b/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/NonProdExe-Tier2.globalconfig index 753d221bfed..87c460ea91e 100644 --- a/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/NonProdExe-Tier2.globalconfig +++ b/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/NonProdExe-Tier2.globalconfig @@ -1,5 +1,5 @@ # Created by DiagConfig, the diagnostic config generator -# Generated : 2023-10-22 00:37:54Z +# Generated : 2024-01-25 20:57:51Z # Max Tier : 2 # Attributes: general # Analyzers : ILLink.RoslynAnalyzer, Microsoft.Analyzers.Extra, Microsoft.Analyzers.Local, Microsoft.AspNetCore.App.Analyzers, Microsoft.AspNetCore.Components.Analyzers, Microsoft.CodeAnalysis.CSharp.NetAnalyzers, Microsoft.CodeAnalysis.NetAnalyzers, Microsoft.VisualStudio.Threading.Analyzers, Microsoft.VisualStudio.Threading.Analyzers.CSharp, SonarAnalyzer.CSharp @@ -108,7 +108,7 @@ dotnet_diagnostic.CA1001.severity = warning # Title : Types that own disposable fields should be disposable # Category : Design # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1001 -dotnet_diagnostic.CA1001.severity = warning +dotnet_diagnostic.CA1001.severity = none # Title : Do not expose generic lists # Category : Design @@ -313,6 +313,7 @@ dotnet_diagnostic.CA1062.severity = none # Category : Design # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1063 dotnet_diagnostic.CA1063.severity = warning +dotnet_code_quality.CA1063.api_surface = public # Title : Exceptions should be public # Category : Design @@ -660,6 +661,7 @@ dotnet_diagnostic.CA1821.severity = none # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1822 dotnet_diagnostic.CA1822.severity = warning +dotnet_code_quality.CA1822.api_surface = all # Title : Avoid unused private fields # Category : Performance @@ -789,7 +791,7 @@ dotnet_diagnostic.CA1847.severity = none # Title : Use the LoggerMessage delegates # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1848 -# Comment : Use the code generated model instead. +# Comment : Use R9 logging model instead dotnet_diagnostic.CA1848.severity = none # Title : Call async methods when in an async method @@ -840,7 +842,7 @@ dotnet_diagnostic.CA1857.severity = warning # Title : Use 'StartsWith' instead of 'IndexOf' # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1858 -dotnet_diagnostic.CA1858.severity = none +dotnet_diagnostic.CA1858.severity = suggestion # Title : Use concrete types when possible for improved performance # Category : Performance @@ -850,7 +852,7 @@ dotnet_diagnostic.CA1859.severity = none # Title : Avoid using 'Enumerable.Any()' extension method # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1860 -dotnet_diagnostic.CA1860.severity = none +dotnet_diagnostic.CA1860.severity = suggestion # Title : Avoid constant arrays as arguments # Category : Performance @@ -860,7 +862,7 @@ dotnet_diagnostic.CA1861.severity = suggestion # Title : Use the 'StringComparison' method overloads to perform case-insensitive string comparisons # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1862 -dotnet_diagnostic.CA1862.severity = none +dotnet_diagnostic.CA1862.severity = suggestion # Title : Use 'CompositeFormat' # Category : Performance @@ -895,12 +897,12 @@ dotnet_diagnostic.CA1868.severity = suggestion # Title : Cache and reuse 'JsonSerializerOptions' instances # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1869 -dotnet_diagnostic.CA1869.severity = none +dotnet_diagnostic.CA1869.severity = suggestion # Title : Use a cached 'SearchValues' instance # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1870 -dotnet_diagnostic.CA1870.severity = none +dotnet_diagnostic.CA1870.severity = suggestion # Title : Dispose objects before losing scope # Category : Reliability @@ -1036,6 +1038,7 @@ dotnet_diagnostic.CA2207.severity = none # Category : Usage # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2208 dotnet_diagnostic.CA2208.severity = warning +dotnet_code_quality.CA2208.api_surface = all # Title : Non-constant fields should not be visible # Category : Usage @@ -1118,6 +1121,7 @@ dotnet_diagnostic.CA2237.severity = none # Category : Usage # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2241 dotnet_diagnostic.CA2241.severity = warning +dotnet_code_quality.CA2241.try_determine_additional_string_formatting_methods_automatically = false # Title : Test for NaN correctly # Category : Usage @@ -2108,7 +2112,7 @@ dotnet_diagnostic.S103.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-104 dotnet_diagnostic.S104.severity = warning -# Title : Destructors should not throw exceptions +# Title : Finalizers should not throw exceptions # Category : Blocker Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1048 # Redundant: CA1065 @@ -2183,7 +2187,7 @@ dotnet_diagnostic.S1110.severity = none # Redundant: SA1106 dotnet_diagnostic.S1116.severity = none -# Title : Local variables should not shadow class fields +# Title : Local variables should not shadow class fields or properties # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1117 dotnet_diagnostic.S1117.severity = warning @@ -2226,6 +2230,11 @@ dotnet_diagnostic.S1128.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-113 dotnet_diagnostic.S113.severity = none +# Title : Deprecated code should be removed +# Category : Info Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-1133 +dotnet_diagnostic.S1133.severity = suggestion + # Title : Track uses of "FIXME" tags # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1134 @@ -2297,7 +2306,7 @@ dotnet_diagnostic.S1192.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1199 dotnet_diagnostic.S1199.severity = none -# Title : Classes should not be coupled to too many other classes (Single Responsibility Principle) +# Title : Classes should not be coupled to too many other classes # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1200 dotnet_diagnostic.S1200.severity = none @@ -2478,7 +2487,7 @@ dotnet_diagnostic.S1699.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1751 dotnet_diagnostic.S1751.severity = warning -# Title : Identical expressions should not be used on both sides of a binary operator +# Title : Identical expressions should not be used on both sides of operators # Category : Major Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1764 dotnet_diagnostic.S1764.severity = warning @@ -2530,7 +2539,7 @@ dotnet_diagnostic.S1939.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1940 dotnet_diagnostic.S1940.severity = warning -# Title : Inappropriate casts should not be made +# Title : Invalid casts should be avoided # Category : Critical Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1944 dotnet_diagnostic.S1944.severity = warning @@ -2567,6 +2576,11 @@ dotnet_diagnostic.S2077.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2092 dotnet_diagnostic.S2092.severity = warning +# Title : Classes should not be empty +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2094 +dotnet_diagnostic.S2094.severity = none + # Title : Collections should not be passed as arguments to their own methods # Category : Major Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2114 @@ -2592,6 +2606,11 @@ dotnet_diagnostic.S2148.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2156 dotnet_diagnostic.S2156.severity = warning +# Title : Classes named like "Exception" should extend "Exception" or a subclass +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2166 +dotnet_diagnostic.S2166.severity = warning + # Title : Short-circuit logic should be used in boolean contexts # Category : Blocker Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2178 @@ -2607,12 +2626,12 @@ dotnet_diagnostic.S2183.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2184 dotnet_diagnostic.S2184.severity = warning -# Title : TestCases should contain tests +# Title : Test classes should contain at least one test case # Category : Blocker Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2187 dotnet_diagnostic.S2187.severity = warning -# Title : Recursion should not be infinite +# Title : Loops and recursions should not be infinite # Category : Blocker Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2190 dotnet_diagnostic.S2190.severity = warning @@ -2622,7 +2641,12 @@ dotnet_diagnostic.S2190.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2197 dotnet_diagnostic.S2197.severity = warning -# Title : Return values from functions without side effects should not be ignored +# Title : Unnecessary mathematical comparisons should not be made +# Category : Critical Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2198 +dotnet_diagnostic.S2198.severity = warning + +# Title : Methods without side effects should not have their return values ignored # Category : Major Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2201 # Redundant: CA1806 @@ -2658,7 +2682,7 @@ dotnet_diagnostic.S2225.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2228 dotnet_diagnostic.S2228.severity = none -# Title : Parameters should be passed in the correct order +# Title : Arguments should be passed in the same order as the method parameters # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2234 dotnet_diagnostic.S2234.severity = warning @@ -2833,11 +2857,17 @@ dotnet_diagnostic.S2387.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2436 dotnet_diagnostic.S2436.severity = none -# Title : Silly bit operations should not be performed +# Title : Unnecessary bit operations should not be performed # Category : Blocker Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2437 dotnet_diagnostic.S2437.severity = warning +# Title : Blocks should be synchronized on read-only fields +# Category : Major Bug +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2445 +# Comment : Noise +dotnet_diagnostic.S2445.severity = none + # Title : Whitespace and control characters in string literals should be explicit # Category : Critical Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2479 @@ -2851,8 +2881,7 @@ dotnet_diagnostic.S2486.severity = warning # Title : Shared resources should not be used for locking # Category : Critical Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2551 -# Redundant: CA2002 -dotnet_diagnostic.S2551.severity = none +dotnet_diagnostic.S2551.severity = warning # Title : Conditionally executed code should be reachable # Category : Major Bug @@ -2863,7 +2892,8 @@ dotnet_diagnostic.S2583.severity = none # Title : Boolean expressions should not be gratuitous # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2589 -dotnet_diagnostic.S2589.severity = warning +# Comment : Too many false positives. +dotnet_diagnostic.S2589.severity = none # Title : Setting loose file permissions is security-sensitive # Category : Major Security Hotspot @@ -2920,7 +2950,7 @@ dotnet_diagnostic.S2743.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2755 dotnet_diagnostic.S2755.severity = warning -# Title : "=+" should not be used instead of "+=" +# Title : Non-existent operators like "=+" should not be used # Category : Major Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2757 dotnet_diagnostic.S2757.severity = warning @@ -2945,6 +2975,11 @@ dotnet_diagnostic.S2761.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2857 dotnet_diagnostic.S2857.severity = warning +# Title : "Thread.Sleep" should not be used in tests +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2925 +dotnet_diagnostic.S2925.severity = none + # Title : "IDisposables" should be disposed # Category : Blocker Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2930 @@ -2983,6 +3018,11 @@ dotnet_diagnostic.S2953.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2955 dotnet_diagnostic.S2955.severity = warning +# Title : Assertions should be complete +# Category : Blocker Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2970 +dotnet_diagnostic.S2970.severity = warning + # Title : "IEnumerable" LINQs should be simplified # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2971 @@ -3033,6 +3073,11 @@ dotnet_diagnostic.S3059.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3060 dotnet_diagnostic.S3060.severity = warning +# Title : "StringBuilder" data should be used +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-3063 +dotnet_diagnostic.S3063.severity = warning + # Title : "async" methods should not return "void" # Category : Major Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3168 @@ -3090,7 +3135,7 @@ dotnet_diagnostic.S3235.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3236 dotnet_diagnostic.S3236.severity = none -# Title : "value" parameters should be used +# Title : "value" contextual keyword should be used # Category : Blocker Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3237 dotnet_diagnostic.S3237.severity = warning @@ -3159,7 +3204,7 @@ dotnet_diagnostic.S3257.severity = none # Title : Non-derived "private" classes and records should be "sealed" # Category : Minor Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3260 -# Redundant: CA1852 +# Redundant: R9A013 dotnet_diagnostic.S3260.severity = none # Title : Namespaces should not be empty @@ -3223,6 +3268,11 @@ dotnet_diagnostic.S3353.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3358 dotnet_diagnostic.S3358.severity = warning +# Title : Date and time should not be used as a type for primary keys +# Category : Minor Bug +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-3363 +dotnet_diagnostic.S3363.severity = warning + # Title : "this" should not be exposed from constructors # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3366 @@ -3239,6 +3289,11 @@ dotnet_diagnostic.S3376.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3397 dotnet_diagnostic.S3397.severity = warning +# Title : "private" methods called only by inner classes should be moved to those classes +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-3398 +dotnet_diagnostic.S3398.severity = warning + # Title : Methods should not return constants # Category : Minor Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3400 @@ -3249,7 +3304,7 @@ dotnet_diagnostic.S3400.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3415 dotnet_diagnostic.S3415.severity = warning -# Title : Method overloads with default parameter values should not overlap +# Title : Method overloads with default parameter values should not overlap # Category : Blocker Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3427 dotnet_diagnostic.S3427.severity = warning @@ -3447,6 +3502,11 @@ dotnet_diagnostic.S3876.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3877 dotnet_diagnostic.S3877.severity = none +# Title : Arrays should not be created for params parameters +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-3878 +dotnet_diagnostic.S3878.severity = suggestion + # Title : Finalizers should not be empty # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3880 @@ -3472,7 +3532,7 @@ dotnet_diagnostic.S3885.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3887 dotnet_diagnostic.S3887.severity = warning -# Title : Neither "Thread.Resume" nor "Thread.Suspend" should be used +# Title : "Thread.Resume" and "Thread.Suspend" should not be used # Category : Blocker Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3889 dotnet_diagnostic.S3889.severity = warning @@ -3846,7 +3906,8 @@ dotnet_diagnostic.S4144.severity = warning # Title : Empty collections should not be accessed or iterated # Category : Minor Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4158 -dotnet_diagnostic.S4158.severity = warning +# Comment : Too many false positives +dotnet_diagnostic.S4158.severity = none # Title : Classes should implement their "ExportAttribute" interfaces # Category : Blocker Bug @@ -3980,6 +4041,11 @@ dotnet_diagnostic.S4507.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4524 dotnet_diagnostic.S4524.severity = warning +# Title : "DebuggerDisplayAttribute" strings should reference existing members +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-4545 +dotnet_diagnostic.S4545.severity = warning + # Title : ASP.NET HTTP request validation feature should not be disabled # Category : Major Vulnerability # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4564 @@ -4000,11 +4066,16 @@ dotnet_diagnostic.S4583.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4586 dotnet_diagnostic.S4586.severity = warning -# Title : String offset-based methods should be preferred for finding substrings from offsets +# Title : Start index should be used instead of calling Substring # Category : Critical Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4635 dotnet_diagnostic.S4635.severity = warning +# Title : Comments should not be empty +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-4663 +dotnet_diagnostic.S4663.severity = none + # Title : Using regular expressions is security-sensitive # Category : Critical Security Hotspot # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4784 @@ -4116,10 +4187,15 @@ dotnet_diagnostic.S5766.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-5773 dotnet_diagnostic.S5773.severity = warning +# Title : Regular expressions should be syntactically valid +# Category : Critical Bug +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-5856 +dotnet_diagnostic.S5856.severity = warning + # Title : Use a testable date/time provider # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-6354 -# Redundant: EA0002 +# Redundant: R9A022 dotnet_diagnostic.S6354.severity = none # Title : Azure Functions should be stateless @@ -4155,7 +4231,120 @@ dotnet_diagnostic.S6424.severity = warning # Title : Not specifying a timeout for regular expressions is security-sensitive # Category : Major Security Hotspot # Help Link: https://rules.sonarsource.com/csharp/RSPEC-6444 -dotnet_diagnostic.S6444.severity = warning +dotnet_diagnostic.S6444.severity = none + +# Title : Blocks should not be synchronized on local variables +# Category : Major Bug +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6507 +# Comment : Too many false positives +dotnet_diagnostic.S6507.severity = none + +# Title : "ExcludeFromCodeCoverage" attributes should include a justification +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6513 +dotnet_diagnostic.S6513.severity = suggestion + +# Title : Avoid using "DateTime.Now" for benchmarking or timing operations +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6561 +dotnet_diagnostic.S6561.severity = warning + +# Title : Always set the "DateTimeKind" when creating new "DateTime" instances +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6562 +# Comment : Noise +dotnet_diagnostic.S6562.severity = none + +# Title : Use UTC when recording DateTime instants +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6563 +dotnet_diagnostic.S6563.severity = none + +# Title : Use "DateTimeOffset" instead of "DateTime" +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6566 +# Comment : Noise +dotnet_diagnostic.S6566.severity = none + +# Title : Use "TimeZoneInfo.FindSystemTimeZoneById" without converting the timezones with "TimezoneConverter" +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6575 +dotnet_diagnostic.S6575.severity = warning + +# Title : Use a format provider when parsing date and time +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6580 +dotnet_diagnostic.S6580.severity = warning + +# Title : Don't hardcode the format when turning dates and times to strings +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6585 +dotnet_diagnostic.S6585.severity = none + +# Title : Use the "UnixEpoch" field instead of creating "DateTime" instances that point to the beginning of the Unix epoch +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6588 +dotnet_diagnostic.S6588.severity = warning + +# Title : "Find" method should be used instead of the "FirstOrDefault" extension +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6602 +dotnet_diagnostic.S6602.severity = none + +# Title : The collection-specific "TrueForAll" method should be used instead of the "All" extension +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6603 +dotnet_diagnostic.S6603.severity = none + +# Title : Collection-specific "Exists" method should be used instead of the "Any" extension +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6605 +dotnet_diagnostic.S6605.severity = none + +# Title : The collection should be filtered before sorting by using "Where" before "OrderBy" +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6607 +dotnet_diagnostic.S6607.severity = none + +# Title : Prefer indexing instead of "Enumerable" methods on types implementing "IList" +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6608 +dotnet_diagnostic.S6608.severity = none + +# Title : "Min/Max" properties of "Set" types should be used instead of the "Enumerable" extension methods +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6609 +dotnet_diagnostic.S6609.severity = none + +# Title : "StartsWith" and "EndsWith" overloads that take a "char" should be used instead of the ones that take a "string" +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6610 +dotnet_diagnostic.S6610.severity = none + +# Title : The lambda parameter should be used instead of capturing arguments in "ConcurrentDictionary" methods +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6612 +dotnet_diagnostic.S6612.severity = none + +# Title : "First" and "Last" properties of "LinkedList" should be used instead of the "First()" and "Last()" extension methods +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6613 +dotnet_diagnostic.S6613.severity = none + +# Title : "Contains" should be used instead of "Any" for simple equality checks +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6617 +dotnet_diagnostic.S6617.severity = none + +# Title : "string.Create" should be used instead of "FormattableString" +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6618 +dotnet_diagnostic.S6618.severity = none + +# Title : Using unsafe code blocks is security-sensitive +# Category : Major Security Hotspot +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6640 +dotnet_diagnostic.S6640.severity = warning # Title : Literal suffixes should be upper case # Category : Minor Code Smell @@ -4202,6 +4391,10 @@ dotnet_diagnostic.S9999-symbolRef.severity = warning # Category : dotnet_diagnostic.S9999-token-type.severity = warning +# Title : Analysis Warning generator +# Category : +dotnet_diagnostic.S9999-warning.severity = warning + # Title : Avoid legacy thread switching APIs # Category : Usage # Help Link: https://github.com/Microsoft/vs-threading/blob/main/doc/analyzers/VSTHRD001.md @@ -4255,6 +4448,7 @@ dotnet_diagnostic.VSTHRD102.severity = suggestion # Title : Call async methods when in an async method # Category : Usage # Help Link: https://github.com/Microsoft/vs-threading/blob/main/doc/analyzers/VSTHRD103.md +# Redundant: CA1849 dotnet_diagnostic.VSTHRD103.severity = none # Title : Offer async methods diff --git a/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/NonProdExe.globalconfig b/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/NonProdExe.globalconfig index 3b10e62f523..7aba65dc923 100644 --- a/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/NonProdExe.globalconfig +++ b/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/NonProdExe.globalconfig @@ -1,5 +1,5 @@ # Created by DiagConfig, the diagnostic config generator -# Generated : 2023-10-22 00:37:57Z +# Generated : 2024-01-25 20:57:54Z # Max Tier : 3 # Attributes: general # Analyzers : ILLink.RoslynAnalyzer, Microsoft.Analyzers.Extra, Microsoft.Analyzers.Local, Microsoft.AspNetCore.App.Analyzers, Microsoft.AspNetCore.Components.Analyzers, Microsoft.CodeAnalysis.CSharp.NetAnalyzers, Microsoft.CodeAnalysis.NetAnalyzers, Microsoft.VisualStudio.Threading.Analyzers, Microsoft.VisualStudio.Threading.Analyzers.CSharp, SonarAnalyzer.CSharp @@ -108,7 +108,7 @@ dotnet_diagnostic.CA1001.severity = warning # Title : Types that own disposable fields should be disposable # Category : Design # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1001 -dotnet_diagnostic.CA1001.severity = warning +dotnet_diagnostic.CA1001.severity = none # Title : Do not expose generic lists # Category : Design @@ -196,6 +196,7 @@ dotnet_diagnostic.CA1028.severity = none # Category : Design # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1030 dotnet_diagnostic.CA1030.severity = warning +dotnet_code_quality.CA1030.api_surface = public # Title : Do not catch general exception types # Category : Design @@ -275,6 +276,7 @@ dotnet_diagnostic.CA1051.severity = none # Category : Design # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1052 dotnet_diagnostic.CA1052.severity = warning +dotnet_code_quality.CA1052.api_surface = all # Title : URI-like parameters should not be strings # Category : Design @@ -317,6 +319,7 @@ dotnet_diagnostic.CA1062.severity = none # Category : Design # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1063 dotnet_diagnostic.CA1063.severity = warning +dotnet_code_quality.CA1063.api_surface = public # Title : Exceptions should be public # Category : Design @@ -575,6 +578,7 @@ dotnet_diagnostic.CA1724.severity = none # Category : Naming # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1725 dotnet_diagnostic.CA1725.severity = warning +dotnet_code_quality.CA1725.api_surface = public, protected # Title : Use PascalCase for named placeholders # Category : Naming @@ -669,6 +673,7 @@ dotnet_diagnostic.CA1821.severity = none # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1822 dotnet_diagnostic.CA1822.severity = warning +dotnet_code_quality.CA1822.api_surface = all # Title : Avoid unused private fields # Category : Performance @@ -798,7 +803,7 @@ dotnet_diagnostic.CA1847.severity = none # Title : Use the LoggerMessage delegates # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1848 -# Comment : Use the code generated model instead. +# Comment : Use R9 logging model instead dotnet_diagnostic.CA1848.severity = none # Title : Call async methods when in an async method @@ -849,7 +854,7 @@ dotnet_diagnostic.CA1857.severity = warning # Title : Use 'StartsWith' instead of 'IndexOf' # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1858 -dotnet_diagnostic.CA1858.severity = none +dotnet_diagnostic.CA1858.severity = suggestion # Title : Use concrete types when possible for improved performance # Category : Performance @@ -859,7 +864,7 @@ dotnet_diagnostic.CA1859.severity = none # Title : Avoid using 'Enumerable.Any()' extension method # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1860 -dotnet_diagnostic.CA1860.severity = none +dotnet_diagnostic.CA1860.severity = suggestion # Title : Avoid constant arrays as arguments # Category : Performance @@ -869,7 +874,7 @@ dotnet_diagnostic.CA1861.severity = suggestion # Title : Use the 'StringComparison' method overloads to perform case-insensitive string comparisons # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1862 -dotnet_diagnostic.CA1862.severity = none +dotnet_diagnostic.CA1862.severity = suggestion # Title : Use 'CompositeFormat' # Category : Performance @@ -904,12 +909,12 @@ dotnet_diagnostic.CA1868.severity = suggestion # Title : Cache and reuse 'JsonSerializerOptions' instances # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1869 -dotnet_diagnostic.CA1869.severity = none +dotnet_diagnostic.CA1869.severity = suggestion # Title : Use a cached 'SearchValues' instance # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1870 -dotnet_diagnostic.CA1870.severity = none +dotnet_diagnostic.CA1870.severity = suggestion # Title : Dispose objects before losing scope # Category : Reliability @@ -1045,6 +1050,7 @@ dotnet_diagnostic.CA2207.severity = none # Category : Usage # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2208 dotnet_diagnostic.CA2208.severity = warning +dotnet_code_quality.CA2208.api_surface = all # Title : Non-constant fields should not be visible # Category : Usage @@ -1108,6 +1114,7 @@ dotnet_diagnostic.CA2229.severity = none # Category : Usage # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2231 dotnet_diagnostic.CA2231.severity = error +dotnet_code_quality.CA2231.api_surface = public # Title : Pass system uri objects instead of strings # Category : Usage @@ -1130,6 +1137,7 @@ dotnet_diagnostic.CA2237.severity = none # Category : Usage # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2241 dotnet_diagnostic.CA2241.severity = warning +dotnet_code_quality.CA2241.try_determine_additional_string_formatting_methods_automatically = false # Title : Test for NaN correctly # Category : Usage @@ -2122,7 +2130,7 @@ dotnet_diagnostic.S103.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-104 dotnet_diagnostic.S104.severity = warning -# Title : Destructors should not throw exceptions +# Title : Finalizers should not throw exceptions # Category : Blocker Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1048 # Redundant: CA1065 @@ -2198,7 +2206,7 @@ dotnet_diagnostic.S1110.severity = none # Redundant: SA1106 dotnet_diagnostic.S1116.severity = none -# Title : Local variables should not shadow class fields +# Title : Local variables should not shadow class fields or properties # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1117 dotnet_diagnostic.S1117.severity = warning @@ -2241,6 +2249,11 @@ dotnet_diagnostic.S1128.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-113 dotnet_diagnostic.S113.severity = none +# Title : Deprecated code should be removed +# Category : Info Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-1133 +dotnet_diagnostic.S1133.severity = suggestion + # Title : Track uses of "FIXME" tags # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1134 @@ -2313,7 +2326,7 @@ dotnet_diagnostic.S1192.severity = suggestion # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1199 dotnet_diagnostic.S1199.severity = warning -# Title : Classes should not be coupled to too many other classes (Single Responsibility Principle) +# Title : Classes should not be coupled to too many other classes # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1200 dotnet_diagnostic.S1200.severity = none @@ -2494,7 +2507,7 @@ dotnet_diagnostic.S1699.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1751 dotnet_diagnostic.S1751.severity = warning -# Title : Identical expressions should not be used on both sides of a binary operator +# Title : Identical expressions should not be used on both sides of operators # Category : Major Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1764 dotnet_diagnostic.S1764.severity = warning @@ -2546,7 +2559,7 @@ dotnet_diagnostic.S1939.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1940 dotnet_diagnostic.S1940.severity = warning -# Title : Inappropriate casts should not be made +# Title : Invalid casts should be avoided # Category : Critical Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1944 dotnet_diagnostic.S1944.severity = warning @@ -2583,6 +2596,11 @@ dotnet_diagnostic.S2077.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2092 dotnet_diagnostic.S2092.severity = warning +# Title : Classes should not be empty +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2094 +dotnet_diagnostic.S2094.severity = none + # Title : Collections should not be passed as arguments to their own methods # Category : Major Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2114 @@ -2608,6 +2626,11 @@ dotnet_diagnostic.S2148.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2156 dotnet_diagnostic.S2156.severity = warning +# Title : Classes named like "Exception" should extend "Exception" or a subclass +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2166 +dotnet_diagnostic.S2166.severity = warning + # Title : Short-circuit logic should be used in boolean contexts # Category : Blocker Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2178 @@ -2623,12 +2646,12 @@ dotnet_diagnostic.S2183.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2184 dotnet_diagnostic.S2184.severity = warning -# Title : TestCases should contain tests +# Title : Test classes should contain at least one test case # Category : Blocker Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2187 dotnet_diagnostic.S2187.severity = warning -# Title : Recursion should not be infinite +# Title : Loops and recursions should not be infinite # Category : Blocker Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2190 dotnet_diagnostic.S2190.severity = warning @@ -2638,7 +2661,12 @@ dotnet_diagnostic.S2190.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2197 dotnet_diagnostic.S2197.severity = warning -# Title : Return values from functions without side effects should not be ignored +# Title : Unnecessary mathematical comparisons should not be made +# Category : Critical Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2198 +dotnet_diagnostic.S2198.severity = warning + +# Title : Methods without side effects should not have their return values ignored # Category : Major Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2201 # Redundant: CA1806 @@ -2674,7 +2702,7 @@ dotnet_diagnostic.S2225.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2228 dotnet_diagnostic.S2228.severity = none -# Title : Parameters should be passed in the correct order +# Title : Arguments should be passed in the same order as the method parameters # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2234 dotnet_diagnostic.S2234.severity = warning @@ -2851,11 +2879,17 @@ dotnet_diagnostic.S2387.severity = warning # Redundant: CA1005 dotnet_diagnostic.S2436.severity = none -# Title : Silly bit operations should not be performed +# Title : Unnecessary bit operations should not be performed # Category : Blocker Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2437 dotnet_diagnostic.S2437.severity = warning +# Title : Blocks should be synchronized on read-only fields +# Category : Major Bug +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2445 +# Comment : Noise +dotnet_diagnostic.S2445.severity = none + # Title : Whitespace and control characters in string literals should be explicit # Category : Critical Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2479 @@ -2869,8 +2903,7 @@ dotnet_diagnostic.S2486.severity = warning # Title : Shared resources should not be used for locking # Category : Critical Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2551 -# Redundant: CA2002 -dotnet_diagnostic.S2551.severity = none +dotnet_diagnostic.S2551.severity = warning # Title : Conditionally executed code should be reachable # Category : Major Bug @@ -2881,7 +2914,8 @@ dotnet_diagnostic.S2583.severity = none # Title : Boolean expressions should not be gratuitous # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2589 -dotnet_diagnostic.S2589.severity = warning +# Comment : Too many false positives. +dotnet_diagnostic.S2589.severity = none # Title : Setting loose file permissions is security-sensitive # Category : Major Security Hotspot @@ -2938,7 +2972,7 @@ dotnet_diagnostic.S2743.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2755 dotnet_diagnostic.S2755.severity = warning -# Title : "=+" should not be used instead of "+=" +# Title : Non-existent operators like "=+" should not be used # Category : Major Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2757 dotnet_diagnostic.S2757.severity = warning @@ -2963,6 +2997,11 @@ dotnet_diagnostic.S2761.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2857 dotnet_diagnostic.S2857.severity = warning +# Title : "Thread.Sleep" should not be used in tests +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2925 +dotnet_diagnostic.S2925.severity = none + # Title : "IDisposables" should be disposed # Category : Blocker Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2930 @@ -3001,6 +3040,11 @@ dotnet_diagnostic.S2953.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2955 dotnet_diagnostic.S2955.severity = warning +# Title : Assertions should be complete +# Category : Blocker Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2970 +dotnet_diagnostic.S2970.severity = warning + # Title : "IEnumerable" LINQs should be simplified # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2971 @@ -3052,6 +3096,11 @@ dotnet_diagnostic.S3059.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3060 dotnet_diagnostic.S3060.severity = warning +# Title : "StringBuilder" data should be used +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-3063 +dotnet_diagnostic.S3063.severity = warning + # Title : "async" methods should not return "void" # Category : Major Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3168 @@ -3109,7 +3158,7 @@ dotnet_diagnostic.S3235.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3236 dotnet_diagnostic.S3236.severity = warning -# Title : "value" parameters should be used +# Title : "value" contextual keyword should be used # Category : Blocker Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3237 dotnet_diagnostic.S3237.severity = warning @@ -3174,12 +3223,13 @@ dotnet_diagnostic.S3256.severity = warning # Title : Declarations and initializations should be as concise as possible # Category : Minor Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3257 -dotnet_diagnostic.S3257.severity = warning +# Comment : Too many false positives +dotnet_diagnostic.S3257.severity = none # Title : Non-derived "private" classes and records should be "sealed" # Category : Minor Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3260 -# Redundant: CA1852 +# Redundant: R9A013 dotnet_diagnostic.S3260.severity = none # Title : Namespaces should not be empty @@ -3243,6 +3293,11 @@ dotnet_diagnostic.S3353.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3358 dotnet_diagnostic.S3358.severity = warning +# Title : Date and time should not be used as a type for primary keys +# Category : Minor Bug +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-3363 +dotnet_diagnostic.S3363.severity = warning + # Title : "this" should not be exposed from constructors # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3366 @@ -3259,6 +3314,11 @@ dotnet_diagnostic.S3376.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3397 dotnet_diagnostic.S3397.severity = warning +# Title : "private" methods called only by inner classes should be moved to those classes +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-3398 +dotnet_diagnostic.S3398.severity = warning + # Title : Methods should not return constants # Category : Minor Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3400 @@ -3269,7 +3329,7 @@ dotnet_diagnostic.S3400.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3415 dotnet_diagnostic.S3415.severity = warning -# Title : Method overloads with default parameter values should not overlap +# Title : Method overloads with default parameter values should not overlap # Category : Blocker Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3427 dotnet_diagnostic.S3427.severity = warning @@ -3467,6 +3527,11 @@ dotnet_diagnostic.S3876.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3877 dotnet_diagnostic.S3877.severity = none +# Title : Arrays should not be created for params parameters +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-3878 +dotnet_diagnostic.S3878.severity = suggestion + # Title : Finalizers should not be empty # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3880 @@ -3492,7 +3557,7 @@ dotnet_diagnostic.S3885.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3887 dotnet_diagnostic.S3887.severity = warning -# Title : Neither "Thread.Resume" nor "Thread.Suspend" should be used +# Title : "Thread.Resume" and "Thread.Suspend" should not be used # Category : Blocker Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3889 dotnet_diagnostic.S3889.severity = warning @@ -3732,7 +3797,7 @@ dotnet_diagnostic.S4022.severity = warning # Title : Interfaces should not be empty # Category : Minor Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4023 -dotnet_diagnostic.S4023.severity = warning +dotnet_diagnostic.S4023.severity = none # Title : Child class fields should not differ from parent class fields only by capitalization # Category : Critical Code Smell @@ -3870,7 +3935,8 @@ dotnet_diagnostic.S4144.severity = warning # Title : Empty collections should not be accessed or iterated # Category : Minor Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4158 -dotnet_diagnostic.S4158.severity = warning +# Comment : Too many false positives +dotnet_diagnostic.S4158.severity = none # Title : Classes should implement their "ExportAttribute" interfaces # Category : Blocker Bug @@ -4004,6 +4070,11 @@ dotnet_diagnostic.S4507.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4524 dotnet_diagnostic.S4524.severity = warning +# Title : "DebuggerDisplayAttribute" strings should reference existing members +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-4545 +dotnet_diagnostic.S4545.severity = warning + # Title : ASP.NET HTTP request validation feature should not be disabled # Category : Major Vulnerability # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4564 @@ -4024,11 +4095,16 @@ dotnet_diagnostic.S4583.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4586 dotnet_diagnostic.S4586.severity = warning -# Title : String offset-based methods should be preferred for finding substrings from offsets +# Title : Start index should be used instead of calling Substring # Category : Critical Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4635 dotnet_diagnostic.S4635.severity = warning +# Title : Comments should not be empty +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-4663 +dotnet_diagnostic.S4663.severity = suggestion + # Title : Using regular expressions is security-sensitive # Category : Critical Security Hotspot # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4784 @@ -4140,10 +4216,15 @@ dotnet_diagnostic.S5766.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-5773 dotnet_diagnostic.S5773.severity = warning +# Title : Regular expressions should be syntactically valid +# Category : Critical Bug +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-5856 +dotnet_diagnostic.S5856.severity = warning + # Title : Use a testable date/time provider # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-6354 -# Redundant: EA0002 +# Redundant: R9A022 dotnet_diagnostic.S6354.severity = none # Title : Azure Functions should be stateless @@ -4179,7 +4260,120 @@ dotnet_diagnostic.S6424.severity = warning # Title : Not specifying a timeout for regular expressions is security-sensitive # Category : Major Security Hotspot # Help Link: https://rules.sonarsource.com/csharp/RSPEC-6444 -dotnet_diagnostic.S6444.severity = warning +dotnet_diagnostic.S6444.severity = none + +# Title : Blocks should not be synchronized on local variables +# Category : Major Bug +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6507 +# Comment : Too many false positives +dotnet_diagnostic.S6507.severity = none + +# Title : "ExcludeFromCodeCoverage" attributes should include a justification +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6513 +dotnet_diagnostic.S6513.severity = suggestion + +# Title : Avoid using "DateTime.Now" for benchmarking or timing operations +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6561 +dotnet_diagnostic.S6561.severity = warning + +# Title : Always set the "DateTimeKind" when creating new "DateTime" instances +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6562 +# Comment : Noise +dotnet_diagnostic.S6562.severity = none + +# Title : Use UTC when recording DateTime instants +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6563 +dotnet_diagnostic.S6563.severity = none + +# Title : Use "DateTimeOffset" instead of "DateTime" +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6566 +# Comment : Noise +dotnet_diagnostic.S6566.severity = none + +# Title : Use "TimeZoneInfo.FindSystemTimeZoneById" without converting the timezones with "TimezoneConverter" +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6575 +dotnet_diagnostic.S6575.severity = warning + +# Title : Use a format provider when parsing date and time +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6580 +dotnet_diagnostic.S6580.severity = warning + +# Title : Don't hardcode the format when turning dates and times to strings +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6585 +dotnet_diagnostic.S6585.severity = none + +# Title : Use the "UnixEpoch" field instead of creating "DateTime" instances that point to the beginning of the Unix epoch +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6588 +dotnet_diagnostic.S6588.severity = warning + +# Title : "Find" method should be used instead of the "FirstOrDefault" extension +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6602 +dotnet_diagnostic.S6602.severity = none + +# Title : The collection-specific "TrueForAll" method should be used instead of the "All" extension +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6603 +dotnet_diagnostic.S6603.severity = none + +# Title : Collection-specific "Exists" method should be used instead of the "Any" extension +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6605 +dotnet_diagnostic.S6605.severity = none + +# Title : The collection should be filtered before sorting by using "Where" before "OrderBy" +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6607 +dotnet_diagnostic.S6607.severity = none + +# Title : Prefer indexing instead of "Enumerable" methods on types implementing "IList" +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6608 +dotnet_diagnostic.S6608.severity = none + +# Title : "Min/Max" properties of "Set" types should be used instead of the "Enumerable" extension methods +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6609 +dotnet_diagnostic.S6609.severity = none + +# Title : "StartsWith" and "EndsWith" overloads that take a "char" should be used instead of the ones that take a "string" +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6610 +dotnet_diagnostic.S6610.severity = none + +# Title : The lambda parameter should be used instead of capturing arguments in "ConcurrentDictionary" methods +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6612 +dotnet_diagnostic.S6612.severity = none + +# Title : "First" and "Last" properties of "LinkedList" should be used instead of the "First()" and "Last()" extension methods +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6613 +dotnet_diagnostic.S6613.severity = none + +# Title : "Contains" should be used instead of "Any" for simple equality checks +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6617 +dotnet_diagnostic.S6617.severity = none + +# Title : "string.Create" should be used instead of "FormattableString" +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6618 +dotnet_diagnostic.S6618.severity = none + +# Title : Using unsafe code blocks is security-sensitive +# Category : Major Security Hotspot +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6640 +dotnet_diagnostic.S6640.severity = warning # Title : Literal suffixes should be upper case # Category : Minor Code Smell @@ -4226,6 +4420,10 @@ dotnet_diagnostic.S9999-symbolRef.severity = warning # Category : dotnet_diagnostic.S9999-token-type.severity = warning +# Title : Analysis Warning generator +# Category : +dotnet_diagnostic.S9999-warning.severity = warning + # Title : Avoid legacy thread switching APIs # Category : Usage # Help Link: https://github.com/Microsoft/vs-threading/blob/main/doc/analyzers/VSTHRD001.md @@ -4279,6 +4477,7 @@ dotnet_diagnostic.VSTHRD102.severity = suggestion # Title : Call async methods when in an async method # Category : Usage # Help Link: https://github.com/Microsoft/vs-threading/blob/main/doc/analyzers/VSTHRD103.md +# Redundant: CA1849 dotnet_diagnostic.VSTHRD103.severity = none # Title : Offer async methods diff --git a/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/NonProdLib-Tier1.globalconfig b/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/NonProdLib-Tier1.globalconfig index 28971d58b7e..d7d0477bee2 100644 --- a/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/NonProdLib-Tier1.globalconfig +++ b/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/NonProdLib-Tier1.globalconfig @@ -1,5 +1,5 @@ # Created by DiagConfig, the diagnostic config generator -# Generated : 2023-10-22 00:37:51Z +# Generated : 2024-01-25 20:57:48Z # Max Tier : 1 # Attributes: api, general # Analyzers : ILLink.RoslynAnalyzer, Microsoft.Analyzers.Extra, Microsoft.Analyzers.Local, Microsoft.AspNetCore.App.Analyzers, Microsoft.AspNetCore.Components.Analyzers, Microsoft.CodeAnalysis.CSharp.NetAnalyzers, Microsoft.CodeAnalysis.NetAnalyzers, Microsoft.VisualStudio.Threading.Analyzers, Microsoft.VisualStudio.Threading.Analyzers.CSharp, SonarAnalyzer.CSharp @@ -309,6 +309,7 @@ dotnet_diagnostic.CA1062.severity = none # Category : Design # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1063 dotnet_diagnostic.CA1063.severity = warning +dotnet_code_quality.CA1063.api_surface = public # Title : Exceptions should be public # Category : Design @@ -828,7 +829,7 @@ dotnet_diagnostic.CA1857.severity = warning # Title : Use 'StartsWith' instead of 'IndexOf' # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1858 -dotnet_diagnostic.CA1858.severity = none +dotnet_diagnostic.CA1858.severity = suggestion # Title : Use concrete types when possible for improved performance # Category : Performance @@ -838,7 +839,7 @@ dotnet_diagnostic.CA1859.severity = none # Title : Avoid using 'Enumerable.Any()' extension method # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1860 -dotnet_diagnostic.CA1860.severity = none +dotnet_diagnostic.CA1860.severity = suggestion # Title : Avoid constant arrays as arguments # Category : Performance @@ -848,7 +849,7 @@ dotnet_diagnostic.CA1861.severity = suggestion # Title : Use the 'StringComparison' method overloads to perform case-insensitive string comparisons # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1862 -dotnet_diagnostic.CA1862.severity = none +dotnet_diagnostic.CA1862.severity = suggestion # Title : Use 'CompositeFormat' # Category : Performance @@ -883,12 +884,12 @@ dotnet_diagnostic.CA1868.severity = suggestion # Title : Cache and reuse 'JsonSerializerOptions' instances # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1869 -dotnet_diagnostic.CA1869.severity = none +dotnet_diagnostic.CA1869.severity = suggestion # Title : Use a cached 'SearchValues' instance # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1870 -dotnet_diagnostic.CA1870.severity = none +dotnet_diagnostic.CA1870.severity = suggestion # Title : Dispose objects before losing scope # Category : Reliability @@ -1105,6 +1106,7 @@ dotnet_diagnostic.CA2237.severity = none # Category : Usage # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2241 dotnet_diagnostic.CA2241.severity = warning +dotnet_code_quality.CA2241.try_determine_additional_string_formatting_methods_automatically = false # Title : Test for NaN correctly # Category : Usage @@ -2095,7 +2097,7 @@ dotnet_diagnostic.S103.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-104 dotnet_diagnostic.S104.severity = none -# Title : Destructors should not throw exceptions +# Title : Finalizers should not throw exceptions # Category : Blocker Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1048 # Redundant: CA1065 @@ -2166,7 +2168,7 @@ dotnet_diagnostic.S1110.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1116 dotnet_diagnostic.S1116.severity = none -# Title : Local variables should not shadow class fields +# Title : Local variables should not shadow class fields or properties # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1117 dotnet_diagnostic.S1117.severity = warning @@ -2206,6 +2208,11 @@ dotnet_diagnostic.S1128.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-113 dotnet_diagnostic.S113.severity = none +# Title : Deprecated code should be removed +# Category : Info Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-1133 +dotnet_diagnostic.S1133.severity = suggestion + # Title : Track uses of "FIXME" tags # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1134 @@ -2277,7 +2284,7 @@ dotnet_diagnostic.S1192.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1199 dotnet_diagnostic.S1199.severity = none -# Title : Classes should not be coupled to too many other classes (Single Responsibility Principle) +# Title : Classes should not be coupled to too many other classes # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1200 dotnet_diagnostic.S1200.severity = none @@ -2454,7 +2461,7 @@ dotnet_diagnostic.S1699.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1751 dotnet_diagnostic.S1751.severity = warning -# Title : Identical expressions should not be used on both sides of a binary operator +# Title : Identical expressions should not be used on both sides of operators # Category : Major Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1764 dotnet_diagnostic.S1764.severity = warning @@ -2505,7 +2512,7 @@ dotnet_diagnostic.S1939.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1940 dotnet_diagnostic.S1940.severity = none -# Title : Inappropriate casts should not be made +# Title : Invalid casts should be avoided # Category : Critical Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1944 dotnet_diagnostic.S1944.severity = warning @@ -2542,6 +2549,11 @@ dotnet_diagnostic.S2077.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2092 dotnet_diagnostic.S2092.severity = none +# Title : Classes should not be empty +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2094 +dotnet_diagnostic.S2094.severity = none + # Title : Collections should not be passed as arguments to their own methods # Category : Major Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2114 @@ -2567,6 +2579,11 @@ dotnet_diagnostic.S2148.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2156 dotnet_diagnostic.S2156.severity = none +# Title : Classes named like "Exception" should extend "Exception" or a subclass +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2166 +dotnet_diagnostic.S2166.severity = warning + # Title : Short-circuit logic should be used in boolean contexts # Category : Blocker Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2178 @@ -2582,12 +2599,12 @@ dotnet_diagnostic.S2183.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2184 dotnet_diagnostic.S2184.severity = none -# Title : TestCases should contain tests +# Title : Test classes should contain at least one test case # Category : Blocker Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2187 dotnet_diagnostic.S2187.severity = none -# Title : Recursion should not be infinite +# Title : Loops and recursions should not be infinite # Category : Blocker Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2190 dotnet_diagnostic.S2190.severity = none @@ -2597,7 +2614,12 @@ dotnet_diagnostic.S2190.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2197 dotnet_diagnostic.S2197.severity = warning -# Title : Return values from functions without side effects should not be ignored +# Title : Unnecessary mathematical comparisons should not be made +# Category : Critical Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2198 +dotnet_diagnostic.S2198.severity = warning + +# Title : Methods without side effects should not have their return values ignored # Category : Major Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2201 # Redundant: CA1806 @@ -2633,7 +2655,7 @@ dotnet_diagnostic.S2225.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2228 dotnet_diagnostic.S2228.severity = none -# Title : Parameters should be passed in the correct order +# Title : Arguments should be passed in the same order as the method parameters # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2234 dotnet_diagnostic.S2234.severity = warning @@ -2807,11 +2829,17 @@ dotnet_diagnostic.S2387.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2436 dotnet_diagnostic.S2436.severity = none -# Title : Silly bit operations should not be performed +# Title : Unnecessary bit operations should not be performed # Category : Blocker Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2437 dotnet_diagnostic.S2437.severity = warning +# Title : Blocks should be synchronized on read-only fields +# Category : Major Bug +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2445 +# Comment : Noise +dotnet_diagnostic.S2445.severity = none + # Title : Whitespace and control characters in string literals should be explicit # Category : Critical Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2479 @@ -2825,8 +2853,7 @@ dotnet_diagnostic.S2486.severity = none # Title : Shared resources should not be used for locking # Category : Critical Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2551 -# Redundant: CA2002 -dotnet_diagnostic.S2551.severity = none +dotnet_diagnostic.S2551.severity = warning # Title : Conditionally executed code should be reachable # Category : Major Bug @@ -2837,7 +2864,8 @@ dotnet_diagnostic.S2583.severity = none # Title : Boolean expressions should not be gratuitous # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2589 -dotnet_diagnostic.S2589.severity = warning +# Comment : Too many false positives. +dotnet_diagnostic.S2589.severity = none # Title : Setting loose file permissions is security-sensitive # Category : Major Security Hotspot @@ -2894,7 +2922,7 @@ dotnet_diagnostic.S2743.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2755 dotnet_diagnostic.S2755.severity = warning -# Title : "=+" should not be used instead of "+=" +# Title : Non-existent operators like "=+" should not be used # Category : Major Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2757 dotnet_diagnostic.S2757.severity = warning @@ -2919,6 +2947,11 @@ dotnet_diagnostic.S2761.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2857 dotnet_diagnostic.S2857.severity = warning +# Title : "Thread.Sleep" should not be used in tests +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2925 +dotnet_diagnostic.S2925.severity = none + # Title : "IDisposables" should be disposed # Category : Blocker Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2930 @@ -2957,6 +2990,11 @@ dotnet_diagnostic.S2953.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2955 dotnet_diagnostic.S2955.severity = none +# Title : Assertions should be complete +# Category : Blocker Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2970 +dotnet_diagnostic.S2970.severity = warning + # Title : "IEnumerable" LINQs should be simplified # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2971 @@ -3007,6 +3045,11 @@ dotnet_diagnostic.S3059.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3060 dotnet_diagnostic.S3060.severity = none +# Title : "StringBuilder" data should be used +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-3063 +dotnet_diagnostic.S3063.severity = warning + # Title : "async" methods should not return "void" # Category : Major Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3168 @@ -3063,7 +3106,7 @@ dotnet_diagnostic.S3235.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3236 dotnet_diagnostic.S3236.severity = none -# Title : "value" parameters should be used +# Title : "value" contextual keyword should be used # Category : Blocker Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3237 dotnet_diagnostic.S3237.severity = warning @@ -3194,6 +3237,11 @@ dotnet_diagnostic.S3353.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3358 dotnet_diagnostic.S3358.severity = warning +# Title : Date and time should not be used as a type for primary keys +# Category : Minor Bug +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-3363 +dotnet_diagnostic.S3363.severity = warning + # Title : "this" should not be exposed from constructors # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3366 @@ -3210,6 +3258,11 @@ dotnet_diagnostic.S3376.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3397 dotnet_diagnostic.S3397.severity = none +# Title : "private" methods called only by inner classes should be moved to those classes +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-3398 +dotnet_diagnostic.S3398.severity = warning + # Title : Methods should not return constants # Category : Minor Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3400 @@ -3220,7 +3273,7 @@ dotnet_diagnostic.S3400.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3415 dotnet_diagnostic.S3415.severity = warning -# Title : Method overloads with default parameter values should not overlap +# Title : Method overloads with default parameter values should not overlap # Category : Blocker Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3427 dotnet_diagnostic.S3427.severity = warning @@ -3416,6 +3469,11 @@ dotnet_diagnostic.S3876.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3877 dotnet_diagnostic.S3877.severity = none +# Title : Arrays should not be created for params parameters +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-3878 +dotnet_diagnostic.S3878.severity = suggestion + # Title : Finalizers should not be empty # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3880 @@ -3441,7 +3499,7 @@ dotnet_diagnostic.S3885.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3887 dotnet_diagnostic.S3887.severity = warning -# Title : Neither "Thread.Resume" nor "Thread.Suspend" should be used +# Title : "Thread.Resume" and "Thread.Suspend" should not be used # Category : Blocker Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3889 dotnet_diagnostic.S3889.severity = warning @@ -3940,6 +3998,11 @@ dotnet_diagnostic.S4507.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4524 dotnet_diagnostic.S4524.severity = warning +# Title : "DebuggerDisplayAttribute" strings should reference existing members +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-4545 +dotnet_diagnostic.S4545.severity = warning + # Title : ASP.NET HTTP request validation feature should not be disabled # Category : Major Vulnerability # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4564 @@ -3960,11 +4023,16 @@ dotnet_diagnostic.S4583.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4586 dotnet_diagnostic.S4586.severity = warning -# Title : String offset-based methods should be preferred for finding substrings from offsets +# Title : Start index should be used instead of calling Substring # Category : Critical Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4635 dotnet_diagnostic.S4635.severity = warning +# Title : Comments should not be empty +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-4663 +dotnet_diagnostic.S4663.severity = none + # Title : Using regular expressions is security-sensitive # Category : Critical Security Hotspot # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4784 @@ -4076,10 +4144,15 @@ dotnet_diagnostic.S5766.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-5773 dotnet_diagnostic.S5773.severity = none +# Title : Regular expressions should be syntactically valid +# Category : Critical Bug +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-5856 +dotnet_diagnostic.S5856.severity = warning + # Title : Use a testable date/time provider # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-6354 -# Redundant: EA0002 +# Redundant: R9A022 dotnet_diagnostic.S6354.severity = none # Title : Azure Functions should be stateless @@ -4115,7 +4188,120 @@ dotnet_diagnostic.S6424.severity = none # Title : Not specifying a timeout for regular expressions is security-sensitive # Category : Major Security Hotspot # Help Link: https://rules.sonarsource.com/csharp/RSPEC-6444 -dotnet_diagnostic.S6444.severity = warning +dotnet_diagnostic.S6444.severity = none + +# Title : Blocks should not be synchronized on local variables +# Category : Major Bug +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6507 +# Comment : Too many false positives +dotnet_diagnostic.S6507.severity = none + +# Title : "ExcludeFromCodeCoverage" attributes should include a justification +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6513 +dotnet_diagnostic.S6513.severity = suggestion + +# Title : Avoid using "DateTime.Now" for benchmarking or timing operations +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6561 +dotnet_diagnostic.S6561.severity = warning + +# Title : Always set the "DateTimeKind" when creating new "DateTime" instances +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6562 +# Comment : Noise +dotnet_diagnostic.S6562.severity = none + +# Title : Use UTC when recording DateTime instants +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6563 +dotnet_diagnostic.S6563.severity = none + +# Title : Use "DateTimeOffset" instead of "DateTime" +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6566 +# Comment : Noise +dotnet_diagnostic.S6566.severity = none + +# Title : Use "TimeZoneInfo.FindSystemTimeZoneById" without converting the timezones with "TimezoneConverter" +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6575 +dotnet_diagnostic.S6575.severity = warning + +# Title : Use a format provider when parsing date and time +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6580 +dotnet_diagnostic.S6580.severity = warning + +# Title : Don't hardcode the format when turning dates and times to strings +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6585 +dotnet_diagnostic.S6585.severity = none + +# Title : Use the "UnixEpoch" field instead of creating "DateTime" instances that point to the beginning of the Unix epoch +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6588 +dotnet_diagnostic.S6588.severity = warning + +# Title : "Find" method should be used instead of the "FirstOrDefault" extension +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6602 +dotnet_diagnostic.S6602.severity = none + +# Title : The collection-specific "TrueForAll" method should be used instead of the "All" extension +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6603 +dotnet_diagnostic.S6603.severity = none + +# Title : Collection-specific "Exists" method should be used instead of the "Any" extension +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6605 +dotnet_diagnostic.S6605.severity = none + +# Title : The collection should be filtered before sorting by using "Where" before "OrderBy" +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6607 +dotnet_diagnostic.S6607.severity = none + +# Title : Prefer indexing instead of "Enumerable" methods on types implementing "IList" +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6608 +dotnet_diagnostic.S6608.severity = none + +# Title : "Min/Max" properties of "Set" types should be used instead of the "Enumerable" extension methods +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6609 +dotnet_diagnostic.S6609.severity = none + +# Title : "StartsWith" and "EndsWith" overloads that take a "char" should be used instead of the ones that take a "string" +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6610 +dotnet_diagnostic.S6610.severity = none + +# Title : The lambda parameter should be used instead of capturing arguments in "ConcurrentDictionary" methods +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6612 +dotnet_diagnostic.S6612.severity = none + +# Title : "First" and "Last" properties of "LinkedList" should be used instead of the "First()" and "Last()" extension methods +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6613 +dotnet_diagnostic.S6613.severity = none + +# Title : "Contains" should be used instead of "Any" for simple equality checks +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6617 +dotnet_diagnostic.S6617.severity = none + +# Title : "string.Create" should be used instead of "FormattableString" +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6618 +dotnet_diagnostic.S6618.severity = none + +# Title : Using unsafe code blocks is security-sensitive +# Category : Major Security Hotspot +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6640 +dotnet_diagnostic.S6640.severity = warning # Title : Literal suffixes should be upper case # Category : Minor Code Smell @@ -4162,6 +4348,10 @@ dotnet_diagnostic.S9999-symbolRef.severity = warning # Category : dotnet_diagnostic.S9999-token-type.severity = warning +# Title : Analysis Warning generator +# Category : +dotnet_diagnostic.S9999-warning.severity = warning + # Title : Avoid legacy thread switching APIs # Category : Usage # Help Link: https://github.com/Microsoft/vs-threading/blob/main/doc/analyzers/VSTHRD001.md @@ -4215,6 +4405,7 @@ dotnet_diagnostic.VSTHRD102.severity = none # Title : Call async methods when in an async method # Category : Usage # Help Link: https://github.com/Microsoft/vs-threading/blob/main/doc/analyzers/VSTHRD103.md +# Redundant: CA1849 dotnet_diagnostic.VSTHRD103.severity = none # Title : Offer async methods diff --git a/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/NonProdLib-Tier2.globalconfig b/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/NonProdLib-Tier2.globalconfig index d1124e7f0c7..69cb0a9d5d7 100644 --- a/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/NonProdLib-Tier2.globalconfig +++ b/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/NonProdLib-Tier2.globalconfig @@ -1,5 +1,5 @@ # Created by DiagConfig, the diagnostic config generator -# Generated : 2023-10-22 00:37:54Z +# Generated : 2024-01-25 20:57:52Z # Max Tier : 2 # Attributes: api, general # Analyzers : ILLink.RoslynAnalyzer, Microsoft.Analyzers.Extra, Microsoft.Analyzers.Local, Microsoft.AspNetCore.App.Analyzers, Microsoft.AspNetCore.Components.Analyzers, Microsoft.CodeAnalysis.CSharp.NetAnalyzers, Microsoft.CodeAnalysis.NetAnalyzers, Microsoft.VisualStudio.Threading.Analyzers, Microsoft.VisualStudio.Threading.Analyzers.CSharp, SonarAnalyzer.CSharp @@ -108,7 +108,7 @@ dotnet_diagnostic.CA1001.severity = warning # Title : Types that own disposable fields should be disposable # Category : Design # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1001 -dotnet_diagnostic.CA1001.severity = warning +dotnet_diagnostic.CA1001.severity = none # Title : Do not expose generic lists # Category : Design @@ -320,6 +320,7 @@ dotnet_code_quality.CA1062.null_check_validation_methods = IfNull|IfNullOrEmpty| # Category : Design # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1063 dotnet_diagnostic.CA1063.severity = warning +dotnet_code_quality.CA1063.api_surface = public # Title : Exceptions should be public # Category : Design @@ -668,6 +669,7 @@ dotnet_diagnostic.CA1821.severity = none # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1822 dotnet_diagnostic.CA1822.severity = warning +dotnet_code_quality.CA1822.api_surface = all # Title : Avoid unused private fields # Category : Performance @@ -797,7 +799,7 @@ dotnet_diagnostic.CA1847.severity = none # Title : Use the LoggerMessage delegates # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1848 -# Comment : Use the code generated model instead. +# Comment : Use R9 logging model instead dotnet_diagnostic.CA1848.severity = none # Title : Call async methods when in an async method @@ -848,7 +850,7 @@ dotnet_diagnostic.CA1857.severity = warning # Title : Use 'StartsWith' instead of 'IndexOf' # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1858 -dotnet_diagnostic.CA1858.severity = none +dotnet_diagnostic.CA1858.severity = suggestion # Title : Use concrete types when possible for improved performance # Category : Performance @@ -858,7 +860,7 @@ dotnet_diagnostic.CA1859.severity = none # Title : Avoid using 'Enumerable.Any()' extension method # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1860 -dotnet_diagnostic.CA1860.severity = none +dotnet_diagnostic.CA1860.severity = suggestion # Title : Avoid constant arrays as arguments # Category : Performance @@ -868,7 +870,7 @@ dotnet_diagnostic.CA1861.severity = suggestion # Title : Use the 'StringComparison' method overloads to perform case-insensitive string comparisons # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1862 -dotnet_diagnostic.CA1862.severity = none +dotnet_diagnostic.CA1862.severity = suggestion # Title : Use 'CompositeFormat' # Category : Performance @@ -903,12 +905,12 @@ dotnet_diagnostic.CA1868.severity = suggestion # Title : Cache and reuse 'JsonSerializerOptions' instances # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1869 -dotnet_diagnostic.CA1869.severity = none +dotnet_diagnostic.CA1869.severity = suggestion # Title : Use a cached 'SearchValues' instance # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1870 -dotnet_diagnostic.CA1870.severity = none +dotnet_diagnostic.CA1870.severity = suggestion # Title : Dispose objects before losing scope # Category : Reliability @@ -1045,6 +1047,7 @@ dotnet_diagnostic.CA2207.severity = none # Category : Usage # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2208 dotnet_diagnostic.CA2208.severity = warning +dotnet_code_quality.CA2208.api_surface = all # Title : Non-constant fields should not be visible # Category : Usage @@ -1128,6 +1131,7 @@ dotnet_diagnostic.CA2237.severity = none # Category : Usage # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2241 dotnet_diagnostic.CA2241.severity = warning +dotnet_code_quality.CA2241.try_determine_additional_string_formatting_methods_automatically = false # Title : Test for NaN correctly # Category : Usage @@ -2118,7 +2122,7 @@ dotnet_diagnostic.S103.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-104 dotnet_diagnostic.S104.severity = warning -# Title : Destructors should not throw exceptions +# Title : Finalizers should not throw exceptions # Category : Blocker Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1048 # Redundant: CA1065 @@ -2193,7 +2197,7 @@ dotnet_diagnostic.S1110.severity = none # Redundant: SA1106 dotnet_diagnostic.S1116.severity = none -# Title : Local variables should not shadow class fields +# Title : Local variables should not shadow class fields or properties # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1117 dotnet_diagnostic.S1117.severity = warning @@ -2236,6 +2240,11 @@ dotnet_diagnostic.S1128.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-113 dotnet_diagnostic.S113.severity = none +# Title : Deprecated code should be removed +# Category : Info Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-1133 +dotnet_diagnostic.S1133.severity = suggestion + # Title : Track uses of "FIXME" tags # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1134 @@ -2307,7 +2316,7 @@ dotnet_diagnostic.S1192.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1199 dotnet_diagnostic.S1199.severity = none -# Title : Classes should not be coupled to too many other classes (Single Responsibility Principle) +# Title : Classes should not be coupled to too many other classes # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1200 dotnet_diagnostic.S1200.severity = none @@ -2488,7 +2497,7 @@ dotnet_diagnostic.S1699.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1751 dotnet_diagnostic.S1751.severity = warning -# Title : Identical expressions should not be used on both sides of a binary operator +# Title : Identical expressions should not be used on both sides of operators # Category : Major Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1764 dotnet_diagnostic.S1764.severity = warning @@ -2540,7 +2549,7 @@ dotnet_diagnostic.S1939.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1940 dotnet_diagnostic.S1940.severity = warning -# Title : Inappropriate casts should not be made +# Title : Invalid casts should be avoided # Category : Critical Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1944 dotnet_diagnostic.S1944.severity = warning @@ -2577,6 +2586,11 @@ dotnet_diagnostic.S2077.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2092 dotnet_diagnostic.S2092.severity = warning +# Title : Classes should not be empty +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2094 +dotnet_diagnostic.S2094.severity = none + # Title : Collections should not be passed as arguments to their own methods # Category : Major Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2114 @@ -2602,6 +2616,11 @@ dotnet_diagnostic.S2148.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2156 dotnet_diagnostic.S2156.severity = warning +# Title : Classes named like "Exception" should extend "Exception" or a subclass +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2166 +dotnet_diagnostic.S2166.severity = warning + # Title : Short-circuit logic should be used in boolean contexts # Category : Blocker Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2178 @@ -2617,12 +2636,12 @@ dotnet_diagnostic.S2183.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2184 dotnet_diagnostic.S2184.severity = warning -# Title : TestCases should contain tests +# Title : Test classes should contain at least one test case # Category : Blocker Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2187 dotnet_diagnostic.S2187.severity = warning -# Title : Recursion should not be infinite +# Title : Loops and recursions should not be infinite # Category : Blocker Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2190 dotnet_diagnostic.S2190.severity = warning @@ -2632,7 +2651,12 @@ dotnet_diagnostic.S2190.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2197 dotnet_diagnostic.S2197.severity = warning -# Title : Return values from functions without side effects should not be ignored +# Title : Unnecessary mathematical comparisons should not be made +# Category : Critical Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2198 +dotnet_diagnostic.S2198.severity = warning + +# Title : Methods without side effects should not have their return values ignored # Category : Major Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2201 # Redundant: CA1806 @@ -2668,7 +2692,7 @@ dotnet_diagnostic.S2225.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2228 dotnet_diagnostic.S2228.severity = none -# Title : Parameters should be passed in the correct order +# Title : Arguments should be passed in the same order as the method parameters # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2234 dotnet_diagnostic.S2234.severity = warning @@ -2843,11 +2867,17 @@ dotnet_diagnostic.S2387.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2436 dotnet_diagnostic.S2436.severity = none -# Title : Silly bit operations should not be performed +# Title : Unnecessary bit operations should not be performed # Category : Blocker Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2437 dotnet_diagnostic.S2437.severity = warning +# Title : Blocks should be synchronized on read-only fields +# Category : Major Bug +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2445 +# Comment : Noise +dotnet_diagnostic.S2445.severity = none + # Title : Whitespace and control characters in string literals should be explicit # Category : Critical Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2479 @@ -2861,8 +2891,7 @@ dotnet_diagnostic.S2486.severity = warning # Title : Shared resources should not be used for locking # Category : Critical Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2551 -# Redundant: CA2002 -dotnet_diagnostic.S2551.severity = none +dotnet_diagnostic.S2551.severity = warning # Title : Conditionally executed code should be reachable # Category : Major Bug @@ -2873,7 +2902,8 @@ dotnet_diagnostic.S2583.severity = none # Title : Boolean expressions should not be gratuitous # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2589 -dotnet_diagnostic.S2589.severity = warning +# Comment : Too many false positives. +dotnet_diagnostic.S2589.severity = none # Title : Setting loose file permissions is security-sensitive # Category : Major Security Hotspot @@ -2930,7 +2960,7 @@ dotnet_diagnostic.S2743.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2755 dotnet_diagnostic.S2755.severity = warning -# Title : "=+" should not be used instead of "+=" +# Title : Non-existent operators like "=+" should not be used # Category : Major Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2757 dotnet_diagnostic.S2757.severity = warning @@ -2955,6 +2985,11 @@ dotnet_diagnostic.S2761.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2857 dotnet_diagnostic.S2857.severity = warning +# Title : "Thread.Sleep" should not be used in tests +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2925 +dotnet_diagnostic.S2925.severity = none + # Title : "IDisposables" should be disposed # Category : Blocker Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2930 @@ -2993,6 +3028,11 @@ dotnet_diagnostic.S2953.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2955 dotnet_diagnostic.S2955.severity = warning +# Title : Assertions should be complete +# Category : Blocker Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2970 +dotnet_diagnostic.S2970.severity = warning + # Title : "IEnumerable" LINQs should be simplified # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2971 @@ -3043,6 +3083,11 @@ dotnet_diagnostic.S3059.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3060 dotnet_diagnostic.S3060.severity = warning +# Title : "StringBuilder" data should be used +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-3063 +dotnet_diagnostic.S3063.severity = warning + # Title : "async" methods should not return "void" # Category : Major Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3168 @@ -3100,7 +3145,7 @@ dotnet_diagnostic.S3235.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3236 dotnet_diagnostic.S3236.severity = none -# Title : "value" parameters should be used +# Title : "value" contextual keyword should be used # Category : Blocker Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3237 dotnet_diagnostic.S3237.severity = warning @@ -3169,7 +3214,7 @@ dotnet_diagnostic.S3257.severity = none # Title : Non-derived "private" classes and records should be "sealed" # Category : Minor Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3260 -# Redundant: CA1852 +# Redundant: R9A013 dotnet_diagnostic.S3260.severity = none # Title : Namespaces should not be empty @@ -3233,6 +3278,11 @@ dotnet_diagnostic.S3353.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3358 dotnet_diagnostic.S3358.severity = warning +# Title : Date and time should not be used as a type for primary keys +# Category : Minor Bug +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-3363 +dotnet_diagnostic.S3363.severity = warning + # Title : "this" should not be exposed from constructors # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3366 @@ -3249,6 +3299,11 @@ dotnet_diagnostic.S3376.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3397 dotnet_diagnostic.S3397.severity = warning +# Title : "private" methods called only by inner classes should be moved to those classes +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-3398 +dotnet_diagnostic.S3398.severity = warning + # Title : Methods should not return constants # Category : Minor Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3400 @@ -3259,7 +3314,7 @@ dotnet_diagnostic.S3400.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3415 dotnet_diagnostic.S3415.severity = warning -# Title : Method overloads with default parameter values should not overlap +# Title : Method overloads with default parameter values should not overlap # Category : Blocker Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3427 dotnet_diagnostic.S3427.severity = warning @@ -3457,6 +3512,11 @@ dotnet_diagnostic.S3876.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3877 dotnet_diagnostic.S3877.severity = none +# Title : Arrays should not be created for params parameters +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-3878 +dotnet_diagnostic.S3878.severity = suggestion + # Title : Finalizers should not be empty # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3880 @@ -3482,7 +3542,7 @@ dotnet_diagnostic.S3885.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3887 dotnet_diagnostic.S3887.severity = warning -# Title : Neither "Thread.Resume" nor "Thread.Suspend" should be used +# Title : "Thread.Resume" and "Thread.Suspend" should not be used # Category : Blocker Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3889 dotnet_diagnostic.S3889.severity = warning @@ -3856,7 +3916,8 @@ dotnet_diagnostic.S4144.severity = warning # Title : Empty collections should not be accessed or iterated # Category : Minor Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4158 -dotnet_diagnostic.S4158.severity = warning +# Comment : Too many false positives +dotnet_diagnostic.S4158.severity = none # Title : Classes should implement their "ExportAttribute" interfaces # Category : Blocker Bug @@ -3990,6 +4051,11 @@ dotnet_diagnostic.S4507.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4524 dotnet_diagnostic.S4524.severity = warning +# Title : "DebuggerDisplayAttribute" strings should reference existing members +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-4545 +dotnet_diagnostic.S4545.severity = warning + # Title : ASP.NET HTTP request validation feature should not be disabled # Category : Major Vulnerability # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4564 @@ -4010,11 +4076,16 @@ dotnet_diagnostic.S4583.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4586 dotnet_diagnostic.S4586.severity = warning -# Title : String offset-based methods should be preferred for finding substrings from offsets +# Title : Start index should be used instead of calling Substring # Category : Critical Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4635 dotnet_diagnostic.S4635.severity = warning +# Title : Comments should not be empty +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-4663 +dotnet_diagnostic.S4663.severity = none + # Title : Using regular expressions is security-sensitive # Category : Critical Security Hotspot # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4784 @@ -4126,10 +4197,15 @@ dotnet_diagnostic.S5766.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-5773 dotnet_diagnostic.S5773.severity = warning +# Title : Regular expressions should be syntactically valid +# Category : Critical Bug +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-5856 +dotnet_diagnostic.S5856.severity = warning + # Title : Use a testable date/time provider # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-6354 -# Redundant: EA0002 +# Redundant: R9A022 dotnet_diagnostic.S6354.severity = none # Title : Azure Functions should be stateless @@ -4165,7 +4241,120 @@ dotnet_diagnostic.S6424.severity = warning # Title : Not specifying a timeout for regular expressions is security-sensitive # Category : Major Security Hotspot # Help Link: https://rules.sonarsource.com/csharp/RSPEC-6444 -dotnet_diagnostic.S6444.severity = warning +dotnet_diagnostic.S6444.severity = none + +# Title : Blocks should not be synchronized on local variables +# Category : Major Bug +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6507 +# Comment : Too many false positives +dotnet_diagnostic.S6507.severity = none + +# Title : "ExcludeFromCodeCoverage" attributes should include a justification +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6513 +dotnet_diagnostic.S6513.severity = suggestion + +# Title : Avoid using "DateTime.Now" for benchmarking or timing operations +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6561 +dotnet_diagnostic.S6561.severity = warning + +# Title : Always set the "DateTimeKind" when creating new "DateTime" instances +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6562 +# Comment : Noise +dotnet_diagnostic.S6562.severity = none + +# Title : Use UTC when recording DateTime instants +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6563 +dotnet_diagnostic.S6563.severity = none + +# Title : Use "DateTimeOffset" instead of "DateTime" +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6566 +# Comment : Noise +dotnet_diagnostic.S6566.severity = none + +# Title : Use "TimeZoneInfo.FindSystemTimeZoneById" without converting the timezones with "TimezoneConverter" +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6575 +dotnet_diagnostic.S6575.severity = warning + +# Title : Use a format provider when parsing date and time +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6580 +dotnet_diagnostic.S6580.severity = warning + +# Title : Don't hardcode the format when turning dates and times to strings +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6585 +dotnet_diagnostic.S6585.severity = none + +# Title : Use the "UnixEpoch" field instead of creating "DateTime" instances that point to the beginning of the Unix epoch +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6588 +dotnet_diagnostic.S6588.severity = warning + +# Title : "Find" method should be used instead of the "FirstOrDefault" extension +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6602 +dotnet_diagnostic.S6602.severity = none + +# Title : The collection-specific "TrueForAll" method should be used instead of the "All" extension +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6603 +dotnet_diagnostic.S6603.severity = none + +# Title : Collection-specific "Exists" method should be used instead of the "Any" extension +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6605 +dotnet_diagnostic.S6605.severity = none + +# Title : The collection should be filtered before sorting by using "Where" before "OrderBy" +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6607 +dotnet_diagnostic.S6607.severity = none + +# Title : Prefer indexing instead of "Enumerable" methods on types implementing "IList" +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6608 +dotnet_diagnostic.S6608.severity = none + +# Title : "Min/Max" properties of "Set" types should be used instead of the "Enumerable" extension methods +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6609 +dotnet_diagnostic.S6609.severity = none + +# Title : "StartsWith" and "EndsWith" overloads that take a "char" should be used instead of the ones that take a "string" +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6610 +dotnet_diagnostic.S6610.severity = none + +# Title : The lambda parameter should be used instead of capturing arguments in "ConcurrentDictionary" methods +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6612 +dotnet_diagnostic.S6612.severity = none + +# Title : "First" and "Last" properties of "LinkedList" should be used instead of the "First()" and "Last()" extension methods +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6613 +dotnet_diagnostic.S6613.severity = none + +# Title : "Contains" should be used instead of "Any" for simple equality checks +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6617 +dotnet_diagnostic.S6617.severity = none + +# Title : "string.Create" should be used instead of "FormattableString" +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6618 +dotnet_diagnostic.S6618.severity = none + +# Title : Using unsafe code blocks is security-sensitive +# Category : Major Security Hotspot +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6640 +dotnet_diagnostic.S6640.severity = warning # Title : Literal suffixes should be upper case # Category : Minor Code Smell @@ -4212,6 +4401,10 @@ dotnet_diagnostic.S9999-symbolRef.severity = warning # Category : dotnet_diagnostic.S9999-token-type.severity = warning +# Title : Analysis Warning generator +# Category : +dotnet_diagnostic.S9999-warning.severity = warning + # Title : Avoid legacy thread switching APIs # Category : Usage # Help Link: https://github.com/Microsoft/vs-threading/blob/main/doc/analyzers/VSTHRD001.md @@ -4265,6 +4458,7 @@ dotnet_diagnostic.VSTHRD102.severity = suggestion # Title : Call async methods when in an async method # Category : Usage # Help Link: https://github.com/Microsoft/vs-threading/blob/main/doc/analyzers/VSTHRD103.md +# Redundant: CA1849 dotnet_diagnostic.VSTHRD103.severity = none # Title : Offer async methods diff --git a/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/NonProdLib.globalconfig b/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/NonProdLib.globalconfig index 3f0b7039479..639a349612d 100644 --- a/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/NonProdLib.globalconfig +++ b/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/NonProdLib.globalconfig @@ -1,5 +1,5 @@ # Created by DiagConfig, the diagnostic config generator -# Generated : 2023-10-22 00:37:58Z +# Generated : 2024-01-25 20:57:55Z # Max Tier : 3 # Attributes: api, general # Analyzers : ILLink.RoslynAnalyzer, Microsoft.Analyzers.Extra, Microsoft.Analyzers.Local, Microsoft.AspNetCore.App.Analyzers, Microsoft.AspNetCore.Components.Analyzers, Microsoft.CodeAnalysis.CSharp.NetAnalyzers, Microsoft.CodeAnalysis.NetAnalyzers, Microsoft.VisualStudio.Threading.Analyzers, Microsoft.VisualStudio.Threading.Analyzers.CSharp, SonarAnalyzer.CSharp @@ -109,7 +109,7 @@ dotnet_diagnostic.CA1001.severity = warning # Title : Types that own disposable fields should be disposable # Category : Design # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1001 -dotnet_diagnostic.CA1001.severity = warning +dotnet_diagnostic.CA1001.severity = none # Title : Do not expose generic lists # Category : Design @@ -204,6 +204,7 @@ dotnet_diagnostic.CA1028.severity = none # Category : Design # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1030 dotnet_diagnostic.CA1030.severity = warning +dotnet_code_quality.CA1030.api_surface = public # Title : Do not catch general exception types # Category : Design @@ -229,6 +230,7 @@ dotnet_diagnostic.CA1034.severity = warning # Category : Design # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1036 dotnet_diagnostic.CA1036.severity = warning +dotnet_code_quality.CA1036.api_surface = all # Title : Avoid empty interfaces # Category : Design @@ -287,21 +289,25 @@ dotnet_code_quality.CA1051.api_surface = public # Category : Design # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1052 dotnet_diagnostic.CA1052.severity = warning +dotnet_code_quality.CA1052.api_surface = all # Title : URI-like parameters should not be strings # Category : Design # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1054 dotnet_diagnostic.CA1054.severity = warning +dotnet_code_quality.CA1054.api_surface = public # Title : URI-like return values should not be strings # Category : Design # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1055 dotnet_diagnostic.CA1055.severity = warning +dotnet_code_quality.CA1055.api_surface = public # Title : URI-like properties should not be strings # Category : Design # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1056 dotnet_diagnostic.CA1056.severity = warning +dotnet_code_quality.CA1056.api_surface = public # Title : Types should not extend certain base types # Category : Design @@ -332,6 +338,7 @@ dotnet_code_quality.CA1062.null_check_validation_methods = IfNull|IfNullOrEmpty| # Category : Design # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1063 dotnet_diagnostic.CA1063.severity = warning +dotnet_code_quality.CA1063.api_surface = public # Title : Exceptions should be public # Category : Design @@ -598,6 +605,7 @@ dotnet_code_quality.CA1724.api_surface = public # Category : Naming # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1725 dotnet_diagnostic.CA1725.severity = warning +dotnet_code_quality.CA1725.api_surface = public, protected # Title : Use PascalCase for named placeholders # Category : Naming @@ -692,6 +700,7 @@ dotnet_diagnostic.CA1821.severity = none # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1822 dotnet_diagnostic.CA1822.severity = warning +dotnet_code_quality.CA1822.api_surface = all # Title : Avoid unused private fields # Category : Performance @@ -821,7 +830,7 @@ dotnet_diagnostic.CA1847.severity = none # Title : Use the LoggerMessage delegates # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1848 -# Comment : Use the code generated model instead. +# Comment : Use R9 logging model instead dotnet_diagnostic.CA1848.severity = none # Title : Call async methods when in an async method @@ -872,7 +881,7 @@ dotnet_diagnostic.CA1857.severity = warning # Title : Use 'StartsWith' instead of 'IndexOf' # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1858 -dotnet_diagnostic.CA1858.severity = none +dotnet_diagnostic.CA1858.severity = suggestion # Title : Use concrete types when possible for improved performance # Category : Performance @@ -882,7 +891,7 @@ dotnet_diagnostic.CA1859.severity = none # Title : Avoid using 'Enumerable.Any()' extension method # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1860 -dotnet_diagnostic.CA1860.severity = none +dotnet_diagnostic.CA1860.severity = suggestion # Title : Avoid constant arrays as arguments # Category : Performance @@ -892,7 +901,7 @@ dotnet_diagnostic.CA1861.severity = suggestion # Title : Use the 'StringComparison' method overloads to perform case-insensitive string comparisons # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1862 -dotnet_diagnostic.CA1862.severity = none +dotnet_diagnostic.CA1862.severity = suggestion # Title : Use 'CompositeFormat' # Category : Performance @@ -927,12 +936,12 @@ dotnet_diagnostic.CA1868.severity = suggestion # Title : Cache and reuse 'JsonSerializerOptions' instances # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1869 -dotnet_diagnostic.CA1869.severity = none +dotnet_diagnostic.CA1869.severity = suggestion # Title : Use a cached 'SearchValues' instance # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1870 -dotnet_diagnostic.CA1870.severity = none +dotnet_diagnostic.CA1870.severity = suggestion # Title : Dispose objects before losing scope # Category : Reliability @@ -1069,6 +1078,7 @@ dotnet_diagnostic.CA2207.severity = none # Category : Usage # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2208 dotnet_diagnostic.CA2208.severity = warning +dotnet_code_quality.CA2208.api_surface = all # Title : Non-constant fields should not be visible # Category : Usage @@ -1133,6 +1143,7 @@ dotnet_diagnostic.CA2229.severity = none # Category : Usage # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2231 dotnet_diagnostic.CA2231.severity = error +dotnet_code_quality.CA2231.api_surface = public # Title : Pass system uri objects instead of strings # Category : Usage @@ -1155,6 +1166,7 @@ dotnet_diagnostic.CA2237.severity = none # Category : Usage # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2241 dotnet_diagnostic.CA2241.severity = warning +dotnet_code_quality.CA2241.try_determine_additional_string_formatting_methods_automatically = false # Title : Test for NaN correctly # Category : Usage @@ -2147,7 +2159,7 @@ dotnet_diagnostic.S103.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-104 dotnet_diagnostic.S104.severity = warning -# Title : Destructors should not throw exceptions +# Title : Finalizers should not throw exceptions # Category : Blocker Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1048 # Redundant: CA1065 @@ -2223,7 +2235,7 @@ dotnet_diagnostic.S1110.severity = none # Redundant: SA1106 dotnet_diagnostic.S1116.severity = none -# Title : Local variables should not shadow class fields +# Title : Local variables should not shadow class fields or properties # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1117 dotnet_diagnostic.S1117.severity = warning @@ -2266,6 +2278,11 @@ dotnet_diagnostic.S1128.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-113 dotnet_diagnostic.S113.severity = none +# Title : Deprecated code should be removed +# Category : Info Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-1133 +dotnet_diagnostic.S1133.severity = suggestion + # Title : Track uses of "FIXME" tags # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1134 @@ -2338,7 +2355,7 @@ dotnet_diagnostic.S1192.severity = suggestion # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1199 dotnet_diagnostic.S1199.severity = warning -# Title : Classes should not be coupled to too many other classes (Single Responsibility Principle) +# Title : Classes should not be coupled to too many other classes # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1200 dotnet_diagnostic.S1200.severity = none @@ -2519,7 +2536,7 @@ dotnet_diagnostic.S1699.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1751 dotnet_diagnostic.S1751.severity = warning -# Title : Identical expressions should not be used on both sides of a binary operator +# Title : Identical expressions should not be used on both sides of operators # Category : Major Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1764 dotnet_diagnostic.S1764.severity = warning @@ -2571,7 +2588,7 @@ dotnet_diagnostic.S1939.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1940 dotnet_diagnostic.S1940.severity = warning -# Title : Inappropriate casts should not be made +# Title : Invalid casts should be avoided # Category : Critical Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1944 dotnet_diagnostic.S1944.severity = warning @@ -2608,6 +2625,11 @@ dotnet_diagnostic.S2077.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2092 dotnet_diagnostic.S2092.severity = warning +# Title : Classes should not be empty +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2094 +dotnet_diagnostic.S2094.severity = none + # Title : Collections should not be passed as arguments to their own methods # Category : Major Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2114 @@ -2633,6 +2655,11 @@ dotnet_diagnostic.S2148.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2156 dotnet_diagnostic.S2156.severity = warning +# Title : Classes named like "Exception" should extend "Exception" or a subclass +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2166 +dotnet_diagnostic.S2166.severity = warning + # Title : Short-circuit logic should be used in boolean contexts # Category : Blocker Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2178 @@ -2648,12 +2675,12 @@ dotnet_diagnostic.S2183.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2184 dotnet_diagnostic.S2184.severity = warning -# Title : TestCases should contain tests +# Title : Test classes should contain at least one test case # Category : Blocker Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2187 dotnet_diagnostic.S2187.severity = warning -# Title : Recursion should not be infinite +# Title : Loops and recursions should not be infinite # Category : Blocker Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2190 dotnet_diagnostic.S2190.severity = warning @@ -2663,7 +2690,12 @@ dotnet_diagnostic.S2190.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2197 dotnet_diagnostic.S2197.severity = warning -# Title : Return values from functions without side effects should not be ignored +# Title : Unnecessary mathematical comparisons should not be made +# Category : Critical Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2198 +dotnet_diagnostic.S2198.severity = warning + +# Title : Methods without side effects should not have their return values ignored # Category : Major Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2201 # Redundant: CA1806 @@ -2699,7 +2731,7 @@ dotnet_diagnostic.S2225.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2228 dotnet_diagnostic.S2228.severity = none -# Title : Parameters should be passed in the correct order +# Title : Arguments should be passed in the same order as the method parameters # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2234 dotnet_diagnostic.S2234.severity = warning @@ -2876,11 +2908,17 @@ dotnet_diagnostic.S2387.severity = warning # Redundant: CA1005 dotnet_diagnostic.S2436.severity = none -# Title : Silly bit operations should not be performed +# Title : Unnecessary bit operations should not be performed # Category : Blocker Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2437 dotnet_diagnostic.S2437.severity = warning +# Title : Blocks should be synchronized on read-only fields +# Category : Major Bug +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2445 +# Comment : Noise +dotnet_diagnostic.S2445.severity = none + # Title : Whitespace and control characters in string literals should be explicit # Category : Critical Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2479 @@ -2894,8 +2932,7 @@ dotnet_diagnostic.S2486.severity = warning # Title : Shared resources should not be used for locking # Category : Critical Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2551 -# Redundant: CA2002 -dotnet_diagnostic.S2551.severity = none +dotnet_diagnostic.S2551.severity = warning # Title : Conditionally executed code should be reachable # Category : Major Bug @@ -2906,7 +2943,8 @@ dotnet_diagnostic.S2583.severity = none # Title : Boolean expressions should not be gratuitous # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2589 -dotnet_diagnostic.S2589.severity = warning +# Comment : Too many false positives. +dotnet_diagnostic.S2589.severity = none # Title : Setting loose file permissions is security-sensitive # Category : Major Security Hotspot @@ -2963,7 +3001,7 @@ dotnet_diagnostic.S2743.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2755 dotnet_diagnostic.S2755.severity = warning -# Title : "=+" should not be used instead of "+=" +# Title : Non-existent operators like "=+" should not be used # Category : Major Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2757 dotnet_diagnostic.S2757.severity = warning @@ -2988,6 +3026,11 @@ dotnet_diagnostic.S2761.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2857 dotnet_diagnostic.S2857.severity = warning +# Title : "Thread.Sleep" should not be used in tests +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2925 +dotnet_diagnostic.S2925.severity = none + # Title : "IDisposables" should be disposed # Category : Blocker Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2930 @@ -3026,6 +3069,11 @@ dotnet_diagnostic.S2953.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2955 dotnet_diagnostic.S2955.severity = warning +# Title : Assertions should be complete +# Category : Blocker Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2970 +dotnet_diagnostic.S2970.severity = warning + # Title : "IEnumerable" LINQs should be simplified # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2971 @@ -3077,6 +3125,11 @@ dotnet_diagnostic.S3059.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3060 dotnet_diagnostic.S3060.severity = warning +# Title : "StringBuilder" data should be used +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-3063 +dotnet_diagnostic.S3063.severity = warning + # Title : "async" methods should not return "void" # Category : Major Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3168 @@ -3134,7 +3187,7 @@ dotnet_diagnostic.S3235.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3236 dotnet_diagnostic.S3236.severity = warning -# Title : "value" parameters should be used +# Title : "value" contextual keyword should be used # Category : Blocker Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3237 dotnet_diagnostic.S3237.severity = warning @@ -3199,12 +3252,13 @@ dotnet_diagnostic.S3256.severity = warning # Title : Declarations and initializations should be as concise as possible # Category : Minor Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3257 -dotnet_diagnostic.S3257.severity = warning +# Comment : Too many false positives +dotnet_diagnostic.S3257.severity = none # Title : Non-derived "private" classes and records should be "sealed" # Category : Minor Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3260 -# Redundant: CA1852 +# Redundant: R9A013 dotnet_diagnostic.S3260.severity = none # Title : Namespaces should not be empty @@ -3268,6 +3322,11 @@ dotnet_diagnostic.S3353.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3358 dotnet_diagnostic.S3358.severity = warning +# Title : Date and time should not be used as a type for primary keys +# Category : Minor Bug +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-3363 +dotnet_diagnostic.S3363.severity = warning + # Title : "this" should not be exposed from constructors # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3366 @@ -3284,6 +3343,11 @@ dotnet_diagnostic.S3376.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3397 dotnet_diagnostic.S3397.severity = warning +# Title : "private" methods called only by inner classes should be moved to those classes +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-3398 +dotnet_diagnostic.S3398.severity = warning + # Title : Methods should not return constants # Category : Minor Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3400 @@ -3294,7 +3358,7 @@ dotnet_diagnostic.S3400.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3415 dotnet_diagnostic.S3415.severity = warning -# Title : Method overloads with default parameter values should not overlap +# Title : Method overloads with default parameter values should not overlap # Category : Blocker Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3427 dotnet_diagnostic.S3427.severity = warning @@ -3492,6 +3556,11 @@ dotnet_diagnostic.S3876.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3877 dotnet_diagnostic.S3877.severity = none +# Title : Arrays should not be created for params parameters +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-3878 +dotnet_diagnostic.S3878.severity = suggestion + # Title : Finalizers should not be empty # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3880 @@ -3517,7 +3586,7 @@ dotnet_diagnostic.S3885.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3887 dotnet_diagnostic.S3887.severity = warning -# Title : Neither "Thread.Resume" nor "Thread.Suspend" should be used +# Title : "Thread.Resume" and "Thread.Suspend" should not be used # Category : Blocker Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3889 dotnet_diagnostic.S3889.severity = warning @@ -3757,7 +3826,7 @@ dotnet_diagnostic.S4022.severity = warning # Title : Interfaces should not be empty # Category : Minor Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4023 -dotnet_diagnostic.S4023.severity = warning +dotnet_diagnostic.S4023.severity = suggestion # Title : Child class fields should not differ from parent class fields only by capitalization # Category : Critical Code Smell @@ -3895,7 +3964,8 @@ dotnet_diagnostic.S4144.severity = warning # Title : Empty collections should not be accessed or iterated # Category : Minor Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4158 -dotnet_diagnostic.S4158.severity = warning +# Comment : Too many false positives +dotnet_diagnostic.S4158.severity = none # Title : Classes should implement their "ExportAttribute" interfaces # Category : Blocker Bug @@ -4029,6 +4099,11 @@ dotnet_diagnostic.S4507.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4524 dotnet_diagnostic.S4524.severity = warning +# Title : "DebuggerDisplayAttribute" strings should reference existing members +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-4545 +dotnet_diagnostic.S4545.severity = warning + # Title : ASP.NET HTTP request validation feature should not be disabled # Category : Major Vulnerability # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4564 @@ -4049,11 +4124,16 @@ dotnet_diagnostic.S4583.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4586 dotnet_diagnostic.S4586.severity = warning -# Title : String offset-based methods should be preferred for finding substrings from offsets +# Title : Start index should be used instead of calling Substring # Category : Critical Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4635 dotnet_diagnostic.S4635.severity = warning +# Title : Comments should not be empty +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-4663 +dotnet_diagnostic.S4663.severity = suggestion + # Title : Using regular expressions is security-sensitive # Category : Critical Security Hotspot # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4784 @@ -4165,10 +4245,15 @@ dotnet_diagnostic.S5766.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-5773 dotnet_diagnostic.S5773.severity = warning +# Title : Regular expressions should be syntactically valid +# Category : Critical Bug +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-5856 +dotnet_diagnostic.S5856.severity = warning + # Title : Use a testable date/time provider # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-6354 -# Redundant: EA0002 +# Redundant: R9A022 dotnet_diagnostic.S6354.severity = none # Title : Azure Functions should be stateless @@ -4204,7 +4289,120 @@ dotnet_diagnostic.S6424.severity = warning # Title : Not specifying a timeout for regular expressions is security-sensitive # Category : Major Security Hotspot # Help Link: https://rules.sonarsource.com/csharp/RSPEC-6444 -dotnet_diagnostic.S6444.severity = warning +dotnet_diagnostic.S6444.severity = none + +# Title : Blocks should not be synchronized on local variables +# Category : Major Bug +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6507 +# Comment : Too many false positives +dotnet_diagnostic.S6507.severity = none + +# Title : "ExcludeFromCodeCoverage" attributes should include a justification +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6513 +dotnet_diagnostic.S6513.severity = suggestion + +# Title : Avoid using "DateTime.Now" for benchmarking or timing operations +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6561 +dotnet_diagnostic.S6561.severity = warning + +# Title : Always set the "DateTimeKind" when creating new "DateTime" instances +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6562 +# Comment : Noise +dotnet_diagnostic.S6562.severity = none + +# Title : Use UTC when recording DateTime instants +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6563 +dotnet_diagnostic.S6563.severity = none + +# Title : Use "DateTimeOffset" instead of "DateTime" +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6566 +# Comment : Noise +dotnet_diagnostic.S6566.severity = none + +# Title : Use "TimeZoneInfo.FindSystemTimeZoneById" without converting the timezones with "TimezoneConverter" +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6575 +dotnet_diagnostic.S6575.severity = warning + +# Title : Use a format provider when parsing date and time +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6580 +dotnet_diagnostic.S6580.severity = warning + +# Title : Don't hardcode the format when turning dates and times to strings +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6585 +dotnet_diagnostic.S6585.severity = none + +# Title : Use the "UnixEpoch" field instead of creating "DateTime" instances that point to the beginning of the Unix epoch +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6588 +dotnet_diagnostic.S6588.severity = warning + +# Title : "Find" method should be used instead of the "FirstOrDefault" extension +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6602 +dotnet_diagnostic.S6602.severity = none + +# Title : The collection-specific "TrueForAll" method should be used instead of the "All" extension +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6603 +dotnet_diagnostic.S6603.severity = none + +# Title : Collection-specific "Exists" method should be used instead of the "Any" extension +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6605 +dotnet_diagnostic.S6605.severity = none + +# Title : The collection should be filtered before sorting by using "Where" before "OrderBy" +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6607 +dotnet_diagnostic.S6607.severity = none + +# Title : Prefer indexing instead of "Enumerable" methods on types implementing "IList" +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6608 +dotnet_diagnostic.S6608.severity = none + +# Title : "Min/Max" properties of "Set" types should be used instead of the "Enumerable" extension methods +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6609 +dotnet_diagnostic.S6609.severity = none + +# Title : "StartsWith" and "EndsWith" overloads that take a "char" should be used instead of the ones that take a "string" +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6610 +dotnet_diagnostic.S6610.severity = none + +# Title : The lambda parameter should be used instead of capturing arguments in "ConcurrentDictionary" methods +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6612 +dotnet_diagnostic.S6612.severity = none + +# Title : "First" and "Last" properties of "LinkedList" should be used instead of the "First()" and "Last()" extension methods +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6613 +dotnet_diagnostic.S6613.severity = none + +# Title : "Contains" should be used instead of "Any" for simple equality checks +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6617 +dotnet_diagnostic.S6617.severity = none + +# Title : "string.Create" should be used instead of "FormattableString" +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6618 +dotnet_diagnostic.S6618.severity = none + +# Title : Using unsafe code blocks is security-sensitive +# Category : Major Security Hotspot +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6640 +dotnet_diagnostic.S6640.severity = warning # Title : Literal suffixes should be upper case # Category : Minor Code Smell @@ -4251,6 +4449,10 @@ dotnet_diagnostic.S9999-symbolRef.severity = warning # Category : dotnet_diagnostic.S9999-token-type.severity = warning +# Title : Analysis Warning generator +# Category : +dotnet_diagnostic.S9999-warning.severity = warning + # Title : Avoid legacy thread switching APIs # Category : Usage # Help Link: https://github.com/Microsoft/vs-threading/blob/main/doc/analyzers/VSTHRD001.md @@ -4304,6 +4506,7 @@ dotnet_diagnostic.VSTHRD102.severity = suggestion # Title : Call async methods when in an async method # Category : Usage # Help Link: https://github.com/Microsoft/vs-threading/blob/main/doc/analyzers/VSTHRD103.md +# Redundant: CA1849 dotnet_diagnostic.VSTHRD103.severity = none # Title : Offer async methods diff --git a/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/ProdExe-Tier1.globalconfig b/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/ProdExe-Tier1.globalconfig index 16079cf2e72..501ffab741c 100644 --- a/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/ProdExe-Tier1.globalconfig +++ b/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/ProdExe-Tier1.globalconfig @@ -1,5 +1,5 @@ # Created by DiagConfig, the diagnostic config generator -# Generated : 2023-10-22 00:37:49Z +# Generated : 2024-01-25 20:57:47Z # Max Tier : 1 # Attributes: general, performance, production # Analyzers : ILLink.RoslynAnalyzer, Microsoft.Analyzers.Extra, Microsoft.Analyzers.Local, Microsoft.AspNetCore.App.Analyzers, Microsoft.AspNetCore.Components.Analyzers, Microsoft.CodeAnalysis.CSharp.NetAnalyzers, Microsoft.CodeAnalysis.NetAnalyzers, Microsoft.VisualStudio.Threading.Analyzers, Microsoft.VisualStudio.Threading.Analyzers.CSharp, SonarAnalyzer.CSharp @@ -309,6 +309,7 @@ dotnet_diagnostic.CA1062.severity = none # Category : Design # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1063 dotnet_diagnostic.CA1063.severity = warning +dotnet_code_quality.CA1063.api_surface = public # Title : Exceptions should be public # Category : Design @@ -828,7 +829,7 @@ dotnet_diagnostic.CA1857.severity = warning # Title : Use 'StartsWith' instead of 'IndexOf' # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1858 -dotnet_diagnostic.CA1858.severity = warning +dotnet_diagnostic.CA1858.severity = suggestion # Title : Use concrete types when possible for improved performance # Category : Performance @@ -838,7 +839,7 @@ dotnet_diagnostic.CA1859.severity = warning # Title : Avoid using 'Enumerable.Any()' extension method # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1860 -dotnet_diagnostic.CA1860.severity = warning +dotnet_diagnostic.CA1860.severity = suggestion # Title : Avoid constant arrays as arguments # Category : Performance @@ -848,17 +849,17 @@ dotnet_diagnostic.CA1861.severity = suggestion # Title : Use the 'StringComparison' method overloads to perform case-insensitive string comparisons # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1862 -dotnet_diagnostic.CA1862.severity = warning +dotnet_diagnostic.CA1862.severity = suggestion # Title : Use 'CompositeFormat' # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1863 -dotnet_diagnostic.CA1863.severity = warning +dotnet_diagnostic.CA1863.severity = none # Title : Prefer the 'IDictionary.TryAdd(TKey, TValue)' method # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1864 -dotnet_diagnostic.CA1864.severity = warning +dotnet_diagnostic.CA1864.severity = suggestion # Title : Use char overload # Category : Performance @@ -878,17 +879,17 @@ dotnet_diagnostic.CA1867.severity = warning # Title : Unnecessary call to 'Contains(item)' # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1868 -dotnet_diagnostic.CA1868.severity = warning +dotnet_diagnostic.CA1868.severity = suggestion # Title : Cache and reuse 'JsonSerializerOptions' instances # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1869 -dotnet_diagnostic.CA1869.severity = warning +dotnet_diagnostic.CA1869.severity = suggestion # Title : Use a cached 'SearchValues' instance # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1870 -dotnet_diagnostic.CA1870.severity = warning +dotnet_diagnostic.CA1870.severity = suggestion # Title : Dispose objects before losing scope # Category : Reliability @@ -1105,6 +1106,7 @@ dotnet_diagnostic.CA2237.severity = none # Category : Usage # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2241 dotnet_diagnostic.CA2241.severity = warning +dotnet_code_quality.CA2241.try_determine_additional_string_formatting_methods_automatically = false # Title : Test for NaN correctly # Category : Usage @@ -2095,7 +2097,7 @@ dotnet_diagnostic.S103.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-104 dotnet_diagnostic.S104.severity = none -# Title : Destructors should not throw exceptions +# Title : Finalizers should not throw exceptions # Category : Blocker Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1048 # Redundant: CA1065 @@ -2166,7 +2168,7 @@ dotnet_diagnostic.S1110.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1116 dotnet_diagnostic.S1116.severity = none -# Title : Local variables should not shadow class fields +# Title : Local variables should not shadow class fields or properties # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1117 dotnet_diagnostic.S1117.severity = warning @@ -2206,6 +2208,11 @@ dotnet_diagnostic.S1128.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-113 dotnet_diagnostic.S113.severity = none +# Title : Deprecated code should be removed +# Category : Info Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-1133 +dotnet_diagnostic.S1133.severity = suggestion + # Title : Track uses of "FIXME" tags # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1134 @@ -2277,7 +2284,7 @@ dotnet_diagnostic.S1192.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1199 dotnet_diagnostic.S1199.severity = none -# Title : Classes should not be coupled to too many other classes (Single Responsibility Principle) +# Title : Classes should not be coupled to too many other classes # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1200 dotnet_diagnostic.S1200.severity = none @@ -2454,7 +2461,7 @@ dotnet_diagnostic.S1699.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1751 dotnet_diagnostic.S1751.severity = warning -# Title : Identical expressions should not be used on both sides of a binary operator +# Title : Identical expressions should not be used on both sides of operators # Category : Major Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1764 dotnet_diagnostic.S1764.severity = warning @@ -2505,7 +2512,7 @@ dotnet_diagnostic.S1939.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1940 dotnet_diagnostic.S1940.severity = none -# Title : Inappropriate casts should not be made +# Title : Invalid casts should be avoided # Category : Critical Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1944 dotnet_diagnostic.S1944.severity = warning @@ -2542,6 +2549,11 @@ dotnet_diagnostic.S2077.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2092 dotnet_diagnostic.S2092.severity = none +# Title : Classes should not be empty +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2094 +dotnet_diagnostic.S2094.severity = none + # Title : Collections should not be passed as arguments to their own methods # Category : Major Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2114 @@ -2567,6 +2579,11 @@ dotnet_diagnostic.S2148.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2156 dotnet_diagnostic.S2156.severity = none +# Title : Classes named like "Exception" should extend "Exception" or a subclass +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2166 +dotnet_diagnostic.S2166.severity = warning + # Title : Short-circuit logic should be used in boolean contexts # Category : Blocker Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2178 @@ -2582,12 +2599,12 @@ dotnet_diagnostic.S2183.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2184 dotnet_diagnostic.S2184.severity = none -# Title : TestCases should contain tests +# Title : Test classes should contain at least one test case # Category : Blocker Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2187 dotnet_diagnostic.S2187.severity = none -# Title : Recursion should not be infinite +# Title : Loops and recursions should not be infinite # Category : Blocker Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2190 dotnet_diagnostic.S2190.severity = none @@ -2597,7 +2614,12 @@ dotnet_diagnostic.S2190.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2197 dotnet_diagnostic.S2197.severity = warning -# Title : Return values from functions without side effects should not be ignored +# Title : Unnecessary mathematical comparisons should not be made +# Category : Critical Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2198 +dotnet_diagnostic.S2198.severity = warning + +# Title : Methods without side effects should not have their return values ignored # Category : Major Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2201 # Redundant: CA1806 @@ -2633,7 +2655,7 @@ dotnet_diagnostic.S2225.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2228 dotnet_diagnostic.S2228.severity = none -# Title : Parameters should be passed in the correct order +# Title : Arguments should be passed in the same order as the method parameters # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2234 dotnet_diagnostic.S2234.severity = warning @@ -2807,11 +2829,17 @@ dotnet_diagnostic.S2387.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2436 dotnet_diagnostic.S2436.severity = none -# Title : Silly bit operations should not be performed +# Title : Unnecessary bit operations should not be performed # Category : Blocker Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2437 dotnet_diagnostic.S2437.severity = warning +# Title : Blocks should be synchronized on read-only fields +# Category : Major Bug +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2445 +# Comment : Noise +dotnet_diagnostic.S2445.severity = none + # Title : Whitespace and control characters in string literals should be explicit # Category : Critical Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2479 @@ -2825,8 +2853,7 @@ dotnet_diagnostic.S2486.severity = none # Title : Shared resources should not be used for locking # Category : Critical Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2551 -# Redundant: CA2002 -dotnet_diagnostic.S2551.severity = none +dotnet_diagnostic.S2551.severity = warning # Title : Conditionally executed code should be reachable # Category : Major Bug @@ -2837,7 +2864,8 @@ dotnet_diagnostic.S2583.severity = none # Title : Boolean expressions should not be gratuitous # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2589 -dotnet_diagnostic.S2589.severity = warning +# Comment : Too many false positives. +dotnet_diagnostic.S2589.severity = none # Title : Setting loose file permissions is security-sensitive # Category : Major Security Hotspot @@ -2894,7 +2922,7 @@ dotnet_diagnostic.S2743.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2755 dotnet_diagnostic.S2755.severity = warning -# Title : "=+" should not be used instead of "+=" +# Title : Non-existent operators like "=+" should not be used # Category : Major Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2757 dotnet_diagnostic.S2757.severity = warning @@ -2919,6 +2947,11 @@ dotnet_diagnostic.S2761.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2857 dotnet_diagnostic.S2857.severity = warning +# Title : "Thread.Sleep" should not be used in tests +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2925 +dotnet_diagnostic.S2925.severity = none + # Title : "IDisposables" should be disposed # Category : Blocker Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2930 @@ -2957,6 +2990,11 @@ dotnet_diagnostic.S2953.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2955 dotnet_diagnostic.S2955.severity = none +# Title : Assertions should be complete +# Category : Blocker Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2970 +dotnet_diagnostic.S2970.severity = warning + # Title : "IEnumerable" LINQs should be simplified # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2971 @@ -3007,6 +3045,11 @@ dotnet_diagnostic.S3059.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3060 dotnet_diagnostic.S3060.severity = none +# Title : "StringBuilder" data should be used +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-3063 +dotnet_diagnostic.S3063.severity = warning + # Title : "async" methods should not return "void" # Category : Major Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3168 @@ -3063,7 +3106,7 @@ dotnet_diagnostic.S3235.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3236 dotnet_diagnostic.S3236.severity = none -# Title : "value" parameters should be used +# Title : "value" contextual keyword should be used # Category : Blocker Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3237 dotnet_diagnostic.S3237.severity = warning @@ -3194,6 +3237,11 @@ dotnet_diagnostic.S3353.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3358 dotnet_diagnostic.S3358.severity = warning +# Title : Date and time should not be used as a type for primary keys +# Category : Minor Bug +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-3363 +dotnet_diagnostic.S3363.severity = warning + # Title : "this" should not be exposed from constructors # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3366 @@ -3210,6 +3258,11 @@ dotnet_diagnostic.S3376.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3397 dotnet_diagnostic.S3397.severity = none +# Title : "private" methods called only by inner classes should be moved to those classes +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-3398 +dotnet_diagnostic.S3398.severity = warning + # Title : Methods should not return constants # Category : Minor Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3400 @@ -3220,7 +3273,7 @@ dotnet_diagnostic.S3400.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3415 dotnet_diagnostic.S3415.severity = warning -# Title : Method overloads with default parameter values should not overlap +# Title : Method overloads with default parameter values should not overlap # Category : Blocker Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3427 dotnet_diagnostic.S3427.severity = warning @@ -3416,6 +3469,11 @@ dotnet_diagnostic.S3876.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3877 dotnet_diagnostic.S3877.severity = warning +# Title : Arrays should not be created for params parameters +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-3878 +dotnet_diagnostic.S3878.severity = suggestion + # Title : Finalizers should not be empty # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3880 @@ -3441,7 +3499,7 @@ dotnet_diagnostic.S3885.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3887 dotnet_diagnostic.S3887.severity = warning -# Title : Neither "Thread.Resume" nor "Thread.Suspend" should be used +# Title : "Thread.Resume" and "Thread.Suspend" should not be used # Category : Blocker Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3889 dotnet_diagnostic.S3889.severity = warning @@ -3940,6 +3998,11 @@ dotnet_diagnostic.S4507.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4524 dotnet_diagnostic.S4524.severity = warning +# Title : "DebuggerDisplayAttribute" strings should reference existing members +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-4545 +dotnet_diagnostic.S4545.severity = warning + # Title : ASP.NET HTTP request validation feature should not be disabled # Category : Major Vulnerability # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4564 @@ -3960,11 +4023,16 @@ dotnet_diagnostic.S4583.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4586 dotnet_diagnostic.S4586.severity = warning -# Title : String offset-based methods should be preferred for finding substrings from offsets +# Title : Start index should be used instead of calling Substring # Category : Critical Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4635 dotnet_diagnostic.S4635.severity = warning +# Title : Comments should not be empty +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-4663 +dotnet_diagnostic.S4663.severity = none + # Title : Using regular expressions is security-sensitive # Category : Critical Security Hotspot # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4784 @@ -4076,10 +4144,15 @@ dotnet_diagnostic.S5766.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-5773 dotnet_diagnostic.S5773.severity = none +# Title : Regular expressions should be syntactically valid +# Category : Critical Bug +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-5856 +dotnet_diagnostic.S5856.severity = warning + # Title : Use a testable date/time provider # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-6354 -# Redundant: EA0002 +# Redundant: R9A022 dotnet_diagnostic.S6354.severity = none # Title : Azure Functions should be stateless @@ -4117,6 +4190,119 @@ dotnet_diagnostic.S6424.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-6444 dotnet_diagnostic.S6444.severity = warning +# Title : Blocks should not be synchronized on local variables +# Category : Major Bug +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6507 +# Comment : Too many false positives +dotnet_diagnostic.S6507.severity = none + +# Title : "ExcludeFromCodeCoverage" attributes should include a justification +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6513 +dotnet_diagnostic.S6513.severity = suggestion + +# Title : Avoid using "DateTime.Now" for benchmarking or timing operations +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6561 +dotnet_diagnostic.S6561.severity = warning + +# Title : Always set the "DateTimeKind" when creating new "DateTime" instances +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6562 +# Comment : Noise +dotnet_diagnostic.S6562.severity = none + +# Title : Use UTC when recording DateTime instants +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6563 +dotnet_diagnostic.S6563.severity = none + +# Title : Use "DateTimeOffset" instead of "DateTime" +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6566 +# Comment : Noise +dotnet_diagnostic.S6566.severity = none + +# Title : Use "TimeZoneInfo.FindSystemTimeZoneById" without converting the timezones with "TimezoneConverter" +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6575 +dotnet_diagnostic.S6575.severity = warning + +# Title : Use a format provider when parsing date and time +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6580 +dotnet_diagnostic.S6580.severity = warning + +# Title : Don't hardcode the format when turning dates and times to strings +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6585 +dotnet_diagnostic.S6585.severity = none + +# Title : Use the "UnixEpoch" field instead of creating "DateTime" instances that point to the beginning of the Unix epoch +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6588 +dotnet_diagnostic.S6588.severity = warning + +# Title : "Find" method should be used instead of the "FirstOrDefault" extension +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6602 +dotnet_diagnostic.S6602.severity = warning + +# Title : The collection-specific "TrueForAll" method should be used instead of the "All" extension +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6603 +dotnet_diagnostic.S6603.severity = warning + +# Title : Collection-specific "Exists" method should be used instead of the "Any" extension +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6605 +dotnet_diagnostic.S6605.severity = warning + +# Title : The collection should be filtered before sorting by using "Where" before "OrderBy" +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6607 +dotnet_diagnostic.S6607.severity = warning + +# Title : Prefer indexing instead of "Enumerable" methods on types implementing "IList" +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6608 +dotnet_diagnostic.S6608.severity = warning + +# Title : "Min/Max" properties of "Set" types should be used instead of the "Enumerable" extension methods +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6609 +dotnet_diagnostic.S6609.severity = warning + +# Title : "StartsWith" and "EndsWith" overloads that take a "char" should be used instead of the ones that take a "string" +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6610 +dotnet_diagnostic.S6610.severity = warning + +# Title : The lambda parameter should be used instead of capturing arguments in "ConcurrentDictionary" methods +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6612 +dotnet_diagnostic.S6612.severity = warning + +# Title : "First" and "Last" properties of "LinkedList" should be used instead of the "First()" and "Last()" extension methods +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6613 +dotnet_diagnostic.S6613.severity = warning + +# Title : "Contains" should be used instead of "Any" for simple equality checks +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6617 +dotnet_diagnostic.S6617.severity = warning + +# Title : "string.Create" should be used instead of "FormattableString" +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6618 +dotnet_diagnostic.S6618.severity = warning + +# Title : Using unsafe code blocks is security-sensitive +# Category : Major Security Hotspot +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6640 +dotnet_diagnostic.S6640.severity = warning + # Title : Literal suffixes should be upper case # Category : Minor Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-818 @@ -4162,6 +4348,10 @@ dotnet_diagnostic.S9999-symbolRef.severity = warning # Category : dotnet_diagnostic.S9999-token-type.severity = warning +# Title : Analysis Warning generator +# Category : +dotnet_diagnostic.S9999-warning.severity = warning + # Title : Avoid legacy thread switching APIs # Category : Usage # Help Link: https://github.com/Microsoft/vs-threading/blob/main/doc/analyzers/VSTHRD001.md @@ -4215,7 +4405,8 @@ dotnet_diagnostic.VSTHRD102.severity = none # Title : Call async methods when in an async method # Category : Usage # Help Link: https://github.com/Microsoft/vs-threading/blob/main/doc/analyzers/VSTHRD103.md -dotnet_diagnostic.VSTHRD103.severity = warning +# Redundant: CA1849 +dotnet_diagnostic.VSTHRD103.severity = none # Title : Offer async methods # Category : Usage diff --git a/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/ProdExe-Tier2.globalconfig b/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/ProdExe-Tier2.globalconfig index 1713acc92c4..1313da06b41 100644 --- a/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/ProdExe-Tier2.globalconfig +++ b/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/ProdExe-Tier2.globalconfig @@ -1,5 +1,5 @@ # Created by DiagConfig, the diagnostic config generator -# Generated : 2023-10-22 00:37:53Z +# Generated : 2024-01-25 20:57:50Z # Max Tier : 2 # Attributes: general, performance, production # Analyzers : ILLink.RoslynAnalyzer, Microsoft.Analyzers.Extra, Microsoft.Analyzers.Local, Microsoft.AspNetCore.App.Analyzers, Microsoft.AspNetCore.Components.Analyzers, Microsoft.CodeAnalysis.CSharp.NetAnalyzers, Microsoft.CodeAnalysis.NetAnalyzers, Microsoft.VisualStudio.Threading.Analyzers, Microsoft.VisualStudio.Threading.Analyzers.CSharp, SonarAnalyzer.CSharp @@ -108,7 +108,7 @@ dotnet_diagnostic.CA1001.severity = warning # Title : Types that own disposable fields should be disposable # Category : Design # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1001 -dotnet_diagnostic.CA1001.severity = warning +dotnet_diagnostic.CA1001.severity = none # Title : Do not expose generic lists # Category : Design @@ -313,6 +313,7 @@ dotnet_diagnostic.CA1062.severity = none # Category : Design # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1063 dotnet_diagnostic.CA1063.severity = warning +dotnet_code_quality.CA1063.api_surface = public # Title : Exceptions should be public # Category : Design @@ -589,6 +590,7 @@ dotnet_diagnostic.CA1801.severity = none # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1802 dotnet_diagnostic.CA1802.severity = warning +dotnet_code_quality.CA1802.required_modifiers = static # Title : Use literals where appropriate # Category : Performance @@ -636,6 +638,7 @@ dotnet_diagnostic.CA1814.severity = none # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1815 dotnet_diagnostic.CA1815.severity = warning +dotnet_code_quality.CA1815.api_surface = public # Title : Dispose methods should call SuppressFinalize # Category : Usage @@ -646,6 +649,7 @@ dotnet_diagnostic.CA1816.severity = none # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1819 dotnet_diagnostic.CA1819.severity = warning +dotnet_code_quality.CA1819.api_surface = public # Title : Test for empty strings using string length # Category : Performance @@ -661,6 +665,7 @@ dotnet_diagnostic.CA1821.severity = none # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1822 dotnet_diagnostic.CA1822.severity = warning +dotnet_code_quality.CA1822.api_surface = all # Title : Avoid unused private fields # Category : Performance @@ -790,7 +795,7 @@ dotnet_diagnostic.CA1847.severity = none # Title : Use the LoggerMessage delegates # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1848 -# Comment : Use the code generated model instead. +# Comment : Use R9 logging model instead dotnet_diagnostic.CA1848.severity = none # Title : Call async methods when in an async method @@ -811,7 +816,8 @@ dotnet_diagnostic.CA1851.severity = suggestion # Title : Seal internal types # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1852 -dotnet_diagnostic.CA1852.severity = none +dotnet_diagnostic.CA1852.severity = warning +dotnet_code_quality.CA1852.ignore_internalsvisibleto = true # Title : Unnecessary call to 'Dictionary.ContainsKey(key)' # Category : Performance @@ -841,7 +847,7 @@ dotnet_diagnostic.CA1857.severity = warning # Title : Use 'StartsWith' instead of 'IndexOf' # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1858 -dotnet_diagnostic.CA1858.severity = warning +dotnet_diagnostic.CA1858.severity = suggestion # Title : Use concrete types when possible for improved performance # Category : Performance @@ -851,7 +857,7 @@ dotnet_diagnostic.CA1859.severity = warning # Title : Avoid using 'Enumerable.Any()' extension method # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1860 -dotnet_diagnostic.CA1860.severity = warning +dotnet_diagnostic.CA1860.severity = suggestion # Title : Avoid constant arrays as arguments # Category : Performance @@ -861,17 +867,17 @@ dotnet_diagnostic.CA1861.severity = suggestion # Title : Use the 'StringComparison' method overloads to perform case-insensitive string comparisons # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1862 -dotnet_diagnostic.CA1862.severity = warning +dotnet_diagnostic.CA1862.severity = suggestion # Title : Use 'CompositeFormat' # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1863 -dotnet_diagnostic.CA1863.severity = warning +dotnet_diagnostic.CA1863.severity = none # Title : Prefer the 'IDictionary.TryAdd(TKey, TValue)' method # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1864 -dotnet_diagnostic.CA1864.severity = warning +dotnet_diagnostic.CA1864.severity = suggestion # Title : Use char overload # Category : Performance @@ -891,17 +897,17 @@ dotnet_diagnostic.CA1867.severity = warning # Title : Unnecessary call to 'Contains(item)' # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1868 -dotnet_diagnostic.CA1868.severity = warning +dotnet_diagnostic.CA1868.severity = suggestion # Title : Cache and reuse 'JsonSerializerOptions' instances # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1869 -dotnet_diagnostic.CA1869.severity = warning +dotnet_diagnostic.CA1869.severity = suggestion # Title : Use a cached 'SearchValues' instance # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1870 -dotnet_diagnostic.CA1870.severity = warning +dotnet_diagnostic.CA1870.severity = suggestion # Title : Dispose objects before losing scope # Category : Reliability @@ -917,6 +923,8 @@ dotnet_diagnostic.CA2002.severity = warning # Category : Reliability # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2007 dotnet_diagnostic.CA2007.severity = warning +dotnet_code_quality.CA2007.output_kinds = all +dotnet_code_quality.CA2007.exclude_async_void_methods = false # Title : Do not create tasks without passing a TaskScheduler # Category : Reliability @@ -1037,6 +1045,7 @@ dotnet_diagnostic.CA2207.severity = warning # Category : Usage # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2208 dotnet_diagnostic.CA2208.severity = warning +dotnet_code_quality.CA2208.api_surface = all # Title : Non-constant fields should not be visible # Category : Usage @@ -1119,6 +1128,7 @@ dotnet_diagnostic.CA2237.severity = none # Category : Usage # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2241 dotnet_diagnostic.CA2241.severity = warning +dotnet_code_quality.CA2241.try_determine_additional_string_formatting_methods_automatically = false # Title : Test for NaN correctly # Category : Usage @@ -2109,7 +2119,7 @@ dotnet_diagnostic.S103.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-104 dotnet_diagnostic.S104.severity = warning -# Title : Destructors should not throw exceptions +# Title : Finalizers should not throw exceptions # Category : Blocker Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1048 # Redundant: CA1065 @@ -2184,7 +2194,7 @@ dotnet_diagnostic.S1110.severity = none # Redundant: SA1106 dotnet_diagnostic.S1116.severity = none -# Title : Local variables should not shadow class fields +# Title : Local variables should not shadow class fields or properties # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1117 dotnet_diagnostic.S1117.severity = warning @@ -2227,6 +2237,11 @@ dotnet_diagnostic.S1128.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-113 dotnet_diagnostic.S113.severity = none +# Title : Deprecated code should be removed +# Category : Info Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-1133 +dotnet_diagnostic.S1133.severity = suggestion + # Title : Track uses of "FIXME" tags # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1134 @@ -2298,7 +2313,7 @@ dotnet_diagnostic.S1192.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1199 dotnet_diagnostic.S1199.severity = none -# Title : Classes should not be coupled to too many other classes (Single Responsibility Principle) +# Title : Classes should not be coupled to too many other classes # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1200 dotnet_diagnostic.S1200.severity = none @@ -2479,7 +2494,7 @@ dotnet_diagnostic.S1699.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1751 dotnet_diagnostic.S1751.severity = warning -# Title : Identical expressions should not be used on both sides of a binary operator +# Title : Identical expressions should not be used on both sides of operators # Category : Major Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1764 dotnet_diagnostic.S1764.severity = warning @@ -2531,7 +2546,7 @@ dotnet_diagnostic.S1939.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1940 dotnet_diagnostic.S1940.severity = warning -# Title : Inappropriate casts should not be made +# Title : Invalid casts should be avoided # Category : Critical Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1944 dotnet_diagnostic.S1944.severity = warning @@ -2568,6 +2583,11 @@ dotnet_diagnostic.S2077.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2092 dotnet_diagnostic.S2092.severity = warning +# Title : Classes should not be empty +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2094 +dotnet_diagnostic.S2094.severity = none + # Title : Collections should not be passed as arguments to their own methods # Category : Major Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2114 @@ -2593,6 +2613,11 @@ dotnet_diagnostic.S2148.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2156 dotnet_diagnostic.S2156.severity = warning +# Title : Classes named like "Exception" should extend "Exception" or a subclass +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2166 +dotnet_diagnostic.S2166.severity = warning + # Title : Short-circuit logic should be used in boolean contexts # Category : Blocker Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2178 @@ -2608,12 +2633,12 @@ dotnet_diagnostic.S2183.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2184 dotnet_diagnostic.S2184.severity = warning -# Title : TestCases should contain tests +# Title : Test classes should contain at least one test case # Category : Blocker Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2187 dotnet_diagnostic.S2187.severity = warning -# Title : Recursion should not be infinite +# Title : Loops and recursions should not be infinite # Category : Blocker Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2190 dotnet_diagnostic.S2190.severity = warning @@ -2623,7 +2648,12 @@ dotnet_diagnostic.S2190.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2197 dotnet_diagnostic.S2197.severity = warning -# Title : Return values from functions without side effects should not be ignored +# Title : Unnecessary mathematical comparisons should not be made +# Category : Critical Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2198 +dotnet_diagnostic.S2198.severity = warning + +# Title : Methods without side effects should not have their return values ignored # Category : Major Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2201 # Redundant: CA1806 @@ -2659,7 +2689,7 @@ dotnet_diagnostic.S2225.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2228 dotnet_diagnostic.S2228.severity = none -# Title : Parameters should be passed in the correct order +# Title : Arguments should be passed in the same order as the method parameters # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2234 dotnet_diagnostic.S2234.severity = warning @@ -2834,11 +2864,17 @@ dotnet_diagnostic.S2387.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2436 dotnet_diagnostic.S2436.severity = none -# Title : Silly bit operations should not be performed +# Title : Unnecessary bit operations should not be performed # Category : Blocker Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2437 dotnet_diagnostic.S2437.severity = warning +# Title : Blocks should be synchronized on read-only fields +# Category : Major Bug +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2445 +# Comment : Noise +dotnet_diagnostic.S2445.severity = none + # Title : Whitespace and control characters in string literals should be explicit # Category : Critical Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2479 @@ -2852,8 +2888,7 @@ dotnet_diagnostic.S2486.severity = warning # Title : Shared resources should not be used for locking # Category : Critical Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2551 -# Redundant: CA2002 -dotnet_diagnostic.S2551.severity = none +dotnet_diagnostic.S2551.severity = warning # Title : Conditionally executed code should be reachable # Category : Major Bug @@ -2864,7 +2899,8 @@ dotnet_diagnostic.S2583.severity = none # Title : Boolean expressions should not be gratuitous # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2589 -dotnet_diagnostic.S2589.severity = warning +# Comment : Too many false positives. +dotnet_diagnostic.S2589.severity = none # Title : Setting loose file permissions is security-sensitive # Category : Major Security Hotspot @@ -2921,7 +2957,7 @@ dotnet_diagnostic.S2743.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2755 dotnet_diagnostic.S2755.severity = warning -# Title : "=+" should not be used instead of "+=" +# Title : Non-existent operators like "=+" should not be used # Category : Major Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2757 dotnet_diagnostic.S2757.severity = warning @@ -2946,6 +2982,11 @@ dotnet_diagnostic.S2761.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2857 dotnet_diagnostic.S2857.severity = warning +# Title : "Thread.Sleep" should not be used in tests +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2925 +dotnet_diagnostic.S2925.severity = none + # Title : "IDisposables" should be disposed # Category : Blocker Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2930 @@ -2984,6 +3025,11 @@ dotnet_diagnostic.S2953.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2955 dotnet_diagnostic.S2955.severity = warning +# Title : Assertions should be complete +# Category : Blocker Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2970 +dotnet_diagnostic.S2970.severity = warning + # Title : "IEnumerable" LINQs should be simplified # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2971 @@ -3034,6 +3080,11 @@ dotnet_diagnostic.S3059.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3060 dotnet_diagnostic.S3060.severity = warning +# Title : "StringBuilder" data should be used +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-3063 +dotnet_diagnostic.S3063.severity = warning + # Title : "async" methods should not return "void" # Category : Major Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3168 @@ -3091,7 +3142,7 @@ dotnet_diagnostic.S3235.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3236 dotnet_diagnostic.S3236.severity = none -# Title : "value" parameters should be used +# Title : "value" contextual keyword should be used # Category : Blocker Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3237 dotnet_diagnostic.S3237.severity = warning @@ -3160,7 +3211,7 @@ dotnet_diagnostic.S3257.severity = none # Title : Non-derived "private" classes and records should be "sealed" # Category : Minor Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3260 -# Redundant: CA1852 +# Redundant: R9A013 dotnet_diagnostic.S3260.severity = none # Title : Namespaces should not be empty @@ -3224,6 +3275,11 @@ dotnet_diagnostic.S3353.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3358 dotnet_diagnostic.S3358.severity = warning +# Title : Date and time should not be used as a type for primary keys +# Category : Minor Bug +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-3363 +dotnet_diagnostic.S3363.severity = warning + # Title : "this" should not be exposed from constructors # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3366 @@ -3240,6 +3296,11 @@ dotnet_diagnostic.S3376.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3397 dotnet_diagnostic.S3397.severity = warning +# Title : "private" methods called only by inner classes should be moved to those classes +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-3398 +dotnet_diagnostic.S3398.severity = warning + # Title : Methods should not return constants # Category : Minor Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3400 @@ -3250,7 +3311,7 @@ dotnet_diagnostic.S3400.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3415 dotnet_diagnostic.S3415.severity = warning -# Title : Method overloads with default parameter values should not overlap +# Title : Method overloads with default parameter values should not overlap # Category : Blocker Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3427 dotnet_diagnostic.S3427.severity = warning @@ -3448,6 +3509,11 @@ dotnet_diagnostic.S3876.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3877 dotnet_diagnostic.S3877.severity = warning +# Title : Arrays should not be created for params parameters +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-3878 +dotnet_diagnostic.S3878.severity = suggestion + # Title : Finalizers should not be empty # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3880 @@ -3473,7 +3539,7 @@ dotnet_diagnostic.S3885.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3887 dotnet_diagnostic.S3887.severity = warning -# Title : Neither "Thread.Resume" nor "Thread.Suspend" should be used +# Title : "Thread.Resume" and "Thread.Suspend" should not be used # Category : Blocker Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3889 dotnet_diagnostic.S3889.severity = warning @@ -3847,7 +3913,8 @@ dotnet_diagnostic.S4144.severity = warning # Title : Empty collections should not be accessed or iterated # Category : Minor Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4158 -dotnet_diagnostic.S4158.severity = warning +# Comment : Too many false positives +dotnet_diagnostic.S4158.severity = none # Title : Classes should implement their "ExportAttribute" interfaces # Category : Blocker Bug @@ -3981,6 +4048,11 @@ dotnet_diagnostic.S4507.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4524 dotnet_diagnostic.S4524.severity = warning +# Title : "DebuggerDisplayAttribute" strings should reference existing members +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-4545 +dotnet_diagnostic.S4545.severity = warning + # Title : ASP.NET HTTP request validation feature should not be disabled # Category : Major Vulnerability # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4564 @@ -4001,11 +4073,16 @@ dotnet_diagnostic.S4583.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4586 dotnet_diagnostic.S4586.severity = warning -# Title : String offset-based methods should be preferred for finding substrings from offsets +# Title : Start index should be used instead of calling Substring # Category : Critical Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4635 dotnet_diagnostic.S4635.severity = warning +# Title : Comments should not be empty +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-4663 +dotnet_diagnostic.S4663.severity = none + # Title : Using regular expressions is security-sensitive # Category : Critical Security Hotspot # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4784 @@ -4117,10 +4194,15 @@ dotnet_diagnostic.S5766.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-5773 dotnet_diagnostic.S5773.severity = warning +# Title : Regular expressions should be syntactically valid +# Category : Critical Bug +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-5856 +dotnet_diagnostic.S5856.severity = warning + # Title : Use a testable date/time provider # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-6354 -# Redundant: EA0002 +# Redundant: R9A022 dotnet_diagnostic.S6354.severity = none # Title : Azure Functions should be stateless @@ -4158,6 +4240,119 @@ dotnet_diagnostic.S6424.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-6444 dotnet_diagnostic.S6444.severity = warning +# Title : Blocks should not be synchronized on local variables +# Category : Major Bug +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6507 +# Comment : Too many false positives +dotnet_diagnostic.S6507.severity = none + +# Title : "ExcludeFromCodeCoverage" attributes should include a justification +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6513 +dotnet_diagnostic.S6513.severity = suggestion + +# Title : Avoid using "DateTime.Now" for benchmarking or timing operations +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6561 +dotnet_diagnostic.S6561.severity = warning + +# Title : Always set the "DateTimeKind" when creating new "DateTime" instances +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6562 +# Comment : Noise +dotnet_diagnostic.S6562.severity = none + +# Title : Use UTC when recording DateTime instants +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6563 +dotnet_diagnostic.S6563.severity = none + +# Title : Use "DateTimeOffset" instead of "DateTime" +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6566 +# Comment : Noise +dotnet_diagnostic.S6566.severity = none + +# Title : Use "TimeZoneInfo.FindSystemTimeZoneById" without converting the timezones with "TimezoneConverter" +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6575 +dotnet_diagnostic.S6575.severity = warning + +# Title : Use a format provider when parsing date and time +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6580 +dotnet_diagnostic.S6580.severity = warning + +# Title : Don't hardcode the format when turning dates and times to strings +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6585 +dotnet_diagnostic.S6585.severity = none + +# Title : Use the "UnixEpoch" field instead of creating "DateTime" instances that point to the beginning of the Unix epoch +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6588 +dotnet_diagnostic.S6588.severity = warning + +# Title : "Find" method should be used instead of the "FirstOrDefault" extension +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6602 +dotnet_diagnostic.S6602.severity = warning + +# Title : The collection-specific "TrueForAll" method should be used instead of the "All" extension +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6603 +dotnet_diagnostic.S6603.severity = warning + +# Title : Collection-specific "Exists" method should be used instead of the "Any" extension +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6605 +dotnet_diagnostic.S6605.severity = warning + +# Title : The collection should be filtered before sorting by using "Where" before "OrderBy" +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6607 +dotnet_diagnostic.S6607.severity = warning + +# Title : Prefer indexing instead of "Enumerable" methods on types implementing "IList" +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6608 +dotnet_diagnostic.S6608.severity = warning + +# Title : "Min/Max" properties of "Set" types should be used instead of the "Enumerable" extension methods +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6609 +dotnet_diagnostic.S6609.severity = warning + +# Title : "StartsWith" and "EndsWith" overloads that take a "char" should be used instead of the ones that take a "string" +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6610 +dotnet_diagnostic.S6610.severity = warning + +# Title : The lambda parameter should be used instead of capturing arguments in "ConcurrentDictionary" methods +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6612 +dotnet_diagnostic.S6612.severity = warning + +# Title : "First" and "Last" properties of "LinkedList" should be used instead of the "First()" and "Last()" extension methods +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6613 +dotnet_diagnostic.S6613.severity = warning + +# Title : "Contains" should be used instead of "Any" for simple equality checks +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6617 +dotnet_diagnostic.S6617.severity = warning + +# Title : "string.Create" should be used instead of "FormattableString" +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6618 +dotnet_diagnostic.S6618.severity = warning + +# Title : Using unsafe code blocks is security-sensitive +# Category : Major Security Hotspot +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6640 +dotnet_diagnostic.S6640.severity = warning + # Title : Literal suffixes should be upper case # Category : Minor Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-818 @@ -4203,6 +4398,10 @@ dotnet_diagnostic.S9999-symbolRef.severity = warning # Category : dotnet_diagnostic.S9999-token-type.severity = warning +# Title : Analysis Warning generator +# Category : +dotnet_diagnostic.S9999-warning.severity = warning + # Title : Avoid legacy thread switching APIs # Category : Usage # Help Link: https://github.com/Microsoft/vs-threading/blob/main/doc/analyzers/VSTHRD001.md @@ -4256,7 +4455,8 @@ dotnet_diagnostic.VSTHRD102.severity = suggestion # Title : Call async methods when in an async method # Category : Usage # Help Link: https://github.com/Microsoft/vs-threading/blob/main/doc/analyzers/VSTHRD103.md -dotnet_diagnostic.VSTHRD103.severity = warning +# Redundant: CA1849 +dotnet_diagnostic.VSTHRD103.severity = none # Title : Offer async methods # Category : Usage diff --git a/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/ProdExe.globalconfig b/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/ProdExe.globalconfig index cbebc09695b..1ae50bae852 100644 --- a/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/ProdExe.globalconfig +++ b/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/ProdExe.globalconfig @@ -1,5 +1,5 @@ # Created by DiagConfig, the diagnostic config generator -# Generated : 2023-10-22 00:37:56Z +# Generated : 2024-01-25 20:57:53Z # Max Tier : 3 # Attributes: general, performance, production # Analyzers : ILLink.RoslynAnalyzer, Microsoft.Analyzers.Extra, Microsoft.Analyzers.Local, Microsoft.AspNetCore.App.Analyzers, Microsoft.AspNetCore.Components.Analyzers, Microsoft.CodeAnalysis.CSharp.NetAnalyzers, Microsoft.CodeAnalysis.NetAnalyzers, Microsoft.VisualStudio.Threading.Analyzers, Microsoft.VisualStudio.Threading.Analyzers.CSharp, SonarAnalyzer.CSharp @@ -108,7 +108,7 @@ dotnet_diagnostic.CA1001.severity = warning # Title : Types that own disposable fields should be disposable # Category : Design # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1001 -dotnet_diagnostic.CA1001.severity = warning +dotnet_diagnostic.CA1001.severity = none # Title : Do not expose generic lists # Category : Design @@ -198,6 +198,7 @@ dotnet_diagnostic.CA1028.severity = none # Category : Design # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1030 dotnet_diagnostic.CA1030.severity = warning +dotnet_code_quality.CA1030.api_surface = public # Title : Do not catch general exception types # Category : Design @@ -277,6 +278,7 @@ dotnet_diagnostic.CA1051.severity = none # Category : Design # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1052 dotnet_diagnostic.CA1052.severity = warning +dotnet_code_quality.CA1052.api_surface = all # Title : URI-like parameters should not be strings # Category : Design @@ -319,6 +321,7 @@ dotnet_diagnostic.CA1062.severity = none # Category : Design # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1063 dotnet_diagnostic.CA1063.severity = warning +dotnet_code_quality.CA1063.api_surface = public # Title : Exceptions should be public # Category : Design @@ -578,6 +581,7 @@ dotnet_diagnostic.CA1724.severity = none # Category : Naming # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1725 dotnet_diagnostic.CA1725.severity = warning +dotnet_code_quality.CA1725.api_surface = public, protected # Title : Use PascalCase for named placeholders # Category : Naming @@ -600,6 +604,7 @@ dotnet_diagnostic.CA1801.severity = none # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1802 dotnet_diagnostic.CA1802.severity = warning +dotnet_code_quality.CA1802.required_modifiers = static # Title : Use literals where appropriate # Category : Performance @@ -647,6 +652,7 @@ dotnet_diagnostic.CA1814.severity = warning # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1815 dotnet_diagnostic.CA1815.severity = warning +dotnet_code_quality.CA1815.api_surface = public # Title : Dispose methods should call SuppressFinalize # Category : Usage @@ -657,6 +663,7 @@ dotnet_diagnostic.CA1816.severity = warning # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1819 dotnet_diagnostic.CA1819.severity = warning +dotnet_code_quality.CA1819.api_surface = public # Title : Test for empty strings using string length # Category : Performance @@ -672,6 +679,7 @@ dotnet_diagnostic.CA1821.severity = warning # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1822 dotnet_diagnostic.CA1822.severity = warning +dotnet_code_quality.CA1822.api_surface = all # Title : Avoid unused private fields # Category : Performance @@ -801,7 +809,7 @@ dotnet_diagnostic.CA1847.severity = warning # Title : Use the LoggerMessage delegates # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1848 -# Comment : Use the code generated model instead. +# Comment : Use R9 logging model instead dotnet_diagnostic.CA1848.severity = none # Title : Call async methods when in an async method @@ -822,7 +830,8 @@ dotnet_diagnostic.CA1851.severity = suggestion # Title : Seal internal types # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1852 -dotnet_diagnostic.CA1852.severity = none +dotnet_diagnostic.CA1852.severity = warning +dotnet_code_quality.CA1852.ignore_internalsvisibleto = true # Title : Unnecessary call to 'Dictionary.ContainsKey(key)' # Category : Performance @@ -852,7 +861,7 @@ dotnet_diagnostic.CA1857.severity = warning # Title : Use 'StartsWith' instead of 'IndexOf' # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1858 -dotnet_diagnostic.CA1858.severity = warning +dotnet_diagnostic.CA1858.severity = suggestion # Title : Use concrete types when possible for improved performance # Category : Performance @@ -862,7 +871,7 @@ dotnet_diagnostic.CA1859.severity = warning # Title : Avoid using 'Enumerable.Any()' extension method # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1860 -dotnet_diagnostic.CA1860.severity = warning +dotnet_diagnostic.CA1860.severity = suggestion # Title : Avoid constant arrays as arguments # Category : Performance @@ -872,17 +881,17 @@ dotnet_diagnostic.CA1861.severity = suggestion # Title : Use the 'StringComparison' method overloads to perform case-insensitive string comparisons # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1862 -dotnet_diagnostic.CA1862.severity = warning +dotnet_diagnostic.CA1862.severity = suggestion # Title : Use 'CompositeFormat' # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1863 -dotnet_diagnostic.CA1863.severity = warning +dotnet_diagnostic.CA1863.severity = none # Title : Prefer the 'IDictionary.TryAdd(TKey, TValue)' method # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1864 -dotnet_diagnostic.CA1864.severity = warning +dotnet_diagnostic.CA1864.severity = suggestion # Title : Use char overload # Category : Performance @@ -902,17 +911,17 @@ dotnet_diagnostic.CA1867.severity = warning # Title : Unnecessary call to 'Contains(item)' # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1868 -dotnet_diagnostic.CA1868.severity = warning +dotnet_diagnostic.CA1868.severity = suggestion # Title : Cache and reuse 'JsonSerializerOptions' instances # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1869 -dotnet_diagnostic.CA1869.severity = warning +dotnet_diagnostic.CA1869.severity = suggestion # Title : Use a cached 'SearchValues' instance # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1870 -dotnet_diagnostic.CA1870.severity = warning +dotnet_diagnostic.CA1870.severity = suggestion # Title : Dispose objects before losing scope # Category : Reliability @@ -928,6 +937,8 @@ dotnet_diagnostic.CA2002.severity = warning # Category : Reliability # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2007 dotnet_diagnostic.CA2007.severity = warning +dotnet_code_quality.CA2007.output_kinds = all +dotnet_code_quality.CA2007.exclude_async_void_methods = false # Title : Do not create tasks without passing a TaskScheduler # Category : Reliability @@ -1048,6 +1059,7 @@ dotnet_diagnostic.CA2207.severity = warning # Category : Usage # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2208 dotnet_diagnostic.CA2208.severity = warning +dotnet_code_quality.CA2208.api_surface = all # Title : Non-constant fields should not be visible # Category : Usage @@ -1111,11 +1123,13 @@ dotnet_diagnostic.CA2229.severity = none # Category : Usage # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2231 dotnet_diagnostic.CA2231.severity = error +dotnet_code_quality.CA2231.api_surface = public # Title : Pass system uri objects instead of strings # Category : Usage # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2234 dotnet_diagnostic.CA2234.severity = warning +dotnet_code_quality.CA2234.api_surface = all # Title : Mark all non-serializable fields # Category : Usage @@ -1133,6 +1147,7 @@ dotnet_diagnostic.CA2237.severity = none # Category : Usage # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2241 dotnet_diagnostic.CA2241.severity = warning +dotnet_code_quality.CA2241.try_determine_additional_string_formatting_methods_automatically = false # Title : Test for NaN correctly # Category : Usage @@ -2125,7 +2140,7 @@ dotnet_diagnostic.S103.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-104 dotnet_diagnostic.S104.severity = warning -# Title : Destructors should not throw exceptions +# Title : Finalizers should not throw exceptions # Category : Blocker Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1048 # Redundant: CA1065 @@ -2201,7 +2216,7 @@ dotnet_diagnostic.S1110.severity = none # Redundant: SA1106 dotnet_diagnostic.S1116.severity = none -# Title : Local variables should not shadow class fields +# Title : Local variables should not shadow class fields or properties # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1117 dotnet_diagnostic.S1117.severity = warning @@ -2244,6 +2259,11 @@ dotnet_diagnostic.S1128.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-113 dotnet_diagnostic.S113.severity = none +# Title : Deprecated code should be removed +# Category : Info Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-1133 +dotnet_diagnostic.S1133.severity = suggestion + # Title : Track uses of "FIXME" tags # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1134 @@ -2316,7 +2336,7 @@ dotnet_diagnostic.S1192.severity = suggestion # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1199 dotnet_diagnostic.S1199.severity = warning -# Title : Classes should not be coupled to too many other classes (Single Responsibility Principle) +# Title : Classes should not be coupled to too many other classes # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1200 dotnet_diagnostic.S1200.severity = none @@ -2497,7 +2517,7 @@ dotnet_diagnostic.S1699.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1751 dotnet_diagnostic.S1751.severity = warning -# Title : Identical expressions should not be used on both sides of a binary operator +# Title : Identical expressions should not be used on both sides of operators # Category : Major Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1764 dotnet_diagnostic.S1764.severity = warning @@ -2549,7 +2569,7 @@ dotnet_diagnostic.S1939.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1940 dotnet_diagnostic.S1940.severity = warning -# Title : Inappropriate casts should not be made +# Title : Invalid casts should be avoided # Category : Critical Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1944 dotnet_diagnostic.S1944.severity = warning @@ -2586,6 +2606,11 @@ dotnet_diagnostic.S2077.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2092 dotnet_diagnostic.S2092.severity = warning +# Title : Classes should not be empty +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2094 +dotnet_diagnostic.S2094.severity = none + # Title : Collections should not be passed as arguments to their own methods # Category : Major Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2114 @@ -2611,6 +2636,11 @@ dotnet_diagnostic.S2148.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2156 dotnet_diagnostic.S2156.severity = warning +# Title : Classes named like "Exception" should extend "Exception" or a subclass +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2166 +dotnet_diagnostic.S2166.severity = warning + # Title : Short-circuit logic should be used in boolean contexts # Category : Blocker Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2178 @@ -2626,12 +2656,12 @@ dotnet_diagnostic.S2183.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2184 dotnet_diagnostic.S2184.severity = warning -# Title : TestCases should contain tests +# Title : Test classes should contain at least one test case # Category : Blocker Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2187 dotnet_diagnostic.S2187.severity = warning -# Title : Recursion should not be infinite +# Title : Loops and recursions should not be infinite # Category : Blocker Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2190 dotnet_diagnostic.S2190.severity = warning @@ -2641,7 +2671,12 @@ dotnet_diagnostic.S2190.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2197 dotnet_diagnostic.S2197.severity = warning -# Title : Return values from functions without side effects should not be ignored +# Title : Unnecessary mathematical comparisons should not be made +# Category : Critical Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2198 +dotnet_diagnostic.S2198.severity = warning + +# Title : Methods without side effects should not have their return values ignored # Category : Major Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2201 # Redundant: CA1806 @@ -2677,7 +2712,7 @@ dotnet_diagnostic.S2225.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2228 dotnet_diagnostic.S2228.severity = warning -# Title : Parameters should be passed in the correct order +# Title : Arguments should be passed in the same order as the method parameters # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2234 dotnet_diagnostic.S2234.severity = warning @@ -2854,11 +2889,17 @@ dotnet_diagnostic.S2387.severity = warning # Redundant: CA1005 dotnet_diagnostic.S2436.severity = none -# Title : Silly bit operations should not be performed +# Title : Unnecessary bit operations should not be performed # Category : Blocker Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2437 dotnet_diagnostic.S2437.severity = warning +# Title : Blocks should be synchronized on read-only fields +# Category : Major Bug +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2445 +# Comment : Noise +dotnet_diagnostic.S2445.severity = none + # Title : Whitespace and control characters in string literals should be explicit # Category : Critical Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2479 @@ -2872,8 +2913,7 @@ dotnet_diagnostic.S2486.severity = warning # Title : Shared resources should not be used for locking # Category : Critical Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2551 -# Redundant: CA2002 -dotnet_diagnostic.S2551.severity = none +dotnet_diagnostic.S2551.severity = warning # Title : Conditionally executed code should be reachable # Category : Major Bug @@ -2884,7 +2924,8 @@ dotnet_diagnostic.S2583.severity = none # Title : Boolean expressions should not be gratuitous # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2589 -dotnet_diagnostic.S2589.severity = warning +# Comment : Too many false positives. +dotnet_diagnostic.S2589.severity = none # Title : Setting loose file permissions is security-sensitive # Category : Major Security Hotspot @@ -2941,7 +2982,7 @@ dotnet_diagnostic.S2743.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2755 dotnet_diagnostic.S2755.severity = warning -# Title : "=+" should not be used instead of "+=" +# Title : Non-existent operators like "=+" should not be used # Category : Major Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2757 dotnet_diagnostic.S2757.severity = warning @@ -2966,6 +3007,11 @@ dotnet_diagnostic.S2761.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2857 dotnet_diagnostic.S2857.severity = warning +# Title : "Thread.Sleep" should not be used in tests +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2925 +dotnet_diagnostic.S2925.severity = none + # Title : "IDisposables" should be disposed # Category : Blocker Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2930 @@ -3004,6 +3050,11 @@ dotnet_diagnostic.S2953.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2955 dotnet_diagnostic.S2955.severity = warning +# Title : Assertions should be complete +# Category : Blocker Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2970 +dotnet_diagnostic.S2970.severity = warning + # Title : "IEnumerable" LINQs should be simplified # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2971 @@ -3055,6 +3106,11 @@ dotnet_diagnostic.S3059.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3060 dotnet_diagnostic.S3060.severity = warning +# Title : "StringBuilder" data should be used +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-3063 +dotnet_diagnostic.S3063.severity = warning + # Title : "async" methods should not return "void" # Category : Major Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3168 @@ -3112,7 +3168,7 @@ dotnet_diagnostic.S3235.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3236 dotnet_diagnostic.S3236.severity = warning -# Title : "value" parameters should be used +# Title : "value" contextual keyword should be used # Category : Blocker Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3237 dotnet_diagnostic.S3237.severity = warning @@ -3177,12 +3233,13 @@ dotnet_diagnostic.S3256.severity = warning # Title : Declarations and initializations should be as concise as possible # Category : Minor Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3257 -dotnet_diagnostic.S3257.severity = warning +# Comment : Too many false positives +dotnet_diagnostic.S3257.severity = none # Title : Non-derived "private" classes and records should be "sealed" # Category : Minor Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3260 -# Redundant: CA1852 +# Redundant: R9A013 dotnet_diagnostic.S3260.severity = none # Title : Namespaces should not be empty @@ -3246,6 +3303,11 @@ dotnet_diagnostic.S3353.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3358 dotnet_diagnostic.S3358.severity = warning +# Title : Date and time should not be used as a type for primary keys +# Category : Minor Bug +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-3363 +dotnet_diagnostic.S3363.severity = warning + # Title : "this" should not be exposed from constructors # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3366 @@ -3262,6 +3324,11 @@ dotnet_diagnostic.S3376.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3397 dotnet_diagnostic.S3397.severity = warning +# Title : "private" methods called only by inner classes should be moved to those classes +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-3398 +dotnet_diagnostic.S3398.severity = warning + # Title : Methods should not return constants # Category : Minor Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3400 @@ -3272,7 +3339,7 @@ dotnet_diagnostic.S3400.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3415 dotnet_diagnostic.S3415.severity = warning -# Title : Method overloads with default parameter values should not overlap +# Title : Method overloads with default parameter values should not overlap # Category : Blocker Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3427 dotnet_diagnostic.S3427.severity = warning @@ -3470,6 +3537,11 @@ dotnet_diagnostic.S3876.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3877 dotnet_diagnostic.S3877.severity = warning +# Title : Arrays should not be created for params parameters +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-3878 +dotnet_diagnostic.S3878.severity = suggestion + # Title : Finalizers should not be empty # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3880 @@ -3495,7 +3567,7 @@ dotnet_diagnostic.S3885.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3887 dotnet_diagnostic.S3887.severity = warning -# Title : Neither "Thread.Resume" nor "Thread.Suspend" should be used +# Title : "Thread.Resume" and "Thread.Suspend" should not be used # Category : Blocker Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3889 dotnet_diagnostic.S3889.severity = warning @@ -3735,7 +3807,7 @@ dotnet_diagnostic.S4022.severity = warning # Title : Interfaces should not be empty # Category : Minor Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4023 -dotnet_diagnostic.S4023.severity = warning +dotnet_diagnostic.S4023.severity = none # Title : Child class fields should not differ from parent class fields only by capitalization # Category : Critical Code Smell @@ -3873,7 +3945,8 @@ dotnet_diagnostic.S4144.severity = warning # Title : Empty collections should not be accessed or iterated # Category : Minor Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4158 -dotnet_diagnostic.S4158.severity = warning +# Comment : Too many false positives +dotnet_diagnostic.S4158.severity = none # Title : Classes should implement their "ExportAttribute" interfaces # Category : Blocker Bug @@ -4007,6 +4080,11 @@ dotnet_diagnostic.S4507.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4524 dotnet_diagnostic.S4524.severity = warning +# Title : "DebuggerDisplayAttribute" strings should reference existing members +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-4545 +dotnet_diagnostic.S4545.severity = warning + # Title : ASP.NET HTTP request validation feature should not be disabled # Category : Major Vulnerability # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4564 @@ -4027,11 +4105,16 @@ dotnet_diagnostic.S4583.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4586 dotnet_diagnostic.S4586.severity = warning -# Title : String offset-based methods should be preferred for finding substrings from offsets +# Title : Start index should be used instead of calling Substring # Category : Critical Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4635 dotnet_diagnostic.S4635.severity = warning +# Title : Comments should not be empty +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-4663 +dotnet_diagnostic.S4663.severity = suggestion + # Title : Using regular expressions is security-sensitive # Category : Critical Security Hotspot # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4784 @@ -4143,10 +4226,15 @@ dotnet_diagnostic.S5766.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-5773 dotnet_diagnostic.S5773.severity = warning +# Title : Regular expressions should be syntactically valid +# Category : Critical Bug +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-5856 +dotnet_diagnostic.S5856.severity = warning + # Title : Use a testable date/time provider # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-6354 -# Redundant: EA0002 +# Redundant: R9A022 dotnet_diagnostic.S6354.severity = none # Title : Azure Functions should be stateless @@ -4184,6 +4272,119 @@ dotnet_diagnostic.S6424.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-6444 dotnet_diagnostic.S6444.severity = warning +# Title : Blocks should not be synchronized on local variables +# Category : Major Bug +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6507 +# Comment : Too many false positives +dotnet_diagnostic.S6507.severity = none + +# Title : "ExcludeFromCodeCoverage" attributes should include a justification +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6513 +dotnet_diagnostic.S6513.severity = suggestion + +# Title : Avoid using "DateTime.Now" for benchmarking or timing operations +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6561 +dotnet_diagnostic.S6561.severity = warning + +# Title : Always set the "DateTimeKind" when creating new "DateTime" instances +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6562 +# Comment : Noise +dotnet_diagnostic.S6562.severity = none + +# Title : Use UTC when recording DateTime instants +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6563 +dotnet_diagnostic.S6563.severity = none + +# Title : Use "DateTimeOffset" instead of "DateTime" +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6566 +# Comment : Noise +dotnet_diagnostic.S6566.severity = none + +# Title : Use "TimeZoneInfo.FindSystemTimeZoneById" without converting the timezones with "TimezoneConverter" +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6575 +dotnet_diagnostic.S6575.severity = warning + +# Title : Use a format provider when parsing date and time +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6580 +dotnet_diagnostic.S6580.severity = warning + +# Title : Don't hardcode the format when turning dates and times to strings +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6585 +dotnet_diagnostic.S6585.severity = none + +# Title : Use the "UnixEpoch" field instead of creating "DateTime" instances that point to the beginning of the Unix epoch +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6588 +dotnet_diagnostic.S6588.severity = warning + +# Title : "Find" method should be used instead of the "FirstOrDefault" extension +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6602 +dotnet_diagnostic.S6602.severity = warning + +# Title : The collection-specific "TrueForAll" method should be used instead of the "All" extension +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6603 +dotnet_diagnostic.S6603.severity = warning + +# Title : Collection-specific "Exists" method should be used instead of the "Any" extension +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6605 +dotnet_diagnostic.S6605.severity = warning + +# Title : The collection should be filtered before sorting by using "Where" before "OrderBy" +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6607 +dotnet_diagnostic.S6607.severity = warning + +# Title : Prefer indexing instead of "Enumerable" methods on types implementing "IList" +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6608 +dotnet_diagnostic.S6608.severity = warning + +# Title : "Min/Max" properties of "Set" types should be used instead of the "Enumerable" extension methods +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6609 +dotnet_diagnostic.S6609.severity = warning + +# Title : "StartsWith" and "EndsWith" overloads that take a "char" should be used instead of the ones that take a "string" +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6610 +dotnet_diagnostic.S6610.severity = warning + +# Title : The lambda parameter should be used instead of capturing arguments in "ConcurrentDictionary" methods +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6612 +dotnet_diagnostic.S6612.severity = warning + +# Title : "First" and "Last" properties of "LinkedList" should be used instead of the "First()" and "Last()" extension methods +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6613 +dotnet_diagnostic.S6613.severity = warning + +# Title : "Contains" should be used instead of "Any" for simple equality checks +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6617 +dotnet_diagnostic.S6617.severity = warning + +# Title : "string.Create" should be used instead of "FormattableString" +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6618 +dotnet_diagnostic.S6618.severity = warning + +# Title : Using unsafe code blocks is security-sensitive +# Category : Major Security Hotspot +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6640 +dotnet_diagnostic.S6640.severity = warning + # Title : Literal suffixes should be upper case # Category : Minor Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-818 @@ -4229,6 +4430,10 @@ dotnet_diagnostic.S9999-symbolRef.severity = warning # Category : dotnet_diagnostic.S9999-token-type.severity = warning +# Title : Analysis Warning generator +# Category : +dotnet_diagnostic.S9999-warning.severity = warning + # Title : Avoid legacy thread switching APIs # Category : Usage # Help Link: https://github.com/Microsoft/vs-threading/blob/main/doc/analyzers/VSTHRD001.md @@ -4282,7 +4487,8 @@ dotnet_diagnostic.VSTHRD102.severity = suggestion # Title : Call async methods when in an async method # Category : Usage # Help Link: https://github.com/Microsoft/vs-threading/blob/main/doc/analyzers/VSTHRD103.md -dotnet_diagnostic.VSTHRD103.severity = warning +# Redundant: CA1849 +dotnet_diagnostic.VSTHRD103.severity = none # Title : Offer async methods # Category : Usage diff --git a/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/ProdLib-Tier1.globalconfig b/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/ProdLib-Tier1.globalconfig index effc6fe04f4..d0bdc856606 100644 --- a/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/ProdLib-Tier1.globalconfig +++ b/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/ProdLib-Tier1.globalconfig @@ -1,5 +1,5 @@ # Created by DiagConfig, the diagnostic config generator -# Generated : 2023-10-22 00:37:50Z +# Generated : 2024-01-25 20:57:47Z # Max Tier : 1 # Attributes: api, general, performance, production # Analyzers : ILLink.RoslynAnalyzer, Microsoft.Analyzers.Extra, Microsoft.Analyzers.Local, Microsoft.AspNetCore.App.Analyzers, Microsoft.AspNetCore.Components.Analyzers, Microsoft.CodeAnalysis.CSharp.NetAnalyzers, Microsoft.CodeAnalysis.NetAnalyzers, Microsoft.VisualStudio.Threading.Analyzers, Microsoft.VisualStudio.Threading.Analyzers.CSharp, SonarAnalyzer.CSharp @@ -309,6 +309,7 @@ dotnet_diagnostic.CA1062.severity = none # Category : Design # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1063 dotnet_diagnostic.CA1063.severity = warning +dotnet_code_quality.CA1063.api_surface = public # Title : Exceptions should be public # Category : Design @@ -828,7 +829,7 @@ dotnet_diagnostic.CA1857.severity = warning # Title : Use 'StartsWith' instead of 'IndexOf' # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1858 -dotnet_diagnostic.CA1858.severity = warning +dotnet_diagnostic.CA1858.severity = suggestion # Title : Use concrete types when possible for improved performance # Category : Performance @@ -838,7 +839,7 @@ dotnet_diagnostic.CA1859.severity = warning # Title : Avoid using 'Enumerable.Any()' extension method # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1860 -dotnet_diagnostic.CA1860.severity = warning +dotnet_diagnostic.CA1860.severity = suggestion # Title : Avoid constant arrays as arguments # Category : Performance @@ -848,17 +849,17 @@ dotnet_diagnostic.CA1861.severity = suggestion # Title : Use the 'StringComparison' method overloads to perform case-insensitive string comparisons # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1862 -dotnet_diagnostic.CA1862.severity = warning +dotnet_diagnostic.CA1862.severity = suggestion # Title : Use 'CompositeFormat' # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1863 -dotnet_diagnostic.CA1863.severity = warning +dotnet_diagnostic.CA1863.severity = none # Title : Prefer the 'IDictionary.TryAdd(TKey, TValue)' method # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1864 -dotnet_diagnostic.CA1864.severity = warning +dotnet_diagnostic.CA1864.severity = suggestion # Title : Use char overload # Category : Performance @@ -878,17 +879,17 @@ dotnet_diagnostic.CA1867.severity = warning # Title : Unnecessary call to 'Contains(item)' # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1868 -dotnet_diagnostic.CA1868.severity = warning +dotnet_diagnostic.CA1868.severity = suggestion # Title : Cache and reuse 'JsonSerializerOptions' instances # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1869 -dotnet_diagnostic.CA1869.severity = warning +dotnet_diagnostic.CA1869.severity = suggestion # Title : Use a cached 'SearchValues' instance # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1870 -dotnet_diagnostic.CA1870.severity = warning +dotnet_diagnostic.CA1870.severity = suggestion # Title : Dispose objects before losing scope # Category : Reliability @@ -1105,6 +1106,7 @@ dotnet_diagnostic.CA2237.severity = none # Category : Usage # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2241 dotnet_diagnostic.CA2241.severity = warning +dotnet_code_quality.CA2241.try_determine_additional_string_formatting_methods_automatically = false # Title : Test for NaN correctly # Category : Usage @@ -2095,7 +2097,7 @@ dotnet_diagnostic.S103.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-104 dotnet_diagnostic.S104.severity = none -# Title : Destructors should not throw exceptions +# Title : Finalizers should not throw exceptions # Category : Blocker Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1048 # Redundant: CA1065 @@ -2166,7 +2168,7 @@ dotnet_diagnostic.S1110.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1116 dotnet_diagnostic.S1116.severity = none -# Title : Local variables should not shadow class fields +# Title : Local variables should not shadow class fields or properties # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1117 dotnet_diagnostic.S1117.severity = warning @@ -2206,6 +2208,11 @@ dotnet_diagnostic.S1128.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-113 dotnet_diagnostic.S113.severity = none +# Title : Deprecated code should be removed +# Category : Info Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-1133 +dotnet_diagnostic.S1133.severity = suggestion + # Title : Track uses of "FIXME" tags # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1134 @@ -2277,7 +2284,7 @@ dotnet_diagnostic.S1192.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1199 dotnet_diagnostic.S1199.severity = none -# Title : Classes should not be coupled to too many other classes (Single Responsibility Principle) +# Title : Classes should not be coupled to too many other classes # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1200 dotnet_diagnostic.S1200.severity = none @@ -2454,7 +2461,7 @@ dotnet_diagnostic.S1699.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1751 dotnet_diagnostic.S1751.severity = warning -# Title : Identical expressions should not be used on both sides of a binary operator +# Title : Identical expressions should not be used on both sides of operators # Category : Major Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1764 dotnet_diagnostic.S1764.severity = warning @@ -2505,7 +2512,7 @@ dotnet_diagnostic.S1939.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1940 dotnet_diagnostic.S1940.severity = none -# Title : Inappropriate casts should not be made +# Title : Invalid casts should be avoided # Category : Critical Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1944 dotnet_diagnostic.S1944.severity = warning @@ -2542,6 +2549,11 @@ dotnet_diagnostic.S2077.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2092 dotnet_diagnostic.S2092.severity = none +# Title : Classes should not be empty +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2094 +dotnet_diagnostic.S2094.severity = none + # Title : Collections should not be passed as arguments to their own methods # Category : Major Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2114 @@ -2567,6 +2579,11 @@ dotnet_diagnostic.S2148.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2156 dotnet_diagnostic.S2156.severity = none +# Title : Classes named like "Exception" should extend "Exception" or a subclass +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2166 +dotnet_diagnostic.S2166.severity = warning + # Title : Short-circuit logic should be used in boolean contexts # Category : Blocker Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2178 @@ -2582,12 +2599,12 @@ dotnet_diagnostic.S2183.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2184 dotnet_diagnostic.S2184.severity = none -# Title : TestCases should contain tests +# Title : Test classes should contain at least one test case # Category : Blocker Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2187 dotnet_diagnostic.S2187.severity = none -# Title : Recursion should not be infinite +# Title : Loops and recursions should not be infinite # Category : Blocker Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2190 dotnet_diagnostic.S2190.severity = none @@ -2597,7 +2614,12 @@ dotnet_diagnostic.S2190.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2197 dotnet_diagnostic.S2197.severity = warning -# Title : Return values from functions without side effects should not be ignored +# Title : Unnecessary mathematical comparisons should not be made +# Category : Critical Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2198 +dotnet_diagnostic.S2198.severity = warning + +# Title : Methods without side effects should not have their return values ignored # Category : Major Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2201 # Redundant: CA1806 @@ -2633,7 +2655,7 @@ dotnet_diagnostic.S2225.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2228 dotnet_diagnostic.S2228.severity = none -# Title : Parameters should be passed in the correct order +# Title : Arguments should be passed in the same order as the method parameters # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2234 dotnet_diagnostic.S2234.severity = warning @@ -2807,11 +2829,17 @@ dotnet_diagnostic.S2387.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2436 dotnet_diagnostic.S2436.severity = none -# Title : Silly bit operations should not be performed +# Title : Unnecessary bit operations should not be performed # Category : Blocker Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2437 dotnet_diagnostic.S2437.severity = warning +# Title : Blocks should be synchronized on read-only fields +# Category : Major Bug +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2445 +# Comment : Noise +dotnet_diagnostic.S2445.severity = none + # Title : Whitespace and control characters in string literals should be explicit # Category : Critical Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2479 @@ -2825,8 +2853,7 @@ dotnet_diagnostic.S2486.severity = none # Title : Shared resources should not be used for locking # Category : Critical Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2551 -# Redundant: CA2002 -dotnet_diagnostic.S2551.severity = none +dotnet_diagnostic.S2551.severity = warning # Title : Conditionally executed code should be reachable # Category : Major Bug @@ -2837,7 +2864,8 @@ dotnet_diagnostic.S2583.severity = none # Title : Boolean expressions should not be gratuitous # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2589 -dotnet_diagnostic.S2589.severity = warning +# Comment : Too many false positives. +dotnet_diagnostic.S2589.severity = none # Title : Setting loose file permissions is security-sensitive # Category : Major Security Hotspot @@ -2894,7 +2922,7 @@ dotnet_diagnostic.S2743.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2755 dotnet_diagnostic.S2755.severity = warning -# Title : "=+" should not be used instead of "+=" +# Title : Non-existent operators like "=+" should not be used # Category : Major Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2757 dotnet_diagnostic.S2757.severity = warning @@ -2919,6 +2947,11 @@ dotnet_diagnostic.S2761.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2857 dotnet_diagnostic.S2857.severity = warning +# Title : "Thread.Sleep" should not be used in tests +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2925 +dotnet_diagnostic.S2925.severity = none + # Title : "IDisposables" should be disposed # Category : Blocker Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2930 @@ -2957,6 +2990,11 @@ dotnet_diagnostic.S2953.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2955 dotnet_diagnostic.S2955.severity = none +# Title : Assertions should be complete +# Category : Blocker Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2970 +dotnet_diagnostic.S2970.severity = warning + # Title : "IEnumerable" LINQs should be simplified # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2971 @@ -3007,6 +3045,11 @@ dotnet_diagnostic.S3059.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3060 dotnet_diagnostic.S3060.severity = none +# Title : "StringBuilder" data should be used +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-3063 +dotnet_diagnostic.S3063.severity = warning + # Title : "async" methods should not return "void" # Category : Major Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3168 @@ -3063,7 +3106,7 @@ dotnet_diagnostic.S3235.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3236 dotnet_diagnostic.S3236.severity = none -# Title : "value" parameters should be used +# Title : "value" contextual keyword should be used # Category : Blocker Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3237 dotnet_diagnostic.S3237.severity = warning @@ -3194,6 +3237,11 @@ dotnet_diagnostic.S3353.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3358 dotnet_diagnostic.S3358.severity = warning +# Title : Date and time should not be used as a type for primary keys +# Category : Minor Bug +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-3363 +dotnet_diagnostic.S3363.severity = warning + # Title : "this" should not be exposed from constructors # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3366 @@ -3210,6 +3258,11 @@ dotnet_diagnostic.S3376.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3397 dotnet_diagnostic.S3397.severity = none +# Title : "private" methods called only by inner classes should be moved to those classes +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-3398 +dotnet_diagnostic.S3398.severity = warning + # Title : Methods should not return constants # Category : Minor Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3400 @@ -3220,7 +3273,7 @@ dotnet_diagnostic.S3400.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3415 dotnet_diagnostic.S3415.severity = warning -# Title : Method overloads with default parameter values should not overlap +# Title : Method overloads with default parameter values should not overlap # Category : Blocker Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3427 dotnet_diagnostic.S3427.severity = warning @@ -3416,6 +3469,11 @@ dotnet_diagnostic.S3876.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3877 dotnet_diagnostic.S3877.severity = warning +# Title : Arrays should not be created for params parameters +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-3878 +dotnet_diagnostic.S3878.severity = suggestion + # Title : Finalizers should not be empty # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3880 @@ -3441,7 +3499,7 @@ dotnet_diagnostic.S3885.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3887 dotnet_diagnostic.S3887.severity = warning -# Title : Neither "Thread.Resume" nor "Thread.Suspend" should be used +# Title : "Thread.Resume" and "Thread.Suspend" should not be used # Category : Blocker Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3889 dotnet_diagnostic.S3889.severity = warning @@ -3940,6 +3998,11 @@ dotnet_diagnostic.S4507.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4524 dotnet_diagnostic.S4524.severity = warning +# Title : "DebuggerDisplayAttribute" strings should reference existing members +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-4545 +dotnet_diagnostic.S4545.severity = warning + # Title : ASP.NET HTTP request validation feature should not be disabled # Category : Major Vulnerability # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4564 @@ -3960,11 +4023,16 @@ dotnet_diagnostic.S4583.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4586 dotnet_diagnostic.S4586.severity = warning -# Title : String offset-based methods should be preferred for finding substrings from offsets +# Title : Start index should be used instead of calling Substring # Category : Critical Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4635 dotnet_diagnostic.S4635.severity = warning +# Title : Comments should not be empty +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-4663 +dotnet_diagnostic.S4663.severity = none + # Title : Using regular expressions is security-sensitive # Category : Critical Security Hotspot # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4784 @@ -4076,10 +4144,15 @@ dotnet_diagnostic.S5766.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-5773 dotnet_diagnostic.S5773.severity = none +# Title : Regular expressions should be syntactically valid +# Category : Critical Bug +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-5856 +dotnet_diagnostic.S5856.severity = warning + # Title : Use a testable date/time provider # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-6354 -# Redundant: EA0002 +# Redundant: R9A022 dotnet_diagnostic.S6354.severity = none # Title : Azure Functions should be stateless @@ -4117,6 +4190,119 @@ dotnet_diagnostic.S6424.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-6444 dotnet_diagnostic.S6444.severity = warning +# Title : Blocks should not be synchronized on local variables +# Category : Major Bug +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6507 +# Comment : Too many false positives +dotnet_diagnostic.S6507.severity = none + +# Title : "ExcludeFromCodeCoverage" attributes should include a justification +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6513 +dotnet_diagnostic.S6513.severity = suggestion + +# Title : Avoid using "DateTime.Now" for benchmarking or timing operations +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6561 +dotnet_diagnostic.S6561.severity = warning + +# Title : Always set the "DateTimeKind" when creating new "DateTime" instances +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6562 +# Comment : Noise +dotnet_diagnostic.S6562.severity = none + +# Title : Use UTC when recording DateTime instants +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6563 +dotnet_diagnostic.S6563.severity = none + +# Title : Use "DateTimeOffset" instead of "DateTime" +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6566 +# Comment : Noise +dotnet_diagnostic.S6566.severity = none + +# Title : Use "TimeZoneInfo.FindSystemTimeZoneById" without converting the timezones with "TimezoneConverter" +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6575 +dotnet_diagnostic.S6575.severity = warning + +# Title : Use a format provider when parsing date and time +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6580 +dotnet_diagnostic.S6580.severity = warning + +# Title : Don't hardcode the format when turning dates and times to strings +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6585 +dotnet_diagnostic.S6585.severity = none + +# Title : Use the "UnixEpoch" field instead of creating "DateTime" instances that point to the beginning of the Unix epoch +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6588 +dotnet_diagnostic.S6588.severity = warning + +# Title : "Find" method should be used instead of the "FirstOrDefault" extension +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6602 +dotnet_diagnostic.S6602.severity = warning + +# Title : The collection-specific "TrueForAll" method should be used instead of the "All" extension +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6603 +dotnet_diagnostic.S6603.severity = warning + +# Title : Collection-specific "Exists" method should be used instead of the "Any" extension +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6605 +dotnet_diagnostic.S6605.severity = warning + +# Title : The collection should be filtered before sorting by using "Where" before "OrderBy" +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6607 +dotnet_diagnostic.S6607.severity = warning + +# Title : Prefer indexing instead of "Enumerable" methods on types implementing "IList" +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6608 +dotnet_diagnostic.S6608.severity = warning + +# Title : "Min/Max" properties of "Set" types should be used instead of the "Enumerable" extension methods +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6609 +dotnet_diagnostic.S6609.severity = warning + +# Title : "StartsWith" and "EndsWith" overloads that take a "char" should be used instead of the ones that take a "string" +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6610 +dotnet_diagnostic.S6610.severity = warning + +# Title : The lambda parameter should be used instead of capturing arguments in "ConcurrentDictionary" methods +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6612 +dotnet_diagnostic.S6612.severity = warning + +# Title : "First" and "Last" properties of "LinkedList" should be used instead of the "First()" and "Last()" extension methods +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6613 +dotnet_diagnostic.S6613.severity = warning + +# Title : "Contains" should be used instead of "Any" for simple equality checks +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6617 +dotnet_diagnostic.S6617.severity = warning + +# Title : "string.Create" should be used instead of "FormattableString" +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6618 +dotnet_diagnostic.S6618.severity = warning + +# Title : Using unsafe code blocks is security-sensitive +# Category : Major Security Hotspot +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6640 +dotnet_diagnostic.S6640.severity = warning + # Title : Literal suffixes should be upper case # Category : Minor Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-818 @@ -4162,6 +4348,10 @@ dotnet_diagnostic.S9999-symbolRef.severity = warning # Category : dotnet_diagnostic.S9999-token-type.severity = warning +# Title : Analysis Warning generator +# Category : +dotnet_diagnostic.S9999-warning.severity = warning + # Title : Avoid legacy thread switching APIs # Category : Usage # Help Link: https://github.com/Microsoft/vs-threading/blob/main/doc/analyzers/VSTHRD001.md @@ -4215,7 +4405,8 @@ dotnet_diagnostic.VSTHRD102.severity = none # Title : Call async methods when in an async method # Category : Usage # Help Link: https://github.com/Microsoft/vs-threading/blob/main/doc/analyzers/VSTHRD103.md -dotnet_diagnostic.VSTHRD103.severity = warning +# Redundant: CA1849 +dotnet_diagnostic.VSTHRD103.severity = none # Title : Offer async methods # Category : Usage diff --git a/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/ProdLib-Tier2.globalconfig b/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/ProdLib-Tier2.globalconfig index 68c1bef7ee8..fd6a91f7346 100644 --- a/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/ProdLib-Tier2.globalconfig +++ b/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/ProdLib-Tier2.globalconfig @@ -1,5 +1,5 @@ # Created by DiagConfig, the diagnostic config generator -# Generated : 2023-10-22 00:37:53Z +# Generated : 2024-01-25 20:57:51Z # Max Tier : 2 # Attributes: api, general, performance, production # Analyzers : ILLink.RoslynAnalyzer, Microsoft.Analyzers.Extra, Microsoft.Analyzers.Local, Microsoft.AspNetCore.App.Analyzers, Microsoft.AspNetCore.Components.Analyzers, Microsoft.CodeAnalysis.CSharp.NetAnalyzers, Microsoft.CodeAnalysis.NetAnalyzers, Microsoft.VisualStudio.Threading.Analyzers, Microsoft.VisualStudio.Threading.Analyzers.CSharp, SonarAnalyzer.CSharp @@ -108,7 +108,7 @@ dotnet_diagnostic.CA1001.severity = warning # Title : Types that own disposable fields should be disposable # Category : Design # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1001 -dotnet_diagnostic.CA1001.severity = warning +dotnet_diagnostic.CA1001.severity = none # Title : Do not expose generic lists # Category : Design @@ -320,6 +320,7 @@ dotnet_code_quality.CA1062.null_check_validation_methods = IfNull|IfNullOrEmpty| # Category : Design # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1063 dotnet_diagnostic.CA1063.severity = warning +dotnet_code_quality.CA1063.api_surface = public # Title : Exceptions should be public # Category : Design @@ -596,6 +597,7 @@ dotnet_diagnostic.CA1801.severity = none # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1802 dotnet_diagnostic.CA1802.severity = warning +dotnet_code_quality.CA1802.required_modifiers = static # Title : Use literals where appropriate # Category : Performance @@ -643,6 +645,7 @@ dotnet_diagnostic.CA1814.severity = none # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1815 dotnet_diagnostic.CA1815.severity = warning +dotnet_code_quality.CA1815.api_surface = public # Title : Dispose methods should call SuppressFinalize # Category : Usage @@ -653,6 +656,7 @@ dotnet_diagnostic.CA1816.severity = none # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1819 dotnet_diagnostic.CA1819.severity = warning +dotnet_code_quality.CA1819.api_surface = public # Title : Test for empty strings using string length # Category : Performance @@ -668,6 +672,7 @@ dotnet_diagnostic.CA1821.severity = none # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1822 dotnet_diagnostic.CA1822.severity = warning +dotnet_code_quality.CA1822.api_surface = all # Title : Avoid unused private fields # Category : Performance @@ -797,7 +802,7 @@ dotnet_diagnostic.CA1847.severity = none # Title : Use the LoggerMessage delegates # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1848 -# Comment : Use the code generated model instead. +# Comment : Use R9 logging model instead dotnet_diagnostic.CA1848.severity = none # Title : Call async methods when in an async method @@ -818,7 +823,8 @@ dotnet_diagnostic.CA1851.severity = suggestion # Title : Seal internal types # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1852 -dotnet_diagnostic.CA1852.severity = none +dotnet_diagnostic.CA1852.severity = warning +dotnet_code_quality.CA1852.ignore_internalsvisibleto = true # Title : Unnecessary call to 'Dictionary.ContainsKey(key)' # Category : Performance @@ -848,7 +854,7 @@ dotnet_diagnostic.CA1857.severity = warning # Title : Use 'StartsWith' instead of 'IndexOf' # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1858 -dotnet_diagnostic.CA1858.severity = warning +dotnet_diagnostic.CA1858.severity = suggestion # Title : Use concrete types when possible for improved performance # Category : Performance @@ -858,7 +864,7 @@ dotnet_diagnostic.CA1859.severity = warning # Title : Avoid using 'Enumerable.Any()' extension method # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1860 -dotnet_diagnostic.CA1860.severity = warning +dotnet_diagnostic.CA1860.severity = suggestion # Title : Avoid constant arrays as arguments # Category : Performance @@ -868,17 +874,17 @@ dotnet_diagnostic.CA1861.severity = suggestion # Title : Use the 'StringComparison' method overloads to perform case-insensitive string comparisons # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1862 -dotnet_diagnostic.CA1862.severity = warning +dotnet_diagnostic.CA1862.severity = suggestion # Title : Use 'CompositeFormat' # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1863 -dotnet_diagnostic.CA1863.severity = warning +dotnet_diagnostic.CA1863.severity = none # Title : Prefer the 'IDictionary.TryAdd(TKey, TValue)' method # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1864 -dotnet_diagnostic.CA1864.severity = warning +dotnet_diagnostic.CA1864.severity = suggestion # Title : Use char overload # Category : Performance @@ -898,17 +904,17 @@ dotnet_diagnostic.CA1867.severity = warning # Title : Unnecessary call to 'Contains(item)' # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1868 -dotnet_diagnostic.CA1868.severity = warning +dotnet_diagnostic.CA1868.severity = suggestion # Title : Cache and reuse 'JsonSerializerOptions' instances # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1869 -dotnet_diagnostic.CA1869.severity = warning +dotnet_diagnostic.CA1869.severity = suggestion # Title : Use a cached 'SearchValues' instance # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1870 -dotnet_diagnostic.CA1870.severity = warning +dotnet_diagnostic.CA1870.severity = suggestion # Title : Dispose objects before losing scope # Category : Reliability @@ -924,6 +930,8 @@ dotnet_diagnostic.CA2002.severity = warning # Category : Reliability # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2007 dotnet_diagnostic.CA2007.severity = warning +dotnet_code_quality.CA2007.output_kinds = all +dotnet_code_quality.CA2007.exclude_async_void_methods = false # Title : Do not create tasks without passing a TaskScheduler # Category : Reliability @@ -1045,6 +1053,7 @@ dotnet_diagnostic.CA2207.severity = warning # Category : Usage # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2208 dotnet_diagnostic.CA2208.severity = warning +dotnet_code_quality.CA2208.api_surface = all # Title : Non-constant fields should not be visible # Category : Usage @@ -1128,6 +1137,7 @@ dotnet_diagnostic.CA2237.severity = none # Category : Usage # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2241 dotnet_diagnostic.CA2241.severity = warning +dotnet_code_quality.CA2241.try_determine_additional_string_formatting_methods_automatically = false # Title : Test for NaN correctly # Category : Usage @@ -2118,7 +2128,7 @@ dotnet_diagnostic.S103.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-104 dotnet_diagnostic.S104.severity = warning -# Title : Destructors should not throw exceptions +# Title : Finalizers should not throw exceptions # Category : Blocker Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1048 # Redundant: CA1065 @@ -2193,7 +2203,7 @@ dotnet_diagnostic.S1110.severity = none # Redundant: SA1106 dotnet_diagnostic.S1116.severity = none -# Title : Local variables should not shadow class fields +# Title : Local variables should not shadow class fields or properties # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1117 dotnet_diagnostic.S1117.severity = warning @@ -2236,6 +2246,11 @@ dotnet_diagnostic.S1128.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-113 dotnet_diagnostic.S113.severity = none +# Title : Deprecated code should be removed +# Category : Info Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-1133 +dotnet_diagnostic.S1133.severity = suggestion + # Title : Track uses of "FIXME" tags # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1134 @@ -2307,7 +2322,7 @@ dotnet_diagnostic.S1192.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1199 dotnet_diagnostic.S1199.severity = none -# Title : Classes should not be coupled to too many other classes (Single Responsibility Principle) +# Title : Classes should not be coupled to too many other classes # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1200 dotnet_diagnostic.S1200.severity = none @@ -2488,7 +2503,7 @@ dotnet_diagnostic.S1699.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1751 dotnet_diagnostic.S1751.severity = warning -# Title : Identical expressions should not be used on both sides of a binary operator +# Title : Identical expressions should not be used on both sides of operators # Category : Major Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1764 dotnet_diagnostic.S1764.severity = warning @@ -2540,7 +2555,7 @@ dotnet_diagnostic.S1939.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1940 dotnet_diagnostic.S1940.severity = warning -# Title : Inappropriate casts should not be made +# Title : Invalid casts should be avoided # Category : Critical Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1944 dotnet_diagnostic.S1944.severity = warning @@ -2577,6 +2592,11 @@ dotnet_diagnostic.S2077.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2092 dotnet_diagnostic.S2092.severity = warning +# Title : Classes should not be empty +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2094 +dotnet_diagnostic.S2094.severity = none + # Title : Collections should not be passed as arguments to their own methods # Category : Major Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2114 @@ -2602,6 +2622,11 @@ dotnet_diagnostic.S2148.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2156 dotnet_diagnostic.S2156.severity = warning +# Title : Classes named like "Exception" should extend "Exception" or a subclass +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2166 +dotnet_diagnostic.S2166.severity = warning + # Title : Short-circuit logic should be used in boolean contexts # Category : Blocker Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2178 @@ -2617,12 +2642,12 @@ dotnet_diagnostic.S2183.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2184 dotnet_diagnostic.S2184.severity = warning -# Title : TestCases should contain tests +# Title : Test classes should contain at least one test case # Category : Blocker Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2187 dotnet_diagnostic.S2187.severity = warning -# Title : Recursion should not be infinite +# Title : Loops and recursions should not be infinite # Category : Blocker Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2190 dotnet_diagnostic.S2190.severity = warning @@ -2632,7 +2657,12 @@ dotnet_diagnostic.S2190.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2197 dotnet_diagnostic.S2197.severity = warning -# Title : Return values from functions without side effects should not be ignored +# Title : Unnecessary mathematical comparisons should not be made +# Category : Critical Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2198 +dotnet_diagnostic.S2198.severity = warning + +# Title : Methods without side effects should not have their return values ignored # Category : Major Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2201 # Redundant: CA1806 @@ -2668,7 +2698,7 @@ dotnet_diagnostic.S2225.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2228 dotnet_diagnostic.S2228.severity = none -# Title : Parameters should be passed in the correct order +# Title : Arguments should be passed in the same order as the method parameters # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2234 dotnet_diagnostic.S2234.severity = warning @@ -2843,11 +2873,17 @@ dotnet_diagnostic.S2387.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2436 dotnet_diagnostic.S2436.severity = none -# Title : Silly bit operations should not be performed +# Title : Unnecessary bit operations should not be performed # Category : Blocker Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2437 dotnet_diagnostic.S2437.severity = warning +# Title : Blocks should be synchronized on read-only fields +# Category : Major Bug +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2445 +# Comment : Noise +dotnet_diagnostic.S2445.severity = none + # Title : Whitespace and control characters in string literals should be explicit # Category : Critical Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2479 @@ -2861,8 +2897,7 @@ dotnet_diagnostic.S2486.severity = warning # Title : Shared resources should not be used for locking # Category : Critical Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2551 -# Redundant: CA2002 -dotnet_diagnostic.S2551.severity = none +dotnet_diagnostic.S2551.severity = warning # Title : Conditionally executed code should be reachable # Category : Major Bug @@ -2873,7 +2908,8 @@ dotnet_diagnostic.S2583.severity = none # Title : Boolean expressions should not be gratuitous # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2589 -dotnet_diagnostic.S2589.severity = warning +# Comment : Too many false positives. +dotnet_diagnostic.S2589.severity = none # Title : Setting loose file permissions is security-sensitive # Category : Major Security Hotspot @@ -2930,7 +2966,7 @@ dotnet_diagnostic.S2743.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2755 dotnet_diagnostic.S2755.severity = warning -# Title : "=+" should not be used instead of "+=" +# Title : Non-existent operators like "=+" should not be used # Category : Major Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2757 dotnet_diagnostic.S2757.severity = warning @@ -2955,6 +2991,11 @@ dotnet_diagnostic.S2761.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2857 dotnet_diagnostic.S2857.severity = warning +# Title : "Thread.Sleep" should not be used in tests +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2925 +dotnet_diagnostic.S2925.severity = none + # Title : "IDisposables" should be disposed # Category : Blocker Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2930 @@ -2993,6 +3034,11 @@ dotnet_diagnostic.S2953.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2955 dotnet_diagnostic.S2955.severity = warning +# Title : Assertions should be complete +# Category : Blocker Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2970 +dotnet_diagnostic.S2970.severity = warning + # Title : "IEnumerable" LINQs should be simplified # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2971 @@ -3043,6 +3089,11 @@ dotnet_diagnostic.S3059.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3060 dotnet_diagnostic.S3060.severity = warning +# Title : "StringBuilder" data should be used +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-3063 +dotnet_diagnostic.S3063.severity = warning + # Title : "async" methods should not return "void" # Category : Major Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3168 @@ -3100,7 +3151,7 @@ dotnet_diagnostic.S3235.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3236 dotnet_diagnostic.S3236.severity = none -# Title : "value" parameters should be used +# Title : "value" contextual keyword should be used # Category : Blocker Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3237 dotnet_diagnostic.S3237.severity = warning @@ -3169,7 +3220,7 @@ dotnet_diagnostic.S3257.severity = none # Title : Non-derived "private" classes and records should be "sealed" # Category : Minor Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3260 -# Redundant: CA1852 +# Redundant: R9A013 dotnet_diagnostic.S3260.severity = none # Title : Namespaces should not be empty @@ -3233,6 +3284,11 @@ dotnet_diagnostic.S3353.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3358 dotnet_diagnostic.S3358.severity = warning +# Title : Date and time should not be used as a type for primary keys +# Category : Minor Bug +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-3363 +dotnet_diagnostic.S3363.severity = warning + # Title : "this" should not be exposed from constructors # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3366 @@ -3249,6 +3305,11 @@ dotnet_diagnostic.S3376.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3397 dotnet_diagnostic.S3397.severity = warning +# Title : "private" methods called only by inner classes should be moved to those classes +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-3398 +dotnet_diagnostic.S3398.severity = warning + # Title : Methods should not return constants # Category : Minor Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3400 @@ -3259,7 +3320,7 @@ dotnet_diagnostic.S3400.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3415 dotnet_diagnostic.S3415.severity = warning -# Title : Method overloads with default parameter values should not overlap +# Title : Method overloads with default parameter values should not overlap # Category : Blocker Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3427 dotnet_diagnostic.S3427.severity = warning @@ -3457,6 +3518,11 @@ dotnet_diagnostic.S3876.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3877 dotnet_diagnostic.S3877.severity = warning +# Title : Arrays should not be created for params parameters +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-3878 +dotnet_diagnostic.S3878.severity = suggestion + # Title : Finalizers should not be empty # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3880 @@ -3482,7 +3548,7 @@ dotnet_diagnostic.S3885.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3887 dotnet_diagnostic.S3887.severity = warning -# Title : Neither "Thread.Resume" nor "Thread.Suspend" should be used +# Title : "Thread.Resume" and "Thread.Suspend" should not be used # Category : Blocker Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3889 dotnet_diagnostic.S3889.severity = warning @@ -3856,7 +3922,8 @@ dotnet_diagnostic.S4144.severity = warning # Title : Empty collections should not be accessed or iterated # Category : Minor Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4158 -dotnet_diagnostic.S4158.severity = warning +# Comment : Too many false positives +dotnet_diagnostic.S4158.severity = none # Title : Classes should implement their "ExportAttribute" interfaces # Category : Blocker Bug @@ -3990,6 +4057,11 @@ dotnet_diagnostic.S4507.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4524 dotnet_diagnostic.S4524.severity = warning +# Title : "DebuggerDisplayAttribute" strings should reference existing members +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-4545 +dotnet_diagnostic.S4545.severity = warning + # Title : ASP.NET HTTP request validation feature should not be disabled # Category : Major Vulnerability # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4564 @@ -4010,11 +4082,16 @@ dotnet_diagnostic.S4583.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4586 dotnet_diagnostic.S4586.severity = warning -# Title : String offset-based methods should be preferred for finding substrings from offsets +# Title : Start index should be used instead of calling Substring # Category : Critical Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4635 dotnet_diagnostic.S4635.severity = warning +# Title : Comments should not be empty +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-4663 +dotnet_diagnostic.S4663.severity = none + # Title : Using regular expressions is security-sensitive # Category : Critical Security Hotspot # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4784 @@ -4126,10 +4203,15 @@ dotnet_diagnostic.S5766.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-5773 dotnet_diagnostic.S5773.severity = warning +# Title : Regular expressions should be syntactically valid +# Category : Critical Bug +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-5856 +dotnet_diagnostic.S5856.severity = warning + # Title : Use a testable date/time provider # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-6354 -# Redundant: EA0002 +# Redundant: R9A022 dotnet_diagnostic.S6354.severity = none # Title : Azure Functions should be stateless @@ -4167,6 +4249,119 @@ dotnet_diagnostic.S6424.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-6444 dotnet_diagnostic.S6444.severity = warning +# Title : Blocks should not be synchronized on local variables +# Category : Major Bug +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6507 +# Comment : Too many false positives +dotnet_diagnostic.S6507.severity = none + +# Title : "ExcludeFromCodeCoverage" attributes should include a justification +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6513 +dotnet_diagnostic.S6513.severity = suggestion + +# Title : Avoid using "DateTime.Now" for benchmarking or timing operations +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6561 +dotnet_diagnostic.S6561.severity = warning + +# Title : Always set the "DateTimeKind" when creating new "DateTime" instances +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6562 +# Comment : Noise +dotnet_diagnostic.S6562.severity = none + +# Title : Use UTC when recording DateTime instants +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6563 +dotnet_diagnostic.S6563.severity = none + +# Title : Use "DateTimeOffset" instead of "DateTime" +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6566 +# Comment : Noise +dotnet_diagnostic.S6566.severity = none + +# Title : Use "TimeZoneInfo.FindSystemTimeZoneById" without converting the timezones with "TimezoneConverter" +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6575 +dotnet_diagnostic.S6575.severity = warning + +# Title : Use a format provider when parsing date and time +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6580 +dotnet_diagnostic.S6580.severity = warning + +# Title : Don't hardcode the format when turning dates and times to strings +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6585 +dotnet_diagnostic.S6585.severity = none + +# Title : Use the "UnixEpoch" field instead of creating "DateTime" instances that point to the beginning of the Unix epoch +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6588 +dotnet_diagnostic.S6588.severity = warning + +# Title : "Find" method should be used instead of the "FirstOrDefault" extension +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6602 +dotnet_diagnostic.S6602.severity = warning + +# Title : The collection-specific "TrueForAll" method should be used instead of the "All" extension +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6603 +dotnet_diagnostic.S6603.severity = warning + +# Title : Collection-specific "Exists" method should be used instead of the "Any" extension +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6605 +dotnet_diagnostic.S6605.severity = warning + +# Title : The collection should be filtered before sorting by using "Where" before "OrderBy" +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6607 +dotnet_diagnostic.S6607.severity = warning + +# Title : Prefer indexing instead of "Enumerable" methods on types implementing "IList" +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6608 +dotnet_diagnostic.S6608.severity = warning + +# Title : "Min/Max" properties of "Set" types should be used instead of the "Enumerable" extension methods +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6609 +dotnet_diagnostic.S6609.severity = warning + +# Title : "StartsWith" and "EndsWith" overloads that take a "char" should be used instead of the ones that take a "string" +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6610 +dotnet_diagnostic.S6610.severity = warning + +# Title : The lambda parameter should be used instead of capturing arguments in "ConcurrentDictionary" methods +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6612 +dotnet_diagnostic.S6612.severity = warning + +# Title : "First" and "Last" properties of "LinkedList" should be used instead of the "First()" and "Last()" extension methods +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6613 +dotnet_diagnostic.S6613.severity = warning + +# Title : "Contains" should be used instead of "Any" for simple equality checks +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6617 +dotnet_diagnostic.S6617.severity = warning + +# Title : "string.Create" should be used instead of "FormattableString" +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6618 +dotnet_diagnostic.S6618.severity = warning + +# Title : Using unsafe code blocks is security-sensitive +# Category : Major Security Hotspot +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6640 +dotnet_diagnostic.S6640.severity = warning + # Title : Literal suffixes should be upper case # Category : Minor Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-818 @@ -4212,6 +4407,10 @@ dotnet_diagnostic.S9999-symbolRef.severity = warning # Category : dotnet_diagnostic.S9999-token-type.severity = warning +# Title : Analysis Warning generator +# Category : +dotnet_diagnostic.S9999-warning.severity = warning + # Title : Avoid legacy thread switching APIs # Category : Usage # Help Link: https://github.com/Microsoft/vs-threading/blob/main/doc/analyzers/VSTHRD001.md @@ -4265,7 +4464,8 @@ dotnet_diagnostic.VSTHRD102.severity = suggestion # Title : Call async methods when in an async method # Category : Usage # Help Link: https://github.com/Microsoft/vs-threading/blob/main/doc/analyzers/VSTHRD103.md -dotnet_diagnostic.VSTHRD103.severity = warning +# Redundant: CA1849 +dotnet_diagnostic.VSTHRD103.severity = none # Title : Offer async methods # Category : Usage diff --git a/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/ProdLib.globalconfig b/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/ProdLib.globalconfig index 233c544c10b..76bfc906640 100644 --- a/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/ProdLib.globalconfig +++ b/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/ProdLib.globalconfig @@ -1,5 +1,5 @@ # Created by DiagConfig, the diagnostic config generator -# Generated : 2023-10-22 00:37:57Z +# Generated : 2024-01-25 20:57:54Z # Max Tier : 3 # Attributes: api, general, performance, production # Analyzers : ILLink.RoslynAnalyzer, Microsoft.Analyzers.Extra, Microsoft.Analyzers.Local, Microsoft.AspNetCore.App.Analyzers, Microsoft.AspNetCore.Components.Analyzers, Microsoft.CodeAnalysis.CSharp.NetAnalyzers, Microsoft.CodeAnalysis.NetAnalyzers, Microsoft.VisualStudio.Threading.Analyzers, Microsoft.VisualStudio.Threading.Analyzers.CSharp, SonarAnalyzer.CSharp @@ -109,7 +109,7 @@ dotnet_diagnostic.CA1001.severity = warning # Title : Types that own disposable fields should be disposable # Category : Design # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1001 -dotnet_diagnostic.CA1001.severity = warning +dotnet_diagnostic.CA1001.severity = none # Title : Do not expose generic lists # Category : Design @@ -204,6 +204,7 @@ dotnet_diagnostic.CA1028.severity = none # Category : Design # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1030 dotnet_diagnostic.CA1030.severity = warning +dotnet_code_quality.CA1030.api_surface = public # Title : Do not catch general exception types # Category : Design @@ -229,6 +230,7 @@ dotnet_diagnostic.CA1034.severity = warning # Category : Design # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1036 dotnet_diagnostic.CA1036.severity = warning +dotnet_code_quality.CA1036.api_surface = all # Title : Avoid empty interfaces # Category : Design @@ -287,21 +289,25 @@ dotnet_code_quality.CA1051.api_surface = public # Category : Design # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1052 dotnet_diagnostic.CA1052.severity = warning +dotnet_code_quality.CA1052.api_surface = all # Title : URI-like parameters should not be strings # Category : Design # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1054 dotnet_diagnostic.CA1054.severity = warning +dotnet_code_quality.CA1054.api_surface = public # Title : URI-like return values should not be strings # Category : Design # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1055 dotnet_diagnostic.CA1055.severity = warning +dotnet_code_quality.CA1055.api_surface = public # Title : URI-like properties should not be strings # Category : Design # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1056 dotnet_diagnostic.CA1056.severity = warning +dotnet_code_quality.CA1056.api_surface = public # Title : Types should not extend certain base types # Category : Design @@ -332,6 +338,7 @@ dotnet_code_quality.CA1062.null_check_validation_methods = IfNull|IfNullOrEmpty| # Category : Design # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1063 dotnet_diagnostic.CA1063.severity = warning +dotnet_code_quality.CA1063.api_surface = public # Title : Exceptions should be public # Category : Design @@ -598,6 +605,7 @@ dotnet_code_quality.CA1724.api_surface = public # Category : Naming # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1725 dotnet_diagnostic.CA1725.severity = warning +dotnet_code_quality.CA1725.api_surface = public, protected # Title : Use PascalCase for named placeholders # Category : Naming @@ -620,6 +628,7 @@ dotnet_diagnostic.CA1801.severity = none # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1802 dotnet_diagnostic.CA1802.severity = warning +dotnet_code_quality.CA1802.required_modifiers = static # Title : Use literals where appropriate # Category : Performance @@ -667,6 +676,7 @@ dotnet_diagnostic.CA1814.severity = warning # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1815 dotnet_diagnostic.CA1815.severity = warning +dotnet_code_quality.CA1815.api_surface = public # Title : Dispose methods should call SuppressFinalize # Category : Usage @@ -677,6 +687,7 @@ dotnet_diagnostic.CA1816.severity = warning # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1819 dotnet_diagnostic.CA1819.severity = warning +dotnet_code_quality.CA1819.api_surface = public # Title : Test for empty strings using string length # Category : Performance @@ -692,6 +703,7 @@ dotnet_diagnostic.CA1821.severity = warning # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1822 dotnet_diagnostic.CA1822.severity = warning +dotnet_code_quality.CA1822.api_surface = all # Title : Avoid unused private fields # Category : Performance @@ -821,7 +833,7 @@ dotnet_diagnostic.CA1847.severity = warning # Title : Use the LoggerMessage delegates # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1848 -# Comment : Use the code generated model instead. +# Comment : Use R9 logging model instead dotnet_diagnostic.CA1848.severity = none # Title : Call async methods when in an async method @@ -842,7 +854,8 @@ dotnet_diagnostic.CA1851.severity = suggestion # Title : Seal internal types # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1852 -dotnet_diagnostic.CA1852.severity = none +dotnet_diagnostic.CA1852.severity = warning +dotnet_code_quality.CA1852.ignore_internalsvisibleto = true # Title : Unnecessary call to 'Dictionary.ContainsKey(key)' # Category : Performance @@ -872,7 +885,7 @@ dotnet_diagnostic.CA1857.severity = warning # Title : Use 'StartsWith' instead of 'IndexOf' # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1858 -dotnet_diagnostic.CA1858.severity = warning +dotnet_diagnostic.CA1858.severity = suggestion # Title : Use concrete types when possible for improved performance # Category : Performance @@ -882,7 +895,7 @@ dotnet_diagnostic.CA1859.severity = warning # Title : Avoid using 'Enumerable.Any()' extension method # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1860 -dotnet_diagnostic.CA1860.severity = warning +dotnet_diagnostic.CA1860.severity = suggestion # Title : Avoid constant arrays as arguments # Category : Performance @@ -892,17 +905,17 @@ dotnet_diagnostic.CA1861.severity = suggestion # Title : Use the 'StringComparison' method overloads to perform case-insensitive string comparisons # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1862 -dotnet_diagnostic.CA1862.severity = warning +dotnet_diagnostic.CA1862.severity = suggestion # Title : Use 'CompositeFormat' # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1863 -dotnet_diagnostic.CA1863.severity = warning +dotnet_diagnostic.CA1863.severity = none # Title : Prefer the 'IDictionary.TryAdd(TKey, TValue)' method # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1864 -dotnet_diagnostic.CA1864.severity = warning +dotnet_diagnostic.CA1864.severity = suggestion # Title : Use char overload # Category : Performance @@ -922,17 +935,17 @@ dotnet_diagnostic.CA1867.severity = warning # Title : Unnecessary call to 'Contains(item)' # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1868 -dotnet_diagnostic.CA1868.severity = warning +dotnet_diagnostic.CA1868.severity = suggestion # Title : Cache and reuse 'JsonSerializerOptions' instances # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1869 -dotnet_diagnostic.CA1869.severity = warning +dotnet_diagnostic.CA1869.severity = suggestion # Title : Use a cached 'SearchValues' instance # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1870 -dotnet_diagnostic.CA1870.severity = warning +dotnet_diagnostic.CA1870.severity = suggestion # Title : Dispose objects before losing scope # Category : Reliability @@ -948,6 +961,8 @@ dotnet_diagnostic.CA2002.severity = warning # Category : Reliability # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2007 dotnet_diagnostic.CA2007.severity = warning +dotnet_code_quality.CA2007.output_kinds = all +dotnet_code_quality.CA2007.exclude_async_void_methods = false # Title : Do not create tasks without passing a TaskScheduler # Category : Reliability @@ -1069,6 +1084,7 @@ dotnet_diagnostic.CA2207.severity = warning # Category : Usage # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2208 dotnet_diagnostic.CA2208.severity = warning +dotnet_code_quality.CA2208.api_surface = all # Title : Non-constant fields should not be visible # Category : Usage @@ -1133,11 +1149,13 @@ dotnet_diagnostic.CA2229.severity = none # Category : Usage # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2231 dotnet_diagnostic.CA2231.severity = error +dotnet_code_quality.CA2231.api_surface = public # Title : Pass system uri objects instead of strings # Category : Usage # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2234 dotnet_diagnostic.CA2234.severity = warning +dotnet_code_quality.CA2234.api_surface = all # Title : Mark all non-serializable fields # Category : Usage @@ -1155,6 +1173,7 @@ dotnet_diagnostic.CA2237.severity = none # Category : Usage # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2241 dotnet_diagnostic.CA2241.severity = warning +dotnet_code_quality.CA2241.try_determine_additional_string_formatting_methods_automatically = false # Title : Test for NaN correctly # Category : Usage @@ -2147,7 +2166,7 @@ dotnet_diagnostic.S103.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-104 dotnet_diagnostic.S104.severity = warning -# Title : Destructors should not throw exceptions +# Title : Finalizers should not throw exceptions # Category : Blocker Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1048 # Redundant: CA1065 @@ -2223,7 +2242,7 @@ dotnet_diagnostic.S1110.severity = none # Redundant: SA1106 dotnet_diagnostic.S1116.severity = none -# Title : Local variables should not shadow class fields +# Title : Local variables should not shadow class fields or properties # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1117 dotnet_diagnostic.S1117.severity = warning @@ -2266,6 +2285,11 @@ dotnet_diagnostic.S1128.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-113 dotnet_diagnostic.S113.severity = none +# Title : Deprecated code should be removed +# Category : Info Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-1133 +dotnet_diagnostic.S1133.severity = suggestion + # Title : Track uses of "FIXME" tags # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1134 @@ -2338,7 +2362,7 @@ dotnet_diagnostic.S1192.severity = suggestion # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1199 dotnet_diagnostic.S1199.severity = warning -# Title : Classes should not be coupled to too many other classes (Single Responsibility Principle) +# Title : Classes should not be coupled to too many other classes # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1200 dotnet_diagnostic.S1200.severity = none @@ -2519,7 +2543,7 @@ dotnet_diagnostic.S1699.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1751 dotnet_diagnostic.S1751.severity = warning -# Title : Identical expressions should not be used on both sides of a binary operator +# Title : Identical expressions should not be used on both sides of operators # Category : Major Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1764 dotnet_diagnostic.S1764.severity = warning @@ -2571,7 +2595,7 @@ dotnet_diagnostic.S1939.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1940 dotnet_diagnostic.S1940.severity = warning -# Title : Inappropriate casts should not be made +# Title : Invalid casts should be avoided # Category : Critical Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1944 dotnet_diagnostic.S1944.severity = warning @@ -2608,6 +2632,11 @@ dotnet_diagnostic.S2077.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2092 dotnet_diagnostic.S2092.severity = warning +# Title : Classes should not be empty +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2094 +dotnet_diagnostic.S2094.severity = none + # Title : Collections should not be passed as arguments to their own methods # Category : Major Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2114 @@ -2633,6 +2662,11 @@ dotnet_diagnostic.S2148.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2156 dotnet_diagnostic.S2156.severity = warning +# Title : Classes named like "Exception" should extend "Exception" or a subclass +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2166 +dotnet_diagnostic.S2166.severity = warning + # Title : Short-circuit logic should be used in boolean contexts # Category : Blocker Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2178 @@ -2648,12 +2682,12 @@ dotnet_diagnostic.S2183.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2184 dotnet_diagnostic.S2184.severity = warning -# Title : TestCases should contain tests +# Title : Test classes should contain at least one test case # Category : Blocker Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2187 dotnet_diagnostic.S2187.severity = warning -# Title : Recursion should not be infinite +# Title : Loops and recursions should not be infinite # Category : Blocker Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2190 dotnet_diagnostic.S2190.severity = warning @@ -2663,7 +2697,12 @@ dotnet_diagnostic.S2190.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2197 dotnet_diagnostic.S2197.severity = warning -# Title : Return values from functions without side effects should not be ignored +# Title : Unnecessary mathematical comparisons should not be made +# Category : Critical Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2198 +dotnet_diagnostic.S2198.severity = warning + +# Title : Methods without side effects should not have their return values ignored # Category : Major Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2201 # Redundant: CA1806 @@ -2699,7 +2738,7 @@ dotnet_diagnostic.S2225.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2228 dotnet_diagnostic.S2228.severity = warning -# Title : Parameters should be passed in the correct order +# Title : Arguments should be passed in the same order as the method parameters # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2234 dotnet_diagnostic.S2234.severity = warning @@ -2876,11 +2915,17 @@ dotnet_diagnostic.S2387.severity = warning # Redundant: CA1005 dotnet_diagnostic.S2436.severity = none -# Title : Silly bit operations should not be performed +# Title : Unnecessary bit operations should not be performed # Category : Blocker Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2437 dotnet_diagnostic.S2437.severity = warning +# Title : Blocks should be synchronized on read-only fields +# Category : Major Bug +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2445 +# Comment : Noise +dotnet_diagnostic.S2445.severity = none + # Title : Whitespace and control characters in string literals should be explicit # Category : Critical Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2479 @@ -2894,8 +2939,7 @@ dotnet_diagnostic.S2486.severity = warning # Title : Shared resources should not be used for locking # Category : Critical Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2551 -# Redundant: CA2002 -dotnet_diagnostic.S2551.severity = none +dotnet_diagnostic.S2551.severity = warning # Title : Conditionally executed code should be reachable # Category : Major Bug @@ -2906,7 +2950,8 @@ dotnet_diagnostic.S2583.severity = none # Title : Boolean expressions should not be gratuitous # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2589 -dotnet_diagnostic.S2589.severity = warning +# Comment : Too many false positives. +dotnet_diagnostic.S2589.severity = none # Title : Setting loose file permissions is security-sensitive # Category : Major Security Hotspot @@ -2963,7 +3008,7 @@ dotnet_diagnostic.S2743.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2755 dotnet_diagnostic.S2755.severity = warning -# Title : "=+" should not be used instead of "+=" +# Title : Non-existent operators like "=+" should not be used # Category : Major Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2757 dotnet_diagnostic.S2757.severity = warning @@ -2988,6 +3033,11 @@ dotnet_diagnostic.S2761.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2857 dotnet_diagnostic.S2857.severity = warning +# Title : "Thread.Sleep" should not be used in tests +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2925 +dotnet_diagnostic.S2925.severity = none + # Title : "IDisposables" should be disposed # Category : Blocker Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2930 @@ -3026,6 +3076,11 @@ dotnet_diagnostic.S2953.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2955 dotnet_diagnostic.S2955.severity = warning +# Title : Assertions should be complete +# Category : Blocker Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2970 +dotnet_diagnostic.S2970.severity = warning + # Title : "IEnumerable" LINQs should be simplified # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2971 @@ -3077,6 +3132,11 @@ dotnet_diagnostic.S3059.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3060 dotnet_diagnostic.S3060.severity = warning +# Title : "StringBuilder" data should be used +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-3063 +dotnet_diagnostic.S3063.severity = warning + # Title : "async" methods should not return "void" # Category : Major Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3168 @@ -3134,7 +3194,7 @@ dotnet_diagnostic.S3235.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3236 dotnet_diagnostic.S3236.severity = warning -# Title : "value" parameters should be used +# Title : "value" contextual keyword should be used # Category : Blocker Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3237 dotnet_diagnostic.S3237.severity = warning @@ -3199,12 +3259,13 @@ dotnet_diagnostic.S3256.severity = warning # Title : Declarations and initializations should be as concise as possible # Category : Minor Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3257 -dotnet_diagnostic.S3257.severity = warning +# Comment : Too many false positives +dotnet_diagnostic.S3257.severity = none # Title : Non-derived "private" classes and records should be "sealed" # Category : Minor Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3260 -# Redundant: CA1852 +# Redundant: R9A013 dotnet_diagnostic.S3260.severity = none # Title : Namespaces should not be empty @@ -3268,6 +3329,11 @@ dotnet_diagnostic.S3353.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3358 dotnet_diagnostic.S3358.severity = warning +# Title : Date and time should not be used as a type for primary keys +# Category : Minor Bug +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-3363 +dotnet_diagnostic.S3363.severity = warning + # Title : "this" should not be exposed from constructors # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3366 @@ -3284,6 +3350,11 @@ dotnet_diagnostic.S3376.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3397 dotnet_diagnostic.S3397.severity = warning +# Title : "private" methods called only by inner classes should be moved to those classes +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-3398 +dotnet_diagnostic.S3398.severity = warning + # Title : Methods should not return constants # Category : Minor Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3400 @@ -3294,7 +3365,7 @@ dotnet_diagnostic.S3400.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3415 dotnet_diagnostic.S3415.severity = warning -# Title : Method overloads with default parameter values should not overlap +# Title : Method overloads with default parameter values should not overlap # Category : Blocker Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3427 dotnet_diagnostic.S3427.severity = warning @@ -3492,6 +3563,11 @@ dotnet_diagnostic.S3876.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3877 dotnet_diagnostic.S3877.severity = warning +# Title : Arrays should not be created for params parameters +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-3878 +dotnet_diagnostic.S3878.severity = suggestion + # Title : Finalizers should not be empty # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3880 @@ -3517,7 +3593,7 @@ dotnet_diagnostic.S3885.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3887 dotnet_diagnostic.S3887.severity = warning -# Title : Neither "Thread.Resume" nor "Thread.Suspend" should be used +# Title : "Thread.Resume" and "Thread.Suspend" should not be used # Category : Blocker Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3889 dotnet_diagnostic.S3889.severity = warning @@ -3757,7 +3833,7 @@ dotnet_diagnostic.S4022.severity = warning # Title : Interfaces should not be empty # Category : Minor Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4023 -dotnet_diagnostic.S4023.severity = warning +dotnet_diagnostic.S4023.severity = suggestion # Title : Child class fields should not differ from parent class fields only by capitalization # Category : Critical Code Smell @@ -3895,7 +3971,8 @@ dotnet_diagnostic.S4144.severity = warning # Title : Empty collections should not be accessed or iterated # Category : Minor Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4158 -dotnet_diagnostic.S4158.severity = warning +# Comment : Too many false positives +dotnet_diagnostic.S4158.severity = none # Title : Classes should implement their "ExportAttribute" interfaces # Category : Blocker Bug @@ -4029,6 +4106,11 @@ dotnet_diagnostic.S4507.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4524 dotnet_diagnostic.S4524.severity = warning +# Title : "DebuggerDisplayAttribute" strings should reference existing members +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-4545 +dotnet_diagnostic.S4545.severity = warning + # Title : ASP.NET HTTP request validation feature should not be disabled # Category : Major Vulnerability # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4564 @@ -4049,11 +4131,16 @@ dotnet_diagnostic.S4583.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4586 dotnet_diagnostic.S4586.severity = warning -# Title : String offset-based methods should be preferred for finding substrings from offsets +# Title : Start index should be used instead of calling Substring # Category : Critical Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4635 dotnet_diagnostic.S4635.severity = warning +# Title : Comments should not be empty +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-4663 +dotnet_diagnostic.S4663.severity = suggestion + # Title : Using regular expressions is security-sensitive # Category : Critical Security Hotspot # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4784 @@ -4165,10 +4252,15 @@ dotnet_diagnostic.S5766.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-5773 dotnet_diagnostic.S5773.severity = warning +# Title : Regular expressions should be syntactically valid +# Category : Critical Bug +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-5856 +dotnet_diagnostic.S5856.severity = warning + # Title : Use a testable date/time provider # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-6354 -# Redundant: EA0002 +# Redundant: R9A022 dotnet_diagnostic.S6354.severity = none # Title : Azure Functions should be stateless @@ -4206,6 +4298,119 @@ dotnet_diagnostic.S6424.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-6444 dotnet_diagnostic.S6444.severity = warning +# Title : Blocks should not be synchronized on local variables +# Category : Major Bug +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6507 +# Comment : Too many false positives +dotnet_diagnostic.S6507.severity = none + +# Title : "ExcludeFromCodeCoverage" attributes should include a justification +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6513 +dotnet_diagnostic.S6513.severity = suggestion + +# Title : Avoid using "DateTime.Now" for benchmarking or timing operations +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6561 +dotnet_diagnostic.S6561.severity = warning + +# Title : Always set the "DateTimeKind" when creating new "DateTime" instances +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6562 +# Comment : Noise +dotnet_diagnostic.S6562.severity = none + +# Title : Use UTC when recording DateTime instants +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6563 +dotnet_diagnostic.S6563.severity = none + +# Title : Use "DateTimeOffset" instead of "DateTime" +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6566 +# Comment : Noise +dotnet_diagnostic.S6566.severity = none + +# Title : Use "TimeZoneInfo.FindSystemTimeZoneById" without converting the timezones with "TimezoneConverter" +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6575 +dotnet_diagnostic.S6575.severity = warning + +# Title : Use a format provider when parsing date and time +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6580 +dotnet_diagnostic.S6580.severity = warning + +# Title : Don't hardcode the format when turning dates and times to strings +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6585 +dotnet_diagnostic.S6585.severity = none + +# Title : Use the "UnixEpoch" field instead of creating "DateTime" instances that point to the beginning of the Unix epoch +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6588 +dotnet_diagnostic.S6588.severity = warning + +# Title : "Find" method should be used instead of the "FirstOrDefault" extension +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6602 +dotnet_diagnostic.S6602.severity = warning + +# Title : The collection-specific "TrueForAll" method should be used instead of the "All" extension +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6603 +dotnet_diagnostic.S6603.severity = warning + +# Title : Collection-specific "Exists" method should be used instead of the "Any" extension +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6605 +dotnet_diagnostic.S6605.severity = warning + +# Title : The collection should be filtered before sorting by using "Where" before "OrderBy" +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6607 +dotnet_diagnostic.S6607.severity = warning + +# Title : Prefer indexing instead of "Enumerable" methods on types implementing "IList" +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6608 +dotnet_diagnostic.S6608.severity = warning + +# Title : "Min/Max" properties of "Set" types should be used instead of the "Enumerable" extension methods +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6609 +dotnet_diagnostic.S6609.severity = warning + +# Title : "StartsWith" and "EndsWith" overloads that take a "char" should be used instead of the ones that take a "string" +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6610 +dotnet_diagnostic.S6610.severity = warning + +# Title : The lambda parameter should be used instead of capturing arguments in "ConcurrentDictionary" methods +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6612 +dotnet_diagnostic.S6612.severity = warning + +# Title : "First" and "Last" properties of "LinkedList" should be used instead of the "First()" and "Last()" extension methods +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6613 +dotnet_diagnostic.S6613.severity = warning + +# Title : "Contains" should be used instead of "Any" for simple equality checks +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6617 +dotnet_diagnostic.S6617.severity = warning + +# Title : "string.Create" should be used instead of "FormattableString" +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6618 +dotnet_diagnostic.S6618.severity = warning + +# Title : Using unsafe code blocks is security-sensitive +# Category : Major Security Hotspot +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6640 +dotnet_diagnostic.S6640.severity = warning + # Title : Literal suffixes should be upper case # Category : Minor Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-818 @@ -4251,6 +4456,10 @@ dotnet_diagnostic.S9999-symbolRef.severity = warning # Category : dotnet_diagnostic.S9999-token-type.severity = warning +# Title : Analysis Warning generator +# Category : +dotnet_diagnostic.S9999-warning.severity = warning + # Title : Avoid legacy thread switching APIs # Category : Usage # Help Link: https://github.com/Microsoft/vs-threading/blob/main/doc/analyzers/VSTHRD001.md @@ -4304,7 +4513,8 @@ dotnet_diagnostic.VSTHRD102.severity = suggestion # Title : Call async methods when in an async method # Category : Usage # Help Link: https://github.com/Microsoft/vs-threading/blob/main/doc/analyzers/VSTHRD103.md -dotnet_diagnostic.VSTHRD103.severity = warning +# Redundant: CA1849 +dotnet_diagnostic.VSTHRD103.severity = none # Title : Offer async methods # Category : Usage diff --git a/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/Test-Tier1.globalconfig b/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/Test-Tier1.globalconfig index 0f48469ea6a..5416bca2801 100644 --- a/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/Test-Tier1.globalconfig +++ b/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/Test-Tier1.globalconfig @@ -1,5 +1,5 @@ # Created by DiagConfig, the diagnostic config generator -# Generated : 2023-10-22 00:37:52Z +# Generated : 2024-01-25 20:57:49Z # Max Tier : 1 # Attributes: general, test # Analyzers : ILLink.RoslynAnalyzer, Microsoft.Analyzers.Extra, Microsoft.Analyzers.Local, Microsoft.AspNetCore.App.Analyzers, Microsoft.AspNetCore.Components.Analyzers, Microsoft.CodeAnalysis.CSharp.NetAnalyzers, Microsoft.CodeAnalysis.NetAnalyzers, Microsoft.VisualStudio.Threading.Analyzers, Microsoft.VisualStudio.Threading.Analyzers.CSharp, SonarAnalyzer.CSharp, xunit.analyzers @@ -309,6 +309,7 @@ dotnet_diagnostic.CA1062.severity = none # Category : Design # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1063 dotnet_diagnostic.CA1063.severity = warning +dotnet_code_quality.CA1063.api_surface = public # Title : Exceptions should be public # Category : Design @@ -828,7 +829,7 @@ dotnet_diagnostic.CA1857.severity = warning # Title : Use 'StartsWith' instead of 'IndexOf' # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1858 -dotnet_diagnostic.CA1858.severity = none +dotnet_diagnostic.CA1858.severity = suggestion # Title : Use concrete types when possible for improved performance # Category : Performance @@ -838,7 +839,7 @@ dotnet_diagnostic.CA1859.severity = none # Title : Avoid using 'Enumerable.Any()' extension method # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1860 -dotnet_diagnostic.CA1860.severity = none +dotnet_diagnostic.CA1860.severity = suggestion # Title : Avoid constant arrays as arguments # Category : Performance @@ -848,7 +849,7 @@ dotnet_diagnostic.CA1861.severity = suggestion # Title : Use the 'StringComparison' method overloads to perform case-insensitive string comparisons # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1862 -dotnet_diagnostic.CA1862.severity = none +dotnet_diagnostic.CA1862.severity = suggestion # Title : Use 'CompositeFormat' # Category : Performance @@ -883,12 +884,12 @@ dotnet_diagnostic.CA1868.severity = suggestion # Title : Cache and reuse 'JsonSerializerOptions' instances # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1869 -dotnet_diagnostic.CA1869.severity = none +dotnet_diagnostic.CA1869.severity = suggestion # Title : Use a cached 'SearchValues' instance # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1870 -dotnet_diagnostic.CA1870.severity = none +dotnet_diagnostic.CA1870.severity = suggestion # Title : Dispose objects before losing scope # Category : Reliability @@ -1105,6 +1106,7 @@ dotnet_diagnostic.CA2237.severity = none # Category : Usage # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2241 dotnet_diagnostic.CA2241.severity = warning +dotnet_code_quality.CA2241.try_determine_additional_string_formatting_methods_automatically = false # Title : Test for NaN correctly # Category : Usage @@ -2095,7 +2097,7 @@ dotnet_diagnostic.S103.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-104 dotnet_diagnostic.S104.severity = none -# Title : Destructors should not throw exceptions +# Title : Finalizers should not throw exceptions # Category : Blocker Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1048 # Redundant: CA1065 @@ -2166,7 +2168,7 @@ dotnet_diagnostic.S1110.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1116 dotnet_diagnostic.S1116.severity = none -# Title : Local variables should not shadow class fields +# Title : Local variables should not shadow class fields or properties # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1117 dotnet_diagnostic.S1117.severity = warning @@ -2206,6 +2208,11 @@ dotnet_diagnostic.S1128.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-113 dotnet_diagnostic.S113.severity = none +# Title : Deprecated code should be removed +# Category : Info Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-1133 +dotnet_diagnostic.S1133.severity = suggestion + # Title : Track uses of "FIXME" tags # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1134 @@ -2277,7 +2284,7 @@ dotnet_diagnostic.S1192.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1199 dotnet_diagnostic.S1199.severity = none -# Title : Classes should not be coupled to too many other classes (Single Responsibility Principle) +# Title : Classes should not be coupled to too many other classes # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1200 dotnet_diagnostic.S1200.severity = none @@ -2454,7 +2461,7 @@ dotnet_diagnostic.S1699.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1751 dotnet_diagnostic.S1751.severity = warning -# Title : Identical expressions should not be used on both sides of a binary operator +# Title : Identical expressions should not be used on both sides of operators # Category : Major Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1764 dotnet_diagnostic.S1764.severity = warning @@ -2505,7 +2512,7 @@ dotnet_diagnostic.S1939.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1940 dotnet_diagnostic.S1940.severity = none -# Title : Inappropriate casts should not be made +# Title : Invalid casts should be avoided # Category : Critical Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1944 dotnet_diagnostic.S1944.severity = warning @@ -2542,6 +2549,11 @@ dotnet_diagnostic.S2077.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2092 dotnet_diagnostic.S2092.severity = none +# Title : Classes should not be empty +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2094 +dotnet_diagnostic.S2094.severity = none + # Title : Collections should not be passed as arguments to their own methods # Category : Major Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2114 @@ -2567,6 +2579,11 @@ dotnet_diagnostic.S2148.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2156 dotnet_diagnostic.S2156.severity = none +# Title : Classes named like "Exception" should extend "Exception" or a subclass +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2166 +dotnet_diagnostic.S2166.severity = warning + # Title : Short-circuit logic should be used in boolean contexts # Category : Blocker Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2178 @@ -2582,12 +2599,12 @@ dotnet_diagnostic.S2183.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2184 dotnet_diagnostic.S2184.severity = none -# Title : TestCases should contain tests +# Title : Test classes should contain at least one test case # Category : Blocker Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2187 dotnet_diagnostic.S2187.severity = none -# Title : Recursion should not be infinite +# Title : Loops and recursions should not be infinite # Category : Blocker Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2190 dotnet_diagnostic.S2190.severity = none @@ -2597,7 +2614,12 @@ dotnet_diagnostic.S2190.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2197 dotnet_diagnostic.S2197.severity = warning -# Title : Return values from functions without side effects should not be ignored +# Title : Unnecessary mathematical comparisons should not be made +# Category : Critical Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2198 +dotnet_diagnostic.S2198.severity = warning + +# Title : Methods without side effects should not have their return values ignored # Category : Major Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2201 # Redundant: CA1806 @@ -2633,7 +2655,7 @@ dotnet_diagnostic.S2225.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2228 dotnet_diagnostic.S2228.severity = none -# Title : Parameters should be passed in the correct order +# Title : Arguments should be passed in the same order as the method parameters # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2234 dotnet_diagnostic.S2234.severity = warning @@ -2807,11 +2829,17 @@ dotnet_diagnostic.S2387.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2436 dotnet_diagnostic.S2436.severity = none -# Title : Silly bit operations should not be performed +# Title : Unnecessary bit operations should not be performed # Category : Blocker Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2437 dotnet_diagnostic.S2437.severity = warning +# Title : Blocks should be synchronized on read-only fields +# Category : Major Bug +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2445 +# Comment : Noise +dotnet_diagnostic.S2445.severity = none + # Title : Whitespace and control characters in string literals should be explicit # Category : Critical Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2479 @@ -2825,8 +2853,7 @@ dotnet_diagnostic.S2486.severity = none # Title : Shared resources should not be used for locking # Category : Critical Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2551 -# Redundant: CA2002 -dotnet_diagnostic.S2551.severity = none +dotnet_diagnostic.S2551.severity = warning # Title : Conditionally executed code should be reachable # Category : Major Bug @@ -2837,7 +2864,8 @@ dotnet_diagnostic.S2583.severity = none # Title : Boolean expressions should not be gratuitous # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2589 -dotnet_diagnostic.S2589.severity = warning +# Comment : Too many false positives. +dotnet_diagnostic.S2589.severity = none # Title : Setting loose file permissions is security-sensitive # Category : Major Security Hotspot @@ -2894,7 +2922,7 @@ dotnet_diagnostic.S2743.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2755 dotnet_diagnostic.S2755.severity = warning -# Title : "=+" should not be used instead of "+=" +# Title : Non-existent operators like "=+" should not be used # Category : Major Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2757 dotnet_diagnostic.S2757.severity = warning @@ -2919,6 +2947,11 @@ dotnet_diagnostic.S2761.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2857 dotnet_diagnostic.S2857.severity = warning +# Title : "Thread.Sleep" should not be used in tests +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2925 +dotnet_diagnostic.S2925.severity = none + # Title : "IDisposables" should be disposed # Category : Blocker Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2930 @@ -2957,6 +2990,11 @@ dotnet_diagnostic.S2953.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2955 dotnet_diagnostic.S2955.severity = none +# Title : Assertions should be complete +# Category : Blocker Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2970 +dotnet_diagnostic.S2970.severity = warning + # Title : "IEnumerable" LINQs should be simplified # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2971 @@ -3007,6 +3045,11 @@ dotnet_diagnostic.S3059.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3060 dotnet_diagnostic.S3060.severity = none +# Title : "StringBuilder" data should be used +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-3063 +dotnet_diagnostic.S3063.severity = warning + # Title : "async" methods should not return "void" # Category : Major Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3168 @@ -3063,7 +3106,7 @@ dotnet_diagnostic.S3235.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3236 dotnet_diagnostic.S3236.severity = none -# Title : "value" parameters should be used +# Title : "value" contextual keyword should be used # Category : Blocker Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3237 dotnet_diagnostic.S3237.severity = warning @@ -3194,6 +3237,11 @@ dotnet_diagnostic.S3353.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3358 dotnet_diagnostic.S3358.severity = warning +# Title : Date and time should not be used as a type for primary keys +# Category : Minor Bug +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-3363 +dotnet_diagnostic.S3363.severity = warning + # Title : "this" should not be exposed from constructors # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3366 @@ -3210,6 +3258,11 @@ dotnet_diagnostic.S3376.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3397 dotnet_diagnostic.S3397.severity = none +# Title : "private" methods called only by inner classes should be moved to those classes +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-3398 +dotnet_diagnostic.S3398.severity = warning + # Title : Methods should not return constants # Category : Minor Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3400 @@ -3220,7 +3273,7 @@ dotnet_diagnostic.S3400.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3415 dotnet_diagnostic.S3415.severity = warning -# Title : Method overloads with default parameter values should not overlap +# Title : Method overloads with default parameter values should not overlap # Category : Blocker Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3427 dotnet_diagnostic.S3427.severity = warning @@ -3416,6 +3469,11 @@ dotnet_diagnostic.S3876.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3877 dotnet_diagnostic.S3877.severity = none +# Title : Arrays should not be created for params parameters +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-3878 +dotnet_diagnostic.S3878.severity = suggestion + # Title : Finalizers should not be empty # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3880 @@ -3441,7 +3499,7 @@ dotnet_diagnostic.S3885.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3887 dotnet_diagnostic.S3887.severity = warning -# Title : Neither "Thread.Resume" nor "Thread.Suspend" should be used +# Title : "Thread.Resume" and "Thread.Suspend" should not be used # Category : Blocker Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3889 dotnet_diagnostic.S3889.severity = warning @@ -3940,6 +3998,11 @@ dotnet_diagnostic.S4507.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4524 dotnet_diagnostic.S4524.severity = warning +# Title : "DebuggerDisplayAttribute" strings should reference existing members +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-4545 +dotnet_diagnostic.S4545.severity = warning + # Title : ASP.NET HTTP request validation feature should not be disabled # Category : Major Vulnerability # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4564 @@ -3960,11 +4023,16 @@ dotnet_diagnostic.S4583.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4586 dotnet_diagnostic.S4586.severity = warning -# Title : String offset-based methods should be preferred for finding substrings from offsets +# Title : Start index should be used instead of calling Substring # Category : Critical Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4635 dotnet_diagnostic.S4635.severity = warning +# Title : Comments should not be empty +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-4663 +dotnet_diagnostic.S4663.severity = none + # Title : Using regular expressions is security-sensitive # Category : Critical Security Hotspot # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4784 @@ -4076,10 +4144,15 @@ dotnet_diagnostic.S5766.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-5773 dotnet_diagnostic.S5773.severity = none +# Title : Regular expressions should be syntactically valid +# Category : Critical Bug +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-5856 +dotnet_diagnostic.S5856.severity = warning + # Title : Use a testable date/time provider # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-6354 -# Redundant: EA0002 +# Redundant: R9A022 dotnet_diagnostic.S6354.severity = none # Title : Azure Functions should be stateless @@ -4115,7 +4188,120 @@ dotnet_diagnostic.S6424.severity = none # Title : Not specifying a timeout for regular expressions is security-sensitive # Category : Major Security Hotspot # Help Link: https://rules.sonarsource.com/csharp/RSPEC-6444 -dotnet_diagnostic.S6444.severity = warning +dotnet_diagnostic.S6444.severity = none + +# Title : Blocks should not be synchronized on local variables +# Category : Major Bug +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6507 +# Comment : Too many false positives +dotnet_diagnostic.S6507.severity = none + +# Title : "ExcludeFromCodeCoverage" attributes should include a justification +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6513 +dotnet_diagnostic.S6513.severity = suggestion + +# Title : Avoid using "DateTime.Now" for benchmarking or timing operations +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6561 +dotnet_diagnostic.S6561.severity = warning + +# Title : Always set the "DateTimeKind" when creating new "DateTime" instances +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6562 +# Comment : Noise +dotnet_diagnostic.S6562.severity = none + +# Title : Use UTC when recording DateTime instants +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6563 +dotnet_diagnostic.S6563.severity = none + +# Title : Use "DateTimeOffset" instead of "DateTime" +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6566 +# Comment : Noise +dotnet_diagnostic.S6566.severity = none + +# Title : Use "TimeZoneInfo.FindSystemTimeZoneById" without converting the timezones with "TimezoneConverter" +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6575 +dotnet_diagnostic.S6575.severity = warning + +# Title : Use a format provider when parsing date and time +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6580 +dotnet_diagnostic.S6580.severity = warning + +# Title : Don't hardcode the format when turning dates and times to strings +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6585 +dotnet_diagnostic.S6585.severity = none + +# Title : Use the "UnixEpoch" field instead of creating "DateTime" instances that point to the beginning of the Unix epoch +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6588 +dotnet_diagnostic.S6588.severity = warning + +# Title : "Find" method should be used instead of the "FirstOrDefault" extension +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6602 +dotnet_diagnostic.S6602.severity = none + +# Title : The collection-specific "TrueForAll" method should be used instead of the "All" extension +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6603 +dotnet_diagnostic.S6603.severity = none + +# Title : Collection-specific "Exists" method should be used instead of the "Any" extension +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6605 +dotnet_diagnostic.S6605.severity = none + +# Title : The collection should be filtered before sorting by using "Where" before "OrderBy" +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6607 +dotnet_diagnostic.S6607.severity = none + +# Title : Prefer indexing instead of "Enumerable" methods on types implementing "IList" +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6608 +dotnet_diagnostic.S6608.severity = none + +# Title : "Min/Max" properties of "Set" types should be used instead of the "Enumerable" extension methods +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6609 +dotnet_diagnostic.S6609.severity = none + +# Title : "StartsWith" and "EndsWith" overloads that take a "char" should be used instead of the ones that take a "string" +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6610 +dotnet_diagnostic.S6610.severity = none + +# Title : The lambda parameter should be used instead of capturing arguments in "ConcurrentDictionary" methods +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6612 +dotnet_diagnostic.S6612.severity = none + +# Title : "First" and "Last" properties of "LinkedList" should be used instead of the "First()" and "Last()" extension methods +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6613 +dotnet_diagnostic.S6613.severity = none + +# Title : "Contains" should be used instead of "Any" for simple equality checks +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6617 +dotnet_diagnostic.S6617.severity = none + +# Title : "string.Create" should be used instead of "FormattableString" +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6618 +dotnet_diagnostic.S6618.severity = none + +# Title : Using unsafe code blocks is security-sensitive +# Category : Major Security Hotspot +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6640 +dotnet_diagnostic.S6640.severity = warning # Title : Literal suffixes should be upper case # Category : Minor Code Smell @@ -4162,6 +4348,10 @@ dotnet_diagnostic.S9999-symbolRef.severity = warning # Category : dotnet_diagnostic.S9999-token-type.severity = warning +# Title : Analysis Warning generator +# Category : +dotnet_diagnostic.S9999-warning.severity = warning + # Title : Avoid legacy thread switching APIs # Category : Usage # Help Link: https://github.com/Microsoft/vs-threading/blob/main/doc/analyzers/VSTHRD001.md @@ -4215,6 +4405,7 @@ dotnet_diagnostic.VSTHRD102.severity = none # Title : Call async methods when in an async method # Category : Usage # Help Link: https://github.com/Microsoft/vs-threading/blob/main/doc/analyzers/VSTHRD103.md +# Redundant: CA1849 dotnet_diagnostic.VSTHRD103.severity = none # Title : Offer async methods @@ -4423,11 +4614,71 @@ dotnet_diagnostic.xUnit1026.severity = none # Help Link: https://xunit.net/xunit.analyzers/rules/xUnit1027 dotnet_diagnostic.xUnit1027.severity = error +# Title : Test method must have valid return type +# Category : Usage +# Help Link: https://xunit.net/xunit.analyzers/rules/xUnit1028 +dotnet_diagnostic.xUnit1028.severity = error + +# Title : Local functions cannot be test functions +# Category : Usage +# Help Link: https://xunit.net/xunit.analyzers/rules/xUnit1029 +dotnet_diagnostic.xUnit1029.severity = error + +# Title : Do not call ConfigureAwait(false) in test method +# Category : Usage +# Help Link: https://xunit.net/xunit.analyzers/rules/xUnit1030 +dotnet_diagnostic.xUnit1030.severity = warning + +# Title : Do not use blocking task operations in test method +# Category : Usage +# Help Link: https://xunit.net/xunit.analyzers/rules/xUnit1031 +dotnet_diagnostic.xUnit1031.severity = warning + +# Title : Test classes cannot be nested within a generic class +# Category : Usage +# Help Link: https://xunit.net/xunit.analyzers/rules/xUnit1032 +dotnet_diagnostic.xUnit1032.severity = error + # Title : Test classes decorated with 'Xunit.IClassFixture' or 'Xunit.ICollectionFixture' should add a constructor argument of type TFixture # Category : Usage # Help Link: https://xunit.net/xunit.analyzers/rules/xUnit1033 dotnet_diagnostic.xUnit1033.severity = suggestion +# Title : Null should only be used for nullable parameters +# Category : Usage +# Help Link: https://xunit.net/xunit.analyzers/rules/xUnit1034 +dotnet_diagnostic.xUnit1034.severity = warning + +# Title : The value is not convertible to the method parameter type +# Category : Usage +# Help Link: https://xunit.net/xunit.analyzers/rules/xUnit1035 +dotnet_diagnostic.xUnit1035.severity = error + +# Title : There is no matching method parameter +# Category : Usage +# Help Link: https://xunit.net/xunit.analyzers/rules/xUnit1036 +dotnet_diagnostic.xUnit1036.severity = error + +# Title : There are fewer TheoryData type arguments than required by the parameters of the test method +# Category : Usage +# Help Link: https://xunit.net/xunit.analyzers/rules/xUnit1037 +dotnet_diagnostic.xUnit1037.severity = error + +# Title : There are more TheoryData type arguments than allowed by the parameters of the test method +# Category : Usage +# Help Link: https://xunit.net/xunit.analyzers/rules/xUnit1038 +dotnet_diagnostic.xUnit1038.severity = error + +# Title : The type argument to TheoryData is not compatible with the type of the corresponding test method parameter +# Category : Usage +# Help Link: https://xunit.net/xunit.analyzers/rules/xUnit1039 +dotnet_diagnostic.xUnit1039.severity = error + +# Title : The type argument to TheoryData is nullable, while the type of the corresponding test method parameter is not +# Category : Usage +# Help Link: https://xunit.net/xunit.analyzers/rules/xUnit1040 +dotnet_diagnostic.xUnit1040.severity = warning + # Title : Constants and literals should be the expected argument # Category : Assertions # Help Link: https://xunit.net/xunit.analyzers/rules/xUnit2000 @@ -4528,7 +4779,22 @@ dotnet_diagnostic.xUnit2018.severity = none # Help Link: https://xunit.github.io/xunit.analyzers/rules/xUnit2019 dotnet_diagnostic.xUnit2019.severity = none -# Title : Test case classes must derive directly or indirectly from Xunit.LongLivedMarshalByRefObject +# Title : Do not use always-failing boolean assertions +# Category : Assertions +# Help Link: https://xunit.net/xunit.analyzers/rules/xUnit2020 +dotnet_diagnostic.xUnit2020.severity = warning + +# Title : Async assertions should be awaited +# Category : Assertions +# Help Link: https://xunit.net/xunit.analyzers/rules/xUnit2021 +dotnet_diagnostic.xUnit2021.severity = error + +# Title : Boolean assertions should not be negated +# Category : Assertions +# Help Link: https://xunit.net/xunit.analyzers/rules/xUnit2022 +dotnet_diagnostic.xUnit2022.severity = suggestion + +# Title : Classes which cross AppDomain boundaries must derive directly or indirectly from LongLivedMarshalByRefObject # Category : Extensibility # Help Link: https://xunit.net/xunit.analyzers/rules/xUnit3000 dotnet_diagnostic.xUnit3000.severity = error diff --git a/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/Test-Tier2.globalconfig b/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/Test-Tier2.globalconfig index 8aee2179d9c..f9c6b1bf0e5 100644 --- a/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/Test-Tier2.globalconfig +++ b/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/Test-Tier2.globalconfig @@ -1,5 +1,5 @@ # Created by DiagConfig, the diagnostic config generator -# Generated : 2023-10-22 00:37:55Z +# Generated : 2024-01-25 20:57:52Z # Max Tier : 2 # Attributes: general, test # Analyzers : ILLink.RoslynAnalyzer, Microsoft.Analyzers.Extra, Microsoft.Analyzers.Local, Microsoft.AspNetCore.App.Analyzers, Microsoft.AspNetCore.Components.Analyzers, Microsoft.CodeAnalysis.CSharp.NetAnalyzers, Microsoft.CodeAnalysis.NetAnalyzers, Microsoft.VisualStudio.Threading.Analyzers, Microsoft.VisualStudio.Threading.Analyzers.CSharp, SonarAnalyzer.CSharp, xunit.analyzers @@ -108,7 +108,7 @@ dotnet_diagnostic.CA1001.severity = warning # Title : Types that own disposable fields should be disposable # Category : Design # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1001 -dotnet_diagnostic.CA1001.severity = warning +dotnet_diagnostic.CA1001.severity = none # Title : Do not expose generic lists # Category : Design @@ -313,6 +313,7 @@ dotnet_diagnostic.CA1062.severity = none # Category : Design # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1063 dotnet_diagnostic.CA1063.severity = warning +dotnet_code_quality.CA1063.api_surface = public # Title : Exceptions should be public # Category : Design @@ -660,6 +661,7 @@ dotnet_diagnostic.CA1821.severity = none # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1822 dotnet_diagnostic.CA1822.severity = warning +dotnet_code_quality.CA1822.api_surface = all # Title : Avoid unused private fields # Category : Performance @@ -789,7 +791,7 @@ dotnet_diagnostic.CA1847.severity = none # Title : Use the LoggerMessage delegates # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1848 -# Comment : Use the code generated model instead. +# Comment : Use R9 logging model instead dotnet_diagnostic.CA1848.severity = none # Title : Call async methods when in an async method @@ -840,7 +842,7 @@ dotnet_diagnostic.CA1857.severity = warning # Title : Use 'StartsWith' instead of 'IndexOf' # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1858 -dotnet_diagnostic.CA1858.severity = none +dotnet_diagnostic.CA1858.severity = suggestion # Title : Use concrete types when possible for improved performance # Category : Performance @@ -850,7 +852,7 @@ dotnet_diagnostic.CA1859.severity = none # Title : Avoid using 'Enumerable.Any()' extension method # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1860 -dotnet_diagnostic.CA1860.severity = none +dotnet_diagnostic.CA1860.severity = suggestion # Title : Avoid constant arrays as arguments # Category : Performance @@ -860,7 +862,7 @@ dotnet_diagnostic.CA1861.severity = suggestion # Title : Use the 'StringComparison' method overloads to perform case-insensitive string comparisons # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1862 -dotnet_diagnostic.CA1862.severity = none +dotnet_diagnostic.CA1862.severity = suggestion # Title : Use 'CompositeFormat' # Category : Performance @@ -895,12 +897,12 @@ dotnet_diagnostic.CA1868.severity = suggestion # Title : Cache and reuse 'JsonSerializerOptions' instances # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1869 -dotnet_diagnostic.CA1869.severity = none +dotnet_diagnostic.CA1869.severity = suggestion # Title : Use a cached 'SearchValues' instance # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1870 -dotnet_diagnostic.CA1870.severity = none +dotnet_diagnostic.CA1870.severity = suggestion # Title : Dispose objects before losing scope # Category : Reliability @@ -1036,6 +1038,7 @@ dotnet_diagnostic.CA2207.severity = none # Category : Usage # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2208 dotnet_diagnostic.CA2208.severity = warning +dotnet_code_quality.CA2208.api_surface = all # Title : Non-constant fields should not be visible # Category : Usage @@ -1118,6 +1121,7 @@ dotnet_diagnostic.CA2237.severity = none # Category : Usage # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2241 dotnet_diagnostic.CA2241.severity = warning +dotnet_code_quality.CA2241.try_determine_additional_string_formatting_methods_automatically = false # Title : Test for NaN correctly # Category : Usage @@ -2108,7 +2112,7 @@ dotnet_diagnostic.S103.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-104 dotnet_diagnostic.S104.severity = warning -# Title : Destructors should not throw exceptions +# Title : Finalizers should not throw exceptions # Category : Blocker Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1048 # Redundant: CA1065 @@ -2183,7 +2187,7 @@ dotnet_diagnostic.S1110.severity = none # Redundant: SA1106 dotnet_diagnostic.S1116.severity = none -# Title : Local variables should not shadow class fields +# Title : Local variables should not shadow class fields or properties # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1117 dotnet_diagnostic.S1117.severity = warning @@ -2226,6 +2230,11 @@ dotnet_diagnostic.S1128.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-113 dotnet_diagnostic.S113.severity = none +# Title : Deprecated code should be removed +# Category : Info Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-1133 +dotnet_diagnostic.S1133.severity = suggestion + # Title : Track uses of "FIXME" tags # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1134 @@ -2297,7 +2306,7 @@ dotnet_diagnostic.S1192.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1199 dotnet_diagnostic.S1199.severity = none -# Title : Classes should not be coupled to too many other classes (Single Responsibility Principle) +# Title : Classes should not be coupled to too many other classes # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1200 dotnet_diagnostic.S1200.severity = none @@ -2478,7 +2487,7 @@ dotnet_diagnostic.S1699.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1751 dotnet_diagnostic.S1751.severity = warning -# Title : Identical expressions should not be used on both sides of a binary operator +# Title : Identical expressions should not be used on both sides of operators # Category : Major Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1764 dotnet_diagnostic.S1764.severity = warning @@ -2530,7 +2539,7 @@ dotnet_diagnostic.S1939.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1940 dotnet_diagnostic.S1940.severity = warning -# Title : Inappropriate casts should not be made +# Title : Invalid casts should be avoided # Category : Critical Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1944 dotnet_diagnostic.S1944.severity = warning @@ -2567,6 +2576,11 @@ dotnet_diagnostic.S2077.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2092 dotnet_diagnostic.S2092.severity = warning +# Title : Classes should not be empty +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2094 +dotnet_diagnostic.S2094.severity = none + # Title : Collections should not be passed as arguments to their own methods # Category : Major Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2114 @@ -2592,6 +2606,11 @@ dotnet_diagnostic.S2148.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2156 dotnet_diagnostic.S2156.severity = warning +# Title : Classes named like "Exception" should extend "Exception" or a subclass +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2166 +dotnet_diagnostic.S2166.severity = warning + # Title : Short-circuit logic should be used in boolean contexts # Category : Blocker Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2178 @@ -2607,12 +2626,12 @@ dotnet_diagnostic.S2183.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2184 dotnet_diagnostic.S2184.severity = warning -# Title : TestCases should contain tests +# Title : Test classes should contain at least one test case # Category : Blocker Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2187 dotnet_diagnostic.S2187.severity = warning -# Title : Recursion should not be infinite +# Title : Loops and recursions should not be infinite # Category : Blocker Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2190 dotnet_diagnostic.S2190.severity = warning @@ -2622,7 +2641,12 @@ dotnet_diagnostic.S2190.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2197 dotnet_diagnostic.S2197.severity = warning -# Title : Return values from functions without side effects should not be ignored +# Title : Unnecessary mathematical comparisons should not be made +# Category : Critical Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2198 +dotnet_diagnostic.S2198.severity = warning + +# Title : Methods without side effects should not have their return values ignored # Category : Major Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2201 # Redundant: CA1806 @@ -2658,7 +2682,7 @@ dotnet_diagnostic.S2225.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2228 dotnet_diagnostic.S2228.severity = none -# Title : Parameters should be passed in the correct order +# Title : Arguments should be passed in the same order as the method parameters # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2234 dotnet_diagnostic.S2234.severity = warning @@ -2833,11 +2857,17 @@ dotnet_diagnostic.S2387.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2436 dotnet_diagnostic.S2436.severity = none -# Title : Silly bit operations should not be performed +# Title : Unnecessary bit operations should not be performed # Category : Blocker Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2437 dotnet_diagnostic.S2437.severity = warning +# Title : Blocks should be synchronized on read-only fields +# Category : Major Bug +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2445 +# Comment : Noise +dotnet_diagnostic.S2445.severity = none + # Title : Whitespace and control characters in string literals should be explicit # Category : Critical Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2479 @@ -2851,8 +2881,7 @@ dotnet_diagnostic.S2486.severity = warning # Title : Shared resources should not be used for locking # Category : Critical Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2551 -# Redundant: CA2002 -dotnet_diagnostic.S2551.severity = none +dotnet_diagnostic.S2551.severity = warning # Title : Conditionally executed code should be reachable # Category : Major Bug @@ -2863,7 +2892,8 @@ dotnet_diagnostic.S2583.severity = none # Title : Boolean expressions should not be gratuitous # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2589 -dotnet_diagnostic.S2589.severity = warning +# Comment : Too many false positives. +dotnet_diagnostic.S2589.severity = none # Title : Setting loose file permissions is security-sensitive # Category : Major Security Hotspot @@ -2920,7 +2950,7 @@ dotnet_diagnostic.S2743.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2755 dotnet_diagnostic.S2755.severity = warning -# Title : "=+" should not be used instead of "+=" +# Title : Non-existent operators like "=+" should not be used # Category : Major Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2757 dotnet_diagnostic.S2757.severity = warning @@ -2945,6 +2975,11 @@ dotnet_diagnostic.S2761.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2857 dotnet_diagnostic.S2857.severity = warning +# Title : "Thread.Sleep" should not be used in tests +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2925 +dotnet_diagnostic.S2925.severity = none + # Title : "IDisposables" should be disposed # Category : Blocker Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2930 @@ -2983,6 +3018,11 @@ dotnet_diagnostic.S2953.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2955 dotnet_diagnostic.S2955.severity = warning +# Title : Assertions should be complete +# Category : Blocker Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2970 +dotnet_diagnostic.S2970.severity = warning + # Title : "IEnumerable" LINQs should be simplified # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2971 @@ -3033,6 +3073,11 @@ dotnet_diagnostic.S3059.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3060 dotnet_diagnostic.S3060.severity = warning +# Title : "StringBuilder" data should be used +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-3063 +dotnet_diagnostic.S3063.severity = warning + # Title : "async" methods should not return "void" # Category : Major Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3168 @@ -3090,7 +3135,7 @@ dotnet_diagnostic.S3235.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3236 dotnet_diagnostic.S3236.severity = none -# Title : "value" parameters should be used +# Title : "value" contextual keyword should be used # Category : Blocker Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3237 dotnet_diagnostic.S3237.severity = warning @@ -3159,7 +3204,7 @@ dotnet_diagnostic.S3257.severity = none # Title : Non-derived "private" classes and records should be "sealed" # Category : Minor Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3260 -# Redundant: CA1852 +# Redundant: R9A013 dotnet_diagnostic.S3260.severity = none # Title : Namespaces should not be empty @@ -3223,6 +3268,11 @@ dotnet_diagnostic.S3353.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3358 dotnet_diagnostic.S3358.severity = warning +# Title : Date and time should not be used as a type for primary keys +# Category : Minor Bug +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-3363 +dotnet_diagnostic.S3363.severity = warning + # Title : "this" should not be exposed from constructors # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3366 @@ -3239,6 +3289,11 @@ dotnet_diagnostic.S3376.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3397 dotnet_diagnostic.S3397.severity = warning +# Title : "private" methods called only by inner classes should be moved to those classes +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-3398 +dotnet_diagnostic.S3398.severity = warning + # Title : Methods should not return constants # Category : Minor Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3400 @@ -3249,7 +3304,7 @@ dotnet_diagnostic.S3400.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3415 dotnet_diagnostic.S3415.severity = warning -# Title : Method overloads with default parameter values should not overlap +# Title : Method overloads with default parameter values should not overlap # Category : Blocker Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3427 dotnet_diagnostic.S3427.severity = warning @@ -3447,6 +3502,11 @@ dotnet_diagnostic.S3876.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3877 dotnet_diagnostic.S3877.severity = none +# Title : Arrays should not be created for params parameters +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-3878 +dotnet_diagnostic.S3878.severity = suggestion + # Title : Finalizers should not be empty # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3880 @@ -3472,7 +3532,7 @@ dotnet_diagnostic.S3885.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3887 dotnet_diagnostic.S3887.severity = warning -# Title : Neither "Thread.Resume" nor "Thread.Suspend" should be used +# Title : "Thread.Resume" and "Thread.Suspend" should not be used # Category : Blocker Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3889 dotnet_diagnostic.S3889.severity = warning @@ -3846,7 +3906,8 @@ dotnet_diagnostic.S4144.severity = warning # Title : Empty collections should not be accessed or iterated # Category : Minor Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4158 -dotnet_diagnostic.S4158.severity = warning +# Comment : Too many false positives +dotnet_diagnostic.S4158.severity = none # Title : Classes should implement their "ExportAttribute" interfaces # Category : Blocker Bug @@ -3980,6 +4041,11 @@ dotnet_diagnostic.S4507.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4524 dotnet_diagnostic.S4524.severity = warning +# Title : "DebuggerDisplayAttribute" strings should reference existing members +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-4545 +dotnet_diagnostic.S4545.severity = warning + # Title : ASP.NET HTTP request validation feature should not be disabled # Category : Major Vulnerability # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4564 @@ -4000,11 +4066,16 @@ dotnet_diagnostic.S4583.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4586 dotnet_diagnostic.S4586.severity = warning -# Title : String offset-based methods should be preferred for finding substrings from offsets +# Title : Start index should be used instead of calling Substring # Category : Critical Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4635 dotnet_diagnostic.S4635.severity = warning +# Title : Comments should not be empty +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-4663 +dotnet_diagnostic.S4663.severity = none + # Title : Using regular expressions is security-sensitive # Category : Critical Security Hotspot # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4784 @@ -4116,10 +4187,15 @@ dotnet_diagnostic.S5766.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-5773 dotnet_diagnostic.S5773.severity = warning +# Title : Regular expressions should be syntactically valid +# Category : Critical Bug +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-5856 +dotnet_diagnostic.S5856.severity = warning + # Title : Use a testable date/time provider # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-6354 -# Redundant: EA0002 +# Redundant: R9A022 dotnet_diagnostic.S6354.severity = none # Title : Azure Functions should be stateless @@ -4155,7 +4231,120 @@ dotnet_diagnostic.S6424.severity = warning # Title : Not specifying a timeout for regular expressions is security-sensitive # Category : Major Security Hotspot # Help Link: https://rules.sonarsource.com/csharp/RSPEC-6444 -dotnet_diagnostic.S6444.severity = warning +dotnet_diagnostic.S6444.severity = none + +# Title : Blocks should not be synchronized on local variables +# Category : Major Bug +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6507 +# Comment : Too many false positives +dotnet_diagnostic.S6507.severity = none + +# Title : "ExcludeFromCodeCoverage" attributes should include a justification +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6513 +dotnet_diagnostic.S6513.severity = suggestion + +# Title : Avoid using "DateTime.Now" for benchmarking or timing operations +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6561 +dotnet_diagnostic.S6561.severity = warning + +# Title : Always set the "DateTimeKind" when creating new "DateTime" instances +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6562 +# Comment : Noise +dotnet_diagnostic.S6562.severity = none + +# Title : Use UTC when recording DateTime instants +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6563 +dotnet_diagnostic.S6563.severity = none + +# Title : Use "DateTimeOffset" instead of "DateTime" +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6566 +# Comment : Noise +dotnet_diagnostic.S6566.severity = none + +# Title : Use "TimeZoneInfo.FindSystemTimeZoneById" without converting the timezones with "TimezoneConverter" +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6575 +dotnet_diagnostic.S6575.severity = warning + +# Title : Use a format provider when parsing date and time +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6580 +dotnet_diagnostic.S6580.severity = warning + +# Title : Don't hardcode the format when turning dates and times to strings +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6585 +dotnet_diagnostic.S6585.severity = none + +# Title : Use the "UnixEpoch" field instead of creating "DateTime" instances that point to the beginning of the Unix epoch +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6588 +dotnet_diagnostic.S6588.severity = warning + +# Title : "Find" method should be used instead of the "FirstOrDefault" extension +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6602 +dotnet_diagnostic.S6602.severity = none + +# Title : The collection-specific "TrueForAll" method should be used instead of the "All" extension +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6603 +dotnet_diagnostic.S6603.severity = none + +# Title : Collection-specific "Exists" method should be used instead of the "Any" extension +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6605 +dotnet_diagnostic.S6605.severity = none + +# Title : The collection should be filtered before sorting by using "Where" before "OrderBy" +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6607 +dotnet_diagnostic.S6607.severity = none + +# Title : Prefer indexing instead of "Enumerable" methods on types implementing "IList" +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6608 +dotnet_diagnostic.S6608.severity = none + +# Title : "Min/Max" properties of "Set" types should be used instead of the "Enumerable" extension methods +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6609 +dotnet_diagnostic.S6609.severity = none + +# Title : "StartsWith" and "EndsWith" overloads that take a "char" should be used instead of the ones that take a "string" +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6610 +dotnet_diagnostic.S6610.severity = none + +# Title : The lambda parameter should be used instead of capturing arguments in "ConcurrentDictionary" methods +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6612 +dotnet_diagnostic.S6612.severity = none + +# Title : "First" and "Last" properties of "LinkedList" should be used instead of the "First()" and "Last()" extension methods +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6613 +dotnet_diagnostic.S6613.severity = none + +# Title : "Contains" should be used instead of "Any" for simple equality checks +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6617 +dotnet_diagnostic.S6617.severity = none + +# Title : "string.Create" should be used instead of "FormattableString" +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6618 +dotnet_diagnostic.S6618.severity = none + +# Title : Using unsafe code blocks is security-sensitive +# Category : Major Security Hotspot +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6640 +dotnet_diagnostic.S6640.severity = warning # Title : Literal suffixes should be upper case # Category : Minor Code Smell @@ -4202,6 +4391,10 @@ dotnet_diagnostic.S9999-symbolRef.severity = warning # Category : dotnet_diagnostic.S9999-token-type.severity = warning +# Title : Analysis Warning generator +# Category : +dotnet_diagnostic.S9999-warning.severity = warning + # Title : Avoid legacy thread switching APIs # Category : Usage # Help Link: https://github.com/Microsoft/vs-threading/blob/main/doc/analyzers/VSTHRD001.md @@ -4255,6 +4448,7 @@ dotnet_diagnostic.VSTHRD102.severity = suggestion # Title : Call async methods when in an async method # Category : Usage # Help Link: https://github.com/Microsoft/vs-threading/blob/main/doc/analyzers/VSTHRD103.md +# Redundant: CA1849 dotnet_diagnostic.VSTHRD103.severity = none # Title : Offer async methods @@ -4464,11 +4658,71 @@ dotnet_diagnostic.xUnit1026.severity = warning # Help Link: https://xunit.net/xunit.analyzers/rules/xUnit1027 dotnet_diagnostic.xUnit1027.severity = error +# Title : Test method must have valid return type +# Category : Usage +# Help Link: https://xunit.net/xunit.analyzers/rules/xUnit1028 +dotnet_diagnostic.xUnit1028.severity = error + +# Title : Local functions cannot be test functions +# Category : Usage +# Help Link: https://xunit.net/xunit.analyzers/rules/xUnit1029 +dotnet_diagnostic.xUnit1029.severity = error + +# Title : Do not call ConfigureAwait(false) in test method +# Category : Usage +# Help Link: https://xunit.net/xunit.analyzers/rules/xUnit1030 +dotnet_diagnostic.xUnit1030.severity = warning + +# Title : Do not use blocking task operations in test method +# Category : Usage +# Help Link: https://xunit.net/xunit.analyzers/rules/xUnit1031 +dotnet_diagnostic.xUnit1031.severity = warning + +# Title : Test classes cannot be nested within a generic class +# Category : Usage +# Help Link: https://xunit.net/xunit.analyzers/rules/xUnit1032 +dotnet_diagnostic.xUnit1032.severity = error + # Title : Test classes decorated with 'Xunit.IClassFixture' or 'Xunit.ICollectionFixture' should add a constructor argument of type TFixture # Category : Usage # Help Link: https://xunit.net/xunit.analyzers/rules/xUnit1033 dotnet_diagnostic.xUnit1033.severity = suggestion +# Title : Null should only be used for nullable parameters +# Category : Usage +# Help Link: https://xunit.net/xunit.analyzers/rules/xUnit1034 +dotnet_diagnostic.xUnit1034.severity = warning + +# Title : The value is not convertible to the method parameter type +# Category : Usage +# Help Link: https://xunit.net/xunit.analyzers/rules/xUnit1035 +dotnet_diagnostic.xUnit1035.severity = error + +# Title : There is no matching method parameter +# Category : Usage +# Help Link: https://xunit.net/xunit.analyzers/rules/xUnit1036 +dotnet_diagnostic.xUnit1036.severity = error + +# Title : There are fewer TheoryData type arguments than required by the parameters of the test method +# Category : Usage +# Help Link: https://xunit.net/xunit.analyzers/rules/xUnit1037 +dotnet_diagnostic.xUnit1037.severity = error + +# Title : There are more TheoryData type arguments than allowed by the parameters of the test method +# Category : Usage +# Help Link: https://xunit.net/xunit.analyzers/rules/xUnit1038 +dotnet_diagnostic.xUnit1038.severity = error + +# Title : The type argument to TheoryData is not compatible with the type of the corresponding test method parameter +# Category : Usage +# Help Link: https://xunit.net/xunit.analyzers/rules/xUnit1039 +dotnet_diagnostic.xUnit1039.severity = error + +# Title : The type argument to TheoryData is nullable, while the type of the corresponding test method parameter is not +# Category : Usage +# Help Link: https://xunit.net/xunit.analyzers/rules/xUnit1040 +dotnet_diagnostic.xUnit1040.severity = warning + # Title : Constants and literals should be the expected argument # Category : Assertions # Help Link: https://xunit.net/xunit.analyzers/rules/xUnit2000 @@ -4569,7 +4823,22 @@ dotnet_diagnostic.xUnit2018.severity = warning # Help Link: https://xunit.github.io/xunit.analyzers/rules/xUnit2019 dotnet_diagnostic.xUnit2019.severity = warning -# Title : Test case classes must derive directly or indirectly from Xunit.LongLivedMarshalByRefObject +# Title : Do not use always-failing boolean assertions +# Category : Assertions +# Help Link: https://xunit.net/xunit.analyzers/rules/xUnit2020 +dotnet_diagnostic.xUnit2020.severity = warning + +# Title : Async assertions should be awaited +# Category : Assertions +# Help Link: https://xunit.net/xunit.analyzers/rules/xUnit2021 +dotnet_diagnostic.xUnit2021.severity = error + +# Title : Boolean assertions should not be negated +# Category : Assertions +# Help Link: https://xunit.net/xunit.analyzers/rules/xUnit2022 +dotnet_diagnostic.xUnit2022.severity = suggestion + +# Title : Classes which cross AppDomain boundaries must derive directly or indirectly from LongLivedMarshalByRefObject # Category : Extensibility # Help Link: https://xunit.net/xunit.analyzers/rules/xUnit3000 dotnet_diagnostic.xUnit3000.severity = error diff --git a/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/Test.globalconfig b/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/Test.globalconfig index 9a708301a99..7015c34ae11 100644 --- a/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/Test.globalconfig +++ b/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/Test.globalconfig @@ -1,5 +1,5 @@ # Created by DiagConfig, the diagnostic config generator -# Generated : 2023-10-22 00:37:59Z +# Generated : 2024-01-25 20:57:56Z # Max Tier : 3 # Attributes: general, test # Analyzers : ILLink.RoslynAnalyzer, Microsoft.Analyzers.Extra, Microsoft.Analyzers.Local, Microsoft.AspNetCore.App.Analyzers, Microsoft.AspNetCore.Components.Analyzers, Microsoft.CodeAnalysis.CSharp.NetAnalyzers, Microsoft.CodeAnalysis.NetAnalyzers, Microsoft.VisualStudio.Threading.Analyzers, Microsoft.VisualStudio.Threading.Analyzers.CSharp, SonarAnalyzer.CSharp, xunit.analyzers @@ -108,7 +108,7 @@ dotnet_diagnostic.CA1001.severity = warning # Title : Types that own disposable fields should be disposable # Category : Design # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1001 -dotnet_diagnostic.CA1001.severity = warning +dotnet_diagnostic.CA1001.severity = none # Title : Do not expose generic lists # Category : Design @@ -196,6 +196,7 @@ dotnet_diagnostic.CA1028.severity = none # Category : Design # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1030 dotnet_diagnostic.CA1030.severity = warning +dotnet_code_quality.CA1030.api_surface = public # Title : Do not catch general exception types # Category : Design @@ -275,6 +276,7 @@ dotnet_diagnostic.CA1051.severity = none # Category : Design # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1052 dotnet_diagnostic.CA1052.severity = warning +dotnet_code_quality.CA1052.api_surface = all # Title : URI-like parameters should not be strings # Category : Design @@ -317,6 +319,7 @@ dotnet_diagnostic.CA1062.severity = none # Category : Design # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1063 dotnet_diagnostic.CA1063.severity = warning +dotnet_code_quality.CA1063.api_surface = public # Title : Exceptions should be public # Category : Design @@ -575,6 +578,7 @@ dotnet_diagnostic.CA1724.severity = none # Category : Naming # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1725 dotnet_diagnostic.CA1725.severity = warning +dotnet_code_quality.CA1725.api_surface = public, protected # Title : Use PascalCase for named placeholders # Category : Naming @@ -669,6 +673,7 @@ dotnet_diagnostic.CA1821.severity = none # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1822 dotnet_diagnostic.CA1822.severity = warning +dotnet_code_quality.CA1822.api_surface = all # Title : Avoid unused private fields # Category : Performance @@ -798,7 +803,7 @@ dotnet_diagnostic.CA1847.severity = none # Title : Use the LoggerMessage delegates # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1848 -# Comment : Use the code generated model instead. +# Comment : Use R9 logging model instead dotnet_diagnostic.CA1848.severity = none # Title : Call async methods when in an async method @@ -849,7 +854,7 @@ dotnet_diagnostic.CA1857.severity = warning # Title : Use 'StartsWith' instead of 'IndexOf' # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1858 -dotnet_diagnostic.CA1858.severity = none +dotnet_diagnostic.CA1858.severity = suggestion # Title : Use concrete types when possible for improved performance # Category : Performance @@ -859,7 +864,7 @@ dotnet_diagnostic.CA1859.severity = none # Title : Avoid using 'Enumerable.Any()' extension method # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1860 -dotnet_diagnostic.CA1860.severity = none +dotnet_diagnostic.CA1860.severity = suggestion # Title : Avoid constant arrays as arguments # Category : Performance @@ -869,7 +874,7 @@ dotnet_diagnostic.CA1861.severity = suggestion # Title : Use the 'StringComparison' method overloads to perform case-insensitive string comparisons # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1862 -dotnet_diagnostic.CA1862.severity = none +dotnet_diagnostic.CA1862.severity = suggestion # Title : Use 'CompositeFormat' # Category : Performance @@ -904,12 +909,12 @@ dotnet_diagnostic.CA1868.severity = suggestion # Title : Cache and reuse 'JsonSerializerOptions' instances # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1869 -dotnet_diagnostic.CA1869.severity = none +dotnet_diagnostic.CA1869.severity = suggestion # Title : Use a cached 'SearchValues' instance # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1870 -dotnet_diagnostic.CA1870.severity = none +dotnet_diagnostic.CA1870.severity = suggestion # Title : Dispose objects before losing scope # Category : Reliability @@ -1045,6 +1050,7 @@ dotnet_diagnostic.CA2207.severity = none # Category : Usage # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2208 dotnet_diagnostic.CA2208.severity = warning +dotnet_code_quality.CA2208.api_surface = all # Title : Non-constant fields should not be visible # Category : Usage @@ -1108,6 +1114,7 @@ dotnet_diagnostic.CA2229.severity = none # Category : Usage # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2231 dotnet_diagnostic.CA2231.severity = error +dotnet_code_quality.CA2231.api_surface = public # Title : Pass system uri objects instead of strings # Category : Usage @@ -1130,6 +1137,7 @@ dotnet_diagnostic.CA2237.severity = none # Category : Usage # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2241 dotnet_diagnostic.CA2241.severity = warning +dotnet_code_quality.CA2241.try_determine_additional_string_formatting_methods_automatically = false # Title : Test for NaN correctly # Category : Usage @@ -2122,7 +2130,7 @@ dotnet_diagnostic.S103.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-104 dotnet_diagnostic.S104.severity = warning -# Title : Destructors should not throw exceptions +# Title : Finalizers should not throw exceptions # Category : Blocker Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1048 # Redundant: CA1065 @@ -2198,7 +2206,7 @@ dotnet_diagnostic.S1110.severity = none # Redundant: SA1106 dotnet_diagnostic.S1116.severity = none -# Title : Local variables should not shadow class fields +# Title : Local variables should not shadow class fields or properties # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1117 dotnet_diagnostic.S1117.severity = warning @@ -2241,6 +2249,11 @@ dotnet_diagnostic.S1128.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-113 dotnet_diagnostic.S113.severity = none +# Title : Deprecated code should be removed +# Category : Info Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-1133 +dotnet_diagnostic.S1133.severity = suggestion + # Title : Track uses of "FIXME" tags # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1134 @@ -2313,7 +2326,7 @@ dotnet_diagnostic.S1192.severity = suggestion # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1199 dotnet_diagnostic.S1199.severity = warning -# Title : Classes should not be coupled to too many other classes (Single Responsibility Principle) +# Title : Classes should not be coupled to too many other classes # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1200 dotnet_diagnostic.S1200.severity = none @@ -2494,7 +2507,7 @@ dotnet_diagnostic.S1699.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1751 dotnet_diagnostic.S1751.severity = warning -# Title : Identical expressions should not be used on both sides of a binary operator +# Title : Identical expressions should not be used on both sides of operators # Category : Major Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1764 dotnet_diagnostic.S1764.severity = warning @@ -2546,7 +2559,7 @@ dotnet_diagnostic.S1939.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1940 dotnet_diagnostic.S1940.severity = warning -# Title : Inappropriate casts should not be made +# Title : Invalid casts should be avoided # Category : Critical Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1944 dotnet_diagnostic.S1944.severity = warning @@ -2583,6 +2596,11 @@ dotnet_diagnostic.S2077.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2092 dotnet_diagnostic.S2092.severity = warning +# Title : Classes should not be empty +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2094 +dotnet_diagnostic.S2094.severity = none + # Title : Collections should not be passed as arguments to their own methods # Category : Major Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2114 @@ -2608,6 +2626,11 @@ dotnet_diagnostic.S2148.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2156 dotnet_diagnostic.S2156.severity = warning +# Title : Classes named like "Exception" should extend "Exception" or a subclass +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2166 +dotnet_diagnostic.S2166.severity = warning + # Title : Short-circuit logic should be used in boolean contexts # Category : Blocker Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2178 @@ -2623,12 +2646,12 @@ dotnet_diagnostic.S2183.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2184 dotnet_diagnostic.S2184.severity = warning -# Title : TestCases should contain tests +# Title : Test classes should contain at least one test case # Category : Blocker Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2187 dotnet_diagnostic.S2187.severity = warning -# Title : Recursion should not be infinite +# Title : Loops and recursions should not be infinite # Category : Blocker Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2190 dotnet_diagnostic.S2190.severity = warning @@ -2638,7 +2661,12 @@ dotnet_diagnostic.S2190.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2197 dotnet_diagnostic.S2197.severity = warning -# Title : Return values from functions without side effects should not be ignored +# Title : Unnecessary mathematical comparisons should not be made +# Category : Critical Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2198 +dotnet_diagnostic.S2198.severity = warning + +# Title : Methods without side effects should not have their return values ignored # Category : Major Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2201 # Redundant: CA1806 @@ -2674,7 +2702,7 @@ dotnet_diagnostic.S2225.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2228 dotnet_diagnostic.S2228.severity = none -# Title : Parameters should be passed in the correct order +# Title : Arguments should be passed in the same order as the method parameters # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2234 dotnet_diagnostic.S2234.severity = warning @@ -2851,11 +2879,17 @@ dotnet_diagnostic.S2387.severity = warning # Redundant: CA1005 dotnet_diagnostic.S2436.severity = none -# Title : Silly bit operations should not be performed +# Title : Unnecessary bit operations should not be performed # Category : Blocker Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2437 dotnet_diagnostic.S2437.severity = warning +# Title : Blocks should be synchronized on read-only fields +# Category : Major Bug +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2445 +# Comment : Noise +dotnet_diagnostic.S2445.severity = none + # Title : Whitespace and control characters in string literals should be explicit # Category : Critical Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2479 @@ -2869,8 +2903,7 @@ dotnet_diagnostic.S2486.severity = warning # Title : Shared resources should not be used for locking # Category : Critical Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2551 -# Redundant: CA2002 -dotnet_diagnostic.S2551.severity = none +dotnet_diagnostic.S2551.severity = warning # Title : Conditionally executed code should be reachable # Category : Major Bug @@ -2881,7 +2914,8 @@ dotnet_diagnostic.S2583.severity = none # Title : Boolean expressions should not be gratuitous # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2589 -dotnet_diagnostic.S2589.severity = warning +# Comment : Too many false positives. +dotnet_diagnostic.S2589.severity = none # Title : Setting loose file permissions is security-sensitive # Category : Major Security Hotspot @@ -2938,7 +2972,7 @@ dotnet_diagnostic.S2743.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2755 dotnet_diagnostic.S2755.severity = warning -# Title : "=+" should not be used instead of "+=" +# Title : Non-existent operators like "=+" should not be used # Category : Major Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2757 dotnet_diagnostic.S2757.severity = warning @@ -2963,6 +2997,11 @@ dotnet_diagnostic.S2761.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2857 dotnet_diagnostic.S2857.severity = warning +# Title : "Thread.Sleep" should not be used in tests +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2925 +dotnet_diagnostic.S2925.severity = none + # Title : "IDisposables" should be disposed # Category : Blocker Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2930 @@ -3001,6 +3040,11 @@ dotnet_diagnostic.S2953.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2955 dotnet_diagnostic.S2955.severity = warning +# Title : Assertions should be complete +# Category : Blocker Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2970 +dotnet_diagnostic.S2970.severity = warning + # Title : "IEnumerable" LINQs should be simplified # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2971 @@ -3052,6 +3096,11 @@ dotnet_diagnostic.S3059.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3060 dotnet_diagnostic.S3060.severity = warning +# Title : "StringBuilder" data should be used +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-3063 +dotnet_diagnostic.S3063.severity = warning + # Title : "async" methods should not return "void" # Category : Major Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3168 @@ -3109,7 +3158,7 @@ dotnet_diagnostic.S3235.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3236 dotnet_diagnostic.S3236.severity = warning -# Title : "value" parameters should be used +# Title : "value" contextual keyword should be used # Category : Blocker Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3237 dotnet_diagnostic.S3237.severity = warning @@ -3174,12 +3223,13 @@ dotnet_diagnostic.S3256.severity = warning # Title : Declarations and initializations should be as concise as possible # Category : Minor Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3257 -dotnet_diagnostic.S3257.severity = warning +# Comment : Too many false positives +dotnet_diagnostic.S3257.severity = none # Title : Non-derived "private" classes and records should be "sealed" # Category : Minor Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3260 -# Redundant: CA1852 +# Redundant: R9A013 dotnet_diagnostic.S3260.severity = none # Title : Namespaces should not be empty @@ -3243,6 +3293,11 @@ dotnet_diagnostic.S3353.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3358 dotnet_diagnostic.S3358.severity = warning +# Title : Date and time should not be used as a type for primary keys +# Category : Minor Bug +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-3363 +dotnet_diagnostic.S3363.severity = warning + # Title : "this" should not be exposed from constructors # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3366 @@ -3259,6 +3314,11 @@ dotnet_diagnostic.S3376.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3397 dotnet_diagnostic.S3397.severity = warning +# Title : "private" methods called only by inner classes should be moved to those classes +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-3398 +dotnet_diagnostic.S3398.severity = warning + # Title : Methods should not return constants # Category : Minor Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3400 @@ -3269,7 +3329,7 @@ dotnet_diagnostic.S3400.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3415 dotnet_diagnostic.S3415.severity = warning -# Title : Method overloads with default parameter values should not overlap +# Title : Method overloads with default parameter values should not overlap # Category : Blocker Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3427 dotnet_diagnostic.S3427.severity = warning @@ -3467,6 +3527,11 @@ dotnet_diagnostic.S3876.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3877 dotnet_diagnostic.S3877.severity = none +# Title : Arrays should not be created for params parameters +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-3878 +dotnet_diagnostic.S3878.severity = suggestion + # Title : Finalizers should not be empty # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3880 @@ -3492,7 +3557,7 @@ dotnet_diagnostic.S3885.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3887 dotnet_diagnostic.S3887.severity = warning -# Title : Neither "Thread.Resume" nor "Thread.Suspend" should be used +# Title : "Thread.Resume" and "Thread.Suspend" should not be used # Category : Blocker Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3889 dotnet_diagnostic.S3889.severity = warning @@ -3732,7 +3797,7 @@ dotnet_diagnostic.S4022.severity = warning # Title : Interfaces should not be empty # Category : Minor Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4023 -dotnet_diagnostic.S4023.severity = warning +dotnet_diagnostic.S4023.severity = none # Title : Child class fields should not differ from parent class fields only by capitalization # Category : Critical Code Smell @@ -3870,7 +3935,8 @@ dotnet_diagnostic.S4144.severity = warning # Title : Empty collections should not be accessed or iterated # Category : Minor Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4158 -dotnet_diagnostic.S4158.severity = warning +# Comment : Too many false positives +dotnet_diagnostic.S4158.severity = none # Title : Classes should implement their "ExportAttribute" interfaces # Category : Blocker Bug @@ -4004,6 +4070,11 @@ dotnet_diagnostic.S4507.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4524 dotnet_diagnostic.S4524.severity = warning +# Title : "DebuggerDisplayAttribute" strings should reference existing members +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-4545 +dotnet_diagnostic.S4545.severity = warning + # Title : ASP.NET HTTP request validation feature should not be disabled # Category : Major Vulnerability # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4564 @@ -4024,11 +4095,16 @@ dotnet_diagnostic.S4583.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4586 dotnet_diagnostic.S4586.severity = warning -# Title : String offset-based methods should be preferred for finding substrings from offsets +# Title : Start index should be used instead of calling Substring # Category : Critical Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4635 dotnet_diagnostic.S4635.severity = warning +# Title : Comments should not be empty +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-4663 +dotnet_diagnostic.S4663.severity = suggestion + # Title : Using regular expressions is security-sensitive # Category : Critical Security Hotspot # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4784 @@ -4140,10 +4216,15 @@ dotnet_diagnostic.S5766.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-5773 dotnet_diagnostic.S5773.severity = warning +# Title : Regular expressions should be syntactically valid +# Category : Critical Bug +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-5856 +dotnet_diagnostic.S5856.severity = warning + # Title : Use a testable date/time provider # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-6354 -# Redundant: EA0002 +# Redundant: R9A022 dotnet_diagnostic.S6354.severity = none # Title : Azure Functions should be stateless @@ -4179,7 +4260,120 @@ dotnet_diagnostic.S6424.severity = warning # Title : Not specifying a timeout for regular expressions is security-sensitive # Category : Major Security Hotspot # Help Link: https://rules.sonarsource.com/csharp/RSPEC-6444 -dotnet_diagnostic.S6444.severity = warning +dotnet_diagnostic.S6444.severity = none + +# Title : Blocks should not be synchronized on local variables +# Category : Major Bug +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6507 +# Comment : Too many false positives +dotnet_diagnostic.S6507.severity = none + +# Title : "ExcludeFromCodeCoverage" attributes should include a justification +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6513 +dotnet_diagnostic.S6513.severity = suggestion + +# Title : Avoid using "DateTime.Now" for benchmarking or timing operations +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6561 +dotnet_diagnostic.S6561.severity = warning + +# Title : Always set the "DateTimeKind" when creating new "DateTime" instances +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6562 +# Comment : Noise +dotnet_diagnostic.S6562.severity = none + +# Title : Use UTC when recording DateTime instants +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6563 +dotnet_diagnostic.S6563.severity = none + +# Title : Use "DateTimeOffset" instead of "DateTime" +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6566 +# Comment : Noise +dotnet_diagnostic.S6566.severity = none + +# Title : Use "TimeZoneInfo.FindSystemTimeZoneById" without converting the timezones with "TimezoneConverter" +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6575 +dotnet_diagnostic.S6575.severity = warning + +# Title : Use a format provider when parsing date and time +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6580 +dotnet_diagnostic.S6580.severity = warning + +# Title : Don't hardcode the format when turning dates and times to strings +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6585 +dotnet_diagnostic.S6585.severity = none + +# Title : Use the "UnixEpoch" field instead of creating "DateTime" instances that point to the beginning of the Unix epoch +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6588 +dotnet_diagnostic.S6588.severity = warning + +# Title : "Find" method should be used instead of the "FirstOrDefault" extension +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6602 +dotnet_diagnostic.S6602.severity = none + +# Title : The collection-specific "TrueForAll" method should be used instead of the "All" extension +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6603 +dotnet_diagnostic.S6603.severity = none + +# Title : Collection-specific "Exists" method should be used instead of the "Any" extension +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6605 +dotnet_diagnostic.S6605.severity = none + +# Title : The collection should be filtered before sorting by using "Where" before "OrderBy" +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6607 +dotnet_diagnostic.S6607.severity = none + +# Title : Prefer indexing instead of "Enumerable" methods on types implementing "IList" +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6608 +dotnet_diagnostic.S6608.severity = none + +# Title : "Min/Max" properties of "Set" types should be used instead of the "Enumerable" extension methods +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6609 +dotnet_diagnostic.S6609.severity = none + +# Title : "StartsWith" and "EndsWith" overloads that take a "char" should be used instead of the ones that take a "string" +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6610 +dotnet_diagnostic.S6610.severity = none + +# Title : The lambda parameter should be used instead of capturing arguments in "ConcurrentDictionary" methods +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6612 +dotnet_diagnostic.S6612.severity = none + +# Title : "First" and "Last" properties of "LinkedList" should be used instead of the "First()" and "Last()" extension methods +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6613 +dotnet_diagnostic.S6613.severity = none + +# Title : "Contains" should be used instead of "Any" for simple equality checks +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6617 +dotnet_diagnostic.S6617.severity = none + +# Title : "string.Create" should be used instead of "FormattableString" +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6618 +dotnet_diagnostic.S6618.severity = none + +# Title : Using unsafe code blocks is security-sensitive +# Category : Major Security Hotspot +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6640 +dotnet_diagnostic.S6640.severity = warning # Title : Literal suffixes should be upper case # Category : Minor Code Smell @@ -4226,6 +4420,10 @@ dotnet_diagnostic.S9999-symbolRef.severity = warning # Category : dotnet_diagnostic.S9999-token-type.severity = warning +# Title : Analysis Warning generator +# Category : +dotnet_diagnostic.S9999-warning.severity = warning + # Title : Avoid legacy thread switching APIs # Category : Usage # Help Link: https://github.com/Microsoft/vs-threading/blob/main/doc/analyzers/VSTHRD001.md @@ -4279,6 +4477,7 @@ dotnet_diagnostic.VSTHRD102.severity = suggestion # Title : Call async methods when in an async method # Category : Usage # Help Link: https://github.com/Microsoft/vs-threading/blob/main/doc/analyzers/VSTHRD103.md +# Redundant: CA1849 dotnet_diagnostic.VSTHRD103.severity = none # Title : Offer async methods @@ -4488,11 +4687,71 @@ dotnet_diagnostic.xUnit1026.severity = warning # Help Link: https://xunit.net/xunit.analyzers/rules/xUnit1027 dotnet_diagnostic.xUnit1027.severity = error +# Title : Test method must have valid return type +# Category : Usage +# Help Link: https://xunit.net/xunit.analyzers/rules/xUnit1028 +dotnet_diagnostic.xUnit1028.severity = error + +# Title : Local functions cannot be test functions +# Category : Usage +# Help Link: https://xunit.net/xunit.analyzers/rules/xUnit1029 +dotnet_diagnostic.xUnit1029.severity = error + +# Title : Do not call ConfigureAwait(false) in test method +# Category : Usage +# Help Link: https://xunit.net/xunit.analyzers/rules/xUnit1030 +dotnet_diagnostic.xUnit1030.severity = warning + +# Title : Do not use blocking task operations in test method +# Category : Usage +# Help Link: https://xunit.net/xunit.analyzers/rules/xUnit1031 +dotnet_diagnostic.xUnit1031.severity = warning + +# Title : Test classes cannot be nested within a generic class +# Category : Usage +# Help Link: https://xunit.net/xunit.analyzers/rules/xUnit1032 +dotnet_diagnostic.xUnit1032.severity = error + # Title : Test classes decorated with 'Xunit.IClassFixture' or 'Xunit.ICollectionFixture' should add a constructor argument of type TFixture # Category : Usage # Help Link: https://xunit.net/xunit.analyzers/rules/xUnit1033 dotnet_diagnostic.xUnit1033.severity = suggestion +# Title : Null should only be used for nullable parameters +# Category : Usage +# Help Link: https://xunit.net/xunit.analyzers/rules/xUnit1034 +dotnet_diagnostic.xUnit1034.severity = warning + +# Title : The value is not convertible to the method parameter type +# Category : Usage +# Help Link: https://xunit.net/xunit.analyzers/rules/xUnit1035 +dotnet_diagnostic.xUnit1035.severity = error + +# Title : There is no matching method parameter +# Category : Usage +# Help Link: https://xunit.net/xunit.analyzers/rules/xUnit1036 +dotnet_diagnostic.xUnit1036.severity = error + +# Title : There are fewer TheoryData type arguments than required by the parameters of the test method +# Category : Usage +# Help Link: https://xunit.net/xunit.analyzers/rules/xUnit1037 +dotnet_diagnostic.xUnit1037.severity = error + +# Title : There are more TheoryData type arguments than allowed by the parameters of the test method +# Category : Usage +# Help Link: https://xunit.net/xunit.analyzers/rules/xUnit1038 +dotnet_diagnostic.xUnit1038.severity = error + +# Title : The type argument to TheoryData is not compatible with the type of the corresponding test method parameter +# Category : Usage +# Help Link: https://xunit.net/xunit.analyzers/rules/xUnit1039 +dotnet_diagnostic.xUnit1039.severity = error + +# Title : The type argument to TheoryData is nullable, while the type of the corresponding test method parameter is not +# Category : Usage +# Help Link: https://xunit.net/xunit.analyzers/rules/xUnit1040 +dotnet_diagnostic.xUnit1040.severity = warning + # Title : Constants and literals should be the expected argument # Category : Assertions # Help Link: https://xunit.net/xunit.analyzers/rules/xUnit2000 @@ -4593,7 +4852,22 @@ dotnet_diagnostic.xUnit2018.severity = warning # Help Link: https://xunit.github.io/xunit.analyzers/rules/xUnit2019 dotnet_diagnostic.xUnit2019.severity = warning -# Title : Test case classes must derive directly or indirectly from Xunit.LongLivedMarshalByRefObject +# Title : Do not use always-failing boolean assertions +# Category : Assertions +# Help Link: https://xunit.net/xunit.analyzers/rules/xUnit2020 +dotnet_diagnostic.xUnit2020.severity = warning + +# Title : Async assertions should be awaited +# Category : Assertions +# Help Link: https://xunit.net/xunit.analyzers/rules/xUnit2021 +dotnet_diagnostic.xUnit2021.severity = error + +# Title : Boolean assertions should not be negated +# Category : Assertions +# Help Link: https://xunit.net/xunit.analyzers/rules/xUnit2022 +dotnet_diagnostic.xUnit2022.severity = suggestion + +# Title : Classes which cross AppDomain boundaries must derive directly or indirectly from LongLivedMarshalByRefObject # Category : Extensibility # Help Link: https://xunit.net/xunit.analyzers/rules/xUnit3000 dotnet_diagnostic.xUnit3000.severity = error diff --git a/src/Shared/.editorconfig b/src/Shared/.editorconfig index b0dfb5bdc6c..304efe1ab9b 100644 --- a/src/Shared/.editorconfig +++ b/src/Shared/.editorconfig @@ -1,5 +1,5 @@ # Created by DiagConfig, the diagnostic config generator -# Generated : 2023-10-22 00:37:47Z +# Generated : 2024-01-25 20:57:45Z # Max Tier : 2147483647 # Attributes: general, performance, production # Analyzers : ILLink.RoslynAnalyzer, Microsoft.Analyzers.Extra, Microsoft.Analyzers.Local, Microsoft.AspNetCore.App.Analyzers, Microsoft.AspNetCore.Components.Analyzers, Microsoft.CodeAnalysis.CodeStyle, Microsoft.CodeAnalysis.CSharp.CodeStyle, Microsoft.CodeAnalysis.CSharp.NetAnalyzers, Microsoft.CodeAnalysis.NetAnalyzers, Microsoft.VisualStudio.Threading.Analyzers, Microsoft.VisualStudio.Threading.Analyzers.CSharp, SonarAnalyzer.CSharp, StyleCop.Analyzers @@ -107,7 +107,7 @@ dotnet_diagnostic.CA1001.severity = warning # Title : Types that own disposable fields should be disposable # Category : Design # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1001 -dotnet_diagnostic.CA1001.severity = warning +dotnet_diagnostic.CA1001.severity = none # Title : Do not expose generic lists # Category : Design @@ -197,6 +197,7 @@ dotnet_diagnostic.CA1028.severity = none # Category : Design # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1030 dotnet_diagnostic.CA1030.severity = warning +dotnet_code_quality.CA1030.api_surface = public # Title : Do not catch general exception types # Category : Design @@ -276,6 +277,7 @@ dotnet_diagnostic.CA1051.severity = none # Category : Design # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1052 dotnet_diagnostic.CA1052.severity = warning +dotnet_code_quality.CA1052.api_surface = all # Title : URI-like parameters should not be strings # Category : Design @@ -318,6 +320,7 @@ dotnet_diagnostic.CA1062.severity = none # Category : Design # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1063 dotnet_diagnostic.CA1063.severity = warning +dotnet_code_quality.CA1063.api_surface = public # Title : Exceptions should be public # Category : Design @@ -577,6 +580,7 @@ dotnet_diagnostic.CA1724.severity = none # Category : Naming # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1725 dotnet_diagnostic.CA1725.severity = warning +dotnet_code_quality.CA1725.api_surface = public, protected # Title : Use PascalCase for named placeholders # Category : Naming @@ -599,6 +603,7 @@ dotnet_diagnostic.CA1801.severity = none # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1802 dotnet_diagnostic.CA1802.severity = warning +dotnet_code_quality.CA1802.required_modifiers = static # Title : Use literals where appropriate # Category : Performance @@ -646,6 +651,7 @@ dotnet_diagnostic.CA1814.severity = warning # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1815 dotnet_diagnostic.CA1815.severity = warning +dotnet_code_quality.CA1815.api_surface = public # Title : Dispose methods should call SuppressFinalize # Category : Usage @@ -656,6 +662,7 @@ dotnet_diagnostic.CA1816.severity = warning # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1819 dotnet_diagnostic.CA1819.severity = warning +dotnet_code_quality.CA1819.api_surface = public # Title : Test for empty strings using string length # Category : Performance @@ -671,6 +678,7 @@ dotnet_diagnostic.CA1821.severity = warning # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1822 dotnet_diagnostic.CA1822.severity = warning +dotnet_code_quality.CA1822.api_surface = all # Title : Avoid unused private fields # Category : Performance @@ -801,7 +809,7 @@ dotnet_diagnostic.CA1847.severity = warning # Title : Use the LoggerMessage delegates # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1848 -# Comment : Use the code generated model instead. +# Comment : Use R9 logging model instead dotnet_diagnostic.CA1848.severity = none # Title : Call async methods when in an async method @@ -822,7 +830,8 @@ dotnet_diagnostic.CA1851.severity = suggestion # Title : Seal internal types # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1852 -dotnet_diagnostic.CA1852.severity = none +dotnet_diagnostic.CA1852.severity = warning +dotnet_code_quality.CA1852.ignore_internalsvisibleto = true # Title : Unnecessary call to 'Dictionary.ContainsKey(key)' # Category : Performance @@ -852,7 +861,7 @@ dotnet_diagnostic.CA1857.severity = warning # Title : Use 'StartsWith' instead of 'IndexOf' # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1858 -dotnet_diagnostic.CA1858.severity = warning +dotnet_diagnostic.CA1858.severity = suggestion # Title : Use concrete types when possible for improved performance # Category : Performance @@ -862,7 +871,7 @@ dotnet_diagnostic.CA1859.severity = warning # Title : Avoid using 'Enumerable.Any()' extension method # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1860 -dotnet_diagnostic.CA1860.severity = warning +dotnet_diagnostic.CA1860.severity = suggestion # Title : Avoid constant arrays as arguments # Category : Performance @@ -872,17 +881,17 @@ dotnet_diagnostic.CA1861.severity = suggestion # Title : Use the 'StringComparison' method overloads to perform case-insensitive string comparisons # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1862 -dotnet_diagnostic.CA1862.severity = warning +dotnet_diagnostic.CA1862.severity = suggestion # Title : Use 'CompositeFormat' # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1863 -dotnet_diagnostic.CA1863.severity = warning +dotnet_diagnostic.CA1863.severity = none # Title : Prefer the 'IDictionary.TryAdd(TKey, TValue)' method # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1864 -dotnet_diagnostic.CA1864.severity = warning +dotnet_diagnostic.CA1864.severity = suggestion # Title : Use char overload # Category : Performance @@ -902,17 +911,17 @@ dotnet_diagnostic.CA1867.severity = warning # Title : Unnecessary call to 'Contains(item)' # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1868 -dotnet_diagnostic.CA1868.severity = warning +dotnet_diagnostic.CA1868.severity = suggestion # Title : Cache and reuse 'JsonSerializerOptions' instances # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1869 -dotnet_diagnostic.CA1869.severity = warning +dotnet_diagnostic.CA1869.severity = suggestion # Title : Use a cached 'SearchValues' instance # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1870 -dotnet_diagnostic.CA1870.severity = warning +dotnet_diagnostic.CA1870.severity = suggestion # Title : Dispose objects before losing scope # Category : Reliability @@ -928,6 +937,8 @@ dotnet_diagnostic.CA2002.severity = warning # Category : Reliability # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2007 dotnet_diagnostic.CA2007.severity = warning +dotnet_code_quality.CA2007.output_kinds = all +dotnet_code_quality.CA2007.exclude_async_void_methods = false # Title : Do not create tasks without passing a TaskScheduler # Category : Reliability @@ -1048,6 +1059,7 @@ dotnet_diagnostic.CA2207.severity = warning # Category : Usage # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2208 dotnet_diagnostic.CA2208.severity = warning +dotnet_code_quality.CA2208.api_surface = all # Title : Non-constant fields should not be visible # Category : Usage @@ -1111,11 +1123,13 @@ dotnet_diagnostic.CA2229.severity = none # Category : Usage # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2231 dotnet_diagnostic.CA2231.severity = error +dotnet_code_quality.CA2231.api_surface = public # Title : Pass system uri objects instead of strings # Category : Usage # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2234 dotnet_diagnostic.CA2234.severity = warning +dotnet_code_quality.CA2234.api_surface = all # Title : Mark all non-serializable fields # Category : Usage @@ -1133,6 +1147,7 @@ dotnet_diagnostic.CA2237.severity = none # Category : Usage # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2241 dotnet_diagnostic.CA2241.severity = warning +dotnet_code_quality.CA2241.try_determine_additional_string_formatting_methods_automatically = false # Title : Test for NaN correctly # Category : Usage @@ -1850,8 +1865,8 @@ dotnet_diagnostic.IDE0005_gen.severity = none # Title : Use implicit type # Category : Style # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0007 -dotnet_diagnostic.IDE0007.severity = silent -csharp_style_var_elsewhere = true +dotnet_diagnostic.IDE0007.severity = suggestion +csharp_style_var_elsewhere = false csharp_style_var_for_built_in_types = false csharp_style_var_when_type_is_apparent = true @@ -1952,19 +1967,19 @@ csharp_style_expression_bodied_accessors = true # Title : Simplify collection initialization # Category : Style # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0028 -dotnet_diagnostic.IDE0028.severity = warning +dotnet_diagnostic.IDE0028.severity = suggestion dotnet_style_collection_initializer = true # Title : Use coalesce expression # Category : Style # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0029 -dotnet_diagnostic.IDE0029.severity = warning +dotnet_diagnostic.IDE0029.severity = suggestion dotnet_style_coalesce_expression = true # Title : Use coalesce expression # Category : Style # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0030 -dotnet_diagnostic.IDE0030.severity = warning +dotnet_diagnostic.IDE0030.severity = suggestion dotnet_style_coalesce_expression = true # Title : Use null propagation @@ -2300,7 +2315,7 @@ csharp_style_prefer_not_pattern = true # Title : Use 'new(...)' # Category : Style # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0090 -dotnet_diagnostic.IDE0090.severity = warning +dotnet_diagnostic.IDE0090.severity = suggestion csharp_style_implicit_object_creation_when_type_is_apparent = true # Title : Remove redundant equality @@ -2403,7 +2418,8 @@ dotnet_diagnostic.IDE0250.severity = warning # Title : Make member 'readonly' # Category : Style # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0251 -dotnet_diagnostic.IDE0251.severity = none +dotnet_diagnostic.IDE0251.severity = warning +csharp_style_prefer_readonly_struct_members = true # Title : Use pattern matching # Category : Style @@ -2433,7 +2449,7 @@ dotnet_diagnostic.IDE0300.severity = none # Title : Simplify collection initialization # Category : Style # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0301 -dotnet_diagnostic.IDE0301.severity = suggestion +dotnet_diagnostic.IDE0301.severity = none # Title : Simplify collection initialization # Category : Style @@ -2901,7 +2917,7 @@ dotnet_diagnostic.S103.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-104 dotnet_diagnostic.S104.severity = warning -# Title : Destructors should not throw exceptions +# Title : Finalizers should not throw exceptions # Category : Blocker Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1048 # Redundant: CA1065 @@ -2977,7 +2993,7 @@ dotnet_diagnostic.S1110.severity = none # Redundant: SA1106 dotnet_diagnostic.S1116.severity = none -# Title : Local variables should not shadow class fields +# Title : Local variables should not shadow class fields or properties # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1117 dotnet_diagnostic.S1117.severity = warning @@ -3020,6 +3036,11 @@ dotnet_diagnostic.S1128.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-113 dotnet_diagnostic.S113.severity = none +# Title : Deprecated code should be removed +# Category : Info Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-1133 +dotnet_diagnostic.S1133.severity = suggestion + # Title : Track uses of "FIXME" tags # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1134 @@ -3092,7 +3113,7 @@ dotnet_diagnostic.S1192.severity = suggestion # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1199 dotnet_diagnostic.S1199.severity = warning -# Title : Classes should not be coupled to too many other classes (Single Responsibility Principle) +# Title : Classes should not be coupled to too many other classes # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1200 dotnet_diagnostic.S1200.severity = none @@ -3273,7 +3294,7 @@ dotnet_diagnostic.S1699.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1751 dotnet_diagnostic.S1751.severity = warning -# Title : Identical expressions should not be used on both sides of a binary operator +# Title : Identical expressions should not be used on both sides of operators # Category : Major Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1764 dotnet_diagnostic.S1764.severity = warning @@ -3325,7 +3346,7 @@ dotnet_diagnostic.S1939.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1940 dotnet_diagnostic.S1940.severity = warning -# Title : Inappropriate casts should not be made +# Title : Invalid casts should be avoided # Category : Critical Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1944 dotnet_diagnostic.S1944.severity = warning @@ -3362,6 +3383,11 @@ dotnet_diagnostic.S2077.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2092 dotnet_diagnostic.S2092.severity = warning +# Title : Classes should not be empty +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2094 +dotnet_diagnostic.S2094.severity = none + # Title : Collections should not be passed as arguments to their own methods # Category : Major Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2114 @@ -3387,6 +3413,11 @@ dotnet_diagnostic.S2148.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2156 dotnet_diagnostic.S2156.severity = warning +# Title : Classes named like "Exception" should extend "Exception" or a subclass +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2166 +dotnet_diagnostic.S2166.severity = warning + # Title : Short-circuit logic should be used in boolean contexts # Category : Blocker Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2178 @@ -3402,12 +3433,12 @@ dotnet_diagnostic.S2183.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2184 dotnet_diagnostic.S2184.severity = warning -# Title : TestCases should contain tests +# Title : Test classes should contain at least one test case # Category : Blocker Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2187 dotnet_diagnostic.S2187.severity = warning -# Title : Recursion should not be infinite +# Title : Loops and recursions should not be infinite # Category : Blocker Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2190 dotnet_diagnostic.S2190.severity = warning @@ -3417,7 +3448,12 @@ dotnet_diagnostic.S2190.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2197 dotnet_diagnostic.S2197.severity = warning -# Title : Return values from functions without side effects should not be ignored +# Title : Unnecessary mathematical comparisons should not be made +# Category : Critical Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2198 +dotnet_diagnostic.S2198.severity = warning + +# Title : Methods without side effects should not have their return values ignored # Category : Major Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2201 # Redundant: CA1806 @@ -3453,7 +3489,7 @@ dotnet_diagnostic.S2225.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2228 dotnet_diagnostic.S2228.severity = warning -# Title : Parameters should be passed in the correct order +# Title : Arguments should be passed in the same order as the method parameters # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2234 dotnet_diagnostic.S2234.severity = warning @@ -3630,11 +3666,17 @@ dotnet_diagnostic.S2387.severity = warning # Redundant: CA1005 dotnet_diagnostic.S2436.severity = none -# Title : Silly bit operations should not be performed +# Title : Unnecessary bit operations should not be performed # Category : Blocker Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2437 dotnet_diagnostic.S2437.severity = warning +# Title : Blocks should be synchronized on read-only fields +# Category : Major Bug +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2445 +# Comment : Noise +dotnet_diagnostic.S2445.severity = none + # Title : Whitespace and control characters in string literals should be explicit # Category : Critical Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2479 @@ -3648,8 +3690,7 @@ dotnet_diagnostic.S2486.severity = warning # Title : Shared resources should not be used for locking # Category : Critical Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2551 -# Redundant: CA2002 -dotnet_diagnostic.S2551.severity = none +dotnet_diagnostic.S2551.severity = warning # Title : Conditionally executed code should be reachable # Category : Major Bug @@ -3660,7 +3701,8 @@ dotnet_diagnostic.S2583.severity = none # Title : Boolean expressions should not be gratuitous # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2589 -dotnet_diagnostic.S2589.severity = warning +# Comment : Too many false positives. +dotnet_diagnostic.S2589.severity = none # Title : Setting loose file permissions is security-sensitive # Category : Major Security Hotspot @@ -3717,7 +3759,7 @@ dotnet_diagnostic.S2743.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2755 dotnet_diagnostic.S2755.severity = warning -# Title : "=+" should not be used instead of "+=" +# Title : Non-existent operators like "=+" should not be used # Category : Major Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2757 dotnet_diagnostic.S2757.severity = warning @@ -3742,6 +3784,11 @@ dotnet_diagnostic.S2761.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2857 dotnet_diagnostic.S2857.severity = warning +# Title : "Thread.Sleep" should not be used in tests +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2925 +dotnet_diagnostic.S2925.severity = none + # Title : "IDisposables" should be disposed # Category : Blocker Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2930 @@ -3780,6 +3827,11 @@ dotnet_diagnostic.S2953.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2955 dotnet_diagnostic.S2955.severity = warning +# Title : Assertions should be complete +# Category : Blocker Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2970 +dotnet_diagnostic.S2970.severity = warning + # Title : "IEnumerable" LINQs should be simplified # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2971 @@ -3831,6 +3883,11 @@ dotnet_diagnostic.S3059.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3060 dotnet_diagnostic.S3060.severity = warning +# Title : "StringBuilder" data should be used +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-3063 +dotnet_diagnostic.S3063.severity = warning + # Title : "async" methods should not return "void" # Category : Major Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3168 @@ -3888,7 +3945,7 @@ dotnet_diagnostic.S3235.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3236 dotnet_diagnostic.S3236.severity = warning -# Title : "value" parameters should be used +# Title : "value" contextual keyword should be used # Category : Blocker Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3237 dotnet_diagnostic.S3237.severity = warning @@ -3953,12 +4010,13 @@ dotnet_diagnostic.S3256.severity = warning # Title : Declarations and initializations should be as concise as possible # Category : Minor Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3257 -dotnet_diagnostic.S3257.severity = warning +# Comment : Too many false positives +dotnet_diagnostic.S3257.severity = none # Title : Non-derived "private" classes and records should be "sealed" # Category : Minor Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3260 -# Redundant: CA1852 +# Redundant: R9A013 dotnet_diagnostic.S3260.severity = none # Title : Namespaces should not be empty @@ -4022,6 +4080,11 @@ dotnet_diagnostic.S3353.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3358 dotnet_diagnostic.S3358.severity = warning +# Title : Date and time should not be used as a type for primary keys +# Category : Minor Bug +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-3363 +dotnet_diagnostic.S3363.severity = warning + # Title : "this" should not be exposed from constructors # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3366 @@ -4038,6 +4101,11 @@ dotnet_diagnostic.S3376.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3397 dotnet_diagnostic.S3397.severity = warning +# Title : "private" methods called only by inner classes should be moved to those classes +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-3398 +dotnet_diagnostic.S3398.severity = warning + # Title : Methods should not return constants # Category : Minor Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3400 @@ -4048,7 +4116,7 @@ dotnet_diagnostic.S3400.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3415 dotnet_diagnostic.S3415.severity = warning -# Title : Method overloads with default parameter values should not overlap +# Title : Method overloads with default parameter values should not overlap # Category : Blocker Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3427 dotnet_diagnostic.S3427.severity = warning @@ -4246,6 +4314,11 @@ dotnet_diagnostic.S3876.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3877 dotnet_diagnostic.S3877.severity = warning +# Title : Arrays should not be created for params parameters +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-3878 +dotnet_diagnostic.S3878.severity = suggestion + # Title : Finalizers should not be empty # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3880 @@ -4271,7 +4344,7 @@ dotnet_diagnostic.S3885.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3887 dotnet_diagnostic.S3887.severity = warning -# Title : Neither "Thread.Resume" nor "Thread.Suspend" should be used +# Title : "Thread.Resume" and "Thread.Suspend" should not be used # Category : Blocker Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3889 dotnet_diagnostic.S3889.severity = warning @@ -4511,7 +4584,7 @@ dotnet_diagnostic.S4022.severity = warning # Title : Interfaces should not be empty # Category : Minor Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4023 -dotnet_diagnostic.S4023.severity = warning +dotnet_diagnostic.S4023.severity = none # Title : Child class fields should not differ from parent class fields only by capitalization # Category : Critical Code Smell @@ -4649,7 +4722,8 @@ dotnet_diagnostic.S4144.severity = warning # Title : Empty collections should not be accessed or iterated # Category : Minor Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4158 -dotnet_diagnostic.S4158.severity = warning +# Comment : Too many false positives +dotnet_diagnostic.S4158.severity = none # Title : Classes should implement their "ExportAttribute" interfaces # Category : Blocker Bug @@ -4783,6 +4857,11 @@ dotnet_diagnostic.S4507.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4524 dotnet_diagnostic.S4524.severity = warning +# Title : "DebuggerDisplayAttribute" strings should reference existing members +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-4545 +dotnet_diagnostic.S4545.severity = warning + # Title : ASP.NET HTTP request validation feature should not be disabled # Category : Major Vulnerability # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4564 @@ -4803,11 +4882,16 @@ dotnet_diagnostic.S4583.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4586 dotnet_diagnostic.S4586.severity = warning -# Title : String offset-based methods should be preferred for finding substrings from offsets +# Title : Start index should be used instead of calling Substring # Category : Critical Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4635 dotnet_diagnostic.S4635.severity = warning +# Title : Comments should not be empty +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-4663 +dotnet_diagnostic.S4663.severity = suggestion + # Title : Using regular expressions is security-sensitive # Category : Critical Security Hotspot # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4784 @@ -4919,10 +5003,15 @@ dotnet_diagnostic.S5766.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-5773 dotnet_diagnostic.S5773.severity = warning +# Title : Regular expressions should be syntactically valid +# Category : Critical Bug +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-5856 +dotnet_diagnostic.S5856.severity = warning + # Title : Use a testable date/time provider # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-6354 -# Redundant: EA0002 +# Redundant: R9A022 dotnet_diagnostic.S6354.severity = none # Title : Azure Functions should be stateless @@ -4960,6 +5049,119 @@ dotnet_diagnostic.S6424.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-6444 dotnet_diagnostic.S6444.severity = warning +# Title : Blocks should not be synchronized on local variables +# Category : Major Bug +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6507 +# Comment : Too many false positives +dotnet_diagnostic.S6507.severity = none + +# Title : "ExcludeFromCodeCoverage" attributes should include a justification +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6513 +dotnet_diagnostic.S6513.severity = suggestion + +# Title : Avoid using "DateTime.Now" for benchmarking or timing operations +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6561 +dotnet_diagnostic.S6561.severity = warning + +# Title : Always set the "DateTimeKind" when creating new "DateTime" instances +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6562 +# Comment : Noise +dotnet_diagnostic.S6562.severity = none + +# Title : Use UTC when recording DateTime instants +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6563 +dotnet_diagnostic.S6563.severity = none + +# Title : Use "DateTimeOffset" instead of "DateTime" +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6566 +# Comment : Noise +dotnet_diagnostic.S6566.severity = none + +# Title : Use "TimeZoneInfo.FindSystemTimeZoneById" without converting the timezones with "TimezoneConverter" +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6575 +dotnet_diagnostic.S6575.severity = warning + +# Title : Use a format provider when parsing date and time +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6580 +dotnet_diagnostic.S6580.severity = warning + +# Title : Don't hardcode the format when turning dates and times to strings +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6585 +dotnet_diagnostic.S6585.severity = none + +# Title : Use the "UnixEpoch" field instead of creating "DateTime" instances that point to the beginning of the Unix epoch +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6588 +dotnet_diagnostic.S6588.severity = warning + +# Title : "Find" method should be used instead of the "FirstOrDefault" extension +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6602 +dotnet_diagnostic.S6602.severity = warning + +# Title : The collection-specific "TrueForAll" method should be used instead of the "All" extension +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6603 +dotnet_diagnostic.S6603.severity = warning + +# Title : Collection-specific "Exists" method should be used instead of the "Any" extension +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6605 +dotnet_diagnostic.S6605.severity = warning + +# Title : The collection should be filtered before sorting by using "Where" before "OrderBy" +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6607 +dotnet_diagnostic.S6607.severity = warning + +# Title : Prefer indexing instead of "Enumerable" methods on types implementing "IList" +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6608 +dotnet_diagnostic.S6608.severity = warning + +# Title : "Min/Max" properties of "Set" types should be used instead of the "Enumerable" extension methods +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6609 +dotnet_diagnostic.S6609.severity = warning + +# Title : "StartsWith" and "EndsWith" overloads that take a "char" should be used instead of the ones that take a "string" +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6610 +dotnet_diagnostic.S6610.severity = warning + +# Title : The lambda parameter should be used instead of capturing arguments in "ConcurrentDictionary" methods +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6612 +dotnet_diagnostic.S6612.severity = warning + +# Title : "First" and "Last" properties of "LinkedList" should be used instead of the "First()" and "Last()" extension methods +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6613 +dotnet_diagnostic.S6613.severity = warning + +# Title : "Contains" should be used instead of "Any" for simple equality checks +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6617 +dotnet_diagnostic.S6617.severity = warning + +# Title : "string.Create" should be used instead of "FormattableString" +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6618 +dotnet_diagnostic.S6618.severity = warning + +# Title : Using unsafe code blocks is security-sensitive +# Category : Major Security Hotspot +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6640 +dotnet_diagnostic.S6640.severity = warning + # Title : Literal suffixes should be upper case # Category : Minor Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-818 @@ -5005,6 +5207,10 @@ dotnet_diagnostic.S9999-symbolRef.severity = warning # Category : dotnet_diagnostic.S9999-token-type.severity = warning +# Title : Analysis Warning generator +# Category : +dotnet_diagnostic.S9999-warning.severity = warning + # Title : XML comment analysis disabled # Category : StyleCop.CSharp.SpecialRules # Help Link: https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA0001.md @@ -5284,7 +5490,8 @@ dotnet_diagnostic.SA1118.severity = warning # Title : Statement should not use unnecessary parenthesis # Category : StyleCop.CSharp.MaintainabilityRules # Help Link: https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1119.md -dotnet_diagnostic.SA1119.severity = warning +# Redundant: IDE0047 +dotnet_diagnostic.SA1119.severity = none # Title : Statement should not use unnecessary parenthesis # Category : StyleCop.CSharp.MaintainabilityRules @@ -6099,7 +6306,8 @@ dotnet_diagnostic.VSTHRD102.severity = suggestion # Title : Call async methods when in an async method # Category : Usage # Help Link: https://github.com/Microsoft/vs-threading/blob/main/doc/analyzers/VSTHRD103.md -dotnet_diagnostic.VSTHRD103.severity = warning +# Redundant: CA1849 +dotnet_diagnostic.VSTHRD103.severity = none # Title : Offer async methods # Category : Usage diff --git a/test/.editorconfig b/test/.editorconfig index 2368ab81caa..2666a6b9507 100644 --- a/test/.editorconfig +++ b/test/.editorconfig @@ -1,5 +1,5 @@ # Created by DiagConfig, the diagnostic config generator -# Generated : 2023-10-22 00:37:48Z +# Generated : 2024-01-25 20:57:46Z # Max Tier : 2147483647 # Attributes: general, test # Analyzers : ILLink.RoslynAnalyzer, Microsoft.Analyzers.Extra, Microsoft.Analyzers.Local, Microsoft.AspNetCore.App.Analyzers, Microsoft.AspNetCore.Components.Analyzers, Microsoft.CodeAnalysis.CodeStyle, Microsoft.CodeAnalysis.CSharp.CodeStyle, Microsoft.CodeAnalysis.CSharp.NetAnalyzers, Microsoft.CodeAnalysis.NetAnalyzers, Microsoft.VisualStudio.Threading.Analyzers, Microsoft.VisualStudio.Threading.Analyzers.CSharp, SonarAnalyzer.CSharp, StyleCop.Analyzers, xunit.analyzers @@ -107,7 +107,7 @@ dotnet_diagnostic.CA1001.severity = warning # Title : Types that own disposable fields should be disposable # Category : Design # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1001 -dotnet_diagnostic.CA1001.severity = warning +dotnet_diagnostic.CA1001.severity = none # Title : Do not expose generic lists # Category : Design @@ -195,6 +195,7 @@ dotnet_diagnostic.CA1028.severity = none # Category : Design # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1030 dotnet_diagnostic.CA1030.severity = warning +dotnet_code_quality.CA1030.api_surface = public # Title : Do not catch general exception types # Category : Design @@ -274,6 +275,7 @@ dotnet_diagnostic.CA1051.severity = none # Category : Design # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1052 dotnet_diagnostic.CA1052.severity = warning +dotnet_code_quality.CA1052.api_surface = all # Title : URI-like parameters should not be strings # Category : Design @@ -316,6 +318,7 @@ dotnet_diagnostic.CA1062.severity = none # Category : Design # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1063 dotnet_diagnostic.CA1063.severity = warning +dotnet_code_quality.CA1063.api_surface = public # Title : Exceptions should be public # Category : Design @@ -574,6 +577,7 @@ dotnet_diagnostic.CA1724.severity = none # Category : Naming # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1725 dotnet_diagnostic.CA1725.severity = warning +dotnet_code_quality.CA1725.api_surface = public, protected # Title : Use PascalCase for named placeholders # Category : Naming @@ -668,6 +672,7 @@ dotnet_diagnostic.CA1821.severity = none # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1822 dotnet_diagnostic.CA1822.severity = warning +dotnet_code_quality.CA1822.api_surface = all # Title : Avoid unused private fields # Category : Performance @@ -798,7 +803,7 @@ dotnet_diagnostic.CA1847.severity = none # Title : Use the LoggerMessage delegates # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1848 -# Comment : Use the code generated model instead. +# Comment : Use R9 logging model instead dotnet_diagnostic.CA1848.severity = none # Title : Call async methods when in an async method @@ -849,7 +854,7 @@ dotnet_diagnostic.CA1857.severity = warning # Title : Use 'StartsWith' instead of 'IndexOf' # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1858 -dotnet_diagnostic.CA1858.severity = none +dotnet_diagnostic.CA1858.severity = suggestion # Title : Use concrete types when possible for improved performance # Category : Performance @@ -859,7 +864,7 @@ dotnet_diagnostic.CA1859.severity = none # Title : Avoid using 'Enumerable.Any()' extension method # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1860 -dotnet_diagnostic.CA1860.severity = none +dotnet_diagnostic.CA1860.severity = suggestion # Title : Avoid constant arrays as arguments # Category : Performance @@ -869,7 +874,7 @@ dotnet_diagnostic.CA1861.severity = suggestion # Title : Use the 'StringComparison' method overloads to perform case-insensitive string comparisons # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1862 -dotnet_diagnostic.CA1862.severity = none +dotnet_diagnostic.CA1862.severity = suggestion # Title : Use 'CompositeFormat' # Category : Performance @@ -904,12 +909,12 @@ dotnet_diagnostic.CA1868.severity = suggestion # Title : Cache and reuse 'JsonSerializerOptions' instances # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1869 -dotnet_diagnostic.CA1869.severity = none +dotnet_diagnostic.CA1869.severity = suggestion # Title : Use a cached 'SearchValues' instance # Category : Performance # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1870 -dotnet_diagnostic.CA1870.severity = none +dotnet_diagnostic.CA1870.severity = suggestion # Title : Dispose objects before losing scope # Category : Reliability @@ -1045,6 +1050,7 @@ dotnet_diagnostic.CA2207.severity = none # Category : Usage # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2208 dotnet_diagnostic.CA2208.severity = warning +dotnet_code_quality.CA2208.api_surface = all # Title : Non-constant fields should not be visible # Category : Usage @@ -1108,6 +1114,7 @@ dotnet_diagnostic.CA2229.severity = none # Category : Usage # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2231 dotnet_diagnostic.CA2231.severity = error +dotnet_code_quality.CA2231.api_surface = public # Title : Pass system uri objects instead of strings # Category : Usage @@ -1130,6 +1137,7 @@ dotnet_diagnostic.CA2237.severity = none # Category : Usage # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2241 dotnet_diagnostic.CA2241.severity = warning +dotnet_code_quality.CA2241.try_determine_additional_string_formatting_methods_automatically = false # Title : Test for NaN correctly # Category : Usage @@ -1847,8 +1855,8 @@ dotnet_diagnostic.IDE0005_gen.severity = none # Title : Use implicit type # Category : Style # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0007 -dotnet_diagnostic.IDE0007.severity = silent -csharp_style_var_elsewhere = true +dotnet_diagnostic.IDE0007.severity = suggestion +csharp_style_var_elsewhere = false csharp_style_var_for_built_in_types = false csharp_style_var_when_type_is_apparent = true @@ -1949,19 +1957,19 @@ csharp_style_expression_bodied_accessors = true # Title : Simplify collection initialization # Category : Style # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0028 -dotnet_diagnostic.IDE0028.severity = warning +dotnet_diagnostic.IDE0028.severity = suggestion dotnet_style_collection_initializer = true # Title : Use coalesce expression # Category : Style # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0029 -dotnet_diagnostic.IDE0029.severity = warning +dotnet_diagnostic.IDE0029.severity = suggestion dotnet_style_coalesce_expression = true # Title : Use coalesce expression # Category : Style # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0030 -dotnet_diagnostic.IDE0030.severity = warning +dotnet_diagnostic.IDE0030.severity = suggestion dotnet_style_coalesce_expression = true # Title : Use null propagation @@ -2296,7 +2304,7 @@ csharp_style_prefer_not_pattern = true # Title : Use 'new(...)' # Category : Style # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0090 -dotnet_diagnostic.IDE0090.severity = warning +dotnet_diagnostic.IDE0090.severity = suggestion csharp_style_implicit_object_creation_when_type_is_apparent = true # Title : Remove redundant equality @@ -2399,7 +2407,8 @@ dotnet_diagnostic.IDE0250.severity = warning # Title : Make member 'readonly' # Category : Style # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0251 -dotnet_diagnostic.IDE0251.severity = none +dotnet_diagnostic.IDE0251.severity = warning +csharp_style_prefer_readonly_struct_members = true # Title : Use pattern matching # Category : Style @@ -2429,7 +2438,7 @@ dotnet_diagnostic.IDE0300.severity = none # Title : Simplify collection initialization # Category : Style # Help Link: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0301 -dotnet_diagnostic.IDE0301.severity = suggestion +dotnet_diagnostic.IDE0301.severity = none # Title : Simplify collection initialization # Category : Style @@ -2897,7 +2906,7 @@ dotnet_diagnostic.S103.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-104 dotnet_diagnostic.S104.severity = warning -# Title : Destructors should not throw exceptions +# Title : Finalizers should not throw exceptions # Category : Blocker Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1048 # Redundant: CA1065 @@ -2973,7 +2982,7 @@ dotnet_diagnostic.S1110.severity = none # Redundant: SA1106 dotnet_diagnostic.S1116.severity = none -# Title : Local variables should not shadow class fields +# Title : Local variables should not shadow class fields or properties # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1117 dotnet_diagnostic.S1117.severity = warning @@ -3016,6 +3025,11 @@ dotnet_diagnostic.S1128.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-113 dotnet_diagnostic.S113.severity = none +# Title : Deprecated code should be removed +# Category : Info Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-1133 +dotnet_diagnostic.S1133.severity = suggestion + # Title : Track uses of "FIXME" tags # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1134 @@ -3088,7 +3102,7 @@ dotnet_diagnostic.S1192.severity = suggestion # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1199 dotnet_diagnostic.S1199.severity = warning -# Title : Classes should not be coupled to too many other classes (Single Responsibility Principle) +# Title : Classes should not be coupled to too many other classes # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1200 dotnet_diagnostic.S1200.severity = none @@ -3269,7 +3283,7 @@ dotnet_diagnostic.S1699.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1751 dotnet_diagnostic.S1751.severity = warning -# Title : Identical expressions should not be used on both sides of a binary operator +# Title : Identical expressions should not be used on both sides of operators # Category : Major Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1764 dotnet_diagnostic.S1764.severity = warning @@ -3321,7 +3335,7 @@ dotnet_diagnostic.S1939.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1940 dotnet_diagnostic.S1940.severity = warning -# Title : Inappropriate casts should not be made +# Title : Invalid casts should be avoided # Category : Critical Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-1944 dotnet_diagnostic.S1944.severity = warning @@ -3358,6 +3372,11 @@ dotnet_diagnostic.S2077.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2092 dotnet_diagnostic.S2092.severity = warning +# Title : Classes should not be empty +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2094 +dotnet_diagnostic.S2094.severity = none + # Title : Collections should not be passed as arguments to their own methods # Category : Major Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2114 @@ -3383,6 +3402,11 @@ dotnet_diagnostic.S2148.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2156 dotnet_diagnostic.S2156.severity = warning +# Title : Classes named like "Exception" should extend "Exception" or a subclass +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2166 +dotnet_diagnostic.S2166.severity = warning + # Title : Short-circuit logic should be used in boolean contexts # Category : Blocker Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2178 @@ -3398,12 +3422,12 @@ dotnet_diagnostic.S2183.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2184 dotnet_diagnostic.S2184.severity = warning -# Title : TestCases should contain tests +# Title : Test classes should contain at least one test case # Category : Blocker Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2187 dotnet_diagnostic.S2187.severity = warning -# Title : Recursion should not be infinite +# Title : Loops and recursions should not be infinite # Category : Blocker Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2190 dotnet_diagnostic.S2190.severity = warning @@ -3413,7 +3437,12 @@ dotnet_diagnostic.S2190.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2197 dotnet_diagnostic.S2197.severity = warning -# Title : Return values from functions without side effects should not be ignored +# Title : Unnecessary mathematical comparisons should not be made +# Category : Critical Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2198 +dotnet_diagnostic.S2198.severity = warning + +# Title : Methods without side effects should not have their return values ignored # Category : Major Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2201 # Redundant: CA1806 @@ -3449,7 +3478,7 @@ dotnet_diagnostic.S2225.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2228 dotnet_diagnostic.S2228.severity = none -# Title : Parameters should be passed in the correct order +# Title : Arguments should be passed in the same order as the method parameters # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2234 dotnet_diagnostic.S2234.severity = warning @@ -3626,11 +3655,17 @@ dotnet_diagnostic.S2387.severity = warning # Redundant: CA1005 dotnet_diagnostic.S2436.severity = none -# Title : Silly bit operations should not be performed +# Title : Unnecessary bit operations should not be performed # Category : Blocker Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2437 dotnet_diagnostic.S2437.severity = warning +# Title : Blocks should be synchronized on read-only fields +# Category : Major Bug +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2445 +# Comment : Noise +dotnet_diagnostic.S2445.severity = none + # Title : Whitespace and control characters in string literals should be explicit # Category : Critical Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2479 @@ -3644,8 +3679,7 @@ dotnet_diagnostic.S2486.severity = warning # Title : Shared resources should not be used for locking # Category : Critical Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2551 -# Redundant: CA2002 -dotnet_diagnostic.S2551.severity = none +dotnet_diagnostic.S2551.severity = warning # Title : Conditionally executed code should be reachable # Category : Major Bug @@ -3656,7 +3690,8 @@ dotnet_diagnostic.S2583.severity = none # Title : Boolean expressions should not be gratuitous # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2589 -dotnet_diagnostic.S2589.severity = warning +# Comment : Too many false positives. +dotnet_diagnostic.S2589.severity = none # Title : Setting loose file permissions is security-sensitive # Category : Major Security Hotspot @@ -3713,7 +3748,7 @@ dotnet_diagnostic.S2743.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2755 dotnet_diagnostic.S2755.severity = warning -# Title : "=+" should not be used instead of "+=" +# Title : Non-existent operators like "=+" should not be used # Category : Major Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2757 dotnet_diagnostic.S2757.severity = warning @@ -3738,6 +3773,11 @@ dotnet_diagnostic.S2761.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2857 dotnet_diagnostic.S2857.severity = warning +# Title : "Thread.Sleep" should not be used in tests +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2925 +dotnet_diagnostic.S2925.severity = none + # Title : "IDisposables" should be disposed # Category : Blocker Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2930 @@ -3776,6 +3816,11 @@ dotnet_diagnostic.S2953.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2955 dotnet_diagnostic.S2955.severity = warning +# Title : Assertions should be complete +# Category : Blocker Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-2970 +dotnet_diagnostic.S2970.severity = warning + # Title : "IEnumerable" LINQs should be simplified # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-2971 @@ -3827,6 +3872,11 @@ dotnet_diagnostic.S3059.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3060 dotnet_diagnostic.S3060.severity = warning +# Title : "StringBuilder" data should be used +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-3063 +dotnet_diagnostic.S3063.severity = warning + # Title : "async" methods should not return "void" # Category : Major Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3168 @@ -3884,7 +3934,7 @@ dotnet_diagnostic.S3235.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3236 dotnet_diagnostic.S3236.severity = warning -# Title : "value" parameters should be used +# Title : "value" contextual keyword should be used # Category : Blocker Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3237 dotnet_diagnostic.S3237.severity = warning @@ -3949,12 +3999,13 @@ dotnet_diagnostic.S3256.severity = warning # Title : Declarations and initializations should be as concise as possible # Category : Minor Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3257 -dotnet_diagnostic.S3257.severity = warning +# Comment : Too many false positives +dotnet_diagnostic.S3257.severity = none # Title : Non-derived "private" classes and records should be "sealed" # Category : Minor Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3260 -# Redundant: CA1852 +# Redundant: R9A013 dotnet_diagnostic.S3260.severity = none # Title : Namespaces should not be empty @@ -4018,6 +4069,11 @@ dotnet_diagnostic.S3353.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3358 dotnet_diagnostic.S3358.severity = warning +# Title : Date and time should not be used as a type for primary keys +# Category : Minor Bug +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-3363 +dotnet_diagnostic.S3363.severity = warning + # Title : "this" should not be exposed from constructors # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3366 @@ -4034,6 +4090,11 @@ dotnet_diagnostic.S3376.severity = none # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3397 dotnet_diagnostic.S3397.severity = warning +# Title : "private" methods called only by inner classes should be moved to those classes +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-3398 +dotnet_diagnostic.S3398.severity = warning + # Title : Methods should not return constants # Category : Minor Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3400 @@ -4044,7 +4105,7 @@ dotnet_diagnostic.S3400.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3415 dotnet_diagnostic.S3415.severity = warning -# Title : Method overloads with default parameter values should not overlap +# Title : Method overloads with default parameter values should not overlap # Category : Blocker Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3427 dotnet_diagnostic.S3427.severity = warning @@ -4242,6 +4303,11 @@ dotnet_diagnostic.S3876.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3877 dotnet_diagnostic.S3877.severity = none +# Title : Arrays should not be created for params parameters +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-3878 +dotnet_diagnostic.S3878.severity = suggestion + # Title : Finalizers should not be empty # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3880 @@ -4267,7 +4333,7 @@ dotnet_diagnostic.S3885.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3887 dotnet_diagnostic.S3887.severity = warning -# Title : Neither "Thread.Resume" nor "Thread.Suspend" should be used +# Title : "Thread.Resume" and "Thread.Suspend" should not be used # Category : Blocker Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-3889 dotnet_diagnostic.S3889.severity = warning @@ -4507,7 +4573,7 @@ dotnet_diagnostic.S4022.severity = warning # Title : Interfaces should not be empty # Category : Minor Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4023 -dotnet_diagnostic.S4023.severity = warning +dotnet_diagnostic.S4023.severity = none # Title : Child class fields should not differ from parent class fields only by capitalization # Category : Critical Code Smell @@ -4645,7 +4711,8 @@ dotnet_diagnostic.S4144.severity = warning # Title : Empty collections should not be accessed or iterated # Category : Minor Bug # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4158 -dotnet_diagnostic.S4158.severity = warning +# Comment : Too many false positives +dotnet_diagnostic.S4158.severity = none # Title : Classes should implement their "ExportAttribute" interfaces # Category : Blocker Bug @@ -4779,6 +4846,11 @@ dotnet_diagnostic.S4507.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4524 dotnet_diagnostic.S4524.severity = warning +# Title : "DebuggerDisplayAttribute" strings should reference existing members +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-4545 +dotnet_diagnostic.S4545.severity = warning + # Title : ASP.NET HTTP request validation feature should not be disabled # Category : Major Vulnerability # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4564 @@ -4799,11 +4871,16 @@ dotnet_diagnostic.S4583.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4586 dotnet_diagnostic.S4586.severity = warning -# Title : String offset-based methods should be preferred for finding substrings from offsets +# Title : Start index should be used instead of calling Substring # Category : Critical Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4635 dotnet_diagnostic.S4635.severity = warning +# Title : Comments should not be empty +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-4663 +dotnet_diagnostic.S4663.severity = suggestion + # Title : Using regular expressions is security-sensitive # Category : Critical Security Hotspot # Help Link: https://rules.sonarsource.com/csharp/RSPEC-4784 @@ -4915,10 +4992,15 @@ dotnet_diagnostic.S5766.severity = warning # Help Link: https://rules.sonarsource.com/csharp/RSPEC-5773 dotnet_diagnostic.S5773.severity = warning +# Title : Regular expressions should be syntactically valid +# Category : Critical Bug +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-5856 +dotnet_diagnostic.S5856.severity = warning + # Title : Use a testable date/time provider # Category : Major Code Smell # Help Link: https://rules.sonarsource.com/csharp/RSPEC-6354 -# Redundant: EA0002 +# Redundant: R9A022 dotnet_diagnostic.S6354.severity = none # Title : Azure Functions should be stateless @@ -4954,7 +5036,120 @@ dotnet_diagnostic.S6424.severity = warning # Title : Not specifying a timeout for regular expressions is security-sensitive # Category : Major Security Hotspot # Help Link: https://rules.sonarsource.com/csharp/RSPEC-6444 -dotnet_diagnostic.S6444.severity = warning +dotnet_diagnostic.S6444.severity = none + +# Title : Blocks should not be synchronized on local variables +# Category : Major Bug +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6507 +# Comment : Too many false positives +dotnet_diagnostic.S6507.severity = none + +# Title : "ExcludeFromCodeCoverage" attributes should include a justification +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6513 +dotnet_diagnostic.S6513.severity = suggestion + +# Title : Avoid using "DateTime.Now" for benchmarking or timing operations +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6561 +dotnet_diagnostic.S6561.severity = warning + +# Title : Always set the "DateTimeKind" when creating new "DateTime" instances +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6562 +# Comment : Noise +dotnet_diagnostic.S6562.severity = none + +# Title : Use UTC when recording DateTime instants +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6563 +dotnet_diagnostic.S6563.severity = none + +# Title : Use "DateTimeOffset" instead of "DateTime" +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6566 +# Comment : Noise +dotnet_diagnostic.S6566.severity = none + +# Title : Use "TimeZoneInfo.FindSystemTimeZoneById" without converting the timezones with "TimezoneConverter" +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6575 +dotnet_diagnostic.S6575.severity = warning + +# Title : Use a format provider when parsing date and time +# Category : Major Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6580 +dotnet_diagnostic.S6580.severity = warning + +# Title : Don't hardcode the format when turning dates and times to strings +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6585 +dotnet_diagnostic.S6585.severity = none + +# Title : Use the "UnixEpoch" field instead of creating "DateTime" instances that point to the beginning of the Unix epoch +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6588 +dotnet_diagnostic.S6588.severity = warning + +# Title : "Find" method should be used instead of the "FirstOrDefault" extension +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6602 +dotnet_diagnostic.S6602.severity = none + +# Title : The collection-specific "TrueForAll" method should be used instead of the "All" extension +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6603 +dotnet_diagnostic.S6603.severity = none + +# Title : Collection-specific "Exists" method should be used instead of the "Any" extension +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6605 +dotnet_diagnostic.S6605.severity = none + +# Title : The collection should be filtered before sorting by using "Where" before "OrderBy" +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6607 +dotnet_diagnostic.S6607.severity = none + +# Title : Prefer indexing instead of "Enumerable" methods on types implementing "IList" +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6608 +dotnet_diagnostic.S6608.severity = none + +# Title : "Min/Max" properties of "Set" types should be used instead of the "Enumerable" extension methods +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6609 +dotnet_diagnostic.S6609.severity = none + +# Title : "StartsWith" and "EndsWith" overloads that take a "char" should be used instead of the ones that take a "string" +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6610 +dotnet_diagnostic.S6610.severity = none + +# Title : The lambda parameter should be used instead of capturing arguments in "ConcurrentDictionary" methods +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6612 +dotnet_diagnostic.S6612.severity = none + +# Title : "First" and "Last" properties of "LinkedList" should be used instead of the "First()" and "Last()" extension methods +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6613 +dotnet_diagnostic.S6613.severity = none + +# Title : "Contains" should be used instead of "Any" for simple equality checks +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6617 +dotnet_diagnostic.S6617.severity = none + +# Title : "string.Create" should be used instead of "FormattableString" +# Category : Minor Code Smell +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6618 +dotnet_diagnostic.S6618.severity = none + +# Title : Using unsafe code blocks is security-sensitive +# Category : Major Security Hotspot +# Help Link: https://rules.sonarsource.com/csharp/RSPEC-6640 +dotnet_diagnostic.S6640.severity = warning # Title : Literal suffixes should be upper case # Category : Minor Code Smell @@ -5001,6 +5196,10 @@ dotnet_diagnostic.S9999-symbolRef.severity = warning # Category : dotnet_diagnostic.S9999-token-type.severity = warning +# Title : Analysis Warning generator +# Category : +dotnet_diagnostic.S9999-warning.severity = warning + # Title : XML comment analysis disabled # Category : StyleCop.CSharp.SpecialRules # Help Link: https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA0001.md @@ -5280,7 +5479,8 @@ dotnet_diagnostic.SA1118.severity = warning # Title : Statement should not use unnecessary parenthesis # Category : StyleCop.CSharp.MaintainabilityRules # Help Link: https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1119.md -dotnet_diagnostic.SA1119.severity = warning +# Redundant: IDE0047 +dotnet_diagnostic.SA1119.severity = none # Title : Statement should not use unnecessary parenthesis # Category : StyleCop.CSharp.MaintainabilityRules @@ -6095,6 +6295,7 @@ dotnet_diagnostic.VSTHRD102.severity = suggestion # Title : Call async methods when in an async method # Category : Usage # Help Link: https://github.com/Microsoft/vs-threading/blob/main/doc/analyzers/VSTHRD103.md +# Redundant: CA1849 dotnet_diagnostic.VSTHRD103.severity = none # Title : Offer async methods @@ -6304,11 +6505,71 @@ dotnet_diagnostic.xUnit1026.severity = warning # Help Link: https://xunit.net/xunit.analyzers/rules/xUnit1027 dotnet_diagnostic.xUnit1027.severity = error +# Title : Test method must have valid return type +# Category : Usage +# Help Link: https://xunit.net/xunit.analyzers/rules/xUnit1028 +dotnet_diagnostic.xUnit1028.severity = error + +# Title : Local functions cannot be test functions +# Category : Usage +# Help Link: https://xunit.net/xunit.analyzers/rules/xUnit1029 +dotnet_diagnostic.xUnit1029.severity = error + +# Title : Do not call ConfigureAwait(false) in test method +# Category : Usage +# Help Link: https://xunit.net/xunit.analyzers/rules/xUnit1030 +dotnet_diagnostic.xUnit1030.severity = warning + +# Title : Do not use blocking task operations in test method +# Category : Usage +# Help Link: https://xunit.net/xunit.analyzers/rules/xUnit1031 +dotnet_diagnostic.xUnit1031.severity = warning + +# Title : Test classes cannot be nested within a generic class +# Category : Usage +# Help Link: https://xunit.net/xunit.analyzers/rules/xUnit1032 +dotnet_diagnostic.xUnit1032.severity = error + # Title : Test classes decorated with 'Xunit.IClassFixture' or 'Xunit.ICollectionFixture' should add a constructor argument of type TFixture # Category : Usage # Help Link: https://xunit.net/xunit.analyzers/rules/xUnit1033 dotnet_diagnostic.xUnit1033.severity = suggestion +# Title : Null should only be used for nullable parameters +# Category : Usage +# Help Link: https://xunit.net/xunit.analyzers/rules/xUnit1034 +dotnet_diagnostic.xUnit1034.severity = warning + +# Title : The value is not convertible to the method parameter type +# Category : Usage +# Help Link: https://xunit.net/xunit.analyzers/rules/xUnit1035 +dotnet_diagnostic.xUnit1035.severity = error + +# Title : There is no matching method parameter +# Category : Usage +# Help Link: https://xunit.net/xunit.analyzers/rules/xUnit1036 +dotnet_diagnostic.xUnit1036.severity = error + +# Title : There are fewer TheoryData type arguments than required by the parameters of the test method +# Category : Usage +# Help Link: https://xunit.net/xunit.analyzers/rules/xUnit1037 +dotnet_diagnostic.xUnit1037.severity = error + +# Title : There are more TheoryData type arguments than allowed by the parameters of the test method +# Category : Usage +# Help Link: https://xunit.net/xunit.analyzers/rules/xUnit1038 +dotnet_diagnostic.xUnit1038.severity = error + +# Title : The type argument to TheoryData is not compatible with the type of the corresponding test method parameter +# Category : Usage +# Help Link: https://xunit.net/xunit.analyzers/rules/xUnit1039 +dotnet_diagnostic.xUnit1039.severity = error + +# Title : The type argument to TheoryData is nullable, while the type of the corresponding test method parameter is not +# Category : Usage +# Help Link: https://xunit.net/xunit.analyzers/rules/xUnit1040 +dotnet_diagnostic.xUnit1040.severity = warning + # Title : Constants and literals should be the expected argument # Category : Assertions # Help Link: https://xunit.net/xunit.analyzers/rules/xUnit2000 @@ -6409,7 +6670,22 @@ dotnet_diagnostic.xUnit2018.severity = warning # Help Link: https://xunit.github.io/xunit.analyzers/rules/xUnit2019 dotnet_diagnostic.xUnit2019.severity = warning -# Title : Test case classes must derive directly or indirectly from Xunit.LongLivedMarshalByRefObject +# Title : Do not use always-failing boolean assertions +# Category : Assertions +# Help Link: https://xunit.net/xunit.analyzers/rules/xUnit2020 +dotnet_diagnostic.xUnit2020.severity = warning + +# Title : Async assertions should be awaited +# Category : Assertions +# Help Link: https://xunit.net/xunit.analyzers/rules/xUnit2021 +dotnet_diagnostic.xUnit2021.severity = error + +# Title : Boolean assertions should not be negated +# Category : Assertions +# Help Link: https://xunit.net/xunit.analyzers/rules/xUnit2022 +dotnet_diagnostic.xUnit2022.severity = suggestion + +# Title : Classes which cross AppDomain boundaries must derive directly or indirectly from LongLivedMarshalByRefObject # Category : Extensibility # Help Link: https://xunit.net/xunit.analyzers/rules/xUnit3000 dotnet_diagnostic.xUnit3000.severity = error diff --git a/test/Generators/Microsoft.Gen.ContextualOptions/TestClasses/NonPublicStruct.cs b/test/Generators/Microsoft.Gen.ContextualOptions/TestClasses/NonPublicStruct.cs index f9be2b4dbe2..b7c31ec1ecf 100644 --- a/test/Generators/Microsoft.Gen.ContextualOptions/TestClasses/NonPublicStruct.cs +++ b/test/Generators/Microsoft.Gen.ContextualOptions/TestClasses/NonPublicStruct.cs @@ -9,6 +9,6 @@ namespace TestClasses internal partial struct NonPublicStruct { #pragma warning disable CA1822 // Mark members as static - public string Foo => "FooValue"; + public readonly string Foo => "FooValue"; } } diff --git a/test/Generators/Microsoft.Gen.ContextualOptions/TestClasses/Struct1.cs b/test/Generators/Microsoft.Gen.ContextualOptions/TestClasses/Struct1.cs index ad5483666b2..823408168c4 100644 --- a/test/Generators/Microsoft.Gen.ContextualOptions/TestClasses/Struct1.cs +++ b/test/Generators/Microsoft.Gen.ContextualOptions/TestClasses/Struct1.cs @@ -9,6 +9,6 @@ namespace TestClasses public partial struct Struct1 { #pragma warning disable CA1822 // Mark members as static - public string Foo => "FooValue"; + public readonly string Foo => "FooValue"; } } diff --git a/test/Generators/Microsoft.Gen.Logging/TestClasses/FormattableTestExtensions.cs b/test/Generators/Microsoft.Gen.Logging/TestClasses/FormattableTestExtensions.cs index 5d04091cdd3..5043876706b 100644 --- a/test/Generators/Microsoft.Gen.Logging/TestClasses/FormattableTestExtensions.cs +++ b/test/Generators/Microsoft.Gen.Logging/TestClasses/FormattableTestExtensions.cs @@ -19,7 +19,7 @@ internal static partial class FormattableTestExtensions internal struct Formattable : IFormattable { - public string ToString(string? format, IFormatProvider? formatProvider) + public readonly string ToString(string? format, IFormatProvider? formatProvider) { return "Formatted!"; } @@ -27,24 +27,24 @@ public string ToString(string? format, IFormatProvider? formatProvider) internal struct Convertible : IConvertible { - public TypeCode GetTypeCode() => throw new NotSupportedException(); - public bool ToBoolean(IFormatProvider? provider) => throw new NotSupportedException(); - public byte ToByte(IFormatProvider? provider) => throw new NotSupportedException(); - public char ToChar(IFormatProvider? provider) => throw new NotSupportedException(); - public DateTime ToDateTime(IFormatProvider? provider) => throw new NotSupportedException(); - public decimal ToDecimal(IFormatProvider? provider) => throw new NotSupportedException(); - public double ToDouble(IFormatProvider? provider) => throw new NotSupportedException(); - public short ToInt16(IFormatProvider? provider) => throw new NotSupportedException(); - public int ToInt32(IFormatProvider? provider) => throw new NotSupportedException(); - public long ToInt64(IFormatProvider? provider) => throw new NotSupportedException(); - public sbyte ToSByte(IFormatProvider? provider) => throw new NotSupportedException(); - public float ToSingle(IFormatProvider? provider) => throw new NotSupportedException(); - public object ToType(Type conversionType, IFormatProvider? provider) => throw new NotSupportedException(); - public ushort ToUInt16(IFormatProvider? provider) => throw new NotSupportedException(); - public uint ToUInt32(IFormatProvider? provider) => throw new NotSupportedException(); - public ulong ToUInt64(IFormatProvider? provider) => throw new NotSupportedException(); - - public string ToString(IFormatProvider? provider) => "Converted!"; + public readonly TypeCode GetTypeCode() => throw new NotSupportedException(); + public readonly bool ToBoolean(IFormatProvider? provider) => throw new NotSupportedException(); + public readonly byte ToByte(IFormatProvider? provider) => throw new NotSupportedException(); + public readonly char ToChar(IFormatProvider? provider) => throw new NotSupportedException(); + public readonly DateTime ToDateTime(IFormatProvider? provider) => throw new NotSupportedException(); + public readonly decimal ToDecimal(IFormatProvider? provider) => throw new NotSupportedException(); + public readonly double ToDouble(IFormatProvider? provider) => throw new NotSupportedException(); + public readonly short ToInt16(IFormatProvider? provider) => throw new NotSupportedException(); + public readonly int ToInt32(IFormatProvider? provider) => throw new NotSupportedException(); + public readonly long ToInt64(IFormatProvider? provider) => throw new NotSupportedException(); + public readonly sbyte ToSByte(IFormatProvider? provider) => throw new NotSupportedException(); + public readonly float ToSingle(IFormatProvider? provider) => throw new NotSupportedException(); + public readonly object ToType(Type conversionType, IFormatProvider? provider) => throw new NotSupportedException(); + public readonly ushort ToUInt16(IFormatProvider? provider) => throw new NotSupportedException(); + public readonly uint ToUInt32(IFormatProvider? provider) => throw new NotSupportedException(); + public readonly ulong ToUInt64(IFormatProvider? provider) => throw new NotSupportedException(); + + public readonly string ToString(IFormatProvider? provider) => "Converted!"; } internal class ComplexObj diff --git a/test/Generators/Microsoft.Gen.Logging/TestClasses/InParameterTestExtensions.cs b/test/Generators/Microsoft.Gen.Logging/TestClasses/InParameterTestExtensions.cs index c7776321f17..cad9d7b5e17 100644 --- a/test/Generators/Microsoft.Gen.Logging/TestClasses/InParameterTestExtensions.cs +++ b/test/Generators/Microsoft.Gen.Logging/TestClasses/InParameterTestExtensions.cs @@ -9,7 +9,7 @@ internal static partial class InParameterTestExtensions { internal struct S { - public override string ToString() => "Hello from S"; + public override readonly string ToString() => "Hello from S"; } [LoggerMessage(0, LogLevel.Information, "M0 {s}")] diff --git a/test/Generators/Microsoft.Gen.Logging/TestClasses/LogPropertiesRecordExtensions.cs b/test/Generators/Microsoft.Gen.Logging/TestClasses/LogPropertiesRecordExtensions.cs index a34b0653710..7f7d132413b 100644 --- a/test/Generators/Microsoft.Gen.Logging/TestClasses/LogPropertiesRecordExtensions.cs +++ b/test/Generators/Microsoft.Gen.Logging/TestClasses/LogPropertiesRecordExtensions.cs @@ -17,7 +17,7 @@ internal record class MyRecordClass(int Value, string @class) internal record struct MyRecordStruct(int IntValue, string StringValue) { - public long GetOnlyValue => IntValue + 1L; + public readonly long GetOnlyValue => IntValue + 1L; } internal readonly record struct MyReadonlyRecordStruct(int IntValue, string StringValue) diff --git a/test/Generators/Microsoft.Gen.Logging/TestClasses/NestedClassTestExtensions.cs b/test/Generators/Microsoft.Gen.Logging/TestClasses/NestedClassTestExtensions.cs index 4676f869dbb..ec9402ab565 100644 --- a/test/Generators/Microsoft.Gen.Logging/TestClasses/NestedClassTestExtensions.cs +++ b/test/Generators/Microsoft.Gen.Logging/TestClasses/NestedClassTestExtensions.cs @@ -26,7 +26,7 @@ internal static partial class NestedClass public static T Foo(T x) => x; } - internal partial class NonStaticNestedClassTestExtensions + internal sealed partial class NonStaticNestedClassTestExtensions where T : Abc { internal partial class NonStaticNestedMiddleParentClass diff --git a/test/Generators/Microsoft.Gen.Logging/TestClasses/SignatureTestExtensions.cs b/test/Generators/Microsoft.Gen.Logging/TestClasses/SignatureTestExtensions.cs index 6ee0cba8bad..0a25d0a0ad7 100644 --- a/test/Generators/Microsoft.Gen.Logging/TestClasses/SignatureTestExtensions.cs +++ b/test/Generators/Microsoft.Gen.Logging/TestClasses/SignatureTestExtensions.cs @@ -1,6 +1,7 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. +using System.Diagnostics.CodeAnalysis; using Microsoft.Extensions.Logging; namespace TestClasses @@ -22,6 +23,7 @@ internal static partial class SignatureTestExtensions } // test that particular method signature variations are generated correctly + [SuppressMessage("Design", "CA1052:Static holder types should be Static or NotInheritable", Justification = "Needed for reflection")] internal partial class SignatureTestExtensions where T : class { diff --git a/test/Generators/Microsoft.Gen.Logging/TestClasses/TagProviderExtensions.cs b/test/Generators/Microsoft.Gen.Logging/TestClasses/TagProviderExtensions.cs index 58cb023b44f..1fb50a8f409 100644 --- a/test/Generators/Microsoft.Gen.Logging/TestClasses/TagProviderExtensions.cs +++ b/test/Generators/Microsoft.Gen.Logging/TestClasses/TagProviderExtensions.cs @@ -137,7 +137,7 @@ public StructToLog() public string MyStringProperty { get; set; } - public override string ToString() => "Custom struct string representation"; + public override readonly string ToString() => "Custom struct string representation"; } internal interface IInterfaceToLog diff --git a/test/Libraries/Microsoft.AspNetCore.Diagnostics.Middleware.Tests/Logging/AcceptanceTests.Mvc.cs b/test/Libraries/Microsoft.AspNetCore.Diagnostics.Middleware.Tests/Logging/AcceptanceTests.Mvc.cs index 36b4897fba8..e35a7cce81c 100644 --- a/test/Libraries/Microsoft.AspNetCore.Diagnostics.Middleware.Tests/Logging/AcceptanceTests.Mvc.cs +++ b/test/Libraries/Microsoft.AspNetCore.Diagnostics.Middleware.Tests/Logging/AcceptanceTests.Mvc.cs @@ -30,6 +30,7 @@ public partial class AcceptanceTests internal const string ActionRouteTemplate = "api/users/{userId}/{noDataClassification}"; internal const int ControllerProcessingTimeMs = 1_000; + [SuppressMessage("Design", "CA1052:Static holder types should be Static or NotInheritable", Justification = "Needed for reflection")] private class TestStartupWithControllers { [SuppressMessage("Major Code Smell", "S1144:Unused private types or members should be removed", Justification = "Used through reflection")] diff --git a/test/Libraries/Microsoft.AspNetCore.Diagnostics.Middleware.Tests/Logging/AcceptanceTests.Routing.cs b/test/Libraries/Microsoft.AspNetCore.Diagnostics.Middleware.Tests/Logging/AcceptanceTests.Routing.cs index 7d95b0501b2..f35959f4cb7 100644 --- a/test/Libraries/Microsoft.AspNetCore.Diagnostics.Middleware.Tests/Logging/AcceptanceTests.Routing.cs +++ b/test/Libraries/Microsoft.AspNetCore.Diagnostics.Middleware.Tests/Logging/AcceptanceTests.Routing.cs @@ -21,6 +21,7 @@ namespace Microsoft.AspNetCore.Diagnostics.Logging.Test; public partial class AcceptanceTests { + [SuppressMessage("Design", "CA1052:Static holder types should be Static or NotInheritable", Justification = "Needed for reflection")] private class TestStartupWithRouting { [SuppressMessage("Major Code Smell", "S1144:Unused private types or members should be removed", Justification = "Used through reflection")] diff --git a/test/Libraries/Microsoft.AspNetCore.Diagnostics.Middleware.Tests/Logging/AcceptanceTests.cs b/test/Libraries/Microsoft.AspNetCore.Diagnostics.Middleware.Tests/Logging/AcceptanceTests.cs index 6eb305c95a1..05860ddaae9 100644 --- a/test/Libraries/Microsoft.AspNetCore.Diagnostics.Middleware.Tests/Logging/AcceptanceTests.cs +++ b/test/Libraries/Microsoft.AspNetCore.Diagnostics.Middleware.Tests/Logging/AcceptanceTests.cs @@ -38,6 +38,7 @@ public partial class AcceptanceTests private const int SlashRouteProcessingTimeMs = 2_000; private static readonly TimeSpan _defaultLogTimeout = TimeSpan.FromSeconds(5); + [SuppressMessage("Design", "CA1052:Static holder types should be Static or NotInheritable", Justification = "Needed for reflection")] private class TestStartup { [SuppressMessage("Major Code Smell", "S1144:Unused private types or members should be removed", Justification = "Used through reflection")] diff --git a/test/Libraries/Microsoft.Extensions.Http.Diagnostics.Tests/Latency/Internal/HttpMockProvider.cs b/test/Libraries/Microsoft.Extensions.Http.Diagnostics.Tests/Latency/Internal/HttpMockProvider.cs index 0917e8a51ae..a9150df371b 100644 --- a/test/Libraries/Microsoft.Extensions.Http.Diagnostics.Tests/Latency/Internal/HttpMockProvider.cs +++ b/test/Libraries/Microsoft.Extensions.Http.Diagnostics.Tests/Latency/Internal/HttpMockProvider.cs @@ -9,7 +9,7 @@ namespace Microsoft.Extensions.Http.Latency.Test.Internal; -internal class HttpMockProvider +internal static class HttpMockProvider { public static HttpRequestLatencyListener GetListener(HttpClientLatencyContext httpClientLatencyContext, ILatencyContextTokenIssuer tokenIssuer) { From a44a76e708dfbd74ece5f4b79d4c092ef6e14c10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Ros?= Date: Fri, 26 Jan 2024 20:41:43 -0800 Subject: [PATCH 149/172] Fix CA1859 warning (#4908) * Fix CA1859 warning --- .../ResourceMonitoringServiceCollectionExtensions.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Libraries/Microsoft.Extensions.Diagnostics.ResourceMonitoring/ResourceMonitoringServiceCollectionExtensions.cs b/src/Libraries/Microsoft.Extensions.Diagnostics.ResourceMonitoring/ResourceMonitoringServiceCollectionExtensions.cs index 06d183536bc..92d61192ef6 100644 --- a/src/Libraries/Microsoft.Extensions.Diagnostics.ResourceMonitoring/ResourceMonitoringServiceCollectionExtensions.cs +++ b/src/Libraries/Microsoft.Extensions.Diagnostics.ResourceMonitoring/ResourceMonitoringServiceCollectionExtensions.cs @@ -110,7 +110,7 @@ private static void PickWindowsSnapshotProvider(this ResourceMonitorBuilder buil } #if !NETFRAMEWORK - private static IResourceMonitorBuilder AddLinuxProvider(this IResourceMonitorBuilder builder) + private static ResourceMonitorBuilder AddLinuxProvider(this ResourceMonitorBuilder builder) { _ = Throw.IfNull(builder); From 31f4d22bda2231ffa05d85e40208cc02170bf367 Mon Sep 17 00:00:00 2001 From: Nikita Balabaev Date: Mon, 5 Feb 2024 12:37:10 +0100 Subject: [PATCH 150/172] Adding Diagnostics.Testing README (#4918) --- NuGet.config | 2 +- .../README.md | 81 +++++++++++++++++++ .../README.md | 2 +- 3 files changed, 83 insertions(+), 2 deletions(-) diff --git a/NuGet.config b/NuGet.config index 0f94a1f6394..4dfd098020e 100644 --- a/NuGet.config +++ b/NuGet.config @@ -23,7 +23,7 @@ - diff --git a/src/Libraries/Microsoft.Extensions.Diagnostics.Testing/README.md b/src/Libraries/Microsoft.Extensions.Diagnostics.Testing/README.md index 91c0a956535..bfa69b82aed 100644 --- a/src/Libraries/Microsoft.Extensions.Diagnostics.Testing/README.md +++ b/src/Libraries/Microsoft.Extensions.Diagnostics.Testing/README.md @@ -18,6 +18,87 @@ Or directly in the C# project file: ``` +## Usage Example + +### Fake logging + +These components enable faking logging services for testing purposes. + +When using this package, you can register a fake logging provider by one of the following methods: + +```csharp +public static ILoggingBuilder AddFakeLogging(this ILoggingBuilder builder) +public static ILoggingBuilder AddFakeLogging(this ILoggingBuilder builder, IConfigurationSection section) +public static ILoggingBuilder AddFakeLogging(this ILoggingBuilder builder, Action configure) +``` + +You can also register fake logging in the service collection: + +```csharp +public static IServiceCollection AddFakeLogging(this IServiceCollection services) +public static IServiceCollection AddFakeLogging(this IServiceCollection services, IConfigurationSection section) +public static IServiceCollection AddFakeLogging(this IServiceCollection services, Action configure) +``` + +After registering the fake logging services, you can resolve the fake logging provider with this method: + +```csharp +public static FakeLogCollector GetFakeLogCollector(this IServiceProvider services) +``` + +You can also create an instance of `FakeLogger` using one of its constructors: + +```csharp +public FakeLogger(FakeLogCollector? collector = null, string? category = null) +public FakeLogger(Action outputSink, string? category = null) +``` + +You can then use it right away, for example: + +```csharp +var fakeLogger = new FakeLogger(); + +// Optionally, you can set the log level +// fakeLogger.ControlLevel(LogLevel.Debug, enabled: true); + +var myComponentUnderTest = new MyComponent(fakeLogger); +myComponentUnderTest.DoWork(); // We assume that the component will produce some logs + +FakeLogCollector collector = fakeLogger.Collector; // Collector allows you to access the captured logs +IReadOnlyList logs = collector.GetSnapshot(); +// ... assert that the logs are correct +``` + +### Metric collector + +The `MetricCollector` allows you to collect metrics in tests. It has a few constructors and you can choose the one that fits your needs: + +```csharp +public MetricCollector(Instrument instrument, TimeProvider? timeProvider = null) +public MetricCollector(ObservableInstrument instrument, TimeProvider? timeProvider = null) +public MetricCollector(object? meterScope, string meterName, string instrumentName, TimeProvider? timeProvider = null) +public MetricCollector(Meter meter, string instrumentName, TimeProvider? timeProvider = null) +``` + +When you have an exact instrument, you can use the first two constructors. If you have a meter scope (typically it's [`IMeterFactory`](https://learn.microsoft.com/en-us/dotnet/api/system.diagnostics.metrics.imeterfactory?view=net-8.0)), you can use the third constructor. If you have a meter, use the last one. + +Here is an example of how to use the `MetricCollector`: + +```csharp +using System.Diagnostics.Metrics; +using Microsoft.Extensions.Diagnostics.Testing; + +using var meter = new Meter("TestMeter"); +using var collector = new MetricCollector(meter, "TestInstrument"); + +var myComponentUnderTest = new MyComponent(meter); +myComponentUnderTest.DoWork(); // We assume that the component will produce some integer metrics + +CollectedMeasurement? measurement = collector.LastMeasurement(); +// ... assert that the measurement is correct +``` + +Please note that the `MetricCollector` is generic and you need to specify the type of the metric you want to collect (e.g. `int`, `double`, etc.). ## Feedback & Contributing diff --git a/src/Libraries/Microsoft.Extensions.Http.Diagnostics/README.md b/src/Libraries/Microsoft.Extensions.Http.Diagnostics/README.md index 780f407bb1b..3a009164d74 100644 --- a/src/Libraries/Microsoft.Extensions.Http.Diagnostics/README.md +++ b/src/Libraries/Microsoft.Extensions.Http.Diagnostics/README.md @@ -74,7 +74,7 @@ services.AddHttpClient("foo") // Enable logging of request and response bodies: o.LogBody = true; - // We also need to specify the content types that we want to log: + // We also need to specify the content types that we want to log: o.ResponseBodyContentTypes.Add("application/json"); }); From 80abb8ddf7a2454930ae2378b121f044fe3df848 Mon Sep 17 00:00:00 2001 From: martintmk <103487740+martintmk@users.noreply.github.com> Date: Mon, 5 Feb 2024 22:04:52 +0100 Subject: [PATCH 151/172] Upgrade Polly to version 8.3.0 (#4922) --- eng/packages/General.props | 8 ++++---- eng/packages/TestOnly.props | 2 +- .../HttpClientBuilderExtensionsTests.Resilience.cs | 8 +++++++- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/eng/packages/General.props b/eng/packages/General.props index 8a3633a72db..1ee694e5356 100644 --- a/eng/packages/General.props +++ b/eng/packages/General.props @@ -37,10 +37,10 @@ - - - - + + + + diff --git a/eng/packages/TestOnly.props b/eng/packages/TestOnly.props index c04980b381d..d94f4b78586 100644 --- a/eng/packages/TestOnly.props +++ b/eng/packages/TestOnly.props @@ -8,7 +8,7 @@ - + diff --git a/test/Libraries/Microsoft.Extensions.Http.Resilience.Tests/Resilience/HttpClientBuilderExtensionsTests.Resilience.cs b/test/Libraries/Microsoft.Extensions.Http.Resilience.Tests/Resilience/HttpClientBuilderExtensionsTests.Resilience.cs index 66baa44fd57..49e74bcca10 100644 --- a/test/Libraries/Microsoft.Extensions.Http.Resilience.Tests/Resilience/HttpClientBuilderExtensionsTests.Resilience.cs +++ b/test/Libraries/Microsoft.Extensions.Http.Resilience.Tests/Resilience/HttpClientBuilderExtensionsTests.Resilience.cs @@ -92,7 +92,13 @@ public void AddResilienceHandler_EnsureServicesNotAddedTwice() // add twice intentionally builder.AddResilienceHandler("test", ConfigureBuilder); - builder.Services.Should().HaveCount(count + 2); + // We check that the count of existing services is not unnecessary increased. + // + // The additional 3 services that are registered are related to: + // - Configuration of HTTP client options + // - Configuration of resilience pipeline + // - Registration of keyed service for resilience pipeline + builder.Services.Should().HaveCount(count + 3); } [Fact] From b5c9f8d4411af1d6a057279637b8b0bfdb09d0a5 Mon Sep 17 00:00:00 2001 From: Jose Perez Rodriguez Date: Wed, 7 Feb 2024 10:50:41 -0800 Subject: [PATCH 152/172] Revert "Disable HttpClient's timeout for Standard Resilience and Hedging (#4862)" (#4925) This reverts commit 3654748e14445fa794bcdb0d2ebffa46e758603c. --- .../ResilienceHttpClientBuilderExtensions.Hedging.cs | 4 ---- ...eHttpClientBuilderExtensions.StandardResilience.cs | 4 ---- .../Hedging/StandardHedgingTests.cs | 8 -------- .../HttpClientBuilderExtensionsTests.Standard.cs | 11 ----------- 4 files changed, 27 deletions(-) diff --git a/src/Libraries/Microsoft.Extensions.Http.Resilience/Hedging/ResilienceHttpClientBuilderExtensions.Hedging.cs b/src/Libraries/Microsoft.Extensions.Http.Resilience/Hedging/ResilienceHttpClientBuilderExtensions.Hedging.cs index 8e789e400cc..aa32f16d1e6 100644 --- a/src/Libraries/Microsoft.Extensions.Http.Resilience/Hedging/ResilienceHttpClientBuilderExtensions.Hedging.cs +++ b/src/Libraries/Microsoft.Extensions.Http.Resilience/Hedging/ResilienceHttpClientBuilderExtensions.Hedging.cs @@ -3,7 +3,6 @@ using System; using System.Net.Http; -using System.Threading; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection.Extensions; using Microsoft.Extensions.Http.Resilience; @@ -140,9 +139,6 @@ public static IStandardHedgingHandlerBuilder AddStandardHedgingHandler(this IHtt }) .SelectPipelineByAuthority(); - // Disable the HttpClient timeout to allow the timeout strategies to control the timeout. - _ = builder.ConfigureHttpClient(client => client.Timeout = Timeout.InfiniteTimeSpan); - return new StandardHedgingHandlerBuilder(builder.Name, builder.Services, routingBuilder); } diff --git a/src/Libraries/Microsoft.Extensions.Http.Resilience/Resilience/ResilienceHttpClientBuilderExtensions.StandardResilience.cs b/src/Libraries/Microsoft.Extensions.Http.Resilience/Resilience/ResilienceHttpClientBuilderExtensions.StandardResilience.cs index a4315eaa006..f27c2e76eac 100644 --- a/src/Libraries/Microsoft.Extensions.Http.Resilience/Resilience/ResilienceHttpClientBuilderExtensions.StandardResilience.cs +++ b/src/Libraries/Microsoft.Extensions.Http.Resilience/Resilience/ResilienceHttpClientBuilderExtensions.StandardResilience.cs @@ -2,7 +2,6 @@ // The .NET Foundation licenses this file to you under the MIT license. using System; -using System.Threading; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Http.Resilience; @@ -87,9 +86,6 @@ public static IHttpStandardResiliencePipelineBuilder AddStandardResilienceHandle .AddTimeout(options.AttemptTimeout); }); - // Disable the HttpClient timeout to allow the timeout strategies to control the timeout. - _ = builder.ConfigureHttpClient(client => client.Timeout = Timeout.InfiniteTimeSpan); - return new HttpStandardResiliencePipelineBuilder(optionsName, builder.Services); } diff --git a/test/Libraries/Microsoft.Extensions.Http.Resilience.Tests/Hedging/StandardHedgingTests.cs b/test/Libraries/Microsoft.Extensions.Http.Resilience.Tests/Hedging/StandardHedgingTests.cs index 7ded224a2e4..fb381f31e1b 100644 --- a/test/Libraries/Microsoft.Extensions.Http.Resilience.Tests/Hedging/StandardHedgingTests.cs +++ b/test/Libraries/Microsoft.Extensions.Http.Resilience.Tests/Hedging/StandardHedgingTests.cs @@ -246,14 +246,6 @@ public async Task DynamicReloads_Ok() AssertNoResponse(); } - [Fact] - public void AddStandardResilienceHandler_EnsureHttpClientTimeoutDisabled() - { - var client = CreateClientWithHandler(); - - client.Timeout.Should().Be(Timeout.InfiniteTimeSpan); - } - [Fact] public async Task NoRouting_Ok() { diff --git a/test/Libraries/Microsoft.Extensions.Http.Resilience.Tests/Resilience/HttpClientBuilderExtensionsTests.Standard.cs b/test/Libraries/Microsoft.Extensions.Http.Resilience.Tests/Resilience/HttpClientBuilderExtensionsTests.Standard.cs index 567cceb6466..afa4233c797 100644 --- a/test/Libraries/Microsoft.Extensions.Http.Resilience.Tests/Resilience/HttpClientBuilderExtensionsTests.Standard.cs +++ b/test/Libraries/Microsoft.Extensions.Http.Resilience.Tests/Resilience/HttpClientBuilderExtensionsTests.Standard.cs @@ -5,7 +5,6 @@ using System.Collections.Generic; using System.Net; using System.Net.Http; -using System.Threading; using System.Threading.Tasks; using FluentAssertions; using Microsoft.Extensions.Configuration; @@ -235,16 +234,6 @@ public async Task DynamicReloads_Ok() requests.Should().HaveCount(11); } - [Fact] - public void AddStandardResilienceHandler_EnsureHttpClientTimeoutDisabled() - { - var builder = new ServiceCollection().AddLogging().AddMetrics().AddHttpClient("test").AddStandardHedgingHandler(); - - using var client = builder.Services.BuildServiceProvider().GetRequiredService().CreateClient("test"); - - client.Timeout.Should().Be(Timeout.InfiniteTimeSpan); - } - private static void AddStandardResilienceHandler( MethodArgs mode, IHttpClientBuilder builder, From bb94bb1bd9bbf9971cf78801a5b7cd580a84be29 Mon Sep 17 00:00:00 2001 From: Jose Perez Rodriguez Date: Wed, 7 Feb 2024 11:27:51 -0800 Subject: [PATCH 153/172] Get ready for release and update dependencies to 8.0.2 --- Directory.Build.props | 5 ++ NuGet.config | 54 ++++++++------------- azure-pipelines.yml | 50 ------------------- eng/Version.Details.xml | 62 ++++++++++++------------ eng/Versions.props | 26 +++++----- eng/pipelines/templates/BuildAndTest.yml | 18 +++++++ 6 files changed, 87 insertions(+), 128 deletions(-) diff --git a/Directory.Build.props b/Directory.Build.props index cea28e22ade..850685ca2d7 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -34,6 +34,11 @@ $(NetCoreTargetFrameworks) + + + $(NoWarn);NU1507 + + false latest diff --git a/NuGet.config b/NuGet.config index 4dfd098020e..12ff22fb2cd 100644 --- a/NuGet.config +++ b/NuGet.config @@ -4,14 +4,18 @@ - - - + + + + + - - - + + + + + @@ -23,39 +27,21 @@ - - - - - - - - - - - - - - - - - - - - - - - - + + + + + - - - + + + + + diff --git a/azure-pipelines.yml b/azure-pipelines.yml index a695dd6529a..34222fe99c6 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -206,55 +206,6 @@ stages: warnAsError: 0 -# ---------------------------------------------------------------- -# This stage performs quality gates enforcements -# ---------------------------------------------------------------- -- stage: codecoverage - displayName: CodeCoverage - dependsOn: - - build - condition: and(succeeded('build'), ne(variables['SkipQualityGates'], 'true')) - variables: - - template: /eng/common/templates/variables/pool-providers.yml - jobs: - - template: /eng/common/templates/jobs/jobs.yml - parameters: - enableMicrobuild: true - enableTelemetry: true - runAsPublic: ${{ variables['runAsPublic'] }} - workspace: - clean: all - - # ---------------------------------------------------------------- - # This stage downloads the code coverage reports from the build jobs, - # merges those and validates the combined test coverage. - # ---------------------------------------------------------------- - jobs: - - job: CodeCoverageReport - timeoutInMinutes: 180 - - pool: - ${{ if eq(variables['runAsPublic'], 'true') }}: - name: $(DncEngPublicBuildPool) - demands: ImageOverride -equals build.ubuntu.2004.amd64.open - # Non-public (i.e., official builds) - ${{ else }}: - name: $(DncEngInternalBuildPool) - demands: ImageOverride -equals build.ubuntu.2004.amd64 - - preSteps: - - checkout: self - clean: true - persistCredentials: true - fetchDepth: 1 - - steps: - - script: $(Build.SourcesDirectory)/build.sh --ci --restore - displayName: Init toolset - - - template: /eng/pipelines/templates/VerifyCoverageReport.yml - - # ---------------------------------------------------------------- # This stage only performs a build treating warnings as errors # to detect any kind of code style violations @@ -313,7 +264,6 @@ stages: parameters: validateDependsOn: - build - - codecoverage - correctness publishingInfraVersion: 3 enableSymbolValidation: false diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 51a4fb0b76b..c584bffdd0e 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -80,9 +80,9 @@ https://dev.azure.com/dnceng/internal/_git/dotnet-runtime 5535e31a712343a63f5d7d796cd874e563e5ac14 - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - bf5e279d9239bfef5bb1b8d6212f1b971c434606 + 1381d5ebd2ab1f292848d5b19b80cf71ac332508 https://dev.azure.com/dnceng/internal/_git/dotnet-runtime @@ -124,49 +124,49 @@ https://dev.azure.com/dnceng/internal/_git/dotnet-runtime 5535e31a712343a63f5d7d796cd874e563e5ac14 - + https://dev.azure.com/dnceng/internal/_git/dotnet-runtime - bf5e279d9239bfef5bb1b8d6212f1b971c434606 + 1381d5ebd2ab1f292848d5b19b80cf71ac332508 https://dev.azure.com/dnceng/internal/_git/dotnet-runtime 5535e31a712343a63f5d7d796cd874e563e5ac14 - - https://github.com/dotnet/aspnetcore - 8e941eb42f819adb116b881195158b3887a70a1c + + https://dev.azure.com/dnceng/internal/_git/dotnet-aspnetcore + da7e9894ce22ef8cc02e5acc56e95a6f8cf8f644 - - https://github.com/dotnet/aspnetcore - 8e941eb42f819adb116b881195158b3887a70a1c + + https://dev.azure.com/dnceng/internal/_git/dotnet-aspnetcore + da7e9894ce22ef8cc02e5acc56e95a6f8cf8f644 - - https://github.com/dotnet/aspnetcore - 8e941eb42f819adb116b881195158b3887a70a1c + + https://dev.azure.com/dnceng/internal/_git/dotnet-aspnetcore + da7e9894ce22ef8cc02e5acc56e95a6f8cf8f644 - - https://github.com/dotnet/aspnetcore - 8e941eb42f819adb116b881195158b3887a70a1c + + https://dev.azure.com/dnceng/internal/_git/dotnet-aspnetcore + da7e9894ce22ef8cc02e5acc56e95a6f8cf8f644 - - https://github.com/dotnet/aspnetcore - 8e941eb42f819adb116b881195158b3887a70a1c + + https://dev.azure.com/dnceng/internal/_git/dotnet-aspnetcore + da7e9894ce22ef8cc02e5acc56e95a6f8cf8f644 - - https://github.com/dotnet/aspnetcore - 8e941eb42f819adb116b881195158b3887a70a1c + + https://dev.azure.com/dnceng/internal/_git/dotnet-aspnetcore + da7e9894ce22ef8cc02e5acc56e95a6f8cf8f644 - - https://github.com/dotnet/aspnetcore - 8e941eb42f819adb116b881195158b3887a70a1c + + https://dev.azure.com/dnceng/internal/_git/dotnet-aspnetcore + da7e9894ce22ef8cc02e5acc56e95a6f8cf8f644 - - https://github.com/dotnet/aspnetcore - 8e941eb42f819adb116b881195158b3887a70a1c + + https://dev.azure.com/dnceng/internal/_git/dotnet-aspnetcore + da7e9894ce22ef8cc02e5acc56e95a6f8cf8f644 - - https://github.com/dotnet/aspnetcore - 8e941eb42f819adb116b881195158b3887a70a1c + + https://dev.azure.com/dnceng/internal/_git/dotnet-aspnetcore + da7e9894ce22ef8cc02e5acc56e95a6f8cf8f644 diff --git a/eng/Versions.props b/eng/Versions.props index bcabd785546..86b0f86ac54 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -3,7 +3,7 @@ 8 2 0 - preview + rtm $(MajorVersion).$(MinorVersion).$(PatchVersion) @@ -12,7 +12,7 @@ - + release true @@ -48,7 +48,7 @@ 8.0.0 8.0.0 8.0.0 - 8.0.1 + 8.0.2 8.0.0 8.0.0 8.0.0 @@ -59,18 +59,18 @@ 8.0.0 8.0.0 8.0.0 - 8.0.1 + 8.0.2 8.0.0 - 8.0.1 - 8.0.1 - 8.0.1 - 8.0.1 - 8.0.1 - 8.0.1 - 8.0.1 - 8.0.1 - 8.0.1 + 8.0.2 + 8.0.2 + 8.0.2 + 8.0.2 + 8.0.2 + 8.0.2 + 8.0.2 + 8.0.2 + 8.0.2 - release + release true From b7f81954a2c94cf0b8f00e7bbb6e4c5a6bd57cb7 Mon Sep 17 00:00:00 2001 From: Jose Perez Rodriguez Date: Thu, 8 Feb 2024 13:09:40 -0800 Subject: [PATCH 155/172] Branding updates for 8.3 (#4927) --- eng/Versions.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/Versions.props b/eng/Versions.props index bcabd785546..b3dd69c70ea 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -1,7 +1,7 @@ 8 - 2 + 3 0 preview From 55aeea9c6f5edd92949f854d045e53557fac5883 Mon Sep 17 00:00:00 2001 From: Jeff Handley Date: Fri, 9 Feb 2024 10:20:54 -0800 Subject: [PATCH 156/172] Fix the automation for merged/closed PRs (#4930) --- .github/policies/resourceManagement.yml | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/.github/policies/resourceManagement.yml b/.github/policies/resourceManagement.yml index 610112662c3..6d85adda712 100644 --- a/.github/policies/resourceManagement.yml +++ b/.github/policies/resourceManagement.yml @@ -192,11 +192,8 @@ configuration: description: Remove closed issues from milestones - if: - payloadType: Pull_Request - - or: - - isAction: - action: Null - - isAction: - action: Closed + - isAction: + action: Closed then: - removeLabel: label: 'work in progress :construction:' @@ -217,4 +214,4 @@ configuration: label: 'waiting-author-feedback :mailbox_with_no_mail:' description: Remove intermediate labels from closed issue onFailure: -onSuccess: +onSuccess: From b5e9cc7a846ca98dca675ab415745c00d9ccecba Mon Sep 17 00:00:00 2001 From: Martin Taillefer Date: Fri, 9 Feb 2024 14:55:41 -0800 Subject: [PATCH 157/172] Remove broken and superfluous test case (#4934) Co-authored-by: Martin Taillefer --- .../FakeTimeProviderTests.cs | 8 -------- 1 file changed, 8 deletions(-) diff --git a/test/Libraries/Microsoft.Extensions.TimeProvider.Testing.Tests/FakeTimeProviderTests.cs b/test/Libraries/Microsoft.Extensions.TimeProvider.Testing.Tests/FakeTimeProviderTests.cs index 055ac5dc496..b7c70a715ae 100644 --- a/test/Libraries/Microsoft.Extensions.TimeProvider.Testing.Tests/FakeTimeProviderTests.cs +++ b/test/Libraries/Microsoft.Extensions.TimeProvider.Testing.Tests/FakeTimeProviderTests.cs @@ -168,14 +168,6 @@ public void ToStr() private readonly TimeSpan _infiniteTimeout = TimeSpan.FromMilliseconds(-1); - [Fact] - public void Delay_InvalidArgs() - { - var timeProvider = new FakeTimeProvider(); - _ = Assert.ThrowsAsync(() => timeProvider.Delay(TimeSpan.FromTicks(-1), CancellationToken.None)); - _ = Assert.ThrowsAsync(() => timeProvider.Delay(_infiniteTimeout, CancellationToken.None)); - } - [Fact] public async Task Delay_Zero() { From 6715d4faf418fe4ef80f2a2d0a46af0340473ce8 Mon Sep 17 00:00:00 2001 From: martintmk <103487740+martintmk@users.noreply.github.com> Date: Sat, 10 Feb 2024 17:23:13 +0100 Subject: [PATCH 158/172] Add gRPS resilience tests to verify interoperability (#4931) --- .spelling | 3 +- eng/packages/TestOnly.props | 1 + ...ft.Extensions.Http.Resilience.Tests.csproj | 11 ++ .../Protos/greet.proto | 21 ++++ .../Resilience/GrpcResilienceTests.cs | 101 ++++++++++++++++++ 5 files changed, 136 insertions(+), 1 deletion(-) create mode 100644 test/Libraries/Microsoft.Extensions.Http.Resilience.Tests/Protos/greet.proto create mode 100644 test/Libraries/Microsoft.Extensions.Http.Resilience.Tests/Resilience/GrpcResilienceTests.cs diff --git a/.spelling b/.spelling index be8e3729252..5b74629fa65 100644 --- a/.spelling +++ b/.spelling @@ -143,6 +143,7 @@ getters github Golang-ci gRPC +Grpc GuestUser hoc hotfix @@ -355,7 +356,7 @@ versioned versioning Versioning Virtualization -virtualization +virtualization VM WebAuth WebHost diff --git a/eng/packages/TestOnly.props b/eng/packages/TestOnly.props index d94f4b78586..2b93ee7b7d3 100644 --- a/eng/packages/TestOnly.props +++ b/eng/packages/TestOnly.props @@ -13,6 +13,7 @@ + diff --git a/test/Libraries/Microsoft.Extensions.Http.Resilience.Tests/Microsoft.Extensions.Http.Resilience.Tests.csproj b/test/Libraries/Microsoft.Extensions.Http.Resilience.Tests/Microsoft.Extensions.Http.Resilience.Tests.csproj index b1fc7a5907b..44aba460abd 100644 --- a/test/Libraries/Microsoft.Extensions.Http.Resilience.Tests/Microsoft.Extensions.Http.Resilience.Tests.csproj +++ b/test/Libraries/Microsoft.Extensions.Http.Resilience.Tests/Microsoft.Extensions.Http.Resilience.Tests.csproj @@ -13,6 +13,10 @@ + + + + @@ -28,9 +32,16 @@ + + + + + + + diff --git a/test/Libraries/Microsoft.Extensions.Http.Resilience.Tests/Protos/greet.proto b/test/Libraries/Microsoft.Extensions.Http.Resilience.Tests/Protos/greet.proto new file mode 100644 index 00000000000..a008b7933f6 --- /dev/null +++ b/test/Libraries/Microsoft.Extensions.Http.Resilience.Tests/Protos/greet.proto @@ -0,0 +1,21 @@ +syntax = "proto3"; + +option csharp_namespace = "Microsoft.Extensions.Http.Resilience.Test.Grpc"; + +package greet; + +// The greeting service definition. +service Greeter { + // Sends a greeting + rpc SayHello (HelloRequest) returns (HelloReply); +} + +// The request message containing the user's name. +message HelloRequest { + string name = 1; +} + +// The response message containing the greetings. +message HelloReply { + string message = 1; +} diff --git a/test/Libraries/Microsoft.Extensions.Http.Resilience.Tests/Resilience/GrpcResilienceTests.cs b/test/Libraries/Microsoft.Extensions.Http.Resilience.Tests/Resilience/GrpcResilienceTests.cs new file mode 100644 index 00000000000..a4fc4a7ddeb --- /dev/null +++ b/test/Libraries/Microsoft.Extensions.Http.Resilience.Tests/Resilience/GrpcResilienceTests.cs @@ -0,0 +1,101 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +#if !NETFRAMEWORK + +using System; +using System.Net.Http; +using System.Threading.Tasks; +using FluentAssertions; +using Grpc.Core; +using Microsoft.AspNetCore; +using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Hosting; +using Microsoft.AspNetCore.TestHost; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Http.Resilience.Test.Grpc; +using Polly; +using Xunit; + +namespace Microsoft.Extensions.Http.Resilience.Test.Resilience; + +public class GrpcResilienceTests +{ + private IWebHost _host; + private HttpMessageHandler _handler; + + public GrpcResilienceTests() + { + _host = WebHost + .CreateDefaultBuilder() + .ConfigureServices(services => services.AddGrpc()) + .Configure(builder => + { + builder.UseRouting(); + builder.UseEndpoints(endpoints => endpoints.MapGrpcService()); + }) + .UseTestServer() + .Start(); + + _handler = _host.GetTestServer().CreateHandler(); + } + + [Fact] + public async Task SayHello_NoResilience_OK() + { + var response = await CreateClient().SayHelloAsync(new HelloRequest { Name = "dummy" }); + + response.Message.Should().Be("HI!"); + } + + [Fact] + public async Task SayHello_StandardResilience_OK() + { + var response = await CreateClient(builder => builder.AddStandardResilienceHandler()).SayHelloAsync(new HelloRequest { Name = "dummy" }); + + response.Message.Should().Be("HI!"); + } + + [Fact] + public async Task SayHello_StandardHedging_OK() + { + var response = await CreateClient(builder => builder.AddStandardHedgingHandler()).SayHelloAsync(new HelloRequest { Name = "dummy" }); + + response.Message.Should().Be("HI!"); + } + + [Fact] + public async Task SayHello_CustomResilience_OK() + { + var client = CreateClient(builder => builder.AddResilienceHandler("custom", builder => builder.AddTimeout(TimeSpan.FromSeconds(1)))); + + var response = await client.SayHelloAsync(new HelloRequest { Name = "dummy" }); + + response.Message.Should().Be("HI!"); + } + + private Greeter.GreeterClient CreateClient(Action? configure = null) + { + var services = new ServiceCollection(); + var clientBuilder = services + .AddGrpcClient(options => + { + options.Address = _host.GetTestServer().BaseAddress; + }) + .ConfigurePrimaryHttpMessageHandler(() => _handler); + + configure?.Invoke(clientBuilder); + + return services.BuildServiceProvider().GetRequiredService(); + + } + + public class GreeterService : Greeter.GreeterBase + { + public override Task SayHello(HelloRequest request, ServerCallContext context) + { + return Task.FromResult(new HelloReply { Message = "HI!" }); + } + } +} +#endif From 2a6e51eb7924d628bb64703557878a61351eafa3 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Wed, 14 Feb 2024 19:53:42 +0000 Subject: [PATCH 159/172] Update dependencies from https://github.com/dotnet/arcade build 20240213.2 (#4946) [main] Update dependencies from dotnet/arcade --- NuGet.config | 2 +- eng/Version.Details.xml | 8 ++++---- eng/common/post-build/publish-using-darc.ps1 | 4 ++-- .../templates/job/publish-build-assets.yml | 14 +++++++------- eng/common/templates/post-build/post-build.yml | 16 ++++++++-------- .../templates/variables/pool-providers.yml | 12 ++++++------ global.json | 4 ++-- 7 files changed, 30 insertions(+), 30 deletions(-) diff --git a/NuGet.config b/NuGet.config index 86252ff07da..7c4c5d81081 100644 --- a/NuGet.config +++ b/NuGet.config @@ -27,7 +27,7 @@ - diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index c584bffdd0e..2267b52cc99 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -170,13 +170,13 @@ - + https://github.com/dotnet/arcade - 61ae141d2bf3534619265c8f691fd55dc3e75147 + da98edc4c3ea539f109ea320672136ceb32591a7 - + https://github.com/dotnet/arcade - 61ae141d2bf3534619265c8f691fd55dc3e75147 + da98edc4c3ea539f109ea320672136ceb32591a7 diff --git a/eng/common/post-build/publish-using-darc.ps1 b/eng/common/post-build/publish-using-darc.ps1 index 1e779fec4dd..5a3a32ea8d7 100644 --- a/eng/common/post-build/publish-using-darc.ps1 +++ b/eng/common/post-build/publish-using-darc.ps1 @@ -12,7 +12,7 @@ param( try { . $PSScriptRoot\post-build-utils.ps1 - $darc = Get-Darc + $darc = Get-Darc $optionalParams = [System.Collections.ArrayList]::new() @@ -46,7 +46,7 @@ try { } Write-Host 'done.' -} +} catch { Write-Host $_ Write-PipelineTelemetryError -Category 'PromoteBuild' -Message "There was an error while trying to publish build '$BuildId' to default channels." diff --git a/eng/common/templates/job/publish-build-assets.yml b/eng/common/templates/job/publish-build-assets.yml index fa5446c093d..8ec0151def2 100644 --- a/eng/common/templates/job/publish-build-assets.yml +++ b/eng/common/templates/job/publish-build-assets.yml @@ -58,7 +58,7 @@ jobs: demands: Cmd # If it's not devdiv, it's dnceng ${{ if ne(variables['System.TeamProject'], 'DevDiv') }}: - name: $(DncEngInternalBuildPool) + name: NetCore1ESPool-Publishing-Internal demands: ImageOverride -equals windows.vs2019.amd64 steps: @@ -71,7 +71,7 @@ jobs: checkDownloadedFiles: true condition: ${{ parameters.condition }} continueOnError: ${{ parameters.continueOnError }} - + - task: NuGetAuthenticate@1 - task: PowerShell@2 @@ -86,7 +86,7 @@ jobs: /p:OfficialBuildId=$(Build.BuildNumber) condition: ${{ parameters.condition }} continueOnError: ${{ parameters.continueOnError }} - + - task: powershell@2 displayName: Create ReleaseConfigs Artifact inputs: @@ -95,7 +95,7 @@ jobs: Add-Content -Path "$(Build.StagingDirectory)/ReleaseConfigs.txt" -Value $(BARBuildId) Add-Content -Path "$(Build.StagingDirectory)/ReleaseConfigs.txt" -Value "$(DefaultChannels)" Add-Content -Path "$(Build.StagingDirectory)/ReleaseConfigs.txt" -Value $(IsStableBuild) - + - task: PublishBuildArtifacts@1 displayName: Publish ReleaseConfigs Artifact inputs: @@ -121,7 +121,7 @@ jobs: - task: PublishBuildArtifacts@1 displayName: Publish SymbolPublishingExclusionsFile Artifact - condition: eq(variables['SymbolExclusionFile'], 'true') + condition: eq(variables['SymbolExclusionFile'], 'true') inputs: PathtoPublish: '$(Build.SourcesDirectory)/eng/SymbolPublishingExclusionsFile.txt' PublishLocation: Container @@ -137,7 +137,7 @@ jobs: displayName: Publish Using Darc inputs: filePath: $(Build.SourcesDirectory)/eng/common/post-build/publish-using-darc.ps1 - arguments: -BuildId $(BARBuildId) + arguments: -BuildId $(BARBuildId) -PublishingInfraVersion 3 -AzdoToken '$(publishing-dnceng-devdiv-code-r-build-re)' -MaestroToken '$(MaestroApiAccessToken)' @@ -148,4 +148,4 @@ jobs: - ${{ if eq(parameters.enablePublishBuildArtifacts, 'true') }}: - template: /eng/common/templates/steps/publish-logs.yml parameters: - JobLabel: 'Publish_Artifacts_Logs' + JobLabel: 'Publish_Artifacts_Logs' diff --git a/eng/common/templates/post-build/post-build.yml b/eng/common/templates/post-build/post-build.yml index 3f74abf7ce0..aba44a25a33 100644 --- a/eng/common/templates/post-build/post-build.yml +++ b/eng/common/templates/post-build/post-build.yml @@ -39,7 +39,7 @@ parameters: displayName: Enable NuGet validation type: boolean default: true - + - name: publishInstallersAndChecksums displayName: Publish installers and checksums type: boolean @@ -131,8 +131,8 @@ stages: displayName: Validate inputs: filePath: $(Build.SourcesDirectory)/eng/common/post-build/nuget-validation.ps1 - arguments: -PackagesPath $(Build.ArtifactStagingDirectory)/PackageArtifacts/ - -ToolDestinationPath $(Agent.BuildDirectory)/Extract/ + arguments: -PackagesPath $(Build.ArtifactStagingDirectory)/PackageArtifacts/ + -ToolDestinationPath $(Agent.BuildDirectory)/Extract/ - job: displayName: Signing Validation @@ -221,9 +221,9 @@ stages: displayName: Validate inputs: filePath: $(Build.SourcesDirectory)/eng/common/post-build/sourcelink-validation.ps1 - arguments: -InputPath $(Build.ArtifactStagingDirectory)/BlobArtifacts/ - -ExtractPath $(Agent.BuildDirectory)/Extract/ - -GHRepoName $(Build.Repository.Name) + arguments: -InputPath $(Build.ArtifactStagingDirectory)/BlobArtifacts/ + -ExtractPath $(Agent.BuildDirectory)/Extract/ + -GHRepoName $(Build.Repository.Name) -GHCommit $(Build.SourceVersion) -SourcelinkCliVersion $(SourceLinkCLIVersion) continueOnError: true @@ -258,7 +258,7 @@ stages: demands: Cmd # If it's not devdiv, it's dnceng ${{ else }}: - name: $(DncEngInternalBuildPool) + name: NetCore1ESPool-Publishing-Internal demands: ImageOverride -equals windows.vs2019.amd64 steps: - template: setup-maestro-vars.yml @@ -272,7 +272,7 @@ stages: displayName: Publish Using Darc inputs: filePath: $(Build.SourcesDirectory)/eng/common/post-build/publish-using-darc.ps1 - arguments: -BuildId $(BARBuildId) + arguments: -BuildId $(BARBuildId) -PublishingInfraVersion ${{ parameters.publishingInfraVersion }} -AzdoToken '$(publishing-dnceng-devdiv-code-r-build-re)' -MaestroToken '$(MaestroApiAccessToken)' diff --git a/eng/common/templates/variables/pool-providers.yml b/eng/common/templates/variables/pool-providers.yml index 9cc5c550d3b..d236f9fdbb1 100644 --- a/eng/common/templates/variables/pool-providers.yml +++ b/eng/common/templates/variables/pool-providers.yml @@ -1,15 +1,15 @@ -# Select a pool provider based off branch name. Anything with branch name containing 'release' must go into an -Svc pool, +# Select a pool provider based off branch name. Anything with branch name containing 'release' must go into an -Svc pool, # otherwise it should go into the "normal" pools. This separates out the queueing and billing of released branches. -# Motivation: +# Motivation: # Once a given branch of a repository's output has been officially "shipped" once, it is then considered to be COGS # (Cost of goods sold) and should be moved to a servicing pool provider. This allows both separation of queueing # (allowing release builds and main PR builds to not intefere with each other) and billing (required for COGS. -# Additionally, the pool provider name itself may be subject to change when the .NET Core Engineering Services -# team needs to move resources around and create new and potentially differently-named pools. Using this template +# Additionally, the pool provider name itself may be subject to change when the .NET Core Engineering Services +# team needs to move resources around and create new and potentially differently-named pools. Using this template # file from an Arcade-ified repo helps guard against both having to update one's release/* branches and renaming. -# How to use: +# How to use: # This yaml assumes your shipped product branches use the naming convention "release/..." (which many do). # If we find alternate naming conventions in broad usage it can be added to the condition below. # @@ -54,4 +54,4 @@ variables: False, 'NetCore1ESPool-Internal' ) - ] \ No newline at end of file + ] diff --git a/global.json b/global.json index af41c30bd37..75bb4555131 100644 --- a/global.json +++ b/global.json @@ -16,7 +16,7 @@ "msbuild-sdks": { "Microsoft.Build.NoTargets": "3.7.0", "Microsoft.Build.Traversal": "3.2.0", - "Microsoft.DotNet.Arcade.Sdk": "8.0.0-beta.24059.4", - "Microsoft.DotNet.Helix.Sdk": "8.0.0-beta.24059.4" + "Microsoft.DotNet.Arcade.Sdk": "8.0.0-beta.24113.2", + "Microsoft.DotNet.Helix.Sdk": "8.0.0-beta.24113.2" } } From a8e17517bd5150cc0f992b66aa6591c7c6fbdfc4 Mon Sep 17 00:00:00 2001 From: Damian Horna Date: Thu, 15 Feb 2024 05:35:29 +0100 Subject: [PATCH 160/172] Hashcode implementation proposal for DataClassificationSet (#4933) --- .../Classification/DataClassificationSet.cs | 37 +++++++++++++++-- .../Microsoft.Gen.Logging/Generated/Utils.cs | 3 +- .../DataClassificationSetTests.cs | 18 ++++++++ .../RedactorProviderTests.cs | 41 +++++++++++++++++++ 4 files changed, 94 insertions(+), 5 deletions(-) diff --git a/src/Libraries/Microsoft.Extensions.Compliance.Abstractions/Classification/DataClassificationSet.cs b/src/Libraries/Microsoft.Extensions.Compliance.Abstractions/Classification/DataClassificationSet.cs index 6a041e49524..3fb3ce652c9 100644 --- a/src/Libraries/Microsoft.Extensions.Compliance.Abstractions/Classification/DataClassificationSet.cs +++ b/src/Libraries/Microsoft.Extensions.Compliance.Abstractions/Classification/DataClassificationSet.cs @@ -15,6 +15,7 @@ namespace Microsoft.Extensions.Compliance.Classification; public sealed class DataClassificationSet : IEquatable { private readonly HashSet _classifications = []; + private readonly int _cachedHashCode; /// /// Initializes a new instance of the class. @@ -23,6 +24,7 @@ public sealed class DataClassificationSet : IEquatable public DataClassificationSet(DataClassification classification) { _ = _classifications.Add(classification); + _cachedHashCode = ComputeHashCode(); } /// @@ -33,6 +35,7 @@ public DataClassificationSet(IEnumerable classifications) { _ = Throw.IfNull(classifications); _classifications.UnionWith(classifications); + _cachedHashCode = ComputeHashCode(); } /// @@ -43,6 +46,7 @@ public DataClassificationSet(params DataClassification[] classifications) { _ = Throw.IfNull(classifications); _classifications.UnionWith(classifications); + _cachedHashCode = ComputeHashCode(); } /// @@ -73,17 +77,17 @@ public DataClassificationSet Union(DataClassificationSet other) { _ = Throw.IfNull(other); - var result = new DataClassificationSet(other._classifications); - result._classifications.UnionWith(_classifications); + var combinedClassifications = new HashSet(_classifications); + combinedClassifications.UnionWith(other._classifications); - return result; + return new DataClassificationSet(combinedClassifications); } /// /// Gets a hash code for the current object instance. /// /// The hash code value. - public override int GetHashCode() => _classifications.GetHashCode(); + public override int GetHashCode() => _cachedHashCode; /// /// Compares an object with the current instance to see if they contain the same classifications. @@ -131,4 +135,29 @@ public override string ToString() return result; } + + /// + /// Computes the hash code for the current object instance. + /// + /// The computed hash code. + private int ComputeHashCode() + { +#if NETFRAMEWORK + int hash = 0; + foreach (var item in _classifications) + { + hash ^= item.GetHashCode(); + } + + return hash; +#else + var hash = default(HashCode); + foreach (var item in _classifications) + { + hash.Add(item); + } + + return hash.ToHashCode(); +#endif + } } diff --git a/test/Generators/Microsoft.Gen.Logging/Generated/Utils.cs b/test/Generators/Microsoft.Gen.Logging/Generated/Utils.cs index abbb3225b8b..f90a504d31e 100644 --- a/test/Generators/Microsoft.Gen.Logging/Generated/Utils.cs +++ b/test/Generators/Microsoft.Gen.Logging/Generated/Utils.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Generic; +using Microsoft.Extensions.Compliance.Classification; using Microsoft.Extensions.Compliance.Redaction; using Microsoft.Extensions.Compliance.Testing; using Microsoft.Extensions.DependencyInjection; @@ -82,7 +83,7 @@ public static TestLogger GetLogger() { builder.SetRedactor(new PublicDataAttribute().Classification); builder.SetRedactor(new PrivateDataAttribute().Classification); - builder.SetRedactor(new PrivateDataAttribute().Classification, new PublicDataAttribute().Classification); + builder.SetRedactor(new DataClassificationSet(new PrivateDataAttribute().Classification, new PublicDataAttribute().Classification)); builder.SetFallbackRedactor(); }); diff --git a/test/Libraries/Microsoft.Extensions.Compliance.Abstractions.Tests/Classification/DataClassificationSetTests.cs b/test/Libraries/Microsoft.Extensions.Compliance.Abstractions.Tests/Classification/DataClassificationSetTests.cs index 37b91bc9c75..921139049a0 100644 --- a/test/Libraries/Microsoft.Extensions.Compliance.Abstractions.Tests/Classification/DataClassificationSetTests.cs +++ b/test/Libraries/Microsoft.Extensions.Compliance.Abstractions.Tests/Classification/DataClassificationSetTests.cs @@ -30,4 +30,22 @@ public static void Basic() Assert.False(dc1.Equals(null)); #pragma warning restore CA1508 // Avoid dead conditional code } + + [Fact] + public static void TestHashCodes() + { + var dc1 = new DataClassificationSet(FakeTaxonomy.PublicData); + var dc2 = new DataClassificationSet(new[] { FakeTaxonomy.PublicData }); + var dc3 = new DataClassificationSet(new List { FakeTaxonomy.PublicData }); + var dc4 = (DataClassificationSet)FakeTaxonomy.PublicData; + var dc5 = DataClassificationSet.FromDataClassification(FakeTaxonomy.PublicData); + + Assert.Equal(dc1.GetHashCode(), dc2.GetHashCode()); + Assert.Equal(dc1.GetHashCode(), dc3.GetHashCode()); + Assert.Equal(dc1.GetHashCode(), dc4.GetHashCode()); + Assert.Equal(dc1.GetHashCode(), dc5.GetHashCode()); + + var dc6 = dc1.Union(FakeTaxonomy.PrivateData); + Assert.NotEqual(dc1, dc6); + } } diff --git a/test/Libraries/Microsoft.Extensions.Compliance.Redaction.Tests/RedactorProviderTests.cs b/test/Libraries/Microsoft.Extensions.Compliance.Redaction.Tests/RedactorProviderTests.cs index 550058c7901..0a7c97f34f1 100644 --- a/test/Libraries/Microsoft.Extensions.Compliance.Redaction.Tests/RedactorProviderTests.cs +++ b/test/Libraries/Microsoft.Extensions.Compliance.Redaction.Tests/RedactorProviderTests.cs @@ -3,6 +3,7 @@ using System; using Microsoft.Extensions.Compliance.Classification; +using Microsoft.Extensions.DependencyInjection; using Xunit; namespace Microsoft.Extensions.Compliance.Redaction.Test; @@ -46,6 +47,46 @@ public void RedactorProvider_Returns_Redactor_For_Data_Classifications() Assert.Equal(typeof(ErasingRedactor), r3.GetType()); } + [Fact] + public void RedactorProvider_Returns_Same_Redactor_For_Logically_Same_Data_Classification() + { + var dc1 = new DataClassificationSet(new DataClassification("DummyTaxonomy", "Classification")); + var dc2 = new DataClassificationSet(new DataClassification("DummyTaxonomy", "Classification2")); + var dc3 = new DataClassificationSet(new DataClassification("DummyTaxonomy", "Classification3")); + var dc4 = new DataClassificationSet(new DataClassification("DummyTaxonomy", "Classification4")); + var dc5 = new DataClassificationSet(new DataClassification("DummyTaxonomy", "Classification5")); + var dc6 = new DataClassificationSet(new DataClassification("DummyTaxonomy", "Classification6")); + var dc7 = new DataClassificationSet(new DataClassification("DummyTaxonomy", "Classification7")); + var dc8 = new DataClassificationSet(new DataClassification("DummyTaxonomy", "Classification8")); + + var dc9 = new DataClassification("DummyTaxonomy", "Classification9"); + + var dc1LogicalCopy = new DataClassificationSet(new[] { new DataClassification("DummyTaxonomy", "Classification") }); + + var redactorProvider = new ServiceCollection() + .AddRedaction(redaction => + { + redaction.SetRedactor(dc1); + redaction.SetRedactor(dc2); + redaction.SetRedactor(dc3); + redaction.SetRedactor(dc4); + redaction.SetRedactor(dc5); + redaction.SetRedactor(dc6); + redaction.SetRedactor(dc7); + redaction.SetRedactor(dc8); + }) + .BuildServiceProvider() + .GetRequiredService(); + + var r1 = redactorProvider.GetRedactor(dc1); + var r2 = redactorProvider.GetRedactor(dc1LogicalCopy); + var r3 = redactorProvider.GetRedactor(dc9); + + Assert.Equal(typeof(NullRedactor), r1.GetType()); + Assert.Equal(typeof(NullRedactor), r2.GetType()); + Assert.Equal(typeof(ErasingRedactor), r3.GetType()); + } + [Fact] public void RedactorProvider_Throws_On_Ctor_When_Options_Come_As_Null() { From e65a581983db8acf6f10484b35cf7b5a68df2f00 Mon Sep 17 00:00:00 2001 From: Eric St-Georges Date: Wed, 21 Feb 2024 10:04:17 -0500 Subject: [PATCH 161/172] Fix IL2091 warnings (#4953) * Fix IL2091 warnings Part of #4002 Added DynamicallyAccessedMembers attributes where the warning was found removed IL2091 from NoWarn in Directory.Build.targets * Remove more warnings that are no longer necessary. * Remove Memoize with 3 parameters. This code isn't being used. --------- Co-authored-by: Eric Erhardt --- Directory.Build.targets | 2 +- .../HttpLoggingServiceCollectionExtensions.cs | 2 +- .../AutoActivationExtensions.Keyed.cs | 8 +- .../AutoActivationExtensions.cs | 8 +- .../IResourceMonitorBuilder.cs | 3 +- .../ResourceMonitorBuilder.cs | 3 +- ...pDiagnosticsServiceCollectionExtensions.cs | 3 +- ...lientLoggingServiceCollectionExtensions.cs | 3 +- .../Logging/Internal/OptionsExtensions.cs | 4 +- .../Internal/NamedOptionsCache.cs | 3 +- .../Resilience/ResilienceHandlerContext.cs | 2 +- .../ContextualOptionsFactory.cs | 2 +- .../EnrichmentServiceCollectionExtensions.cs | 5 +- src/Shared/Memoization/Memoize.cs | 28 +---- src/Shared/Memoization/MemoizedFunction.cs | 84 +------------ test/Shared/Memoization/MemoizeTests.cs | 113 ------------------ 16 files changed, 34 insertions(+), 239 deletions(-) diff --git a/Directory.Build.targets b/Directory.Build.targets index 3dcffa62576..c6fd3b479e4 100644 --- a/Directory.Build.targets +++ b/Directory.Build.targets @@ -20,7 +20,7 @@ $(NoWarn);TBD - $(NoWarn);IL2026;IL2087;IL2067;IL2075;IL2091;IL2072;IL2090;CA1825;IL2070;IL2098;IL2057 + $(NoWarn);IL2026;IL2087;IL2067;CA1825 $(NoWarn);AD0001 diff --git a/src/Libraries/Microsoft.AspNetCore.Diagnostics.Middleware/Logging/HttpLoggingServiceCollectionExtensions.cs b/src/Libraries/Microsoft.AspNetCore.Diagnostics.Middleware/Logging/HttpLoggingServiceCollectionExtensions.cs index 7de962db012..c98055ff8b1 100644 --- a/src/Libraries/Microsoft.AspNetCore.Diagnostics.Middleware/Logging/HttpLoggingServiceCollectionExtensions.cs +++ b/src/Libraries/Microsoft.AspNetCore.Diagnostics.Middleware/Logging/HttpLoggingServiceCollectionExtensions.cs @@ -70,7 +70,7 @@ public static IServiceCollection AddHttpLoggingRedaction(this IServiceCollection /// The to add the instance of to. /// The value of . /// is . - public static IServiceCollection AddHttpLogEnricher(this IServiceCollection services) + public static IServiceCollection AddHttpLogEnricher<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] T>(this IServiceCollection services) where T : class, IHttpLogEnricher { _ = Throw.IfNull(services); diff --git a/src/Libraries/Microsoft.Extensions.DependencyInjection.AutoActivation/AutoActivationExtensions.Keyed.cs b/src/Libraries/Microsoft.Extensions.DependencyInjection.AutoActivation/AutoActivationExtensions.Keyed.cs index 88a4d5d10e4..e994c858b55 100644 --- a/src/Libraries/Microsoft.Extensions.DependencyInjection.AutoActivation/AutoActivationExtensions.Keyed.cs +++ b/src/Libraries/Microsoft.Extensions.DependencyInjection.AutoActivation/AutoActivationExtensions.Keyed.cs @@ -122,7 +122,7 @@ public static IServiceCollection AddActivatedKeyedSingletonThe type of the service to add. /// The type of the implementation to use. /// The value of . - public static IServiceCollection AddActivatedKeyedSingleton( + public static IServiceCollection AddActivatedKeyedSingleton( this IServiceCollection services, object? serviceKey) where TService : class @@ -159,7 +159,7 @@ public static IServiceCollection AddActivatedKeyedSingleton( /// An object used to uniquely identify the specific service. /// The type of the service to add. /// The value of . - public static IServiceCollection AddActivatedKeyedSingleton( + public static IServiceCollection AddActivatedKeyedSingleton<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] TService>( this IServiceCollection services, object? serviceKey) where TService : class @@ -298,7 +298,7 @@ public static void TryAddActivatedKeyedSingleton( /// The service collection to add the service to. /// An object used to uniquely identify the specific service. /// The type of the service to add. - public static void TryAddActivatedKeyedSingleton( + public static void TryAddActivatedKeyedSingleton<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] TService>( this IServiceCollection services, object? serviceKey) where TService : class @@ -315,7 +315,7 @@ public static void TryAddActivatedKeyedSingleton( /// An object used to uniquely identify the specific service. /// The type of the service to add. /// The type of the implementation to use. - public static void TryAddActivatedKeyedSingleton( + public static void TryAddActivatedKeyedSingleton( this IServiceCollection services, object? serviceKey) where TService : class diff --git a/src/Libraries/Microsoft.Extensions.DependencyInjection.AutoActivation/AutoActivationExtensions.cs b/src/Libraries/Microsoft.Extensions.DependencyInjection.AutoActivation/AutoActivationExtensions.cs index 7b9c5c8a450..f73b4f5060c 100644 --- a/src/Libraries/Microsoft.Extensions.DependencyInjection.AutoActivation/AutoActivationExtensions.cs +++ b/src/Libraries/Microsoft.Extensions.DependencyInjection.AutoActivation/AutoActivationExtensions.cs @@ -114,7 +114,7 @@ public static IServiceCollection AddActivatedSingletonThe type of the service to add. /// The type of the implementation to use. /// The value of . - public static IServiceCollection AddActivatedSingleton(this IServiceCollection services) + public static IServiceCollection AddActivatedSingleton(this IServiceCollection services) where TService : class where TImplementation : class, TService { @@ -149,7 +149,7 @@ public static IServiceCollection AddActivatedSingleton(this IServiceCo /// The service collection to add the service to. /// The type of the service to add. /// The value of . - public static IServiceCollection AddActivatedSingleton(this IServiceCollection services) + public static IServiceCollection AddActivatedSingleton<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] TService>(this IServiceCollection services) where TService : class { _ = Throw.IfNull(services); @@ -260,7 +260,7 @@ public static void TryAddActivatedSingleton(this IServiceCollection services, Ty /// /// The service collection to add the service to. /// The type of the service to add. - public static void TryAddActivatedSingleton(this IServiceCollection services) + public static void TryAddActivatedSingleton<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] TService>(this IServiceCollection services) where TService : class { _ = Throw.IfNull(services); @@ -274,7 +274,7 @@ public static void TryAddActivatedSingleton(this IServiceCollection se /// The service collection to add the service to. /// The type of the service to add. /// The type of the implementation to use. - public static void TryAddActivatedSingleton(this IServiceCollection services) + public static void TryAddActivatedSingleton(this IServiceCollection services) where TService : class where TImplementation : class, TService { diff --git a/src/Libraries/Microsoft.Extensions.Diagnostics.ResourceMonitoring/IResourceMonitorBuilder.cs b/src/Libraries/Microsoft.Extensions.Diagnostics.ResourceMonitoring/IResourceMonitorBuilder.cs index 75ba9302af5..4890ea1bd1a 100644 --- a/src/Libraries/Microsoft.Extensions.Diagnostics.ResourceMonitoring/IResourceMonitorBuilder.cs +++ b/src/Libraries/Microsoft.Extensions.Diagnostics.ResourceMonitoring/IResourceMonitorBuilder.cs @@ -1,6 +1,7 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. +using System.Diagnostics.CodeAnalysis; using Microsoft.Extensions.DependencyInjection; namespace Microsoft.Extensions.Diagnostics.ResourceMonitoring; @@ -20,6 +21,6 @@ public interface IResourceMonitorBuilder /// /// The publisher's implementation type. /// The value of the object instance. - IResourceMonitorBuilder AddPublisher() + IResourceMonitorBuilder AddPublisher<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] T>() where T : class, IResourceUtilizationPublisher; } diff --git a/src/Libraries/Microsoft.Extensions.Diagnostics.ResourceMonitoring/ResourceMonitorBuilder.cs b/src/Libraries/Microsoft.Extensions.Diagnostics.ResourceMonitoring/ResourceMonitorBuilder.cs index 0d4a880008a..4f9f5c9284f 100644 --- a/src/Libraries/Microsoft.Extensions.Diagnostics.ResourceMonitoring/ResourceMonitorBuilder.cs +++ b/src/Libraries/Microsoft.Extensions.Diagnostics.ResourceMonitoring/ResourceMonitorBuilder.cs @@ -1,6 +1,7 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. +using System.Diagnostics.CodeAnalysis; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection.Extensions; using Microsoft.Extensions.Hosting; @@ -20,7 +21,7 @@ public ResourceMonitorBuilder(IServiceCollection services) Services = services; } - public IResourceMonitorBuilder AddPublisher() + public IResourceMonitorBuilder AddPublisher<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] T>() where T : class, IResourceUtilizationPublisher { Services.TryAddEnumerable(ServiceDescriptor.Singleton()); diff --git a/src/Libraries/Microsoft.Extensions.Http.Diagnostics/Http/HttpDiagnosticsServiceCollectionExtensions.cs b/src/Libraries/Microsoft.Extensions.Http.Diagnostics/Http/HttpDiagnosticsServiceCollectionExtensions.cs index eafb265c7b1..6cdcd74b263 100644 --- a/src/Libraries/Microsoft.Extensions.Http.Diagnostics/Http/HttpDiagnosticsServiceCollectionExtensions.cs +++ b/src/Libraries/Microsoft.Extensions.Http.Diagnostics/Http/HttpDiagnosticsServiceCollectionExtensions.cs @@ -1,6 +1,7 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. +using System.Diagnostics.CodeAnalysis; using Microsoft.Extensions.DependencyInjection.Extensions; using Microsoft.Extensions.Http.Diagnostics; using Microsoft.Extensions.Telemetry.Internal; @@ -34,7 +35,7 @@ public static IServiceCollection AddDownstreamDependencyMetadata(this IServiceCo /// instance to be registered. /// object instance. /// The value of . - public static IServiceCollection AddDownstreamDependencyMetadata(this IServiceCollection services) + public static IServiceCollection AddDownstreamDependencyMetadata<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] T>(this IServiceCollection services) where T : class, IDownstreamDependencyMetadata { _ = Throw.IfNull(services); diff --git a/src/Libraries/Microsoft.Extensions.Http.Diagnostics/Logging/HttpClientLoggingServiceCollectionExtensions.cs b/src/Libraries/Microsoft.Extensions.Http.Diagnostics/Logging/HttpClientLoggingServiceCollectionExtensions.cs index 748cdad5366..aa0f2ce78d1 100644 --- a/src/Libraries/Microsoft.Extensions.Http.Diagnostics/Logging/HttpClientLoggingServiceCollectionExtensions.cs +++ b/src/Libraries/Microsoft.Extensions.Http.Diagnostics/Logging/HttpClientLoggingServiceCollectionExtensions.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. using System; +using System.Diagnostics.CodeAnalysis; using System.Net.Http; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection.Extensions; @@ -97,7 +98,7 @@ public static IServiceCollection AddExtendedHttpClientLogging(this IServiceColle /// Type of enricher. /// The to add the instance of to. /// The value of . - public static IServiceCollection AddHttpClientLogEnricher(this IServiceCollection services) + public static IServiceCollection AddHttpClientLogEnricher<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] T>(this IServiceCollection services) where T : class, IHttpClientLogEnricher => Throw.IfNull(services).AddActivatedSingleton(); } diff --git a/src/Libraries/Microsoft.Extensions.Http.Diagnostics/Logging/Internal/OptionsExtensions.cs b/src/Libraries/Microsoft.Extensions.Http.Diagnostics/Logging/Internal/OptionsExtensions.cs index abc7ee602bd..9cdc4765a75 100644 --- a/src/Libraries/Microsoft.Extensions.Http.Diagnostics/Logging/Internal/OptionsExtensions.cs +++ b/src/Libraries/Microsoft.Extensions.Http.Diagnostics/Logging/Internal/OptionsExtensions.cs @@ -1,6 +1,7 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. +using System.Diagnostics.CodeAnalysis; using Microsoft.Extensions.Options; namespace Microsoft.Extensions.Http.Logging.Internal; @@ -14,7 +15,8 @@ internal static class OptionsExtensions /// The to load the options object from. /// An optional string that specifies the name of the options object to get. /// The instance. - public static TOptions GetKeyedOrCurrent(this IOptionsMonitor optionsMonitor, string? serviceKey) + public static TOptions GetKeyedOrCurrent<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)] TOptions>( + this IOptionsMonitor optionsMonitor, string? serviceKey) where TOptions : class { if (serviceKey is null) diff --git a/src/Libraries/Microsoft.Extensions.Http.Resilience/Internal/NamedOptionsCache.cs b/src/Libraries/Microsoft.Extensions.Http.Resilience/Internal/NamedOptionsCache.cs index d9dfbf61310..5a175f46f49 100644 --- a/src/Libraries/Microsoft.Extensions.Http.Resilience/Internal/NamedOptionsCache.cs +++ b/src/Libraries/Microsoft.Extensions.Http.Resilience/Internal/NamedOptionsCache.cs @@ -1,6 +1,7 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. +using System.Diagnostics.CodeAnalysis; using Microsoft.Extensions.Options; namespace Microsoft.Extensions.Http.Resilience.Internal; @@ -9,7 +10,7 @@ namespace Microsoft.Extensions.Http.Resilience.Internal; /// The cache for named options that allows accessing the last valid options instance. /// /// The type of options. -internal sealed class NamedOptionsCache +internal sealed class NamedOptionsCache<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)] TOptions> { public NamedOptionsCache(string optionsName, IOptionsMonitor optionsMonitor) { diff --git a/src/Libraries/Microsoft.Extensions.Http.Resilience/Resilience/ResilienceHandlerContext.cs b/src/Libraries/Microsoft.Extensions.Http.Resilience/Resilience/ResilienceHandlerContext.cs index 3f5e1691abc..478abb419a0 100644 --- a/src/Libraries/Microsoft.Extensions.Http.Resilience/Resilience/ResilienceHandlerContext.cs +++ b/src/Libraries/Microsoft.Extensions.Http.Resilience/Resilience/ResilienceHandlerContext.cs @@ -61,7 +61,7 @@ internal ResilienceHandlerContext(AddResiliencePipelineContext context) /// If is then the global options are returned. /// By default, the parameter is . /// - public TOptions GetOptions(string? name = null) => _context.GetOptions(name); + public TOptions GetOptions<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)] TOptions>(string? name = null) => _context.GetOptions(name); /// /// Registers a callback that is called when the pipeline instance being configured is disposed. diff --git a/src/Libraries/Microsoft.Extensions.Options.Contextual/ContextualOptionsFactory.cs b/src/Libraries/Microsoft.Extensions.Options.Contextual/ContextualOptionsFactory.cs index 4d951e52a50..f044d9eedd2 100644 --- a/src/Libraries/Microsoft.Extensions.Options.Contextual/ContextualOptionsFactory.cs +++ b/src/Libraries/Microsoft.Extensions.Options.Contextual/ContextualOptionsFactory.cs @@ -17,7 +17,7 @@ namespace Microsoft.Extensions.Options.Contextual; /// Implementation of . /// /// The type of options being requested. -internal sealed class ContextualOptionsFactory : IContextualOptionsFactory +internal sealed class ContextualOptionsFactory<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] TOptions> : IContextualOptionsFactory where TOptions : class { private readonly IOptionsFactory _baseFactory; diff --git a/src/Libraries/Microsoft.Extensions.Telemetry.Abstractions/Enrichment/EnrichmentServiceCollectionExtensions.cs b/src/Libraries/Microsoft.Extensions.Telemetry.Abstractions/Enrichment/EnrichmentServiceCollectionExtensions.cs index 6ab3a944523..cc9485c7ede 100644 --- a/src/Libraries/Microsoft.Extensions.Telemetry.Abstractions/Enrichment/EnrichmentServiceCollectionExtensions.cs +++ b/src/Libraries/Microsoft.Extensions.Telemetry.Abstractions/Enrichment/EnrichmentServiceCollectionExtensions.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. using System; +using System.Diagnostics.CodeAnalysis; using Microsoft.Extensions.Diagnostics.Enrichment; using Microsoft.Shared.Diagnostics; @@ -19,7 +20,7 @@ public static class EnrichmentServiceCollectionExtensions /// Enricher type. /// The value of . /// is . - public static IServiceCollection AddLogEnricher(this IServiceCollection services) + public static IServiceCollection AddLogEnricher<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] T>(this IServiceCollection services) where T : class, ILogEnricher => Throw.IfNull(services).AddSingleton(); @@ -40,7 +41,7 @@ public static IServiceCollection AddLogEnricher(this IServiceCollection services /// Enricher type. /// The value of . /// is . - public static IServiceCollection AddStaticLogEnricher(this IServiceCollection services) + public static IServiceCollection AddStaticLogEnricher<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] T>(this IServiceCollection services) where T : class, IStaticLogEnricher => Throw.IfNull(services).AddSingleton(); diff --git a/src/Shared/Memoization/Memoize.cs b/src/Shared/Memoization/Memoize.cs index 1b6c6691009..e8ef1ed0ac5 100644 --- a/src/Shared/Memoization/Memoize.cs +++ b/src/Shared/Memoization/Memoize.cs @@ -9,7 +9,7 @@ namespace Microsoft.Shared.Memoization; #pragma warning restore CA1716 /// -/// Given a function of arity N (1 <= N <= 3), return a function that behaves identically, except that +/// Given a function of arity N (1 <= N <= 2), return a function that behaves identically, except that /// repeated invocations with the same parameters return a cached value rather than redoing the computation. /// /// @@ -38,7 +38,7 @@ internal static class Memoize /// Func is freed. If you're computing values for large numbers of inputs, bear this in mind: if /// the Func lives for a long time, memory usage can increase without bound. /// - public static Func Function(Func f) + public static Func Function(Func f) => new MemoizedFunction(f).Function; /// @@ -54,27 +54,7 @@ public static Func Function(Func - public static Func Function(Func f) + public static Func Function( + Func f) => new MemoizedFunction(f).Function; - - /// - /// Returns a function that remembers the results of previous invocations of the given function. - /// - /// The type of the function's first parameter. - /// The type of the function's second parameter. - /// The type of the function's third parameter. - /// The function output type. - /// The function that needs to be memoized. - /// A function that appears identical to the original function, but duplicate invocations are nearly instant. - /// - /// Computed values consume memory. Garbage collection will free up that memory when the returned - /// Func is freed. If you're computing values for large numbers of inputs, bear this in mind: if - /// the Func lives for a long time, memory usage can increase without bound. - /// - [SuppressMessage( - "Major Code Smell", - "S2436:Types and methods should not have too many generic parameters", - Justification = "We're using many generic types for the same reason Func<>, Func<,>, Func<,,>, ... exist.")] - public static Func Function(Func f) - => new MemoizedFunction(f).Function; } diff --git a/src/Shared/Memoization/MemoizedFunction.cs b/src/Shared/Memoization/MemoizedFunction.cs index 2fcbfb3d4d1..57f853190bc 100644 --- a/src/Shared/Memoization/MemoizedFunction.cs +++ b/src/Shared/Memoization/MemoizedFunction.cs @@ -28,7 +28,7 @@ namespace Microsoft.Shared.Memoization; #endif [DebuggerDisplay("{_values.Count} memoized values")] -internal sealed class MemoizedFunction +internal sealed class MemoizedFunction { private const int Concurrency = 10; private const int Capacity = 100; @@ -99,7 +99,7 @@ internal TResult Function(TParameter arg1) "S2436:Types and methods should not have too many generic parameters", Justification = "We're using many generic types for the same reason Func<>, Func<,>, Func<,,>, ... exist.")] [DebuggerDisplay("{_values.Count} memoized values")] -internal sealed class MemoizedFunction +internal sealed class MemoizedFunction { private const int Concurrency = 10; private const int Capacity = 100; @@ -155,83 +155,3 @@ internal TResult Function(TParameter1 arg1, TParameter2 arg2) return _values.GetOrAdd(args, new Lazy(() => _function(arg1, arg2))).Value; } } - -/// -/// Memoizer for functions of arity 3. -/// -/// First input parameter type for the memoized function. -/// Second input parameter type for the memoized function. -/// Third input parameter type for the memoized function. -/// Return type for the memoized function. - -#if !SHARED_PROJECT -[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] -#endif - -[SuppressMessage( - "Major Code Smell", - "S2436:Types and methods should not have too many generic parameters", - Justification = "We're using many generic types for the same reason Func<>, Func<,>, Func<,,>, ... exist.")] -[DebuggerDisplay("{_values.Count} memoized values")] -internal sealed class MemoizedFunction -{ - private const int Concurrency = 10; - private const int Capacity = 100; - - internal readonly struct Args : IEquatable.Args> - { - private readonly int _hash; - - public Args(TParameter1 arg1, TParameter2 arg2, TParameter3 arg3) - { - Arg1 = arg1; - Arg2 = arg2; - Arg3 = arg3; - - _hash = HashCode.Combine(Arg1, Arg2, Arg3); - } - - public readonly TParameter1 Arg1; - - public readonly TParameter2 Arg2; - - public readonly TParameter3 Arg3; - - public override bool Equals(object? obj) => - obj is MemoizedFunction.Args args && Equals(args); - - public bool Equals(MemoizedFunction.Args other) => - EqualityComparer.Default.Equals(Arg1, other.Arg1) - && EqualityComparer.Default.Equals(Arg2, other.Arg2) - && EqualityComparer.Default.Equals(Arg3, other.Arg3); - - public override int GetHashCode() => _hash; - } - - private readonly ConcurrentDictionary> _values; - - private readonly Func _function; - - /// - /// Initializes a new instance of the class. - /// - /// The function whose results will be memoized. - public MemoizedFunction(Func function) - { - _function = Throw.IfNull(function); - _values = new(Concurrency, Capacity); - } - - internal TResult Function(TParameter1 arg1, TParameter2 arg2, TParameter3 arg3) - { - var args = new Args(arg1, arg2, arg3); - - // Stryker disable once all - if (_values.TryGetValue(args, out var result)) - { - return result.Value; - } - - return _values.GetOrAdd(args, new Lazy(() => _function(arg1, arg2, arg3))).Value; - } -} diff --git a/test/Shared/Memoization/MemoizeTests.cs b/test/Shared/Memoization/MemoizeTests.cs index 9e5a10dacdf..e2a8a647698 100644 --- a/test/Shared/Memoization/MemoizeTests.cs +++ b/test/Shared/Memoization/MemoizeTests.cs @@ -36,15 +36,6 @@ public void MemoizeFunction_Arity2_CanInvoke() Assert.Equal(8, memoized(3, 5)); } - [Fact] - public void MemoizeFunction_Arity3_CanInvoke() - { - Func adder = (x, y, z) => x + y + z; - var memoized = Memoize.Function(adder); - Assert.Equal(6, memoized(1, 2, 3)); - Assert.Equal(9, memoized(3, 5, 1)); - } - [Fact] public void MemoizeFunctionArity1_InvokedMultipleTimes_InvokesFunctionOnlyOnce() { @@ -123,27 +114,6 @@ public void MemoizeFunctionArity2_InvokedMultipleTimesWithNull_InvokesFunctionOn Assert.Equal(2, callCount); } - [Theory] - [InlineData(0, 1, 1)] - [InlineData(1, 0, 1)] - [InlineData(1, 0, 0)] - public void MemoizeFunctionArity3_InvokedMultipleTimes_InvokesFunctionOnlyOnce(int a, int b, int c) - { - var callCount = 0; - Func adder = (x, y, z) => - { - callCount++; - return x + y + z; - }; - var memoized = Memoize.Function(adder); - Assert.Equal(a + b + c, memoized(a, b, c)); - Assert.Equal(a + b + c, memoized(a, b, c)); - Assert.Equal(1, callCount); - - Assert.Equal(a + b + c + 1, memoized(a, b, c + 1)); - Assert.Equal(2, callCount); - } - [Fact] public void Arg1_Equals_Reflexive() { @@ -257,87 +227,4 @@ public void Arg2_Equals_UnequalThingsNotEqual() Assert.False(Args(0, 0).Equals(null)); } - - [Fact] - public void Arg3_Equals_Reflexive() - { - var a = new MemoizedFunction.Args(0, 0, 0); - Assert.Equal(a, a); - Assert.True(a.Equals(a)); - Assert.True(a.Equals((object?)a)); - - Assert.Equal(a.GetHashCode(), a.GetHashCode()); - } - - [Fact] - public void Arg3_Equals_Symmetric() - { - var a = new MemoizedFunction.Args(0, 0, 0); - var b = new MemoizedFunction.Args(0, 0, 0); - Assert.Equal(a, b); - Assert.Equal(b, a); - - Assert.True(a.Equals(b)); - Assert.True(b.Equals(a)); - - Assert.Equal(a.GetHashCode(), b.GetHashCode()); - Assert.Equal(b.GetHashCode(), a.GetHashCode()); - } - - [Fact] - public void Arg3_Equals_Transitive() - { - var a = new MemoizedFunction.Args(1, 1, 1); - var b = new MemoizedFunction.Args(1, 1, 1); - var c = new MemoizedFunction.Args(1, 1, 1); - Assert.Equal(a, b); - Assert.Equal(b, c); - Assert.Equal(c, a); - - Assert.True(a.Equals(b)); - Assert.True(b.Equals(c)); - Assert.True(c.Equals(a)); - - Assert.Equal(a.GetHashCode(), b.GetHashCode()); - Assert.Equal(b.GetHashCode(), c.GetHashCode()); - Assert.Equal(a.GetHashCode(), a.GetHashCode()); - } - - [Fact] - public void Arg3_Equals_UnequalThingsNotEqual() - { - static MemoizedFunction.Args Args(int x, int y, int z) => new(x, y, z); - - Assert.NotEqual(Args(0, 0, 0), Args(1, 0, 0)); - Assert.NotEqual(Args(0, 0, 0), Args(0, 1, 0)); - Assert.NotEqual(Args(0, 0, 0), Args(0, 0, 1)); - - Assert.NotEqual(Args(0, 0, 0).GetHashCode(), Args(1, 0, 0).GetHashCode()); - Assert.NotEqual(Args(0, 0, 0).GetHashCode(), Args(0, 1, 0).GetHashCode()); - Assert.NotEqual(Args(0, 0, 0).GetHashCode(), Args(0, 0, 1).GetHashCode()); - - Assert.False(Args(0, 0, 0).Equals(null)); - } - - [Theory] - [InlineData(null, 0, 0)] - [InlineData(0, null, 0)] - [InlineData(0, 0, null)] - public void MemoizeFunctionArity3_InvokedMultipleTimesWithNull_InvokesFunctionOnlyOnce(int? a, int? b, int? c) - { - var callCount = 0; - Func toString = (_, _, _) => - { - callCount++; - return "return value"; - }; - - var memoized = Memoize.Function(toString); - Assert.Equal("return value", memoized(a, b, c)); - Assert.Equal("return value", memoized(a, b, c)); - Assert.Equal(1, callCount); - - Assert.Equal("return value", memoized(a ?? 0 + 1, b ?? 0 + 1, c ?? 0 + 1)); - Assert.Equal(2, callCount); - } } From ee6afab39ed5b7b54342c2fa58ebd134f83f46e7 Mon Sep 17 00:00:00 2001 From: Milena Hristova Date: Wed, 21 Feb 2024 22:16:09 +0100 Subject: [PATCH 162/172] add ProducesDotNetReleaseShippingAssets property (#4960) --- eng/Publishing.props | 1 + 1 file changed, 1 insertion(+) diff --git a/eng/Publishing.props b/eng/Publishing.props index 85915f03805..0bcb04d4f32 100644 --- a/eng/Publishing.props +++ b/eng/Publishing.props @@ -2,5 +2,6 @@ 3 + true \ No newline at end of file From 3b8be087a18a1fc22622db8a17734d7cc99e14e5 Mon Sep 17 00:00:00 2001 From: Eric Erhardt Date: Thu, 22 Feb 2024 10:37:10 -0600 Subject: [PATCH 163/172] Address remaining trim warnings (#4962) Fix #4002 --- Directory.Build.targets | 6 ----- .../Microsoft.AspNetCore.HeaderParsing.csproj | 6 +++-- .../Redaction/IRedactionBuilder.cs | 5 ++-- .../HmacRedactorOptions.cs | 2 ++ .../RedactionBuilder.cs | 5 ++-- .../AutoActivationExtensions.Keyed.cs | 8 +++---- .../AutoActivationExtensions.cs | 23 +++++++++++++++---- ...enceHttpClientBuilderExtensions.Hedging.cs | 10 ++++++-- 8 files changed, 42 insertions(+), 23 deletions(-) diff --git a/Directory.Build.targets b/Directory.Build.targets index c6fd3b479e4..054243d1998 100644 --- a/Directory.Build.targets +++ b/Directory.Build.targets @@ -16,12 +16,6 @@ false - - $(NoWarn);TBD - - - $(NoWarn);IL2026;IL2087;IL2067;CA1825 - $(NoWarn);AD0001 diff --git a/src/Libraries/Microsoft.AspNetCore.HeaderParsing/Microsoft.AspNetCore.HeaderParsing.csproj b/src/Libraries/Microsoft.AspNetCore.HeaderParsing/Microsoft.AspNetCore.HeaderParsing.csproj index 70cf5f0290f..6993d36408f 100644 --- a/src/Libraries/Microsoft.AspNetCore.HeaderParsing/Microsoft.AspNetCore.HeaderParsing.csproj +++ b/src/Libraries/Microsoft.AspNetCore.HeaderParsing/Microsoft.AspNetCore.HeaderParsing.csproj @@ -8,12 +8,14 @@ $(NetCoreTargetFrameworks) - - false true true true true + + + false + $(NoWarn);IL2026 diff --git a/src/Libraries/Microsoft.Extensions.Compliance.Abstractions/Redaction/IRedactionBuilder.cs b/src/Libraries/Microsoft.Extensions.Compliance.Abstractions/Redaction/IRedactionBuilder.cs index 837492e633a..674f1884afa 100644 --- a/src/Libraries/Microsoft.Extensions.Compliance.Abstractions/Redaction/IRedactionBuilder.cs +++ b/src/Libraries/Microsoft.Extensions.Compliance.Abstractions/Redaction/IRedactionBuilder.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. using System; +using System.Diagnostics.CodeAnalysis; using Microsoft.Extensions.Compliance.Classification; using Microsoft.Extensions.DependencyInjection; @@ -24,7 +25,7 @@ public interface IRedactionBuilder /// The data classifications for which the redactor type should be used. /// The value of this instance. /// is . - IRedactionBuilder SetRedactor(params DataClassificationSet[] classifications) + IRedactionBuilder SetRedactor<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] T>(params DataClassificationSet[] classifications) where T : Redactor; /// @@ -32,6 +33,6 @@ IRedactionBuilder SetRedactor(params DataClassificationSet[] classifications) /// /// Redactor type. /// The value of this instance. - IRedactionBuilder SetFallbackRedactor() + IRedactionBuilder SetFallbackRedactor<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] T>() where T : Redactor; } diff --git a/src/Libraries/Microsoft.Extensions.Compliance.Redaction/HmacRedactorOptions.cs b/src/Libraries/Microsoft.Extensions.Compliance.Redaction/HmacRedactorOptions.cs index 1a110339ad1..c46fbe35e20 100644 --- a/src/Libraries/Microsoft.Extensions.Compliance.Redaction/HmacRedactorOptions.cs +++ b/src/Libraries/Microsoft.Extensions.Compliance.Redaction/HmacRedactorOptions.cs @@ -39,6 +39,8 @@ public class HmacRedactorOptions #if NET8_0_OR_GREATER [System.ComponentModel.DataAnnotations.Base64String] #endif + [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode", + Justification = "Validating the Length attribute on a string does not require reflection, it is handled intrinsically.")] [Microsoft.Shared.Data.Validation.Length(44)] public string Key { get; set; } = string.Empty; } diff --git a/src/Libraries/Microsoft.Extensions.Compliance.Redaction/RedactionBuilder.cs b/src/Libraries/Microsoft.Extensions.Compliance.Redaction/RedactionBuilder.cs index 493ff3682dd..14f68b0c8c9 100644 --- a/src/Libraries/Microsoft.Extensions.Compliance.Redaction/RedactionBuilder.cs +++ b/src/Libraries/Microsoft.Extensions.Compliance.Redaction/RedactionBuilder.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. using System; +using System.Diagnostics.CodeAnalysis; using Microsoft.Extensions.Compliance.Classification; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection.Extensions; @@ -29,7 +30,7 @@ public RedactionBuilder(IServiceCollection services) Services.TryAddEnumerable(ServiceDescriptor.Singleton(NullRedactor.Instance)); } - public IRedactionBuilder SetRedactor(params DataClassificationSet[] classifications) + public IRedactionBuilder SetRedactor<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] T>(params DataClassificationSet[] classifications) where T : Redactor { _ = Throw.IfNull(classifications); @@ -44,7 +45,7 @@ public IRedactionBuilder SetRedactor(params DataClassificationSet[] classific return this; } - public IRedactionBuilder SetFallbackRedactor() + public IRedactionBuilder SetFallbackRedactor<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] T>() where T : Redactor { Services.TryAddEnumerable(ServiceDescriptor.Singleton(typeof(Redactor), typeof(T))); diff --git a/src/Libraries/Microsoft.Extensions.DependencyInjection.AutoActivation/AutoActivationExtensions.Keyed.cs b/src/Libraries/Microsoft.Extensions.DependencyInjection.AutoActivation/AutoActivationExtensions.Keyed.cs index e994c858b55..985c6dffbcc 100644 --- a/src/Libraries/Microsoft.Extensions.DependencyInjection.AutoActivation/AutoActivationExtensions.Keyed.cs +++ b/src/Libraries/Microsoft.Extensions.DependencyInjection.AutoActivation/AutoActivationExtensions.Keyed.cs @@ -178,7 +178,7 @@ public static IServiceCollection AddActivatedKeyedSingleton( /// The value of . public static IServiceCollection AddActivatedKeyedSingleton( this IServiceCollection services, - Type serviceType, + [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type serviceType, object? serviceKey) { _ = Throw.IfNull(services); @@ -224,7 +224,7 @@ public static IServiceCollection AddActivatedKeyedSingleton( this IServiceCollection services, Type serviceType, object? serviceKey, - Type implementationType) + [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type implementationType) { _ = Throw.IfNull(services); _ = Throw.IfNull(serviceType); @@ -243,7 +243,7 @@ public static IServiceCollection AddActivatedKeyedSingleton( /// An object used to uniquely identify the specific service. public static void TryAddActivatedKeyedSingleton( this IServiceCollection services, - Type serviceType, + [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type serviceType, object? serviceKey) { _ = Throw.IfNull(services); @@ -263,7 +263,7 @@ public static void TryAddActivatedKeyedSingleton( this IServiceCollection services, Type serviceType, object? serviceKey, - Type implementationType) + [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type implementationType) { _ = Throw.IfNull(services); _ = Throw.IfNull(serviceType); diff --git a/src/Libraries/Microsoft.Extensions.DependencyInjection.AutoActivation/AutoActivationExtensions.cs b/src/Libraries/Microsoft.Extensions.DependencyInjection.AutoActivation/AutoActivationExtensions.cs index f73b4f5060c..5cb40f05a2e 100644 --- a/src/Libraries/Microsoft.Extensions.DependencyInjection.AutoActivation/AutoActivationExtensions.cs +++ b/src/Libraries/Microsoft.Extensions.DependencyInjection.AutoActivation/AutoActivationExtensions.cs @@ -166,7 +166,9 @@ public static IServiceCollection AddActivatedSingleton(this IServiceCo /// The service collection to add the service to. /// The type of the service to register and the implementation to use. /// The value of . - public static IServiceCollection AddActivatedSingleton(this IServiceCollection services, Type serviceType) + public static IServiceCollection AddActivatedSingleton( + this IServiceCollection services, + [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type serviceType) { _ = Throw.IfNull(services); _ = Throw.IfNull(serviceType); @@ -183,7 +185,10 @@ public static IServiceCollection AddActivatedSingleton(this IServiceCollection s /// The type of the service to register. /// The factory that creates the service. /// The value of . - public static IServiceCollection AddActivatedSingleton(this IServiceCollection services, Type serviceType, Func implementationFactory) + public static IServiceCollection AddActivatedSingleton( + this IServiceCollection services, + [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type serviceType, + Func implementationFactory) { _ = Throw.IfNull(services); _ = Throw.IfNull(serviceType); @@ -201,7 +206,10 @@ public static IServiceCollection AddActivatedSingleton(this IServiceCollection s /// The type of the service to register. /// The implementation type of the service. /// The value of . - public static IServiceCollection AddActivatedSingleton(this IServiceCollection services, Type serviceType, Type implementationType) + public static IServiceCollection AddActivatedSingleton( + this IServiceCollection services, + Type serviceType, + [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type implementationType) { _ = Throw.IfNull(services); _ = Throw.IfNull(serviceType); @@ -217,7 +225,9 @@ public static IServiceCollection AddActivatedSingleton(this IServiceCollection s /// /// The service collection to add the service to. /// The type of the service to register. - public static void TryAddActivatedSingleton(this IServiceCollection services, Type serviceType) + public static void TryAddActivatedSingleton( + this IServiceCollection services, + [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type serviceType) { _ = Throw.IfNull(services); _ = Throw.IfNull(serviceType); @@ -231,7 +241,10 @@ public static void TryAddActivatedSingleton(this IServiceCollection services, Ty /// The service collection to add the service to. /// The type of the service to register. /// The implementation type of the service. - public static void TryAddActivatedSingleton(this IServiceCollection services, Type serviceType, Type implementationType) + public static void TryAddActivatedSingleton( + this IServiceCollection services, + Type serviceType, + [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type implementationType) { _ = Throw.IfNull(services); _ = Throw.IfNull(serviceType); diff --git a/src/Libraries/Microsoft.Extensions.Http.Resilience/Hedging/ResilienceHttpClientBuilderExtensions.Hedging.cs b/src/Libraries/Microsoft.Extensions.Http.Resilience/Hedging/ResilienceHttpClientBuilderExtensions.Hedging.cs index aa32f16d1e6..a4e426c263f 100644 --- a/src/Libraries/Microsoft.Extensions.Http.Resilience/Hedging/ResilienceHttpClientBuilderExtensions.Hedging.cs +++ b/src/Libraries/Microsoft.Extensions.Http.Resilience/Hedging/ResilienceHttpClientBuilderExtensions.Hedging.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. using System; +using System.Diagnostics.CodeAnalysis; using System.Net.Http; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection.Extensions; @@ -118,8 +119,8 @@ public static IStandardHedgingHandlerBuilder AddStandardHedgingHandler(this IHtt var routingOptions = context.GetOptions(routingBuilder.Name); _ = builder - .AddStrategy(_ => new RoutingResilienceStrategy(routingOptions.RoutingStrategyProvider), new EmptyResilienceStrategyOptions()) - .AddStrategy(_ => new RequestMessageSnapshotStrategy(), new EmptyResilienceStrategyOptions()) + .AddStrategy(_ => new RoutingResilienceStrategy(routingOptions.RoutingStrategyProvider)) + .AddStrategy(_ => new RequestMessageSnapshotStrategy()) .AddTimeout(options.TotalRequestTimeout) .AddHedging(options.Hedging); }); @@ -142,6 +143,11 @@ public static IStandardHedgingHandlerBuilder AddStandardHedgingHandler(this IHtt return new StandardHedgingHandlerBuilder(builder.Name, builder.Services, routingBuilder); } + [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode", + Justification = "The EmptyResilienceStrategyOptions doesn't have any properties to validate.")] + private static ResiliencePipelineBuilder AddStrategy(this ResiliencePipelineBuilder builder, Func factory) => + builder.AddStrategy(factory, new EmptyResilienceStrategyOptions()); + private sealed record StandardHedgingHandlerBuilder( string Name, IServiceCollection Services, From 6fcfa31c66db363119737326701313e0e5ef366a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fri=C3=B0rik=20Bragi=20D=C3=BDrfj=C3=B6r=C3=B0?= Date: Thu, 22 Feb 2024 22:27:31 +0000 Subject: [PATCH 164/172] Added a descriptive tag to TimeProvider.Testing Fixes #4958 Added PackageTags and more informative Description to the package to make it easier to find on NuGet package server. --- .../Microsoft.Extensions.TimeProvider.Testing.csproj | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Libraries/Microsoft.Extensions.TimeProvider.Testing/Microsoft.Extensions.TimeProvider.Testing.csproj b/src/Libraries/Microsoft.Extensions.TimeProvider.Testing/Microsoft.Extensions.TimeProvider.Testing.csproj index 9e4ff4ba169..fd90b9425b8 100644 --- a/src/Libraries/Microsoft.Extensions.TimeProvider.Testing/Microsoft.Extensions.TimeProvider.Testing.csproj +++ b/src/Libraries/Microsoft.Extensions.TimeProvider.Testing/Microsoft.Extensions.TimeProvider.Testing.csproj @@ -1,10 +1,14 @@ Microsoft.Extensions.TimeProvider.Testing - Hand-crafted fakes to make time-related testing easier. + Hand-crafted fakes to make time-related testing easier. + + FakeTimeProvider implements the abstract TimeProvider class and is + specifically designed to be used for testing. + Fundamentals Testing - $(PackageTags);Testing + $(PackageTags);Testing;TimeProvider;FakeTimeProvider true From 043b5e5c99dce94da440360a1f43fa9b773ee5a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Obr=C3=A1til?= Date: Thu, 29 Feb 2024 17:59:51 +0100 Subject: [PATCH 165/172] AsyncState can be used across different service providers (#4966) AsyncState can be used across different service providers --- .../AsyncState.cs | 4 ++- .../AssemblyInfo.cs | 6 ++++ .../AsyncContextTests.cs | 23 ++++++++----- .../AsyncStateTests.cs | 34 ++++++++++++++++--- ...crosoft.Extensions.AsyncState.Tests.csproj | 4 +++ 5 files changed, 57 insertions(+), 14 deletions(-) create mode 100644 test/Libraries/Microsoft.Extensions.AsyncState.Tests/AssemblyInfo.cs diff --git a/src/Libraries/Microsoft.Extensions.AsyncState/AsyncState.cs b/src/Libraries/Microsoft.Extensions.AsyncState/AsyncState.cs index 4d782409238..d338447ed1d 100644 --- a/src/Libraries/Microsoft.Extensions.AsyncState/AsyncState.cs +++ b/src/Libraries/Microsoft.Extensions.AsyncState/AsyncState.cs @@ -14,7 +14,7 @@ internal sealed class AsyncState : IAsyncState { private static readonly AsyncLocal _asyncContextCurrent = new(); private static readonly ObjectPool> _featuresPool = PoolFactory.CreatePool(new FeaturesPooledPolicy()); - private int _contextCount; + private static int _contextCount; public void Initialize() { @@ -104,7 +104,9 @@ internal static void EnsureCount(List features, int count) } } +#pragma warning disable CA1822 // Member 'ContextCount' does not access instance data and can be marked as static. internal int ContextCount => Volatile.Read(ref _contextCount); +#pragma warning restore CA1822 // Member 'ContextCount' does not access instance data and can be marked as static. private sealed class AsyncStateHolder { diff --git a/test/Libraries/Microsoft.Extensions.AsyncState.Tests/AssemblyInfo.cs b/test/Libraries/Microsoft.Extensions.AsyncState.Tests/AssemblyInfo.cs new file mode 100644 index 00000000000..60db61910dd --- /dev/null +++ b/test/Libraries/Microsoft.Extensions.AsyncState.Tests/AssemblyInfo.cs @@ -0,0 +1,6 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using Xunit; + +[assembly: CollectionBehavior(DisableTestParallelization = true)] \ No newline at end of file diff --git a/test/Libraries/Microsoft.Extensions.AsyncState.Tests/AsyncContextTests.cs b/test/Libraries/Microsoft.Extensions.AsyncState.Tests/AsyncContextTests.cs index c7cca81bdf4..1ad60e9ad4f 100644 --- a/test/Libraries/Microsoft.Extensions.AsyncState.Tests/AsyncContextTests.cs +++ b/test/Libraries/Microsoft.Extensions.AsyncState.Tests/AsyncContextTests.cs @@ -13,12 +13,13 @@ public class AsyncContextTests public async Task CreateAsyncContext_BeforeInitialize() { var state = new AsyncState(); + var initialContextCount = state.ContextCount; var context1 = new AsyncContext(state); var context2 = new AsyncContext(state); var obj1 = new Thing(); var obj2 = new Thing(); - Assert.Equal(2, state.ContextCount); + Assert.Equal(2, state.ContextCount - initialContextCount); state.Initialize(); await Task.Run(() => context1.Set(obj1)); @@ -36,11 +37,12 @@ public async Task CreateAsyncContext_AfterInitialize() { var state = new AsyncState(); state.Initialize(); + var initialContextCount = state.ContextCount; var context1 = new AsyncContext(state); var context2 = new AsyncContext(state); - Assert.Equal(2, state.ContextCount); + Assert.Equal(2, state.ContextCount - initialContextCount); var obj1 = new Thing(); @@ -58,14 +60,14 @@ await Task.Run(() => public async Task CreateAsyncContext_BeforeAndAfterInitialize() { var state = new AsyncState(); - + var initialContextCount = state.ContextCount; var context1 = new AsyncContext(state); state.Initialize(); var context2 = new AsyncContext(state); var obj1 = new Thing(); var obj2 = new Thing(); - Assert.Equal(2, state.ContextCount); + Assert.Equal(2, state.ContextCount - initialContextCount); await Task.Run(() => { @@ -85,12 +87,13 @@ await Task.Run(() => public async Task Tryget_BeforeAndAfterInitialize() { var state = new AsyncState(); + var initialContextCount = state.ContextCount; var context1 = new AsyncContext(state); Assert.False(context1.TryGet(out _)); state.Initialize(); var obj1 = new Thing(); - Assert.Equal(1, state.ContextCount); + Assert.Equal(1, state.ContextCount - initialContextCount); await Task.Run(() => { @@ -110,12 +113,12 @@ await Task.Run(() => public async Task CreateAsyncContextInAsync_AfterInitialize() { var state = new AsyncState(); - + var initialContextCount = state.ContextCount; var context1 = new AsyncContext(state); var obj1 = new Thing(); state.Initialize(); - Assert.Equal(1, state.ContextCount); + Assert.Equal(1, state.ContextCount - initialContextCount); await Task.Run(async () => { @@ -181,6 +184,7 @@ public void Reset_DoesNotDisposeObjects() public async Task TwoAsyncFlows_WithDiffrentAsyncStates() { var state = new AsyncState(); + var initialContextCount = state.ContextCount; var task1 = Task.Run(async () => { @@ -215,13 +219,14 @@ await Task.Run(async () => }); await Task.WhenAll(task1, task2); - Assert.Equal(2, state.ContextCount); + Assert.Equal(2, state.ContextCount - initialContextCount); } [Fact] public async Task IndependentAsyncFlows_WithSameAsyncState() { var state = new AsyncState(); + var initialContextCount = state.ContextCount; var context = new AsyncContext(state); Func setAsyncState = async () => @@ -251,6 +256,6 @@ await Task.Run(() => await Task.WhenAll(tasks); - Assert.Equal(1, state.ContextCount); + Assert.Equal(1, state.ContextCount - initialContextCount); } } diff --git a/test/Libraries/Microsoft.Extensions.AsyncState.Tests/AsyncStateTests.cs b/test/Libraries/Microsoft.Extensions.AsyncState.Tests/AsyncStateTests.cs index f7a7b050eb1..6048b86b4df 100644 --- a/test/Libraries/Microsoft.Extensions.AsyncState.Tests/AsyncStateTests.cs +++ b/test/Libraries/Microsoft.Extensions.AsyncState.Tests/AsyncStateTests.cs @@ -6,6 +6,7 @@ using System.Diagnostics.CodeAnalysis; using System.Threading; using System.Threading.Tasks; +using Microsoft.Extensions.DependencyInjection; using Xunit; namespace Microsoft.Extensions.AsyncState.Test; @@ -195,15 +196,16 @@ public async Task GettingAsyncContextDoesNotFlowIfExecutionContextDoesNotFlow() public void RegisterContextCorrectly() { var asyncState = new AsyncState(); + var initialContextCount = asyncState.ContextCount; var c1 = asyncState.RegisterAsyncContext(); - Assert.Equal(0, c1.Index); + Assert.Equal(0, c1.Index - initialContextCount); var c2 = asyncState.RegisterAsyncContext(); - Assert.Equal(1, c2.Index); + Assert.Equal(1, c2.Index - initialContextCount); var c3 = asyncState.RegisterAsyncContext(); - Assert.Equal(2, c3.Index); + Assert.Equal(2, c3.Index - initialContextCount); - Assert.Equal(3, asyncState.ContextCount); + Assert.Equal(3, asyncState.ContextCount - initialContextCount); } [Fact] @@ -229,4 +231,28 @@ public void EnsureCount_WhenCountEqualWithExpected() AsyncState.EnsureCount(l, 5); Assert.Equal(5, l.Count); } + + [Fact] + public void AsyncStateCanBeUsedInDifferentServiceProviders() + { + var expectedValue1 = new Tuple(3.14); + var expectedValue2 = new Tuple(42); + var spOne = CreateAsyncState>(); + var spTwo = CreateAsyncState>(); + spOne.Set(expectedValue1); + spTwo.Set(expectedValue2); + var value1 = spOne.Get(); + var value2 = spTwo.Get(); + + Assert.Equal(expectedValue1, value1); + Assert.Equal(expectedValue2, value2); + + static IAsyncContext CreateAsyncState() + where T : notnull + { + var services = new ServiceCollection().AddAsyncState().BuildServiceProvider(); + services.GetRequiredService().Initialize(); + return services.GetRequiredService>(); + } + } } diff --git a/test/Libraries/Microsoft.Extensions.AsyncState.Tests/Microsoft.Extensions.AsyncState.Tests.csproj b/test/Libraries/Microsoft.Extensions.AsyncState.Tests/Microsoft.Extensions.AsyncState.Tests.csproj index 1371b340536..6b48515ac23 100644 --- a/test/Libraries/Microsoft.Extensions.AsyncState.Tests/Microsoft.Extensions.AsyncState.Tests.csproj +++ b/test/Libraries/Microsoft.Extensions.AsyncState.Tests/Microsoft.Extensions.AsyncState.Tests.csproj @@ -4,6 +4,10 @@ Unit tests for Microsoft.Extensions.AsyncState. + + + + From 48eeecaf9de5a86981f75aae50bc229f01220503 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Fri, 1 Mar 2024 05:41:16 +0000 Subject: [PATCH 166/172] Update dependencies from https://github.com/dotnet/arcade build 20240223.1 (#4973) Microsoft.DotNet.Arcade.Sdk , Microsoft.DotNet.Helix.Sdk From Version 8.0.0-beta.24113.2 -> To Version 8.0.0-beta.24123.1 Co-authored-by: dotnet-maestro[bot] --- NuGet.config | 20 -------------------- eng/Version.Details.xml | 8 ++++---- eng/common/templates/steps/generate-sbom.yml | 2 +- global.json | 4 ++-- 4 files changed, 7 insertions(+), 27 deletions(-) diff --git a/NuGet.config b/NuGet.config index 7c4c5d81081..92c91acc4ce 100644 --- a/NuGet.config +++ b/NuGet.config @@ -4,18 +4,8 @@ - - - - - - - - - - @@ -52,18 +42,8 @@ - - - - - - - - - - diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 2267b52cc99..12a9022c9ca 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -170,13 +170,13 @@ - + https://github.com/dotnet/arcade - da98edc4c3ea539f109ea320672136ceb32591a7 + 042763a811fd94dc3556253d4c64118dd665216e - + https://github.com/dotnet/arcade - da98edc4c3ea539f109ea320672136ceb32591a7 + 042763a811fd94dc3556253d4c64118dd665216e diff --git a/eng/common/templates/steps/generate-sbom.yml b/eng/common/templates/steps/generate-sbom.yml index a06373f38fa..2b21eae4273 100644 --- a/eng/common/templates/steps/generate-sbom.yml +++ b/eng/common/templates/steps/generate-sbom.yml @@ -5,7 +5,7 @@ # IgnoreDirectories - Directories to ignore for SBOM generation. This will be passed through to the CG component detector. parameters: - PackageVersion: 7.0.0 + PackageVersion: 8.0.0 BuildDropPath: '$(Build.SourcesDirectory)/artifacts' PackageName: '.NET' ManifestDirPath: $(Build.ArtifactStagingDirectory)/sbom diff --git a/global.json b/global.json index 75bb4555131..1220281b3c7 100644 --- a/global.json +++ b/global.json @@ -16,7 +16,7 @@ "msbuild-sdks": { "Microsoft.Build.NoTargets": "3.7.0", "Microsoft.Build.Traversal": "3.2.0", - "Microsoft.DotNet.Arcade.Sdk": "8.0.0-beta.24113.2", - "Microsoft.DotNet.Helix.Sdk": "8.0.0-beta.24113.2" + "Microsoft.DotNet.Arcade.Sdk": "8.0.0-beta.24123.1", + "Microsoft.DotNet.Helix.Sdk": "8.0.0-beta.24123.1" } } From 34ba23f48ce096f9111eee644c4883dbc51f729d Mon Sep 17 00:00:00 2001 From: Nikita Balabaev Date: Mon, 4 Mar 2024 16:39:14 +0100 Subject: [PATCH 167/172] Update Microsoft.IO.RecyclableMemoryStream to v3 (#4976) --- eng/packages/General.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/packages/General.props b/eng/packages/General.props index 1ee694e5356..cd2a0b19b6c 100644 --- a/eng/packages/General.props +++ b/eng/packages/General.props @@ -35,7 +35,7 @@ - + From 018768f6d31dc31746f7774df38fb5d393cbefcc Mon Sep 17 00:00:00 2001 From: Dan Moseley Date: Mon, 4 Mar 2024 18:18:35 -0700 Subject: [PATCH 168/172] try dependabot (#4978) --- .github/dependabot.yml | 61 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 .github/dependabot.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 00000000000..43f6301c940 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,61 @@ +version: 2 +registries: + public-nuget: + type: nuget-feed + url: https://api.nuget.org/v3/index.json +updates: + - package-ecosystem: nuget + directory: "/" + registries: + - public-nuget + schedule: + interval: daily + time: "07:00" + timezone: "America/Los_Angeles" + open-pull-requests-limit: 15 + ignore: + # handled by Darc/Maestro flows + - dependency-name: "Microsoft.DotNet.Arcade.Sdk" + - dependency-name: "Microsoft.DotNet.Helix.Sdk" + - dependency-name: "Microsoft.DotNet.SharedFramework.Sdk" + - dependency-name: "Microsoft.Build.NoTargets" + groups: + AspNetCore: + patterns: + - "Microsoft.AspNetCore.*" + - "Microsoft.Extensions.Features" + MicrosoftCodeAnalysis: + patterns: + - "Microsoft.CodeAnalysis.*" + MicrosoftExtensions: + patterns: + - "Microsoft.Extensions.*" + OpenTelemetry: + patterns: + - "OpenTelemetry.*" + MicrosoftDotNet: + patterns: + - "Microsoft.DotNet.*" + AutoFixture: + patterns: + - "AutoFixture.*" + FluentAssertions: + patterns: + - "FluentAssertions.*" + BenchmarkDotNet: + patterns: + - "BenchmarkDotNet.*" + Moq: + patterns: + - "Moq.*" + Grpc: + patterns: + - "Grpc.*" + Polly: + patterns: + - "Polly.*" + Xunit: + patterns: + - "Xunit.*" + labels: + - "area-codeflow" From 76b6d4a33729eca62ac4c5fd25a7b3863bb69972 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Tue, 5 Mar 2024 02:54:56 +0000 Subject: [PATCH 169/172] Update dependencies from https://github.com/dotnet/arcade build 20240301.4 (#4981) [main] Update dependencies from dotnet/arcade --- eng/Version.Details.xml | 8 +- eng/common/templates-official/job/job.yml | 255 ++++++++++++++++ .../templates-official/job/onelocbuild.yml | 112 +++++++ .../job/publish-build-assets.yml | 153 ++++++++++ .../templates-official/job/source-build.yml | 67 ++++ .../job/source-index-stage1.yml | 68 +++++ .../templates-official/jobs/codeql-build.yml | 31 ++ eng/common/templates-official/jobs/jobs.yml | 97 ++++++ .../templates-official/jobs/source-build.yml | 46 +++ .../post-build/common-variables.yml | 22 ++ .../post-build/post-build.yml | 285 ++++++++++++++++++ .../post-build/setup-maestro-vars.yml | 70 +++++ .../post-build/trigger-subscription.yml | 13 + .../steps/add-build-to-channel.yml | 13 + .../templates-official/steps/build-reason.yml | 12 + .../steps/component-governance.yml | 13 + .../steps/execute-codeql.yml | 32 ++ .../templates-official/steps/execute-sdl.yml | 88 ++++++ .../steps/generate-sbom.yml | 48 +++ .../templates-official/steps/publish-logs.yml | 23 ++ .../templates-official/steps/retain-build.yml | 28 ++ .../steps/send-to-helix.yml | 91 ++++++ .../templates-official/steps/source-build.yml | 129 ++++++++ .../variables/pool-providers.yml | 45 +++ .../variables/sdl-variables.yml | 7 + global.json | 4 +- 26 files changed, 1754 insertions(+), 6 deletions(-) create mode 100644 eng/common/templates-official/job/job.yml create mode 100644 eng/common/templates-official/job/onelocbuild.yml create mode 100644 eng/common/templates-official/job/publish-build-assets.yml create mode 100644 eng/common/templates-official/job/source-build.yml create mode 100644 eng/common/templates-official/job/source-index-stage1.yml create mode 100644 eng/common/templates-official/jobs/codeql-build.yml create mode 100644 eng/common/templates-official/jobs/jobs.yml create mode 100644 eng/common/templates-official/jobs/source-build.yml create mode 100644 eng/common/templates-official/post-build/common-variables.yml create mode 100644 eng/common/templates-official/post-build/post-build.yml create mode 100644 eng/common/templates-official/post-build/setup-maestro-vars.yml create mode 100644 eng/common/templates-official/post-build/trigger-subscription.yml create mode 100644 eng/common/templates-official/steps/add-build-to-channel.yml create mode 100644 eng/common/templates-official/steps/build-reason.yml create mode 100644 eng/common/templates-official/steps/component-governance.yml create mode 100644 eng/common/templates-official/steps/execute-codeql.yml create mode 100644 eng/common/templates-official/steps/execute-sdl.yml create mode 100644 eng/common/templates-official/steps/generate-sbom.yml create mode 100644 eng/common/templates-official/steps/publish-logs.yml create mode 100644 eng/common/templates-official/steps/retain-build.yml create mode 100644 eng/common/templates-official/steps/send-to-helix.yml create mode 100644 eng/common/templates-official/steps/source-build.yml create mode 100644 eng/common/templates-official/variables/pool-providers.yml create mode 100644 eng/common/templates-official/variables/sdl-variables.yml diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 12a9022c9ca..3d37a253ee2 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -170,13 +170,13 @@ - + https://github.com/dotnet/arcade - 042763a811fd94dc3556253d4c64118dd665216e + cbb61c3a9a42e7c3cce17ee453ff5ecdc7f69282 - + https://github.com/dotnet/arcade - 042763a811fd94dc3556253d4c64118dd665216e + cbb61c3a9a42e7c3cce17ee453ff5ecdc7f69282 diff --git a/eng/common/templates-official/job/job.yml b/eng/common/templates-official/job/job.yml new file mode 100644 index 00000000000..9e7bebe9af8 --- /dev/null +++ b/eng/common/templates-official/job/job.yml @@ -0,0 +1,255 @@ +# Internal resources (telemetry, microbuild) can only be accessed from non-public projects, +# and some (Microbuild) should only be applied to non-PR cases for internal builds. + +parameters: +# Job schema parameters - https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema?view=vsts&tabs=schema#job + cancelTimeoutInMinutes: '' + condition: '' + container: '' + continueOnError: false + dependsOn: '' + displayName: '' + pool: '' + steps: [] + strategy: '' + timeoutInMinutes: '' + variables: [] + workspace: '' + +# Job base template specific parameters + # See schema documentation - https://github.com/dotnet/arcade/blob/master/Documentation/AzureDevOps/TemplateSchema.md + artifacts: '' + enableMicrobuild: false + enablePublishBuildArtifacts: false + enablePublishBuildAssets: false + enablePublishTestResults: false + enablePublishUsingPipelines: false + enableBuildRetry: false + disableComponentGovernance: '' + componentGovernanceIgnoreDirectories: '' + mergeTestResults: false + testRunTitle: '' + testResultsFormat: '' + name: '' + preSteps: [] + runAsPublic: false +# Sbom related params + enableSbom: true + PackageVersion: 7.0.0 + BuildDropPath: '$(Build.SourcesDirectory)/artifacts' + +jobs: +- job: ${{ parameters.name }} + + ${{ if ne(parameters.cancelTimeoutInMinutes, '') }}: + cancelTimeoutInMinutes: ${{ parameters.cancelTimeoutInMinutes }} + + ${{ if ne(parameters.condition, '') }}: + condition: ${{ parameters.condition }} + + ${{ if ne(parameters.container, '') }}: + container: ${{ parameters.container }} + + ${{ if ne(parameters.continueOnError, '') }}: + continueOnError: ${{ parameters.continueOnError }} + + ${{ if ne(parameters.dependsOn, '') }}: + dependsOn: ${{ parameters.dependsOn }} + + ${{ if ne(parameters.displayName, '') }}: + displayName: ${{ parameters.displayName }} + + ${{ if ne(parameters.pool, '') }}: + pool: ${{ parameters.pool }} + + ${{ if ne(parameters.strategy, '') }}: + strategy: ${{ parameters.strategy }} + + ${{ if ne(parameters.timeoutInMinutes, '') }}: + timeoutInMinutes: ${{ parameters.timeoutInMinutes }} + + variables: + - ${{ if ne(parameters.enableTelemetry, 'false') }}: + - name: DOTNET_CLI_TELEMETRY_PROFILE + value: '$(Build.Repository.Uri)' + - ${{ if eq(parameters.enableRichCodeNavigation, 'true') }}: + - name: EnableRichCodeNavigation + value: 'true' + # Retry signature validation up to three times, waiting 2 seconds between attempts. + # See https://learn.microsoft.com/en-us/nuget/reference/errors-and-warnings/nu3028#retry-untrusted-root-failures + - name: NUGET_EXPERIMENTAL_CHAIN_BUILD_RETRY_POLICY + value: 3,2000 + - ${{ each variable in parameters.variables }}: + # handle name-value variable syntax + # example: + # - name: [key] + # value: [value] + - ${{ if ne(variable.name, '') }}: + - name: ${{ variable.name }} + value: ${{ variable.value }} + + # handle variable groups + - ${{ if ne(variable.group, '') }}: + - group: ${{ variable.group }} + + # handle template variable syntax + # example: + # - template: path/to/template.yml + # parameters: + # [key]: [value] + - ${{ if ne(variable.template, '') }}: + - template: ${{ variable.template }} + ${{ if ne(variable.parameters, '') }}: + parameters: ${{ variable.parameters }} + + # handle key-value variable syntax. + # example: + # - [key]: [value] + - ${{ if and(eq(variable.name, ''), eq(variable.group, ''), eq(variable.template, '')) }}: + - ${{ each pair in variable }}: + - name: ${{ pair.key }} + value: ${{ pair.value }} + + # DotNet-HelixApi-Access provides 'HelixApiAccessToken' for internal builds + - ${{ if and(eq(parameters.enableTelemetry, 'true'), eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: + - group: DotNet-HelixApi-Access + + ${{ if ne(parameters.workspace, '') }}: + workspace: ${{ parameters.workspace }} + + steps: + - ${{ if ne(parameters.preSteps, '') }}: + - ${{ each preStep in parameters.preSteps }}: + - ${{ preStep }} + + - ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: + - ${{ if eq(parameters.enableMicrobuild, 'true') }}: + - task: MicroBuildSigningPlugin@3 + displayName: Install MicroBuild plugin + inputs: + signType: $(_SignType) + zipSources: false + feedSource: https://dnceng.pkgs.visualstudio.com/_packaging/MicroBuildToolset/nuget/v3/index.json + env: + TeamName: $(_TeamName) + continueOnError: ${{ parameters.continueOnError }} + condition: and(succeeded(), in(variables['_SignType'], 'real', 'test'), eq(variables['Agent.Os'], 'Windows_NT')) + + - ${{ if and(eq(parameters.runAsPublic, 'false'), eq(variables['System.TeamProject'], 'internal')) }}: + - task: NuGetAuthenticate@1 + + - ${{ if and(ne(parameters.artifacts.download, 'false'), ne(parameters.artifacts.download, '')) }}: + - task: DownloadPipelineArtifact@2 + inputs: + buildType: current + artifactName: ${{ coalesce(parameters.artifacts.download.name, 'Artifacts_$(Agent.OS)_$(_BuildConfig)') }} + targetPath: ${{ coalesce(parameters.artifacts.download.path, 'artifacts') }} + itemPattern: ${{ coalesce(parameters.artifacts.download.pattern, '**') }} + + - ${{ each step in parameters.steps }}: + - ${{ step }} + + - ${{ if eq(parameters.enableRichCodeNavigation, true) }}: + - task: RichCodeNavIndexer@0 + displayName: RichCodeNav Upload + inputs: + languages: ${{ coalesce(parameters.richCodeNavigationLanguage, 'csharp') }} + environment: ${{ coalesce(parameters.richCodeNavigationEnvironment, 'production') }} + richNavLogOutputDirectory: $(Build.SourcesDirectory)/artifacts/bin + uploadRichNavArtifacts: ${{ coalesce(parameters.richCodeNavigationUploadArtifacts, false) }} + continueOnError: true + + - template: /eng/common/templates-official/steps/component-governance.yml + parameters: + ${{ if eq(parameters.disableComponentGovernance, '') }}: + ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest'), eq(parameters.runAsPublic, 'false'), or(startsWith(variables['Build.SourceBranch'], 'refs/heads/release/'), startsWith(variables['Build.SourceBranch'], 'refs/heads/dotnet/'), startsWith(variables['Build.SourceBranch'], 'refs/heads/microsoft/'), eq(variables['Build.SourceBranch'], 'refs/heads/main'))) }}: + disableComponentGovernance: false + ${{ else }}: + disableComponentGovernance: true + ${{ else }}: + disableComponentGovernance: ${{ parameters.disableComponentGovernance }} + componentGovernanceIgnoreDirectories: ${{ parameters.componentGovernanceIgnoreDirectories }} + + - ${{ if eq(parameters.enableMicrobuild, 'true') }}: + - ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: + - task: MicroBuildCleanup@1 + displayName: Execute Microbuild cleanup tasks + condition: and(always(), in(variables['_SignType'], 'real', 'test'), eq(variables['Agent.Os'], 'Windows_NT')) + continueOnError: ${{ parameters.continueOnError }} + env: + TeamName: $(_TeamName) + + - ${{ if ne(parameters.artifacts.publish, '') }}: + - ${{ if and(ne(parameters.artifacts.publish.artifacts, 'false'), ne(parameters.artifacts.publish.artifacts, '')) }}: + - task: CopyFiles@2 + displayName: Gather binaries for publish to artifacts + inputs: + SourceFolder: 'artifacts/bin' + Contents: '**' + TargetFolder: '$(Build.ArtifactStagingDirectory)/artifacts/bin' + - task: CopyFiles@2 + displayName: Gather packages for publish to artifacts + inputs: + SourceFolder: 'artifacts/packages' + Contents: '**' + TargetFolder: '$(Build.ArtifactStagingDirectory)/artifacts/packages' + - task: 1ES.PublishBuildArtifacts@1 + displayName: Publish pipeline artifacts + inputs: + PathtoPublish: '$(Build.ArtifactStagingDirectory)/artifacts' + PublishLocation: Container + ArtifactName: ${{ coalesce(parameters.artifacts.publish.artifacts.name , 'Artifacts_$(Agent.Os)_$(_BuildConfig)') }} + continueOnError: true + condition: always() + - ${{ if and(ne(parameters.artifacts.publish.logs, 'false'), ne(parameters.artifacts.publish.logs, '')) }}: + - publish: artifacts/log + artifact: ${{ coalesce(parameters.artifacts.publish.logs.name, 'Logs_Build_$(Agent.Os)_$(_BuildConfig)') }} + displayName: Publish logs + continueOnError: true + condition: always() + + - ${{ if ne(parameters.enablePublishBuildArtifacts, 'false') }}: + - task: 1ES.PublishBuildArtifacts@1 + displayName: Publish Logs + inputs: + PathtoPublish: '$(Build.SourcesDirectory)/artifacts/log/$(_BuildConfig)' + PublishLocation: Container + ArtifactName: ${{ coalesce(parameters.enablePublishBuildArtifacts.artifactName, '$(Agent.Os)_$(Agent.JobName)' ) }} + continueOnError: true + condition: always() + + - ${{ if or(and(eq(parameters.enablePublishTestResults, 'true'), eq(parameters.testResultsFormat, '')), eq(parameters.testResultsFormat, 'xunit')) }}: + - task: PublishTestResults@2 + displayName: Publish XUnit Test Results + inputs: + testResultsFormat: 'xUnit' + testResultsFiles: '*.xml' + searchFolder: '$(Build.SourcesDirectory)/artifacts/TestResults/$(_BuildConfig)' + testRunTitle: ${{ coalesce(parameters.testRunTitle, parameters.name, '$(System.JobName)') }}-xunit + mergeTestResults: ${{ parameters.mergeTestResults }} + continueOnError: true + condition: always() + - ${{ if or(and(eq(parameters.enablePublishTestResults, 'true'), eq(parameters.testResultsFormat, '')), eq(parameters.testResultsFormat, 'vstest')) }}: + - task: PublishTestResults@2 + displayName: Publish TRX Test Results + inputs: + testResultsFormat: 'VSTest' + testResultsFiles: '*.trx' + searchFolder: '$(Build.SourcesDirectory)/artifacts/TestResults/$(_BuildConfig)' + testRunTitle: ${{ coalesce(parameters.testRunTitle, parameters.name, '$(System.JobName)') }}-trx + mergeTestResults: ${{ parameters.mergeTestResults }} + continueOnError: true + condition: always() + + - ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest'), eq(parameters.enableSbom, 'true')) }}: + - template: /eng/common/templates-official/steps/generate-sbom.yml + parameters: + PackageVersion: ${{ parameters.packageVersion}} + BuildDropPath: ${{ parameters.buildDropPath }} + IgnoreDirectories: ${{ parameters.componentGovernanceIgnoreDirectories }} + + - ${{ if eq(parameters.enableBuildRetry, 'true') }}: + - publish: $(Build.SourcesDirectory)\eng\common\BuildConfiguration + artifact: BuildConfiguration + displayName: Publish build retry configuration + continueOnError: true diff --git a/eng/common/templates-official/job/onelocbuild.yml b/eng/common/templates-official/job/onelocbuild.yml new file mode 100644 index 00000000000..ba9ba493032 --- /dev/null +++ b/eng/common/templates-official/job/onelocbuild.yml @@ -0,0 +1,112 @@ +parameters: + # Optional: dependencies of the job + dependsOn: '' + + # Optional: A defined YAML pool - https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema?view=vsts&tabs=schema#pool + pool: '' + + CeapexPat: $(dn-bot-ceapex-package-r) # PAT for the loc AzDO instance https://dev.azure.com/ceapex + GithubPat: $(BotAccount-dotnet-bot-repo-PAT) + + SourcesDirectory: $(Build.SourcesDirectory) + CreatePr: true + AutoCompletePr: false + ReusePr: true + UseLfLineEndings: true + UseCheckedInLocProjectJson: false + SkipLocProjectJsonGeneration: false + LanguageSet: VS_Main_Languages + LclSource: lclFilesInRepo + LclPackageId: '' + RepoType: gitHub + GitHubOrg: dotnet + MirrorRepo: '' + MirrorBranch: main + condition: '' + JobNameSuffix: '' + +jobs: +- job: OneLocBuild${{ parameters.JobNameSuffix }} + + dependsOn: ${{ parameters.dependsOn }} + + displayName: OneLocBuild${{ parameters.JobNameSuffix }} + + variables: + - group: OneLocBuildVariables # Contains the CeapexPat and GithubPat + - name: _GenerateLocProjectArguments + value: -SourcesDirectory ${{ parameters.SourcesDirectory }} + -LanguageSet "${{ parameters.LanguageSet }}" + -CreateNeutralXlfs + - ${{ if eq(parameters.UseCheckedInLocProjectJson, 'true') }}: + - name: _GenerateLocProjectArguments + value: ${{ variables._GenerateLocProjectArguments }} -UseCheckedInLocProjectJson + - template: /eng/common/templates-official/variables/pool-providers.yml + + ${{ if ne(parameters.pool, '') }}: + pool: ${{ parameters.pool }} + ${{ if eq(parameters.pool, '') }}: + pool: + # We don't use the collection uri here because it might vary (.visualstudio.com vs. dev.azure.com) + ${{ if eq(variables['System.TeamProject'], 'DevDiv') }}: + name: AzurePipelines-EO + image: 1ESPT-Windows2022 + demands: Cmd + os: windows + # If it's not devdiv, it's dnceng + ${{ if ne(variables['System.TeamProject'], 'DevDiv') }}: + name: $(DncEngInternalBuildPool) + image: 1es-windows-2022-pt + os: windows + + steps: + - ${{ if ne(parameters.SkipLocProjectJsonGeneration, 'true') }}: + - task: Powershell@2 + inputs: + filePath: $(Build.SourcesDirectory)/eng/common/generate-locproject.ps1 + arguments: $(_GenerateLocProjectArguments) + displayName: Generate LocProject.json + condition: ${{ parameters.condition }} + + - task: OneLocBuild@2 + displayName: OneLocBuild + env: + SYSTEM_ACCESSTOKEN: $(System.AccessToken) + inputs: + locProj: eng/Localize/LocProject.json + outDir: $(Build.ArtifactStagingDirectory) + lclSource: ${{ parameters.LclSource }} + lclPackageId: ${{ parameters.LclPackageId }} + isCreatePrSelected: ${{ parameters.CreatePr }} + isAutoCompletePrSelected: ${{ parameters.AutoCompletePr }} + ${{ if eq(parameters.CreatePr, true) }}: + isUseLfLineEndingsSelected: ${{ parameters.UseLfLineEndings }} + ${{ if eq(parameters.RepoType, 'gitHub') }}: + isShouldReusePrSelected: ${{ parameters.ReusePr }} + packageSourceAuth: patAuth + patVariable: ${{ parameters.CeapexPat }} + ${{ if eq(parameters.RepoType, 'gitHub') }}: + repoType: ${{ parameters.RepoType }} + gitHubPatVariable: "${{ parameters.GithubPat }}" + ${{ if ne(parameters.MirrorRepo, '') }}: + isMirrorRepoSelected: true + gitHubOrganization: ${{ parameters.GitHubOrg }} + mirrorRepo: ${{ parameters.MirrorRepo }} + mirrorBranch: ${{ parameters.MirrorBranch }} + condition: ${{ parameters.condition }} + + - task: 1ES.PublishBuildArtifacts@1 + displayName: Publish Localization Files + inputs: + PathtoPublish: '$(Build.ArtifactStagingDirectory)/loc' + PublishLocation: Container + ArtifactName: Loc + condition: ${{ parameters.condition }} + + - task: 1ES.PublishBuildArtifacts@1 + displayName: Publish LocProject.json + inputs: + PathtoPublish: '$(Build.SourcesDirectory)/eng/Localize/' + PublishLocation: Container + ArtifactName: Loc + condition: ${{ parameters.condition }} \ No newline at end of file diff --git a/eng/common/templates-official/job/publish-build-assets.yml b/eng/common/templates-official/job/publish-build-assets.yml new file mode 100644 index 00000000000..ea5104625fa --- /dev/null +++ b/eng/common/templates-official/job/publish-build-assets.yml @@ -0,0 +1,153 @@ +parameters: + configuration: 'Debug' + + # Optional: condition for the job to run + condition: '' + + # Optional: 'true' if future jobs should run even if this job fails + continueOnError: false + + # Optional: dependencies of the job + dependsOn: '' + + # Optional: Include PublishBuildArtifacts task + enablePublishBuildArtifacts: false + + # Optional: A defined YAML pool - https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema?view=vsts&tabs=schema#pool + pool: {} + + # Optional: should run as a public build even in the internal project + # if 'true', the build won't run any of the internal only steps, even if it is running in non-public projects. + runAsPublic: false + + # Optional: whether the build's artifacts will be published using release pipelines or direct feed publishing + publishUsingPipelines: false + + # Optional: whether the build's artifacts will be published using release pipelines or direct feed publishing + publishAssetsImmediately: false + + artifactsPublishingAdditionalParameters: '' + + signingValidationAdditionalParameters: '' + +jobs: +- job: Asset_Registry_Publish + + dependsOn: ${{ parameters.dependsOn }} + timeoutInMinutes: 150 + + ${{ if eq(parameters.publishAssetsImmediately, 'true') }}: + displayName: Publish Assets + ${{ else }}: + displayName: Publish to Build Asset Registry + + variables: + - template: /eng/common/templates-official/variables/pool-providers.yml + - ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: + - group: Publish-Build-Assets + - group: AzureDevOps-Artifact-Feeds-Pats + - name: runCodesignValidationInjection + value: false + - ${{ if eq(parameters.publishAssetsImmediately, 'true') }}: + - template: /eng/common/templates-official/post-build/common-variables.yml + + pool: + # We don't use the collection uri here because it might vary (.visualstudio.com vs. dev.azure.com) + ${{ if eq(variables['System.TeamProject'], 'DevDiv') }}: + name: AzurePipelines-EO + image: 1ESPT-Windows2022 + demands: Cmd + os: windows + # If it's not devdiv, it's dnceng + ${{ if ne(variables['System.TeamProject'], 'DevDiv') }}: + name: $(DncEngInternalBuildPool) + image: 1es-windows-2022-pt + os: windows + steps: + - ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: + - task: DownloadBuildArtifacts@0 + displayName: Download artifact + inputs: + artifactName: AssetManifests + downloadPath: '$(Build.StagingDirectory)/Download' + checkDownloadedFiles: true + condition: ${{ parameters.condition }} + continueOnError: ${{ parameters.continueOnError }} + + - task: NuGetAuthenticate@1 + + - task: PowerShell@2 + displayName: Publish Build Assets + inputs: + filePath: eng\common\sdk-task.ps1 + arguments: -task PublishBuildAssets -restore -msbuildEngine dotnet + /p:ManifestsPath='$(Build.StagingDirectory)/Download/AssetManifests' + /p:BuildAssetRegistryToken=$(MaestroAccessToken) + /p:MaestroApiEndpoint=https://maestro-prod.westus2.cloudapp.azure.com + /p:PublishUsingPipelines=${{ parameters.publishUsingPipelines }} + /p:OfficialBuildId=$(Build.BuildNumber) + condition: ${{ parameters.condition }} + continueOnError: ${{ parameters.continueOnError }} + + - task: powershell@2 + displayName: Create ReleaseConfigs Artifact + inputs: + targetType: inline + script: | + Add-Content -Path "$(Build.StagingDirectory)/ReleaseConfigs.txt" -Value $(BARBuildId) + Add-Content -Path "$(Build.StagingDirectory)/ReleaseConfigs.txt" -Value "$(DefaultChannels)" + Add-Content -Path "$(Build.StagingDirectory)/ReleaseConfigs.txt" -Value $(IsStableBuild) + + - task: 1ES.PublishBuildArtifacts@1 + displayName: Publish ReleaseConfigs Artifact + inputs: + PathtoPublish: '$(Build.StagingDirectory)/ReleaseConfigs.txt' + PublishLocation: Container + ArtifactName: ReleaseConfigs + + - task: powershell@2 + displayName: Check if SymbolPublishingExclusionsFile.txt exists + inputs: + targetType: inline + script: | + $symbolExclusionfile = "$(Build.SourcesDirectory)/eng/SymbolPublishingExclusionsFile.txt" + if(Test-Path -Path $symbolExclusionfile) + { + Write-Host "SymbolExclusionFile exists" + Write-Host "##vso[task.setvariable variable=SymbolExclusionFile]true" + } + else{ + Write-Host "Symbols Exclusion file does not exists" + Write-Host "##vso[task.setvariable variable=SymbolExclusionFile]false" + } + + - task: 1ES.PublishBuildArtifacts@1 + displayName: Publish SymbolPublishingExclusionsFile Artifact + condition: eq(variables['SymbolExclusionFile'], 'true') + inputs: + PathtoPublish: '$(Build.SourcesDirectory)/eng/SymbolPublishingExclusionsFile.txt' + PublishLocation: Container + ArtifactName: ReleaseConfigs + + - ${{ if eq(parameters.publishAssetsImmediately, 'true') }}: + - template: /eng/common/templates-official/post-build/setup-maestro-vars.yml + parameters: + BARBuildId: ${{ parameters.BARBuildId }} + PromoteToChannelIds: ${{ parameters.PromoteToChannelIds }} + + - task: PowerShell@2 + displayName: Publish Using Darc + inputs: + filePath: $(Build.SourcesDirectory)/eng/common/post-build/publish-using-darc.ps1 + arguments: -BuildId $(BARBuildId) + -PublishingInfraVersion 3 + -AzdoToken '$(publishing-dnceng-devdiv-code-r-build-re)' + -MaestroToken '$(MaestroApiAccessToken)' + -WaitPublishingFinish true + -ArtifactsPublishingAdditionalParameters '${{ parameters.artifactsPublishingAdditionalParameters }}' + -SymbolPublishingAdditionalParameters '${{ parameters.symbolPublishingAdditionalParameters }}' + + - ${{ if eq(parameters.enablePublishBuildArtifacts, 'true') }}: + - template: /eng/common/templates-official/steps/publish-logs.yml + parameters: + JobLabel: 'Publish_Artifacts_Logs' diff --git a/eng/common/templates-official/job/source-build.yml b/eng/common/templates-official/job/source-build.yml new file mode 100644 index 00000000000..8aba3b44bb2 --- /dev/null +++ b/eng/common/templates-official/job/source-build.yml @@ -0,0 +1,67 @@ +parameters: + # This template adds arcade-powered source-build to CI. The template produces a server job with a + # default ID 'Source_Build_Complete' to put in a dependency list if necessary. + + # Specifies the prefix for source-build jobs added to pipeline. Use this if disambiguation needed. + jobNamePrefix: 'Source_Build' + + # Defines the platform on which to run the job. By default, a linux-x64 machine, suitable for + # managed-only repositories. This is an object with these properties: + # + # name: '' + # The name of the job. This is included in the job ID. + # targetRID: '' + # The name of the target RID to use, instead of the one auto-detected by Arcade. + # nonPortable: false + # Enables non-portable mode. This means a more specific RID (e.g. fedora.32-x64 rather than + # linux-x64), and compiling against distro-provided packages rather than portable ones. + # skipPublishValidation: false + # Disables publishing validation. By default, a check is performed to ensure no packages are + # published by source-build. + # container: '' + # A container to use. Runs in docker. + # pool: {} + # A pool to use. Runs directly on an agent. + # buildScript: '' + # Specifies the build script to invoke to perform the build in the repo. The default + # './build.sh' should work for typical Arcade repositories, but this is customizable for + # difficult situations. + # jobProperties: {} + # A list of job properties to inject at the top level, for potential extensibility beyond + # container and pool. + platform: {} + +jobs: +- job: ${{ parameters.jobNamePrefix }}_${{ parameters.platform.name }} + displayName: Source-Build (${{ parameters.platform.name }}) + + ${{ each property in parameters.platform.jobProperties }}: + ${{ property.key }}: ${{ property.value }} + + ${{ if ne(parameters.platform.container, '') }}: + container: ${{ parameters.platform.container }} + + ${{ if eq(parameters.platform.pool, '') }}: + # The default VM host AzDO pool. This should be capable of running Docker containers: almost all + # source-build builds run in Docker, including the default managed platform. + # /eng/common/templates-official/variables/pool-providers.yml can't be used here (some customers declare variables already), so duplicate its logic + pool: + ${{ if eq(variables['System.TeamProject'], 'public') }}: + name: $[replace(replace(eq(contains(coalesce(variables['System.PullRequest.TargetBranch'], variables['Build.SourceBranch'], 'refs/heads/main'), 'release'), 'true'), True, 'NetCore-Svc-Public' ), False, 'NetCore-Public')] + demands: ImageOverride -equals Build.Ubuntu.1804.Amd64.Open + + ${{ if eq(variables['System.TeamProject'], 'internal') }}: + name: $[replace(replace(eq(contains(coalesce(variables['System.PullRequest.TargetBranch'], variables['Build.SourceBranch'], 'refs/heads/main'), 'release'), 'true'), True, 'NetCore1ESPool-Svc-Internal'), False, 'NetCore1ESPool-Internal')] + image: 1es-mariner-2-pt + os: linux + + ${{ if ne(parameters.platform.pool, '') }}: + pool: ${{ parameters.platform.pool }} + + workspace: + clean: all + + steps: + - template: /eng/common/templates-official/steps/source-build.yml + parameters: + platform: ${{ parameters.platform }} diff --git a/eng/common/templates-official/job/source-index-stage1.yml b/eng/common/templates-official/job/source-index-stage1.yml new file mode 100644 index 00000000000..4b633739170 --- /dev/null +++ b/eng/common/templates-official/job/source-index-stage1.yml @@ -0,0 +1,68 @@ +parameters: + runAsPublic: false + sourceIndexPackageVersion: 1.0.1-20230228.2 + sourceIndexPackageSource: https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json + sourceIndexBuildCommand: powershell -NoLogo -NoProfile -ExecutionPolicy Bypass -Command "eng/common/build.ps1 -restore -build -binarylog -ci" + preSteps: [] + binlogPath: artifacts/log/Debug/Build.binlog + condition: '' + dependsOn: '' + pool: '' + +jobs: +- job: SourceIndexStage1 + dependsOn: ${{ parameters.dependsOn }} + condition: ${{ parameters.condition }} + variables: + - name: SourceIndexPackageVersion + value: ${{ parameters.sourceIndexPackageVersion }} + - name: SourceIndexPackageSource + value: ${{ parameters.sourceIndexPackageSource }} + - name: BinlogPath + value: ${{ parameters.binlogPath }} + - ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: + - group: source-dot-net stage1 variables + - template: /eng/common/templates-official/variables/pool-providers.yml + + ${{ if ne(parameters.pool, '') }}: + pool: ${{ parameters.pool }} + ${{ if eq(parameters.pool, '') }}: + pool: + ${{ if eq(variables['System.TeamProject'], 'public') }}: + name: $(DncEngPublicBuildPool) + demands: ImageOverride -equals windows.vs2019.amd64.open + ${{ if eq(variables['System.TeamProject'], 'internal') }}: + name: $(DncEngInternalBuildPool) + image: 1es-windows-2022-pt + os: windows + + steps: + - ${{ each preStep in parameters.preSteps }}: + - ${{ preStep }} + + - task: UseDotNet@2 + displayName: Use .NET Core SDK 6 + inputs: + packageType: sdk + version: 6.0.x + installationPath: $(Agent.TempDirectory)/dotnet + workingDirectory: $(Agent.TempDirectory) + + - script: | + $(Agent.TempDirectory)/dotnet/dotnet tool install BinLogToSln --version $(SourceIndexPackageVersion) --add-source $(SourceIndexPackageSource) --tool-path $(Agent.TempDirectory)/.source-index/tools + $(Agent.TempDirectory)/dotnet/dotnet tool install UploadIndexStage1 --version $(SourceIndexPackageVersion) --add-source $(SourceIndexPackageSource) --tool-path $(Agent.TempDirectory)/.source-index/tools + displayName: Download Tools + # Set working directory to temp directory so 'dotnet' doesn't try to use global.json and use the repo's sdk. + workingDirectory: $(Agent.TempDirectory) + + - script: ${{ parameters.sourceIndexBuildCommand }} + displayName: Build Repository + + - script: $(Agent.TempDirectory)/.source-index/tools/BinLogToSln -i $(BinlogPath) -r $(Build.SourcesDirectory) -n $(Build.Repository.Name) -o .source-index/stage1output + displayName: Process Binlog into indexable sln + + - ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: + - script: $(Agent.TempDirectory)/.source-index/tools/UploadIndexStage1 -i .source-index/stage1output -n $(Build.Repository.Name) + displayName: Upload stage1 artifacts to source index + env: + BLOB_CONTAINER_URL: $(source-dot-net-stage1-blob-container-url) diff --git a/eng/common/templates-official/jobs/codeql-build.yml b/eng/common/templates-official/jobs/codeql-build.yml new file mode 100644 index 00000000000..b68d3c2f319 --- /dev/null +++ b/eng/common/templates-official/jobs/codeql-build.yml @@ -0,0 +1,31 @@ +parameters: + # See schema documentation in /Documentation/AzureDevOps/TemplateSchema.md + continueOnError: false + # Required: A collection of jobs to run - https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema?view=vsts&tabs=schema#job + jobs: [] + # Optional: if specified, restore and use this version of Guardian instead of the default. + overrideGuardianVersion: '' + +jobs: +- template: /eng/common/templates-official/jobs/jobs.yml + parameters: + enableMicrobuild: false + enablePublishBuildArtifacts: false + enablePublishTestResults: false + enablePublishBuildAssets: false + enablePublishUsingPipelines: false + enableTelemetry: true + + variables: + - group: Publish-Build-Assets + # The Guardian version specified in 'eng/common/sdl/packages.config'. This value must be kept in + # sync with the packages.config file. + - name: DefaultGuardianVersion + value: 0.109.0 + - name: GuardianPackagesConfigFile + value: $(Build.SourcesDirectory)\eng\common\sdl\packages.config + - name: GuardianVersion + value: ${{ coalesce(parameters.overrideGuardianVersion, '$(DefaultGuardianVersion)') }} + + jobs: ${{ parameters.jobs }} + diff --git a/eng/common/templates-official/jobs/jobs.yml b/eng/common/templates-official/jobs/jobs.yml new file mode 100644 index 00000000000..857a0f8ba43 --- /dev/null +++ b/eng/common/templates-official/jobs/jobs.yml @@ -0,0 +1,97 @@ +parameters: + # See schema documentation in /Documentation/AzureDevOps/TemplateSchema.md + continueOnError: false + + # Optional: Include PublishBuildArtifacts task + enablePublishBuildArtifacts: false + + # Optional: Enable publishing using release pipelines + enablePublishUsingPipelines: false + + # Optional: Enable running the source-build jobs to build repo from source + enableSourceBuild: false + + # Optional: Parameters for source-build template. + # See /eng/common/templates-official/jobs/source-build.yml for options + sourceBuildParameters: [] + + graphFileGeneration: + # Optional: Enable generating the graph files at the end of the build + enabled: false + # Optional: Include toolset dependencies in the generated graph files + includeToolset: false + + # Required: A collection of jobs to run - https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema?view=vsts&tabs=schema#job + jobs: [] + + # Optional: Override automatically derived dependsOn value for "publish build assets" job + publishBuildAssetsDependsOn: '' + + # Optional: Publish the assets as soon as the publish to BAR stage is complete, rather doing so in a separate stage. + publishAssetsImmediately: false + + # Optional: If using publishAssetsImmediately and additional parameters are needed, can be used to send along additional parameters (normally sent to post-build.yml) + artifactsPublishingAdditionalParameters: '' + signingValidationAdditionalParameters: '' + + # Optional: should run as a public build even in the internal project + # if 'true', the build won't run any of the internal only steps, even if it is running in non-public projects. + runAsPublic: false + + enableSourceIndex: false + sourceIndexParams: {} + +# Internal resources (telemetry, microbuild) can only be accessed from non-public projects, +# and some (Microbuild) should only be applied to non-PR cases for internal builds. + +jobs: +- ${{ each job in parameters.jobs }}: + - template: ../job/job.yml + parameters: + # pass along parameters + ${{ each parameter in parameters }}: + ${{ if ne(parameter.key, 'jobs') }}: + ${{ parameter.key }}: ${{ parameter.value }} + + # pass along job properties + ${{ each property in job }}: + ${{ if ne(property.key, 'job') }}: + ${{ property.key }}: ${{ property.value }} + + name: ${{ job.job }} + +- ${{ if eq(parameters.enableSourceBuild, true) }}: + - template: /eng/common/templates-official/jobs/source-build.yml + parameters: + allCompletedJobId: Source_Build_Complete + ${{ each parameter in parameters.sourceBuildParameters }}: + ${{ parameter.key }}: ${{ parameter.value }} + +- ${{ if eq(parameters.enableSourceIndex, 'true') }}: + - template: ../job/source-index-stage1.yml + parameters: + runAsPublic: ${{ parameters.runAsPublic }} + ${{ each parameter in parameters.sourceIndexParams }}: + ${{ parameter.key }}: ${{ parameter.value }} + +- ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: + - ${{ if or(eq(parameters.enablePublishBuildAssets, true), eq(parameters.artifacts.publish.manifests, 'true'), ne(parameters.artifacts.publish.manifests, '')) }}: + - template: ../job/publish-build-assets.yml + parameters: + continueOnError: ${{ parameters.continueOnError }} + dependsOn: + - ${{ if ne(parameters.publishBuildAssetsDependsOn, '') }}: + - ${{ each job in parameters.publishBuildAssetsDependsOn }}: + - ${{ job.job }} + - ${{ if eq(parameters.publishBuildAssetsDependsOn, '') }}: + - ${{ each job in parameters.jobs }}: + - ${{ job.job }} + - ${{ if eq(parameters.enableSourceBuild, true) }}: + - Source_Build_Complete + + runAsPublic: ${{ parameters.runAsPublic }} + publishUsingPipelines: ${{ parameters.enablePublishUsingPipelines }} + publishAssetsImmediately: ${{ parameters.publishAssetsImmediately }} + enablePublishBuildArtifacts: ${{ parameters.enablePublishBuildArtifacts }} + artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }} + signingValidationAdditionalParameters: ${{ parameters.signingValidationAdditionalParameters }} diff --git a/eng/common/templates-official/jobs/source-build.yml b/eng/common/templates-official/jobs/source-build.yml new file mode 100644 index 00000000000..08e5db9bb11 --- /dev/null +++ b/eng/common/templates-official/jobs/source-build.yml @@ -0,0 +1,46 @@ +parameters: + # This template adds arcade-powered source-build to CI. A job is created for each platform, as + # well as an optional server job that completes when all platform jobs complete. + + # The name of the "join" job for all source-build platforms. If set to empty string, the job is + # not included. Existing repo pipelines can use this job depend on all source-build jobs + # completing without maintaining a separate list of every single job ID: just depend on this one + # server job. By default, not included. Recommended name if used: 'Source_Build_Complete'. + allCompletedJobId: '' + + # See /eng/common/templates-official/job/source-build.yml + jobNamePrefix: 'Source_Build' + + # This is the default platform provided by Arcade, intended for use by a managed-only repo. + defaultManagedPlatform: + name: 'Managed' + container: 'mcr.microsoft.com/dotnet-buildtools/prereqs:centos-stream8' + + # Defines the platforms on which to run build jobs. One job is created for each platform, and the + # object in this array is sent to the job template as 'platform'. If no platforms are specified, + # one job runs on 'defaultManagedPlatform'. + platforms: [] + +jobs: + +- ${{ if ne(parameters.allCompletedJobId, '') }}: + - job: ${{ parameters.allCompletedJobId }} + displayName: Source-Build Complete + pool: server + dependsOn: + - ${{ each platform in parameters.platforms }}: + - ${{ parameters.jobNamePrefix }}_${{ platform.name }} + - ${{ if eq(length(parameters.platforms), 0) }}: + - ${{ parameters.jobNamePrefix }}_${{ parameters.defaultManagedPlatform.name }} + +- ${{ each platform in parameters.platforms }}: + - template: /eng/common/templates-official/job/source-build.yml + parameters: + jobNamePrefix: ${{ parameters.jobNamePrefix }} + platform: ${{ platform }} + +- ${{ if eq(length(parameters.platforms), 0) }}: + - template: /eng/common/templates-official/job/source-build.yml + parameters: + jobNamePrefix: ${{ parameters.jobNamePrefix }} + platform: ${{ parameters.defaultManagedPlatform }} diff --git a/eng/common/templates-official/post-build/common-variables.yml b/eng/common/templates-official/post-build/common-variables.yml new file mode 100644 index 00000000000..c24193acfc9 --- /dev/null +++ b/eng/common/templates-official/post-build/common-variables.yml @@ -0,0 +1,22 @@ +variables: + - group: Publish-Build-Assets + + # Whether the build is internal or not + - name: IsInternalBuild + value: ${{ and(ne(variables['System.TeamProject'], 'public'), contains(variables['Build.SourceBranch'], 'internal')) }} + + # Default Maestro++ API Endpoint and API Version + - name: MaestroApiEndPoint + value: "https://maestro-prod.westus2.cloudapp.azure.com" + - name: MaestroApiAccessToken + value: $(MaestroAccessToken) + - name: MaestroApiVersion + value: "2020-02-20" + + - name: SourceLinkCLIVersion + value: 3.0.0 + - name: SymbolToolVersion + value: 1.0.1 + + - name: runCodesignValidationInjection + value: false diff --git a/eng/common/templates-official/post-build/post-build.yml b/eng/common/templates-official/post-build/post-build.yml new file mode 100644 index 00000000000..5c98fe1c0f3 --- /dev/null +++ b/eng/common/templates-official/post-build/post-build.yml @@ -0,0 +1,285 @@ +parameters: + # Which publishing infra should be used. THIS SHOULD MATCH THE VERSION ON THE BUILD MANIFEST. + # Publishing V1 is no longer supported + # Publishing V2 is no longer supported + # Publishing V3 is the default + - name: publishingInfraVersion + displayName: Which version of publishing should be used to promote the build definition? + type: number + default: 3 + values: + - 3 + + - name: BARBuildId + displayName: BAR Build Id + type: number + default: 0 + + - name: PromoteToChannelIds + displayName: Channel to promote BARBuildId to + type: string + default: '' + + - name: enableSourceLinkValidation + displayName: Enable SourceLink validation + type: boolean + default: false + + - name: enableSigningValidation + displayName: Enable signing validation + type: boolean + default: true + + - name: enableSymbolValidation + displayName: Enable symbol validation + type: boolean + default: false + + - name: enableNugetValidation + displayName: Enable NuGet validation + type: boolean + default: true + + - name: publishInstallersAndChecksums + displayName: Publish installers and checksums + type: boolean + default: true + + - name: SDLValidationParameters + type: object + default: + enable: false + publishGdn: false + continueOnError: false + params: '' + artifactNames: '' + downloadArtifacts: true + + # These parameters let the user customize the call to sdk-task.ps1 for publishing + # symbols & general artifacts as well as for signing validation + - name: symbolPublishingAdditionalParameters + displayName: Symbol publishing additional parameters + type: string + default: '' + + - name: artifactsPublishingAdditionalParameters + displayName: Artifact publishing additional parameters + type: string + default: '' + + - name: signingValidationAdditionalParameters + displayName: Signing validation additional parameters + type: string + default: '' + + # Which stages should finish execution before post-build stages start + - name: validateDependsOn + type: object + default: + - build + + - name: publishDependsOn + type: object + default: + - Validate + + # Optional: Call asset publishing rather than running in a separate stage + - name: publishAssetsImmediately + type: boolean + default: false + +stages: +- ${{ if or(eq( parameters.enableNugetValidation, 'true'), eq(parameters.enableSigningValidation, 'true'), eq(parameters.enableSourceLinkValidation, 'true'), eq(parameters.SDLValidationParameters.enable, 'true')) }}: + - stage: Validate + dependsOn: ${{ parameters.validateDependsOn }} + displayName: Validate Build Assets + variables: + - template: common-variables.yml + - template: /eng/common/templates-official/variables/pool-providers.yml + jobs: + - job: + displayName: NuGet Validation + condition: and(succeededOrFailed(), eq( ${{ parameters.enableNugetValidation }}, 'true')) + pool: + # We don't use the collection uri here because it might vary (.visualstudio.com vs. dev.azure.com) + ${{ if eq(variables['System.TeamProject'], 'DevDiv') }}: + name: AzurePipelines-EO + image: 1ESPT-Windows2022 + demands: Cmd + os: windows + # If it's not devdiv, it's dnceng + ${{ else }}: + name: $(DncEngInternalBuildPool) + image: 1es-windows-2022-pt + os: windows + + steps: + - template: setup-maestro-vars.yml + parameters: + BARBuildId: ${{ parameters.BARBuildId }} + PromoteToChannelIds: ${{ parameters.PromoteToChannelIds }} + + - task: DownloadBuildArtifacts@0 + displayName: Download Package Artifacts + inputs: + buildType: specific + buildVersionToDownload: specific + project: $(AzDOProjectName) + pipeline: $(AzDOPipelineId) + buildId: $(AzDOBuildId) + artifactName: PackageArtifacts + checkDownloadedFiles: true + + - task: PowerShell@2 + displayName: Validate + inputs: + filePath: $(Build.SourcesDirectory)/eng/common/post-build/nuget-validation.ps1 + arguments: -PackagesPath $(Build.ArtifactStagingDirectory)/PackageArtifacts/ + -ToolDestinationPath $(Agent.BuildDirectory)/Extract/ + + - job: + displayName: Signing Validation + condition: and( eq( ${{ parameters.enableSigningValidation }}, 'true'), ne( variables['PostBuildSign'], 'true')) + pool: + # We don't use the collection uri here because it might vary (.visualstudio.com vs. dev.azure.com) + ${{ if eq(variables['System.TeamProject'], 'DevDiv') }}: + name: AzurePipelines-EO + image: 1ESPT-Windows2022 + demands: Cmd + os: windows + # If it's not devdiv, it's dnceng + ${{ else }}: + name: $(DncEngInternalBuildPool) + image: 1es-windows-2022-pt + os: windows + steps: + - template: setup-maestro-vars.yml + parameters: + BARBuildId: ${{ parameters.BARBuildId }} + PromoteToChannelIds: ${{ parameters.PromoteToChannelIds }} + + - task: DownloadBuildArtifacts@0 + displayName: Download Package Artifacts + inputs: + buildType: specific + buildVersionToDownload: specific + project: $(AzDOProjectName) + pipeline: $(AzDOPipelineId) + buildId: $(AzDOBuildId) + artifactName: PackageArtifacts + checkDownloadedFiles: true + itemPattern: | + ** + !**/Microsoft.SourceBuild.Intermediate.*.nupkg + + # This is necessary whenever we want to publish/restore to an AzDO private feed + # Since sdk-task.ps1 tries to restore packages we need to do this authentication here + # otherwise it'll complain about accessing a private feed. + - task: NuGetAuthenticate@1 + displayName: 'Authenticate to AzDO Feeds' + + # Signing validation will optionally work with the buildmanifest file which is downloaded from + # Azure DevOps above. + - task: PowerShell@2 + displayName: Validate + inputs: + filePath: eng\common\sdk-task.ps1 + arguments: -task SigningValidation -restore -msbuildEngine vs + /p:PackageBasePath='$(Build.ArtifactStagingDirectory)/PackageArtifacts' + /p:SignCheckExclusionsFile='$(Build.SourcesDirectory)/eng/SignCheckExclusionsFile.txt' + ${{ parameters.signingValidationAdditionalParameters }} + + - template: ../steps/publish-logs.yml + parameters: + StageLabel: 'Validation' + JobLabel: 'Signing' + BinlogToolVersion: $(BinlogToolVersion) + + - job: + displayName: SourceLink Validation + condition: eq( ${{ parameters.enableSourceLinkValidation }}, 'true') + pool: + # We don't use the collection uri here because it might vary (.visualstudio.com vs. dev.azure.com) + ${{ if eq(variables['System.TeamProject'], 'DevDiv') }}: + name: AzurePipelines-EO + image: 1ESPT-Windows2022 + demands: Cmd + os: windows + # If it's not devdiv, it's dnceng + ${{ else }}: + name: $(DncEngInternalBuildPool) + image: 1es-windows-2022-pt + os: windows + steps: + - template: setup-maestro-vars.yml + parameters: + BARBuildId: ${{ parameters.BARBuildId }} + PromoteToChannelIds: ${{ parameters.PromoteToChannelIds }} + + - task: DownloadBuildArtifacts@0 + displayName: Download Blob Artifacts + inputs: + buildType: specific + buildVersionToDownload: specific + project: $(AzDOProjectName) + pipeline: $(AzDOPipelineId) + buildId: $(AzDOBuildId) + artifactName: BlobArtifacts + checkDownloadedFiles: true + + - task: PowerShell@2 + displayName: Validate + inputs: + filePath: $(Build.SourcesDirectory)/eng/common/post-build/sourcelink-validation.ps1 + arguments: -InputPath $(Build.ArtifactStagingDirectory)/BlobArtifacts/ + -ExtractPath $(Agent.BuildDirectory)/Extract/ + -GHRepoName $(Build.Repository.Name) + -GHCommit $(Build.SourceVersion) + -SourcelinkCliVersion $(SourceLinkCLIVersion) + continueOnError: true + +- ${{ if ne(parameters.publishAssetsImmediately, 'true') }}: + - stage: publish_using_darc + ${{ if or(eq(parameters.enableNugetValidation, 'true'), eq(parameters.enableSigningValidation, 'true'), eq(parameters.enableSourceLinkValidation, 'true'), eq(parameters.SDLValidationParameters.enable, 'true')) }}: + dependsOn: ${{ parameters.publishDependsOn }} + ${{ else }}: + dependsOn: ${{ parameters.validateDependsOn }} + displayName: Publish using Darc + variables: + - template: common-variables.yml + - template: /eng/common/templates-official/variables/pool-providers.yml + jobs: + - job: + displayName: Publish Using Darc + timeoutInMinutes: 120 + pool: + # We don't use the collection uri here because it might vary (.visualstudio.com vs. dev.azure.com) + ${{ if eq(variables['System.TeamProject'], 'DevDiv') }}: + name: AzurePipelines-EO + image: 1ESPT-Windows2022 + demands: Cmd + os: windows + # If it's not devdiv, it's dnceng + ${{ else }}: + name: $(DncEngInternalBuildPool) + image: 1es-windows-2022-pt + os: windows + steps: + - template: setup-maestro-vars.yml + parameters: + BARBuildId: ${{ parameters.BARBuildId }} + PromoteToChannelIds: ${{ parameters.PromoteToChannelIds }} + + - task: NuGetAuthenticate@1 + + - task: PowerShell@2 + displayName: Publish Using Darc + inputs: + filePath: $(Build.SourcesDirectory)/eng/common/post-build/publish-using-darc.ps1 + arguments: -BuildId $(BARBuildId) + -PublishingInfraVersion ${{ parameters.publishingInfraVersion }} + -AzdoToken '$(publishing-dnceng-devdiv-code-r-build-re)' + -MaestroToken '$(MaestroApiAccessToken)' + -WaitPublishingFinish true + -ArtifactsPublishingAdditionalParameters '${{ parameters.artifactsPublishingAdditionalParameters }}' + -SymbolPublishingAdditionalParameters '${{ parameters.symbolPublishingAdditionalParameters }}' diff --git a/eng/common/templates-official/post-build/setup-maestro-vars.yml b/eng/common/templates-official/post-build/setup-maestro-vars.yml new file mode 100644 index 00000000000..0c87f149a4a --- /dev/null +++ b/eng/common/templates-official/post-build/setup-maestro-vars.yml @@ -0,0 +1,70 @@ +parameters: + BARBuildId: '' + PromoteToChannelIds: '' + +steps: + - ${{ if eq(coalesce(parameters.PromoteToChannelIds, 0), 0) }}: + - task: DownloadBuildArtifacts@0 + displayName: Download Release Configs + inputs: + buildType: current + artifactName: ReleaseConfigs + checkDownloadedFiles: true + + - task: PowerShell@2 + name: setReleaseVars + displayName: Set Release Configs Vars + inputs: + targetType: inline + pwsh: true + script: | + try { + if (!$Env:PromoteToMaestroChannels -or $Env:PromoteToMaestroChannels.Trim() -eq '') { + $Content = Get-Content $(Build.StagingDirectory)/ReleaseConfigs/ReleaseConfigs.txt + + $BarId = $Content | Select -Index 0 + $Channels = $Content | Select -Index 1 + $IsStableBuild = $Content | Select -Index 2 + + $AzureDevOpsProject = $Env:System_TeamProject + $AzureDevOpsBuildDefinitionId = $Env:System_DefinitionId + $AzureDevOpsBuildId = $Env:Build_BuildId + } + else { + $buildApiEndpoint = "${Env:MaestroApiEndPoint}/api/builds/${Env:BARBuildId}?api-version=${Env:MaestroApiVersion}" + + $apiHeaders = New-Object 'System.Collections.Generic.Dictionary[[String],[String]]' + $apiHeaders.Add('Accept', 'application/json') + $apiHeaders.Add('Authorization',"Bearer ${Env:MAESTRO_API_TOKEN}") + + $buildInfo = try { Invoke-WebRequest -Method Get -Uri $buildApiEndpoint -Headers $apiHeaders | ConvertFrom-Json } catch { Write-Host "Error: $_" } + + $BarId = $Env:BARBuildId + $Channels = $Env:PromoteToMaestroChannels -split "," + $Channels = $Channels -join "][" + $Channels = "[$Channels]" + + $IsStableBuild = $buildInfo.stable + $AzureDevOpsProject = $buildInfo.azureDevOpsProject + $AzureDevOpsBuildDefinitionId = $buildInfo.azureDevOpsBuildDefinitionId + $AzureDevOpsBuildId = $buildInfo.azureDevOpsBuildId + } + + Write-Host "##vso[task.setvariable variable=BARBuildId]$BarId" + Write-Host "##vso[task.setvariable variable=TargetChannels]$Channels" + Write-Host "##vso[task.setvariable variable=IsStableBuild]$IsStableBuild" + + Write-Host "##vso[task.setvariable variable=AzDOProjectName]$AzureDevOpsProject" + Write-Host "##vso[task.setvariable variable=AzDOPipelineId]$AzureDevOpsBuildDefinitionId" + Write-Host "##vso[task.setvariable variable=AzDOBuildId]$AzureDevOpsBuildId" + } + catch { + Write-Host $_ + Write-Host $_.Exception + Write-Host $_.ScriptStackTrace + exit 1 + } + env: + MAESTRO_API_TOKEN: $(MaestroApiAccessToken) + BARBuildId: ${{ parameters.BARBuildId }} + PromoteToMaestroChannels: ${{ parameters.PromoteToChannelIds }} diff --git a/eng/common/templates-official/post-build/trigger-subscription.yml b/eng/common/templates-official/post-build/trigger-subscription.yml new file mode 100644 index 00000000000..da669030daf --- /dev/null +++ b/eng/common/templates-official/post-build/trigger-subscription.yml @@ -0,0 +1,13 @@ +parameters: + ChannelId: 0 + +steps: +- task: PowerShell@2 + displayName: Triggering subscriptions + inputs: + filePath: $(Build.SourcesDirectory)/eng/common/post-build/trigger-subscriptions.ps1 + arguments: -SourceRepo $(Build.Repository.Uri) + -ChannelId ${{ parameters.ChannelId }} + -MaestroApiAccessToken $(MaestroAccessToken) + -MaestroApiEndPoint $(MaestroApiEndPoint) + -MaestroApiVersion $(MaestroApiVersion) diff --git a/eng/common/templates-official/steps/add-build-to-channel.yml b/eng/common/templates-official/steps/add-build-to-channel.yml new file mode 100644 index 00000000000..f67a210d62f --- /dev/null +++ b/eng/common/templates-official/steps/add-build-to-channel.yml @@ -0,0 +1,13 @@ +parameters: + ChannelId: 0 + +steps: +- task: PowerShell@2 + displayName: Add Build to Channel + inputs: + filePath: $(Build.SourcesDirectory)/eng/common/post-build/add-build-to-channel.ps1 + arguments: -BuildId $(BARBuildId) + -ChannelId ${{ parameters.ChannelId }} + -MaestroApiAccessToken $(MaestroApiAccessToken) + -MaestroApiEndPoint $(MaestroApiEndPoint) + -MaestroApiVersion $(MaestroApiVersion) diff --git a/eng/common/templates-official/steps/build-reason.yml b/eng/common/templates-official/steps/build-reason.yml new file mode 100644 index 00000000000..eba58109b52 --- /dev/null +++ b/eng/common/templates-official/steps/build-reason.yml @@ -0,0 +1,12 @@ +# build-reason.yml +# Description: runs steps if build.reason condition is valid. conditions is a string of valid build reasons +# to include steps (',' separated). +parameters: + conditions: '' + steps: [] + +steps: + - ${{ if and( not(startsWith(parameters.conditions, 'not')), contains(parameters.conditions, variables['build.reason'])) }}: + - ${{ parameters.steps }} + - ${{ if and( startsWith(parameters.conditions, 'not'), not(contains(parameters.conditions, variables['build.reason']))) }}: + - ${{ parameters.steps }} diff --git a/eng/common/templates-official/steps/component-governance.yml b/eng/common/templates-official/steps/component-governance.yml new file mode 100644 index 00000000000..0ecec47b0c9 --- /dev/null +++ b/eng/common/templates-official/steps/component-governance.yml @@ -0,0 +1,13 @@ +parameters: + disableComponentGovernance: false + componentGovernanceIgnoreDirectories: '' + +steps: +- ${{ if eq(parameters.disableComponentGovernance, 'true') }}: + - script: "echo ##vso[task.setvariable variable=skipComponentGovernanceDetection]true" + displayName: Set skipComponentGovernanceDetection variable +- ${{ if ne(parameters.disableComponentGovernance, 'true') }}: + - task: ComponentGovernanceComponentDetection@0 + continueOnError: true + inputs: + ignoreDirectories: ${{ parameters.componentGovernanceIgnoreDirectories }} \ No newline at end of file diff --git a/eng/common/templates-official/steps/execute-codeql.yml b/eng/common/templates-official/steps/execute-codeql.yml new file mode 100644 index 00000000000..9b4a5ffa30a --- /dev/null +++ b/eng/common/templates-official/steps/execute-codeql.yml @@ -0,0 +1,32 @@ +parameters: + # Language that should be analyzed. Defaults to csharp + language: csharp + # Build Commands + buildCommands: '' + overrideParameters: '' # Optional: to override values for parameters. + additionalParameters: '' # Optional: parameters that need user specific values eg: '-SourceToolsList @("abc","def") -ArtifactToolsList @("ghi","jkl")' + # Optional: if specified, restore and use this version of Guardian instead of the default. + overrideGuardianVersion: '' + # Optional: if true, publish the '.gdn' folder as a pipeline artifact. This can help with in-depth + # diagnosis of problems with specific tool configurations. + publishGuardianDirectoryToPipeline: false + # The script to run to execute all SDL tools. Use this if you want to use a script to define SDL + # parameters rather than relying on YAML. It may be better to use a local script, because you can + # reproduce results locally without piecing together a command based on the YAML. + executeAllSdlToolsScript: 'eng/common/sdl/execute-all-sdl-tools.ps1' + # There is some sort of bug (has been reported) in Azure DevOps where if this parameter is named + # 'continueOnError', the parameter value is not correctly picked up. + # This can also be remedied by the caller (post-build.yml) if it does not use a nested parameter + # optional: determines whether to continue the build if the step errors; + sdlContinueOnError: false + +steps: +- template: /eng/common/templates-official/steps/execute-sdl.yml + parameters: + overrideGuardianVersion: ${{ parameters.overrideGuardianVersion }} + executeAllSdlToolsScript: ${{ parameters.executeAllSdlToolsScript }} + overrideParameters: ${{ parameters.overrideParameters }} + additionalParameters: '${{ parameters.additionalParameters }} + -CodeQLAdditionalRunConfigParams @("BuildCommands < ${{ parameters.buildCommands }}", "Language < ${{ parameters.language }}")' + publishGuardianDirectoryToPipeline: ${{ parameters.publishGuardianDirectoryToPipeline }} + sdlContinueOnError: ${{ parameters.sdlContinueOnError }} \ No newline at end of file diff --git a/eng/common/templates-official/steps/execute-sdl.yml b/eng/common/templates-official/steps/execute-sdl.yml new file mode 100644 index 00000000000..07426fde05d --- /dev/null +++ b/eng/common/templates-official/steps/execute-sdl.yml @@ -0,0 +1,88 @@ +parameters: + overrideGuardianVersion: '' + executeAllSdlToolsScript: '' + overrideParameters: '' + additionalParameters: '' + publishGuardianDirectoryToPipeline: false + sdlContinueOnError: false + condition: '' + +steps: +- task: NuGetAuthenticate@1 + inputs: + nuGetServiceConnections: GuardianConnect + +- task: NuGetToolInstaller@1 + displayName: 'Install NuGet.exe' + +- ${{ if ne(parameters.overrideGuardianVersion, '') }}: + - pwsh: | + Set-Location -Path $(Build.SourcesDirectory)\eng\common\sdl + . .\sdl.ps1 + $guardianCliLocation = Install-Gdn -Path $(Build.SourcesDirectory)\.artifacts -Version ${{ parameters.overrideGuardianVersion }} + Write-Host "##vso[task.setvariable variable=GuardianCliLocation]$guardianCliLocation" + displayName: Install Guardian (Overridden) + +- ${{ if eq(parameters.overrideGuardianVersion, '') }}: + - pwsh: | + Set-Location -Path $(Build.SourcesDirectory)\eng\common\sdl + . .\sdl.ps1 + $guardianCliLocation = Install-Gdn -Path $(Build.SourcesDirectory)\.artifacts + Write-Host "##vso[task.setvariable variable=GuardianCliLocation]$guardianCliLocation" + displayName: Install Guardian + +- ${{ if ne(parameters.overrideParameters, '') }}: + - powershell: ${{ parameters.executeAllSdlToolsScript }} ${{ parameters.overrideParameters }} + displayName: Execute SDL (Overridden) + continueOnError: ${{ parameters.sdlContinueOnError }} + condition: ${{ parameters.condition }} + +- ${{ if eq(parameters.overrideParameters, '') }}: + - powershell: ${{ parameters.executeAllSdlToolsScript }} + -GuardianCliLocation $(GuardianCliLocation) + -NugetPackageDirectory $(Build.SourcesDirectory)\.packages + -AzureDevOpsAccessToken $(dn-bot-dotnet-build-rw-code-rw) + ${{ parameters.additionalParameters }} + displayName: Execute SDL + continueOnError: ${{ parameters.sdlContinueOnError }} + condition: ${{ parameters.condition }} + +- ${{ if ne(parameters.publishGuardianDirectoryToPipeline, 'false') }}: + # We want to publish the Guardian results and configuration for easy diagnosis. However, the + # '.gdn' dir is a mix of configuration, results, extracted dependencies, and Guardian default + # tooling files. Some of these files are large and aren't useful during an investigation, so + # exclude them by simply deleting them before publishing. (As of writing, there is no documented + # way to selectively exclude a dir from the pipeline artifact publish task.) + - task: DeleteFiles@1 + displayName: Delete Guardian dependencies to avoid uploading + inputs: + SourceFolder: $(Agent.BuildDirectory)/.gdn + Contents: | + c + i + condition: succeededOrFailed() + + - publish: $(Agent.BuildDirectory)/.gdn + artifact: GuardianConfiguration + displayName: Publish GuardianConfiguration + condition: succeededOrFailed() + + # Publish the SARIF files in a container named CodeAnalysisLogs to enable integration + # with the "SARIF SAST Scans Tab" Azure DevOps extension + - task: CopyFiles@2 + displayName: Copy SARIF files + inputs: + flattenFolders: true + sourceFolder: $(Agent.BuildDirectory)/.gdn/rc/ + contents: '**/*.sarif' + targetFolder: $(Build.SourcesDirectory)/CodeAnalysisLogs + condition: succeededOrFailed() + + # Use PublishBuildArtifacts because the SARIF extension only checks this case + # see microsoft/sarif-azuredevops-extension#4 + - task: PublishBuildArtifacts@1 + displayName: Publish SARIF files to CodeAnalysisLogs container + inputs: + pathToPublish: $(Build.SourcesDirectory)/CodeAnalysisLogs + artifactName: CodeAnalysisLogs + condition: succeededOrFailed() \ No newline at end of file diff --git a/eng/common/templates-official/steps/generate-sbom.yml b/eng/common/templates-official/steps/generate-sbom.yml new file mode 100644 index 00000000000..1bf43bf807a --- /dev/null +++ b/eng/common/templates-official/steps/generate-sbom.yml @@ -0,0 +1,48 @@ +# BuildDropPath - The root folder of the drop directory for which the manifest file will be generated. +# PackageName - The name of the package this SBOM represents. +# PackageVersion - The version of the package this SBOM represents. +# ManifestDirPath - The path of the directory where the generated manifest files will be placed +# IgnoreDirectories - Directories to ignore for SBOM generation. This will be passed through to the CG component detector. + +parameters: + PackageVersion: 8.0.0 + BuildDropPath: '$(Build.SourcesDirectory)/artifacts' + PackageName: '.NET' + ManifestDirPath: $(Build.ArtifactStagingDirectory)/sbom + IgnoreDirectories: '' + sbomContinueOnError: true + +steps: +- task: PowerShell@2 + displayName: Prep for SBOM generation in (Non-linux) + condition: or(eq(variables['Agent.Os'], 'Windows_NT'), eq(variables['Agent.Os'], 'Darwin')) + inputs: + filePath: ./eng/common/generate-sbom-prep.ps1 + arguments: ${{parameters.manifestDirPath}} + +# Chmodding is a workaround for https://github.com/dotnet/arcade/issues/8461 +- script: | + chmod +x ./eng/common/generate-sbom-prep.sh + ./eng/common/generate-sbom-prep.sh ${{parameters.manifestDirPath}} + displayName: Prep for SBOM generation in (Linux) + condition: eq(variables['Agent.Os'], 'Linux') + continueOnError: ${{ parameters.sbomContinueOnError }} + +- task: AzureArtifacts.manifest-generator-task.manifest-generator-task.ManifestGeneratorTask@0 + displayName: 'Generate SBOM manifest' + continueOnError: ${{ parameters.sbomContinueOnError }} + inputs: + PackageName: ${{ parameters.packageName }} + BuildDropPath: ${{ parameters.buildDropPath }} + PackageVersion: ${{ parameters.packageVersion }} + ManifestDirPath: ${{ parameters.manifestDirPath }} + ${{ if ne(parameters.IgnoreDirectories, '') }}: + AdditionalComponentDetectorArgs: '--IgnoreDirectories ${{ parameters.IgnoreDirectories }}' + +- task: 1ES.PublishPipelineArtifact@1 + displayName: Publish SBOM manifest + continueOnError: ${{parameters.sbomContinueOnError}} + inputs: + targetPath: '${{parameters.manifestDirPath}}' + artifactName: $(ARTIFACT_NAME) + diff --git a/eng/common/templates-official/steps/publish-logs.yml b/eng/common/templates-official/steps/publish-logs.yml new file mode 100644 index 00000000000..04012fed182 --- /dev/null +++ b/eng/common/templates-official/steps/publish-logs.yml @@ -0,0 +1,23 @@ +parameters: + StageLabel: '' + JobLabel: '' + +steps: +- task: Powershell@2 + displayName: Prepare Binlogs to Upload + inputs: + targetType: inline + script: | + New-Item -ItemType Directory $(Build.SourcesDirectory)/PostBuildLogs/${{parameters.StageLabel}}/${{parameters.JobLabel}}/ + Move-Item -Path $(Build.SourcesDirectory)/artifacts/log/Debug/* $(Build.SourcesDirectory)/PostBuildLogs/${{parameters.StageLabel}}/${{parameters.JobLabel}}/ + continueOnError: true + condition: always() + +- task: 1ES.PublishBuildArtifacts@1 + displayName: Publish Logs + inputs: + PathtoPublish: '$(Build.SourcesDirectory)/PostBuildLogs' + PublishLocation: Container + ArtifactName: PostBuildLogs + continueOnError: true + condition: always() diff --git a/eng/common/templates-official/steps/retain-build.yml b/eng/common/templates-official/steps/retain-build.yml new file mode 100644 index 00000000000..83d97a26a01 --- /dev/null +++ b/eng/common/templates-official/steps/retain-build.yml @@ -0,0 +1,28 @@ +parameters: + # Optional azure devops PAT with build execute permissions for the build's organization, + # only needed if the build that should be retained ran on a different organization than + # the pipeline where this template is executing from + Token: '' + # Optional BuildId to retain, defaults to the current running build + BuildId: '' + # Azure devops Organization URI for the build in the https://dev.azure.com/ format. + # Defaults to the organization the current pipeline is running on + AzdoOrgUri: '$(System.CollectionUri)' + # Azure devops project for the build. Defaults to the project the current pipeline is running on + AzdoProject: '$(System.TeamProject)' + +steps: + - task: powershell@2 + inputs: + targetType: 'filePath' + filePath: eng/common/retain-build.ps1 + pwsh: true + arguments: > + -AzdoOrgUri: ${{parameters.AzdoOrgUri}} + -AzdoProject ${{parameters.AzdoProject}} + -Token ${{coalesce(parameters.Token, '$env:SYSTEM_ACCESSTOKEN') }} + -BuildId ${{coalesce(parameters.BuildId, '$env:BUILD_ID')}} + displayName: Enable permanent build retention + env: + SYSTEM_ACCESSTOKEN: $(System.AccessToken) + BUILD_ID: $(Build.BuildId) \ No newline at end of file diff --git a/eng/common/templates-official/steps/send-to-helix.yml b/eng/common/templates-official/steps/send-to-helix.yml new file mode 100644 index 00000000000..3eb7e2d5f84 --- /dev/null +++ b/eng/common/templates-official/steps/send-to-helix.yml @@ -0,0 +1,91 @@ +# Please remember to update the documentation if you make changes to these parameters! +parameters: + HelixSource: 'pr/default' # required -- sources must start with pr/, official/, prodcon/, or agent/ + HelixType: 'tests/default/' # required -- Helix telemetry which identifies what type of data this is; should include "test" for clarity and must end in '/' + HelixBuild: $(Build.BuildNumber) # required -- the build number Helix will use to identify this -- automatically set to the AzDO build number + HelixTargetQueues: '' # required -- semicolon-delimited list of Helix queues to test on; see https://helix.dot.net/ for a list of queues + HelixAccessToken: '' # required -- access token to make Helix API requests; should be provided by the appropriate variable group + HelixConfiguration: '' # optional -- additional property attached to a job + HelixPreCommands: '' # optional -- commands to run before Helix work item execution + HelixPostCommands: '' # optional -- commands to run after Helix work item execution + WorkItemDirectory: '' # optional -- a payload directory to zip up and send to Helix; requires WorkItemCommand; incompatible with XUnitProjects + WorkItemCommand: '' # optional -- a command to execute on the payload; requires WorkItemDirectory; incompatible with XUnitProjects + WorkItemTimeout: '' # optional -- a timeout in TimeSpan.Parse-ready value (e.g. 00:02:00) for the work item command; requires WorkItemDirectory; incompatible with XUnitProjects + CorrelationPayloadDirectory: '' # optional -- a directory to zip up and send to Helix as a correlation payload + XUnitProjects: '' # optional -- semicolon-delimited list of XUnitProjects to parse and send to Helix; requires XUnitRuntimeTargetFramework, XUnitPublishTargetFramework, XUnitRunnerVersion, and IncludeDotNetCli=true + XUnitWorkItemTimeout: '' # optional -- the workitem timeout in seconds for all workitems created from the xUnit projects specified by XUnitProjects + XUnitPublishTargetFramework: '' # optional -- framework to use to publish your xUnit projects + XUnitRuntimeTargetFramework: '' # optional -- framework to use for the xUnit console runner + XUnitRunnerVersion: '' # optional -- version of the xUnit nuget package you wish to use on Helix; required for XUnitProjects + IncludeDotNetCli: false # optional -- true will download a version of the .NET CLI onto the Helix machine as a correlation payload; requires DotNetCliPackageType and DotNetCliVersion + DotNetCliPackageType: '' # optional -- either 'sdk', 'runtime' or 'aspnetcore-runtime'; determines whether the sdk or runtime will be sent to Helix; see https://raw.githubusercontent.com/dotnet/core/main/release-notes/releases-index.json + DotNetCliVersion: '' # optional -- version of the CLI to send to Helix; based on this: https://raw.githubusercontent.com/dotnet/core/main/release-notes/releases-index.json + WaitForWorkItemCompletion: true # optional -- true will make the task wait until work items have been completed and fail the build if work items fail. False is "fire and forget." + IsExternal: false # [DEPRECATED] -- doesn't do anything, jobs are external if HelixAccessToken is empty and Creator is set + HelixBaseUri: 'https://helix.dot.net/' # optional -- sets the Helix API base URI (allows targeting https://helix.int-dot.net ) + Creator: '' # optional -- if the build is external, use this to specify who is sending the job + DisplayNamePrefix: 'Run Tests' # optional -- rename the beginning of the displayName of the steps in AzDO + condition: succeeded() # optional -- condition for step to execute; defaults to succeeded() + continueOnError: false # optional -- determines whether to continue the build if the step errors; defaults to false + +steps: + - powershell: 'powershell "$env:BUILD_SOURCESDIRECTORY\eng\common\msbuild.ps1 $env:BUILD_SOURCESDIRECTORY\eng\common\helixpublish.proj /restore /p:TreatWarningsAsErrors=false /t:Test /bl:$env:BUILD_SOURCESDIRECTORY\artifacts\log\$env:BuildConfig\SendToHelix.binlog"' + displayName: ${{ parameters.DisplayNamePrefix }} (Windows) + env: + BuildConfig: $(_BuildConfig) + HelixSource: ${{ parameters.HelixSource }} + HelixType: ${{ parameters.HelixType }} + HelixBuild: ${{ parameters.HelixBuild }} + HelixConfiguration: ${{ parameters.HelixConfiguration }} + HelixTargetQueues: ${{ parameters.HelixTargetQueues }} + HelixAccessToken: ${{ parameters.HelixAccessToken }} + HelixPreCommands: ${{ parameters.HelixPreCommands }} + HelixPostCommands: ${{ parameters.HelixPostCommands }} + WorkItemDirectory: ${{ parameters.WorkItemDirectory }} + WorkItemCommand: ${{ parameters.WorkItemCommand }} + WorkItemTimeout: ${{ parameters.WorkItemTimeout }} + CorrelationPayloadDirectory: ${{ parameters.CorrelationPayloadDirectory }} + XUnitProjects: ${{ parameters.XUnitProjects }} + XUnitWorkItemTimeout: ${{ parameters.XUnitWorkItemTimeout }} + XUnitPublishTargetFramework: ${{ parameters.XUnitPublishTargetFramework }} + XUnitRuntimeTargetFramework: ${{ parameters.XUnitRuntimeTargetFramework }} + XUnitRunnerVersion: ${{ parameters.XUnitRunnerVersion }} + IncludeDotNetCli: ${{ parameters.IncludeDotNetCli }} + DotNetCliPackageType: ${{ parameters.DotNetCliPackageType }} + DotNetCliVersion: ${{ parameters.DotNetCliVersion }} + WaitForWorkItemCompletion: ${{ parameters.WaitForWorkItemCompletion }} + HelixBaseUri: ${{ parameters.HelixBaseUri }} + Creator: ${{ parameters.Creator }} + SYSTEM_ACCESSTOKEN: $(System.AccessToken) + condition: and(${{ parameters.condition }}, eq(variables['Agent.Os'], 'Windows_NT')) + continueOnError: ${{ parameters.continueOnError }} + - script: $BUILD_SOURCESDIRECTORY/eng/common/msbuild.sh $BUILD_SOURCESDIRECTORY/eng/common/helixpublish.proj /restore /p:TreatWarningsAsErrors=false /t:Test /bl:$BUILD_SOURCESDIRECTORY/artifacts/log/$BuildConfig/SendToHelix.binlog + displayName: ${{ parameters.DisplayNamePrefix }} (Unix) + env: + BuildConfig: $(_BuildConfig) + HelixSource: ${{ parameters.HelixSource }} + HelixType: ${{ parameters.HelixType }} + HelixBuild: ${{ parameters.HelixBuild }} + HelixConfiguration: ${{ parameters.HelixConfiguration }} + HelixTargetQueues: ${{ parameters.HelixTargetQueues }} + HelixAccessToken: ${{ parameters.HelixAccessToken }} + HelixPreCommands: ${{ parameters.HelixPreCommands }} + HelixPostCommands: ${{ parameters.HelixPostCommands }} + WorkItemDirectory: ${{ parameters.WorkItemDirectory }} + WorkItemCommand: ${{ parameters.WorkItemCommand }} + WorkItemTimeout: ${{ parameters.WorkItemTimeout }} + CorrelationPayloadDirectory: ${{ parameters.CorrelationPayloadDirectory }} + XUnitProjects: ${{ parameters.XUnitProjects }} + XUnitWorkItemTimeout: ${{ parameters.XUnitWorkItemTimeout }} + XUnitPublishTargetFramework: ${{ parameters.XUnitPublishTargetFramework }} + XUnitRuntimeTargetFramework: ${{ parameters.XUnitRuntimeTargetFramework }} + XUnitRunnerVersion: ${{ parameters.XUnitRunnerVersion }} + IncludeDotNetCli: ${{ parameters.IncludeDotNetCli }} + DotNetCliPackageType: ${{ parameters.DotNetCliPackageType }} + DotNetCliVersion: ${{ parameters.DotNetCliVersion }} + WaitForWorkItemCompletion: ${{ parameters.WaitForWorkItemCompletion }} + HelixBaseUri: ${{ parameters.HelixBaseUri }} + Creator: ${{ parameters.Creator }} + SYSTEM_ACCESSTOKEN: $(System.AccessToken) + condition: and(${{ parameters.condition }}, ne(variables['Agent.Os'], 'Windows_NT')) + continueOnError: ${{ parameters.continueOnError }} diff --git a/eng/common/templates-official/steps/source-build.yml b/eng/common/templates-official/steps/source-build.yml new file mode 100644 index 00000000000..829f17c34d1 --- /dev/null +++ b/eng/common/templates-official/steps/source-build.yml @@ -0,0 +1,129 @@ +parameters: + # This template adds arcade-powered source-build to CI. + + # This is a 'steps' template, and is intended for advanced scenarios where the existing build + # infra has a careful build methodology that must be followed. For example, a repo + # (dotnet/runtime) might choose to clone the GitHub repo only once and store it as a pipeline + # artifact for all subsequent jobs to use, to reduce dependence on a strong network connection to + # GitHub. Using this steps template leaves room for that infra to be included. + + # Defines the platform on which to run the steps. See 'eng/common/templates-official/job/source-build.yml' + # for details. The entire object is described in the 'job' template for simplicity, even though + # the usage of the properties on this object is split between the 'job' and 'steps' templates. + platform: {} + +steps: +# Build. Keep it self-contained for simple reusability. (No source-build-specific job variables.) +- script: | + set -x + df -h + + # If building on the internal project, the artifact feeds variable may be available (usually only if needed) + # In that case, call the feed setup script to add internal feeds corresponding to public ones. + # In addition, add an msbuild argument to copy the WIP from the repo to the target build location. + # This is because SetupNuGetSources.sh will alter the current NuGet.config file, and we need to preserve those + # changes. + internalRestoreArgs= + if [ '$(dn-bot-dnceng-artifact-feeds-rw)' != '$''(dn-bot-dnceng-artifact-feeds-rw)' ]; then + # Temporarily work around https://github.com/dotnet/arcade/issues/7709 + chmod +x $(Build.SourcesDirectory)/eng/common/SetupNugetSources.sh + $(Build.SourcesDirectory)/eng/common/SetupNugetSources.sh $(Build.SourcesDirectory)/NuGet.config $(dn-bot-dnceng-artifact-feeds-rw) + internalRestoreArgs='/p:CopyWipIntoInnerSourceBuildRepo=true' + + # The 'Copy WIP' feature of source build uses git stash to apply changes from the original repo. + # This only works if there is a username/email configured, which won't be the case in most CI runs. + git config --get user.email + if [ $? -ne 0 ]; then + git config user.email dn-bot@microsoft.com + git config user.name dn-bot + fi + fi + + # If building on the internal project, the internal storage variable may be available (usually only if needed) + # In that case, add variables to allow the download of internal runtimes if the specified versions are not found + # in the default public locations. + internalRuntimeDownloadArgs= + if [ '$(dotnetbuilds-internal-container-read-token-base64)' != '$''(dotnetbuilds-internal-container-read-token-base64)' ]; then + internalRuntimeDownloadArgs='/p:DotNetRuntimeSourceFeed=https://dotnetbuilds.blob.core.windows.net/internal /p:DotNetRuntimeSourceFeedKey=$(dotnetbuilds-internal-container-read-token-base64) --runtimesourcefeed https://dotnetbuilds.blob.core.windows.net/internal --runtimesourcefeedkey $(dotnetbuilds-internal-container-read-token-base64)' + fi + + buildConfig=Release + # Check if AzDO substitutes in a build config from a variable, and use it if so. + if [ '$(_BuildConfig)' != '$''(_BuildConfig)' ]; then + buildConfig='$(_BuildConfig)' + fi + + officialBuildArgs= + if [ '${{ and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}' = 'True' ]; then + officialBuildArgs='/p:DotNetPublishUsingPipelines=true /p:OfficialBuildId=$(BUILD.BUILDNUMBER)' + fi + + targetRidArgs= + if [ '${{ parameters.platform.targetRID }}' != '' ]; then + targetRidArgs='/p:TargetRid=${{ parameters.platform.targetRID }}' + fi + + runtimeOsArgs= + if [ '${{ parameters.platform.runtimeOS }}' != '' ]; then + runtimeOsArgs='/p:RuntimeOS=${{ parameters.platform.runtimeOS }}' + fi + + baseOsArgs= + if [ '${{ parameters.platform.baseOS }}' != '' ]; then + baseOsArgs='/p:BaseOS=${{ parameters.platform.baseOS }}' + fi + + publishArgs= + if [ '${{ parameters.platform.skipPublishValidation }}' != 'true' ]; then + publishArgs='--publish' + fi + + assetManifestFileName=SourceBuild_RidSpecific.xml + if [ '${{ parameters.platform.name }}' != '' ]; then + assetManifestFileName=SourceBuild_${{ parameters.platform.name }}.xml + fi + + ${{ coalesce(parameters.platform.buildScript, './build.sh') }} --ci \ + --configuration $buildConfig \ + --restore --build --pack $publishArgs -bl \ + $officialBuildArgs \ + $internalRuntimeDownloadArgs \ + $internalRestoreArgs \ + $targetRidArgs \ + $runtimeOsArgs \ + $baseOsArgs \ + /p:SourceBuildNonPortable=${{ parameters.platform.nonPortable }} \ + /p:ArcadeBuildFromSource=true \ + /p:AssetManifestFileName=$assetManifestFileName + displayName: Build + +# Upload build logs for diagnosis. +- task: CopyFiles@2 + displayName: Prepare BuildLogs staging directory + inputs: + SourceFolder: '$(Build.SourcesDirectory)' + Contents: | + **/*.log + **/*.binlog + artifacts/source-build/self/prebuilt-report/** + TargetFolder: '$(Build.StagingDirectory)/BuildLogs' + CleanTargetFolder: true + continueOnError: true + condition: succeededOrFailed() + +- task: 1ES.PublishPipelineArtifact@1 + displayName: Publish BuildLogs + inputs: + targetPath: '$(Build.StagingDirectory)/BuildLogs' + artifactName: BuildLogs_SourceBuild_${{ parameters.platform.name }}_Attempt$(System.JobAttempt) + continueOnError: true + condition: succeededOrFailed() + +# Manually inject component detection so that we can ignore the source build upstream cache, which contains +# a nupkg cache of input packages (a local feed). +# This path must match the upstream cache path in property 'CurrentRepoSourceBuiltNupkgCacheDir' +# in src\Microsoft.DotNet.Arcade.Sdk\tools\SourceBuild\SourceBuildArcade.targets +- task: ComponentGovernanceComponentDetection@0 + displayName: Component Detection (Exclude upstream cache) + inputs: + ignoreDirectories: '$(Build.SourcesDirectory)/artifacts/source-build/self/src/artifacts/obj/source-built-upstream-cache' diff --git a/eng/common/templates-official/variables/pool-providers.yml b/eng/common/templates-official/variables/pool-providers.yml new file mode 100644 index 00000000000..beab7d1bfba --- /dev/null +++ b/eng/common/templates-official/variables/pool-providers.yml @@ -0,0 +1,45 @@ +# Select a pool provider based off branch name. Anything with branch name containing 'release' must go into an -Svc pool, +# otherwise it should go into the "normal" pools. This separates out the queueing and billing of released branches. + +# Motivation: +# Once a given branch of a repository's output has been officially "shipped" once, it is then considered to be COGS +# (Cost of goods sold) and should be moved to a servicing pool provider. This allows both separation of queueing +# (allowing release builds and main PR builds to not intefere with each other) and billing (required for COGS. +# Additionally, the pool provider name itself may be subject to change when the .NET Core Engineering Services +# team needs to move resources around and create new and potentially differently-named pools. Using this template +# file from an Arcade-ified repo helps guard against both having to update one's release/* branches and renaming. + +# How to use: +# This yaml assumes your shipped product branches use the naming convention "release/..." (which many do). +# If we find alternate naming conventions in broad usage it can be added to the condition below. +# +# First, import the template in an arcade-ified repo to pick up the variables, e.g.: +# +# variables: +# - template: /eng/common/templates-official/variables/pool-providers.yml +# +# ... then anywhere specifying the pool provider use the runtime variables, +# $(DncEngInternalBuildPool) +# +# pool: +# name: $(DncEngInternalBuildPool) +# image: 1es-windows-2022-pt + +variables: + # Coalesce the target and source branches so we know when a PR targets a release branch + # If these variables are somehow missing, fall back to main (tends to have more capacity) + + # Any new -Svc alternative pools should have variables added here to allow for splitting work + + - name: DncEngInternalBuildPool + value: $[ + replace( + replace( + eq(contains(coalesce(variables['System.PullRequest.TargetBranch'], variables['Build.SourceBranch'], 'refs/heads/main'), 'release'), 'true'), + True, + 'NetCore1ESPool-Svc-Internal' + ), + False, + 'NetCore1ESPool-Internal' + ) + ] \ No newline at end of file diff --git a/eng/common/templates-official/variables/sdl-variables.yml b/eng/common/templates-official/variables/sdl-variables.yml new file mode 100644 index 00000000000..dbdd66d4a4b --- /dev/null +++ b/eng/common/templates-official/variables/sdl-variables.yml @@ -0,0 +1,7 @@ +variables: +# The Guardian version specified in 'eng/common/sdl/packages.config'. This value must be kept in +# sync with the packages.config file. +- name: DefaultGuardianVersion + value: 0.109.0 +- name: GuardianPackagesConfigFile + value: $(Build.SourcesDirectory)\eng\common\sdl\packages.config \ No newline at end of file diff --git a/global.json b/global.json index 1220281b3c7..aa1bd3708ee 100644 --- a/global.json +++ b/global.json @@ -16,7 +16,7 @@ "msbuild-sdks": { "Microsoft.Build.NoTargets": "3.7.0", "Microsoft.Build.Traversal": "3.2.0", - "Microsoft.DotNet.Arcade.Sdk": "8.0.0-beta.24123.1", - "Microsoft.DotNet.Helix.Sdk": "8.0.0-beta.24123.1" + "Microsoft.DotNet.Arcade.Sdk": "8.0.0-beta.24151.4", + "Microsoft.DotNet.Helix.Sdk": "8.0.0-beta.24151.4" } } From 52350a9c0d287ed62b08a89724cbebecf1074591 Mon Sep 17 00:00:00 2001 From: Nikita Balabaev Date: Tue, 5 Mar 2024 12:23:14 +0100 Subject: [PATCH 170/172] Fix Microsoft.Extensions.AuditReports output path (#4945) * Fix Microsoft.Extensions.AuditReports output path * fix golden reports * add tests and the README --- docs/list-of-diagnostics.md | 8 +- global.json | 4 +- .../ComplianceReportsGenerator.cs | 34 +- .../MetricsReportsGenerator.cs | 59 +- src/Generators/Shared/GeneratorUtilities.cs | 27 + .../README.md | 134 + .../Microsoft.Extensions.AuditReports.props | 1 + .../Microsoft.Extensions.AuditReports.targets | 9 - src/Shared/DiagnosticIds/DiagnosticIds.cs | 6 + .../Unit/GeneratorTests.cs | 133 +- .../MeterAttributedWithXmlDescriptions.json | 31 + ...ensionsAttributedWithXmlDescriptions.json} | 2 +- ...oft.Extensions.Telemetry.Abstractions.json | 885 ----- ...ringReports.Roslyn3.8.Unit.Tests.deps.json | 2870 ----------------- ...ts.Roslyn3.8.Unit.Tests.runtimeconfig.json | 12 - .../GoldenReports/xunit.runner.json | 4 - ...DimensionsAttributedWithXmlDescriptions.cs | 24 +- .../Unit/GeneratorTests.cs | 178 +- ...osoft.Gen.MetricsReports.Unit.Tests.csproj | 4 +- 19 files changed, 492 insertions(+), 3933 deletions(-) delete mode 100644 src/Packages/Microsoft.Extensions.AuditReports/buildTransitive/Microsoft.Extensions.AuditReports.targets create mode 100644 test/Generators/Microsoft.Gen.MetricsReports/GoldenReports/MeterAttributedWithXmlDescriptions.json rename test/Generators/Microsoft.Gen.MetricsReports/GoldenReports/{MeteringReport.json => MeterDimensionsAttributedWithXmlDescriptions.json} (94%) delete mode 100644 test/Generators/Microsoft.Gen.MetricsReports/GoldenReports/Microsoft.Extensions.Telemetry.Abstractions.json delete mode 100644 test/Generators/Microsoft.Gen.MetricsReports/GoldenReports/Microsoft.Gen.MeteringReports.Roslyn3.8.Unit.Tests.deps.json delete mode 100644 test/Generators/Microsoft.Gen.MetricsReports/GoldenReports/Microsoft.Gen.MeteringReports.Roslyn3.8.Unit.Tests.runtimeconfig.json delete mode 100644 test/Generators/Microsoft.Gen.MetricsReports/GoldenReports/xunit.runner.json diff --git a/docs/list-of-diagnostics.md b/docs/list-of-diagnostics.md index 47778c3774c..f540a808699 100644 --- a/docs/list-of-diagnostics.md +++ b/docs/list-of-diagnostics.md @@ -41,7 +41,6 @@ if desired. | `EXTEXP0016` | Hosting integration testing experiments | | `EXTEXP0017` | Contextual options experiments | - # LoggerMessage | Diagnostic ID | Description | @@ -108,3 +107,10 @@ if desired. | `METGEN017` | Gauge is not supported yet | | `METGEN018` | Xml comment was not parsed correctly | | `METGEN019` | A metric class has cycles in its type hierarchy | + +## AuditReports + +| Diagnostic ID | Description | +| :---------------- | :---------- | +| `AUDREPGEN000` | MetricsReports generator couldn't resolve output path for the report | +| `AUDREPGEN001` | ComplianceReports generator couldn't resolve output path for the report | diff --git a/global.json b/global.json index aa1bd3708ee..f3c2dcc2ed0 100644 --- a/global.json +++ b/global.json @@ -1,9 +1,9 @@ { "sdk": { - "version": "8.0.101" + "version": "8.0.200" }, "tools": { - "dotnet": "8.0.101", + "dotnet": "8.0.200", "runtimes": { "dotnet/x64": [ "6.0.22" diff --git a/src/Generators/Microsoft.Gen.ComplianceReports/ComplianceReportsGenerator.cs b/src/Generators/Microsoft.Gen.ComplianceReports/ComplianceReportsGenerator.cs index 63f63aeab2d..31cdb2441ae 100644 --- a/src/Generators/Microsoft.Gen.ComplianceReports/ComplianceReportsGenerator.cs +++ b/src/Generators/Microsoft.Gen.ComplianceReports/ComplianceReportsGenerator.cs @@ -1,9 +1,12 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. +using System.Globalization; using System.IO; +using System.Text; using Microsoft.CodeAnalysis; using Microsoft.Gen.Shared; +using Microsoft.Shared.DiagnosticIds; namespace Microsoft.Gen.ComplianceReports; @@ -18,8 +21,8 @@ public sealed class ComplianceReportsGenerator : ISourceGenerator private const string FallbackFileName = "ComplianceReport.json"; + private readonly string _fileName; private string? _directory; - private string _fileName; public ComplianceReportsGenerator() : this(null) @@ -55,7 +58,7 @@ public void Execute(GeneratorExecutionContext context) if (!GeneratorUtilities.ShouldGenerateReport(context, GenerateComplianceReportsMSBuildProperty)) { - // By default, compliance reports are only generated only during build time and not during design time to prevent the file being written on every keystroke in VS. + // By default, compliance reports are generated only during build time and not during design time to prevent the file being written on every keystroke in VS. return; } @@ -78,19 +81,30 @@ public void Execute(GeneratorExecutionContext context) context.CancellationToken.ThrowIfCancellationRequested(); - if (_directory == null) + var options = context.AnalyzerConfigOptions.GlobalOptions; + _directory ??= GeneratorUtilities.TryRetrieveOptionsValue(options, ComplianceReportOutputPathMSBuildProperty, out var reportOutputPath) + ? reportOutputPath! + : GeneratorUtilities.GetDefaultReportOutputPath(options); + + if (string.IsNullOrWhiteSpace(_directory)) { - _ = context.AnalyzerConfigOptions.GlobalOptions.TryGetValue(ComplianceReportOutputPathMSBuildProperty, out _directory); - if (string.IsNullOrWhiteSpace(_directory)) - { - // no valid output path - return; - } + // Report diagnostic: + var diagnostic = new DiagnosticDescriptor( + DiagnosticIds.AuditReports.AUDREPGEN001, + "ComplianceReports generator couldn't resolve output path for the report. It won't be generated.", + "Both and MSBuild properties are not set. The report won't be generated.", + nameof(DiagnosticIds.AuditReports), + DiagnosticSeverity.Info, + isEnabledByDefault: true, + helpLinkUri: string.Format(CultureInfo.InvariantCulture, DiagnosticIds.UrlFormat, DiagnosticIds.AuditReports.AUDREPGEN001)); + + context.ReportDiagnostic(Diagnostic.Create(diagnostic, location: null)); + return; } _ = Directory.CreateDirectory(_directory); // Write report as JSON file. - File.WriteAllText(Path.Combine(_directory, _fileName), report); + File.WriteAllText(Path.Combine(_directory, _fileName), report, Encoding.UTF8); } } diff --git a/src/Generators/Microsoft.Gen.MetricsReports/MetricsReportsGenerator.cs b/src/Generators/Microsoft.Gen.MetricsReports/MetricsReportsGenerator.cs index a093982abe1..6b67c6ecc8f 100644 --- a/src/Generators/Microsoft.Gen.MetricsReports/MetricsReportsGenerator.cs +++ b/src/Generators/Microsoft.Gen.MetricsReports/MetricsReportsGenerator.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. using System.Collections.Generic; +using System.Globalization; using System.IO; using System.Linq; using System.Text; @@ -9,6 +10,7 @@ using Microsoft.CodeAnalysis.Diagnostics; using Microsoft.Gen.Metrics.Model; using Microsoft.Gen.Shared; +using Microsoft.Shared.DiagnosticIds; namespace Microsoft.Gen.MetricsReports; @@ -18,13 +20,19 @@ public class MetricsReportsGenerator : ISourceGenerator private const string GenerateMetricDefinitionReport = "build_property.GenerateMetricsReport"; private const string RootNamespace = "build_property.rootnamespace"; private const string ReportOutputPath = "build_property.MetricsReportOutputPath"; - private const string CompilationOutputPath = "build_property.outputpath"; - private const string CurrentProjectPath = "build_property.projectdir"; private const string FileName = "MetricsReport.json"; - private string? _compilationOutputPath; - private string? _currentProjectPath; - private string? _reportOutputPath; + private readonly string _fileName; + + public MetricsReportsGenerator() + : this(FileName) + { + } + + internal MetricsReportsGenerator(string reportFileName) + { + _fileName = reportFileName; + } public void Initialize(GeneratorInitializationContext context) { @@ -35,8 +43,9 @@ public void Execute(GeneratorExecutionContext context) { context.CancellationToken.ThrowIfCancellationRequested(); - var receiver = context.SyntaxReceiver as ClassDeclarationSyntaxReceiver; - if (receiver == null || receiver.ClassDeclarations.Count == 0 || !GeneratorUtilities.ShouldGenerateReport(context, GenerateMetricDefinitionReport)) + if (context.SyntaxReceiver is not ClassDeclarationSyntaxReceiver receiver || + receiver.ClassDeclarations.Count == 0 || + !GeneratorUtilities.ShouldGenerateReport(context, GenerateMetricDefinitionReport)) { return; } @@ -52,13 +61,24 @@ public void Execute(GeneratorExecutionContext context) var options = context.AnalyzerConfigOptions.GlobalOptions; - var path = (_reportOutputPath != null || options.TryGetValue(ReportOutputPath, out _reportOutputPath)) - ? _reportOutputPath - : GetDefaultReportOutputPath(options); + var path = GeneratorUtilities.TryRetrieveOptionsValue(options, ReportOutputPath, out var reportOutputPath) + ? reportOutputPath! + : GeneratorUtilities.GetDefaultReportOutputPath(options); if (string.IsNullOrWhiteSpace(path)) { - // Report diagnostic. Tell that it is either missing or visibility to compiler. + // Report diagnostic: + var diagnostic = new DiagnosticDescriptor( + DiagnosticIds.AuditReports.AUDREPGEN000, + "MetricsReports generator couldn't resolve output path for the report. It won't be generated.", + "Both and MSBuild properties are not set. The report won't be generated.", + nameof(DiagnosticIds.AuditReports), + DiagnosticSeverity.Info, + isEnabledByDefault: true, + helpLinkUri: string.Format(CultureInfo.InvariantCulture, DiagnosticIds.UrlFormat, DiagnosticIds.AuditReports.AUDREPGEN000)); + + context.ReportDiagnostic(Diagnostic.Create(diagnostic, location: null)); + return; } @@ -68,7 +88,7 @@ public void Execute(GeneratorExecutionContext context) var reportedMetrics = MapToCommonModel(meteringClasses, rootNamespace); var report = emitter.GenerateReport(reportedMetrics, context.CancellationToken); - File.WriteAllText(Path.Combine(path, FileName), report, Encoding.UTF8); + File.WriteAllText(Path.Combine(path, _fileName), report, Encoding.UTF8); } private static ReportedMetricClass[] MapToCommonModel(IReadOnlyList meteringClasses, string? rootNamespace) @@ -89,19 +109,4 @@ private static ReportedMetricClass[] MapToCommonModel(IReadOnlyList return reportedMetrics.ToArray(); } - - private string GetDefaultReportOutputPath(AnalyzerConfigOptions options) - { - if (_currentProjectPath != null && _compilationOutputPath != null) - { - return _currentProjectPath + _compilationOutputPath; - } - - _ = options.TryGetValue(CompilationOutputPath, out _compilationOutputPath); - _ = options.TryGetValue(CurrentProjectPath, out _currentProjectPath); - - return string.IsNullOrWhiteSpace(_currentProjectPath) || string.IsNullOrWhiteSpace(_compilationOutputPath) - ? string.Empty - : _currentProjectPath + _compilationOutputPath; - } } diff --git a/src/Generators/Shared/GeneratorUtilities.cs b/src/Generators/Shared/GeneratorUtilities.cs index 46be18a59fb..23d00603311 100644 --- a/src/Generators/Shared/GeneratorUtilities.cs +++ b/src/Generators/Shared/GeneratorUtilities.cs @@ -4,11 +4,13 @@ using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; +using System.IO; using System.Linq; using System.Threading; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp; using Microsoft.CodeAnalysis.CSharp.Syntax; +using Microsoft.CodeAnalysis.Diagnostics; [assembly: System.Resources.NeutralResourcesLanguage("en-us")] @@ -21,6 +23,9 @@ namespace Microsoft.Gen.Shared; #endif internal static class GeneratorUtilities { + private const string CompilationOutputPath = "build_property.outputpath"; + private const string CurrentProjectPath = "build_property.projectdir"; + public static string GeneratedCodeAttribute { get; } = $"global::System.CodeDom.Compiler.GeneratedCodeAttribute(" + $"\"{typeof(GeneratorUtilities).Assembly.GetName().Name}\", " + $"\"{typeof(GeneratorUtilities).Assembly.GetName().Version}\")"; @@ -136,4 +141,26 @@ public static bool ShouldGenerateReport(GeneratorExecutionContext context, strin return string.Equals(generateFiles, bool.TrueString, StringComparison.OrdinalIgnoreCase); } + + public static bool TryRetrieveOptionsValue(AnalyzerConfigOptions options, string name, out string? value) + => options.TryGetValue(name, out value) && !string.IsNullOrWhiteSpace(value); + + public static string GetDefaultReportOutputPath(AnalyzerConfigOptions options) + { + if (!TryRetrieveOptionsValue(options, CompilationOutputPath, out var compilationOutputPath)) + { + return string.Empty; + } + + // If is absolute - return it right away: + if (Path.IsPathRooted(compilationOutputPath)) + { + return compilationOutputPath!; + } + + // Get and combine it with if the former isn't empty: + return TryRetrieveOptionsValue(options, CurrentProjectPath, out var currentProjectPath) + ? Path.Combine(currentProjectPath!, compilationOutputPath!) + : string.Empty; + } } diff --git a/src/Packages/Microsoft.Extensions.AuditReports/README.md b/src/Packages/Microsoft.Extensions.AuditReports/README.md index 8c044fea796..bd871cac8b5 100644 --- a/src/Packages/Microsoft.Extensions.AuditReports/README.md +++ b/src/Packages/Microsoft.Extensions.AuditReports/README.md @@ -18,6 +18,140 @@ Or directly in the C# project file: ``` +## Available reports + +The following reports are available in this package: + +- **Metrics**: Reports on the use of source-generated metric definitions in the code. +- **Compliance**: Reports on the use of privacy-sensitive data in the code, including source-generated logging methods. + +The table below shows various MSBuild properties that you can use to control the behavior of the reports generation: + +| Metrics report generator | Compliance report generator | Description | +| --- | --- | --- | +| `` | `` | Controls whether the report is generated. | +| `` | `` | The path to the directory where the report will be generated. | + +The file names of the reports are defined by the corresponding report generator. +The metrics report will be generated in a file named `MetricsReport.json`. +The compliance report will be generated in a file named `ComplianceReport.json`. + +For example, to generate a compliance report, you can add the following to your project file: + +```xml + + true + C:\AuditReports + +``` + +Both report generators follow the same strategy if you don't provide a value for the property with the output path (`ComplianceReportOutputPath` or `MetricsReportOutputPath`). +In that case, the report path will be determined via the following strategy: + +1. If the `$(OutputPath)` property is defined and it's an absolute path, the report will be generated in that directory. +2. If both `$(OutputPath)` and `$(ProjectDir)` properties are defined and the `$(OutputPath)` property contains a relative path, the report will be generated in the `$(ProjectDir)\$(OutputPath)` directory. + +If none of the above conditions are met, the report will not be generated and the diagnostic message will be emitted. + +## Example of a compliance report + +Let's assume we have a project with a class that contains privacy-sensitive data: + +```csharp +namespace ComplianceTesting +{ + internal sealed class User + { + internal User(string name, DateTimeOffset registeredAt) + { + Name = name; + RegisteredAt = registeredAt; + } + + [PrivateData] + public string Name { get; } + + public DateTimeOffset RegisteredAt { get; } + } +} +``` + +`Microsoft.Extensions.Compliance.Testing` package contains a definition for `[PrivateData]` attribute, we use it here for demonstration purposes only. + +A compliance report for the code listed above might look like this: + +```json +{ + "Name": "MyAssembly", + "Types": [ + { + "Name": "ComplianceTesting.User", + "Members": [ + { + "Name": "Name", + "Type": "string", + "File": "C:\\source\\samples\\src\\MyAssembly\\User.cs", + "Line": "12", + "Classifications": [ + { + "Name": "PrivateData" + } + ] + } + ] + } + ] +} +``` + +## Example of a metrics report + +Let's assume we have a project with a class that contains a source-generated metric definition: + +```csharp +internal sealed partial class Metric +{ + internal static class Tags + { + /// + /// The target of the metric, e.g. the name of the service or the name of the method. + /// + public const string Target = nameof(Target); + + /// + /// The reason for the failure, e.g. the exception message or the HTTP status code. + /// + public const string FailureReason = nameof(FailureReason); + } + + /// + /// The counter metric for the number of failed requests. + /// + [Counter(Tags.Target, Tags.FailureReason)] + public static partial FailedRequestCounter CreateFailedRequestCounter(Meter meter); +} +``` + +A metrics report for the code listed above might look like this: + +```json +[ + { + "MyAssembly": + [ + { + "MetricName": "FailedRequestCounter", + "MetricDescription": "The counter metric for the number of failed requests.", + "InstrumentName": "Counter", + "Dimensions": { + "Target": "The target of the metric, e.g. the name of the service or the name of the method.", + "FailureReason": "The reason for the failure, e.g. the exception message or the HTTP status code." + } + } + ] + } +] +``` ## Feedback & Contributing diff --git a/src/Packages/Microsoft.Extensions.AuditReports/buildTransitive/Microsoft.Extensions.AuditReports.props b/src/Packages/Microsoft.Extensions.AuditReports/buildTransitive/Microsoft.Extensions.AuditReports.props index 2a7fd855217..978d52a35ea 100644 --- a/src/Packages/Microsoft.Extensions.AuditReports/buildTransitive/Microsoft.Extensions.AuditReports.props +++ b/src/Packages/Microsoft.Extensions.AuditReports/buildTransitive/Microsoft.Extensions.AuditReports.props @@ -14,5 +14,6 @@ + diff --git a/src/Packages/Microsoft.Extensions.AuditReports/buildTransitive/Microsoft.Extensions.AuditReports.targets b/src/Packages/Microsoft.Extensions.AuditReports/buildTransitive/Microsoft.Extensions.AuditReports.targets deleted file mode 100644 index e17bcc0e734..00000000000 --- a/src/Packages/Microsoft.Extensions.AuditReports/buildTransitive/Microsoft.Extensions.AuditReports.targets +++ /dev/null @@ -1,9 +0,0 @@ - - - $(OutputPath) - - - - $(OutputPath) - - diff --git a/src/Shared/DiagnosticIds/DiagnosticIds.cs b/src/Shared/DiagnosticIds/DiagnosticIds.cs index da7d80a43aa..343093e6f44 100644 --- a/src/Shared/DiagnosticIds/DiagnosticIds.cs +++ b/src/Shared/DiagnosticIds/DiagnosticIds.cs @@ -111,6 +111,12 @@ internal static class Metrics internal const string METGEN018 = nameof(METGEN018); internal const string METGEN019 = nameof(METGEN019); } + + internal static class AuditReports + { + internal const string AUDREPGEN000 = nameof(AUDREPGEN000); + internal const string AUDREPGEN001 = nameof(AUDREPGEN001); + } } #pragma warning restore S1144 diff --git a/test/Generators/Microsoft.Gen.ComplianceReports/Unit/GeneratorTests.cs b/test/Generators/Microsoft.Gen.ComplianceReports/Unit/GeneratorTests.cs index ec64e24d623..0959430a641 100644 --- a/test/Generators/Microsoft.Gen.ComplianceReports/Unit/GeneratorTests.cs +++ b/test/Generators/Microsoft.Gen.ComplianceReports/Unit/GeneratorTests.cs @@ -1,8 +1,10 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. +using System; using System.Collections.Generic; using System.IO; +using System.Linq; using System.Reflection; using System.Threading.Tasks; using Microsoft.CodeAnalysis; @@ -47,9 +49,14 @@ public GeneratorTests(ITestOutputHelper output) _output = output; } - [Fact] - public async Task TestAll() + [Theory] + [CombinatorialData] + public async Task TestAll(bool useExplicitReportPath) { + Dictionary? options = useExplicitReportPath + ? new() { ["build_property.ComplianceReportOutputPath"] = Directory.GetCurrentDirectory() } + : null; + foreach (var inputFile in Directory.GetFiles("TestClasses")) { var stem = Path.GetFileNameWithoutExtension(inputFile); @@ -58,7 +65,7 @@ public async Task TestAll() if (File.Exists(goldenReportFile)) { var tmp = Path.GetTempFileName(); - var d = await RunGenerator(File.ReadAllText(inputFile), tmp); + var d = await RunGenerator(File.ReadAllText(inputFile), tmp, options); Assert.Empty(d); var golden = File.ReadAllText(goldenReportFile); @@ -66,7 +73,7 @@ public async Task TestAll() if (golden != generated) { - _output.WriteLine($"MISMATCH: goldenReportFile {goldenReportFile}, tmp {tmp}"); + _output.WriteLine($"MISMATCH: golden report {goldenReportFile}, generated {tmp}"); _output.WriteLine("----"); _output.WriteLine("golden:"); _output.WriteLine(golden); @@ -76,36 +83,16 @@ public async Task TestAll() _output.WriteLine("----"); } - Assert.Equal(golden, generated); File.Delete(tmp); + Assert.Equal(golden, generated); } else { // generate the golden file if it doesn't already exist _output.WriteLine($"Generating golden report: {goldenReportFile}"); - _ = await RunGenerator(File.ReadAllText(inputFile), goldenReportFile); + _ = await RunGenerator(File.ReadAllText(inputFile), goldenReportFile, options); } } - - static async Task> RunGenerator(string code, string outputFile) - { - var (d, _) = await RoslynTestUtils.RunGenerator( - new ComplianceReportsGenerator(outputFile), - new[] - { - Assembly.GetAssembly(typeof(ILogger))!, - Assembly.GetAssembly(typeof(LoggerMessageAttribute))!, - Assembly.GetAssembly(typeof(Microsoft.Extensions.Compliance.Classification.DataClassification))!, - }, - new[] - { - code, - TestTaxonomy, - }, - new OptionsProvider()).ConfigureAwait(false); - - return d; - } } [Fact] @@ -120,29 +107,99 @@ public async Task MissingDataClassificationSymbol() { Source, }, - new OptionsProvider()).ConfigureAwait(false); + new OptionsProvider(null)) + .ConfigureAwait(false); - Assert.Equal(0, d.Count); + Assert.Empty(d); } - private sealed class Options : AnalyzerConfigOptions + [Theory] + [CombinatorialData] + public async Task Should_EmitWarning_WhenPathUnavailable(bool isReportPathProvided) { - public override bool TryGetValue(string key, out string value) + var inputFile = Directory.GetFiles("TestClasses").First(); + var options = new Dictionary + { + ["build_property.outputpath"] = string.Empty + }; + + if (isReportPathProvided) + { + options.Add("build_property.ComplianceReportOutputPath", string.Empty); + } + + var diags = await RunGenerator(await File.ReadAllTextAsync(inputFile), options: options); + var diag = Assert.Single(diags); + Assert.Equal("AUDREPGEN001", diag.Id); + Assert.Equal(DiagnosticSeverity.Info, diag.Severity); + } + + [Fact] + public async Task Should_UseProjectDir_WhenOutputPathIsRelative() + { + var projectDir = Path.GetTempPath(); + var outputPath = Guid.NewGuid().ToString(); + var fullReportPath = Path.Combine(projectDir, outputPath); + Directory.CreateDirectory(fullReportPath); + + try { - if (key == "build_property.GenerateComplianceReport") + var inputFile = Directory.GetFiles("TestClasses").First(); + var options = new Dictionary { - value = bool.TrueString; - return true; - } + ["build_property.projectdir"] = projectDir, + ["build_property.outputpath"] = outputPath + }; - value = null!; - return false; + var diags = await RunGenerator(await File.ReadAllTextAsync(inputFile), options: options); + Assert.Empty(diags); + Assert.True(File.Exists(Path.Combine(fullReportPath, "ComplianceReport.json"))); } + finally + { + Directory.Delete(fullReportPath, recursive: true); + } + } + + private static async Task> RunGenerator(string code, string? outputFile = null, Dictionary? options = null) + { + var (d, _) = await RoslynTestUtils.RunGenerator( + new ComplianceReportsGenerator(outputFile), + new[] + { + Assembly.GetAssembly(typeof(ILogger))!, + Assembly.GetAssembly(typeof(LoggerMessageAttribute))!, + Assembly.GetAssembly(typeof(Extensions.Compliance.Classification.DataClassification))!, + }, + new[] + { + code, + TestTaxonomy, + }, + new OptionsProvider(analyzerOptions: options)).ConfigureAwait(false); + + return d; } - private sealed class OptionsProvider : AnalyzerConfigOptionsProvider + private sealed class Options : AnalyzerConfigOptions { - public override AnalyzerConfigOptions GlobalOptions => new Options(); + private readonly Dictionary _options; + + public Options(Dictionary? analyzerOptions) + { + _options = analyzerOptions ?? []; + _options.TryAdd("build_property.GenerateComplianceReport", bool.TrueString); + _options.TryAdd("build_property.outputpath", Directory.GetCurrentDirectory()); + } + + public override bool TryGetValue(string key, out string value) + => _options.TryGetValue(key, out value!); + } + + private sealed class OptionsProvider(Dictionary? analyzerOptions) : AnalyzerConfigOptionsProvider + { + public override AnalyzerConfigOptions GlobalOptions => new Options(analyzerOptions); + public override AnalyzerConfigOptions GetOptions(SyntaxTree tree) => throw new System.NotSupportedException(); public override AnalyzerConfigOptions GetOptions(AdditionalText textFile) => throw new System.NotSupportedException(); } diff --git a/test/Generators/Microsoft.Gen.MetricsReports/GoldenReports/MeterAttributedWithXmlDescriptions.json b/test/Generators/Microsoft.Gen.MetricsReports/GoldenReports/MeterAttributedWithXmlDescriptions.json new file mode 100644 index 00000000000..fc05721109c --- /dev/null +++ b/test/Generators/Microsoft.Gen.MetricsReports/GoldenReports/MeterAttributedWithXmlDescriptions.json @@ -0,0 +1,31 @@ +[ + { + "TestClasses": + [ + { + "MetricName": "CounterWithDescription", + "MetricDescription": "CounterWithDescription description.", + "InstrumentName": "Counter" + }, + { + "MetricName": "HistogramWithDescription", + "MetricDescription": "HistogramWithDescription description.", + "InstrumentName": "Histogram" + }, + { + "MetricName": "HistogramWithWrongDescription", + "MetricDescription": "(Missing Summary)", + "InstrumentName": "Histogram" + }, + { + "MetricName": "ConstDescribedCounter", + "MetricDescription": "CreateConstDescribedCounter description.", + "InstrumentName": "Counter", + "Dimensions": { + "Dim4": "Dim4 description.", + "InClassDim": "InClassDim description." + } + } + ] + } +] \ No newline at end of file diff --git a/test/Generators/Microsoft.Gen.MetricsReports/GoldenReports/MeteringReport.json b/test/Generators/Microsoft.Gen.MetricsReports/GoldenReports/MeterDimensionsAttributedWithXmlDescriptions.json similarity index 94% rename from test/Generators/Microsoft.Gen.MetricsReports/GoldenReports/MeteringReport.json rename to test/Generators/Microsoft.Gen.MetricsReports/GoldenReports/MeterDimensionsAttributedWithXmlDescriptions.json index 540dd9cabcc..aec09194f8a 100644 --- a/test/Generators/Microsoft.Gen.MetricsReports/GoldenReports/MeteringReport.json +++ b/test/Generators/Microsoft.Gen.MetricsReports/GoldenReports/MeterDimensionsAttributedWithXmlDescriptions.json @@ -17,7 +17,7 @@ "InstrumentName": "Histogram", "Dimensions": { "Dimension2": "Dimension2 description.", - "DimenisonDefinedInMetricClass": "DimenisonDefinedInMetricClass description." + "DimensionDefinedInMetricClass": "DimensionDefinedInMetricClass description." } }, { diff --git a/test/Generators/Microsoft.Gen.MetricsReports/GoldenReports/Microsoft.Extensions.Telemetry.Abstractions.json b/test/Generators/Microsoft.Gen.MetricsReports/GoldenReports/Microsoft.Extensions.Telemetry.Abstractions.json deleted file mode 100644 index 046247fa87e..00000000000 --- a/test/Generators/Microsoft.Gen.MetricsReports/GoldenReports/Microsoft.Extensions.Telemetry.Abstractions.json +++ /dev/null @@ -1,885 +0,0 @@ -{ - "Name": "Microsoft.Extensions.Telemetry.Abstractions, Version=8.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35", - "Types": [ - { - "Type": "readonly struct Microsoft.Extensions.Diagnostics.Latency.Checkpoint : System.IEquatable", - "Stage": "Stable", - "Methods": [ - { - "Member": "Microsoft.Extensions.Diagnostics.Latency.Checkpoint.Checkpoint(string name, long elapsed, long frequency);", - "Stage": "Stable" - }, - { - "Member": "Microsoft.Extensions.Diagnostics.Latency.Checkpoint.Checkpoint();", - "Stage": "Stable" - }, - { - "Member": "override bool Microsoft.Extensions.Diagnostics.Latency.Checkpoint.Equals(object? obj);", - "Stage": "Stable" - }, - { - "Member": "bool Microsoft.Extensions.Diagnostics.Latency.Checkpoint.Equals(Microsoft.Extensions.Diagnostics.Latency.Checkpoint other);", - "Stage": "Stable" - }, - { - "Member": "override int Microsoft.Extensions.Diagnostics.Latency.Checkpoint.GetHashCode();", - "Stage": "Stable" - }, - { - "Member": "static bool Microsoft.Extensions.Diagnostics.Latency.Checkpoint.operator ==(Microsoft.Extensions.Diagnostics.Latency.Checkpoint left, Microsoft.Extensions.Diagnostics.Latency.Checkpoint right);", - "Stage": "Stable" - }, - { - "Member": "static bool Microsoft.Extensions.Diagnostics.Latency.Checkpoint.operator !=(Microsoft.Extensions.Diagnostics.Latency.Checkpoint left, Microsoft.Extensions.Diagnostics.Latency.Checkpoint right);", - "Stage": "Stable" - } - ], - "Properties": [ - { - "Member": "long Microsoft.Extensions.Diagnostics.Latency.Checkpoint.Elapsed { get; }", - "Stage": "Stable" - }, - { - "Member": "long Microsoft.Extensions.Diagnostics.Latency.Checkpoint.Frequency { get; }", - "Stage": "Stable" - }, - { - "Member": "string Microsoft.Extensions.Diagnostics.Latency.Checkpoint.Name { get; }", - "Stage": "Stable" - } - ] - }, - { - "Type": "readonly struct Microsoft.Extensions.Diagnostics.Latency.CheckpointToken", - "Stage": "Stable", - "Methods": [ - { - "Member": "Microsoft.Extensions.Diagnostics.Latency.CheckpointToken.CheckpointToken(string name, int position);", - "Stage": "Stable" - }, - { - "Member": "Microsoft.Extensions.Diagnostics.Latency.CheckpointToken.CheckpointToken();", - "Stage": "Stable" - } - ], - "Properties": [ - { - "Member": "string Microsoft.Extensions.Diagnostics.Latency.CheckpointToken.Name { get; }", - "Stage": "Stable" - }, - { - "Member": "int Microsoft.Extensions.Diagnostics.Latency.CheckpointToken.Position { get; }", - "Stage": "Stable" - } - ] - }, - { - "Type": "sealed class Microsoft.Extensions.Telemetry.Metering.CounterAttribute : System.Attribute", - "Stage": "Stable", - "Methods": [ - { - "Member": "Microsoft.Extensions.Telemetry.Metering.CounterAttribute.CounterAttribute(params string[] dimensions);", - "Stage": "Stable" - }, - { - "Member": "Microsoft.Extensions.Telemetry.Metering.CounterAttribute.CounterAttribute(System.Type type);", - "Stage": "Stable" - } - ], - "Properties": [ - { - "Member": "string[]? Microsoft.Extensions.Telemetry.Metering.CounterAttribute.Dimensions { get; }", - "Stage": "Stable" - }, - { - "Member": "string? Microsoft.Extensions.Telemetry.Metering.CounterAttribute.Name { get; set; }", - "Stage": "Stable" - }, - { - "Member": "System.Type? Microsoft.Extensions.Telemetry.Metering.CounterAttribute.Type { get; }", - "Stage": "Stable" - } - ] - }, - { - "Type": "sealed class Microsoft.Extensions.Telemetry.Metering.CounterAttribute : System.Attribute where T : struct", - "Stage": "Stable", - "Methods": [ - { - "Member": "Microsoft.Extensions.Telemetry.Metering.CounterAttribute.CounterAttribute(params string[] dimensions);", - "Stage": "Stable" - }, - { - "Member": "Microsoft.Extensions.Telemetry.Metering.CounterAttribute.CounterAttribute(System.Type type);", - "Stage": "Stable" - } - ], - "Properties": [ - { - "Member": "string[]? Microsoft.Extensions.Telemetry.Metering.CounterAttribute.Dimensions { get; }", - "Stage": "Stable" - }, - { - "Member": "string? Microsoft.Extensions.Telemetry.Metering.CounterAttribute.Name { get; set; }", - "Stage": "Stable" - }, - { - "Member": "System.Type? Microsoft.Extensions.Telemetry.Metering.CounterAttribute.Type { get; }", - "Stage": "Stable" - } - ] - }, - { - "Type": "sealed class Microsoft.Extensions.Telemetry.Metering.DimensionAttribute : System.Attribute", - "Stage": "Stable", - "Methods": [ - { - "Member": "Microsoft.Extensions.Telemetry.Metering.DimensionAttribute.DimensionAttribute(string name);", - "Stage": "Stable" - } - ], - "Properties": [ - { - "Member": "string Microsoft.Extensions.Telemetry.Metering.DimensionAttribute.Name { get; }", - "Stage": "Stable" - } - ] - }, - { - "Type": "static class Microsoft.Extensions.Diagnostics.Enrichment.EnricherExtensions", - "Stage": "Stable", - "Methods": [ - { - "Member": "static Microsoft.Extensions.DependencyInjection.IServiceCollection Microsoft.Extensions.Diagnostics.Enrichment.EnricherExtensions.AddLogEnricher(this Microsoft.Extensions.DependencyInjection.IServiceCollection services);", - "Stage": "Stable" - }, - { - "Member": "static Microsoft.Extensions.DependencyInjection.IServiceCollection Microsoft.Extensions.Diagnostics.Enrichment.EnricherExtensions.AddLogEnricher(this Microsoft.Extensions.DependencyInjection.IServiceCollection services, Microsoft.Extensions.Diagnostics.Enrichment.ILogEnricher enricher);", - "Stage": "Stable" - }, - { - "Member": "static Microsoft.Extensions.DependencyInjection.IServiceCollection Microsoft.Extensions.Diagnostics.Enrichment.EnricherExtensions.AddMetricEnricher(this Microsoft.Extensions.DependencyInjection.IServiceCollection services);", - "Stage": "Stable" - }, - { - "Member": "static Microsoft.Extensions.DependencyInjection.IServiceCollection Microsoft.Extensions.Diagnostics.Enrichment.EnricherExtensions.AddMetricEnricher(this Microsoft.Extensions.DependencyInjection.IServiceCollection services, Microsoft.Extensions.Diagnostics.Enrichment.IMetricEnricher enricher);", - "Stage": "Stable" - } - ] - }, - { - "Type": "sealed class Microsoft.Extensions.Telemetry.Metering.GaugeAttribute : System.Attribute", - "Stage": "Stable", - "Methods": [ - { - "Member": "Microsoft.Extensions.Telemetry.Metering.GaugeAttribute.GaugeAttribute(params string[] dimensions);", - "Stage": "Stable" - }, - { - "Member": "Microsoft.Extensions.Telemetry.Metering.GaugeAttribute.GaugeAttribute(System.Type type);", - "Stage": "Stable" - } - ], - "Properties": [ - { - "Member": "string[]? Microsoft.Extensions.Telemetry.Metering.GaugeAttribute.Dimensions { get; }", - "Stage": "Stable" - }, - { - "Member": "string? Microsoft.Extensions.Telemetry.Metering.GaugeAttribute.Name { get; set; }", - "Stage": "Stable" - }, - { - "Member": "System.Type? Microsoft.Extensions.Telemetry.Metering.GaugeAttribute.Type { get; }", - "Stage": "Stable" - } - ] - }, - { - "Type": "sealed class Microsoft.Extensions.Telemetry.Metering.HistogramAttribute : System.Attribute", - "Stage": "Stable", - "Methods": [ - { - "Member": "Microsoft.Extensions.Telemetry.Metering.HistogramAttribute.HistogramAttribute(params string[] dimensions);", - "Stage": "Stable" - }, - { - "Member": "Microsoft.Extensions.Telemetry.Metering.HistogramAttribute.HistogramAttribute(System.Type type);", - "Stage": "Stable" - } - ], - "Properties": [ - { - "Member": "string[]? Microsoft.Extensions.Telemetry.Metering.HistogramAttribute.Dimensions { get; }", - "Stage": "Stable" - }, - { - "Member": "string? Microsoft.Extensions.Telemetry.Metering.HistogramAttribute.Name { get; set; }", - "Stage": "Stable" - }, - { - "Member": "System.Type? Microsoft.Extensions.Telemetry.Metering.HistogramAttribute.Type { get; }", - "Stage": "Stable" - } - ] - }, - { - "Type": "sealed class Microsoft.Extensions.Telemetry.Metering.HistogramAttribute : System.Attribute where T : struct", - "Stage": "Experimental", - "Methods": [ - { - "Member": "Microsoft.Extensions.Telemetry.Metering.HistogramAttribute.HistogramAttribute(params string[] dimensions);", - "Stage": "Experimental" - }, - { - "Member": "Microsoft.Extensions.Telemetry.Metering.HistogramAttribute.HistogramAttribute(System.Type type);", - "Stage": "Experimental" - } - ], - "Properties": [ - { - "Member": "string[]? Microsoft.Extensions.Telemetry.Metering.HistogramAttribute.Dimensions { get; }", - "Stage": "Experimental" - }, - { - "Member": "string? Microsoft.Extensions.Telemetry.Metering.HistogramAttribute.Name { get; set; }", - "Stage": "Experimental" - }, - { - "Member": "System.Type? Microsoft.Extensions.Telemetry.Metering.HistogramAttribute.Type { get; }", - "Stage": "Experimental" - } - ] - }, - { - "Type": "enum Microsoft.Extensions.Http.Diagnostics.HttpRouteParameterRedactionMode", - "Stage": "Stable", - "Methods": [ - { - "Member": "Microsoft.Extensions.Http.Diagnostics.HttpRouteParameterRedactionMode.HttpRouteParameterRedactionMode();", - "Stage": "Stable" - } - ], - "Fields": [ - { - "Member": "const Microsoft.Extensions.Http.Diagnostics.HttpRouteParameterRedactionMode Microsoft.Extensions.Http.Diagnostics.HttpRouteParameterRedactionMode.Loose", - "Stage": "Stable", - "Value": "1" - }, - { - "Member": "const Microsoft.Extensions.Http.Diagnostics.HttpRouteParameterRedactionMode Microsoft.Extensions.Http.Diagnostics.HttpRouteParameterRedactionMode.None", - "Stage": "Stable", - "Value": "2" - }, - { - "Member": "const Microsoft.Extensions.Http.Diagnostics.HttpRouteParameterRedactionMode Microsoft.Extensions.Http.Diagnostics.HttpRouteParameterRedactionMode.Strict", - "Stage": "Stable", - "Value": "0" - } - ] - }, - { - "Type": "interface Microsoft.Extensions.Http.Diagnostics.IDownstreamDependencyMetadata", - "Stage": "Stable", - "Properties": [ - { - "Member": "string Microsoft.Extensions.Http.Diagnostics.IDownstreamDependencyMetadata.DependencyName { get; }", - "Stage": "Stable" - }, - { - "Member": "System.Collections.Generic.ISet Microsoft.Extensions.Http.Diagnostics.IDownstreamDependencyMetadata.RequestMetadata { get; }", - "Stage": "Stable" - }, - { - "Member": "System.Collections.Generic.ISet Microsoft.Extensions.Http.Diagnostics.IDownstreamDependencyMetadata.UniqueHostNameSuffixes { get; }", - "Stage": "Stable" - } - ] - }, - { - "Type": "interface Microsoft.Extensions.Diagnostics.Enrichment.IEnrichmentPropertyBag", - "Stage": "Stable", - "Methods": [ - { - "Member": "void Microsoft.Extensions.Diagnostics.Enrichment.IEnrichmentPropertyBag.Add(string key, object value);", - "Stage": "Stable" - }, - { - "Member": "void Microsoft.Extensions.Diagnostics.Enrichment.IEnrichmentPropertyBag.Add(string key, string value);", - "Stage": "Stable" - }, - { - "Member": "void Microsoft.Extensions.Diagnostics.Enrichment.IEnrichmentPropertyBag.Add(System.ReadOnlySpan> properties);", - "Stage": "Stable" - }, - { - "Member": "void Microsoft.Extensions.Diagnostics.Enrichment.IEnrichmentPropertyBag.Add(System.ReadOnlySpan> properties);", - "Stage": "Stable" - } - ] - }, - { - "Type": "interface Microsoft.Extensions.Diagnostics.Latency.ILatencyContext : System.IDisposable", - "Stage": "Stable", - "Methods": [ - { - "Member": "void Microsoft.Extensions.Diagnostics.Latency.ILatencyContext.AddCheckpoint(Microsoft.Extensions.Diagnostics.Latency.CheckpointToken token);", - "Stage": "Stable" - }, - { - "Member": "void Microsoft.Extensions.Diagnostics.Latency.ILatencyContext.AddMeasure(Microsoft.Extensions.Diagnostics.Latency.MeasureToken token, long value);", - "Stage": "Stable" - }, - { - "Member": "void Microsoft.Extensions.Diagnostics.Latency.ILatencyContext.Freeze();", - "Stage": "Stable" - }, - { - "Member": "void Microsoft.Extensions.Diagnostics.Latency.ILatencyContext.RecordMeasure(Microsoft.Extensions.Diagnostics.Latency.MeasureToken token, long value);", - "Stage": "Stable" - }, - { - "Member": "void Microsoft.Extensions.Diagnostics.Latency.ILatencyContext.SetTag(Microsoft.Extensions.Diagnostics.Latency.TagToken token, string value);", - "Stage": "Stable" - } - ], - "Properties": [ - { - "Member": "Microsoft.Extensions.Diagnostics.Latency.LatencyData Microsoft.Extensions.Diagnostics.Latency.ILatencyContext.LatencyData { get; }", - "Stage": "Stable" - } - ] - }, - { - "Type": "interface Microsoft.Extensions.Diagnostics.Latency.ILatencyContextProvider", - "Stage": "Stable", - "Methods": [ - { - "Member": "Microsoft.Extensions.Diagnostics.Latency.ILatencyContext Microsoft.Extensions.Diagnostics.Latency.ILatencyContextProvider.CreateContext();", - "Stage": "Stable" - } - ] - }, - { - "Type": "interface Microsoft.Extensions.Diagnostics.Latency.ILatencyContextTokenIssuer", - "Stage": "Stable", - "Methods": [ - { - "Member": "Microsoft.Extensions.Diagnostics.Latency.CheckpointToken Microsoft.Extensions.Diagnostics.Latency.ILatencyContextTokenIssuer.GetCheckpointToken(string name);", - "Stage": "Stable" - }, - { - "Member": "Microsoft.Extensions.Diagnostics.Latency.MeasureToken Microsoft.Extensions.Diagnostics.Latency.ILatencyContextTokenIssuer.GetMeasureToken(string name);", - "Stage": "Stable" - }, - { - "Member": "Microsoft.Extensions.Diagnostics.Latency.TagToken Microsoft.Extensions.Diagnostics.Latency.ILatencyContextTokenIssuer.GetTagToken(string name);", - "Stage": "Stable" - } - ] - }, - { - "Type": "interface Microsoft.Extensions.Diagnostics.Latency.ILatencyDataExporter", - "Stage": "Stable", - "Methods": [ - { - "Member": "System.Threading.Tasks.Task Microsoft.Extensions.Diagnostics.Latency.ILatencyDataExporter.ExportAsync(Microsoft.Extensions.Diagnostics.Latency.LatencyData data, System.Threading.CancellationToken cancellationToken);", - "Stage": "Stable" - } - ] - }, - { - "Type": "interface Microsoft.Extensions.Diagnostics.Enrichment.ILogEnricher", - "Stage": "Stable", - "Methods": [ - { - "Member": "void Microsoft.Extensions.Diagnostics.Enrichment.ILogEnricher.Enrich(Microsoft.Extensions.Diagnostics.Enrichment.IEnrichmentPropertyBag bag);", - "Stage": "Stable" - } - ] - }, - { - "Type": "interface Microsoft.Extensions.Logging.ITagCollector", - "Stage": "Stable", - "Methods": [ - { - "Member": "void Microsoft.Extensions.Logging.ITagCollector.Add(string propertyName, object? propertyValue);", - "Stage": "Stable" - } - ] - }, - { - "Type": "interface Microsoft.Extensions.Diagnostics.Enrichment.IMetricEnricher", - "Stage": "Stable", - "Methods": [ - { - "Member": "void Microsoft.Extensions.Diagnostics.Enrichment.IMetricEnricher.Enrich(Microsoft.Extensions.Diagnostics.Enrichment.IEnrichmentPropertyBag bag);", - "Stage": "Stable" - } - ] - }, - { - "Type": "interface Microsoft.Extensions.Http.Diagnostics.IOutgoingRequestContext", - "Stage": "Stable", - "Methods": [ - { - "Member": "void Microsoft.Extensions.Http.Diagnostics.IOutgoingRequestContext.SetRequestMetadata(Microsoft.Extensions.Http.Diagnostics.RequestMetadata metadata);", - "Stage": "Stable" - } - ], - "Properties": [ - { - "Member": "Microsoft.Extensions.Http.Diagnostics.RequestMetadata? Microsoft.Extensions.Http.Diagnostics.IOutgoingRequestContext.RequestMetadata { get; }", - "Stage": "Stable" - } - ] - }, - { - "Type": "interface Microsoft.Extensions.Diagnostics.Enrichment.ITraceEnricher", - "Stage": "Stable", - "Methods": [ - { - "Member": "void Microsoft.Extensions.Diagnostics.Enrichment.ITraceEnricher.Enrich(System.Diagnostics.Activity activity);", - "Stage": "Stable" - }, - { - "Member": "void Microsoft.Extensions.Diagnostics.Enrichment.ITraceEnricher.EnrichOnActivityStart(System.Diagnostics.Activity activity);", - "Stage": "Stable" - } - ] - }, - { - "Type": "class Microsoft.Extensions.Diagnostics.Latency.LatencyContextRegistrationOptions", - "Stage": "Stable", - "Methods": [ - { - "Member": "Microsoft.Extensions.Diagnostics.Latency.LatencyContextRegistrationOptions.LatencyContextRegistrationOptions();", - "Stage": "Stable" - } - ], - "Properties": [ - { - "Member": "System.Collections.Generic.IReadOnlyList Microsoft.Extensions.Diagnostics.Latency.LatencyContextRegistrationOptions.CheckpointNames { get; set; }", - "Stage": "Stable" - }, - { - "Member": "System.Collections.Generic.IReadOnlyList Microsoft.Extensions.Diagnostics.Latency.LatencyContextRegistrationOptions.MeasureNames { get; set; }", - "Stage": "Stable" - }, - { - "Member": "System.Collections.Generic.IReadOnlyList Microsoft.Extensions.Diagnostics.Latency.LatencyContextRegistrationOptions.TagNames { get; set; }", - "Stage": "Stable" - } - ] - }, - { - "Type": "readonly struct Microsoft.Extensions.Diagnostics.Latency.LatencyData", - "Stage": "Stable", - "Methods": [ - { - "Member": "Microsoft.Extensions.Diagnostics.Latency.LatencyData.LatencyData(System.ArraySegment tags, System.ArraySegment checkpoints, System.ArraySegment measures, long durationTimestamp, long durationTimestampFrequency);", - "Stage": "Stable" - }, - { - "Member": "Microsoft.Extensions.Diagnostics.Latency.LatencyData.LatencyData();", - "Stage": "Stable" - } - ], - "Properties": [ - { - "Member": "System.ReadOnlySpan Microsoft.Extensions.Diagnostics.Latency.LatencyData.Checkpoints { get; }", - "Stage": "Stable" - }, - { - "Member": "long Microsoft.Extensions.Diagnostics.Latency.LatencyData.DurationTimestamp { get; }", - "Stage": "Stable" - }, - { - "Member": "long Microsoft.Extensions.Diagnostics.Latency.LatencyData.DurationTimestampFrequency { get; }", - "Stage": "Stable" - }, - { - "Member": "System.ReadOnlySpan Microsoft.Extensions.Diagnostics.Latency.LatencyData.Measures { get; }", - "Stage": "Stable" - }, - { - "Member": "System.ReadOnlySpan Microsoft.Extensions.Diagnostics.Latency.LatencyData.Tags { get; }", - "Stage": "Stable" - } - ] - }, - { - "Type": "static class Microsoft.Extensions.Diagnostics.Latency.LatencyRegistryExtensions", - "Stage": "Stable", - "Methods": [ - { - "Member": "static Microsoft.Extensions.DependencyInjection.IServiceCollection Microsoft.Extensions.Diagnostics.Latency.LatencyRegistryExtensions.RegisterCheckpointNames(this Microsoft.Extensions.DependencyInjection.IServiceCollection services, params string[] names);", - "Stage": "Stable" - }, - { - "Member": "static Microsoft.Extensions.DependencyInjection.IServiceCollection Microsoft.Extensions.Diagnostics.Latency.LatencyRegistryExtensions.RegisterMeasureNames(this Microsoft.Extensions.DependencyInjection.IServiceCollection services, params string[] names);", - "Stage": "Stable" - }, - { - "Member": "static Microsoft.Extensions.DependencyInjection.IServiceCollection Microsoft.Extensions.Diagnostics.Latency.LatencyRegistryExtensions.RegisterTagNames(this Microsoft.Extensions.DependencyInjection.IServiceCollection services, params string[] names);", - "Stage": "Stable" - } - ] - }, - { - "Type": "sealed class Microsoft.Extensions.Logging.LoggerMessageAttribute : System.Attribute", - "Stage": "Stable", - "Methods": [ - { - "Member": "Microsoft.Extensions.Logging.LoggerMessageAttribute.LoggerMessageAttribute(int eventId, Microsoft.Extensions.Logging.LogLevel level, string message);", - "Stage": "Stable" - }, - { - "Member": "Microsoft.Extensions.Logging.LoggerMessageAttribute.LoggerMessageAttribute(int eventId, Microsoft.Extensions.Logging.LogLevel level);", - "Stage": "Stable" - }, - { - "Member": "Microsoft.Extensions.Logging.LoggerMessageAttribute.LoggerMessageAttribute(Microsoft.Extensions.Logging.LogLevel level, string message);", - "Stage": "Stable" - }, - { - "Member": "Microsoft.Extensions.Logging.LoggerMessageAttribute.LoggerMessageAttribute(Microsoft.Extensions.Logging.LogLevel level);", - "Stage": "Stable" - }, - { - "Member": "Microsoft.Extensions.Logging.LoggerMessageAttribute.LoggerMessageAttribute(string message);", - "Stage": "Stable" - }, - { - "Member": "Microsoft.Extensions.Logging.LoggerMessageAttribute.LoggerMessageAttribute(int eventId, string message);", - "Stage": "Stable" - }, - { - "Member": "Microsoft.Extensions.Logging.LoggerMessageAttribute.LoggerMessageAttribute(int eventId);", - "Stage": "Stable" - }, - { - "Member": "Microsoft.Extensions.Logging.LoggerMessageAttribute.LoggerMessageAttribute();", - "Stage": "Experimental" - } - ], - "Properties": [ - { - "Member": "int Microsoft.Extensions.Logging.LoggerMessageAttribute.EventId { get; }", - "Stage": "Stable" - }, - { - "Member": "string? Microsoft.Extensions.Logging.LoggerMessageAttribute.EventName { get; set; }", - "Stage": "Stable" - }, - { - "Member": "Microsoft.Extensions.Logging.LogLevel? Microsoft.Extensions.Logging.LoggerMessageAttribute.Level { get; }", - "Stage": "Stable" - }, - { - "Member": "string Microsoft.Extensions.Logging.LoggerMessageAttribute.Message { get; }", - "Stage": "Stable" - }, - { - "Member": "bool Microsoft.Extensions.Logging.LoggerMessageAttribute.SkipEnabledCheck { get; set; }", - "Stage": "Stable" - } - ] - }, - { - "Type": "sealed class Microsoft.Extensions.Logging.LogMethodHelper : System.Collections.Generic.List>, Microsoft.Extensions.Logging.ITagCollector, Microsoft.Extensions.Diagnostics.Enrichment.IEnrichmentPropertyBag, Microsoft.Extensions.ObjectPool.IResettable", - "Stage": "Stable", - "Methods": [ - { - "Member": "Microsoft.Extensions.Logging.LogMethodHelper.LogMethodHelper();", - "Stage": "Stable" - }, - { - "Member": "void Microsoft.Extensions.Logging.LogMethodHelper.Add(string propertyName, object? propertyValue);", - "Stage": "Stable" - }, - { - "Member": "static Microsoft.Extensions.Logging.LogMethodHelper Microsoft.Extensions.Logging.LogMethodHelper.GetHelper();", - "Stage": "Stable" - }, - { - "Member": "static void Microsoft.Extensions.Logging.LogMethodHelper.ReturnHelper(Microsoft.Extensions.Logging.LogMethodHelper helper);", - "Stage": "Stable" - }, - { - "Member": "static string Microsoft.Extensions.Logging.LogMethodHelper.Stringify(System.Collections.IEnumerable? enumerable);", - "Stage": "Stable" - }, - { - "Member": "static string Microsoft.Extensions.Logging.LogMethodHelper.Stringify(System.Collections.Generic.IEnumerable>? enumerable);", - "Stage": "Stable" - }, - { - "Member": "bool Microsoft.Extensions.Logging.LogMethodHelper.TryReset();", - "Stage": "Stable" - } - ], - "Properties": [ - { - "Member": "string Microsoft.Extensions.Logging.LogMethodHelper.ParameterName { get; set; }", - "Stage": "Stable" - }, - { - "Member": "static Microsoft.Extensions.Logging.LogDefineOptions Microsoft.Extensions.Logging.LogMethodHelper.SkipEnabledCheckOptions { get; }", - "Stage": "Stable" - } - ] - }, - { - "Type": "sealed class Microsoft.Extensions.Logging.LogPropertiesAttribute : System.Attribute", - "Stage": "Stable", - "Methods": [ - { - "Member": "Microsoft.Extensions.Logging.LogPropertiesAttribute.LogPropertiesAttribute();", - "Stage": "Stable" - }, - { - "Member": "Microsoft.Extensions.Logging.LogPropertiesAttribute.LogPropertiesAttribute(System.Type providerType, string providerMethod);", - "Stage": "Stable" - } - ], - "Properties": [ - { - "Member": "bool Microsoft.Extensions.Logging.LogPropertiesAttribute.OmitParameterName { get; set; }", - "Stage": "Stable" - }, - { - "Member": "string? Microsoft.Extensions.Logging.LogPropertiesAttribute.ProviderMethod { get; }", - "Stage": "Stable" - }, - { - "Member": "System.Type? Microsoft.Extensions.Logging.LogPropertiesAttribute.ProviderType { get; }", - "Stage": "Stable" - }, - { - "Member": "bool Microsoft.Extensions.Logging.LogPropertiesAttribute.SkipNullProperties { get; set; }", - "Stage": "Stable" - } - ] - }, - { - "Type": "sealed class Microsoft.Extensions.Logging.LogPropertyIgnoreAttribute : System.Attribute", - "Stage": "Stable", - "Methods": [ - { - "Member": "Microsoft.Extensions.Logging.LogPropertyIgnoreAttribute.LogPropertyIgnoreAttribute();", - "Stage": "Stable" - } - ] - }, - { - "Type": "readonly struct Microsoft.Extensions.Diagnostics.Latency.Measure : System.IEquatable", - "Stage": "Stable", - "Methods": [ - { - "Member": "Microsoft.Extensions.Diagnostics.Latency.Measure.Measure(string name, long value);", - "Stage": "Stable" - }, - { - "Member": "Microsoft.Extensions.Diagnostics.Latency.Measure.Measure();", - "Stage": "Stable" - }, - { - "Member": "override bool Microsoft.Extensions.Diagnostics.Latency.Measure.Equals(object? obj);", - "Stage": "Stable" - }, - { - "Member": "bool Microsoft.Extensions.Diagnostics.Latency.Measure.Equals(Microsoft.Extensions.Diagnostics.Latency.Measure other);", - "Stage": "Stable" - }, - { - "Member": "override int Microsoft.Extensions.Diagnostics.Latency.Measure.GetHashCode();", - "Stage": "Stable" - }, - { - "Member": "static bool Microsoft.Extensions.Diagnostics.Latency.Measure.operator ==(Microsoft.Extensions.Diagnostics.Latency.Measure left, Microsoft.Extensions.Diagnostics.Latency.Measure right);", - "Stage": "Stable" - }, - { - "Member": "static bool Microsoft.Extensions.Diagnostics.Latency.Measure.operator !=(Microsoft.Extensions.Diagnostics.Latency.Measure left, Microsoft.Extensions.Diagnostics.Latency.Measure right);", - "Stage": "Stable" - } - ], - "Properties": [ - { - "Member": "string Microsoft.Extensions.Diagnostics.Latency.Measure.Name { get; }", - "Stage": "Stable" - }, - { - "Member": "long Microsoft.Extensions.Diagnostics.Latency.Measure.Value { get; }", - "Stage": "Stable" - } - ] - }, - { - "Type": "readonly struct Microsoft.Extensions.Diagnostics.Latency.MeasureToken", - "Stage": "Stable", - "Methods": [ - { - "Member": "Microsoft.Extensions.Diagnostics.Latency.MeasureToken.MeasureToken(string name, int position);", - "Stage": "Stable" - }, - { - "Member": "Microsoft.Extensions.Diagnostics.Latency.MeasureToken.MeasureToken();", - "Stage": "Stable" - } - ], - "Properties": [ - { - "Member": "string Microsoft.Extensions.Diagnostics.Latency.MeasureToken.Name { get; }", - "Stage": "Stable" - }, - { - "Member": "int Microsoft.Extensions.Diagnostics.Latency.MeasureToken.Position { get; }", - "Stage": "Stable" - } - ] - }, - { - "Type": "class Microsoft.Extensions.Telemetry.Metering.Meter : System.Diagnostics.Metrics.Meter", - "Stage": "Experimental", - "Methods": [ - { - "Member": "Microsoft.Extensions.Telemetry.Metering.Meter.Meter();", - "Stage": "Experimental" - } - ] - }, - { - "Type": "static class Microsoft.Extensions.Telemetry.Metering.MeteringExtensions", - "Stage": "Stable", - "Methods": [ - { - "Member": "static Microsoft.Extensions.DependencyInjection.IServiceCollection Microsoft.Extensions.Telemetry.Metering.MeteringExtensions.RegisterMetering(this Microsoft.Extensions.DependencyInjection.IServiceCollection services);", - "Stage": "Experimental" - } - ] - }, - { - "Type": "static class Microsoft.Extensions.Diagnostics.Latency.NullLatencyContextExtensions", - "Stage": "Stable", - "Methods": [ - { - "Member": "static Microsoft.Extensions.DependencyInjection.IServiceCollection Microsoft.Extensions.Diagnostics.Latency.NullLatencyContextExtensions.AddNullLatencyContext(this Microsoft.Extensions.DependencyInjection.IServiceCollection services);", - "Stage": "Stable" - } - ] - }, - { - "Type": "class Microsoft.Extensions.Http.Diagnostics.RequestMetadata", - "Stage": "Stable", - "Methods": [ - { - "Member": "Microsoft.Extensions.Http.Diagnostics.RequestMetadata.RequestMetadata();", - "Stage": "Stable" - }, - { - "Member": "Microsoft.Extensions.Http.Diagnostics.RequestMetadata.RequestMetadata(string methodType, string requestRoute, string requestName = \"unknown\");", - "Stage": "Stable" - } - ], - "Properties": [ - { - "Member": "string Microsoft.Extensions.Http.Diagnostics.RequestMetadata.DependencyName { get; set; }", - "Stage": "Stable" - }, - { - "Member": "string Microsoft.Extensions.Http.Diagnostics.RequestMetadata.MethodType { get; set; }", - "Stage": "Stable" - }, - { - "Member": "string Microsoft.Extensions.Http.Diagnostics.RequestMetadata.RequestName { get; set; }", - "Stage": "Stable" - }, - { - "Member": "string Microsoft.Extensions.Http.Diagnostics.RequestMetadata.RequestRoute { get; set; }", - "Stage": "Stable" - } - ] - }, - { - "Type": "readonly struct Microsoft.Extensions.Diagnostics.Latency.Tag", - "Stage": "Stable", - "Methods": [ - { - "Member": "Microsoft.Extensions.Diagnostics.Latency.Tag.Tag(string name, string value);", - "Stage": "Stable" - }, - { - "Member": "Microsoft.Extensions.Diagnostics.Latency.Tag.Tag();", - "Stage": "Stable" - } - ], - "Properties": [ - { - "Member": "string Microsoft.Extensions.Diagnostics.Latency.Tag.Name { get; }", - "Stage": "Stable" - }, - { - "Member": "string Microsoft.Extensions.Diagnostics.Latency.Tag.Value { get; }", - "Stage": "Stable" - } - ] - }, - { - "Type": "readonly struct Microsoft.Extensions.Diagnostics.Latency.TagToken", - "Stage": "Stable", - "Methods": [ - { - "Member": "Microsoft.Extensions.Diagnostics.Latency.TagToken.TagToken(string name, int position);", - "Stage": "Stable" - }, - { - "Member": "Microsoft.Extensions.Diagnostics.Latency.TagToken.TagToken();", - "Stage": "Stable" - } - ], - "Properties": [ - { - "Member": "string Microsoft.Extensions.Diagnostics.Latency.TagToken.Name { get; }", - "Stage": "Stable" - }, - { - "Member": "int Microsoft.Extensions.Diagnostics.Latency.TagToken.Position { get; }", - "Stage": "Stable" - } - ] - }, - { - "Type": "static class Microsoft.Extensions.Http.Diagnostics.TelemetryConstants", - "Stage": "Stable", - "Fields": [ - { - "Member": "const string Microsoft.Extensions.Http.Diagnostics.TelemetryConstants.ClientApplicationNameHeader", - "Stage": "Experimental", - "Value": "X-ClientApplication" - }, - { - "Member": "const string Microsoft.Extensions.Http.Diagnostics.TelemetryConstants.Redacted", - "Stage": "Stable", - "Value": "REDACTED" - }, - { - "Member": "const string Microsoft.Extensions.Http.Diagnostics.TelemetryConstants.RequestMetadataKey", - "Stage": "Stable", - "Value": "Extensions-RequestMetadata" - }, - { - "Member": "const string Microsoft.Extensions.Http.Diagnostics.TelemetryConstants.ServerApplicationNameHeader", - "Stage": "Experimental", - "Value": "X-ServerApplication" - }, - { - "Member": "const string Microsoft.Extensions.Http.Diagnostics.TelemetryConstants.Unknown", - "Stage": "Stable", - "Value": "unknown" - } - ] - } - ] -} \ No newline at end of file diff --git a/test/Generators/Microsoft.Gen.MetricsReports/GoldenReports/Microsoft.Gen.MeteringReports.Roslyn3.8.Unit.Tests.deps.json b/test/Generators/Microsoft.Gen.MetricsReports/GoldenReports/Microsoft.Gen.MeteringReports.Roslyn3.8.Unit.Tests.deps.json deleted file mode 100644 index 3a0ebf498ab..00000000000 --- a/test/Generators/Microsoft.Gen.MetricsReports/GoldenReports/Microsoft.Gen.MeteringReports.Roslyn3.8.Unit.Tests.deps.json +++ /dev/null @@ -1,2870 +0,0 @@ -{ - "runtimeTarget": { - "name": ".NETCoreApp,Version=v8.0", - "signature": "" - }, - "compilationOptions": {}, - "targets": { - ".NETCoreApp,Version=v8.0": { - "Microsoft.Gen.MeteringReports.Roslyn3.8.Unit.Tests/8.0.0-dev": { - "dependencies": { - "AutoFixture.AutoMoq": "4.17.0", - "FluentAssertions": "6.2.0", - "Microsoft.CodeAnalysis": "4.0.1", - "Microsoft.Extensions.Telemetry.Abstractions": "8.0.0-dev", - "Microsoft.Gen.MeteringReports": "8.0.0-dev", - "Microsoft.NET.Test.Sdk": "17.5.0", - "Microsoft.SourceLink.AzureRepos.Git": "8.0.0-beta.23252.2", - "Microsoft.SourceLink.GitHub": "8.0.0-beta.23252.2", - "Microsoft.TestUtilities": "8.0.0-dev", - "Microsoft.VisualStudio.Threading.Analyzers": "17.5.22", - "Moq": "4.16.1", - "Moq.AutoMock": "3.1.0", - "SonarAnalyzer.CSharp": "8.52.0.60960", - "StrongNamer": "0.2.5", - "StyleCop.Analyzers.Unstable": "1.2.0.435", - "Xunit.Combinatorial": "1.5.25", - "AutoFixture": "4.17.0", - "xunit.analyzers": "1.0.0", - "xunit.assert": "2.4.2", - "xunit.core": "2.4.2", - "xunit.runner.visualstudio": "2.4.3", - "Microsoft.Gen.MeteringReports.Reference": "8.0.0.0", - "Microsoft.TestUtilities.Reference": "8.0.0.0" - }, - "runtime": { - "Microsoft.Gen.MeteringReports.Roslyn3.8.Unit.Tests.dll": {} - } - }, - "AutoFixture/4.17.0": { - "dependencies": { - "Fare": "2.1.1", - "System.ComponentModel.Annotations": "4.3.0" - }, - "runtime": { - "lib/netstandard2.0/AutoFixture.dll": { - "assemblyVersion": "4.17.0.0", - "fileVersion": "4.17.0.636" - } - } - }, - "AutoFixture.AutoMoq/4.17.0": { - "dependencies": { - "AutoFixture": "4.17.0", - "Moq": "4.16.1" - }, - "runtime": { - "lib/netstandard2.0/AutoFixture.AutoMoq.dll": { - "assemblyVersion": "4.17.0.0", - "fileVersion": "4.17.0.636" - } - } - }, - "Castle.Core/4.4.0": { - "dependencies": { - "NETStandard.Library": "1.6.1", - "System.Collections.Specialized": "4.3.0", - "System.ComponentModel": "4.3.0", - "System.ComponentModel.TypeConverter": "4.3.0", - "System.Diagnostics.TraceSource": "4.3.0", - "System.Dynamic.Runtime": "4.3.0", - "System.Reflection": "4.3.0", - "System.Reflection.Emit": "4.3.0", - "System.Reflection.TypeExtensions": "4.3.0", - "System.Xml.XmlDocument": "4.3.0" - }, - "runtime": { - "lib/netstandard1.5/Castle.Core.dll": { - "assemblyVersion": "4.0.0.0", - "fileVersion": "4.4.0.0" - } - } - }, - "Fare/2.1.1": { - "dependencies": { - "NETStandard.Library": "1.6.1" - }, - "runtime": { - "lib/netstandard1.1/Fare.dll": { - "assemblyVersion": "2.1.0.0", - "fileVersion": "2.1.1.0" - } - } - }, - "FluentAssertions/6.2.0": { - "dependencies": { - "System.Configuration.ConfigurationManager": "4.4.0" - }, - "runtime": { - "lib/netcoreapp3.0/FluentAssertions.dll": { - "assemblyVersion": "6.2.0.0", - "fileVersion": "6.2.0.0" - } - } - }, - "Humanizer.Core/2.2.0": { - "dependencies": { - "NETStandard.Library": "1.6.1" - }, - "runtime": { - "lib/netstandard1.0/Humanizer.dll": { - "assemblyVersion": "2.2.0.0", - "fileVersion": "2.2.0.0" - } - } - }, - "Microsoft.Bcl.AsyncInterfaces/5.0.0": { - "runtime": { - "lib/netstandard2.1/Microsoft.Bcl.AsyncInterfaces.dll": { - "assemblyVersion": "5.0.0.0", - "fileVersion": "5.0.20.51904" - } - } - }, - "Microsoft.Build.Tasks.Git/8.0.0-beta.23252.2": {}, - "Microsoft.CodeAnalysis/4.0.1": { - "dependencies": { - "Microsoft.CodeAnalysis.CSharp.Workspaces": "4.0.1", - "Microsoft.CodeAnalysis.VisualBasic.Workspaces": "4.0.1" - } - }, - "Microsoft.CodeAnalysis.Analyzers/3.3.2": {}, - "Microsoft.CodeAnalysis.Common/4.0.1": { - "dependencies": { - "Microsoft.CodeAnalysis.Analyzers": "3.3.2", - "System.Collections.Immutable": "5.0.0", - "System.Memory": "4.5.4", - "System.Reflection.Metadata": "5.0.0", - "System.Runtime.CompilerServices.Unsafe": "5.0.0", - "System.Text.Encoding.CodePages": "4.5.1", - "System.Threading.Tasks.Extensions": "4.5.4" - }, - "runtime": { - "lib/netcoreapp3.1/Microsoft.CodeAnalysis.dll": { - "assemblyVersion": "4.0.0.0", - "fileVersion": "4.0.121.55815" - } - }, - "resources": { - "lib/netcoreapp3.1/cs/Microsoft.CodeAnalysis.resources.dll": { - "locale": "cs" - }, - "lib/netcoreapp3.1/de/Microsoft.CodeAnalysis.resources.dll": { - "locale": "de" - }, - "lib/netcoreapp3.1/es/Microsoft.CodeAnalysis.resources.dll": { - "locale": "es" - }, - "lib/netcoreapp3.1/fr/Microsoft.CodeAnalysis.resources.dll": { - "locale": "fr" - }, - "lib/netcoreapp3.1/it/Microsoft.CodeAnalysis.resources.dll": { - "locale": "it" - }, - "lib/netcoreapp3.1/ja/Microsoft.CodeAnalysis.resources.dll": { - "locale": "ja" - }, - "lib/netcoreapp3.1/ko/Microsoft.CodeAnalysis.resources.dll": { - "locale": "ko" - }, - "lib/netcoreapp3.1/pl/Microsoft.CodeAnalysis.resources.dll": { - "locale": "pl" - }, - "lib/netcoreapp3.1/pt-BR/Microsoft.CodeAnalysis.resources.dll": { - "locale": "pt-BR" - }, - "lib/netcoreapp3.1/ru/Microsoft.CodeAnalysis.resources.dll": { - "locale": "ru" - }, - "lib/netcoreapp3.1/tr/Microsoft.CodeAnalysis.resources.dll": { - "locale": "tr" - }, - "lib/netcoreapp3.1/zh-Hans/Microsoft.CodeAnalysis.resources.dll": { - "locale": "zh-Hans" - }, - "lib/netcoreapp3.1/zh-Hant/Microsoft.CodeAnalysis.resources.dll": { - "locale": "zh-Hant" - } - } - }, - "Microsoft.CodeAnalysis.CSharp/4.0.1": { - "dependencies": { - "Microsoft.CodeAnalysis.Common": "4.0.1" - }, - "runtime": { - "lib/netcoreapp3.1/Microsoft.CodeAnalysis.CSharp.dll": { - "assemblyVersion": "4.0.0.0", - "fileVersion": "4.0.121.55815" - } - }, - "resources": { - "lib/netcoreapp3.1/cs/Microsoft.CodeAnalysis.CSharp.resources.dll": { - "locale": "cs" - }, - "lib/netcoreapp3.1/de/Microsoft.CodeAnalysis.CSharp.resources.dll": { - "locale": "de" - }, - "lib/netcoreapp3.1/es/Microsoft.CodeAnalysis.CSharp.resources.dll": { - "locale": "es" - }, - "lib/netcoreapp3.1/fr/Microsoft.CodeAnalysis.CSharp.resources.dll": { - "locale": "fr" - }, - "lib/netcoreapp3.1/it/Microsoft.CodeAnalysis.CSharp.resources.dll": { - "locale": "it" - }, - "lib/netcoreapp3.1/ja/Microsoft.CodeAnalysis.CSharp.resources.dll": { - "locale": "ja" - }, - "lib/netcoreapp3.1/ko/Microsoft.CodeAnalysis.CSharp.resources.dll": { - "locale": "ko" - }, - "lib/netcoreapp3.1/pl/Microsoft.CodeAnalysis.CSharp.resources.dll": { - "locale": "pl" - }, - "lib/netcoreapp3.1/pt-BR/Microsoft.CodeAnalysis.CSharp.resources.dll": { - "locale": "pt-BR" - }, - "lib/netcoreapp3.1/ru/Microsoft.CodeAnalysis.CSharp.resources.dll": { - "locale": "ru" - }, - "lib/netcoreapp3.1/tr/Microsoft.CodeAnalysis.CSharp.resources.dll": { - "locale": "tr" - }, - "lib/netcoreapp3.1/zh-Hans/Microsoft.CodeAnalysis.CSharp.resources.dll": { - "locale": "zh-Hans" - }, - "lib/netcoreapp3.1/zh-Hant/Microsoft.CodeAnalysis.CSharp.resources.dll": { - "locale": "zh-Hant" - } - } - }, - "Microsoft.CodeAnalysis.CSharp.Workspaces/4.0.1": { - "dependencies": { - "Humanizer.Core": "2.2.0", - "Microsoft.CodeAnalysis.CSharp": "4.0.1", - "Microsoft.CodeAnalysis.Common": "4.0.1", - "Microsoft.CodeAnalysis.Workspaces.Common": "4.0.1" - }, - "runtime": { - "lib/netcoreapp3.1/Microsoft.CodeAnalysis.CSharp.Workspaces.dll": { - "assemblyVersion": "4.0.0.0", - "fileVersion": "4.0.121.55815" - } - }, - "resources": { - "lib/netcoreapp3.1/cs/Microsoft.CodeAnalysis.CSharp.Workspaces.resources.dll": { - "locale": "cs" - }, - "lib/netcoreapp3.1/de/Microsoft.CodeAnalysis.CSharp.Workspaces.resources.dll": { - "locale": "de" - }, - "lib/netcoreapp3.1/es/Microsoft.CodeAnalysis.CSharp.Workspaces.resources.dll": { - "locale": "es" - }, - "lib/netcoreapp3.1/fr/Microsoft.CodeAnalysis.CSharp.Workspaces.resources.dll": { - "locale": "fr" - }, - "lib/netcoreapp3.1/it/Microsoft.CodeAnalysis.CSharp.Workspaces.resources.dll": { - "locale": "it" - }, - "lib/netcoreapp3.1/ja/Microsoft.CodeAnalysis.CSharp.Workspaces.resources.dll": { - "locale": "ja" - }, - "lib/netcoreapp3.1/ko/Microsoft.CodeAnalysis.CSharp.Workspaces.resources.dll": { - "locale": "ko" - }, - "lib/netcoreapp3.1/pl/Microsoft.CodeAnalysis.CSharp.Workspaces.resources.dll": { - "locale": "pl" - }, - "lib/netcoreapp3.1/pt-BR/Microsoft.CodeAnalysis.CSharp.Workspaces.resources.dll": { - "locale": "pt-BR" - }, - "lib/netcoreapp3.1/ru/Microsoft.CodeAnalysis.CSharp.Workspaces.resources.dll": { - "locale": "ru" - }, - "lib/netcoreapp3.1/tr/Microsoft.CodeAnalysis.CSharp.Workspaces.resources.dll": { - "locale": "tr" - }, - "lib/netcoreapp3.1/zh-Hans/Microsoft.CodeAnalysis.CSharp.Workspaces.resources.dll": { - "locale": "zh-Hans" - }, - "lib/netcoreapp3.1/zh-Hant/Microsoft.CodeAnalysis.CSharp.Workspaces.resources.dll": { - "locale": "zh-Hant" - } - } - }, - "Microsoft.CodeAnalysis.VisualBasic/4.0.1": { - "dependencies": { - "Microsoft.CodeAnalysis.Common": "4.0.1" - }, - "runtime": { - "lib/netcoreapp3.1/Microsoft.CodeAnalysis.VisualBasic.dll": { - "assemblyVersion": "4.0.0.0", - "fileVersion": "4.0.121.55815" - } - }, - "resources": { - "lib/netcoreapp3.1/cs/Microsoft.CodeAnalysis.VisualBasic.resources.dll": { - "locale": "cs" - }, - "lib/netcoreapp3.1/de/Microsoft.CodeAnalysis.VisualBasic.resources.dll": { - "locale": "de" - }, - "lib/netcoreapp3.1/es/Microsoft.CodeAnalysis.VisualBasic.resources.dll": { - "locale": "es" - }, - "lib/netcoreapp3.1/fr/Microsoft.CodeAnalysis.VisualBasic.resources.dll": { - "locale": "fr" - }, - "lib/netcoreapp3.1/it/Microsoft.CodeAnalysis.VisualBasic.resources.dll": { - "locale": "it" - }, - "lib/netcoreapp3.1/ja/Microsoft.CodeAnalysis.VisualBasic.resources.dll": { - "locale": "ja" - }, - "lib/netcoreapp3.1/ko/Microsoft.CodeAnalysis.VisualBasic.resources.dll": { - "locale": "ko" - }, - "lib/netcoreapp3.1/pl/Microsoft.CodeAnalysis.VisualBasic.resources.dll": { - "locale": "pl" - }, - "lib/netcoreapp3.1/pt-BR/Microsoft.CodeAnalysis.VisualBasic.resources.dll": { - "locale": "pt-BR" - }, - "lib/netcoreapp3.1/ru/Microsoft.CodeAnalysis.VisualBasic.resources.dll": { - "locale": "ru" - }, - "lib/netcoreapp3.1/tr/Microsoft.CodeAnalysis.VisualBasic.resources.dll": { - "locale": "tr" - }, - "lib/netcoreapp3.1/zh-Hans/Microsoft.CodeAnalysis.VisualBasic.resources.dll": { - "locale": "zh-Hans" - }, - "lib/netcoreapp3.1/zh-Hant/Microsoft.CodeAnalysis.VisualBasic.resources.dll": { - "locale": "zh-Hant" - } - } - }, - "Microsoft.CodeAnalysis.VisualBasic.Workspaces/4.0.1": { - "dependencies": { - "Microsoft.CodeAnalysis.Common": "4.0.1", - "Microsoft.CodeAnalysis.VisualBasic": "4.0.1", - "Microsoft.CodeAnalysis.Workspaces.Common": "4.0.1" - }, - "runtime": { - "lib/netcoreapp3.1/Microsoft.CodeAnalysis.VisualBasic.Workspaces.dll": { - "assemblyVersion": "4.0.0.0", - "fileVersion": "4.0.121.55815" - } - }, - "resources": { - "lib/netcoreapp3.1/cs/Microsoft.CodeAnalysis.VisualBasic.Workspaces.resources.dll": { - "locale": "cs" - }, - "lib/netcoreapp3.1/de/Microsoft.CodeAnalysis.VisualBasic.Workspaces.resources.dll": { - "locale": "de" - }, - "lib/netcoreapp3.1/es/Microsoft.CodeAnalysis.VisualBasic.Workspaces.resources.dll": { - "locale": "es" - }, - "lib/netcoreapp3.1/fr/Microsoft.CodeAnalysis.VisualBasic.Workspaces.resources.dll": { - "locale": "fr" - }, - "lib/netcoreapp3.1/it/Microsoft.CodeAnalysis.VisualBasic.Workspaces.resources.dll": { - "locale": "it" - }, - "lib/netcoreapp3.1/ja/Microsoft.CodeAnalysis.VisualBasic.Workspaces.resources.dll": { - "locale": "ja" - }, - "lib/netcoreapp3.1/ko/Microsoft.CodeAnalysis.VisualBasic.Workspaces.resources.dll": { - "locale": "ko" - }, - "lib/netcoreapp3.1/pl/Microsoft.CodeAnalysis.VisualBasic.Workspaces.resources.dll": { - "locale": "pl" - }, - "lib/netcoreapp3.1/pt-BR/Microsoft.CodeAnalysis.VisualBasic.Workspaces.resources.dll": { - "locale": "pt-BR" - }, - "lib/netcoreapp3.1/ru/Microsoft.CodeAnalysis.VisualBasic.Workspaces.resources.dll": { - "locale": "ru" - }, - "lib/netcoreapp3.1/tr/Microsoft.CodeAnalysis.VisualBasic.Workspaces.resources.dll": { - "locale": "tr" - }, - "lib/netcoreapp3.1/zh-Hans/Microsoft.CodeAnalysis.VisualBasic.Workspaces.resources.dll": { - "locale": "zh-Hans" - }, - "lib/netcoreapp3.1/zh-Hant/Microsoft.CodeAnalysis.VisualBasic.Workspaces.resources.dll": { - "locale": "zh-Hant" - } - } - }, - "Microsoft.CodeAnalysis.Workspaces.Common/4.0.1": { - "dependencies": { - "Humanizer.Core": "2.2.0", - "Microsoft.Bcl.AsyncInterfaces": "5.0.0", - "Microsoft.CodeAnalysis.Common": "4.0.1", - "System.Composition": "1.0.31", - "System.IO.Pipelines": "5.0.1" - }, - "runtime": { - "lib/netcoreapp3.1/Microsoft.CodeAnalysis.Workspaces.dll": { - "assemblyVersion": "4.0.0.0", - "fileVersion": "4.0.121.55815" - } - }, - "resources": { - "lib/netcoreapp3.1/cs/Microsoft.CodeAnalysis.Workspaces.resources.dll": { - "locale": "cs" - }, - "lib/netcoreapp3.1/de/Microsoft.CodeAnalysis.Workspaces.resources.dll": { - "locale": "de" - }, - "lib/netcoreapp3.1/es/Microsoft.CodeAnalysis.Workspaces.resources.dll": { - "locale": "es" - }, - "lib/netcoreapp3.1/fr/Microsoft.CodeAnalysis.Workspaces.resources.dll": { - "locale": "fr" - }, - "lib/netcoreapp3.1/it/Microsoft.CodeAnalysis.Workspaces.resources.dll": { - "locale": "it" - }, - "lib/netcoreapp3.1/ja/Microsoft.CodeAnalysis.Workspaces.resources.dll": { - "locale": "ja" - }, - "lib/netcoreapp3.1/ko/Microsoft.CodeAnalysis.Workspaces.resources.dll": { - "locale": "ko" - }, - "lib/netcoreapp3.1/pl/Microsoft.CodeAnalysis.Workspaces.resources.dll": { - "locale": "pl" - }, - "lib/netcoreapp3.1/pt-BR/Microsoft.CodeAnalysis.Workspaces.resources.dll": { - "locale": "pt-BR" - }, - "lib/netcoreapp3.1/ru/Microsoft.CodeAnalysis.Workspaces.resources.dll": { - "locale": "ru" - }, - "lib/netcoreapp3.1/tr/Microsoft.CodeAnalysis.Workspaces.resources.dll": { - "locale": "tr" - }, - "lib/netcoreapp3.1/zh-Hans/Microsoft.CodeAnalysis.Workspaces.resources.dll": { - "locale": "zh-Hans" - }, - "lib/netcoreapp3.1/zh-Hant/Microsoft.CodeAnalysis.Workspaces.resources.dll": { - "locale": "zh-Hant" - } - } - }, - "Microsoft.CodeCoverage/17.5.0": { - "runtime": { - "lib/netcoreapp3.1/Microsoft.VisualStudio.CodeCoverage.Shim.dll": { - "assemblyVersion": "15.0.0.0", - "fileVersion": "17.500.222.62001" - } - } - }, - "Microsoft.Extensions.DependencyInjection.Abstractions/8.0.0-preview.5.23272.1": { - "runtime": { - "lib/net8.0/Microsoft.Extensions.DependencyInjection.Abstractions.dll": { - "assemblyVersion": "8.0.0.0", - "fileVersion": "8.0.23.27201" - } - } - }, - "Microsoft.Extensions.Logging.Abstractions/8.0.0-preview.5.23272.1": { - "runtime": { - "lib/net8.0/Microsoft.Extensions.Logging.Abstractions.dll": { - "assemblyVersion": "8.0.0.0", - "fileVersion": "8.0.23.27201" - } - } - }, - "Microsoft.Extensions.ObjectPool/8.0.0-preview.5.23273.2": { - "runtime": { - "lib/net8.0/Microsoft.Extensions.ObjectPool.dll": { - "assemblyVersion": "8.0.0.0", - "fileVersion": "8.0.23.27302" - } - } - }, - "Microsoft.Extensions.Options/8.0.0-preview.5.23272.1": { - "dependencies": { - "Microsoft.Extensions.DependencyInjection.Abstractions": "8.0.0-preview.5.23272.1", - "Microsoft.Extensions.Primitives": "8.0.0-preview.5.23272.1" - }, - "runtime": { - "lib/net8.0/Microsoft.Extensions.Options.dll": { - "assemblyVersion": "8.0.0.0", - "fileVersion": "8.0.23.27201" - } - } - }, - "Microsoft.Extensions.Primitives/8.0.0-preview.5.23272.1": { - "runtime": { - "lib/net8.0/Microsoft.Extensions.Primitives.dll": { - "assemblyVersion": "8.0.0.0", - "fileVersion": "8.0.23.27201" - } - } - }, - "Microsoft.NET.Test.Sdk/17.5.0": { - "dependencies": { - "Microsoft.CodeCoverage": "17.5.0", - "Microsoft.TestPlatform.TestHost": "17.5.0" - } - }, - "Microsoft.NETCore.Platforms/2.1.2": {}, - "Microsoft.NETCore.Targets/1.1.0": {}, - "Microsoft.SourceLink.AzureRepos.Git/8.0.0-beta.23252.2": { - "dependencies": { - "Microsoft.Build.Tasks.Git": "8.0.0-beta.23252.2", - "Microsoft.SourceLink.Common": "8.0.0-beta.23252.2" - } - }, - "Microsoft.SourceLink.Common/8.0.0-beta.23252.2": {}, - "Microsoft.SourceLink.GitHub/8.0.0-beta.23252.2": { - "dependencies": { - "Microsoft.Build.Tasks.Git": "8.0.0-beta.23252.2", - "Microsoft.SourceLink.Common": "8.0.0-beta.23252.2" - } - }, - "Microsoft.TestPlatform.ObjectModel/17.5.0": { - "dependencies": { - "NuGet.Frameworks": "5.11.0", - "System.Reflection.Metadata": "5.0.0" - }, - "runtime": { - "lib/netcoreapp3.1/Microsoft.TestPlatform.CoreUtilities.dll": { - "assemblyVersion": "15.0.0.0", - "fileVersion": "15.0.0.0" - }, - "lib/netcoreapp3.1/Microsoft.TestPlatform.PlatformAbstractions.dll": { - "assemblyVersion": "15.0.0.0", - "fileVersion": "15.0.0.0" - }, - "lib/netcoreapp3.1/Microsoft.VisualStudio.TestPlatform.ObjectModel.dll": { - "assemblyVersion": "15.0.0.0", - "fileVersion": "15.0.0.0" - } - }, - "resources": { - "lib/netcoreapp3.1/cs/Microsoft.TestPlatform.CoreUtilities.resources.dll": { - "locale": "cs" - }, - "lib/netcoreapp3.1/cs/Microsoft.VisualStudio.TestPlatform.ObjectModel.resources.dll": { - "locale": "cs" - }, - "lib/netcoreapp3.1/de/Microsoft.TestPlatform.CoreUtilities.resources.dll": { - "locale": "de" - }, - "lib/netcoreapp3.1/de/Microsoft.VisualStudio.TestPlatform.ObjectModel.resources.dll": { - "locale": "de" - }, - "lib/netcoreapp3.1/es/Microsoft.TestPlatform.CoreUtilities.resources.dll": { - "locale": "es" - }, - "lib/netcoreapp3.1/es/Microsoft.VisualStudio.TestPlatform.ObjectModel.resources.dll": { - "locale": "es" - }, - "lib/netcoreapp3.1/fr/Microsoft.TestPlatform.CoreUtilities.resources.dll": { - "locale": "fr" - }, - "lib/netcoreapp3.1/fr/Microsoft.VisualStudio.TestPlatform.ObjectModel.resources.dll": { - "locale": "fr" - }, - "lib/netcoreapp3.1/it/Microsoft.TestPlatform.CoreUtilities.resources.dll": { - "locale": "it" - }, - "lib/netcoreapp3.1/it/Microsoft.VisualStudio.TestPlatform.ObjectModel.resources.dll": { - "locale": "it" - }, - "lib/netcoreapp3.1/ja/Microsoft.TestPlatform.CoreUtilities.resources.dll": { - "locale": "ja" - }, - "lib/netcoreapp3.1/ja/Microsoft.VisualStudio.TestPlatform.ObjectModel.resources.dll": { - "locale": "ja" - }, - "lib/netcoreapp3.1/ko/Microsoft.TestPlatform.CoreUtilities.resources.dll": { - "locale": "ko" - }, - "lib/netcoreapp3.1/ko/Microsoft.VisualStudio.TestPlatform.ObjectModel.resources.dll": { - "locale": "ko" - }, - "lib/netcoreapp3.1/pl/Microsoft.TestPlatform.CoreUtilities.resources.dll": { - "locale": "pl" - }, - "lib/netcoreapp3.1/pl/Microsoft.VisualStudio.TestPlatform.ObjectModel.resources.dll": { - "locale": "pl" - }, - "lib/netcoreapp3.1/pt-BR/Microsoft.TestPlatform.CoreUtilities.resources.dll": { - "locale": "pt-BR" - }, - "lib/netcoreapp3.1/pt-BR/Microsoft.VisualStudio.TestPlatform.ObjectModel.resources.dll": { - "locale": "pt-BR" - }, - "lib/netcoreapp3.1/ru/Microsoft.TestPlatform.CoreUtilities.resources.dll": { - "locale": "ru" - }, - "lib/netcoreapp3.1/ru/Microsoft.VisualStudio.TestPlatform.ObjectModel.resources.dll": { - "locale": "ru" - }, - "lib/netcoreapp3.1/tr/Microsoft.TestPlatform.CoreUtilities.resources.dll": { - "locale": "tr" - }, - "lib/netcoreapp3.1/tr/Microsoft.VisualStudio.TestPlatform.ObjectModel.resources.dll": { - "locale": "tr" - }, - "lib/netcoreapp3.1/zh-Hans/Microsoft.TestPlatform.CoreUtilities.resources.dll": { - "locale": "zh-Hans" - }, - "lib/netcoreapp3.1/zh-Hans/Microsoft.VisualStudio.TestPlatform.ObjectModel.resources.dll": { - "locale": "zh-Hans" - }, - "lib/netcoreapp3.1/zh-Hant/Microsoft.TestPlatform.CoreUtilities.resources.dll": { - "locale": "zh-Hant" - }, - "lib/netcoreapp3.1/zh-Hant/Microsoft.VisualStudio.TestPlatform.ObjectModel.resources.dll": { - "locale": "zh-Hant" - } - } - }, - "Microsoft.TestPlatform.TestHost/17.5.0": { - "dependencies": { - "Microsoft.TestPlatform.ObjectModel": "17.5.0", - "Newtonsoft.Json": "13.0.1" - }, - "runtime": { - "lib/netcoreapp3.1/Microsoft.TestPlatform.CommunicationUtilities.dll": { - "assemblyVersion": "15.0.0.0", - "fileVersion": "15.0.0.0" - }, - "lib/netcoreapp3.1/Microsoft.TestPlatform.CrossPlatEngine.dll": { - "assemblyVersion": "15.0.0.0", - "fileVersion": "15.0.0.0" - }, - "lib/netcoreapp3.1/Microsoft.TestPlatform.Utilities.dll": { - "assemblyVersion": "15.0.0.0", - "fileVersion": "15.0.0.0" - }, - "lib/netcoreapp3.1/Microsoft.VisualStudio.TestPlatform.Common.dll": { - "assemblyVersion": "15.0.0.0", - "fileVersion": "15.0.0.0" - }, - "lib/netcoreapp3.1/testhost.dll": { - "assemblyVersion": "15.0.0.0", - "fileVersion": "15.0.0.0" - } - }, - "resources": { - "lib/netcoreapp3.1/cs/Microsoft.TestPlatform.CommunicationUtilities.resources.dll": { - "locale": "cs" - }, - "lib/netcoreapp3.1/cs/Microsoft.TestPlatform.CrossPlatEngine.resources.dll": { - "locale": "cs" - }, - "lib/netcoreapp3.1/cs/Microsoft.VisualStudio.TestPlatform.Common.resources.dll": { - "locale": "cs" - }, - "lib/netcoreapp3.1/de/Microsoft.TestPlatform.CommunicationUtilities.resources.dll": { - "locale": "de" - }, - "lib/netcoreapp3.1/de/Microsoft.TestPlatform.CrossPlatEngine.resources.dll": { - "locale": "de" - }, - "lib/netcoreapp3.1/de/Microsoft.VisualStudio.TestPlatform.Common.resources.dll": { - "locale": "de" - }, - "lib/netcoreapp3.1/es/Microsoft.TestPlatform.CommunicationUtilities.resources.dll": { - "locale": "es" - }, - "lib/netcoreapp3.1/es/Microsoft.TestPlatform.CrossPlatEngine.resources.dll": { - "locale": "es" - }, - "lib/netcoreapp3.1/es/Microsoft.VisualStudio.TestPlatform.Common.resources.dll": { - "locale": "es" - }, - "lib/netcoreapp3.1/fr/Microsoft.TestPlatform.CommunicationUtilities.resources.dll": { - "locale": "fr" - }, - "lib/netcoreapp3.1/fr/Microsoft.TestPlatform.CrossPlatEngine.resources.dll": { - "locale": "fr" - }, - "lib/netcoreapp3.1/fr/Microsoft.VisualStudio.TestPlatform.Common.resources.dll": { - "locale": "fr" - }, - "lib/netcoreapp3.1/it/Microsoft.TestPlatform.CommunicationUtilities.resources.dll": { - "locale": "it" - }, - "lib/netcoreapp3.1/it/Microsoft.TestPlatform.CrossPlatEngine.resources.dll": { - "locale": "it" - }, - "lib/netcoreapp3.1/it/Microsoft.VisualStudio.TestPlatform.Common.resources.dll": { - "locale": "it" - }, - "lib/netcoreapp3.1/ja/Microsoft.TestPlatform.CommunicationUtilities.resources.dll": { - "locale": "ja" - }, - "lib/netcoreapp3.1/ja/Microsoft.TestPlatform.CrossPlatEngine.resources.dll": { - "locale": "ja" - }, - "lib/netcoreapp3.1/ja/Microsoft.VisualStudio.TestPlatform.Common.resources.dll": { - "locale": "ja" - }, - "lib/netcoreapp3.1/ko/Microsoft.TestPlatform.CommunicationUtilities.resources.dll": { - "locale": "ko" - }, - "lib/netcoreapp3.1/ko/Microsoft.TestPlatform.CrossPlatEngine.resources.dll": { - "locale": "ko" - }, - "lib/netcoreapp3.1/ko/Microsoft.VisualStudio.TestPlatform.Common.resources.dll": { - "locale": "ko" - }, - "lib/netcoreapp3.1/pl/Microsoft.TestPlatform.CommunicationUtilities.resources.dll": { - "locale": "pl" - }, - "lib/netcoreapp3.1/pl/Microsoft.TestPlatform.CrossPlatEngine.resources.dll": { - "locale": "pl" - }, - "lib/netcoreapp3.1/pl/Microsoft.VisualStudio.TestPlatform.Common.resources.dll": { - "locale": "pl" - }, - "lib/netcoreapp3.1/pt-BR/Microsoft.TestPlatform.CommunicationUtilities.resources.dll": { - "locale": "pt-BR" - }, - "lib/netcoreapp3.1/pt-BR/Microsoft.TestPlatform.CrossPlatEngine.resources.dll": { - "locale": "pt-BR" - }, - "lib/netcoreapp3.1/pt-BR/Microsoft.VisualStudio.TestPlatform.Common.resources.dll": { - "locale": "pt-BR" - }, - "lib/netcoreapp3.1/ru/Microsoft.TestPlatform.CommunicationUtilities.resources.dll": { - "locale": "ru" - }, - "lib/netcoreapp3.1/ru/Microsoft.TestPlatform.CrossPlatEngine.resources.dll": { - "locale": "ru" - }, - "lib/netcoreapp3.1/ru/Microsoft.VisualStudio.TestPlatform.Common.resources.dll": { - "locale": "ru" - }, - "lib/netcoreapp3.1/tr/Microsoft.TestPlatform.CommunicationUtilities.resources.dll": { - "locale": "tr" - }, - "lib/netcoreapp3.1/tr/Microsoft.TestPlatform.CrossPlatEngine.resources.dll": { - "locale": "tr" - }, - "lib/netcoreapp3.1/tr/Microsoft.VisualStudio.TestPlatform.Common.resources.dll": { - "locale": "tr" - }, - "lib/netcoreapp3.1/zh-Hans/Microsoft.TestPlatform.CommunicationUtilities.resources.dll": { - "locale": "zh-Hans" - }, - "lib/netcoreapp3.1/zh-Hans/Microsoft.TestPlatform.CrossPlatEngine.resources.dll": { - "locale": "zh-Hans" - }, - "lib/netcoreapp3.1/zh-Hans/Microsoft.VisualStudio.TestPlatform.Common.resources.dll": { - "locale": "zh-Hans" - }, - "lib/netcoreapp3.1/zh-Hant/Microsoft.TestPlatform.CommunicationUtilities.resources.dll": { - "locale": "zh-Hant" - }, - "lib/netcoreapp3.1/zh-Hant/Microsoft.TestPlatform.CrossPlatEngine.resources.dll": { - "locale": "zh-Hant" - }, - "lib/netcoreapp3.1/zh-Hant/Microsoft.VisualStudio.TestPlatform.Common.resources.dll": { - "locale": "zh-Hant" - } - } - }, - "Microsoft.VisualStudio.Threading.Analyzers/17.5.22": {}, - "Microsoft.Win32.Primitives/4.3.0": { - "dependencies": { - "Microsoft.NETCore.Platforms": "2.1.2", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0" - } - }, - "Moq/4.16.1": { - "dependencies": { - "Castle.Core": "4.4.0", - "System.Threading.Tasks.Extensions": "4.5.4" - }, - "runtime": { - "lib/netstandard2.1/Moq.dll": { - "assemblyVersion": "4.16.0.0", - "fileVersion": "4.16.1.0" - } - } - }, - "Moq.AutoMock/3.1.0": { - "dependencies": { - "Moq": "4.16.1" - }, - "runtime": { - "lib/netstandard2.0/Moq.AutoMock.dll": { - "assemblyVersion": "3.1.0.0", - "fileVersion": "3.1.0.0" - } - } - }, - "NETStandard.Library/1.6.1": { - "dependencies": { - "Microsoft.NETCore.Platforms": "2.1.2", - "Microsoft.Win32.Primitives": "4.3.0", - "System.AppContext": "4.3.0", - "System.Collections": "4.3.0", - "System.Collections.Concurrent": "4.3.0", - "System.Console": "4.3.0", - "System.Diagnostics.Debug": "4.3.0", - "System.Diagnostics.Tools": "4.3.0", - "System.Diagnostics.Tracing": "4.3.0", - "System.Globalization": "4.3.0", - "System.Globalization.Calendars": "4.3.0", - "System.IO": "4.3.0", - "System.IO.Compression": "4.3.0", - "System.IO.Compression.ZipFile": "4.3.0", - "System.IO.FileSystem": "4.3.0", - "System.IO.FileSystem.Primitives": "4.3.0", - "System.Linq": "4.3.0", - "System.Linq.Expressions": "4.3.0", - "System.Net.Http": "4.3.0", - "System.Net.Primitives": "4.3.0", - "System.Net.Sockets": "4.3.0", - "System.ObjectModel": "4.3.0", - "System.Reflection": "4.3.0", - "System.Reflection.Extensions": "4.3.0", - "System.Reflection.Primitives": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Runtime.Handles": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Runtime.InteropServices.RuntimeInformation": "4.3.0", - "System.Runtime.Numerics": "4.3.0", - "System.Security.Cryptography.Algorithms": "4.3.0", - "System.Security.Cryptography.Encoding": "4.3.0", - "System.Security.Cryptography.Primitives": "4.3.0", - "System.Security.Cryptography.X509Certificates": "4.3.0", - "System.Text.Encoding": "4.3.0", - "System.Text.Encoding.Extensions": "4.3.0", - "System.Text.RegularExpressions": "4.3.0", - "System.Threading": "4.3.0", - "System.Threading.Tasks": "4.3.0", - "System.Threading.Timer": "4.3.0", - "System.Xml.ReaderWriter": "4.3.0", - "System.Xml.XDocument": "4.3.0" - } - }, - "Newtonsoft.Json/13.0.1": { - "runtime": { - "lib/netstandard2.0/Newtonsoft.Json.dll": { - "assemblyVersion": "13.0.0.0", - "fileVersion": "13.0.1.25517" - } - } - }, - "NuGet.Frameworks/5.11.0": { - "runtime": { - "lib/netstandard2.0/NuGet.Frameworks.dll": { - "assemblyVersion": "5.11.0.10", - "fileVersion": "5.11.0.10" - } - } - }, - "runtime.debian.8-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": {}, - "runtime.fedora.23-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": {}, - "runtime.fedora.24-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": {}, - "runtime.native.System/4.3.0": { - "dependencies": { - "Microsoft.NETCore.Platforms": "2.1.2", - "Microsoft.NETCore.Targets": "1.1.0" - } - }, - "runtime.native.System.IO.Compression/4.3.0": { - "dependencies": { - "Microsoft.NETCore.Platforms": "2.1.2", - "Microsoft.NETCore.Targets": "1.1.0" - } - }, - "runtime.native.System.Net.Http/4.3.0": { - "dependencies": { - "Microsoft.NETCore.Platforms": "2.1.2", - "Microsoft.NETCore.Targets": "1.1.0" - } - }, - "runtime.native.System.Security.Cryptography.Apple/4.3.0": { - "dependencies": { - "runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.Apple": "4.3.0" - } - }, - "runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { - "dependencies": { - "runtime.debian.8-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", - "runtime.fedora.23-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", - "runtime.fedora.24-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", - "runtime.opensuse.13.2-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", - "runtime.opensuse.42.1-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", - "runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", - "runtime.rhel.7-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", - "runtime.ubuntu.14.04-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", - "runtime.ubuntu.16.04-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", - "runtime.ubuntu.16.10-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0" - } - }, - "runtime.opensuse.13.2-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": {}, - "runtime.opensuse.42.1-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": {}, - "runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.Apple/4.3.0": {}, - "runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": {}, - "runtime.rhel.7-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": {}, - "runtime.ubuntu.14.04-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": {}, - "runtime.ubuntu.16.04-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": {}, - "runtime.ubuntu.16.10-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": {}, - "SonarAnalyzer.CSharp/8.52.0.60960": {}, - "StrongNamer/0.2.5": {}, - "StyleCop.Analyzers.Unstable/1.2.0.435": {}, - "System.AppContext/4.3.0": { - "dependencies": { - "System.Runtime": "4.3.0" - } - }, - "System.Buffers/4.3.0": { - "dependencies": { - "System.Diagnostics.Debug": "4.3.0", - "System.Diagnostics.Tracing": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Threading": "4.3.0" - } - }, - "System.Collections/4.3.0": { - "dependencies": { - "Microsoft.NETCore.Platforms": "2.1.2", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0" - } - }, - "System.Collections.Concurrent/4.3.0": { - "dependencies": { - "System.Collections": "4.3.0", - "System.Diagnostics.Debug": "4.3.0", - "System.Diagnostics.Tracing": "4.3.0", - "System.Globalization": "4.3.0", - "System.Reflection": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Threading": "4.3.0", - "System.Threading.Tasks": "4.3.0" - } - }, - "System.Collections.Immutable/5.0.0": {}, - "System.Collections.NonGeneric/4.3.0": { - "dependencies": { - "System.Diagnostics.Debug": "4.3.0", - "System.Globalization": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Threading": "4.3.0" - } - }, - "System.Collections.Specialized/4.3.0": { - "dependencies": { - "System.Collections.NonGeneric": "4.3.0", - "System.Globalization": "4.3.0", - "System.Globalization.Extensions": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Threading": "4.3.0" - } - }, - "System.ComponentModel/4.3.0": { - "dependencies": { - "System.Runtime": "4.3.0" - } - }, - "System.ComponentModel.Annotations/4.3.0": { - "dependencies": { - "System.Collections": "4.3.0", - "System.ComponentModel": "4.3.0", - "System.Globalization": "4.3.0", - "System.Linq": "4.3.0", - "System.Reflection": "4.3.0", - "System.Reflection.Extensions": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Text.RegularExpressions": "4.3.0", - "System.Threading": "4.3.0" - } - }, - "System.ComponentModel.Primitives/4.3.0": { - "dependencies": { - "System.ComponentModel": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0" - } - }, - "System.ComponentModel.TypeConverter/4.3.0": { - "dependencies": { - "System.Collections": "4.3.0", - "System.Collections.NonGeneric": "4.3.0", - "System.Collections.Specialized": "4.3.0", - "System.ComponentModel": "4.3.0", - "System.ComponentModel.Primitives": "4.3.0", - "System.Globalization": "4.3.0", - "System.Linq": "4.3.0", - "System.Reflection": "4.3.0", - "System.Reflection.Extensions": "4.3.0", - "System.Reflection.Primitives": "4.3.0", - "System.Reflection.TypeExtensions": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Threading": "4.3.0" - } - }, - "System.Composition/1.0.31": { - "dependencies": { - "System.Composition.AttributedModel": "1.0.31", - "System.Composition.Convention": "1.0.31", - "System.Composition.Hosting": "1.0.31", - "System.Composition.Runtime": "1.0.31", - "System.Composition.TypedParts": "1.0.31" - } - }, - "System.Composition.AttributedModel/1.0.31": { - "dependencies": { - "System.Reflection": "4.3.0", - "System.Runtime": "4.3.0" - }, - "runtime": { - "lib/netstandard1.0/System.Composition.AttributedModel.dll": { - "assemblyVersion": "1.0.31.0", - "fileVersion": "4.6.24705.1" - } - } - }, - "System.Composition.Convention/1.0.31": { - "dependencies": { - "System.Collections": "4.3.0", - "System.Composition.AttributedModel": "1.0.31", - "System.Diagnostics.Debug": "4.3.0", - "System.Diagnostics.Tools": "4.3.0", - "System.Globalization": "4.3.0", - "System.Linq": "4.3.0", - "System.Linq.Expressions": "4.3.0", - "System.Reflection": "4.3.0", - "System.Reflection.Extensions": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Threading": "4.3.0" - }, - "runtime": { - "lib/netstandard1.0/System.Composition.Convention.dll": { - "assemblyVersion": "1.0.31.0", - "fileVersion": "4.6.24705.1" - } - } - }, - "System.Composition.Hosting/1.0.31": { - "dependencies": { - "System.Collections": "4.3.0", - "System.Composition.Runtime": "1.0.31", - "System.Diagnostics.Debug": "4.3.0", - "System.Diagnostics.Tools": "4.3.0", - "System.Globalization": "4.3.0", - "System.Linq": "4.3.0", - "System.Linq.Expressions": "4.3.0", - "System.ObjectModel": "4.3.0", - "System.Reflection": "4.3.0", - "System.Reflection.Extensions": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Threading": "4.3.0" - }, - "runtime": { - "lib/netstandard1.0/System.Composition.Hosting.dll": { - "assemblyVersion": "1.0.31.0", - "fileVersion": "4.6.24705.1" - } - } - }, - "System.Composition.Runtime/1.0.31": { - "dependencies": { - "System.Collections": "4.3.0", - "System.Diagnostics.Debug": "4.3.0", - "System.Diagnostics.Tools": "4.3.0", - "System.Globalization": "4.3.0", - "System.Linq": "4.3.0", - "System.Reflection": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0" - }, - "runtime": { - "lib/netstandard1.0/System.Composition.Runtime.dll": { - "assemblyVersion": "1.0.31.0", - "fileVersion": "4.6.24705.1" - } - } - }, - "System.Composition.TypedParts/1.0.31": { - "dependencies": { - "System.Collections": "4.3.0", - "System.Composition.AttributedModel": "1.0.31", - "System.Composition.Hosting": "1.0.31", - "System.Composition.Runtime": "1.0.31", - "System.Diagnostics.Debug": "4.3.0", - "System.Diagnostics.Tools": "4.3.0", - "System.Globalization": "4.3.0", - "System.Linq": "4.3.0", - "System.Linq.Expressions": "4.3.0", - "System.Reflection": "4.3.0", - "System.Reflection.Extensions": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0" - }, - "runtime": { - "lib/netstandard1.0/System.Composition.TypedParts.dll": { - "assemblyVersion": "1.0.31.0", - "fileVersion": "4.6.24705.1" - } - } - }, - "System.Configuration.ConfigurationManager/4.4.0": { - "dependencies": { - "System.Security.Cryptography.ProtectedData": "4.4.0" - }, - "runtime": { - "lib/netstandard2.0/System.Configuration.ConfigurationManager.dll": { - "assemblyVersion": "4.0.0.0", - "fileVersion": "4.6.25519.3" - } - } - }, - "System.Console/4.3.0": { - "dependencies": { - "Microsoft.NETCore.Platforms": "2.1.2", - "Microsoft.NETCore.Targets": "1.1.0", - "System.IO": "4.3.0", - "System.Runtime": "4.3.0", - "System.Text.Encoding": "4.3.0" - } - }, - "System.Diagnostics.Debug/4.3.0": { - "dependencies": { - "Microsoft.NETCore.Platforms": "2.1.2", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0" - } - }, - "System.Diagnostics.DiagnosticSource/8.0.0-preview.5.23272.1": { - "runtime": { - "lib/net8.0/System.Diagnostics.DiagnosticSource.dll": { - "assemblyVersion": "8.0.0.0", - "fileVersion": "8.0.23.27201" - } - } - }, - "System.Diagnostics.Tools/4.3.0": { - "dependencies": { - "Microsoft.NETCore.Platforms": "2.1.2", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0" - } - }, - "System.Diagnostics.TraceSource/4.3.0": { - "dependencies": { - "Microsoft.NETCore.Platforms": "2.1.2", - "System.Collections": "4.3.0", - "System.Diagnostics.Debug": "4.3.0", - "System.Globalization": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Threading": "4.3.0", - "runtime.native.System": "4.3.0" - } - }, - "System.Diagnostics.Tracing/4.3.0": { - "dependencies": { - "Microsoft.NETCore.Platforms": "2.1.2", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0" - } - }, - "System.Dynamic.Runtime/4.3.0": { - "dependencies": { - "System.Collections": "4.3.0", - "System.Diagnostics.Debug": "4.3.0", - "System.Linq": "4.3.0", - "System.Linq.Expressions": "4.3.0", - "System.ObjectModel": "4.3.0", - "System.Reflection": "4.3.0", - "System.Reflection.Emit": "4.3.0", - "System.Reflection.Emit.ILGeneration": "4.3.0", - "System.Reflection.Primitives": "4.3.0", - "System.Reflection.TypeExtensions": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Threading": "4.3.0" - } - }, - "System.Globalization/4.3.0": { - "dependencies": { - "Microsoft.NETCore.Platforms": "2.1.2", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0" - } - }, - "System.Globalization.Calendars/4.3.0": { - "dependencies": { - "Microsoft.NETCore.Platforms": "2.1.2", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Globalization": "4.3.0", - "System.Runtime": "4.3.0" - } - }, - "System.Globalization.Extensions/4.3.0": { - "dependencies": { - "Microsoft.NETCore.Platforms": "2.1.2", - "System.Globalization": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Runtime.InteropServices": "4.3.0" - } - }, - "System.IO/4.3.0": { - "dependencies": { - "Microsoft.NETCore.Platforms": "2.1.2", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0", - "System.Text.Encoding": "4.3.0", - "System.Threading.Tasks": "4.3.0" - } - }, - "System.IO.Compression/4.3.0": { - "dependencies": { - "Microsoft.NETCore.Platforms": "2.1.2", - "System.Buffers": "4.3.0", - "System.Collections": "4.3.0", - "System.Diagnostics.Debug": "4.3.0", - "System.IO": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Runtime.Handles": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Text.Encoding": "4.3.0", - "System.Threading": "4.3.0", - "System.Threading.Tasks": "4.3.0", - "runtime.native.System": "4.3.0", - "runtime.native.System.IO.Compression": "4.3.0" - } - }, - "System.IO.Compression.ZipFile/4.3.0": { - "dependencies": { - "System.Buffers": "4.3.0", - "System.IO": "4.3.0", - "System.IO.Compression": "4.3.0", - "System.IO.FileSystem": "4.3.0", - "System.IO.FileSystem.Primitives": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Text.Encoding": "4.3.0" - } - }, - "System.IO.FileSystem/4.3.0": { - "dependencies": { - "Microsoft.NETCore.Platforms": "2.1.2", - "Microsoft.NETCore.Targets": "1.1.0", - "System.IO": "4.3.0", - "System.IO.FileSystem.Primitives": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Handles": "4.3.0", - "System.Text.Encoding": "4.3.0", - "System.Threading.Tasks": "4.3.0" - } - }, - "System.IO.FileSystem.Primitives/4.3.0": { - "dependencies": { - "System.Runtime": "4.3.0" - } - }, - "System.IO.Pipelines/5.0.1": { - "runtime": { - "lib/netcoreapp3.0/System.IO.Pipelines.dll": { - "assemblyVersion": "5.0.0.1", - "fileVersion": "5.0.120.57516" - } - } - }, - "System.Linq/4.3.0": { - "dependencies": { - "System.Collections": "4.3.0", - "System.Diagnostics.Debug": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0" - } - }, - "System.Linq.Expressions/4.3.0": { - "dependencies": { - "System.Collections": "4.3.0", - "System.Diagnostics.Debug": "4.3.0", - "System.Globalization": "4.3.0", - "System.IO": "4.3.0", - "System.Linq": "4.3.0", - "System.ObjectModel": "4.3.0", - "System.Reflection": "4.3.0", - "System.Reflection.Emit": "4.3.0", - "System.Reflection.Emit.ILGeneration": "4.3.0", - "System.Reflection.Emit.Lightweight": "4.3.0", - "System.Reflection.Extensions": "4.3.0", - "System.Reflection.Primitives": "4.3.0", - "System.Reflection.TypeExtensions": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Threading": "4.3.0" - } - }, - "System.Memory/4.5.4": {}, - "System.Net.Http/4.3.0": { - "dependencies": { - "Microsoft.NETCore.Platforms": "2.1.2", - "System.Collections": "4.3.0", - "System.Diagnostics.Debug": "4.3.0", - "System.Diagnostics.DiagnosticSource": "8.0.0-preview.5.23272.1", - "System.Diagnostics.Tracing": "4.3.0", - "System.Globalization": "4.3.0", - "System.Globalization.Extensions": "4.3.0", - "System.IO": "4.3.0", - "System.IO.FileSystem": "4.3.0", - "System.Net.Primitives": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Runtime.Handles": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Security.Cryptography.Algorithms": "4.3.0", - "System.Security.Cryptography.Encoding": "4.3.0", - "System.Security.Cryptography.OpenSsl": "4.3.0", - "System.Security.Cryptography.Primitives": "4.3.0", - "System.Security.Cryptography.X509Certificates": "4.3.0", - "System.Text.Encoding": "4.3.0", - "System.Threading": "4.3.0", - "System.Threading.Tasks": "4.3.0", - "runtime.native.System": "4.3.0", - "runtime.native.System.Net.Http": "4.3.0", - "runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0" - } - }, - "System.Net.Primitives/4.3.0": { - "dependencies": { - "Microsoft.NETCore.Platforms": "2.1.2", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0", - "System.Runtime.Handles": "4.3.0" - } - }, - "System.Net.Sockets/4.3.0": { - "dependencies": { - "Microsoft.NETCore.Platforms": "2.1.2", - "Microsoft.NETCore.Targets": "1.1.0", - "System.IO": "4.3.0", - "System.Net.Primitives": "4.3.0", - "System.Runtime": "4.3.0", - "System.Threading.Tasks": "4.3.0" - } - }, - "System.ObjectModel/4.3.0": { - "dependencies": { - "System.Collections": "4.3.0", - "System.Diagnostics.Debug": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Threading": "4.3.0" - } - }, - "System.Reflection/4.3.0": { - "dependencies": { - "Microsoft.NETCore.Platforms": "2.1.2", - "Microsoft.NETCore.Targets": "1.1.0", - "System.IO": "4.3.0", - "System.Reflection.Primitives": "4.3.0", - "System.Runtime": "4.3.0" - } - }, - "System.Reflection.Emit/4.3.0": { - "dependencies": { - "System.IO": "4.3.0", - "System.Reflection": "4.3.0", - "System.Reflection.Emit.ILGeneration": "4.3.0", - "System.Reflection.Primitives": "4.3.0", - "System.Runtime": "4.3.0" - } - }, - "System.Reflection.Emit.ILGeneration/4.3.0": { - "dependencies": { - "System.Reflection": "4.3.0", - "System.Reflection.Primitives": "4.3.0", - "System.Runtime": "4.3.0" - } - }, - "System.Reflection.Emit.Lightweight/4.3.0": { - "dependencies": { - "System.Reflection": "4.3.0", - "System.Reflection.Emit.ILGeneration": "4.3.0", - "System.Reflection.Primitives": "4.3.0", - "System.Runtime": "4.3.0" - } - }, - "System.Reflection.Extensions/4.3.0": { - "dependencies": { - "Microsoft.NETCore.Platforms": "2.1.2", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Reflection": "4.3.0", - "System.Runtime": "4.3.0" - } - }, - "System.Reflection.Metadata/5.0.0": {}, - "System.Reflection.Primitives/4.3.0": { - "dependencies": { - "Microsoft.NETCore.Platforms": "2.1.2", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0" - } - }, - "System.Reflection.TypeExtensions/4.3.0": { - "dependencies": { - "System.Reflection": "4.3.0", - "System.Runtime": "4.3.0" - } - }, - "System.Resources.ResourceManager/4.3.0": { - "dependencies": { - "Microsoft.NETCore.Platforms": "2.1.2", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Globalization": "4.3.0", - "System.Reflection": "4.3.0", - "System.Runtime": "4.3.0" - } - }, - "System.Runtime/4.3.0": { - "dependencies": { - "Microsoft.NETCore.Platforms": "2.1.2", - "Microsoft.NETCore.Targets": "1.1.0" - } - }, - "System.Runtime.CompilerServices.Unsafe/5.0.0": {}, - "System.Runtime.Extensions/4.3.0": { - "dependencies": { - "Microsoft.NETCore.Platforms": "2.1.2", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0" - } - }, - "System.Runtime.Handles/4.3.0": { - "dependencies": { - "Microsoft.NETCore.Platforms": "2.1.2", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0" - } - }, - "System.Runtime.InteropServices/4.3.0": { - "dependencies": { - "Microsoft.NETCore.Platforms": "2.1.2", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Reflection": "4.3.0", - "System.Reflection.Primitives": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Handles": "4.3.0" - } - }, - "System.Runtime.InteropServices.RuntimeInformation/4.3.0": { - "dependencies": { - "System.Reflection": "4.3.0", - "System.Reflection.Extensions": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Threading": "4.3.0", - "runtime.native.System": "4.3.0" - } - }, - "System.Runtime.Numerics/4.3.0": { - "dependencies": { - "System.Globalization": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0" - } - }, - "System.Security.Cryptography.Algorithms/4.3.0": { - "dependencies": { - "Microsoft.NETCore.Platforms": "2.1.2", - "System.Collections": "4.3.0", - "System.IO": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Runtime.Handles": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Runtime.Numerics": "4.3.0", - "System.Security.Cryptography.Encoding": "4.3.0", - "System.Security.Cryptography.Primitives": "4.3.0", - "System.Text.Encoding": "4.3.0", - "runtime.native.System.Security.Cryptography.Apple": "4.3.0", - "runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0" - } - }, - "System.Security.Cryptography.Cng/4.3.0": { - "dependencies": { - "Microsoft.NETCore.Platforms": "2.1.2", - "System.IO": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Runtime.Handles": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Security.Cryptography.Algorithms": "4.3.0", - "System.Security.Cryptography.Encoding": "4.3.0", - "System.Security.Cryptography.Primitives": "4.3.0", - "System.Text.Encoding": "4.3.0" - } - }, - "System.Security.Cryptography.Csp/4.3.0": { - "dependencies": { - "Microsoft.NETCore.Platforms": "2.1.2", - "System.IO": "4.3.0", - "System.Reflection": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Runtime.Handles": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Security.Cryptography.Algorithms": "4.3.0", - "System.Security.Cryptography.Encoding": "4.3.0", - "System.Security.Cryptography.Primitives": "4.3.0", - "System.Text.Encoding": "4.3.0", - "System.Threading": "4.3.0" - } - }, - "System.Security.Cryptography.Encoding/4.3.0": { - "dependencies": { - "Microsoft.NETCore.Platforms": "2.1.2", - "System.Collections": "4.3.0", - "System.Collections.Concurrent": "4.3.0", - "System.Linq": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Runtime.Handles": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Security.Cryptography.Primitives": "4.3.0", - "System.Text.Encoding": "4.3.0", - "runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0" - } - }, - "System.Security.Cryptography.OpenSsl/4.3.0": { - "dependencies": { - "System.Collections": "4.3.0", - "System.IO": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Runtime.Handles": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Runtime.Numerics": "4.3.0", - "System.Security.Cryptography.Algorithms": "4.3.0", - "System.Security.Cryptography.Encoding": "4.3.0", - "System.Security.Cryptography.Primitives": "4.3.0", - "System.Text.Encoding": "4.3.0", - "runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0" - } - }, - "System.Security.Cryptography.Primitives/4.3.0": { - "dependencies": { - "System.Diagnostics.Debug": "4.3.0", - "System.Globalization": "4.3.0", - "System.IO": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Threading": "4.3.0", - "System.Threading.Tasks": "4.3.0" - } - }, - "System.Security.Cryptography.ProtectedData/4.4.0": { - "runtime": { - "lib/netstandard2.0/System.Security.Cryptography.ProtectedData.dll": { - "assemblyVersion": "4.0.2.0", - "fileVersion": "4.6.25519.3" - } - }, - "runtimeTargets": { - "runtimes/win/lib/netstandard2.0/System.Security.Cryptography.ProtectedData.dll": { - "rid": "win", - "assetType": "runtime", - "assemblyVersion": "4.0.2.0", - "fileVersion": "4.6.25519.3" - } - } - }, - "System.Security.Cryptography.X509Certificates/4.3.0": { - "dependencies": { - "Microsoft.NETCore.Platforms": "2.1.2", - "System.Collections": "4.3.0", - "System.Diagnostics.Debug": "4.3.0", - "System.Globalization": "4.3.0", - "System.Globalization.Calendars": "4.3.0", - "System.IO": "4.3.0", - "System.IO.FileSystem": "4.3.0", - "System.IO.FileSystem.Primitives": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Runtime.Handles": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Runtime.Numerics": "4.3.0", - "System.Security.Cryptography.Algorithms": "4.3.0", - "System.Security.Cryptography.Cng": "4.3.0", - "System.Security.Cryptography.Csp": "4.3.0", - "System.Security.Cryptography.Encoding": "4.3.0", - "System.Security.Cryptography.OpenSsl": "4.3.0", - "System.Security.Cryptography.Primitives": "4.3.0", - "System.Text.Encoding": "4.3.0", - "System.Threading": "4.3.0", - "runtime.native.System": "4.3.0", - "runtime.native.System.Net.Http": "4.3.0", - "runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0" - } - }, - "System.Text.Encoding/4.3.0": { - "dependencies": { - "Microsoft.NETCore.Platforms": "2.1.2", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0" - } - }, - "System.Text.Encoding.CodePages/4.5.1": { - "dependencies": { - "Microsoft.NETCore.Platforms": "2.1.2", - "System.Runtime.CompilerServices.Unsafe": "5.0.0" - } - }, - "System.Text.Encoding.Extensions/4.3.0": { - "dependencies": { - "Microsoft.NETCore.Platforms": "2.1.2", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0", - "System.Text.Encoding": "4.3.0" - } - }, - "System.Text.RegularExpressions/4.3.0": { - "dependencies": { - "System.Runtime": "4.3.0" - } - }, - "System.Threading/4.3.0": { - "dependencies": { - "System.Runtime": "4.3.0", - "System.Threading.Tasks": "4.3.0" - } - }, - "System.Threading.Tasks/4.3.0": { - "dependencies": { - "Microsoft.NETCore.Platforms": "2.1.2", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0" - } - }, - "System.Threading.Tasks.Extensions/4.5.4": {}, - "System.Threading.Timer/4.3.0": { - "dependencies": { - "Microsoft.NETCore.Platforms": "2.1.2", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0" - } - }, - "System.Xml.ReaderWriter/4.3.0": { - "dependencies": { - "System.Collections": "4.3.0", - "System.Diagnostics.Debug": "4.3.0", - "System.Globalization": "4.3.0", - "System.IO": "4.3.0", - "System.IO.FileSystem": "4.3.0", - "System.IO.FileSystem.Primitives": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Text.Encoding": "4.3.0", - "System.Text.Encoding.Extensions": "4.3.0", - "System.Text.RegularExpressions": "4.3.0", - "System.Threading.Tasks": "4.3.0", - "System.Threading.Tasks.Extensions": "4.5.4" - } - }, - "System.Xml.XDocument/4.3.0": { - "dependencies": { - "System.Collections": "4.3.0", - "System.Diagnostics.Debug": "4.3.0", - "System.Diagnostics.Tools": "4.3.0", - "System.Globalization": "4.3.0", - "System.IO": "4.3.0", - "System.Reflection": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Text.Encoding": "4.3.0", - "System.Threading": "4.3.0", - "System.Xml.ReaderWriter": "4.3.0" - } - }, - "System.Xml.XmlDocument/4.3.0": { - "dependencies": { - "System.Collections": "4.3.0", - "System.Diagnostics.Debug": "4.3.0", - "System.Globalization": "4.3.0", - "System.IO": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Text.Encoding": "4.3.0", - "System.Threading": "4.3.0", - "System.Xml.ReaderWriter": "4.3.0" - } - }, - "xunit.abstractions/2.0.3": { - "runtime": { - "lib/netstandard2.0/xunit.abstractions.dll": { - "assemblyVersion": "2.0.0.0", - "fileVersion": "2.0.0.0" - } - } - }, - "xunit.analyzers/1.0.0": {}, - "xunit.assert/2.4.2": { - "dependencies": { - "NETStandard.Library": "1.6.1" - }, - "runtime": { - "lib/netstandard1.1/xunit.assert.dll": { - "assemblyVersion": "2.4.2.0", - "fileVersion": "2.4.2.0" - } - } - }, - "Xunit.Combinatorial/1.5.25": { - "dependencies": { - "xunit.extensibility.core": "2.4.2" - }, - "runtime": { - "lib/netstandard2.0/Xunit.Combinatorial.dll": { - "assemblyVersion": "1.5.0.0", - "fileVersion": "1.5.25.38407" - } - } - }, - "xunit.core/2.4.2": { - "dependencies": { - "xunit.extensibility.core": "2.4.2", - "xunit.extensibility.execution": "2.4.2" - } - }, - "xunit.extensibility.core/2.4.2": { - "dependencies": { - "NETStandard.Library": "1.6.1", - "xunit.abstractions": "2.0.3" - }, - "runtime": { - "lib/netstandard1.1/xunit.core.dll": { - "assemblyVersion": "2.4.2.0", - "fileVersion": "2.4.2.0" - } - } - }, - "xunit.extensibility.execution/2.4.2": { - "dependencies": { - "NETStandard.Library": "1.6.1", - "xunit.extensibility.core": "2.4.2" - }, - "runtime": { - "lib/netstandard1.1/xunit.execution.dotnet.dll": { - "assemblyVersion": "2.4.2.0", - "fileVersion": "2.4.2.0" - } - } - }, - "xunit.runner.visualstudio/2.4.3": {}, - "Microsoft.Extensions.Telemetry.Abstractions/8.0.0-dev": { - "dependencies": { - "Microsoft.Extensions.Logging.Abstractions": "8.0.0-preview.5.23272.1", - "Microsoft.Extensions.ObjectPool": "8.0.0-preview.5.23273.2", - "Microsoft.Extensions.Options": "8.0.0-preview.5.23272.1", - "System.Diagnostics.DiagnosticSource": "8.0.0-preview.5.23272.1" - }, - "runtime": { - "Microsoft.Extensions.Telemetry.Abstractions.dll": {} - } - }, - "Microsoft.Gen.MeteringReports/8.0.0-dev": { - "dependencies": { - "Microsoft.CodeAnalysis": "4.0.1" - }, - "runtime": { - "Microsoft.Gen.MeteringReports.dll": {} - } - }, - "Microsoft.TestUtilities/8.0.0-dev": { - "dependencies": { - "AutoFixture.AutoMoq": "4.17.0", - "FluentAssertions": "6.2.0", - "Moq": "4.16.1", - "Moq.AutoMock": "3.1.0", - "StrongNamer": "0.2.5", - "Xunit.Combinatorial": "1.5.25", - "AutoFixture": "4.17.0", - "xunit.extensibility.execution": "2.4.2" - }, - "runtime": { - "Microsoft.TestUtilities.dll": {} - } - }, - "Microsoft.Gen.MeteringReports.Reference/8.0.0.0": { - "runtime": { - "Microsoft.Gen.MeteringReports.dll": { - "assemblyVersion": "8.0.0.0", - "fileVersion": "42.42.42.42424" - } - } - }, - "Microsoft.TestUtilities.Reference/8.0.0.0": { - "runtime": { - "Microsoft.TestUtilities.dll": { - "assemblyVersion": "8.0.0.0", - "fileVersion": "42.42.42.42424" - } - } - } - } - }, - "libraries": { - "Microsoft.Gen.MeteringReports.Roslyn3.8.Unit.Tests/8.0.0-dev": { - "type": "project", - "serviceable": false, - "sha512": "" - }, - "AutoFixture/4.17.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-efMRCG3Epc4QDELwdmQGf6/caQUleRXPRCnLAq5gLMpTuOTcOQWV12vEJ8qo678Rj97/TjjxHYu/34rGkXdVAA==", - "path": "autofixture/4.17.0", - "hashPath": "autofixture.4.17.0.nupkg.sha512" - }, - "AutoFixture.AutoMoq/4.17.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-i6xReNJM8+jjXk1LJ5UBPJMZjoOAr7mkgM1pkI40aZJ9Y2KZxRW528XmLoYzDmvIayDtvzkYd1Zns0dn7Kkr0g==", - "path": "autofixture.automoq/4.17.0", - "hashPath": "autofixture.automoq.4.17.0.nupkg.sha512" - }, - "Castle.Core/4.4.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-b5rRL5zeaau1y/5hIbI+6mGw3cwun16YjkHZnV9RRT5UyUIFsgLmNXJ0YnIN9p8Hw7K7AbG1q1UclQVU3DinAQ==", - "path": "castle.core/4.4.0", - "hashPath": "castle.core.4.4.0.nupkg.sha512" - }, - "Fare/2.1.1": { - "type": "package", - "serviceable": true, - "sha512": "sha512-HaI8puqA66YU7/9cK4Sgbs1taUTP1Ssa4QT2PIzqJ7GvAbN1QgkjbRsjH+FSbMh1MJdvS0CIwQNLtFT+KF6KpA==", - "path": "fare/2.1.1", - "hashPath": "fare.2.1.1.nupkg.sha512" - }, - "FluentAssertions/6.2.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-5YOZLB0Tay1bw+wEYZTAZlPThQ/Yntk1HSPJYluMd5PW/Xg9E8I1mRC03AKRsnuANBR0kYaHq0NX1fg7RgrGNA==", - "path": "fluentassertions/6.2.0", - "hashPath": "fluentassertions.6.2.0.nupkg.sha512" - }, - "Humanizer.Core/2.2.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-rsYXB7+iUPP8AHgQ8JP2UZI2xK2KhjcdGr9E6zX3CsZaTLCaw8M35vaAJRo1rfxeaZEVMuXeaquLVCkZ7JcZ5Q==", - "path": "humanizer.core/2.2.0", - "hashPath": "humanizer.core.2.2.0.nupkg.sha512" - }, - "Microsoft.Bcl.AsyncInterfaces/5.0.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-W8DPQjkMScOMTtJbPwmPyj9c3zYSFGawDW3jwlBOOsnY+EzZFLgNQ/UMkK35JmkNOVPdCyPr2Tw7Vv9N+KA3ZQ==", - "path": "microsoft.bcl.asyncinterfaces/5.0.0", - "hashPath": "microsoft.bcl.asyncinterfaces.5.0.0.nupkg.sha512" - }, - "Microsoft.Build.Tasks.Git/8.0.0-beta.23252.2": { - "type": "package", - "serviceable": true, - "sha512": "sha512-AmkuzGoK7EHF44CmZQ2ScZSKWsMd0c2FQBeThwedLOtYb6rbLJbuFPXwHaPw68BiaO7zHOKkMGDkiXxd9O0Rpg==", - "path": "microsoft.build.tasks.git/8.0.0-beta.23252.2", - "hashPath": "microsoft.build.tasks.git.8.0.0-beta.23252.2.nupkg.sha512" - }, - "Microsoft.CodeAnalysis/4.0.1": { - "type": "package", - "serviceable": true, - "sha512": "sha512-PIuWPA8RyLNJhsgPNsOsJPYmfKTrJOqe7+lp7KNvs4m2kFGHVvq2f8yfQ60uCbyRmLxWU4w49gNcKytjcIuBZw==", - "path": "microsoft.codeanalysis/4.0.1", - "hashPath": "microsoft.codeanalysis.4.0.1.nupkg.sha512" - }, - "Microsoft.CodeAnalysis.Analyzers/3.3.2": { - "type": "package", - "serviceable": true, - "sha512": "sha512-7xt6zTlIEizUgEsYAIgm37EbdkiMmr6fP6J9pDoKEpiGM4pi32BCPGr/IczmSJI9Zzp0a6HOzpr9OvpMP+2veA==", - "path": "microsoft.codeanalysis.analyzers/3.3.2", - "hashPath": "microsoft.codeanalysis.analyzers.3.3.2.nupkg.sha512" - }, - "Microsoft.CodeAnalysis.Common/4.0.1": { - "type": "package", - "serviceable": true, - "sha512": "sha512-SMREwaVD5SzatlWhh9aahQAtSWdb63NcE//f+bQzgHSECU6xtDtaxk0kwV+asdFfr6HtW38UeO6jvqdfzudg3w==", - "path": "microsoft.codeanalysis.common/4.0.1", - "hashPath": "microsoft.codeanalysis.common.4.0.1.nupkg.sha512" - }, - "Microsoft.CodeAnalysis.CSharp/4.0.1": { - "type": "package", - "serviceable": true, - "sha512": "sha512-Q9RxxydPpUElj/x1/qykDTUGsRoKbJG8H5XUSeMGmMu54fBiuX1xyanom9caa1oQfh5JIW1BgLxobSaWs4WyHQ==", - "path": "microsoft.codeanalysis.csharp/4.0.1", - "hashPath": "microsoft.codeanalysis.csharp.4.0.1.nupkg.sha512" - }, - "Microsoft.CodeAnalysis.CSharp.Workspaces/4.0.1": { - "type": "package", - "serviceable": true, - "sha512": "sha512-gcixGtpEjtoZV9SQcmSzf3OjHBACWUBKEEEjdIyn9E2gpd7dm+TiFFMrvJK6mW0VJp63z2MW6wBDiuaXDcFZdQ==", - "path": "microsoft.codeanalysis.csharp.workspaces/4.0.1", - "hashPath": "microsoft.codeanalysis.csharp.workspaces.4.0.1.nupkg.sha512" - }, - "Microsoft.CodeAnalysis.VisualBasic/4.0.1": { - "type": "package", - "serviceable": true, - "sha512": "sha512-o67w8S4zO7tQvB0EQeeo7i5uJCT/CrLwnLUWkkbxU2aUsZPGuRd35diuqk7e+vwnfhu27AvNJsr+1Z6EUT+fDA==", - "path": "microsoft.codeanalysis.visualbasic/4.0.1", - "hashPath": "microsoft.codeanalysis.visualbasic.4.0.1.nupkg.sha512" - }, - "Microsoft.CodeAnalysis.VisualBasic.Workspaces/4.0.1": { - "type": "package", - "serviceable": true, - "sha512": "sha512-h8Alrq7yPFHU8DLmCMbAcaKnFVsdu2bDy6IFTiw9UXDdWjGGre1/Uae+VcY/VIi/GkjmrLtRcTTHZZIyagMOWg==", - "path": "microsoft.codeanalysis.visualbasic.workspaces/4.0.1", - "hashPath": "microsoft.codeanalysis.visualbasic.workspaces.4.0.1.nupkg.sha512" - }, - "Microsoft.CodeAnalysis.Workspaces.Common/4.0.1": { - "type": "package", - "serviceable": true, - "sha512": "sha512-UfH5ZiUeXE3YIJAiJV1KTrs7uyJ4U3kqjLerYxwuugfaxedpI4lTevbXKSvns+FPL+hLTxKvldhANj8/uEYiRA==", - "path": "microsoft.codeanalysis.workspaces.common/4.0.1", - "hashPath": "microsoft.codeanalysis.workspaces.common.4.0.1.nupkg.sha512" - }, - "Microsoft.CodeCoverage/17.5.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-6FQo0O6LKDqbCiIgVQhJAf810HSjFlOj7FunWaeOGDKxy8DAbpHzPk4SfBTXz9ytaaceuIIeR6hZgplt09m+ig==", - "path": "microsoft.codecoverage/17.5.0", - "hashPath": "microsoft.codecoverage.17.5.0.nupkg.sha512" - }, - "Microsoft.Extensions.DependencyInjection.Abstractions/8.0.0-preview.5.23272.1": { - "type": "package", - "serviceable": true, - "sha512": "sha512-N3IghJGtLftmXLkEZE/pQGT+/roy3SD52vUvfPOJxlVqROlsZ7LsHjjWzAVEBCZPh32Njb8Cx3YtrZ9jQd0Row==", - "path": "microsoft.extensions.dependencyinjection.abstractions/8.0.0-preview.5.23272.1", - "hashPath": "microsoft.extensions.dependencyinjection.abstractions.8.0.0-preview.5.23272.1.nupkg.sha512" - }, - "Microsoft.Extensions.Logging.Abstractions/8.0.0-preview.5.23272.1": { - "type": "package", - "serviceable": true, - "sha512": "sha512-hTSwio6sUotYVDsoeoGu+8wpqk+oBYT98Tw8Nx3q/TUjQGNk4jtugVNmk0uGqI86T18mJG0+2+KP7Wehl/DP9g==", - "path": "microsoft.extensions.logging.abstractions/8.0.0-preview.5.23272.1", - "hashPath": "microsoft.extensions.logging.abstractions.8.0.0-preview.5.23272.1.nupkg.sha512" - }, - "Microsoft.Extensions.ObjectPool/8.0.0-preview.5.23273.2": { - "type": "package", - "serviceable": true, - "sha512": "sha512-FUK7flkPH4VZAbuJiZh+TzchyJ3eBepZCiih+mSZE5jKlQUbe3nBkARpciKPsOh7WdkiqQi8gT5vEe40R3NQbQ==", - "path": "microsoft.extensions.objectpool/8.0.0-preview.5.23273.2", - "hashPath": "microsoft.extensions.objectpool.8.0.0-preview.5.23273.2.nupkg.sha512" - }, - "Microsoft.Extensions.Options/8.0.0-preview.5.23272.1": { - "type": "package", - "serviceable": true, - "sha512": "sha512-ffM5AMRw1xl+QYjAdSSv2xF2t2bl9DpAD+GTAb8ejfsu1iHR3O2LLl8XXdz+v2F5QRqBde8E1N+xmMl88w/Beg==", - "path": "microsoft.extensions.options/8.0.0-preview.5.23272.1", - "hashPath": "microsoft.extensions.options.8.0.0-preview.5.23272.1.nupkg.sha512" - }, - "Microsoft.Extensions.Primitives/8.0.0-preview.5.23272.1": { - "type": "package", - "serviceable": true, - "sha512": "sha512-MyhXgKLRd65RiREqK0W/DIO/AJYPrTccL/cBfB455O4DV9ehy6FbBMzrzhJV2RszDcDP+JYA1K3cHfmQHLEpoA==", - "path": "microsoft.extensions.primitives/8.0.0-preview.5.23272.1", - "hashPath": "microsoft.extensions.primitives.8.0.0-preview.5.23272.1.nupkg.sha512" - }, - "Microsoft.NET.Test.Sdk/17.5.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-IJ4eSPcsRbwbAZehh1M9KgejSy0u3d0wAdkJytfCh67zOaCl5U3ltruUEe15MqirdRqGmm/ngbjeaVeGapSZxg==", - "path": "microsoft.net.test.sdk/17.5.0", - "hashPath": "microsoft.net.test.sdk.17.5.0.nupkg.sha512" - }, - "Microsoft.NETCore.Platforms/2.1.2": { - "type": "package", - "serviceable": true, - "sha512": "sha512-mOJy3M0UN+LUG21dLGMxaWZEP6xYpQEpLuvuEQBaownaX4YuhH6NmNUlN9si+vNkAS6dwJ//N1O4DmLf2CikVg==", - "path": "microsoft.netcore.platforms/2.1.2", - "hashPath": "microsoft.netcore.platforms.2.1.2.nupkg.sha512" - }, - "Microsoft.NETCore.Targets/1.1.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-aOZA3BWfz9RXjpzt0sRJJMjAscAUm3Hoa4UWAfceV9UTYxgwZ1lZt5nO2myFf+/jetYQo4uTP7zS8sJY67BBxg==", - "path": "microsoft.netcore.targets/1.1.0", - "hashPath": "microsoft.netcore.targets.1.1.0.nupkg.sha512" - }, - "Microsoft.SourceLink.AzureRepos.Git/8.0.0-beta.23252.2": { - "type": "package", - "serviceable": true, - "sha512": "sha512-+MyyxoSorb2TD5XzQ5ZW6o6XWjvedBSZgc+7AJNxWwIwAejy9ObGhcv22G9+n+nUjUHlVIkt3HXouQPHbm8kjQ==", - "path": "microsoft.sourcelink.azurerepos.git/8.0.0-beta.23252.2", - "hashPath": "microsoft.sourcelink.azurerepos.git.8.0.0-beta.23252.2.nupkg.sha512" - }, - "Microsoft.SourceLink.Common/8.0.0-beta.23252.2": { - "type": "package", - "serviceable": true, - "sha512": "sha512-E9nnMi6RRrMGzrcJDZ3U1PnunYwysTIH4AsEPJIFPLt0cHvVSMJLw6B3JeYZ1KjvLkCUmLiL5TiUfjC6F//I4A==", - "path": "microsoft.sourcelink.common/8.0.0-beta.23252.2", - "hashPath": "microsoft.sourcelink.common.8.0.0-beta.23252.2.nupkg.sha512" - }, - "Microsoft.SourceLink.GitHub/8.0.0-beta.23252.2": { - "type": "package", - "serviceable": true, - "sha512": "sha512-rjx+CRlfZeGl/2hbP+Ty1OQuEjWBll4TCUgVRY9pw4n/FMwNj0B+LYVobeH9vnvmmiPfAnHePVcZiCm/cIaRVw==", - "path": "microsoft.sourcelink.github/8.0.0-beta.23252.2", - "hashPath": "microsoft.sourcelink.github.8.0.0-beta.23252.2.nupkg.sha512" - }, - "Microsoft.TestPlatform.ObjectModel/17.5.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-QwiBJcC/oEA1kojOaB0uPWOIo4i6BYuTBBYJVhUvmXkyYqZ2Ut/VZfgi+enf8LF8J4sjO98oRRFt39MiRorcIw==", - "path": "microsoft.testplatform.objectmodel/17.5.0", - "hashPath": "microsoft.testplatform.objectmodel.17.5.0.nupkg.sha512" - }, - "Microsoft.TestPlatform.TestHost/17.5.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-X86aikwp9d4SDcBChwzQYZihTPGEtMdDk+9t64emAl7N0Tq+OmlLAoW+Rs+2FB2k6QdUicSlT4QLO2xABRokaw==", - "path": "microsoft.testplatform.testhost/17.5.0", - "hashPath": "microsoft.testplatform.testhost.17.5.0.nupkg.sha512" - }, - "Microsoft.VisualStudio.Threading.Analyzers/17.5.22": { - "type": "package", - "serviceable": true, - "sha512": "sha512-WzCsniKpC6S9yAerB+Od8pK8RytxW+fFSZ+GjL0y0XdIb7H/os71bWFbKMXxB1omDLZHNm1IdBlcLQm4KmS/AQ==", - "path": "microsoft.visualstudio.threading.analyzers/17.5.22", - "hashPath": "microsoft.visualstudio.threading.analyzers.17.5.22.nupkg.sha512" - }, - "Microsoft.Win32.Primitives/4.3.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-9ZQKCWxH7Ijp9BfahvL2Zyf1cJIk8XYLF6Yjzr2yi0b2cOut/HQ31qf1ThHAgCc3WiZMdnWcfJCgN82/0UunxA==", - "path": "microsoft.win32.primitives/4.3.0", - "hashPath": "microsoft.win32.primitives.4.3.0.nupkg.sha512" - }, - "Moq/4.16.1": { - "type": "package", - "serviceable": true, - "sha512": "sha512-bw3R9q8cVNhWXNpnvWb0OGP4HadS4zvClq+T1zf7AF+tLY1haZ2AvbHidQekf4PDv1T40c6brZeT/V0IBq7cEQ==", - "path": "moq/4.16.1", - "hashPath": "moq.4.16.1.nupkg.sha512" - }, - "Moq.AutoMock/3.1.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-4FOnn9vEsMxGCqk9saSPur5LUYlrVri+hwTIMJ8vp1yHFaD4621ogcsvD+KnOuJVF4N/gQSofGMg2mrWlvEg/w==", - "path": "moq.automock/3.1.0", - "hashPath": "moq.automock.3.1.0.nupkg.sha512" - }, - "NETStandard.Library/1.6.1": { - "type": "package", - "serviceable": true, - "sha512": "sha512-WcSp3+vP+yHNgS8EV5J7pZ9IRpeDuARBPN28by8zqff1wJQXm26PVU8L3/fYLBJVU7BtDyqNVWq2KlCVvSSR4A==", - "path": "netstandard.library/1.6.1", - "hashPath": "netstandard.library.1.6.1.nupkg.sha512" - }, - "Newtonsoft.Json/13.0.1": { - "type": "package", - "serviceable": true, - "sha512": "sha512-ppPFpBcvxdsfUonNcvITKqLl3bqxWbDCZIzDWHzjpdAHRFfZe0Dw9HmA0+za13IdyrgJwpkDTDA9fHaxOrt20A==", - "path": "newtonsoft.json/13.0.1", - "hashPath": "newtonsoft.json.13.0.1.nupkg.sha512" - }, - "NuGet.Frameworks/5.11.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-eaiXkUjC4NPcquGWzAGMXjuxvLwc6XGKMptSyOGQeT0X70BUZObuybJFZLA0OfTdueLd3US23NBPTBb6iF3V1Q==", - "path": "nuget.frameworks/5.11.0", - "hashPath": "nuget.frameworks.5.11.0.nupkg.sha512" - }, - "runtime.debian.8-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-HdSSp5MnJSsg08KMfZThpuLPJpPwE5hBXvHwoKWosyHHfe8Mh5WKT0ylEOf6yNzX6Ngjxe4Whkafh5q7Ymac4Q==", - "path": "runtime.debian.8-x64.runtime.native.system.security.cryptography.openssl/4.3.0", - "hashPath": "runtime.debian.8-x64.runtime.native.system.security.cryptography.openssl.4.3.0.nupkg.sha512" - }, - "runtime.fedora.23-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-+yH1a49wJMy8Zt4yx5RhJrxO/DBDByAiCzNwiETI+1S4mPdCu0OY4djdciC7Vssk0l22wQaDLrXxXkp+3+7bVA==", - "path": "runtime.fedora.23-x64.runtime.native.system.security.cryptography.openssl/4.3.0", - "hashPath": "runtime.fedora.23-x64.runtime.native.system.security.cryptography.openssl.4.3.0.nupkg.sha512" - }, - "runtime.fedora.24-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-c3YNH1GQJbfIPJeCnr4avseugSqPrxwIqzthYyZDN6EuOyNOzq+y2KSUfRcXauya1sF4foESTgwM5e1A8arAKw==", - "path": "runtime.fedora.24-x64.runtime.native.system.security.cryptography.openssl/4.3.0", - "hashPath": "runtime.fedora.24-x64.runtime.native.system.security.cryptography.openssl.4.3.0.nupkg.sha512" - }, - "runtime.native.System/4.3.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-c/qWt2LieNZIj1jGnVNsE2Kl23Ya2aSTBuXMD6V7k9KWr6l16Tqdwq+hJScEpWER9753NWC8h96PaVNY5Ld7Jw==", - "path": "runtime.native.system/4.3.0", - "hashPath": "runtime.native.system.4.3.0.nupkg.sha512" - }, - "runtime.native.System.IO.Compression/4.3.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-INBPonS5QPEgn7naufQFXJEp3zX6L4bwHgJ/ZH78aBTpeNfQMtf7C6VrAFhlq2xxWBveIOWyFzQjJ8XzHMhdOQ==", - "path": "runtime.native.system.io.compression/4.3.0", - "hashPath": "runtime.native.system.io.compression.4.3.0.nupkg.sha512" - }, - "runtime.native.System.Net.Http/4.3.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-ZVuZJqnnegJhd2k/PtAbbIcZ3aZeITq3sj06oKfMBSfphW3HDmk/t4ObvbOk/JA/swGR0LNqMksAh/f7gpTROg==", - "path": "runtime.native.system.net.http/4.3.0", - "hashPath": "runtime.native.system.net.http.4.3.0.nupkg.sha512" - }, - "runtime.native.System.Security.Cryptography.Apple/4.3.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-DloMk88juo0OuOWr56QG7MNchmafTLYWvABy36izkrLI5VledI0rq28KGs1i9wbpeT9NPQrx/wTf8U2vazqQ3Q==", - "path": "runtime.native.system.security.cryptography.apple/4.3.0", - "hashPath": "runtime.native.system.security.cryptography.apple.4.3.0.nupkg.sha512" - }, - "runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-NS1U+700m4KFRHR5o4vo9DSlTmlCKu/u7dtE5sUHVIPB+xpXxYQvgBgA6wEIeCz6Yfn0Z52/72WYsToCEPJnrw==", - "path": "runtime.native.system.security.cryptography.openssl/4.3.0", - "hashPath": "runtime.native.system.security.cryptography.openssl.4.3.0.nupkg.sha512" - }, - "runtime.opensuse.13.2-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-b3pthNgxxFcD+Pc0WSEoC0+md3MyhRS6aCEeenvNE3Fdw1HyJ18ZhRFVJJzIeR/O/jpxPboB805Ho0T3Ul7w8A==", - "path": "runtime.opensuse.13.2-x64.runtime.native.system.security.cryptography.openssl/4.3.0", - "hashPath": "runtime.opensuse.13.2-x64.runtime.native.system.security.cryptography.openssl.4.3.0.nupkg.sha512" - }, - "runtime.opensuse.42.1-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-KeLz4HClKf+nFS7p/6Fi/CqyLXh81FpiGzcmuS8DGi9lUqSnZ6Es23/gv2O+1XVGfrbNmviF7CckBpavkBoIFQ==", - "path": "runtime.opensuse.42.1-x64.runtime.native.system.security.cryptography.openssl/4.3.0", - "hashPath": "runtime.opensuse.42.1-x64.runtime.native.system.security.cryptography.openssl.4.3.0.nupkg.sha512" - }, - "runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.Apple/4.3.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-kVXCuMTrTlxq4XOOMAysuNwsXWpYeboGddNGpIgNSZmv1b6r/s/DPk0fYMB7Q5Qo4bY68o48jt4T4y5BVecbCQ==", - "path": "runtime.osx.10.10-x64.runtime.native.system.security.cryptography.apple/4.3.0", - "hashPath": "runtime.osx.10.10-x64.runtime.native.system.security.cryptography.apple.4.3.0.nupkg.sha512" - }, - "runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-X7IdhILzr4ROXd8mI1BUCQMSHSQwelUlBjF1JyTKCjXaOGn2fB4EKBxQbCK2VjO3WaWIdlXZL3W6TiIVnrhX4g==", - "path": "runtime.osx.10.10-x64.runtime.native.system.security.cryptography.openssl/4.3.0", - "hashPath": "runtime.osx.10.10-x64.runtime.native.system.security.cryptography.openssl.4.3.0.nupkg.sha512" - }, - "runtime.rhel.7-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-nyFNiCk/r+VOiIqreLix8yN+q3Wga9+SE8BCgkf+2BwEKiNx6DyvFjCgkfV743/grxv8jHJ8gUK4XEQw7yzRYg==", - "path": "runtime.rhel.7-x64.runtime.native.system.security.cryptography.openssl/4.3.0", - "hashPath": "runtime.rhel.7-x64.runtime.native.system.security.cryptography.openssl.4.3.0.nupkg.sha512" - }, - "runtime.ubuntu.14.04-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-ytoewC6wGorL7KoCAvRfsgoJPJbNq+64k2SqW6JcOAebWsFUvCCYgfzQMrnpvPiEl4OrblUlhF2ji+Q1+SVLrQ==", - "path": "runtime.ubuntu.14.04-x64.runtime.native.system.security.cryptography.openssl/4.3.0", - "hashPath": "runtime.ubuntu.14.04-x64.runtime.native.system.security.cryptography.openssl.4.3.0.nupkg.sha512" - }, - "runtime.ubuntu.16.04-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-I8bKw2I8k58Wx7fMKQJn2R8lamboCAiHfHeV/pS65ScKWMMI0+wJkLYlEKvgW1D/XvSl/221clBoR2q9QNNM7A==", - "path": "runtime.ubuntu.16.04-x64.runtime.native.system.security.cryptography.openssl/4.3.0", - "hashPath": "runtime.ubuntu.16.04-x64.runtime.native.system.security.cryptography.openssl.4.3.0.nupkg.sha512" - }, - "runtime.ubuntu.16.10-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-VB5cn/7OzUfzdnC8tqAIMQciVLiq2epm2NrAm1E9OjNRyG4lVhfR61SMcLizejzQP8R8Uf/0l5qOIbUEi+RdEg==", - "path": "runtime.ubuntu.16.10-x64.runtime.native.system.security.cryptography.openssl/4.3.0", - "hashPath": "runtime.ubuntu.16.10-x64.runtime.native.system.security.cryptography.openssl.4.3.0.nupkg.sha512" - }, - "SonarAnalyzer.CSharp/8.52.0.60960": { - "type": "package", - "serviceable": true, - "sha512": "sha512-XZX2dwJaM0EmXUrbz1AET6GnXEMDorPlp9e7B3cQvyZG3eGs6Xmk//ZDybqbPuvPukbr9eOmFrsUxyrtiHm2LQ==", - "path": "sonaranalyzer.csharp/8.52.0.60960", - "hashPath": "sonaranalyzer.csharp.8.52.0.60960.nupkg.sha512" - }, - "StrongNamer/0.2.5": { - "type": "package", - "serviceable": true, - "sha512": "sha512-1IWl8gYnsTC6NXHz63iDpXL8r0y5x0M/Cnq/Ju5uM17gTOQYSeclMkgQsvmGglJEqAwVxayY1sIUR3bb2MAy5Q==", - "path": "strongnamer/0.2.5", - "hashPath": "strongnamer.0.2.5.nupkg.sha512" - }, - "StyleCop.Analyzers.Unstable/1.2.0.435": { - "type": "package", - "serviceable": true, - "sha512": "sha512-ouwPWZxbOV3SmCZxIRqHvljkSzkCyi1tDoMzQtDb/bRP8ctASV/iRJr+A2Gdj0QLaLmWnqTWDrH82/iP+X80Lg==", - "path": "stylecop.analyzers.unstable/1.2.0.435", - "hashPath": "stylecop.analyzers.unstable.1.2.0.435.nupkg.sha512" - }, - "System.AppContext/4.3.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-fKC+rmaLfeIzUhagxY17Q9siv/sPrjjKcfNg1Ic8IlQkZLipo8ljcaZQu4VtI4Jqbzjc2VTjzGLF6WmsRXAEgA==", - "path": "system.appcontext/4.3.0", - "hashPath": "system.appcontext.4.3.0.nupkg.sha512" - }, - "System.Buffers/4.3.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-ratu44uTIHgeBeI0dE8DWvmXVBSo4u7ozRZZHOMmK/JPpYyo0dAfgSiHlpiObMQ5lEtEyIXA40sKRYg5J6A8uQ==", - "path": "system.buffers/4.3.0", - "hashPath": "system.buffers.4.3.0.nupkg.sha512" - }, - "System.Collections/4.3.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-3Dcj85/TBdVpL5Zr+gEEBUuFe2icOnLalmEh9hfck1PTYbbyWuZgh4fmm2ysCLTrqLQw6t3TgTyJ+VLp+Qb+Lw==", - "path": "system.collections/4.3.0", - "hashPath": "system.collections.4.3.0.nupkg.sha512" - }, - "System.Collections.Concurrent/4.3.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-ztl69Xp0Y/UXCL+3v3tEU+lIy+bvjKNUmopn1wep/a291pVPK7dxBd6T7WnlQqRog+d1a/hSsgRsmFnIBKTPLQ==", - "path": "system.collections.concurrent/4.3.0", - "hashPath": "system.collections.concurrent.4.3.0.nupkg.sha512" - }, - "System.Collections.Immutable/5.0.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-FXkLXiK0sVVewcso0imKQoOxjoPAj42R8HtjjbSjVPAzwDfzoyoznWxgA3c38LDbN9SJux1xXoXYAhz98j7r2g==", - "path": "system.collections.immutable/5.0.0", - "hashPath": "system.collections.immutable.5.0.0.nupkg.sha512" - }, - "System.Collections.NonGeneric/4.3.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-prtjIEMhGUnQq6RnPEYLpFt8AtLbp9yq2zxOSrY7KJJZrw25Fi97IzBqY7iqssbM61Ek5b8f3MG/sG1N2sN5KA==", - "path": "system.collections.nongeneric/4.3.0", - "hashPath": "system.collections.nongeneric.4.3.0.nupkg.sha512" - }, - "System.Collections.Specialized/4.3.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-Epx8PoVZR0iuOnJJDzp7pWvdfMMOAvpUo95pC4ScH2mJuXkKA2Y4aR3cG9qt2klHgSons1WFh4kcGW7cSXvrxg==", - "path": "system.collections.specialized/4.3.0", - "hashPath": "system.collections.specialized.4.3.0.nupkg.sha512" - }, - "System.ComponentModel/4.3.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-VyGn1jGRZVfxnh8EdvDCi71v3bMXrsu8aYJOwoV7SNDLVhiEqwP86pPMyRGsDsxhXAm2b3o9OIqeETfN5qfezw==", - "path": "system.componentmodel/4.3.0", - "hashPath": "system.componentmodel.4.3.0.nupkg.sha512" - }, - "System.ComponentModel.Annotations/4.3.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-SY2RLItHt43rd8J9D8M8e8NM4m+9WLN2uUd9G0n1I4hj/7w+v3pzK6ZBjexlG1/2xvLKQsqir3UGVSyBTXMLWA==", - "path": "system.componentmodel.annotations/4.3.0", - "hashPath": "system.componentmodel.annotations.4.3.0.nupkg.sha512" - }, - "System.ComponentModel.Primitives/4.3.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-j8GUkCpM8V4d4vhLIIoBLGey2Z5bCkMVNjEZseyAlm4n5arcsJOeI3zkUP+zvZgzsbLTYh4lYeP/ZD/gdIAPrw==", - "path": "system.componentmodel.primitives/4.3.0", - "hashPath": "system.componentmodel.primitives.4.3.0.nupkg.sha512" - }, - "System.ComponentModel.TypeConverter/4.3.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-16pQ6P+EdhcXzPiEK4kbA953Fu0MNG2ovxTZU81/qsCd1zPRsKc3uif5NgvllCY598k6bI0KUyKW8fanlfaDQg==", - "path": "system.componentmodel.typeconverter/4.3.0", - "hashPath": "system.componentmodel.typeconverter.4.3.0.nupkg.sha512" - }, - "System.Composition/1.0.31": { - "type": "package", - "serviceable": true, - "sha512": "sha512-I+D26qpYdoklyAVUdqwUBrEIckMNjAYnuPJy/h9dsQItpQwVREkDFs4b4tkBza0kT2Yk48Lcfsv2QQ9hWsh9Iw==", - "path": "system.composition/1.0.31", - "hashPath": "system.composition.1.0.31.nupkg.sha512" - }, - "System.Composition.AttributedModel/1.0.31": { - "type": "package", - "serviceable": true, - "sha512": "sha512-NHWhkM3ZkspmA0XJEsKdtTt1ViDYuojgSND3yHhTzwxepiwqZf+BCWuvCbjUt4fe0NxxQhUDGJ5km6sLjo9qnQ==", - "path": "system.composition.attributedmodel/1.0.31", - "hashPath": "system.composition.attributedmodel.1.0.31.nupkg.sha512" - }, - "System.Composition.Convention/1.0.31": { - "type": "package", - "serviceable": true, - "sha512": "sha512-GLjh2Ju71k6C0qxMMtl4efHa68NmWeIUYh4fkUI8xbjQrEBvFmRwMDFcylT8/PR9SQbeeL48IkFxU/+gd0nYEQ==", - "path": "system.composition.convention/1.0.31", - "hashPath": "system.composition.convention.1.0.31.nupkg.sha512" - }, - "System.Composition.Hosting/1.0.31": { - "type": "package", - "serviceable": true, - "sha512": "sha512-fN1bT4RX4vUqjbgoyuJFVUizAl2mYF5VAb+bVIxIYZSSc0BdnX+yGAxcavxJuDDCQ1K+/mdpgyEFc8e9ikjvrg==", - "path": "system.composition.hosting/1.0.31", - "hashPath": "system.composition.hosting.1.0.31.nupkg.sha512" - }, - "System.Composition.Runtime/1.0.31": { - "type": "package", - "serviceable": true, - "sha512": "sha512-0LEJN+2NVM89CE4SekDrrk5tHV5LeATltkp+9WNYrR+Huiyt0vaCqHbbHtVAjPyeLWIc8dOz/3kthRBj32wGQg==", - "path": "system.composition.runtime/1.0.31", - "hashPath": "system.composition.runtime.1.0.31.nupkg.sha512" - }, - "System.Composition.TypedParts/1.0.31": { - "type": "package", - "serviceable": true, - "sha512": "sha512-0Zae/FtzeFgDBBuILeIbC/T9HMYbW4olAmi8XqqAGosSOWvXfiQLfARZEhiGd0LVXaYgXr0NhxiU1LldRP1fpQ==", - "path": "system.composition.typedparts/1.0.31", - "hashPath": "system.composition.typedparts.1.0.31.nupkg.sha512" - }, - "System.Configuration.ConfigurationManager/4.4.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-gWwQv/Ug1qWJmHCmN17nAbxJYmQBM/E94QxKLksvUiiKB1Ld3Sc/eK1lgmbSjDFxkQhVuayI/cGFZhpBSodLrg==", - "path": "system.configuration.configurationmanager/4.4.0", - "hashPath": "system.configuration.configurationmanager.4.4.0.nupkg.sha512" - }, - "System.Console/4.3.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-DHDrIxiqk1h03m6khKWV2X8p/uvN79rgSqpilL6uzpmSfxfU5ng8VcPtW4qsDsQDHiTv6IPV9TmD5M/vElPNLg==", - "path": "system.console/4.3.0", - "hashPath": "system.console.4.3.0.nupkg.sha512" - }, - "System.Diagnostics.Debug/4.3.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-ZUhUOdqmaG5Jk3Xdb8xi5kIyQYAA4PnTNlHx1mu9ZY3qv4ELIdKbnL/akbGaKi2RnNUWaZsAs31rvzFdewTj2g==", - "path": "system.diagnostics.debug/4.3.0", - "hashPath": "system.diagnostics.debug.4.3.0.nupkg.sha512" - }, - "System.Diagnostics.DiagnosticSource/8.0.0-preview.5.23272.1": { - "type": "package", - "serviceable": true, - "sha512": "sha512-z8aWPWEARVzr7lFRzlS/C05DUbzO8A/CSC3RRao8ik8CedaDXmbbUeOAH3WGS3XDbF/sY6K6uhwZacwWxzmXgA==", - "path": "system.diagnostics.diagnosticsource/8.0.0-preview.5.23272.1", - "hashPath": "system.diagnostics.diagnosticsource.8.0.0-preview.5.23272.1.nupkg.sha512" - }, - "System.Diagnostics.Tools/4.3.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-UUvkJfSYJMM6x527dJg2VyWPSRqIVB0Z7dbjHst1zmwTXz5CcXSYJFWRpuigfbO1Lf7yfZiIaEUesfnl/g5EyA==", - "path": "system.diagnostics.tools/4.3.0", - "hashPath": "system.diagnostics.tools.4.3.0.nupkg.sha512" - }, - "System.Diagnostics.TraceSource/4.3.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-VnYp1NxGx8Ww731y2LJ1vpfb/DKVNKEZ8Jsh5SgQTZREL/YpWRArgh9pI8CDLmgHspZmLL697CaLvH85qQpRiw==", - "path": "system.diagnostics.tracesource/4.3.0", - "hashPath": "system.diagnostics.tracesource.4.3.0.nupkg.sha512" - }, - "System.Diagnostics.Tracing/4.3.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-rswfv0f/Cqkh78rA5S8eN8Neocz234+emGCtTF3lxPY96F+mmmUen6tbn0glN6PMvlKQb9bPAY5e9u7fgPTkKw==", - "path": "system.diagnostics.tracing/4.3.0", - "hashPath": "system.diagnostics.tracing.4.3.0.nupkg.sha512" - }, - "System.Dynamic.Runtime/4.3.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-SNVi1E/vfWUAs/WYKhE9+qlS6KqK0YVhnlT0HQtr8pMIA8YX3lwy3uPMownDwdYISBdmAF/2holEIldVp85Wag==", - "path": "system.dynamic.runtime/4.3.0", - "hashPath": "system.dynamic.runtime.4.3.0.nupkg.sha512" - }, - "System.Globalization/4.3.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-kYdVd2f2PAdFGblzFswE4hkNANJBKRmsfa2X5LG2AcWE1c7/4t0pYae1L8vfZ5xvE2nK/R9JprtToA61OSHWIg==", - "path": "system.globalization/4.3.0", - "hashPath": "system.globalization.4.3.0.nupkg.sha512" - }, - "System.Globalization.Calendars/4.3.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-GUlBtdOWT4LTV3I+9/PJW+56AnnChTaOqqTLFtdmype/L500M2LIyXgmtd9X2P2VOkmJd5c67H5SaC2QcL1bFA==", - "path": "system.globalization.calendars/4.3.0", - "hashPath": "system.globalization.calendars.4.3.0.nupkg.sha512" - }, - "System.Globalization.Extensions/4.3.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-FhKmdR6MPG+pxow6wGtNAWdZh7noIOpdD5TwQ3CprzgIE1bBBoim0vbR1+AWsWjQmU7zXHgQo4TWSP6lCeiWcQ==", - "path": "system.globalization.extensions/4.3.0", - "hashPath": "system.globalization.extensions.4.3.0.nupkg.sha512" - }, - "System.IO/4.3.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-3qjaHvxQPDpSOYICjUoTsmoq5u6QJAFRUITgeT/4gqkF1bajbSmb1kwSxEA8AHlofqgcKJcM8udgieRNhaJ5Cg==", - "path": "system.io/4.3.0", - "hashPath": "system.io.4.3.0.nupkg.sha512" - }, - "System.IO.Compression/4.3.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-YHndyoiV90iu4iKG115ibkhrG+S3jBm8Ap9OwoUAzO5oPDAWcr0SFwQFm0HjM8WkEZWo0zvLTyLmbvTkW1bXgg==", - "path": "system.io.compression/4.3.0", - "hashPath": "system.io.compression.4.3.0.nupkg.sha512" - }, - "System.IO.Compression.ZipFile/4.3.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-G4HwjEsgIwy3JFBduZ9quBkAu+eUwjIdJleuNSgmUojbH6O3mlvEIme+GHx/cLlTAPcrnnL7GqvB9pTlWRfhOg==", - "path": "system.io.compression.zipfile/4.3.0", - "hashPath": "system.io.compression.zipfile.4.3.0.nupkg.sha512" - }, - "System.IO.FileSystem/4.3.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-3wEMARTnuio+ulnvi+hkRNROYwa1kylvYahhcLk4HSoVdl+xxTFVeVlYOfLwrDPImGls0mDqbMhrza8qnWPTdA==", - "path": "system.io.filesystem/4.3.0", - "hashPath": "system.io.filesystem.4.3.0.nupkg.sha512" - }, - "System.IO.FileSystem.Primitives/4.3.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-6QOb2XFLch7bEc4lIcJH49nJN2HV+OC3fHDgsLVsBVBk3Y4hFAnOBGzJ2lUu7CyDDFo9IBWkSsnbkT6IBwwiMw==", - "path": "system.io.filesystem.primitives/4.3.0", - "hashPath": "system.io.filesystem.primitives.4.3.0.nupkg.sha512" - }, - "System.IO.Pipelines/5.0.1": { - "type": "package", - "serviceable": true, - "sha512": "sha512-qEePWsaq9LoEEIqhbGe6D5J8c9IqQOUuTzzV6wn1POlfdLkJliZY3OlB0j0f17uMWlqZYjH7txj+2YbyrIA8Yg==", - "path": "system.io.pipelines/5.0.1", - "hashPath": "system.io.pipelines.5.0.1.nupkg.sha512" - }, - "System.Linq/4.3.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-5DbqIUpsDp0dFftytzuMmc0oeMdQwjcP/EWxsksIz/w1TcFRkZ3yKKz0PqiYFMmEwPSWw+qNVqD7PJ889JzHbw==", - "path": "system.linq/4.3.0", - "hashPath": "system.linq.4.3.0.nupkg.sha512" - }, - "System.Linq.Expressions/4.3.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-PGKkrd2khG4CnlyJwxwwaWWiSiWFNBGlgXvJpeO0xCXrZ89ODrQ6tjEWS/kOqZ8GwEOUATtKtzp1eRgmYNfclg==", - "path": "system.linq.expressions/4.3.0", - "hashPath": "system.linq.expressions.4.3.0.nupkg.sha512" - }, - "System.Memory/4.5.4": { - "type": "package", - "serviceable": true, - "sha512": "sha512-1MbJTHS1lZ4bS4FmsJjnuGJOu88ZzTT2rLvrhW7Ygic+pC0NWA+3hgAen0HRdsocuQXCkUTdFn9yHJJhsijDXw==", - "path": "system.memory/4.5.4", - "hashPath": "system.memory.4.5.4.nupkg.sha512" - }, - "System.Net.Http/4.3.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-sYg+FtILtRQuYWSIAuNOELwVuVsxVyJGWQyOnlAzhV4xvhyFnON1bAzYYC+jjRW8JREM45R0R5Dgi8MTC5sEwA==", - "path": "system.net.http/4.3.0", - "hashPath": "system.net.http.4.3.0.nupkg.sha512" - }, - "System.Net.Primitives/4.3.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-qOu+hDwFwoZPbzPvwut2qATe3ygjeQBDQj91xlsaqGFQUI5i4ZnZb8yyQuLGpDGivEPIt8EJkd1BVzVoP31FXA==", - "path": "system.net.primitives/4.3.0", - "hashPath": "system.net.primitives.4.3.0.nupkg.sha512" - }, - "System.Net.Sockets/4.3.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-m6icV6TqQOAdgt5N/9I5KNpjom/5NFtkmGseEH+AK/hny8XrytLH3+b5M8zL/Ycg3fhIocFpUMyl/wpFnVRvdw==", - "path": "system.net.sockets/4.3.0", - "hashPath": "system.net.sockets.4.3.0.nupkg.sha512" - }, - "System.ObjectModel/4.3.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-bdX+80eKv9bN6K4N+d77OankKHGn6CH711a6fcOpMQu2Fckp/Ft4L/kW9WznHpyR0NRAvJutzOMHNNlBGvxQzQ==", - "path": "system.objectmodel/4.3.0", - "hashPath": "system.objectmodel.4.3.0.nupkg.sha512" - }, - "System.Reflection/4.3.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-KMiAFoW7MfJGa9nDFNcfu+FpEdiHpWgTcS2HdMpDvt9saK3y/G4GwprPyzqjFH9NTaGPQeWNHU+iDlDILj96aQ==", - "path": "system.reflection/4.3.0", - "hashPath": "system.reflection.4.3.0.nupkg.sha512" - }, - "System.Reflection.Emit/4.3.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-228FG0jLcIwTVJyz8CLFKueVqQK36ANazUManGaJHkO0icjiIypKW7YLWLIWahyIkdh5M7mV2dJepllLyA1SKg==", - "path": "system.reflection.emit/4.3.0", - "hashPath": "system.reflection.emit.4.3.0.nupkg.sha512" - }, - "System.Reflection.Emit.ILGeneration/4.3.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-59tBslAk9733NXLrUJrwNZEzbMAcu8k344OYo+wfSVygcgZ9lgBdGIzH/nrg3LYhXceynyvTc8t5/GD4Ri0/ng==", - "path": "system.reflection.emit.ilgeneration/4.3.0", - "hashPath": "system.reflection.emit.ilgeneration.4.3.0.nupkg.sha512" - }, - "System.Reflection.Emit.Lightweight/4.3.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-oadVHGSMsTmZsAF864QYN1t1QzZjIcuKU3l2S9cZOwDdDueNTrqq1yRj7koFfIGEnKpt6NjpL3rOzRhs4ryOgA==", - "path": "system.reflection.emit.lightweight/4.3.0", - "hashPath": "system.reflection.emit.lightweight.4.3.0.nupkg.sha512" - }, - "System.Reflection.Extensions/4.3.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-rJkrJD3kBI5B712aRu4DpSIiHRtr6QlfZSQsb0hYHrDCZORXCFjQfoipo2LaMUHoT9i1B7j7MnfaEKWDFmFQNQ==", - "path": "system.reflection.extensions/4.3.0", - "hashPath": "system.reflection.extensions.4.3.0.nupkg.sha512" - }, - "System.Reflection.Metadata/5.0.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-5NecZgXktdGg34rh1OenY1rFNDCI8xSjFr+Z4OU4cU06AQHUdRnIIEeWENu3Wl4YowbzkymAIMvi3WyK9U53pQ==", - "path": "system.reflection.metadata/5.0.0", - "hashPath": "system.reflection.metadata.5.0.0.nupkg.sha512" - }, - "System.Reflection.Primitives/4.3.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-5RXItQz5As4xN2/YUDxdpsEkMhvw3e6aNveFXUn4Hl/udNTCNhnKp8lT9fnc3MhvGKh1baak5CovpuQUXHAlIA==", - "path": "system.reflection.primitives/4.3.0", - "hashPath": "system.reflection.primitives.4.3.0.nupkg.sha512" - }, - "System.Reflection.TypeExtensions/4.3.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-7u6ulLcZbyxB5Gq0nMkQttcdBTx57ibzw+4IOXEfR+sXYQoHvjW5LTLyNr8O22UIMrqYbchJQJnos4eooYzYJA==", - "path": "system.reflection.typeextensions/4.3.0", - "hashPath": "system.reflection.typeextensions.4.3.0.nupkg.sha512" - }, - "System.Resources.ResourceManager/4.3.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-/zrcPkkWdZmI4F92gL/TPumP98AVDu/Wxr3CSJGQQ+XN6wbRZcyfSKVoPo17ilb3iOr0cCRqJInGwNMolqhS8A==", - "path": "system.resources.resourcemanager/4.3.0", - "hashPath": "system.resources.resourcemanager.4.3.0.nupkg.sha512" - }, - "System.Runtime/4.3.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-JufQi0vPQ0xGnAczR13AUFglDyVYt4Kqnz1AZaiKZ5+GICq0/1MH/mO/eAJHt/mHW1zjKBJd7kV26SrxddAhiw==", - "path": "system.runtime/4.3.0", - "hashPath": "system.runtime.4.3.0.nupkg.sha512" - }, - "System.Runtime.CompilerServices.Unsafe/5.0.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-ZD9TMpsmYJLrxbbmdvhwt9YEgG5WntEnZ/d1eH8JBX9LBp+Ju8BSBhUGbZMNVHHomWo2KVImJhTDl2hIgw/6MA==", - "path": "system.runtime.compilerservices.unsafe/5.0.0", - "hashPath": "system.runtime.compilerservices.unsafe.5.0.0.nupkg.sha512" - }, - "System.Runtime.Extensions/4.3.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-guW0uK0fn5fcJJ1tJVXYd7/1h5F+pea1r7FLSOz/f8vPEqbR2ZAknuRDvTQ8PzAilDveOxNjSfr0CHfIQfFk8g==", - "path": "system.runtime.extensions/4.3.0", - "hashPath": "system.runtime.extensions.4.3.0.nupkg.sha512" - }, - "System.Runtime.Handles/4.3.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-OKiSUN7DmTWeYb3l51A7EYaeNMnvxwE249YtZz7yooT4gOZhmTjIn48KgSsw2k2lYdLgTKNJw/ZIfSElwDRVgg==", - "path": "system.runtime.handles/4.3.0", - "hashPath": "system.runtime.handles.4.3.0.nupkg.sha512" - }, - "System.Runtime.InteropServices/4.3.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-uv1ynXqiMK8mp1GM3jDqPCFN66eJ5w5XNomaK2XD+TuCroNTLFGeZ+WCmBMcBDyTFKou3P6cR6J/QsaqDp7fGQ==", - "path": "system.runtime.interopservices/4.3.0", - "hashPath": "system.runtime.interopservices.4.3.0.nupkg.sha512" - }, - "System.Runtime.InteropServices.RuntimeInformation/4.3.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-cbz4YJMqRDR7oLeMRbdYv7mYzc++17lNhScCX0goO2XpGWdvAt60CGN+FHdePUEHCe/Jy9jUlvNAiNdM+7jsOw==", - "path": "system.runtime.interopservices.runtimeinformation/4.3.0", - "hashPath": "system.runtime.interopservices.runtimeinformation.4.3.0.nupkg.sha512" - }, - "System.Runtime.Numerics/4.3.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-yMH+MfdzHjy17l2KESnPiF2dwq7T+xLnSJar7slyimAkUh/gTrS9/UQOtv7xarskJ2/XDSNvfLGOBQPjL7PaHQ==", - "path": "system.runtime.numerics/4.3.0", - "hashPath": "system.runtime.numerics.4.3.0.nupkg.sha512" - }, - "System.Security.Cryptography.Algorithms/4.3.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-W1kd2Y8mYSCgc3ULTAZ0hOP2dSdG5YauTb1089T0/kRcN2MpSAW1izOFROrJgxSlMn3ArsgHXagigyi+ibhevg==", - "path": "system.security.cryptography.algorithms/4.3.0", - "hashPath": "system.security.cryptography.algorithms.4.3.0.nupkg.sha512" - }, - "System.Security.Cryptography.Cng/4.3.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-03idZOqFlsKRL4W+LuCpJ6dBYDUWReug6lZjBa3uJWnk5sPCUXckocevTaUA8iT/MFSrY/2HXkOt753xQ/cf8g==", - "path": "system.security.cryptography.cng/4.3.0", - "hashPath": "system.security.cryptography.cng.4.3.0.nupkg.sha512" - }, - "System.Security.Cryptography.Csp/4.3.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-X4s/FCkEUnRGnwR3aSfVIkldBmtURMhmexALNTwpjklzxWU7yjMk7GHLKOZTNkgnWnE0q7+BCf9N2LVRWxewaA==", - "path": "system.security.cryptography.csp/4.3.0", - "hashPath": "system.security.cryptography.csp.4.3.0.nupkg.sha512" - }, - "System.Security.Cryptography.Encoding/4.3.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-1DEWjZZly9ae9C79vFwqaO5kaOlI5q+3/55ohmq/7dpDyDfc8lYe7YVxJUZ5MF/NtbkRjwFRo14yM4OEo9EmDw==", - "path": "system.security.cryptography.encoding/4.3.0", - "hashPath": "system.security.cryptography.encoding.4.3.0.nupkg.sha512" - }, - "System.Security.Cryptography.OpenSsl/4.3.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-h4CEgOgv5PKVF/HwaHzJRiVboL2THYCou97zpmhjghx5frc7fIvlkY1jL+lnIQyChrJDMNEXS6r7byGif8Cy4w==", - "path": "system.security.cryptography.openssl/4.3.0", - "hashPath": "system.security.cryptography.openssl.4.3.0.nupkg.sha512" - }, - "System.Security.Cryptography.Primitives/4.3.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-7bDIyVFNL/xKeFHjhobUAQqSpJq9YTOpbEs6mR233Et01STBMXNAc/V+BM6dwYGc95gVh/Zf+iVXWzj3mE8DWg==", - "path": "system.security.cryptography.primitives/4.3.0", - "hashPath": "system.security.cryptography.primitives.4.3.0.nupkg.sha512" - }, - "System.Security.Cryptography.ProtectedData/4.4.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-cJV7ScGW7EhatRsjehfvvYVBvtiSMKgN8bOVI0bQhnF5bU7vnHVIsH49Kva7i7GWaWYvmEzkYVk1TC+gZYBEog==", - "path": "system.security.cryptography.protecteddata/4.4.0", - "hashPath": "system.security.cryptography.protecteddata.4.4.0.nupkg.sha512" - }, - "System.Security.Cryptography.X509Certificates/4.3.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-t2Tmu6Y2NtJ2um0RtcuhP7ZdNNxXEgUm2JeoA/0NvlMjAhKCnM1NX07TDl3244mVp3QU6LPEhT3HTtH1uF7IYw==", - "path": "system.security.cryptography.x509certificates/4.3.0", - "hashPath": "system.security.cryptography.x509certificates.4.3.0.nupkg.sha512" - }, - "System.Text.Encoding/4.3.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-BiIg+KWaSDOITze6jGQynxg64naAPtqGHBwDrLaCtixsa5bKiR8dpPOHA7ge3C0JJQizJE+sfkz1wV+BAKAYZw==", - "path": "system.text.encoding/4.3.0", - "hashPath": "system.text.encoding.4.3.0.nupkg.sha512" - }, - "System.Text.Encoding.CodePages/4.5.1": { - "type": "package", - "serviceable": true, - "sha512": "sha512-4J2JQXbftjPMppIHJ7IC+VXQ9XfEagN92vZZNoG12i+zReYlim5dMoXFC1Zzg7tsnKDM7JPo5bYfFK4Jheq44w==", - "path": "system.text.encoding.codepages/4.5.1", - "hashPath": "system.text.encoding.codepages.4.5.1.nupkg.sha512" - }, - "System.Text.Encoding.Extensions/4.3.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-YVMK0Bt/A43RmwizJoZ22ei2nmrhobgeiYwFzC4YAN+nue8RF6djXDMog0UCn+brerQoYVyaS+ghy9P/MUVcmw==", - "path": "system.text.encoding.extensions/4.3.0", - "hashPath": "system.text.encoding.extensions.4.3.0.nupkg.sha512" - }, - "System.Text.RegularExpressions/4.3.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-RpT2DA+L660cBt1FssIE9CAGpLFdFPuheB7pLpKpn6ZXNby7jDERe8Ua/Ne2xGiwLVG2JOqziiaVCGDon5sKFA==", - "path": "system.text.regularexpressions/4.3.0", - "hashPath": "system.text.regularexpressions.4.3.0.nupkg.sha512" - }, - "System.Threading/4.3.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-VkUS0kOBcUf3Wwm0TSbrevDDZ6BlM+b/HRiapRFWjM5O0NS0LviG0glKmFK+hhPDd1XFeSdU1GmlLhb2CoVpIw==", - "path": "system.threading/4.3.0", - "hashPath": "system.threading.4.3.0.nupkg.sha512" - }, - "System.Threading.Tasks/4.3.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-LbSxKEdOUhVe8BezB/9uOGGppt+nZf6e1VFyw6v3DN6lqitm0OSn2uXMOdtP0M3W4iMcqcivm2J6UgqiwwnXiA==", - "path": "system.threading.tasks/4.3.0", - "hashPath": "system.threading.tasks.4.3.0.nupkg.sha512" - }, - "System.Threading.Tasks.Extensions/4.5.4": { - "type": "package", - "serviceable": true, - "sha512": "sha512-zteT+G8xuGu6mS+mzDzYXbzS7rd3K6Fjb9RiZlYlJPam2/hU7JCBZBVEcywNuR+oZ1ncTvc/cq0faRr3P01OVg==", - "path": "system.threading.tasks.extensions/4.5.4", - "hashPath": "system.threading.tasks.extensions.4.5.4.nupkg.sha512" - }, - "System.Threading.Timer/4.3.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-Z6YfyYTCg7lOZjJzBjONJTFKGN9/NIYKSxhU5GRd+DTwHSZyvWp1xuI5aR+dLg+ayyC5Xv57KiY4oJ0tMO89fQ==", - "path": "system.threading.timer/4.3.0", - "hashPath": "system.threading.timer.4.3.0.nupkg.sha512" - }, - "System.Xml.ReaderWriter/4.3.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-GrprA+Z0RUXaR4N7/eW71j1rgMnEnEVlgii49GZyAjTH7uliMnrOU3HNFBr6fEDBCJCIdlVNq9hHbaDR621XBA==", - "path": "system.xml.readerwriter/4.3.0", - "hashPath": "system.xml.readerwriter.4.3.0.nupkg.sha512" - }, - "System.Xml.XDocument/4.3.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-5zJ0XDxAIg8iy+t4aMnQAu0MqVbqyvfoUVl1yDV61xdo3Vth45oA2FoY4pPkxYAH5f8ixpmTqXeEIya95x0aCQ==", - "path": "system.xml.xdocument/4.3.0", - "hashPath": "system.xml.xdocument.4.3.0.nupkg.sha512" - }, - "System.Xml.XmlDocument/4.3.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-lJ8AxvkX7GQxpC6GFCeBj8ThYVyQczx2+f/cWHJU8tjS7YfI6Cv6bon70jVEgs2CiFbmmM8b9j1oZVx0dSI2Ww==", - "path": "system.xml.xmldocument/4.3.0", - "hashPath": "system.xml.xmldocument.4.3.0.nupkg.sha512" - }, - "xunit.abstractions/2.0.3": { - "type": "package", - "serviceable": true, - "sha512": "sha512-pot1I4YOxlWjIb5jmwvvQNbTrZ3lJQ+jUGkGjWE3hEFM0l5gOnBWS+H3qsex68s5cO52g+44vpGzhAt+42vwKg==", - "path": "xunit.abstractions/2.0.3", - "hashPath": "xunit.abstractions.2.0.3.nupkg.sha512" - }, - "xunit.analyzers/1.0.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-BeO8hEgs/c8Ls2647fPfieMngncvf0D0xYNDfIO59MolxtCtVjFRd6SRc+7tj8VMqkVOuJcnc9eh4ngI2cAmLQ==", - "path": "xunit.analyzers/1.0.0", - "hashPath": "xunit.analyzers.1.0.0.nupkg.sha512" - }, - "xunit.assert/2.4.2": { - "type": "package", - "serviceable": true, - "sha512": "sha512-pxJISOFjn2XTTi1mcDCkRZrTFb9OtRRCtx2kZFNF51GdReLr1ls2rnyxvAS4JO247K3aNtflvh5Q0346K5BROA==", - "path": "xunit.assert/2.4.2", - "hashPath": "xunit.assert.2.4.2.nupkg.sha512" - }, - "Xunit.Combinatorial/1.5.25": { - "type": "package", - "serviceable": true, - "sha512": "sha512-wB5Knl4YznMl/vtfk3fv5OiTO5lKG2xjsk4kKjsvYPxNxYA4gR8rL0SKSJqhGOxUQGqAmkRragIK+sgMO5I61g==", - "path": "xunit.combinatorial/1.5.25", - "hashPath": "xunit.combinatorial.1.5.25.nupkg.sha512" - }, - "xunit.core/2.4.2": { - "type": "package", - "serviceable": true, - "sha512": "sha512-KB4yGCxNqIVyekhJLXtKSEq6BaXVp/JO3mbGVE1hxypZTLEe7h+sTbAhpA+yZW2dPtXTuiW+C1B2oxxHEkrmOw==", - "path": "xunit.core/2.4.2", - "hashPath": "xunit.core.2.4.2.nupkg.sha512" - }, - "xunit.extensibility.core/2.4.2": { - "type": "package", - "serviceable": true, - "sha512": "sha512-W1BoXTIN1C6kpVSMw25huSet25ky6IAQUNovu3zGOGN/jWnbgSoTyCrlIhmXSg0tH5nEf8q7h3OjNHOjyu5PfA==", - "path": "xunit.extensibility.core/2.4.2", - "hashPath": "xunit.extensibility.core.2.4.2.nupkg.sha512" - }, - "xunit.extensibility.execution/2.4.2": { - "type": "package", - "serviceable": true, - "sha512": "sha512-CZmgcKkwpyo8FlupZdWpJCryrAOWLh1FBPG6gmVZuPQkGQsim/oL4PcP4nfrC2hHgXUFtluvaJ0Sp9PQKUMNpg==", - "path": "xunit.extensibility.execution/2.4.2", - "hashPath": "xunit.extensibility.execution.2.4.2.nupkg.sha512" - }, - "xunit.runner.visualstudio/2.4.3": { - "type": "package", - "serviceable": true, - "sha512": "sha512-kZZSmOmKA8OBlAJaquPXnJJLM9RwQ27H7BMVqfMLUcTi9xHinWGJiWksa3D4NEtz0wZ/nxd2mogObvBgJKCRhQ==", - "path": "xunit.runner.visualstudio/2.4.3", - "hashPath": "xunit.runner.visualstudio.2.4.3.nupkg.sha512" - }, - "Microsoft.Extensions.Telemetry.Abstractions/8.0.0-dev": { - "type": "project", - "serviceable": false, - "sha512": "" - }, - "Microsoft.Gen.MeteringReports/8.0.0-dev": { - "type": "project", - "serviceable": false, - "sha512": "" - }, - "Microsoft.TestUtilities/8.0.0-dev": { - "type": "project", - "serviceable": false, - "sha512": "" - }, - "Microsoft.Gen.MeteringReports.Reference/8.0.0.0": { - "type": "reference", - "serviceable": false, - "sha512": "" - }, - "Microsoft.TestUtilities.Reference/8.0.0.0": { - "type": "reference", - "serviceable": false, - "sha512": "" - } - } -} \ No newline at end of file diff --git a/test/Generators/Microsoft.Gen.MetricsReports/GoldenReports/Microsoft.Gen.MeteringReports.Roslyn3.8.Unit.Tests.runtimeconfig.json b/test/Generators/Microsoft.Gen.MetricsReports/GoldenReports/Microsoft.Gen.MeteringReports.Roslyn3.8.Unit.Tests.runtimeconfig.json deleted file mode 100644 index 716c590e70f..00000000000 --- a/test/Generators/Microsoft.Gen.MetricsReports/GoldenReports/Microsoft.Gen.MeteringReports.Roslyn3.8.Unit.Tests.runtimeconfig.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "runtimeOptions": { - "tfm": "net8.0", - "framework": { - "name": "Microsoft.NETCore.App", - "version": "8.0.0-preview.5.23260.3" - }, - "configProperties": { - "System.Runtime.Serialization.EnableUnsafeBinaryFormatterSerialization": false - } - } -} \ No newline at end of file diff --git a/test/Generators/Microsoft.Gen.MetricsReports/GoldenReports/xunit.runner.json b/test/Generators/Microsoft.Gen.MetricsReports/GoldenReports/xunit.runner.json deleted file mode 100644 index 6e96fab28c8..00000000000 --- a/test/Generators/Microsoft.Gen.MetricsReports/GoldenReports/xunit.runner.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "diagnosticMessages": true, - "longRunningTestSeconds": 300 -} diff --git a/test/Generators/Microsoft.Gen.MetricsReports/TestClasses/MeterDimensionsAttributedWithXmlDescriptions.cs b/test/Generators/Microsoft.Gen.MetricsReports/TestClasses/MeterDimensionsAttributedWithXmlDescriptions.cs index a0661917467..3777e60d353 100644 --- a/test/Generators/Microsoft.Gen.MetricsReports/TestClasses/MeterDimensionsAttributedWithXmlDescriptions.cs +++ b/test/Generators/Microsoft.Gen.MetricsReports/TestClasses/MeterDimensionsAttributedWithXmlDescriptions.cs @@ -8,33 +8,33 @@ namespace TestClasses { [SuppressMessage("Usage", "CA1801:Review unused parameters", - Justification = "For testing emitter for classes with description for metrics.")] - Justification = "Metrics generator tests")] + Justification = "For testing emitter for classes with description for metrics.")] + Justification = "Metrics generator tests")] internal static partial class MeterDimensionsAttributedWithXmlDescriptions { public const string Dim1 = "Dim1"; - [Counter(DescripedDimensions.Dimension1, Dim1)] + [Counter(DescriptedDimensions.Dimension1, Dim1)] public static partial DescribedDimensionCounter CreatePublicCounter(Meter meter); /// - /// DimenisonDefinedInMetricClass description. + /// DimensionDefinedInMetricClass description. /// - public const string DimenisonDefinedInMetricClass = "DimenisonDefinedInMetricClass"; + public const string DimensionDefinedInMetricClass = "DimensionDefinedInMetricClass"; - [Histogram(DescripedDimensions.Dimension2, DimenisonDefinedInMetricClass)] + [Histogram(DescriptedDimensions.Dimension2, DimensionDefinedInMetricClass)] public static partial DescribedDimensionHistogram CreatePublicHistogram(Meter meter); [Counter(typeof(DimensionForStrongTypes), Name = "MyStrongTypeMetricWithDescription")] - public static partial StrongTypeCounterWithDescripedDimension CreateStrongTypeCounterWithDescibedDimensions(Meter meter); + public static partial StrongTypeCounterWithDescriptedDimension CreateStrongTypeCounterWithDescribedDimensions(Meter meter); } #pragma warning disable SA1402 // File may only contain a single type /// - /// DescripedDimensions class description. + /// DescriptedDimensions class description. /// - internal static class DescripedDimensions + internal static class DescriptedDimensions { /// /// Dimension1 description. @@ -67,7 +67,7 @@ public class DimensionForStrongTypes /// /// Gets or sets MetricEnum2. /// - [Dimension("Enum2")] + [TagName("Enum2")] public MetricOperations MetricEnum2 { get; set; } /// @@ -97,7 +97,7 @@ public class ChildClassDimensionForStrongTypes /// /// Gets or sets SomeDim. /// - [Dimension("dim2FromAttribute")] + [TagName("dim2FromAttribute")] public string? SomeDim; } @@ -111,7 +111,7 @@ public struct DimensionForStrongTypesDimensionsStruct /// /// Gets or sets Dim5Struct. /// - [Dimension("Dim5FromAttribute")] + [TagName("Dim5FromAttribute")] public string Dim5Struct { get; set; } } #pragma warning restore SA1402 // File may only contain a single type diff --git a/test/Generators/Microsoft.Gen.MetricsReports/Unit/GeneratorTests.cs b/test/Generators/Microsoft.Gen.MetricsReports/Unit/GeneratorTests.cs index 9a291bbedf1..f432257b111 100644 --- a/test/Generators/Microsoft.Gen.MetricsReports/Unit/GeneratorTests.cs +++ b/test/Generators/Microsoft.Gen.MetricsReports/Unit/GeneratorTests.cs @@ -5,6 +5,7 @@ using System.Collections.Generic; using System.Diagnostics.Metrics; using System.IO; +using System.Linq; using System.Reflection; using System.Threading; using System.Threading.Tasks; @@ -17,91 +18,154 @@ namespace Microsoft.Gen.MetricsReports.Test; -public class GeneratorTests +public class GeneratorTests(ITestOutputHelper output) { - private readonly ITestOutputHelper _output; - - public GeneratorTests(ITestOutputHelper output) - { - _output = output; - } + private const string ReportFilename = "MetricsReport.json"; [Fact] public void GeneratorShouldNotDoAnythingIfGeneralExecutionContextDoesNotHaveClassDeclarationSyntaxReceiver() { - var defaultGeneralExecutionContext = default(GeneratorExecutionContext); + GeneratorExecutionContext defaultGeneralExecutionContext = default; new MetricsReportsGenerator().Execute(defaultGeneralExecutionContext); Assert.Null(defaultGeneralExecutionContext.SyntaxReceiver); } - [Fact] - public async Task TestAll() + [Theory] + [CombinatorialData] + public async Task TestAll(bool useExplicitReportPath) { + Dictionary? options = useExplicitReportPath + ? new() { ["build_property.MetricsReportOutputPath"] = Directory.GetCurrentDirectory() } + : null; + foreach (var inputFile in Directory.GetFiles("TestClasses")) { var stem = Path.GetFileNameWithoutExtension(inputFile); - var goldenReportFile = $"GoldenReports/{stem}.json"; + var goldenFileName = Path.ChangeExtension(stem, ".json"); + var goldenReportPath = Path.Combine("GoldenReports", goldenFileName); - var tmp = Path.Combine(Directory.GetCurrentDirectory(), "MetricsReport.json"); + var generatedReportPath = Path.Combine(Directory.GetCurrentDirectory(), ReportFilename); - if (File.Exists(goldenReportFile)) + if (File.Exists(goldenReportPath)) { - var d = await RunGenerator(File.ReadAllText(inputFile)); + var d = await RunGenerator(await File.ReadAllTextAsync(inputFile), options); Assert.Empty(d); - var golden = File.ReadAllText(goldenReportFile); - var generated = File.ReadAllText(tmp); + var golden = await File.ReadAllTextAsync(goldenReportPath); + var generated = await File.ReadAllTextAsync(generatedReportPath); if (golden != generated) { - _output.WriteLine($"MISMATCH: goldenReportFile {goldenReportFile}, tmp {tmp}"); - _output.WriteLine("----"); - _output.WriteLine("golden:"); - _output.WriteLine(golden); - _output.WriteLine("----"); - _output.WriteLine("generated:"); - _output.WriteLine(generated); - _output.WriteLine("----"); + output.WriteLine($"MISMATCH: golden report {goldenReportPath}, generated {generatedReportPath}"); + output.WriteLine("----"); + output.WriteLine("golden:"); + output.WriteLine(golden); + output.WriteLine("----"); + output.WriteLine("generated:"); + output.WriteLine(generated); + output.WriteLine("----"); } + File.Delete(generatedReportPath); Assert.Equal(golden, generated); - File.Delete(tmp); } else { // generate the golden file if it doesn't already exist - _output.WriteLine($"Generating golden report: {goldenReportFile}"); - _ = await RunGenerator(File.ReadAllText(inputFile)); - File.Copy(tmp, goldenReportFile); + output.WriteLine($"Generating golden report: {goldenReportPath}"); + _ = await RunGenerator(await File.ReadAllTextAsync(inputFile), options, reportFileName: goldenFileName); } } } - private static async Task> RunGenerator( - string code, - bool includeBaseReferences = true, - bool includeMeterReferences = true, - CancellationToken cancellationToken = default) + [Fact] + public async Task ShouldNot_Generate_WhenDisabledViaConfig() { - Assembly[]? refs = null; - if (includeMeterReferences) + var inputFile = Directory.GetFiles("TestClasses").First(); + var options = new Dictionary { - refs = new[] + ["build_property.GenerateMetricsReport"] = bool.FalseString, + ["build_property.MetricsReportOutputPath"] = Path.GetTempPath() + }; + + var d = await RunGenerator(await File.ReadAllTextAsync(inputFile), options); + Assert.Empty(d); + Assert.False(File.Exists(Path.Combine(Path.GetTempPath(), ReportFilename))); + } + + [Theory] + [CombinatorialData] + public async Task Should_EmitWarning_WhenPathUnavailable(bool isReportPathProvided) + { + var inputFile = Directory.GetFiles("TestClasses").First(); + var options = new Dictionary + { + ["build_property.outputpath"] = string.Empty + }; + + if (isReportPathProvided) + { + options.Add("build_property.MetricsReportOutputPath", string.Empty); + } + + var diags = await RunGenerator(await File.ReadAllTextAsync(inputFile), options); + var diag = Assert.Single(diags); + Assert.Equal("AUDREPGEN000", diag.Id); + Assert.Equal(DiagnosticSeverity.Info, diag.Severity); + } + + [Fact] + public async Task Should_UseProjectDir_WhenOutputPathIsRelative() + { + var projectDir = Path.GetTempPath(); + var outputPath = Guid.NewGuid().ToString(); + var fullReportPath = Path.Combine(projectDir, outputPath); + Directory.CreateDirectory(fullReportPath); + + try + { + var inputFile = Directory.GetFiles("TestClasses").First(); + var options = new Dictionary { - Assembly.GetAssembly(typeof(Meter))!, - Assembly.GetAssembly(typeof(CounterAttribute))!, - Assembly.GetAssembly(typeof(HistogramAttribute))!, - Assembly.GetAssembly(typeof(GaugeAttribute))!, + ["build_property.projectdir"] = projectDir, + ["build_property.outputpath"] = outputPath }; + + var diags = await RunGenerator(await File.ReadAllTextAsync(inputFile), options); + Assert.Empty(diags); + Assert.True(File.Exists(Path.Combine(fullReportPath, ReportFilename))); + } + finally + { + Directory.Delete(fullReportPath, recursive: true); } + } + + private static async Task> RunGenerator( + string code, + Dictionary? analyzerOptions = null, + CancellationToken cancellationToken = default, + string? reportFileName = null) + { + Assembly[] refs = + [ + Assembly.GetAssembly(typeof(Meter))!, + Assembly.GetAssembly(typeof(CounterAttribute))!, + Assembly.GetAssembly(typeof(HistogramAttribute))!, + Assembly.GetAssembly(typeof(GaugeAttribute))! + ]; + + var generator = reportFileName is null + ? new MetricsReportsGenerator() + : new MetricsReportsGenerator(reportFileName); var (d, _) = await RoslynTestUtils.RunGenerator( - new MetricsReportsGenerator(), + generator, refs, new[] { code }, - new OptionsProvider(), - includeBaseReferences: includeBaseReferences, + new OptionsProvider(analyzerOptions), + includeBaseReferences: true, cancellationToken: cancellationToken).ConfigureAwait(false); return d; @@ -109,28 +173,22 @@ private static async Task> RunGenerator( private sealed class Options : AnalyzerConfigOptions { - public override bool TryGetValue(string key, out string value) - { - if (key == "build_property.GenerateMetricsReport") - { - value = bool.TrueString; - return true; - } - - if (key == "build_property.MetricsReportOutputPath") - { - value = Directory.GetCurrentDirectory(); - return true; - } + private readonly Dictionary _options; - value = null!; - return false; + public Options(Dictionary? analyzerOptions) + { + _options = analyzerOptions ?? []; + _options.TryAdd("build_property.GenerateMetricsReport", bool.TrueString); + _options.TryAdd("build_property.outputpath", Directory.GetCurrentDirectory()); } + + public override bool TryGetValue(string key, out string value) + => _options.TryGetValue(key, out value!); } - private sealed class OptionsProvider : AnalyzerConfigOptionsProvider + private sealed class OptionsProvider(Dictionary? analyzerOptions) : AnalyzerConfigOptionsProvider { - public override AnalyzerConfigOptions GlobalOptions => new Options(); + public override AnalyzerConfigOptions GlobalOptions => new Options(analyzerOptions); public override AnalyzerConfigOptions GetOptions(SyntaxTree tree) => throw new NotSupportedException(); public override AnalyzerConfigOptions GetOptions(AdditionalText textFile) => throw new NotSupportedException(); diff --git a/test/Generators/Microsoft.Gen.MetricsReports/Unit/Microsoft.Gen.MetricsReports.Unit.Tests.csproj b/test/Generators/Microsoft.Gen.MetricsReports/Unit/Microsoft.Gen.MetricsReports.Unit.Tests.csproj index c0dbef58c69..c42782b9da5 100644 --- a/test/Generators/Microsoft.Gen.MetricsReports/Unit/Microsoft.Gen.MetricsReports.Unit.Tests.csproj +++ b/test/Generators/Microsoft.Gen.MetricsReports/Unit/Microsoft.Gen.MetricsReports.Unit.Tests.csproj @@ -1,4 +1,4 @@ - + Microsoft.Gen.MetricsReports.Test Unit tests for Microsoft.Gen.MetricsReports. @@ -16,7 +16,7 @@ PreserveNewest - + GoldenReports\%(RecursiveDir)%(Filename)%(Extension) PreserveNewest From 5db5909f2861ea3c5fc5e7839f4f598cb433b5b2 Mon Sep 17 00:00:00 2001 From: Martin Taillefer Date: Thu, 7 Mar 2024 16:08:51 -0800 Subject: [PATCH 171/172] Fix incorrect diagnostic value. (#4994) - VSTHRD114 appears in two different assemblies, and so shows up twice in the diagnostics yaml files. Both uses should be configured consistently. The only manual change here is in the .yml file, everything else is generated by scripts/MakeEditorConfigs.ps1 Fixed #4991 Co-authored-by: Martin Taillefer --- bench/.editorconfig | 4 ++-- eng/Diags/Microsoft.VisualStudio.Threading.Analyzers.yml | 2 +- eng/Tools/.editorconfig | 4 ++-- src/Analyzers/.editorconfig | 4 ++-- src/Generators/.editorconfig | 4 ++-- src/LegacySupport/.editorconfig | 4 ++-- src/Libraries/.editorconfig | 4 ++-- .../build/config/Benchmark-Tier1.globalconfig | 4 ++-- .../build/config/Benchmark-Tier2.globalconfig | 4 ++-- .../build/config/Benchmark.globalconfig | 4 ++-- .../build/config/General-Tier1.globalconfig | 4 ++-- .../build/config/General-Tier2.globalconfig | 4 ++-- .../build/config/General.globalconfig | 4 ++-- .../build/config/NonProdExe-Tier1.globalconfig | 4 ++-- .../build/config/NonProdExe-Tier2.globalconfig | 4 ++-- .../build/config/NonProdExe.globalconfig | 4 ++-- .../build/config/NonProdLib-Tier1.globalconfig | 4 ++-- .../build/config/NonProdLib-Tier2.globalconfig | 4 ++-- .../build/config/NonProdLib.globalconfig | 4 ++-- .../build/config/ProdExe-Tier1.globalconfig | 4 ++-- .../build/config/ProdExe-Tier2.globalconfig | 4 ++-- .../build/config/ProdExe.globalconfig | 4 ++-- .../build/config/ProdLib-Tier1.globalconfig | 4 ++-- .../build/config/ProdLib-Tier2.globalconfig | 4 ++-- .../build/config/ProdLib.globalconfig | 4 ++-- .../build/config/Test-Tier1.globalconfig | 4 ++-- .../build/config/Test-Tier2.globalconfig | 4 ++-- .../build/config/Test.globalconfig | 4 ++-- src/Shared/.editorconfig | 4 ++-- test/.editorconfig | 4 ++-- 30 files changed, 59 insertions(+), 59 deletions(-) diff --git a/bench/.editorconfig b/bench/.editorconfig index bea91a82fa7..f66bffda880 100644 --- a/bench/.editorconfig +++ b/bench/.editorconfig @@ -1,5 +1,5 @@ # Created by DiagConfig, the diagnostic config generator -# Generated : 2024-01-25 20:57:45Z +# Generated : 2024-03-07 23:40:38Z # Max Tier : 2147483647 # Attributes: general, performance # Analyzers : ILLink.RoslynAnalyzer, Microsoft.Analyzers.Extra, Microsoft.Analyzers.Local, Microsoft.AspNetCore.App.Analyzers, Microsoft.AspNetCore.Components.Analyzers, Microsoft.CodeAnalysis.CodeStyle, Microsoft.CodeAnalysis.CSharp.CodeStyle, Microsoft.CodeAnalysis.CSharp.NetAnalyzers, Microsoft.CodeAnalysis.NetAnalyzers, Microsoft.VisualStudio.Threading.Analyzers, Microsoft.VisualStudio.Threading.Analyzers.CSharp, SonarAnalyzer.CSharp, StyleCop.Analyzers @@ -6361,7 +6361,7 @@ dotnet_diagnostic.VSTHRD113.severity = suggestion # Title : Avoid returning a null Task # Category : Usage # Help Link: https://github.com/Microsoft/vs-threading/blob/main/doc/analyzers/VSTHRD114.md -dotnet_diagnostic.VSTHRD114.severity = warning +dotnet_diagnostic.VSTHRD114.severity = error # Title : Avoid returning a null Task # Category : Usage diff --git a/eng/Diags/Microsoft.VisualStudio.Threading.Analyzers.yml b/eng/Diags/Microsoft.VisualStudio.Threading.Analyzers.yml index 36711516996..c77821fa951 100644 --- a/eng/Diags/Microsoft.VisualStudio.Threading.Analyzers.yml +++ b/eng/Diags/Microsoft.VisualStudio.Threading.Analyzers.yml @@ -80,4 +80,4 @@ Diagnostics: Tier: 1 Attributes: general: - Severity: Warning + Severity: Error diff --git a/eng/Tools/.editorconfig b/eng/Tools/.editorconfig index 9c1ca9d5128..be77d5da2f3 100644 --- a/eng/Tools/.editorconfig +++ b/eng/Tools/.editorconfig @@ -1,5 +1,5 @@ # Created by DiagConfig, the diagnostic config generator -# Generated : 2024-01-25 20:57:45Z +# Generated : 2024-03-07 23:40:38Z # Max Tier : 2147483647 # Attributes: general # Analyzers : ILLink.RoslynAnalyzer, Microsoft.Analyzers.Extra, Microsoft.Analyzers.Local, Microsoft.AspNetCore.App.Analyzers, Microsoft.AspNetCore.Components.Analyzers, Microsoft.CodeAnalysis.CodeStyle, Microsoft.CodeAnalysis.CSharp.CodeStyle, Microsoft.CodeAnalysis.CSharp.NetAnalyzers, Microsoft.CodeAnalysis.NetAnalyzers, Microsoft.VisualStudio.Threading.Analyzers, Microsoft.VisualStudio.Threading.Analyzers.CSharp, SonarAnalyzer.CSharp, StyleCop.Analyzers @@ -6353,7 +6353,7 @@ dotnet_diagnostic.VSTHRD113.severity = suggestion # Title : Avoid returning a null Task # Category : Usage # Help Link: https://github.com/Microsoft/vs-threading/blob/main/doc/analyzers/VSTHRD114.md -dotnet_diagnostic.VSTHRD114.severity = warning +dotnet_diagnostic.VSTHRD114.severity = error # Title : Avoid returning a null Task # Category : Usage diff --git a/src/Analyzers/.editorconfig b/src/Analyzers/.editorconfig index e954d5b2cff..c46aa61b062 100644 --- a/src/Analyzers/.editorconfig +++ b/src/Analyzers/.editorconfig @@ -1,5 +1,5 @@ # Created by DiagConfig, the diagnostic config generator -# Generated : 2024-01-25 20:57:43Z +# Generated : 2024-03-07 23:40:36Z # Max Tier : 2147483647 # Attributes: general, performance, production # Analyzers : ILLink.RoslynAnalyzer, Microsoft.Analyzers.Extra, Microsoft.Analyzers.Local, Microsoft.AspNetCore.App.Analyzers, Microsoft.AspNetCore.Components.Analyzers, Microsoft.CodeAnalysis.CodeStyle, Microsoft.CodeAnalysis.CSharp.CodeStyle, Microsoft.CodeAnalysis.CSharp.NetAnalyzers, Microsoft.CodeAnalysis.NetAnalyzers, Microsoft.VisualStudio.Threading.Analyzers, Microsoft.VisualStudio.Threading.Analyzers.CSharp, SonarAnalyzer.CSharp, StyleCop.Analyzers @@ -6364,7 +6364,7 @@ dotnet_diagnostic.VSTHRD113.severity = suggestion # Title : Avoid returning a null Task # Category : Usage # Help Link: https://github.com/Microsoft/vs-threading/blob/main/doc/analyzers/VSTHRD114.md -dotnet_diagnostic.VSTHRD114.severity = warning +dotnet_diagnostic.VSTHRD114.severity = error # Title : Avoid returning a null Task # Category : Usage diff --git a/src/Generators/.editorconfig b/src/Generators/.editorconfig index e954d5b2cff..c46aa61b062 100644 --- a/src/Generators/.editorconfig +++ b/src/Generators/.editorconfig @@ -1,5 +1,5 @@ # Created by DiagConfig, the diagnostic config generator -# Generated : 2024-01-25 20:57:43Z +# Generated : 2024-03-07 23:40:36Z # Max Tier : 2147483647 # Attributes: general, performance, production # Analyzers : ILLink.RoslynAnalyzer, Microsoft.Analyzers.Extra, Microsoft.Analyzers.Local, Microsoft.AspNetCore.App.Analyzers, Microsoft.AspNetCore.Components.Analyzers, Microsoft.CodeAnalysis.CodeStyle, Microsoft.CodeAnalysis.CSharp.CodeStyle, Microsoft.CodeAnalysis.CSharp.NetAnalyzers, Microsoft.CodeAnalysis.NetAnalyzers, Microsoft.VisualStudio.Threading.Analyzers, Microsoft.VisualStudio.Threading.Analyzers.CSharp, SonarAnalyzer.CSharp, StyleCop.Analyzers @@ -6364,7 +6364,7 @@ dotnet_diagnostic.VSTHRD113.severity = suggestion # Title : Avoid returning a null Task # Category : Usage # Help Link: https://github.com/Microsoft/vs-threading/blob/main/doc/analyzers/VSTHRD114.md -dotnet_diagnostic.VSTHRD114.severity = warning +dotnet_diagnostic.VSTHRD114.severity = error # Title : Avoid returning a null Task # Category : Usage diff --git a/src/LegacySupport/.editorconfig b/src/LegacySupport/.editorconfig index a65272c4a60..bc980461f04 100644 --- a/src/LegacySupport/.editorconfig +++ b/src/LegacySupport/.editorconfig @@ -1,5 +1,5 @@ # Created by DiagConfig, the diagnostic config generator -# Generated : 2024-01-25 20:57:44Z +# Generated : 2024-03-07 23:40:37Z # Max Tier : 2147483647 # Attributes: general, performance, production # Analyzers : ILLink.RoslynAnalyzer, Microsoft.Analyzers.Extra, Microsoft.Analyzers.Local, Microsoft.AspNetCore.App.Analyzers, Microsoft.AspNetCore.Components.Analyzers, Microsoft.CodeAnalysis.CodeStyle, Microsoft.CodeAnalysis.CSharp.CodeStyle, Microsoft.CodeAnalysis.CSharp.NetAnalyzers, Microsoft.CodeAnalysis.NetAnalyzers, Microsoft.VisualStudio.Threading.Analyzers, Microsoft.VisualStudio.Threading.Analyzers.CSharp, SonarAnalyzer.CSharp, StyleCop.Analyzers @@ -6364,7 +6364,7 @@ dotnet_diagnostic.VSTHRD113.severity = suggestion # Title : Avoid returning a null Task # Category : Usage # Help Link: https://github.com/Microsoft/vs-threading/blob/main/doc/analyzers/VSTHRD114.md -dotnet_diagnostic.VSTHRD114.severity = warning +dotnet_diagnostic.VSTHRD114.severity = error # Title : Avoid returning a null Task # Category : Usage diff --git a/src/Libraries/.editorconfig b/src/Libraries/.editorconfig index 6df7713e424..b74b979edaf 100644 --- a/src/Libraries/.editorconfig +++ b/src/Libraries/.editorconfig @@ -1,5 +1,5 @@ # Created by DiagConfig, the diagnostic config generator -# Generated : 2024-01-25 20:57:44Z +# Generated : 2024-03-07 23:40:36Z # Max Tier : 2147483647 # Attributes: api, general, performance, production # Analyzers : ILLink.RoslynAnalyzer, Microsoft.Analyzers.Extra, Microsoft.Analyzers.Local, Microsoft.AspNetCore.App.Analyzers, Microsoft.AspNetCore.Components.Analyzers, Microsoft.CodeAnalysis.CodeStyle, Microsoft.CodeAnalysis.CSharp.CodeStyle, Microsoft.CodeAnalysis.CSharp.NetAnalyzers, Microsoft.CodeAnalysis.NetAnalyzers, Microsoft.VisualStudio.Threading.Analyzers, Microsoft.VisualStudio.Threading.Analyzers.CSharp, SonarAnalyzer.CSharp, StyleCop.Analyzers @@ -6390,7 +6390,7 @@ dotnet_diagnostic.VSTHRD113.severity = suggestion # Title : Avoid returning a null Task # Category : Usage # Help Link: https://github.com/Microsoft/vs-threading/blob/main/doc/analyzers/VSTHRD114.md -dotnet_diagnostic.VSTHRD114.severity = warning +dotnet_diagnostic.VSTHRD114.severity = error # Title : Avoid returning a null Task # Category : Usage diff --git a/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/Benchmark-Tier1.globalconfig b/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/Benchmark-Tier1.globalconfig index 8b933e32e7b..5d33c53187a 100644 --- a/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/Benchmark-Tier1.globalconfig +++ b/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/Benchmark-Tier1.globalconfig @@ -1,5 +1,5 @@ # Created by DiagConfig, the diagnostic config generator -# Generated : 2024-01-25 20:57:49Z +# Generated : 2024-03-07 23:40:41Z # Max Tier : 1 # Attributes: general, performance # Analyzers : ILLink.RoslynAnalyzer, Microsoft.Analyzers.Extra, Microsoft.Analyzers.Local, Microsoft.AspNetCore.App.Analyzers, Microsoft.AspNetCore.Components.Analyzers, Microsoft.CodeAnalysis.CSharp.NetAnalyzers, Microsoft.CodeAnalysis.NetAnalyzers, Microsoft.VisualStudio.Threading.Analyzers, Microsoft.VisualStudio.Threading.Analyzers.CSharp, SonarAnalyzer.CSharp @@ -4462,7 +4462,7 @@ dotnet_diagnostic.VSTHRD113.severity = none # Title : Avoid returning a null Task # Category : Usage # Help Link: https://github.com/Microsoft/vs-threading/blob/main/doc/analyzers/VSTHRD114.md -dotnet_diagnostic.VSTHRD114.severity = warning +dotnet_diagnostic.VSTHRD114.severity = error # Title : Avoid returning a null Task # Category : Usage diff --git a/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/Benchmark-Tier2.globalconfig b/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/Benchmark-Tier2.globalconfig index 97f83a3dbff..9733fe11391 100644 --- a/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/Benchmark-Tier2.globalconfig +++ b/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/Benchmark-Tier2.globalconfig @@ -1,5 +1,5 @@ # Created by DiagConfig, the diagnostic config generator -# Generated : 2024-01-25 20:57:52Z +# Generated : 2024-03-07 23:40:44Z # Max Tier : 2 # Attributes: general, performance # Analyzers : ILLink.RoslynAnalyzer, Microsoft.Analyzers.Extra, Microsoft.Analyzers.Local, Microsoft.AspNetCore.App.Analyzers, Microsoft.AspNetCore.Components.Analyzers, Microsoft.CodeAnalysis.CSharp.NetAnalyzers, Microsoft.CodeAnalysis.NetAnalyzers, Microsoft.VisualStudio.Threading.Analyzers, Microsoft.VisualStudio.Threading.Analyzers.CSharp, SonarAnalyzer.CSharp @@ -4512,7 +4512,7 @@ dotnet_diagnostic.VSTHRD113.severity = suggestion # Title : Avoid returning a null Task # Category : Usage # Help Link: https://github.com/Microsoft/vs-threading/blob/main/doc/analyzers/VSTHRD114.md -dotnet_diagnostic.VSTHRD114.severity = warning +dotnet_diagnostic.VSTHRD114.severity = error # Title : Avoid returning a null Task # Category : Usage diff --git a/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/Benchmark.globalconfig b/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/Benchmark.globalconfig index 081db65eeec..24971720771 100644 --- a/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/Benchmark.globalconfig +++ b/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/Benchmark.globalconfig @@ -1,5 +1,5 @@ # Created by DiagConfig, the diagnostic config generator -# Generated : 2024-01-25 20:57:55Z +# Generated : 2024-03-07 23:40:48Z # Max Tier : 3 # Attributes: general, performance # Analyzers : ILLink.RoslynAnalyzer, Microsoft.Analyzers.Extra, Microsoft.Analyzers.Local, Microsoft.AspNetCore.App.Analyzers, Microsoft.AspNetCore.Components.Analyzers, Microsoft.CodeAnalysis.CSharp.NetAnalyzers, Microsoft.CodeAnalysis.NetAnalyzers, Microsoft.VisualStudio.Threading.Analyzers, Microsoft.VisualStudio.Threading.Analyzers.CSharp, SonarAnalyzer.CSharp @@ -4543,7 +4543,7 @@ dotnet_diagnostic.VSTHRD113.severity = suggestion # Title : Avoid returning a null Task # Category : Usage # Help Link: https://github.com/Microsoft/vs-threading/blob/main/doc/analyzers/VSTHRD114.md -dotnet_diagnostic.VSTHRD114.severity = warning +dotnet_diagnostic.VSTHRD114.severity = error # Title : Avoid returning a null Task # Category : Usage diff --git a/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/General-Tier1.globalconfig b/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/General-Tier1.globalconfig index 802eae68a5e..3007d9e3988 100644 --- a/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/General-Tier1.globalconfig +++ b/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/General-Tier1.globalconfig @@ -1,5 +1,5 @@ # Created by DiagConfig, the diagnostic config generator -# Generated : 2024-01-25 20:57:46Z +# Generated : 2024-03-07 23:40:39Z # Max Tier : 1 # Attributes: general # Analyzers : ILLink.RoslynAnalyzer, Microsoft.Analyzers.Extra, Microsoft.Analyzers.Local, Microsoft.AspNetCore.App.Analyzers, Microsoft.AspNetCore.Components.Analyzers, Microsoft.CodeAnalysis.CSharp.NetAnalyzers, Microsoft.CodeAnalysis.NetAnalyzers, Microsoft.VisualStudio.Threading.Analyzers, Microsoft.VisualStudio.Threading.Analyzers.CSharp, SonarAnalyzer.CSharp @@ -4462,7 +4462,7 @@ dotnet_diagnostic.VSTHRD113.severity = none # Title : Avoid returning a null Task # Category : Usage # Help Link: https://github.com/Microsoft/vs-threading/blob/main/doc/analyzers/VSTHRD114.md -dotnet_diagnostic.VSTHRD114.severity = warning +dotnet_diagnostic.VSTHRD114.severity = error # Title : Avoid returning a null Task # Category : Usage diff --git a/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/General-Tier2.globalconfig b/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/General-Tier2.globalconfig index e90793c42c4..f6318766b5c 100644 --- a/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/General-Tier2.globalconfig +++ b/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/General-Tier2.globalconfig @@ -1,5 +1,5 @@ # Created by DiagConfig, the diagnostic config generator -# Generated : 2024-01-25 20:57:50Z +# Generated : 2024-03-07 23:40:42Z # Max Tier : 2 # Attributes: general # Analyzers : ILLink.RoslynAnalyzer, Microsoft.Analyzers.Extra, Microsoft.Analyzers.Local, Microsoft.AspNetCore.App.Analyzers, Microsoft.AspNetCore.Components.Analyzers, Microsoft.CodeAnalysis.CSharp.NetAnalyzers, Microsoft.CodeAnalysis.NetAnalyzers, Microsoft.VisualStudio.Threading.Analyzers, Microsoft.VisualStudio.Threading.Analyzers.CSharp, SonarAnalyzer.CSharp @@ -4506,7 +4506,7 @@ dotnet_diagnostic.VSTHRD113.severity = suggestion # Title : Avoid returning a null Task # Category : Usage # Help Link: https://github.com/Microsoft/vs-threading/blob/main/doc/analyzers/VSTHRD114.md -dotnet_diagnostic.VSTHRD114.severity = warning +dotnet_diagnostic.VSTHRD114.severity = error # Title : Avoid returning a null Task # Category : Usage diff --git a/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/General.globalconfig b/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/General.globalconfig index 329158eee37..e376fe897af 100644 --- a/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/General.globalconfig +++ b/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/General.globalconfig @@ -1,5 +1,5 @@ # Created by DiagConfig, the diagnostic config generator -# Generated : 2024-01-25 20:57:53Z +# Generated : 2024-03-07 23:40:45Z # Max Tier : 3 # Attributes: general # Analyzers : ILLink.RoslynAnalyzer, Microsoft.Analyzers.Extra, Microsoft.Analyzers.Local, Microsoft.AspNetCore.App.Analyzers, Microsoft.AspNetCore.Components.Analyzers, Microsoft.CodeAnalysis.CSharp.NetAnalyzers, Microsoft.CodeAnalysis.NetAnalyzers, Microsoft.VisualStudio.Threading.Analyzers, Microsoft.VisualStudio.Threading.Analyzers.CSharp, SonarAnalyzer.CSharp @@ -4535,7 +4535,7 @@ dotnet_diagnostic.VSTHRD113.severity = suggestion # Title : Avoid returning a null Task # Category : Usage # Help Link: https://github.com/Microsoft/vs-threading/blob/main/doc/analyzers/VSTHRD114.md -dotnet_diagnostic.VSTHRD114.severity = warning +dotnet_diagnostic.VSTHRD114.severity = error # Title : Avoid returning a null Task # Category : Usage diff --git a/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/NonProdExe-Tier1.globalconfig b/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/NonProdExe-Tier1.globalconfig index 8651b023cd8..f35967ff6a9 100644 --- a/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/NonProdExe-Tier1.globalconfig +++ b/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/NonProdExe-Tier1.globalconfig @@ -1,5 +1,5 @@ # Created by DiagConfig, the diagnostic config generator -# Generated : 2024-01-25 20:57:48Z +# Generated : 2024-03-07 23:40:41Z # Max Tier : 1 # Attributes: general # Analyzers : ILLink.RoslynAnalyzer, Microsoft.Analyzers.Extra, Microsoft.Analyzers.Local, Microsoft.AspNetCore.App.Analyzers, Microsoft.AspNetCore.Components.Analyzers, Microsoft.CodeAnalysis.CSharp.NetAnalyzers, Microsoft.CodeAnalysis.NetAnalyzers, Microsoft.VisualStudio.Threading.Analyzers, Microsoft.VisualStudio.Threading.Analyzers.CSharp, SonarAnalyzer.CSharp @@ -4462,7 +4462,7 @@ dotnet_diagnostic.VSTHRD113.severity = none # Title : Avoid returning a null Task # Category : Usage # Help Link: https://github.com/Microsoft/vs-threading/blob/main/doc/analyzers/VSTHRD114.md -dotnet_diagnostic.VSTHRD114.severity = warning +dotnet_diagnostic.VSTHRD114.severity = error # Title : Avoid returning a null Task # Category : Usage diff --git a/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/NonProdExe-Tier2.globalconfig b/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/NonProdExe-Tier2.globalconfig index 87c460ea91e..381e095a089 100644 --- a/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/NonProdExe-Tier2.globalconfig +++ b/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/NonProdExe-Tier2.globalconfig @@ -1,5 +1,5 @@ # Created by DiagConfig, the diagnostic config generator -# Generated : 2024-01-25 20:57:51Z +# Generated : 2024-03-07 23:40:44Z # Max Tier : 2 # Attributes: general # Analyzers : ILLink.RoslynAnalyzer, Microsoft.Analyzers.Extra, Microsoft.Analyzers.Local, Microsoft.AspNetCore.App.Analyzers, Microsoft.AspNetCore.Components.Analyzers, Microsoft.CodeAnalysis.CSharp.NetAnalyzers, Microsoft.CodeAnalysis.NetAnalyzers, Microsoft.VisualStudio.Threading.Analyzers, Microsoft.VisualStudio.Threading.Analyzers.CSharp, SonarAnalyzer.CSharp @@ -4506,7 +4506,7 @@ dotnet_diagnostic.VSTHRD113.severity = suggestion # Title : Avoid returning a null Task # Category : Usage # Help Link: https://github.com/Microsoft/vs-threading/blob/main/doc/analyzers/VSTHRD114.md -dotnet_diagnostic.VSTHRD114.severity = warning +dotnet_diagnostic.VSTHRD114.severity = error # Title : Avoid returning a null Task # Category : Usage diff --git a/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/NonProdExe.globalconfig b/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/NonProdExe.globalconfig index 7aba65dc923..f7ceb9ac1bc 100644 --- a/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/NonProdExe.globalconfig +++ b/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/NonProdExe.globalconfig @@ -1,5 +1,5 @@ # Created by DiagConfig, the diagnostic config generator -# Generated : 2024-01-25 20:57:54Z +# Generated : 2024-03-07 23:40:47Z # Max Tier : 3 # Attributes: general # Analyzers : ILLink.RoslynAnalyzer, Microsoft.Analyzers.Extra, Microsoft.Analyzers.Local, Microsoft.AspNetCore.App.Analyzers, Microsoft.AspNetCore.Components.Analyzers, Microsoft.CodeAnalysis.CSharp.NetAnalyzers, Microsoft.CodeAnalysis.NetAnalyzers, Microsoft.VisualStudio.Threading.Analyzers, Microsoft.VisualStudio.Threading.Analyzers.CSharp, SonarAnalyzer.CSharp @@ -4535,7 +4535,7 @@ dotnet_diagnostic.VSTHRD113.severity = suggestion # Title : Avoid returning a null Task # Category : Usage # Help Link: https://github.com/Microsoft/vs-threading/blob/main/doc/analyzers/VSTHRD114.md -dotnet_diagnostic.VSTHRD114.severity = warning +dotnet_diagnostic.VSTHRD114.severity = error # Title : Avoid returning a null Task # Category : Usage diff --git a/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/NonProdLib-Tier1.globalconfig b/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/NonProdLib-Tier1.globalconfig index d7d0477bee2..e4cb424341f 100644 --- a/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/NonProdLib-Tier1.globalconfig +++ b/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/NonProdLib-Tier1.globalconfig @@ -1,5 +1,5 @@ # Created by DiagConfig, the diagnostic config generator -# Generated : 2024-01-25 20:57:48Z +# Generated : 2024-03-07 23:40:41Z # Max Tier : 1 # Attributes: api, general # Analyzers : ILLink.RoslynAnalyzer, Microsoft.Analyzers.Extra, Microsoft.Analyzers.Local, Microsoft.AspNetCore.App.Analyzers, Microsoft.AspNetCore.Components.Analyzers, Microsoft.CodeAnalysis.CSharp.NetAnalyzers, Microsoft.CodeAnalysis.NetAnalyzers, Microsoft.VisualStudio.Threading.Analyzers, Microsoft.VisualStudio.Threading.Analyzers.CSharp, SonarAnalyzer.CSharp @@ -4462,7 +4462,7 @@ dotnet_diagnostic.VSTHRD113.severity = none # Title : Avoid returning a null Task # Category : Usage # Help Link: https://github.com/Microsoft/vs-threading/blob/main/doc/analyzers/VSTHRD114.md -dotnet_diagnostic.VSTHRD114.severity = warning +dotnet_diagnostic.VSTHRD114.severity = error # Title : Avoid returning a null Task # Category : Usage diff --git a/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/NonProdLib-Tier2.globalconfig b/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/NonProdLib-Tier2.globalconfig index 69cb0a9d5d7..19e48928cf0 100644 --- a/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/NonProdLib-Tier2.globalconfig +++ b/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/NonProdLib-Tier2.globalconfig @@ -1,5 +1,5 @@ # Created by DiagConfig, the diagnostic config generator -# Generated : 2024-01-25 20:57:52Z +# Generated : 2024-03-07 23:40:44Z # Max Tier : 2 # Attributes: api, general # Analyzers : ILLink.RoslynAnalyzer, Microsoft.Analyzers.Extra, Microsoft.Analyzers.Local, Microsoft.AspNetCore.App.Analyzers, Microsoft.AspNetCore.Components.Analyzers, Microsoft.CodeAnalysis.CSharp.NetAnalyzers, Microsoft.CodeAnalysis.NetAnalyzers, Microsoft.VisualStudio.Threading.Analyzers, Microsoft.VisualStudio.Threading.Analyzers.CSharp, SonarAnalyzer.CSharp @@ -4516,7 +4516,7 @@ dotnet_diagnostic.VSTHRD113.severity = suggestion # Title : Avoid returning a null Task # Category : Usage # Help Link: https://github.com/Microsoft/vs-threading/blob/main/doc/analyzers/VSTHRD114.md -dotnet_diagnostic.VSTHRD114.severity = warning +dotnet_diagnostic.VSTHRD114.severity = error # Title : Avoid returning a null Task # Category : Usage diff --git a/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/NonProdLib.globalconfig b/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/NonProdLib.globalconfig index 639a349612d..976d9191c95 100644 --- a/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/NonProdLib.globalconfig +++ b/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/NonProdLib.globalconfig @@ -1,5 +1,5 @@ # Created by DiagConfig, the diagnostic config generator -# Generated : 2024-01-25 20:57:55Z +# Generated : 2024-03-07 23:40:47Z # Max Tier : 3 # Attributes: api, general # Analyzers : ILLink.RoslynAnalyzer, Microsoft.Analyzers.Extra, Microsoft.Analyzers.Local, Microsoft.AspNetCore.App.Analyzers, Microsoft.AspNetCore.Components.Analyzers, Microsoft.CodeAnalysis.CSharp.NetAnalyzers, Microsoft.CodeAnalysis.NetAnalyzers, Microsoft.VisualStudio.Threading.Analyzers, Microsoft.VisualStudio.Threading.Analyzers.CSharp, SonarAnalyzer.CSharp @@ -4564,7 +4564,7 @@ dotnet_diagnostic.VSTHRD113.severity = suggestion # Title : Avoid returning a null Task # Category : Usage # Help Link: https://github.com/Microsoft/vs-threading/blob/main/doc/analyzers/VSTHRD114.md -dotnet_diagnostic.VSTHRD114.severity = warning +dotnet_diagnostic.VSTHRD114.severity = error # Title : Avoid returning a null Task # Category : Usage diff --git a/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/ProdExe-Tier1.globalconfig b/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/ProdExe-Tier1.globalconfig index 501ffab741c..97e758bb10e 100644 --- a/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/ProdExe-Tier1.globalconfig +++ b/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/ProdExe-Tier1.globalconfig @@ -1,5 +1,5 @@ # Created by DiagConfig, the diagnostic config generator -# Generated : 2024-01-25 20:57:47Z +# Generated : 2024-03-07 23:40:40Z # Max Tier : 1 # Attributes: general, performance, production # Analyzers : ILLink.RoslynAnalyzer, Microsoft.Analyzers.Extra, Microsoft.Analyzers.Local, Microsoft.AspNetCore.App.Analyzers, Microsoft.AspNetCore.Components.Analyzers, Microsoft.CodeAnalysis.CSharp.NetAnalyzers, Microsoft.CodeAnalysis.NetAnalyzers, Microsoft.VisualStudio.Threading.Analyzers, Microsoft.VisualStudio.Threading.Analyzers.CSharp, SonarAnalyzer.CSharp @@ -4462,7 +4462,7 @@ dotnet_diagnostic.VSTHRD113.severity = none # Title : Avoid returning a null Task # Category : Usage # Help Link: https://github.com/Microsoft/vs-threading/blob/main/doc/analyzers/VSTHRD114.md -dotnet_diagnostic.VSTHRD114.severity = warning +dotnet_diagnostic.VSTHRD114.severity = error # Title : Avoid returning a null Task # Category : Usage diff --git a/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/ProdExe-Tier2.globalconfig b/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/ProdExe-Tier2.globalconfig index 1313da06b41..5c8b6fcd675 100644 --- a/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/ProdExe-Tier2.globalconfig +++ b/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/ProdExe-Tier2.globalconfig @@ -1,5 +1,5 @@ # Created by DiagConfig, the diagnostic config generator -# Generated : 2024-01-25 20:57:50Z +# Generated : 2024-03-07 23:40:43Z # Max Tier : 2 # Attributes: general, performance, production # Analyzers : ILLink.RoslynAnalyzer, Microsoft.Analyzers.Extra, Microsoft.Analyzers.Local, Microsoft.AspNetCore.App.Analyzers, Microsoft.AspNetCore.Components.Analyzers, Microsoft.CodeAnalysis.CSharp.NetAnalyzers, Microsoft.CodeAnalysis.NetAnalyzers, Microsoft.VisualStudio.Threading.Analyzers, Microsoft.VisualStudio.Threading.Analyzers.CSharp, SonarAnalyzer.CSharp @@ -4513,7 +4513,7 @@ dotnet_diagnostic.VSTHRD113.severity = suggestion # Title : Avoid returning a null Task # Category : Usage # Help Link: https://github.com/Microsoft/vs-threading/blob/main/doc/analyzers/VSTHRD114.md -dotnet_diagnostic.VSTHRD114.severity = warning +dotnet_diagnostic.VSTHRD114.severity = error # Title : Avoid returning a null Task # Category : Usage diff --git a/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/ProdExe.globalconfig b/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/ProdExe.globalconfig index 1ae50bae852..64f95db6992 100644 --- a/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/ProdExe.globalconfig +++ b/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/ProdExe.globalconfig @@ -1,5 +1,5 @@ # Created by DiagConfig, the diagnostic config generator -# Generated : 2024-01-25 20:57:53Z +# Generated : 2024-03-07 23:40:46Z # Max Tier : 3 # Attributes: general, performance, production # Analyzers : ILLink.RoslynAnalyzer, Microsoft.Analyzers.Extra, Microsoft.Analyzers.Local, Microsoft.AspNetCore.App.Analyzers, Microsoft.AspNetCore.Components.Analyzers, Microsoft.CodeAnalysis.CSharp.NetAnalyzers, Microsoft.CodeAnalysis.NetAnalyzers, Microsoft.VisualStudio.Threading.Analyzers, Microsoft.VisualStudio.Threading.Analyzers.CSharp, SonarAnalyzer.CSharp @@ -4545,7 +4545,7 @@ dotnet_diagnostic.VSTHRD113.severity = suggestion # Title : Avoid returning a null Task # Category : Usage # Help Link: https://github.com/Microsoft/vs-threading/blob/main/doc/analyzers/VSTHRD114.md -dotnet_diagnostic.VSTHRD114.severity = warning +dotnet_diagnostic.VSTHRD114.severity = error # Title : Avoid returning a null Task # Category : Usage diff --git a/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/ProdLib-Tier1.globalconfig b/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/ProdLib-Tier1.globalconfig index d0bdc856606..5b384cb36e0 100644 --- a/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/ProdLib-Tier1.globalconfig +++ b/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/ProdLib-Tier1.globalconfig @@ -1,5 +1,5 @@ # Created by DiagConfig, the diagnostic config generator -# Generated : 2024-01-25 20:57:47Z +# Generated : 2024-03-07 23:40:40Z # Max Tier : 1 # Attributes: api, general, performance, production # Analyzers : ILLink.RoslynAnalyzer, Microsoft.Analyzers.Extra, Microsoft.Analyzers.Local, Microsoft.AspNetCore.App.Analyzers, Microsoft.AspNetCore.Components.Analyzers, Microsoft.CodeAnalysis.CSharp.NetAnalyzers, Microsoft.CodeAnalysis.NetAnalyzers, Microsoft.VisualStudio.Threading.Analyzers, Microsoft.VisualStudio.Threading.Analyzers.CSharp, SonarAnalyzer.CSharp @@ -4462,7 +4462,7 @@ dotnet_diagnostic.VSTHRD113.severity = none # Title : Avoid returning a null Task # Category : Usage # Help Link: https://github.com/Microsoft/vs-threading/blob/main/doc/analyzers/VSTHRD114.md -dotnet_diagnostic.VSTHRD114.severity = warning +dotnet_diagnostic.VSTHRD114.severity = error # Title : Avoid returning a null Task # Category : Usage diff --git a/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/ProdLib-Tier2.globalconfig b/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/ProdLib-Tier2.globalconfig index fd6a91f7346..cf3365818ee 100644 --- a/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/ProdLib-Tier2.globalconfig +++ b/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/ProdLib-Tier2.globalconfig @@ -1,5 +1,5 @@ # Created by DiagConfig, the diagnostic config generator -# Generated : 2024-01-25 20:57:51Z +# Generated : 2024-03-07 23:40:43Z # Max Tier : 2 # Attributes: api, general, performance, production # Analyzers : ILLink.RoslynAnalyzer, Microsoft.Analyzers.Extra, Microsoft.Analyzers.Local, Microsoft.AspNetCore.App.Analyzers, Microsoft.AspNetCore.Components.Analyzers, Microsoft.CodeAnalysis.CSharp.NetAnalyzers, Microsoft.CodeAnalysis.NetAnalyzers, Microsoft.VisualStudio.Threading.Analyzers, Microsoft.VisualStudio.Threading.Analyzers.CSharp, SonarAnalyzer.CSharp @@ -4522,7 +4522,7 @@ dotnet_diagnostic.VSTHRD113.severity = suggestion # Title : Avoid returning a null Task # Category : Usage # Help Link: https://github.com/Microsoft/vs-threading/blob/main/doc/analyzers/VSTHRD114.md -dotnet_diagnostic.VSTHRD114.severity = warning +dotnet_diagnostic.VSTHRD114.severity = error # Title : Avoid returning a null Task # Category : Usage diff --git a/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/ProdLib.globalconfig b/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/ProdLib.globalconfig index 76bfc906640..d31068071ca 100644 --- a/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/ProdLib.globalconfig +++ b/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/ProdLib.globalconfig @@ -1,5 +1,5 @@ # Created by DiagConfig, the diagnostic config generator -# Generated : 2024-01-25 20:57:54Z +# Generated : 2024-03-07 23:40:46Z # Max Tier : 3 # Attributes: api, general, performance, production # Analyzers : ILLink.RoslynAnalyzer, Microsoft.Analyzers.Extra, Microsoft.Analyzers.Local, Microsoft.AspNetCore.App.Analyzers, Microsoft.AspNetCore.Components.Analyzers, Microsoft.CodeAnalysis.CSharp.NetAnalyzers, Microsoft.CodeAnalysis.NetAnalyzers, Microsoft.VisualStudio.Threading.Analyzers, Microsoft.VisualStudio.Threading.Analyzers.CSharp, SonarAnalyzer.CSharp @@ -4571,7 +4571,7 @@ dotnet_diagnostic.VSTHRD113.severity = suggestion # Title : Avoid returning a null Task # Category : Usage # Help Link: https://github.com/Microsoft/vs-threading/blob/main/doc/analyzers/VSTHRD114.md -dotnet_diagnostic.VSTHRD114.severity = warning +dotnet_diagnostic.VSTHRD114.severity = error # Title : Avoid returning a null Task # Category : Usage diff --git a/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/Test-Tier1.globalconfig b/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/Test-Tier1.globalconfig index 5416bca2801..b87a1603c0b 100644 --- a/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/Test-Tier1.globalconfig +++ b/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/Test-Tier1.globalconfig @@ -1,5 +1,5 @@ # Created by DiagConfig, the diagnostic config generator -# Generated : 2024-01-25 20:57:49Z +# Generated : 2024-03-07 23:40:42Z # Max Tier : 1 # Attributes: general, test # Analyzers : ILLink.RoslynAnalyzer, Microsoft.Analyzers.Extra, Microsoft.Analyzers.Local, Microsoft.AspNetCore.App.Analyzers, Microsoft.AspNetCore.Components.Analyzers, Microsoft.CodeAnalysis.CSharp.NetAnalyzers, Microsoft.CodeAnalysis.NetAnalyzers, Microsoft.VisualStudio.Threading.Analyzers, Microsoft.VisualStudio.Threading.Analyzers.CSharp, SonarAnalyzer.CSharp, xunit.analyzers @@ -4462,7 +4462,7 @@ dotnet_diagnostic.VSTHRD113.severity = none # Title : Avoid returning a null Task # Category : Usage # Help Link: https://github.com/Microsoft/vs-threading/blob/main/doc/analyzers/VSTHRD114.md -dotnet_diagnostic.VSTHRD114.severity = warning +dotnet_diagnostic.VSTHRD114.severity = error # Title : Avoid returning a null Task # Category : Usage diff --git a/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/Test-Tier2.globalconfig b/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/Test-Tier2.globalconfig index f9c6b1bf0e5..2f4362c4776 100644 --- a/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/Test-Tier2.globalconfig +++ b/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/Test-Tier2.globalconfig @@ -1,5 +1,5 @@ # Created by DiagConfig, the diagnostic config generator -# Generated : 2024-01-25 20:57:52Z +# Generated : 2024-03-07 23:40:45Z # Max Tier : 2 # Attributes: general, test # Analyzers : ILLink.RoslynAnalyzer, Microsoft.Analyzers.Extra, Microsoft.Analyzers.Local, Microsoft.AspNetCore.App.Analyzers, Microsoft.AspNetCore.Components.Analyzers, Microsoft.CodeAnalysis.CSharp.NetAnalyzers, Microsoft.CodeAnalysis.NetAnalyzers, Microsoft.VisualStudio.Threading.Analyzers, Microsoft.VisualStudio.Threading.Analyzers.CSharp, SonarAnalyzer.CSharp, xunit.analyzers @@ -4506,7 +4506,7 @@ dotnet_diagnostic.VSTHRD113.severity = suggestion # Title : Avoid returning a null Task # Category : Usage # Help Link: https://github.com/Microsoft/vs-threading/blob/main/doc/analyzers/VSTHRD114.md -dotnet_diagnostic.VSTHRD114.severity = warning +dotnet_diagnostic.VSTHRD114.severity = error # Title : Avoid returning a null Task # Category : Usage diff --git a/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/Test.globalconfig b/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/Test.globalconfig index 7015c34ae11..2c5731db4f0 100644 --- a/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/Test.globalconfig +++ b/src/Packages/Microsoft.Extensions.StaticAnalysis/build/config/Test.globalconfig @@ -1,5 +1,5 @@ # Created by DiagConfig, the diagnostic config generator -# Generated : 2024-01-25 20:57:56Z +# Generated : 2024-03-07 23:40:48Z # Max Tier : 3 # Attributes: general, test # Analyzers : ILLink.RoslynAnalyzer, Microsoft.Analyzers.Extra, Microsoft.Analyzers.Local, Microsoft.AspNetCore.App.Analyzers, Microsoft.AspNetCore.Components.Analyzers, Microsoft.CodeAnalysis.CSharp.NetAnalyzers, Microsoft.CodeAnalysis.NetAnalyzers, Microsoft.VisualStudio.Threading.Analyzers, Microsoft.VisualStudio.Threading.Analyzers.CSharp, SonarAnalyzer.CSharp, xunit.analyzers @@ -4535,7 +4535,7 @@ dotnet_diagnostic.VSTHRD113.severity = suggestion # Title : Avoid returning a null Task # Category : Usage # Help Link: https://github.com/Microsoft/vs-threading/blob/main/doc/analyzers/VSTHRD114.md -dotnet_diagnostic.VSTHRD114.severity = warning +dotnet_diagnostic.VSTHRD114.severity = error # Title : Avoid returning a null Task # Category : Usage diff --git a/src/Shared/.editorconfig b/src/Shared/.editorconfig index 304efe1ab9b..bc980461f04 100644 --- a/src/Shared/.editorconfig +++ b/src/Shared/.editorconfig @@ -1,5 +1,5 @@ # Created by DiagConfig, the diagnostic config generator -# Generated : 2024-01-25 20:57:45Z +# Generated : 2024-03-07 23:40:37Z # Max Tier : 2147483647 # Attributes: general, performance, production # Analyzers : ILLink.RoslynAnalyzer, Microsoft.Analyzers.Extra, Microsoft.Analyzers.Local, Microsoft.AspNetCore.App.Analyzers, Microsoft.AspNetCore.Components.Analyzers, Microsoft.CodeAnalysis.CodeStyle, Microsoft.CodeAnalysis.CSharp.CodeStyle, Microsoft.CodeAnalysis.CSharp.NetAnalyzers, Microsoft.CodeAnalysis.NetAnalyzers, Microsoft.VisualStudio.Threading.Analyzers, Microsoft.VisualStudio.Threading.Analyzers.CSharp, SonarAnalyzer.CSharp, StyleCop.Analyzers @@ -6364,7 +6364,7 @@ dotnet_diagnostic.VSTHRD113.severity = suggestion # Title : Avoid returning a null Task # Category : Usage # Help Link: https://github.com/Microsoft/vs-threading/blob/main/doc/analyzers/VSTHRD114.md -dotnet_diagnostic.VSTHRD114.severity = warning +dotnet_diagnostic.VSTHRD114.severity = error # Title : Avoid returning a null Task # Category : Usage diff --git a/test/.editorconfig b/test/.editorconfig index 2666a6b9507..e98d1472b6a 100644 --- a/test/.editorconfig +++ b/test/.editorconfig @@ -1,5 +1,5 @@ # Created by DiagConfig, the diagnostic config generator -# Generated : 2024-01-25 20:57:46Z +# Generated : 2024-03-07 23:40:39Z # Max Tier : 2147483647 # Attributes: general, test # Analyzers : ILLink.RoslynAnalyzer, Microsoft.Analyzers.Extra, Microsoft.Analyzers.Local, Microsoft.AspNetCore.App.Analyzers, Microsoft.AspNetCore.Components.Analyzers, Microsoft.CodeAnalysis.CodeStyle, Microsoft.CodeAnalysis.CSharp.CodeStyle, Microsoft.CodeAnalysis.CSharp.NetAnalyzers, Microsoft.CodeAnalysis.NetAnalyzers, Microsoft.VisualStudio.Threading.Analyzers, Microsoft.VisualStudio.Threading.Analyzers.CSharp, SonarAnalyzer.CSharp, StyleCop.Analyzers, xunit.analyzers @@ -6353,7 +6353,7 @@ dotnet_diagnostic.VSTHRD113.severity = suggestion # Title : Avoid returning a null Task # Category : Usage # Help Link: https://github.com/Microsoft/vs-threading/blob/main/doc/analyzers/VSTHRD114.md -dotnet_diagnostic.VSTHRD114.severity = warning +dotnet_diagnostic.VSTHRD114.severity = error # Title : Avoid returning a null Task # Category : Usage From 480ff1ebdb2d2cded8f972658b8a37347d4b5aed Mon Sep 17 00:00:00 2001 From: Igor Velikorossov Date: Fri, 8 Mar 2024 12:29:09 +1100 Subject: [PATCH 172/172] Public build pipeline (#4993) A copy of azure-pipelines.yml with stripped out non-public conditions. --- azure-pipelines-public.yml | 255 ++++++++++++++++++ .../Microsoft.Gen.ComplianceReports.csproj | 2 +- .../Microsoft.Gen.MetricsReports.csproj | 2 +- 3 files changed, 257 insertions(+), 2 deletions(-) create mode 100644 azure-pipelines-public.yml diff --git a/azure-pipelines-public.yml b/azure-pipelines-public.yml new file mode 100644 index 00000000000..a5ff92b7f48 --- /dev/null +++ b/azure-pipelines-public.yml @@ -0,0 +1,255 @@ +# Setting batch to true, triggers one build at a time. +# if there is a push while a build in progress, it will wait, +# until the running build finishes, and produce a build with all the changes +# that happened during the last build. +trigger: + batch: true + branches: + include: + - main + - dev + paths: + include: + - '*' + exclude: + - eng/Version.Details.xml + - .github/* + - docs/* + - CODE_OF_CONDUCT.md + - CONTRIBUTING.md + - README.md + - SECURITY.md + - LICENSE.TXT + - PATENTS.TXT + - THIRD-PARTY-NOTICES.TXT + +pr: + branches: + include: + - main + - dev + paths: + include: + - '*' + exclude: + - eng/Version.Details.xml + - .github/* + - docs/* + - CODE_OF_CONDUCT.md + - CONTRIBUTING.md + - README.md + - SECURITY.md + - LICENSE.TXT + - PATENTS.TXT + - THIRD-PARTY-NOTICES.TXT + +variables: + - name: Build.Arcade.ArtifactsPath + value: $(Build.SourcesDirectory)/artifacts/ + - name: Build.Arcade.LogsPath + value: $(Build.Arcade.ArtifactsPath)log/$(_BuildConfig)/ + - name: Build.Arcade.TestResultsPath + value: $(Build.Arcade.ArtifactsPath)TestResults/$(_BuildConfig)/ + + - name: SkipQualityGates + value: false + - name: _TeamName + value: dotnet-r9 + - name: NativeToolsOnMachine + value: true + - name: DOTNET_SKIP_FIRST_TIME_EXPERIENCE + value: true + - name: _BuildConfig + value: Release + - name: PostBuildSign + value: false + # needed for darc (dependency flow) publishing + - name: _PublishArgs + value: '' + - name: _OfficialBuildIdArgs + value: '' + # needed for signing + - name: _SignType + value: test + - name: _SignArgs + value: '' + - name: _Sign + value: false + +stages: +- stage: build + displayName: Build + variables: + - template: /eng/common/templates/variables/pool-providers.yml + jobs: + - template: /eng/common/templates/jobs/jobs.yml + parameters: + enableMicrobuild: true + enableTelemetry: true + enableSourceIndex: false + runAsPublic: true + # Publish build logs + enablePublishBuildArtifacts: true + # Publish test logs + enablePublishTestResults: true + # Publish NuGet packages using v3 + # https://github.com/dotnet/arcade/blob/main/Documentation/CorePackages/Publishing.md#basic-onboarding-scenario-for-new-repositories-to-the-current-publishing-version-v3 + enablePublishUsingPipelines: true + enablePublishBuildAssets: true + workspace: + clean: all + + jobs: + + # ---------------------------------------------------------------- + # This job build and run tests on Windows + # ---------------------------------------------------------------- + - job: Windows + timeoutInMinutes: 180 + testResultsFormat: VSTest + + pool: + name: $(DncEngPublicBuildPool) + demands: ImageOverride -equals windows.vs2022preview.amd64.open + + variables: + - _buildScript: $(Build.SourcesDirectory)/build.cmd -ci -NativeToolsOnMachine + + preSteps: + - checkout: self + clean: true + persistCredentials: true + fetchDepth: 1 + + steps: + - template: /eng/pipelines/templates/BuildAndTest.yml + parameters: + buildScript: $(_buildScript) + buildConfig: $(_BuildConfig) + repoLogPath: $(Build.Arcade.LogsPath) + repoTestResultsPath: $(Build.Arcade.TestResultsPath) + skipQualityGates: ${{ eq(variables['SkipQualityGates'], 'true') }} + isWindows: true + warnAsError: 0 + + # ---------------------------------------------------------------- + # This job build and run tests on Ubuntu + # ---------------------------------------------------------------- + - job: Ubuntu + timeoutInMinutes: 180 + testResultsFormat: VSTest + + pool: + name: $(DncEngPublicBuildPool) + demands: ImageOverride -equals build.ubuntu.2004.amd64.open + + variables: + - _buildScript: $(Build.SourcesDirectory)/build.sh --ci + + preSteps: + - checkout: self + clean: true + persistCredentials: true + fetchDepth: 1 + + steps: + - template: /eng/pipelines/templates/BuildAndTest.yml + parameters: + buildScript: $(_buildScript) + buildConfig: $(_BuildConfig) + repoLogPath: $(Build.Arcade.LogsPath) + repoTestResultsPath: $(Build.Arcade.TestResultsPath) + skipQualityGates: ${{ eq(variables['SkipQualityGates'], 'true') }} + isWindows: false + warnAsError: 0 + + +# ---------------------------------------------------------------- +# This stage performs quality gates enforcements +# ---------------------------------------------------------------- +- stage: codecoverage + displayName: CodeCoverage + dependsOn: + - build + condition: and(succeeded('build'), ne(variables['SkipQualityGates'], 'true')) + variables: + - template: /eng/common/templates/variables/pool-providers.yml + jobs: + - template: /eng/common/templates/jobs/jobs.yml + parameters: + enableMicrobuild: true + enableTelemetry: true + runAsPublic: true + workspace: + clean: all + + # ---------------------------------------------------------------- + # This stage downloads the code coverage reports from the build jobs, + # merges those and validates the combined test coverage. + # ---------------------------------------------------------------- + jobs: + - job: CodeCoverageReport + timeoutInMinutes: 180 + + pool: + name: $(DncEngPublicBuildPool) + demands: ImageOverride -equals build.ubuntu.2004.amd64.open + + preSteps: + - checkout: self + clean: true + persistCredentials: true + fetchDepth: 1 + + steps: + - script: $(Build.SourcesDirectory)/build.sh --ci --restore + displayName: Init toolset + + - template: /eng/pipelines/templates/VerifyCoverageReport.yml + + +# ---------------------------------------------------------------- +# This stage only performs a build treating warnings as errors +# to detect any kind of code style violations +# ---------------------------------------------------------------- +- stage: correctness + displayName: Correctness + dependsOn: [] + variables: + - template: /eng/common/templates/variables/pool-providers.yml + jobs: + - template: /eng/common/templates/jobs/jobs.yml + parameters: + enableMicrobuild: true + enableTelemetry: true + runAsPublic: true + workspace: + clean: all + + jobs: + - job: WarningsCheck + timeoutInMinutes: 180 + + pool: + name: $(DncEngPublicBuildPool) + demands: ImageOverride -equals build.ubuntu.2004.amd64.open + + variables: + - _buildScript: $(Build.SourcesDirectory)/build.sh --ci + + preSteps: + - checkout: self + clean: true + persistCredentials: true + fetchDepth: 1 + + steps: + - template: /eng/pipelines/templates/BuildAndTest.yml + parameters: + buildScript: $(_buildScript) + buildConfig: $(_BuildConfig) + repoLogPath: $(Build.Arcade.LogsPath) + repoTestResultsPath: $(Build.Arcade.TestResultsPath) + skipTests: true + skipQualityGates: true + isWindows: false diff --git a/src/Generators/Microsoft.Gen.ComplianceReports/Microsoft.Gen.ComplianceReports.csproj b/src/Generators/Microsoft.Gen.ComplianceReports/Microsoft.Gen.ComplianceReports.csproj index e05809ebece..224d0d98548 100644 --- a/src/Generators/Microsoft.Gen.ComplianceReports/Microsoft.Gen.ComplianceReports.csproj +++ b/src/Generators/Microsoft.Gen.ComplianceReports/Microsoft.Gen.ComplianceReports.csproj @@ -12,7 +12,7 @@ normal - 96 + 98 85 diff --git a/src/Generators/Microsoft.Gen.MetricsReports/Microsoft.Gen.MetricsReports.csproj b/src/Generators/Microsoft.Gen.MetricsReports/Microsoft.Gen.MetricsReports.csproj index 0448e091cbf..1f93b3e344f 100644 --- a/src/Generators/Microsoft.Gen.MetricsReports/Microsoft.Gen.MetricsReports.csproj +++ b/src/Generators/Microsoft.Gen.MetricsReports/Microsoft.Gen.MetricsReports.csproj @@ -11,7 +11,7 @@ - 65 + 67 85