When writing to the event log, our application uses enumerations to create an error number for attaching to the elements of the event log. The idea is to list what we know may go wrong and assign identifiers for each of them so that we can immediately determine what went wrong when viewing the event log.
One enumeration contains values / identifiers that represent the class in the application, and another enumeration contains values representing error codes for known errors that may occur at runtime (for example, invalid date = 1, invalid amount = 2, etc.) .
Now let's say that we found an invalid method input. We add the corresponding class identifier containing the method from one enumeration and the specific error of "incorrect input" from the second enumeration, and then pass the result of adding to the EventLog.WriteEntry () method along with the message line.
The problem is that when we pass a variable containing the result of adding enum values to the WriteEntry () method, nothing is written to the event log. However, if the value is passed as a regular integer in the method parameters, then the event is recorded successfully.
Does anyone know why this is happening?
Ramon
source
share