dotnet / runtime

.NET is a cross-platform runtime for cloud, mobile, desktop, and IoT apps.
https://docs.microsoft.com/dotnet/core/
MIT License
14.58k stars 4.55k forks source link

Should we dispose EventLog if there was an Interop.Errors.ERROR_INVALID_PARAMETER? #104053

Open omajid opened 2 weeks ago

omajid commented 2 weeks ago

https://github.com/dotnet/runtime/blob/9317db0695918f74d8e2308bbe4c2f06cc3dea49/src/libraries/System.Diagnostics.EventLog/src/System/Diagnostics/EventLog.cs#L651-L664

In the two conditions, we save the just-created log object. Should we call log.Dispose() if neither of those branches are taken?

dotnet-policy-service[bot] commented 2 weeks ago

Tagging subscribers to this area: @dotnet/area-system-diagnostics-eventlog See info in area-owners.md if you want to be subscribed.