Skip to content

AddResourceMonitoring() do no-operation if not supported OS #5962

@juliankock

Description

@juliankock

Description

I'm currently working on MacOS and it seems like https://source.dot.net/#Microsoft.Extensions.Diagnostics.ResourceMonitoring/ResourceMonitoringServiceCollectionExtensions.cs,7ba4439b710f2460,references throws an exception if the OS is not supported.

I would prefer it did a no-op. We go through all OS' and we need to do:

if (!OperatingSystem.IsMacOS())
{
    builder.Services.AddResourceMonitoring();
}

In the calling code.

Reproduction Steps

Run builder.Services.AddResourceMonitoring();.

Expected behavior

Just do no-op and return early if not supported OS.

Actual behavior

Throws exception

Regression?

No response

Known Workarounds

Add if statement at consuming code

Configuration

No response

Other information

No response

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions