-
Notifications
You must be signed in to change notification settings - Fork 10.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HealthCheckPublisherError and HealthCheckPublisherTimeout have the same EventId.Id = 104 #47348
Comments
The code generator would warn about the duplicate ID, but the warning has been suppressed. aspnetcore/src/HealthChecks/HealthChecks/src/HealthCheckPublisherHostedService.cs Lines 236 to 245 in 6a6d775
SYSLIB1006: Multiple logging methods cannot use the same event ID |
@eerhardt just wondering if you can cast your mind back on this change (looks like you added the suppressions here). Was there a reason why the suppression was added vs. just making the IDs unique? |
Unfortunately I don't remember exactly why I suppressed the warning here. My initial thought is because it is a breaking change, and I didn't want to deal with breaking changes in that PR (since it was just refactoring to use the source generator). But if I didn't think it was correct, I would have logged a follow-up issue for it, but I don't see one logged. So there must have been a reason why we thought it was valid back then, I just don't know what that reason is. Note also we have duplicate event names elsewhere - see #46072. |
This sounds reasonable. I possibly would have done the same thing ;) @KalleOlaviNiemitalo are you interested in submitting a PR to fix this up? |
Note the work involved isn't just fixing up the code, it is also documenting the breaking change. |
Ah yes, that will probably require the team to march it through the process. Fair enough. |
Duplicate of #46099. |
Is there an existing issue for this?
Describe the bug
In Microsoft.Extensions.Diagnostics.HealthChecks.HealthCheckPublisherHostedService.EventIds, both HealthCheckPublisherErrorId and HealthCheckPublisherTimeoutId are defined as 104:
aspnetcore/src/HealthChecks/HealthChecks/src/HealthCheckPublisherHostedService.cs
Lines 201 to 202 in 6a6d775
These are then used as LoggerMessageAttribute.EventId, whence they go to EventId.Id.
Expected Behavior
Each event in the same logging category should have a distinct EventId.Id. That would allow the events to be recognized even after they are passed through a logger that uses only EventId.Id and discards EventId.Name, such as Microsoft.Extensions.Logging.EventLog.EventLogLogger.
Steps To Reproduce
No response
Exceptions (if any)
None
.NET Version
6.0.15
Anything else?
This bug has been there ever since the events were added in aspnet/Diagnostics#498.
Event IDs for some Microsoft.AspNetCore.Mvc.Core log messages changed is precedent for making event IDs unique even though it is a breaking change.
The text was updated successfully, but these errors were encountered: