-
Notifications
You must be signed in to change notification settings - Fork 48
Description
Describe the bug
Symptoms
Attempting to generate a usage report from ServiceControl (through the ServicePulse interface) does nothing after confirming the download of the report in the web browser. Log output shows an exception:
An unhandled exception was thrown by the application.|System.InvalidOperationException: Sequence contains more than one matching element
Who's affected
Users who may have more than one data source of the same type for a given endpoint. This can happen as a result of endpoint name or queue name sanitization that results in two different endpoint or queue names resolving to the same value after the name has been sanitized.
Root cause
ServiceControl generates usage reports by considering different types of data sources for each endpoint. To select the data for a given data source type, the first collection of data is selected using a call to SingleOrDefault. If an endpoint has more than one data source of the same type, this throws an exception and the usage report fails to generate.
Confirmed workarounds
None
Original bug report
Trying to generate a usage report but after the browser says 'do you want to download', nothing happens, no file comes ...Relevant log output
2025-10-28 14:28:34.7342|18:18:14.331|136|Error|Microsoft.AspNetCore.Server.Kestrel|Connection id "0HNGID55T7H51", Request id "0HNGID55T7H51:0000003E": An unhandled exception was thrown by the application.|System.InvalidOperationException: Sequence contains more than one matching element
at System.Linq.ThrowHelper.ThrowMoreThanOneMatchException()
at System.Linq.Enumerable.TryGetSingle[TSource](IEnumerable`1 source, Func`2 predicate, Boolean& found)
at System.Linq.Enumerable.SingleOrDefault[TSource](IEnumerable`1 source, Func`2 predicate)
at Particular.LicensingComponent.ThroughputDataExtensions.FromSource(List`1 throughputs, ThroughputSource source) in /_/src/Particular.LicensingComponent/ThroughputDataExtensions.cs:line 7
at Particular.LicensingComponent.ThroughputCollector.GenerateThroughputReport(String spVersion, Nullable`1 reportEndDate, CancellationToken cancellationToken) in /_/src/Particular.LicensingComponent/ThroughputCollector.cs:line 127
at Particular.LicensingComponent.ThroughputCollector.GenerateThroughputReport(String spVersion, Nullable`1 reportEndDate, CancellationToken cancellationToken)
at Particular.LicensingComponent.WebApi.LicensingController.GetThroughputReportFile(String spVersion, CancellationToken cancellationToken) in /_/src/Particular.LicensingComponent/WebApi/LicensingController.cs:line 47
at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.TaskOfIActionResultExecutor.Execute(ActionContext actionContext, IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask`1 actionResultValueTask)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeInnerFilterAsync>g__Awaited|13_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeFilterPipelineAsync>g__Awaited|20_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.ProcessRequests[TContext](IHttpApplication`1 application)Additional Information
None