diff --git a/CHANGELOG.md b/CHANGELOG.md index ced2b681e3..5a1291a5ab 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## Unreleased + +- Add IsDynamicCode* to events ([#1418](https://github.com/getsentry/sentry-dotnet/pull/1418)) + ## 3.12.3 ### Fixes diff --git a/src/Sentry/Internal/MainSentryEventProcessor.cs b/src/Sentry/Internal/MainSentryEventProcessor.cs index aa2814f435..6635ea7c47 100644 --- a/src/Sentry/Internal/MainSentryEventProcessor.cs +++ b/src/Sentry/Internal/MainSentryEventProcessor.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Globalization; using System.Linq; +using System.Runtime.CompilerServices; using System.Threading; using Sentry.Extensibility; using Sentry.Reflection; @@ -14,6 +15,9 @@ internal class MainSentryEventProcessor : ISentryEventProcessor internal const string CurrentUiCultureKey = "Current UI Culture"; internal const string MemoryInfoKey = "Memory Info"; internal const string ThreadPoolInfoKey = "ThreadPool Info"; + internal const string IsDynamicCodeKey = "Dynamic Code"; + internal const string IsDynamicCodeCompiledKey = "Compiled"; + internal const string IsDynamicCodeSupportedKey = "Supported"; private readonly Enricher _enricher; @@ -56,6 +60,14 @@ public SentryEvent Process(SentryEvent @event) @event.Contexts[CurrentUiCultureKey] = currentUiCultureMap; } +#if NETCOREAPP3_0_OR_GREATER + @event.Contexts[IsDynamicCodeKey] = new Dictionary + { + { IsDynamicCodeCompiledKey, RuntimeFeature.IsDynamicCodeCompiled }, + { IsDynamicCodeSupportedKey, RuntimeFeature.IsDynamicCodeSupported } + }; +#endif + AddMemoryInfo(@event.Contexts); AddThreadPoolInfo(@event.Contexts); if (@event.ServerName == null)