When writing to the event log, our application uses enums to generate an error number to attach to event log items. The idea is to list the things that we know can go wrong, and assign IDs to each one so we can identify right away what went wrong when viewing the event log.
One enum contains values/IDs that represent a class in the application, and another enum contains values representing error codes for known errors that may occur during execution (e.g. invalid date=1, invalid amount=2 and so on).
Now, say we've detected an invalid input to a method. We add up the appropriate class ID that contains the method from one enum, and the specific "invalid input" error from the second enum, and then we pass the result of the addition to the EventLog.WriteEntry () method along with the message string.
The problem is that when we pass a variable containing the result of the enum values' addition to the WriteEntry() method, nothing gets written to the event log. However, if the value is passed as a regular integer in the method's parameters, then the event is written successfully.
Does anyone have any idea why this is happening?