diff --git a/coverlet.runsettings b/coverlet.runsettings index 16d10b5dd8..fe0adb82b8 100644 --- a/coverlet.runsettings +++ b/coverlet.runsettings @@ -5,12 +5,10 @@ opencover - [*.Test*]*,[*]Microsoft.Diagnostics* - [Steeltoe.*]* - Obsolete,GeneratedCodeAttribute,CompilerGeneratedAttribute + [ConfigurationSchemaGenerator]* + **/test/**/*.* + ObsoleteAttribute,GeneratedCodeAttribute,CompilerGeneratedAttribute true - false - false diff --git a/src/Common/src/Common/ConfigurationSchemaAttributes.cs b/src/Common/src/Common/ConfigurationSchemaAttributes.cs index 992e13329a..78a74b297e 100644 --- a/src/Common/src/Common/ConfigurationSchemaAttributes.cs +++ b/src/Common/src/Common/ConfigurationSchemaAttributes.cs @@ -6,12 +6,15 @@ // Steeltoe: This file was copied from the .NET Aspire Configuration Schema generator // at https://github.com/dotnet/aspire/tree/cb7cc4d78f8dd2b4df1053a229493cdbf88f50df/src/Tools/ConfigurationSchemaGenerator. +using System.Diagnostics.CodeAnalysis; + namespace Aspire; /// /// Attribute used to automatically generate a JSON schema for a component's configuration. /// [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] +[ExcludeFromCodeCoverage(Justification = "Used while compiling Steeltoe, does not ship with Steeltoe.")] internal sealed class ConfigurationSchemaAttribute : Attribute { public ConfigurationSchemaAttribute(string path, Type type, string[]? exclusionPaths = null) diff --git a/src/Management/src/Endpoint/Actuators/Health/Contributors/FileSystem/NetworkShareWrapper.cs b/src/Management/src/Endpoint/Actuators/Health/Contributors/FileSystem/NetworkShareWrapper.cs index 196ceab1bb..a62227d27d 100644 --- a/src/Management/src/Endpoint/Actuators/Health/Contributors/FileSystem/NetworkShareWrapper.cs +++ b/src/Management/src/Endpoint/Actuators/Health/Contributors/FileSystem/NetworkShareWrapper.cs @@ -1,7 +1,8 @@ -// 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 Apache 2.0 License. // See the LICENSE file in the project root for more information. +using System.Diagnostics.CodeAnalysis; using System.Runtime.InteropServices; namespace Steeltoe.Management.Endpoint.Actuators.Health.Contributors.FileSystem; @@ -26,6 +27,7 @@ private NetworkShareWrapper(ulong freeBytesAvailable, ulong totalNumberOfBytes) : null; } + [ExcludeFromCodeCoverage(Justification = "Workaround for https://github.com/coverlet-coverage/coverlet/issues/1762")] private static partial class NativeMethods { [LibraryImport("kernel32.dll", EntryPoint = "GetDiskFreeSpaceExW", StringMarshalling = StringMarshalling.Utf16, SetLastError = true)] diff --git a/src/Management/src/Endpoint/Actuators/ThreadDump/EventPipeThreadDumper.cs b/src/Management/src/Endpoint/Actuators/ThreadDump/EventPipeThreadDumper.cs index 23acc5e15c..312287d4be 100644 --- a/src/Management/src/Endpoint/Actuators/ThreadDump/EventPipeThreadDumper.cs +++ b/src/Management/src/Endpoint/Actuators/ThreadDump/EventPipeThreadDumper.cs @@ -77,7 +77,9 @@ public async Task> DumpThreadsAsync(CancellationToken cancella } finally { +#pragma warning disable S1215 // "GC.Collect" should not be called long totalMemory = GC.GetTotalMemory(true); +#pragma warning restore S1215 // "GC.Collect" should not be called _logger.LogDebug("Total memory: {Memory}.", totalMemory); } }, cancellationToken);