Xamarin Public Jenkins (auto-signing) e79aa3c0ed Imported Upstream version 4.6.0.125
Former-commit-id: a2155e9bd80020e49e72e86c44da02a8ac0e57a4
2016-08-03 10:59:49 +00:00

58 lines
1.8 KiB
C#

//-----------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//-----------------------------------------------------------------------------
namespace System.Runtime.Serialization
{
using System.Diagnostics;
using System.Security;
#if USE_REFEMIT
public static class SerializationTrace
#else
static class SerializationTrace
#endif
{
[Fx.Tag.SecurityNote(Critical = "Static fields are marked SecurityCritical or readonly to prevent"
+ " data from being modified or leaked to other components in appdomain.")]
[SecurityCritical]
static TraceSource codeGen;
internal static SourceSwitch CodeGenerationSwitch
{
get
{
return CodeGenerationTraceSource.Switch;
}
}
internal static void WriteInstruction(int lineNumber, string instruction)
{
CodeGenerationTraceSource.TraceInformation("{0:00000}: {1}", lineNumber, instruction);
}
#if USE_REFEMIT
public static void TraceInstruction(string instruction)
#else
internal static void TraceInstruction(string instruction)
#endif
{
CodeGenerationTraceSource.TraceEvent(TraceEventType.Verbose, 0, instruction);
}
static TraceSource CodeGenerationTraceSource
{
[Fx.Tag.SecurityNote(Critical = "Fetches the critical codeGen field.",
Safe = "Get-only properties only needs to be protected for write; initialized in getter if null.")]
[SecuritySafeCritical]
get
{
if (codeGen == null)
codeGen = new TraceSource("System.Runtime.Serialization.CodeGeneration");
return codeGen;
}
}
}
}