1 //------------------------------------------------------------
2 // Copyright (c) Microsoft Corporation.  All rights reserved.
3 //------------------------------------------------------------
4 
5 namespace System.Runtime.Diagnostics
6 {
7     // When adding an EventLogEventId, an entry must also be added to src\ndp\cdf\src\WCF\EventLog\EventLog.mc.
8     // The hexadecimal representation of each EventId ('0xabbbcccc') can be broken down into 3 parts:
9     //     Hex digit  1   ('a')    : Severity : a=0 for Success, a=4 for Informational, a=8 for Warning, a=c for Error
10     //     Hex digits 2-4 ('bbb')  : Facility : bbb=001 for Tracing, bbb=002 for ServiceModel, bbb=003 for TransactionBridge, bbb=004 for SMSvcHost, bbb=005 for Info_Cards, bbb=006 for Security_Audit
11     //     Hex digits 5-8 ('cccc') : Code     : Each event within the same facility is assigned a unique "code".
12     // The EventId generated from EventLog.mc must match the EventId assigned here.
13     // Order is important: The order here must match the order of strings in src\ndp\cdf\src\WCF\EventLog\EventLog.mc so that the 'code' portions of the EventId's match.
14     //     The "code" portions of the EventId's are generated by EventLog.mc as follows:
15     //         - The first event for a given facility is assigned the code "0x0001".
16     //         - Each subsequent event within this facility, regardless of severity, is assigned the value of the previous event incremented by 1.
17     //     Thus, if you add an EventLogEventId below, you must ensure that its code is equal to the code of the previous EventLogEventId in its facility incremented by 1.
18     // The Severity and Facility assigned in EventLog.mc must match those assigned via the EventId here.
19     // If the EventId's do not match, the EventViewer will not be able to display the strings defined in EventLog.mc correctly.  In this case, the following error message will be included in the logged event:
20     //     "The description for Event ID XX from source System.ServiceModel 4.0.0.0 cannot be found..."
21     // To inspect the value assigend to the enum elements below, build 'ndp\cdf\src\System.ServiceModel.Internals', and inspect System.ServiceModel.Internals\System.ServiceModel.Internals.asmmeta
22     // To inspect the EventId generated from EventLog.mc, build 'ndp\cdf\src\WCF\EventLog', and open ServiceModelEvents.dll.mui with \\indigofs\PrivateLabDebugShare\sarada\RPFRecorder\RPFRecorder.exe (convert EventId from decimal to hex).
23     // You could also use any other method of viewing ServiceModelEvents.dll.mui which would allow you to inspect the EventId
24     enum EventLogEventId : uint
25     {
26         // EventIDs from shared Diagnostics and Reliability code
27         // All EventId's beneath 'FailedToSetupTracing', until the next explicitly assigned one, inherit its severity and facility, via the enum's auto-incrememt
28         FailedToSetupTracing = EventSeverity.Error | EventFacility.Tracing | 0x0064,
29         FailedToInitializeTraceSource,
30         FailFast,
31         FailFastException,
32         FailedToTraceEvent,
33         FailedToTraceEventWithException,
34         InvariantAssertionFailed,
35         PiiLoggingOn,
36         PiiLoggingNotAllowed,
37 
38         // ServiceModel EventIDs
39         // All EventId's beneath 'WebHostUnhandledException', until the next explicitly assigned one, inherit its severity and facility, via the enum's auto-incrememt
40         WebHostUnhandledException = EventSeverity.Error | EventFacility.ServiceModel | 0x0001,
41         WebHostHttpError,
42         WebHostFailedToProcessRequest,
43         WebHostFailedToListen,
44         FailedToLogMessage,
45         RemovedBadFilter,
46         FailedToCreateMessageLoggingTraceSource,
47         MessageLoggingOn,
48         MessageLoggingOff,
49         FailedToLoadPerformanceCounter,
50         FailedToRemovePerformanceCounter,
51         WmiGetObjectFailed,
52         WmiPutInstanceFailed,
53         WmiDeleteInstanceFailed,
54         WmiCreateInstanceFailed,
55         WmiExecQueryFailed,
56         WmiExecMethodFailed,
57         WmiRegistrationFailed,
58         WmiUnregistrationFailed,
59         WmiAdminTypeMismatch,
60         WmiPropertyMissing,
61         ComPlusServiceHostStartingServiceError,
62         ComPlusDllHostInitializerStartingError,
63         ComPlusTLBImportError,
64         ComPlusInvokingMethodFailed,
65         ComPlusInstanceCreationError,
66         ComPlusInvokingMethodFailedMismatchedTransactions,
67         // Assigning code 0x001c to this EventId because it is the 28th (0x001c) EventId with Facility = ServiceModel.
68         WebHostNotLoggingInsufficientMemoryExceptionsOnActivationForNextTimeInterval = EventSeverity.Warning | EventFacility.ServiceModel | 0x001c,
69 
70         // TransactionBridge
71         // All EventId's beneath 'UnhandledStateMachineExceptionRecordDescription', until the next explicitly assigned one, inherit its severity and facility, via the enum's auto-incrememt
72         UnhandledStateMachineExceptionRecordDescription = EventSeverity.Error | EventFacility.TransactionBridge | 0x0001,
73         FatalUnexpectedStateMachineEvent,
74         ParticipantRecoveryLogEntryCorrupt,
75         CoordinatorRecoveryLogEntryCorrupt,
76         CoordinatorRecoveryLogEntryCreationFailure,
77         ParticipantRecoveryLogEntryCreationFailure,
78         ProtocolInitializationFailure,
79         ProtocolStartFailure,
80         ProtocolRecoveryBeginningFailure,
81         ProtocolRecoveryCompleteFailure,
82         TransactionBridgeRecoveryFailure,
83         ProtocolStopFailure,
84         NonFatalUnexpectedStateMachineEvent,
85         PerformanceCounterInitializationFailure,
86         ProtocolRecoveryComplete,
87         ProtocolStopped,
88         ThumbPrintNotFound,
89         ThumbPrintNotValidated,
90         SslNoPrivateKey,
91         SslNoAccessiblePrivateKey,
92         MissingNecessaryKeyUsage,
93         MissingNecessaryEnhancedKeyUsage,
94 
95         // SMSvcHost
96         // All EventId's beneath 'StartErrorPublish', until the next explicitly assigned one, inherit its severity and facility, via the enum's auto-incrememt
97         StartErrorPublish = EventSeverity.Error | EventFacility.SMSvcHost | 0x0001,
98         BindingError,
99         LAFailedToListenForApp,
100         UnknownListenerAdapterError,
101         WasDisconnected,
102         WasConnectionTimedout,
103         ServiceStartFailed,
104         MessageQueueDuplicatedSocketLeak,
105         MessageQueueDuplicatedPipeLeak,
106         SharingUnhandledException,
107 
108         // SecurityAudit
109         ServiceAuthorizationSuccess = EventSeverity.Informational | EventFacility.SecurityAudit | 0x0001,
110         ServiceAuthorizationFailure = EventSeverity.Error | EventFacility.SecurityAudit | 0x0002,
111         MessageAuthenticationSuccess = EventSeverity.Informational | EventFacility.SecurityAudit | 0x0003,
112         MessageAuthenticationFailure = EventSeverity.Error | EventFacility.SecurityAudit | 0x0004,
113         SecurityNegotiationSuccess = EventSeverity.Informational | EventFacility.SecurityAudit | 0x0005,
114         SecurityNegotiationFailure = EventSeverity.Error | EventFacility.SecurityAudit | 0x0006,
115         TransportAuthenticationSuccess = EventSeverity.Informational | EventFacility.SecurityAudit | 0x0007,
116         TransportAuthenticationFailure = EventSeverity.Error | EventFacility.SecurityAudit | 0x0008,
117         ImpersonationSuccess = EventSeverity.Informational | EventFacility.SecurityAudit | 0x0009,
118         ImpersonationFailure = EventSeverity.Error | EventFacility.SecurityAudit | 0x000a
119     }
120 
121     enum EventSeverity : uint
122     {
123         Success = 0x00000000,
124         Informational = 0x40000000,
125         Warning = 0x80000000,
126         Error = 0xc0000000
127     }
128 
129     enum EventFacility : uint
130     {
131         Tracing = 0x00010000,
132         ServiceModel = 0x00020000,
133         TransactionBridge = 0x00030000,
134         SMSvcHost = 0x00040000,
135         InfoCards = 0x00050000,
136         SecurityAudit = 0x00060000
137     }
138 }
139