TraceCore.Designer.cs 47 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870
  1. //------------------------------------------------------------------------------
  2. // <auto-generated>
  3. // This code was generated by a tool.
  4. //
  5. // Changes to this file may cause incorrect behavior and will be lost if
  6. // the code is regenerated.
  7. // </auto-generated>
  8. //------------------------------------------------------------------------------
  9. namespace System.Runtime
  10. {
  11. using System.Runtime.Diagnostics;
  12. using System.Security;
  13. internal partial class TraceCore
  14. {
  15. static System.Resources.ResourceManager resourceManager;
  16. static System.Globalization.CultureInfo resourceCulture;
  17. [System.Security.SecurityCriticalAttribute()]
  18. static System.Runtime.Diagnostics.EventDescriptor[] eventDescriptors;
  19. static object syncLock = new object();
  20. // Double-checked locking pattern requires volatile for read/write synchronization
  21. static volatile bool eventDescriptorsCreated;
  22. private TraceCore()
  23. {
  24. }
  25. [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Justification="This is an auto-generated code, some ETW/TraceSource mixed code would use it.")]
  26. static System.Resources.ResourceManager ResourceManager
  27. {
  28. get
  29. {
  30. if (object.ReferenceEquals(resourceManager, null))
  31. {
  32. resourceManager = new System.Resources.ResourceManager("System.Runtime.TraceCore", typeof(TraceCore).Assembly);
  33. }
  34. return resourceManager;
  35. }
  36. }
  37. [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Justification="This template is shared across all assemblies, some of which use this accessor.")]
  38. internal static System.Globalization.CultureInfo Culture
  39. {
  40. get
  41. {
  42. return resourceCulture;
  43. }
  44. set
  45. {
  46. resourceCulture = value;
  47. }
  48. }
  49. /// <summary>
  50. /// Check if trace definition is enabled
  51. /// Event description ID=57393, Level=informational, Channel=Debug
  52. /// </summary>
  53. /// <param name="trace">The trace provider</param>
  54. internal static bool AppDomainUnloadIsEnabled(EtwDiagnosticTrace trace)
  55. {
  56. return (trace.ShouldTrace(TraceEventLevel.Informational) || TraceCore.IsEtwEventEnabled(trace, 0));
  57. }
  58. /// <summary>
  59. /// Gets trace definition like: AppDomain unloading. AppDomain.FriendlyName {0}, ProcessName {1}, ProcessId {2}.
  60. /// Event description ID=57393, Level=informational, Channel=Debug
  61. /// </summary>
  62. /// <param name="trace">The trace provider</param>
  63. /// <param name="appdomainName">Parameter 0 for event: AppDomain unloading. AppDomain.FriendlyName {0}, ProcessName {1}, ProcessId {2}.</param>
  64. /// <param name="processName">Parameter 1 for event: AppDomain unloading. AppDomain.FriendlyName {0}, ProcessName {1}, ProcessId {2}.</param>
  65. /// <param name="processId">Parameter 2 for event: AppDomain unloading. AppDomain.FriendlyName {0}, ProcessName {1}, ProcessId {2}.</param>
  66. internal static void AppDomainUnload(EtwDiagnosticTrace trace, string appdomainName, string processName, string processId)
  67. {
  68. TracePayload payload = trace.GetSerializedPayload(null, null, null);
  69. if (TraceCore.IsEtwEventEnabled(trace, 0))
  70. {
  71. TraceCore.WriteEtwEvent(trace, 0, null, appdomainName, processName, processId, payload.AppDomainFriendlyName);
  72. }
  73. if (trace.ShouldTraceToTraceSource(TraceEventLevel.Informational))
  74. {
  75. string description = string.Format(Culture, ResourceManager.GetString("AppDomainUnload", Culture), appdomainName, processName, processId);
  76. TraceCore.WriteTraceSource(trace, 0, description, payload);
  77. }
  78. }
  79. /// <summary>
  80. /// Check if trace definition is enabled
  81. /// Event description ID=57394, Level=informational, Channel=Analytic
  82. /// </summary>
  83. /// <param name="trace">The trace provider</param>
  84. internal static bool HandledExceptionIsEnabled(EtwDiagnosticTrace trace)
  85. {
  86. return (trace.ShouldTrace(TraceEventLevel.Informational) || TraceCore.IsEtwEventEnabled(trace, 1));
  87. }
  88. /// <summary>
  89. /// Gets trace definition like: Handling an exception. Exception details: {0}
  90. /// Event description ID=57394, Level=informational, Channel=Analytic
  91. /// </summary>
  92. /// <param name="trace">The trace provider</param>
  93. /// <param name="param0">Parameter 0 for event: Handling an exception. Exception details: {0}</param>
  94. /// <param name="exception">Exception associated with the event</param>
  95. internal static void HandledException(EtwDiagnosticTrace trace, string param0, System.Exception exception)
  96. {
  97. TracePayload payload = trace.GetSerializedPayload(null, null, exception);
  98. if (TraceCore.IsEtwEventEnabled(trace, 1))
  99. {
  100. TraceCore.WriteEtwEvent(trace, 1, null, param0, payload.SerializedException, payload.AppDomainFriendlyName);
  101. }
  102. if (trace.ShouldTraceToTraceSource(TraceEventLevel.Informational))
  103. {
  104. string description = string.Format(Culture, ResourceManager.GetString("HandledException", Culture), param0);
  105. TraceCore.WriteTraceSource(trace, 1, description, payload);
  106. }
  107. }
  108. /// <summary>
  109. /// Check if trace definition is enabled
  110. /// Event description ID=57395, Level=error, Channel=Analytic
  111. /// </summary>
  112. /// <param name="trace">The trace provider</param>
  113. internal static bool ShipAssertExceptionMessageIsEnabled(EtwDiagnosticTrace trace)
  114. {
  115. return (trace.ShouldTrace(TraceEventLevel.Error) || TraceCore.IsEtwEventEnabled(trace, 2));
  116. }
  117. /// <summary>
  118. /// Gets trace definition like: An unexpected failure occurred. Applications should not attempt to handle this error. For diagnostic purposes, this English message is associated with the failure: {0}.
  119. /// Event description ID=57395, Level=error, Channel=Analytic
  120. /// </summary>
  121. /// <param name="trace">The trace provider</param>
  122. /// <param name="param0">Parameter 0 for event: An unexpected failure occurred. Applications should not attempt to handle this error. For diagnostic purposes, this English message is associated with the failure: {0}.</param>
  123. internal static void ShipAssertExceptionMessage(EtwDiagnosticTrace trace, string param0)
  124. {
  125. TracePayload payload = trace.GetSerializedPayload(null, null, null);
  126. if (TraceCore.IsEtwEventEnabled(trace, 2))
  127. {
  128. TraceCore.WriteEtwEvent(trace, 2, null, param0, payload.AppDomainFriendlyName);
  129. }
  130. if (trace.ShouldTraceToTraceSource(TraceEventLevel.Error))
  131. {
  132. string description = string.Format(Culture, ResourceManager.GetString("ShipAssertExceptionMessage", Culture), param0);
  133. TraceCore.WriteTraceSource(trace, 2, description, payload);
  134. }
  135. }
  136. /// <summary>
  137. /// Check if trace definition is enabled
  138. /// Event description ID=57396, Level=warning, Channel=Analytic
  139. /// </summary>
  140. /// <param name="trace">The trace provider</param>
  141. internal static bool ThrowingExceptionIsEnabled(EtwDiagnosticTrace trace)
  142. {
  143. return (trace.ShouldTrace(TraceEventLevel.Warning) || TraceCore.IsEtwEventEnabled(trace, 3));
  144. }
  145. /// <summary>
  146. /// Gets trace definition like: Throwing an exception. Source: {0}. Exception details: {1}
  147. /// Event description ID=57396, Level=warning, Channel=Analytic
  148. /// </summary>
  149. /// <param name="trace">The trace provider</param>
  150. /// <param name="param0">Parameter 0 for event: Throwing an exception. Source: {0}. Exception details: {1}</param>
  151. /// <param name="param1">Parameter 1 for event: Throwing an exception. Source: {0}. Exception details: {1}</param>
  152. /// <param name="exception">Exception associated with the event</param>
  153. internal static void ThrowingException(EtwDiagnosticTrace trace, string param0, string param1, System.Exception exception)
  154. {
  155. TracePayload payload = trace.GetSerializedPayload(null, null, exception);
  156. if (TraceCore.IsEtwEventEnabled(trace, 3))
  157. {
  158. TraceCore.WriteEtwEvent(trace, 3, null, param0, param1, payload.SerializedException, payload.AppDomainFriendlyName);
  159. }
  160. if (trace.ShouldTraceToTraceSource(TraceEventLevel.Warning))
  161. {
  162. string description = string.Format(Culture, ResourceManager.GetString("ThrowingException", Culture), param0, param1);
  163. TraceCore.WriteTraceSource(trace, 3, description, payload);
  164. }
  165. }
  166. /// <summary>
  167. /// Check if trace definition is enabled
  168. /// Event description ID=57397, Level=critical, Channel=Operational
  169. /// </summary>
  170. /// <param name="trace">The trace provider</param>
  171. internal static bool UnhandledExceptionIsEnabled(EtwDiagnosticTrace trace)
  172. {
  173. return (trace.ShouldTrace(TraceEventLevel.Critical) || TraceCore.IsEtwEventEnabled(trace, 4));
  174. }
  175. /// <summary>
  176. /// Gets trace definition like: Unhandled exception. Exception details: {0}
  177. /// Event description ID=57397, Level=critical, Channel=Operational
  178. /// </summary>
  179. /// <param name="trace">The trace provider</param>
  180. /// <param name="param0">Parameter 0 for event: Unhandled exception. Exception details: {0}</param>
  181. /// <param name="exception">Exception associated with the event</param>
  182. internal static void UnhandledException(EtwDiagnosticTrace trace, string param0, System.Exception exception)
  183. {
  184. TracePayload payload = trace.GetSerializedPayload(null, null, exception);
  185. if (TraceCore.IsEtwEventEnabled(trace, 4))
  186. {
  187. TraceCore.WriteEtwEvent(trace, 4, null, param0, payload.SerializedException, payload.AppDomainFriendlyName);
  188. }
  189. if (trace.ShouldTraceToTraceSource(TraceEventLevel.Critical))
  190. {
  191. string description = string.Format(Culture, ResourceManager.GetString("UnhandledException", Culture), param0);
  192. TraceCore.WriteTraceSource(trace, 4, description, payload);
  193. }
  194. }
  195. /// <summary>
  196. /// Check if trace definition is enabled
  197. /// Event description ID=57399, Level=critical, Channel=Debug
  198. /// </summary>
  199. /// <param name="trace">The trace provider</param>
  200. internal static bool TraceCodeEventLogCriticalIsEnabled(EtwDiagnosticTrace trace)
  201. {
  202. return (trace.ShouldTrace(TraceEventLevel.Critical) || TraceCore.IsEtwEventEnabled(trace, 5));
  203. }
  204. /// <summary>
  205. /// Gets trace definition like: Wrote to the EventLog.
  206. /// Event description ID=57399, Level=critical, Channel=Debug
  207. /// </summary>
  208. /// <param name="trace">The trace provider</param>
  209. /// <param name="traceRecord">Extended data (TraceRecord) for the event</param>
  210. internal static void TraceCodeEventLogCritical(EtwDiagnosticTrace trace, TraceRecord traceRecord)
  211. {
  212. TracePayload payload = trace.GetSerializedPayload(null, traceRecord, null);
  213. if (TraceCore.IsEtwEventEnabled(trace, 5))
  214. {
  215. TraceCore.WriteEtwEvent(trace, 5, null, payload.ExtendedData, payload.AppDomainFriendlyName);
  216. }
  217. if (trace.ShouldTraceToTraceSource(TraceEventLevel.Critical))
  218. {
  219. string description = string.Format(Culture, ResourceManager.GetString("TraceCodeEventLogCritical", Culture));
  220. TraceCore.WriteTraceSource(trace, 5, description, payload);
  221. }
  222. }
  223. /// <summary>
  224. /// Check if trace definition is enabled
  225. /// Event description ID=57400, Level=error, Channel=Debug
  226. /// </summary>
  227. /// <param name="trace">The trace provider</param>
  228. internal static bool TraceCodeEventLogErrorIsEnabled(EtwDiagnosticTrace trace)
  229. {
  230. return (trace.ShouldTrace(TraceEventLevel.Error) || TraceCore.IsEtwEventEnabled(trace, 6));
  231. }
  232. /// <summary>
  233. /// Gets trace definition like: Wrote to the EventLog.
  234. /// Event description ID=57400, Level=error, Channel=Debug
  235. /// </summary>
  236. /// <param name="trace">The trace provider</param>
  237. /// <param name="traceRecord">Extended data (TraceRecord) for the event</param>
  238. internal static void TraceCodeEventLogError(EtwDiagnosticTrace trace, TraceRecord traceRecord)
  239. {
  240. TracePayload payload = trace.GetSerializedPayload(null, traceRecord, null);
  241. if (TraceCore.IsEtwEventEnabled(trace, 6))
  242. {
  243. TraceCore.WriteEtwEvent(trace, 6, null, payload.ExtendedData, payload.AppDomainFriendlyName);
  244. }
  245. if (trace.ShouldTraceToTraceSource(TraceEventLevel.Error))
  246. {
  247. string description = string.Format(Culture, ResourceManager.GetString("TraceCodeEventLogError", Culture));
  248. TraceCore.WriteTraceSource(trace, 6, description, payload);
  249. }
  250. }
  251. /// <summary>
  252. /// Check if trace definition is enabled
  253. /// Event description ID=57401, Level=informational, Channel=Debug
  254. /// </summary>
  255. /// <param name="trace">The trace provider</param>
  256. internal static bool TraceCodeEventLogInfoIsEnabled(EtwDiagnosticTrace trace)
  257. {
  258. return (trace.ShouldTrace(TraceEventLevel.Informational) || TraceCore.IsEtwEventEnabled(trace, 7));
  259. }
  260. /// <summary>
  261. /// Gets trace definition like: Wrote to the EventLog.
  262. /// Event description ID=57401, Level=informational, Channel=Debug
  263. /// </summary>
  264. /// <param name="trace">The trace provider</param>
  265. /// <param name="traceRecord">Extended data (TraceRecord) for the event</param>
  266. internal static void TraceCodeEventLogInfo(EtwDiagnosticTrace trace, TraceRecord traceRecord)
  267. {
  268. TracePayload payload = trace.GetSerializedPayload(null, traceRecord, null);
  269. if (TraceCore.IsEtwEventEnabled(trace, 7))
  270. {
  271. TraceCore.WriteEtwEvent(trace, 7, null, payload.ExtendedData, payload.AppDomainFriendlyName);
  272. }
  273. if (trace.ShouldTraceToTraceSource(TraceEventLevel.Informational))
  274. {
  275. string description = string.Format(Culture, ResourceManager.GetString("TraceCodeEventLogInfo", Culture));
  276. TraceCore.WriteTraceSource(trace, 7, description, payload);
  277. }
  278. }
  279. /// <summary>
  280. /// Check if trace definition is enabled
  281. /// Event description ID=57402, Level=verbose, Channel=Debug
  282. /// </summary>
  283. /// <param name="trace">The trace provider</param>
  284. internal static bool TraceCodeEventLogVerboseIsEnabled(EtwDiagnosticTrace trace)
  285. {
  286. return (trace.ShouldTrace(TraceEventLevel.Verbose) || TraceCore.IsEtwEventEnabled(trace, 8));
  287. }
  288. /// <summary>
  289. /// Gets trace definition like: Wrote to the EventLog.
  290. /// Event description ID=57402, Level=verbose, Channel=Debug
  291. /// </summary>
  292. /// <param name="trace">The trace provider</param>
  293. /// <param name="traceRecord">Extended data (TraceRecord) for the event</param>
  294. internal static void TraceCodeEventLogVerbose(EtwDiagnosticTrace trace, TraceRecord traceRecord)
  295. {
  296. TracePayload payload = trace.GetSerializedPayload(null, traceRecord, null);
  297. if (TraceCore.IsEtwEventEnabled(trace, 8))
  298. {
  299. TraceCore.WriteEtwEvent(trace, 8, null, payload.ExtendedData, payload.AppDomainFriendlyName);
  300. }
  301. if (trace.ShouldTraceToTraceSource(TraceEventLevel.Verbose))
  302. {
  303. string description = string.Format(Culture, ResourceManager.GetString("TraceCodeEventLogVerbose", Culture));
  304. TraceCore.WriteTraceSource(trace, 8, description, payload);
  305. }
  306. }
  307. /// <summary>
  308. /// Check if trace definition is enabled
  309. /// Event description ID=57403, Level=warning, Channel=Debug
  310. /// </summary>
  311. /// <param name="trace">The trace provider</param>
  312. internal static bool TraceCodeEventLogWarningIsEnabled(EtwDiagnosticTrace trace)
  313. {
  314. return (trace.ShouldTrace(TraceEventLevel.Warning) || TraceCore.IsEtwEventEnabled(trace, 9));
  315. }
  316. /// <summary>
  317. /// Gets trace definition like: Wrote to the EventLog.
  318. /// Event description ID=57403, Level=warning, Channel=Debug
  319. /// </summary>
  320. /// <param name="trace">The trace provider</param>
  321. /// <param name="traceRecord">Extended data (TraceRecord) for the event</param>
  322. internal static void TraceCodeEventLogWarning(EtwDiagnosticTrace trace, TraceRecord traceRecord)
  323. {
  324. TracePayload payload = trace.GetSerializedPayload(null, traceRecord, null);
  325. if (TraceCore.IsEtwEventEnabled(trace, 9))
  326. {
  327. TraceCore.WriteEtwEvent(trace, 9, null, payload.ExtendedData, payload.AppDomainFriendlyName);
  328. }
  329. if (trace.ShouldTraceToTraceSource(TraceEventLevel.Warning))
  330. {
  331. string description = string.Format(Culture, ResourceManager.GetString("TraceCodeEventLogWarning", Culture));
  332. TraceCore.WriteTraceSource(trace, 9, description, payload);
  333. }
  334. }
  335. /// <summary>
  336. /// Check if trace definition is enabled
  337. /// Event description ID=57404, Level=warning, Channel=Analytic
  338. /// </summary>
  339. /// <param name="trace">The trace provider</param>
  340. internal static bool HandledExceptionWarningIsEnabled(EtwDiagnosticTrace trace)
  341. {
  342. return (trace.ShouldTrace(TraceEventLevel.Warning) || TraceCore.IsEtwEventEnabled(trace, 10));
  343. }
  344. /// <summary>
  345. /// Gets trace definition like: Handling an exception. Exception details: {0}
  346. /// Event description ID=57404, Level=warning, Channel=Analytic
  347. /// </summary>
  348. /// <param name="trace">The trace provider</param>
  349. /// <param name="param0">Parameter 0 for event: Handling an exception. Exception details: {0}</param>
  350. /// <param name="exception">Exception associated with the event</param>
  351. internal static void HandledExceptionWarning(EtwDiagnosticTrace trace, string param0, System.Exception exception)
  352. {
  353. TracePayload payload = trace.GetSerializedPayload(null, null, exception);
  354. if (TraceCore.IsEtwEventEnabled(trace, 10))
  355. {
  356. TraceCore.WriteEtwEvent(trace, 10, null, param0, payload.SerializedException, payload.AppDomainFriendlyName);
  357. }
  358. if (trace.ShouldTraceToTraceSource(TraceEventLevel.Warning))
  359. {
  360. string description = string.Format(Culture, ResourceManager.GetString("HandledExceptionWarning", Culture), param0);
  361. TraceCore.WriteTraceSource(trace, 10, description, payload);
  362. }
  363. }
  364. /// <summary>
  365. /// Check if trace definition is enabled
  366. /// Event description ID=131, Level=verbose, Channel=Debug
  367. /// </summary>
  368. /// <param name="trace">The trace provider</param>
  369. internal static bool BufferPoolAllocationIsEnabled(EtwDiagnosticTrace trace)
  370. {
  371. return TraceCore.IsEtwEventEnabled(trace, 11);
  372. }
  373. /// <summary>
  374. /// Gets trace definition like: Pool allocating {0} Bytes.
  375. /// Event description ID=131, Level=verbose, Channel=Debug
  376. /// </summary>
  377. /// <param name="trace">The trace provider</param>
  378. /// <param name="Size">Parameter 0 for event: Pool allocating {0} Bytes.</param>
  379. internal static void BufferPoolAllocation(EtwDiagnosticTrace trace, int Size)
  380. {
  381. TracePayload payload = trace.GetSerializedPayload(null, null, null);
  382. if (TraceCore.IsEtwEventEnabled(trace, 11))
  383. {
  384. TraceCore.WriteEtwEvent(trace, 11, null, Size, payload.AppDomainFriendlyName);
  385. }
  386. }
  387. /// <summary>
  388. /// Check if trace definition is enabled
  389. /// Event description ID=132, Level=verbose, Channel=Debug
  390. /// </summary>
  391. /// <param name="trace">The trace provider</param>
  392. internal static bool BufferPoolChangeQuotaIsEnabled(EtwDiagnosticTrace trace)
  393. {
  394. return TraceCore.IsEtwEventEnabled(trace, 12);
  395. }
  396. /// <summary>
  397. /// Gets trace definition like: BufferPool of size {0}, changing quota by {1}.
  398. /// Event description ID=132, Level=verbose, Channel=Debug
  399. /// </summary>
  400. /// <param name="trace">The trace provider</param>
  401. /// <param name="PoolSize">Parameter 0 for event: BufferPool of size {0}, changing quota by {1}.</param>
  402. /// <param name="Delta">Parameter 1 for event: BufferPool of size {0}, changing quota by {1}.</param>
  403. internal static void BufferPoolChangeQuota(EtwDiagnosticTrace trace, int PoolSize, int Delta)
  404. {
  405. TracePayload payload = trace.GetSerializedPayload(null, null, null);
  406. if (TraceCore.IsEtwEventEnabled(trace, 12))
  407. {
  408. TraceCore.WriteEtwEvent(trace, 12, null, PoolSize, Delta, payload.AppDomainFriendlyName);
  409. }
  410. }
  411. /// <summary>
  412. /// Check if trace definition is enabled
  413. /// Event description ID=133, Level=verbose, Channel=Debug
  414. /// </summary>
  415. /// <param name="trace">The trace provider</param>
  416. internal static bool ActionItemScheduledIsEnabled(EtwDiagnosticTrace trace)
  417. {
  418. return TraceCore.IsEtwEventEnabled(trace, 13);
  419. }
  420. /// <summary>
  421. /// Gets trace definition like: IO Thread scheduler callback invoked.
  422. /// Event description ID=133, Level=verbose, Channel=Debug
  423. /// </summary>
  424. /// <param name="trace">The trace provider</param>
  425. /// <param name="eventTraceActivity">The event trace activity</param>
  426. internal static void ActionItemScheduled(EtwDiagnosticTrace trace, System.Runtime.Diagnostics.EventTraceActivity eventTraceActivity)
  427. {
  428. TracePayload payload = trace.GetSerializedPayload(null, null, null);
  429. if (TraceCore.IsEtwEventEnabled(trace, 13))
  430. {
  431. TraceCore.WriteEtwEvent(trace, 13, eventTraceActivity, payload.AppDomainFriendlyName);
  432. }
  433. }
  434. /// <summary>
  435. /// Check if trace definition is enabled
  436. /// Event description ID=134, Level=verbose, Channel=Debug
  437. /// </summary>
  438. /// <param name="trace">The trace provider</param>
  439. internal static bool ActionItemCallbackInvokedIsEnabled(EtwDiagnosticTrace trace)
  440. {
  441. return TraceCore.IsEtwEventEnabled(trace, 14);
  442. }
  443. /// <summary>
  444. /// Gets trace definition like: IO Thread scheduler callback invoked.
  445. /// Event description ID=134, Level=verbose, Channel=Debug
  446. /// </summary>
  447. /// <param name="trace">The trace provider</param>
  448. /// <param name="eventTraceActivity">The event trace activity</param>
  449. internal static void ActionItemCallbackInvoked(EtwDiagnosticTrace trace, System.Runtime.Diagnostics.EventTraceActivity eventTraceActivity)
  450. {
  451. TracePayload payload = trace.GetSerializedPayload(null, null, null);
  452. if (TraceCore.IsEtwEventEnabled(trace, 14))
  453. {
  454. TraceCore.WriteEtwEvent(trace, 14, eventTraceActivity, payload.AppDomainFriendlyName);
  455. }
  456. }
  457. /// <summary>
  458. /// Check if trace definition is enabled
  459. /// Event description ID=57405, Level=error, Channel=Operational
  460. /// </summary>
  461. /// <param name="trace">The trace provider</param>
  462. internal static bool HandledExceptionErrorIsEnabled(EtwDiagnosticTrace trace)
  463. {
  464. return (trace.ShouldTrace(TraceEventLevel.Error) || TraceCore.IsEtwEventEnabled(trace, 15));
  465. }
  466. /// <summary>
  467. /// Gets trace definition like: Handling an exception. Exception details: {0}
  468. /// Event description ID=57405, Level=error, Channel=Operational
  469. /// </summary>
  470. /// <param name="trace">The trace provider</param>
  471. /// <param name="param0">Parameter 0 for event: Handling an exception. Exception details: {0}</param>
  472. /// <param name="exception">Exception associated with the event</param>
  473. internal static void HandledExceptionError(EtwDiagnosticTrace trace, string param0, System.Exception exception)
  474. {
  475. TracePayload payload = trace.GetSerializedPayload(null, null, exception);
  476. if (TraceCore.IsEtwEventEnabled(trace, 15))
  477. {
  478. TraceCore.WriteEtwEvent(trace, 15, null, param0, payload.SerializedException, payload.AppDomainFriendlyName);
  479. }
  480. if (trace.ShouldTraceToTraceSource(TraceEventLevel.Error))
  481. {
  482. string description = string.Format(Culture, ResourceManager.GetString("HandledExceptionError", Culture), param0);
  483. TraceCore.WriteTraceSource(trace, 15, description, payload);
  484. }
  485. }
  486. /// <summary>
  487. /// Check if trace definition is enabled
  488. /// Event description ID=57406, Level=verbose, Channel=Analytic
  489. /// </summary>
  490. /// <param name="trace">The trace provider</param>
  491. internal static bool HandledExceptionVerboseIsEnabled(EtwDiagnosticTrace trace)
  492. {
  493. return (trace.ShouldTrace(TraceEventLevel.Verbose) || TraceCore.IsEtwEventEnabled(trace, 16));
  494. }
  495. /// <summary>
  496. /// Gets trace definition like: Handling an exception Exception details: {0}
  497. /// Event description ID=57406, Level=verbose, Channel=Analytic
  498. /// </summary>
  499. /// <param name="trace">The trace provider</param>
  500. /// <param name="param0">Parameter 0 for event: Handling an exception Exception details: {0}</param>
  501. /// <param name="exception">Exception associated with the event</param>
  502. internal static void HandledExceptionVerbose(EtwDiagnosticTrace trace, string param0, System.Exception exception)
  503. {
  504. TracePayload payload = trace.GetSerializedPayload(null, null, exception);
  505. if (TraceCore.IsEtwEventEnabled(trace, 16))
  506. {
  507. TraceCore.WriteEtwEvent(trace, 16, null, param0, payload.SerializedException, payload.AppDomainFriendlyName);
  508. }
  509. if (trace.ShouldTraceToTraceSource(TraceEventLevel.Verbose))
  510. {
  511. string description = string.Format(Culture, ResourceManager.GetString("HandledExceptionVerbose", Culture), param0);
  512. TraceCore.WriteTraceSource(trace, 16, description, payload);
  513. }
  514. }
  515. /// <summary>
  516. /// Check if trace definition is enabled
  517. /// Event description ID=57408, Level=critical, Channel=Operational
  518. /// </summary>
  519. /// <param name="trace">The trace provider</param>
  520. internal static bool EtwUnhandledExceptionIsEnabled(EtwDiagnosticTrace trace)
  521. {
  522. return TraceCore.IsEtwEventEnabled(trace, 17);
  523. }
  524. /// <summary>
  525. /// Gets trace definition like: Unhandled exception. Exception details: {0}
  526. /// Event description ID=57408, Level=critical, Channel=Operational
  527. /// </summary>
  528. /// <param name="trace">The trace provider</param>
  529. /// <param name="param0">Parameter 0 for event: Unhandled exception. Exception details: {0}</param>
  530. /// <param name="exception">Exception associated with the event</param>
  531. internal static void EtwUnhandledException(EtwDiagnosticTrace trace, string param0, System.Exception exception)
  532. {
  533. TracePayload payload = trace.GetSerializedPayload(null, null, exception);
  534. if (TraceCore.IsEtwEventEnabled(trace, 17))
  535. {
  536. TraceCore.WriteEtwEvent(trace, 17, null, param0, payload.SerializedException, payload.AppDomainFriendlyName);
  537. }
  538. }
  539. /// <summary>
  540. /// Check if trace definition is enabled
  541. /// Event description ID=57410, Level=warning, Channel=Analytic
  542. /// </summary>
  543. /// <param name="trace">The trace provider</param>
  544. internal static bool ThrowingEtwExceptionIsEnabled(EtwDiagnosticTrace trace)
  545. {
  546. return TraceCore.IsEtwEventEnabled(trace, 18);
  547. }
  548. /// <summary>
  549. /// Gets trace definition like: Throwing an exception. Source: {0}. Exception details: {1}
  550. /// Event description ID=57410, Level=warning, Channel=Analytic
  551. /// </summary>
  552. /// <param name="trace">The trace provider</param>
  553. /// <param name="param0">Parameter 0 for event: Throwing an exception. Source: {0}. Exception details: {1}</param>
  554. /// <param name="param1">Parameter 1 for event: Throwing an exception. Source: {0}. Exception details: {1}</param>
  555. /// <param name="exception">Exception associated with the event</param>
  556. internal static void ThrowingEtwException(EtwDiagnosticTrace trace, string param0, string param1, System.Exception exception)
  557. {
  558. TracePayload payload = trace.GetSerializedPayload(null, null, exception);
  559. if (TraceCore.IsEtwEventEnabled(trace, 18))
  560. {
  561. TraceCore.WriteEtwEvent(trace, 18, null, param0, param1, payload.SerializedException, payload.AppDomainFriendlyName);
  562. }
  563. }
  564. /// <summary>
  565. /// Check if trace definition is enabled
  566. /// Event description ID=57409, Level=verbose, Channel=Analytic
  567. /// </summary>
  568. /// <param name="trace">The trace provider</param>
  569. internal static bool ThrowingEtwExceptionVerboseIsEnabled(EtwDiagnosticTrace trace)
  570. {
  571. return TraceCore.IsEtwEventEnabled(trace, 19);
  572. }
  573. /// <summary>
  574. /// Gets trace definition like: Throwing an exception. Source: {0}. Exception details: {1}
  575. /// Event description ID=57409, Level=verbose, Channel=Analytic
  576. /// </summary>
  577. /// <param name="trace">The trace provider</param>
  578. /// <param name="param0">Parameter 0 for event: Throwing an exception. Source: {0}. Exception details: {1}</param>
  579. /// <param name="param1">Parameter 1 for event: Throwing an exception. Source: {0}. Exception details: {1}</param>
  580. /// <param name="exception">Exception associated with the event</param>
  581. internal static void ThrowingEtwExceptionVerbose(EtwDiagnosticTrace trace, string param0, string param1, System.Exception exception)
  582. {
  583. TracePayload payload = trace.GetSerializedPayload(null, null, exception);
  584. if (TraceCore.IsEtwEventEnabled(trace, 19))
  585. {
  586. TraceCore.WriteEtwEvent(trace, 19, null, param0, param1, payload.SerializedException, payload.AppDomainFriendlyName);
  587. }
  588. }
  589. /// <summary>
  590. /// Check if trace definition is enabled
  591. /// Event description ID=57407, Level=verbose, Channel=Analytic
  592. /// </summary>
  593. /// <param name="trace">The trace provider</param>
  594. internal static bool ThrowingExceptionVerboseIsEnabled(EtwDiagnosticTrace trace)
  595. {
  596. return (trace.ShouldTrace(TraceEventLevel.Verbose) || TraceCore.IsEtwEventEnabled(trace, 20));
  597. }
  598. /// <summary>
  599. /// Gets trace definition like: Throwing an exception. Source: {0}. Exception details: {1}
  600. /// Event description ID=57407, Level=verbose, Channel=Analytic
  601. /// </summary>
  602. /// <param name="trace">The trace provider</param>
  603. /// <param name="param0">Parameter 0 for event: Throwing an exception. Source: {0}. Exception details: {1}</param>
  604. /// <param name="param1">Parameter 1 for event: Throwing an exception. Source: {0}. Exception details: {1}</param>
  605. /// <param name="exception">Exception associated with the event</param>
  606. internal static void ThrowingExceptionVerbose(EtwDiagnosticTrace trace, string param0, string param1, System.Exception exception)
  607. {
  608. TracePayload payload = trace.GetSerializedPayload(null, null, exception);
  609. if (TraceCore.IsEtwEventEnabled(trace, 20))
  610. {
  611. TraceCore.WriteEtwEvent(trace, 20, null, param0, param1, payload.SerializedException, payload.AppDomainFriendlyName);
  612. }
  613. if (trace.ShouldTraceToTraceSource(TraceEventLevel.Verbose))
  614. {
  615. string description = string.Format(Culture, ResourceManager.GetString("ThrowingExceptionVerbose", Culture), param0, param1);
  616. TraceCore.WriteTraceSource(trace, 20, description, payload);
  617. }
  618. }
  619. /// <summary>
  620. /// Creates the event descriptors array
  621. /// </summary>
  622. // Critical = Sets the SecurityCritical member eventDescriptors
  623. // Safe = We control what the event descriptors contain
  624. [System.Security.SecuritySafeCriticalAttribute()]
  625. static void CreateEventDescriptors()
  626. {
  627. eventDescriptors = new System.Runtime.Diagnostics.EventDescriptor[] {
  628. new System.Runtime.Diagnostics.EventDescriptor(57393, 0, (byte)TraceChannel.Debug, (byte)TraceEventLevel.Informational, (byte)TraceEventOpcode.Info, 0x0, 0x1000000000010000),
  629. new System.Runtime.Diagnostics.EventDescriptor(57394, 0, (byte)TraceChannel.Analytic, (byte)TraceEventLevel.Informational, (byte)TraceEventOpcode.Info, 0x0, 0x2000000000010000),
  630. new System.Runtime.Diagnostics.EventDescriptor(57395, 0, (byte)TraceChannel.Analytic, (byte)TraceEventLevel.Error, (byte)TraceEventOpcode.Info, 0x0, 0x2000000000010000),
  631. new System.Runtime.Diagnostics.EventDescriptor(57396, 0, (byte)TraceChannel.Analytic, (byte)TraceEventLevel.Warning, (byte)TraceEventOpcode.Info, 0x0, 0x2000000000010000),
  632. new System.Runtime.Diagnostics.EventDescriptor(57397, 0, (byte)TraceChannel.Operational, (byte)TraceEventLevel.Critical, (byte)TraceEventOpcode.Info, 0x0, 0x4000000000010000),
  633. new System.Runtime.Diagnostics.EventDescriptor(57399, 0, (byte)TraceChannel.Debug, (byte)TraceEventLevel.Critical, (byte)TraceEventOpcode.Info, 0x0, 0x1000000000010000),
  634. new System.Runtime.Diagnostics.EventDescriptor(57400, 0, (byte)TraceChannel.Debug, (byte)TraceEventLevel.Error, (byte)TraceEventOpcode.Info, 0x0, 0x1000000000010000),
  635. new System.Runtime.Diagnostics.EventDescriptor(57401, 0, (byte)TraceChannel.Debug, (byte)TraceEventLevel.Informational, (byte)TraceEventOpcode.Info, 0x0, 0x1000000000010000),
  636. new System.Runtime.Diagnostics.EventDescriptor(57402, 0, (byte)TraceChannel.Debug, (byte)TraceEventLevel.Verbose, (byte)TraceEventOpcode.Info, 0x0, 0x1000000000010000),
  637. new System.Runtime.Diagnostics.EventDescriptor(57403, 0, (byte)TraceChannel.Debug, (byte)TraceEventLevel.Warning, (byte)TraceEventOpcode.Info, 0x0, 0x1000000000010000),
  638. new System.Runtime.Diagnostics.EventDescriptor(57404, 0, (byte)TraceChannel.Analytic, (byte)TraceEventLevel.Warning, (byte)TraceEventOpcode.Info, 0x0, 0x2000000000010000),
  639. new System.Runtime.Diagnostics.EventDescriptor(131, 0, (byte)TraceChannel.Debug, (byte)TraceEventLevel.Verbose, (byte)12, 0x9cd, 0x1000000000010000),
  640. new System.Runtime.Diagnostics.EventDescriptor(132, 0, (byte)TraceChannel.Debug, (byte)TraceEventLevel.Verbose, (byte)13, 0x9cd, 0x1000000000010000),
  641. new System.Runtime.Diagnostics.EventDescriptor(133, 0, (byte)TraceChannel.Debug, (byte)TraceEventLevel.Verbose, (byte)TraceEventOpcode.Start, 0xa21, 0x1000000000200000),
  642. new System.Runtime.Diagnostics.EventDescriptor(134, 0, (byte)TraceChannel.Debug, (byte)TraceEventLevel.Verbose, (byte)TraceEventOpcode.Stop, 0xa21, 0x1000000000200000),
  643. new System.Runtime.Diagnostics.EventDescriptor(57405, 0, (byte)TraceChannel.Operational, (byte)TraceEventLevel.Error, (byte)TraceEventOpcode.Info, 0x0, 0x4000000000010000),
  644. new System.Runtime.Diagnostics.EventDescriptor(57406, 0, (byte)TraceChannel.Analytic, (byte)TraceEventLevel.Verbose, (byte)TraceEventOpcode.Info, 0x0, 0x2000000000010000),
  645. new System.Runtime.Diagnostics.EventDescriptor(57408, 0, (byte)TraceChannel.Operational, (byte)TraceEventLevel.Critical, (byte)TraceEventOpcode.Info, 0x0, 0x4000000000010000),
  646. new System.Runtime.Diagnostics.EventDescriptor(57410, 0, (byte)TraceChannel.Analytic, (byte)TraceEventLevel.Warning, (byte)TraceEventOpcode.Info, 0x0, 0x2000000000010000),
  647. new System.Runtime.Diagnostics.EventDescriptor(57409, 0, (byte)TraceChannel.Analytic, (byte)TraceEventLevel.Verbose, (byte)TraceEventOpcode.Info, 0x0, 0x2000000000010000),
  648. new System.Runtime.Diagnostics.EventDescriptor(57407, 0, (byte)TraceChannel.Analytic, (byte)TraceEventLevel.Verbose, (byte)TraceEventOpcode.Info, 0x0, 0x2000000000010000)};
  649. }
  650. /// <summary>
  651. /// Ensures that the event descriptors array is initialized
  652. /// </summary>
  653. static void EnsureEventDescriptors()
  654. {
  655. if (eventDescriptorsCreated)
  656. {
  657. return;
  658. }
  659. System.Threading.Monitor.Enter(syncLock);
  660. try
  661. {
  662. if (eventDescriptorsCreated)
  663. {
  664. return;
  665. }
  666. CreateEventDescriptors();
  667. eventDescriptorsCreated = true;
  668. }
  669. finally
  670. {
  671. System.Threading.Monitor.Exit(syncLock);
  672. }
  673. }
  674. /// <summary>
  675. /// Check if ETW tracing is enabled for the particular event
  676. /// </summary>
  677. /// <param name="trace">The trace provider</param>
  678. /// <param name="eventIndex">The index of the event descriptor</param>
  679. // Critical = Accesses SecurityCritical member eventDescriptors
  680. // Safe = eventDescriptors is not changed
  681. [System.Security.SecuritySafeCriticalAttribute()]
  682. static bool IsEtwEventEnabled(EtwDiagnosticTrace trace, int eventIndex)
  683. {
  684. if (trace.IsEtwProviderEnabled)
  685. {
  686. EnsureEventDescriptors();
  687. return trace.IsEtwEventEnabled(ref eventDescriptors[eventIndex], false);
  688. }
  689. return false;
  690. }
  691. /// <summary>
  692. /// Writes ETW trace event
  693. ///</summary>
  694. /// <param name="trace">The trace provider</param>
  695. /// <param name="eventIndex">The index of the event descriptor</param>>
  696. /// <param name="eventParam0">A parameter of the ETW event</param>>
  697. /// <param name="eventParam1">A parameter of the ETW event</param>>
  698. /// <param name="eventParam2">A parameter of the ETW event</param>>
  699. /// <param name="eventParam3">A parameter of the ETW event</param>>
  700. /// <param name="eventParam4">A parameter of the ETW event</param>>
  701. // Critical = Calls SecurityCritical method EtwProvider.WriteEvent
  702. // Safe = We only allow setting of provider id from SecurityCritical code, access to EventDescriptors is SecurityCritical, and ETW limits buffer sizes.
  703. [System.Security.SecuritySafeCriticalAttribute()]
  704. static bool WriteEtwEvent(EtwDiagnosticTrace trace, int eventIndex, System.Runtime.Diagnostics.EventTraceActivity eventParam0, string eventParam1, string eventParam2, string eventParam3, string eventParam4)
  705. {
  706. EnsureEventDescriptors();
  707. return trace.EtwProvider.WriteEvent(ref eventDescriptors[eventIndex], eventParam0, eventParam1, eventParam2, eventParam3, eventParam4);
  708. }
  709. /// <summary>
  710. /// Writes ETW trace event
  711. ///</summary>
  712. /// <param name="trace">The trace provider</param>
  713. /// <param name="eventIndex">The index of the event descriptor</param>>
  714. /// <param name="eventParam0">A parameter of the ETW event</param>>
  715. /// <param name="eventParam1">A parameter of the ETW event</param>>
  716. /// <param name="eventParam2">A parameter of the ETW event</param>>
  717. /// <param name="eventParam3">A parameter of the ETW event</param>>
  718. // Critical = Calls SecurityCritical method EtwProvider.WriteEvent
  719. // Safe = We only allow setting of provider id from SecurityCritical code, access to EventDescriptors is SecurityCritical, and ETW limits buffer sizes.
  720. [System.Security.SecuritySafeCriticalAttribute()]
  721. static bool WriteEtwEvent(EtwDiagnosticTrace trace, int eventIndex, System.Runtime.Diagnostics.EventTraceActivity eventParam0, string eventParam1, string eventParam2, string eventParam3)
  722. {
  723. EnsureEventDescriptors();
  724. return trace.EtwProvider.WriteEvent(ref eventDescriptors[eventIndex], eventParam0, eventParam1, eventParam2, eventParam3);
  725. }
  726. /// <summary>
  727. /// Writes ETW trace event
  728. ///</summary>
  729. /// <param name="trace">The trace provider</param>
  730. /// <param name="eventIndex">The index of the event descriptor</param>>
  731. /// <param name="eventParam0">A parameter of the ETW event</param>>
  732. /// <param name="eventParam1">A parameter of the ETW event</param>>
  733. /// <param name="eventParam2">A parameter of the ETW event</param>>
  734. // Critical = Calls SecurityCritical method EtwProvider.WriteEvent
  735. // Safe = We only allow setting of provider id from SecurityCritical code, access to EventDescriptors is SecurityCritical, and ETW limits buffer sizes.
  736. [System.Security.SecuritySafeCriticalAttribute()]
  737. static bool WriteEtwEvent(EtwDiagnosticTrace trace, int eventIndex, System.Runtime.Diagnostics.EventTraceActivity eventParam0, string eventParam1, string eventParam2)
  738. {
  739. EnsureEventDescriptors();
  740. return trace.EtwProvider.WriteEvent(ref eventDescriptors[eventIndex], eventParam0, eventParam1, eventParam2);
  741. }
  742. /// <summary>
  743. /// Writes ETW trace event
  744. ///</summary>
  745. /// <param name="trace">The trace provider</param>
  746. /// <param name="eventIndex">The index of the event descriptor</param>>
  747. /// <param name="eventParam0">A parameter of the ETW event</param>>
  748. /// <param name="eventParam1">A parameter of the ETW event</param>>
  749. /// <param name="eventParam2">A parameter of the ETW event</param>>
  750. // Critical = Calls SecurityCritical method EtwProvider.WriteEvent
  751. // Safe = We only allow setting of provider id from SecurityCritical code, access to EventDescriptors is SecurityCritical, and ETW limits buffer sizes.
  752. [System.Security.SecuritySafeCriticalAttribute()]
  753. static bool WriteEtwEvent(EtwDiagnosticTrace trace, int eventIndex, System.Runtime.Diagnostics.EventTraceActivity eventParam0, int eventParam1, string eventParam2)
  754. {
  755. EnsureEventDescriptors();
  756. return trace.EtwProvider.WriteEvent(ref eventDescriptors[eventIndex], eventParam0, eventParam1, eventParam2);
  757. }
  758. /// <summary>
  759. /// Writes ETW trace event
  760. ///</summary>
  761. /// <param name="trace">The trace provider</param>
  762. /// <param name="eventIndex">The index of the event descriptor</param>>
  763. /// <param name="eventParam0">A parameter of the ETW event</param>>
  764. /// <param name="eventParam1">A parameter of the ETW event</param>>
  765. /// <param name="eventParam2">A parameter of the ETW event</param>>
  766. /// <param name="eventParam3">A parameter of the ETW event</param>>
  767. // Critical = Calls SecurityCritical method EtwProvider.WriteEvent
  768. // Safe = We only allow setting of provider id from SecurityCritical code, access to EventDescriptors is SecurityCritical, and ETW limits buffer sizes.
  769. [System.Security.SecuritySafeCriticalAttribute()]
  770. static bool WriteEtwEvent(EtwDiagnosticTrace trace, int eventIndex, System.Runtime.Diagnostics.EventTraceActivity eventParam0, int eventParam1, int eventParam2, string eventParam3)
  771. {
  772. EnsureEventDescriptors();
  773. return trace.EtwProvider.WriteEvent(ref eventDescriptors[eventIndex], eventParam0, eventParam1, eventParam2, eventParam3);
  774. }
  775. /// <summary>
  776. /// Writes ETW trace event
  777. ///</summary>
  778. /// <param name="trace">The trace provider</param>
  779. /// <param name="eventIndex">The index of the event descriptor</param>>
  780. /// <param name="eventParam0">A parameter of the ETW event</param>>
  781. /// <param name="eventParam1">A parameter of the ETW event</param>>
  782. // Critical = Calls SecurityCritical method EtwProvider.WriteEvent
  783. // Safe = We only allow setting of provider id from SecurityCritical code, access to EventDescriptors is SecurityCritical, and ETW limits buffer sizes.
  784. [System.Security.SecuritySafeCriticalAttribute()]
  785. static bool WriteEtwEvent(EtwDiagnosticTrace trace, int eventIndex, System.Runtime.Diagnostics.EventTraceActivity eventParam0, string eventParam1)
  786. {
  787. EnsureEventDescriptors();
  788. return trace.EtwProvider.WriteEvent(ref eventDescriptors[eventIndex], eventParam0, eventParam1);
  789. }
  790. /// <summary>
  791. /// write a trace source into the diagnostic trace
  792. /// </summary>
  793. /// <param name="trace">The trace provider</param>
  794. /// <param name="eventIndex">The index of the event descriptor</param>
  795. /// <param name="description">The description to write</param>
  796. /// <param name="payload">The trace payload</param>
  797. // Critical = Calls SecurityCritical method EtwDiagnosticTrace.WriteTraceSource
  798. // Safe = We only allow setting of provider id from SecurityCritical code
  799. [System.Security.SecuritySafeCriticalAttribute()]
  800. static void WriteTraceSource(EtwDiagnosticTrace trace, int eventIndex, string description, TracePayload payload)
  801. {
  802. EnsureEventDescriptors();
  803. trace.WriteTraceSource(ref eventDescriptors[eventIndex], description, payload);
  804. }
  805. }
  806. }