summaryrefslogtreecommitdiff
path: root/src/mscorlib/src/System/Diagnostics/Eventing/EventSource.cs
diff options
context:
space:
mode:
authorJiyoung Yun <jy910.yun@samsung.com>2017-02-10 20:35:12 +0900
committerJiyoung Yun <jy910.yun@samsung.com>2017-02-10 20:35:12 +0900
commit4b11dc566a5bbfa1378d6266525c281b028abcc8 (patch)
treeb48831a898906734f8884d08b6e18f1144ee2b82 /src/mscorlib/src/System/Diagnostics/Eventing/EventSource.cs
parentdb20f3f1bb8595633a7e16c8900fd401a453a6b5 (diff)
downloadcoreclr-4b11dc566a5bbfa1378d6266525c281b028abcc8.tar.gz
coreclr-4b11dc566a5bbfa1378d6266525c281b028abcc8.tar.bz2
coreclr-4b11dc566a5bbfa1378d6266525c281b028abcc8.zip
Imported Upstream version 1.0.0.9910upstream/1.0.0.9910
Diffstat (limited to 'src/mscorlib/src/System/Diagnostics/Eventing/EventSource.cs')
-rw-r--r--src/mscorlib/src/System/Diagnostics/Eventing/EventSource.cs23
1 files changed, 11 insertions, 12 deletions
diff --git a/src/mscorlib/src/System/Diagnostics/Eventing/EventSource.cs b/src/mscorlib/src/System/Diagnostics/Eventing/EventSource.cs
index aa0d8d72d1..a558a1647e 100644
--- a/src/mscorlib/src/System/Diagnostics/Eventing/EventSource.cs
+++ b/src/mscorlib/src/System/Diagnostics/Eventing/EventSource.cs
@@ -187,7 +187,9 @@ using System.Globalization;
using System.Reflection;
using System.Resources;
using System.Security;
+#if !CORECLR
using System.Security.Permissions;
+#endif // !CORECLR
using System.Text;
using System.Threading;
@@ -3047,7 +3049,7 @@ namespace System.Diagnostics.Tracing
}
if (s_currentPid == 0)
{
-#if ES_BUILD_STANDALONE && !ES_BUILD_PCL
+#if ES_BUILD_STANDALONE && !ES_BUILD_PCL && !CORECLR
// for non-BCL EventSource we must assert SecurityPermission
new SecurityPermission(PermissionState.Unrestricted).Assert();
#endif
@@ -3803,7 +3805,9 @@ namespace System.Diagnostics.Tracing
// RET
//
// If we find this pattern we return the XXX. Otherwise we return -1.
+#if !CORECLR
(new ReflectionPermission(ReflectionPermissionFlag.MemberAccess)).Assert();
+#endif
byte[] instrs = method.GetMethodBody().GetILAsByteArray();
int retVal = -1;
for (int idx = 0; idx < instrs.Length;)
@@ -4221,7 +4225,7 @@ namespace System.Diagnostics.Tracing
public EventListener()
{
// This will cause the OnEventSourceCreated callback to fire.
- CallBackForExistingEventSources(true, (obj, args) => args.EventSource.AddListener(this));
+ CallBackForExistingEventSources(true, (obj, args) => args.EventSource.AddListener((EventListener)obj));
}
/// <summary>
@@ -6741,6 +6745,7 @@ namespace System.Diagnostics.Tracing
stringBuilder.Append(eventMessage, startIndex, count);
}
+ private static readonly string[] s_escapes = { "&amp;", "&lt;", "&gt;", "&apos;", "&quot;", "%r", "%n", "%t" };
// Manifest messages use %N conventions for their message substitutions. Translate from
// .NET conventions. We can't use RegEx for this (we are in mscorlib), so we do it 'by hand'
private string TranslateToManifestConvention(string eventMessage, string evtName)
@@ -6808,16 +6813,10 @@ namespace System.Diagnostics.Tracing
}
else if ((chIdx = "&<>'\"\r\n\t".IndexOf(eventMessage[i])) >= 0)
{
- string[] escapes = { "&amp;", "&lt;", "&gt;", "&apos;", "&quot;", "%r", "%n", "%t" };
- var update = new Action<char, string>(
- (ch, escape) =>
- {
- UpdateStringBuilder(ref stringBuilder, eventMessage, writtenSoFar, i - writtenSoFar);
- i++;
- stringBuilder.Append(escape);
- writtenSoFar = i;
- });
- update(eventMessage[i], escapes[chIdx]);
+ UpdateStringBuilder(ref stringBuilder, eventMessage, writtenSoFar, i - writtenSoFar);
+ i++;
+ stringBuilder.Append(s_escapes[chIdx]);
+ writtenSoFar = i;
}
else
i++;