microsoft / Omex

Shared components used by the Omex team to build scalable and highly available distributed systems
MIT License
71 stars 40 forks source link

Process components are not managed correctly #453

Closed K-Cully closed 2 years ago

K-Cully commented 2 years ago

In some logging classes Process.GetCurrentProcess is used incorrectly. See https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/ca1837 regarding the issues.

For initialization logger, the code should be updated to Environment.ProcessId (https://docs.microsoft.com/en-us/dotnet/api/system.environment.processid?view=net-6.0). For OmexLogEventSender, the process should be created in a using scope to ensure it is disposed correctly.

See https://github.com/microsoft/Omex/search?q=GetCurrentProcess

artempushkin commented 2 years ago

Good catch.