Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Remove AppContext EventSource support on browser
  • Loading branch information
agocke committed Aug 13, 2021
commit bc59e0082f338eaef27670cdab3d0d19c6dd9908
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,34 @@ private static string GetBaseDirectoryCore()

return directory;
}

internal static void LogSwitchValues(RuntimeEventSource ev)
{
if (s_switches is not null)
{
lock (s_switches)
{
foreach (var (k, v) in s_switches)
{
// Convert bool to int because it's cheaper to log (no boxing)
ev.LogAppContextSwitch(k, v ? 0 : 1);
}
}
}

if (s_dataStore is not null)
{
lock (s_dataStore)
{
foreach (var (k, v) in s_dataStore)
{
if (v is string s && bool.TryParse(s, out bool isEnabled))
{
ev.LogAppContextSwitch(k, isEnabled ? 0 : 1);
}
}
}
}
}
}
}
29 changes: 0 additions & 29 deletions src/libraries/System.Private.CoreLib/src/System/AppContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -135,35 +135,6 @@ public static void SetSwitch(string switchName, bool isEnabled)
}
}

internal static void LogSwitchValues(RuntimeEventSource ev)
{
if (s_switches is not null)
{
lock (s_switches)
{
foreach (var (k, v) in s_switches)
{
// Convert bool to int because it's cheaper to log (no boxing)
ev.LogAppContextSwitch(k, v ? 0 : 1);
}
}
}

if (s_dataStore is not null)
{
lock (s_dataStore)
{
foreach (var (k, v) in s_dataStore)
{
if (v is string s && bool.TryParse(s, out bool isEnabled))
{
ev.LogAppContextSwitch(k, isEnabled ? 0 : 1);
}
}
}
}
}

#if !CORERT
internal static unsafe void Setup(char** pNames, char** pValues, int count)
{
Expand Down