1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310
|
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace System.IdentityModel.Diagnostics.Application
{
using System.Runtime;
using System.Runtime.Diagnostics;
using System.Security;
internal partial class TD
{
static System.Resources.ResourceManager resourceManager;
static System.Globalization.CultureInfo resourceCulture;
[System.Security.SecurityCriticalAttribute()]
static System.Runtime.Diagnostics.EventDescriptor[] eventDescriptors;
static object syncLock = new object();
// Double-checked locking pattern requires volatile for read/write synchronization
static volatile bool eventDescriptorsCreated;
private TD()
{
}
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Justification="This is an auto-generated code, some ETW/TraceSource mixed code would use it.")]
static System.Resources.ResourceManager ResourceManager
{
get
{
if (object.ReferenceEquals(resourceManager, null))
{
resourceManager = new System.Resources.ResourceManager("System.IdentityModel.Diagnostics.Application.TD", typeof(TD).Assembly);
}
return resourceManager;
}
}
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Justification="This template is shared across all assemblies, some of which use this accessor.")]
internal static System.Globalization.CultureInfo Culture
{
get
{
return resourceCulture;
}
set
{
resourceCulture = value;
}
}
/// <summary>
/// Check if trace definition is enabled
/// Event description ID=5406, Level=Error, Channel=Debug
/// </summary>
internal static bool GetIssuerNameFailureIsEnabled()
{
return (FxTrace.ShouldTraceError && TD.IsEtwEventEnabled(0));
}
/// <summary>
/// Gets trace definition like: Retrieval of issuer name from tokenId:{0} failed.
/// Event description ID=5406, Level=Error, Channel=Debug
/// </summary>
/// <param name="eventTraceActivity">The event trace activity</param>
/// <param name="tokenID">Parameter 0 for event: Retrieval of issuer name from tokenId:{0} failed.</param>
internal static void GetIssuerNameFailure(System.Runtime.Diagnostics.EventTraceActivity eventTraceActivity, string tokenID)
{
TracePayload payload = FxTrace.Trace.GetSerializedPayload(null, null, null, true);
if (TD.IsEtwEventEnabled(0))
{
TD.WriteEtwEvent(0, eventTraceActivity, tokenID, payload.HostReference, payload.AppDomainFriendlyName);
}
}
/// <summary>
/// Check if trace definition is enabled
/// Event description ID=5405, Level=Verbose, Channel=Debug
/// </summary>
internal static bool GetIssuerNameSuccessIsEnabled()
{
return (FxTrace.ShouldTraceVerbose && TD.IsEtwEventEnabled(1));
}
/// <summary>
/// Gets trace definition like: Retrieval of issuer name:{0} from tokenId:{1} succeeded.
/// Event description ID=5405, Level=Verbose, Channel=Debug
/// </summary>
/// <param name="eventTraceActivity">The event trace activity</param>
/// <param name="issuerName">Parameter 0 for event: Retrieval of issuer name:{0} from tokenId:{1} succeeded.</param>
/// <param name="tokenID">Parameter 1 for event: Retrieval of issuer name:{0} from tokenId:{1} succeeded.</param>
internal static void GetIssuerNameSuccess(System.Runtime.Diagnostics.EventTraceActivity eventTraceActivity, string issuerName, string tokenID)
{
TracePayload payload = FxTrace.Trace.GetSerializedPayload(null, null, null, true);
if (TD.IsEtwEventEnabled(1))
{
TD.WriteEtwEvent(1, eventTraceActivity, issuerName, tokenID, payload.HostReference, payload.AppDomainFriendlyName);
}
}
/// <summary>
/// Check if trace definition is enabled
/// Event description ID=5404, Level=Error, Channel=Debug
/// </summary>
internal static bool TokenValidationFailureIsEnabled()
{
return (FxTrace.ShouldTraceError && TD.IsEtwEventEnabled(2));
}
/// <summary>
/// Gets trace definition like: SecurityToken (type '{0}' and id '{1}') validation failed. {2}
/// Event description ID=5404, Level=Error, Channel=Debug
/// </summary>
/// <param name="eventTraceActivity">The event trace activity</param>
/// <param name="tokenType">Parameter 0 for event: SecurityToken (type '{0}' and id '{1}') validation failed. {2}</param>
/// <param name="tokenID">Parameter 1 for event: SecurityToken (type '{0}' and id '{1}') validation failed. {2}</param>
/// <param name="errorMessage">Parameter 2 for event: SecurityToken (type '{0}' and id '{1}') validation failed. {2}</param>
internal static void TokenValidationFailure(System.Runtime.Diagnostics.EventTraceActivity eventTraceActivity, string tokenType, string tokenID, string errorMessage)
{
TracePayload payload = FxTrace.Trace.GetSerializedPayload(null, null, null, true);
if (TD.IsEtwEventEnabled(2))
{
TD.WriteEtwEvent(2, eventTraceActivity, tokenType, tokenID, errorMessage, payload.HostReference, payload.AppDomainFriendlyName);
}
}
/// <summary>
/// Check if trace definition is enabled
/// Event description ID=5402, Level=Verbose, Channel=Debug
/// </summary>
internal static bool TokenValidationStartedIsEnabled()
{
return (FxTrace.ShouldTraceVerbose && TD.IsEtwEventEnabled(3));
}
/// <summary>
/// Gets trace definition like: SecurityToken (type '{0}' and id '{1}') validation started.
/// Event description ID=5402, Level=Verbose, Channel=Debug
/// </summary>
/// <param name="eventTraceActivity">The event trace activity</param>
/// <param name="tokenType">Parameter 0 for event: SecurityToken (type '{0}' and id '{1}') validation started.</param>
/// <param name="tokenID">Parameter 1 for event: SecurityToken (type '{0}' and id '{1}') validation started.</param>
internal static void TokenValidationStarted(System.Runtime.Diagnostics.EventTraceActivity eventTraceActivity, string tokenType, string tokenID)
{
TracePayload payload = FxTrace.Trace.GetSerializedPayload(null, null, null, true);
if (TD.IsEtwEventEnabled(3))
{
TD.WriteEtwEvent(3, eventTraceActivity, tokenType, tokenID, payload.HostReference, payload.AppDomainFriendlyName);
}
}
/// <summary>
/// Check if trace definition is enabled
/// Event description ID=5403, Level=Verbose, Channel=Debug
/// </summary>
internal static bool TokenValidationSuccessIsEnabled()
{
return (FxTrace.ShouldTraceVerbose && TD.IsEtwEventEnabled(4));
}
/// <summary>
/// Gets trace definition like: SecurityToken (type '{0}' and id '{1}') validation succeeded.
/// Event description ID=5403, Level=Verbose, Channel=Debug
/// </summary>
/// <param name="eventTraceActivity">The event trace activity</param>
/// <param name="tokenType">Parameter 0 for event: SecurityToken (type '{0}' and id '{1}') validation succeeded.</param>
/// <param name="tokenID">Parameter 1 for event: SecurityToken (type '{0}' and id '{1}') validation succeeded.</param>
internal static void TokenValidationSuccess(System.Runtime.Diagnostics.EventTraceActivity eventTraceActivity, string tokenType, string tokenID)
{
TracePayload payload = FxTrace.Trace.GetSerializedPayload(null, null, null, true);
if (TD.IsEtwEventEnabled(4))
{
TD.WriteEtwEvent(4, eventTraceActivity, tokenType, tokenID, payload.HostReference, payload.AppDomainFriendlyName);
}
}
/// <summary>
/// Creates the event descriptors array
/// </summary>
// Critical = Sets the SecurityCritical member eventDescriptors
// Safe = We control what the event descriptors contain
[System.Security.SecuritySafeCriticalAttribute()]
static void CreateEventDescriptors()
{
System.Runtime.Diagnostics.EventDescriptor[] descriptors = new System.Runtime.Diagnostics.EventDescriptor[] {
new System.Runtime.Diagnostics.EventDescriptor(5406, 0, (byte)TraceChannel.Debug, (byte)TraceEventLevel.Error, (byte)TraceEventOpcode.Info, 0xa35, 0x1000000000000010),
new System.Runtime.Diagnostics.EventDescriptor(5405, 0, (byte)TraceChannel.Debug, (byte)TraceEventLevel.Verbose, (byte)TraceEventOpcode.Info, 0xa35, 0x1000000000000010),
new System.Runtime.Diagnostics.EventDescriptor(5404, 0, (byte)TraceChannel.Debug, (byte)TraceEventLevel.Error, (byte)TraceEventOpcode.Info, 0xa34, 0x1000000000000010),
new System.Runtime.Diagnostics.EventDescriptor(5402, 0, (byte)TraceChannel.Debug, (byte)TraceEventLevel.Verbose, (byte)TraceEventOpcode.Info, 0xa34, 0x1000000000000010),
new System.Runtime.Diagnostics.EventDescriptor(5403, 0, (byte)TraceChannel.Debug, (byte)TraceEventLevel.Verbose, (byte)TraceEventOpcode.Info, 0xa34, 0x1000000000000010)};
// The hashcodes calculated from PTCop for TD.CreateEventDescriptors are unstable when just declaring
// a local field of ushort[] if the array is non-empty and contains more than 2 entries, because
// the c#-compiler is using some private types for optimization. The type name follows the following pattern:
// <PrivateImplementationDetails>{6BAE93FD-290B-4DE0-BCEE-366B30800FDF} (where the GUID is changing with every build)
// To scope the change to unblock PTCop as much as possible we wrap the list of End2EndEvents in a List<ushort>
System.Collections.Generic.List<ushort> e2eEvents = new System.Collections.Generic.List<ushort>(5);
e2eEvents.Add(5402);
e2eEvents.Add(5403);
e2eEvents.Add(5404);
e2eEvents.Add(5405);
e2eEvents.Add(5406);
FxTrace.UpdateEventDefinitions(descriptors, e2eEvents.ToArray());
eventDescriptors = descriptors;
}
/// <summary>
/// Ensures that the event descriptors array is initialized
/// </summary>
static void EnsureEventDescriptors()
{
if (eventDescriptorsCreated)
{
return;
}
System.Threading.Monitor.Enter(syncLock);
try
{
if (eventDescriptorsCreated)
{
return;
}
CreateEventDescriptors();
eventDescriptorsCreated = true;
}
finally
{
System.Threading.Monitor.Exit(syncLock);
}
}
/// <summary>
/// Check if ETW tracing is enabled for the particular event
/// </summary>
/// <param name="eventIndex">The index of the event descriptor</param>
static bool IsEtwEventEnabled(int eventIndex)
{
if (FxTrace.Trace.IsEtwProviderEnabled)
{
EnsureEventDescriptors();
return FxTrace.IsEventEnabled(eventIndex);
}
return false;
}
/// <summary>
/// Writes ETW trace event
///</summary>
/// <param name="eventIndex">The index of the event descriptor</param>>
/// <param name="eventParam0">A parameter of the ETW event</param>>
/// <param name="eventParam1">A parameter of the ETW event</param>>
/// <param name="eventParam2">A parameter of the ETW event</param>>
/// <param name="eventParam3">A parameter of the ETW event</param>>
// Critical = Calls SecurityCritical method EtwProvider.WriteEvent
// Safe = We only allow setting of provider id from SecurityCritical code, access to EventDescriptors is SecurityCritical, and ETW limits buffer sizes.
[System.Security.SecuritySafeCriticalAttribute()]
static bool WriteEtwEvent(int eventIndex, System.Runtime.Diagnostics.EventTraceActivity eventParam0, string eventParam1, string eventParam2, string eventParam3)
{
EnsureEventDescriptors();
return FxTrace.Trace.EtwProvider.WriteEvent(ref eventDescriptors[eventIndex], eventParam0, eventParam1, eventParam2, eventParam3);
}
/// <summary>
/// Writes ETW trace event
///</summary>
/// <param name="eventIndex">The index of the event descriptor</param>>
/// <param name="eventParam0">A parameter of the ETW event</param>>
/// <param name="eventParam1">A parameter of the ETW event</param>>
/// <param name="eventParam2">A parameter of the ETW event</param>>
/// <param name="eventParam3">A parameter of the ETW event</param>>
/// <param name="eventParam4">A parameter of the ETW event</param>>
// Critical = Calls SecurityCritical method EtwProvider.WriteEvent
// Safe = We only allow setting of provider id from SecurityCritical code, access to EventDescriptors is SecurityCritical, and ETW limits buffer sizes.
[System.Security.SecuritySafeCriticalAttribute()]
static bool WriteEtwEvent(int eventIndex, System.Runtime.Diagnostics.EventTraceActivity eventParam0, string eventParam1, string eventParam2, string eventParam3, string eventParam4)
{
EnsureEventDescriptors();
return FxTrace.Trace.EtwProvider.WriteEvent(ref eventDescriptors[eventIndex], eventParam0, eventParam1, eventParam2, eventParam3, eventParam4);
}
/// <summary>
/// Writes ETW trace event
///</summary>
/// <param name="eventIndex">The index of the event descriptor</param>>
/// <param name="eventParam0">A parameter of the ETW event</param>>
/// <param name="eventParam1">A parameter of the ETW event</param>>
/// <param name="eventParam2">A parameter of the ETW event</param>>
/// <param name="eventParam3">A parameter of the ETW event</param>>
/// <param name="eventParam4">A parameter of the ETW event</param>>
/// <param name="eventParam5">A parameter of the ETW event</param>>
// Critical = Calls SecurityCritical method EtwProvider.WriteEvent
// Safe = We only allow setting of provider id from SecurityCritical code, access to EventDescriptors is SecurityCritical, and ETW limits buffer sizes.
[System.Security.SecuritySafeCriticalAttribute()]
static bool WriteEtwEvent(int eventIndex, System.Runtime.Diagnostics.EventTraceActivity eventParam0, string eventParam1, string eventParam2, string eventParam3, string eventParam4, string eventParam5)
{
EnsureEventDescriptors();
return FxTrace.Trace.EtwProvider.WriteEvent(ref eventDescriptors[eventIndex], eventParam0, eventParam1, eventParam2, eventParam3, eventParam4, eventParam5);
}
}
}
|