diff --git a/src/IdentityServer/Services/Default/DefaultEventService.cs b/src/IdentityServer/Services/Default/DefaultEventService.cs index 939240965..cc4ac23cb 100644 --- a/src/IdentityServer/Services/Default/DefaultEventService.cs +++ b/src/IdentityServer/Services/Default/DefaultEventService.cs @@ -112,7 +112,8 @@ protected virtual bool CanRaiseEvent(Event evt) protected virtual async Task PrepareEventAsync(Event evt) { evt.TimeStamp = Clock.UtcNow.DateTime; - evt.ProcessId = Process.GetCurrentProcess().Id; + using var process = Process.GetCurrentProcess(); + evt.ProcessId = process.Id; if (Context.HttpContext?.TraceIdentifier != null) {