Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add IsDynamicCode* to events #1418

Merged
merged 4 commits into from
Jan 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## Unreleased

- Add IsDynamicCode* to events ([#1418](https://github.com/getsentry/sentry-dotnet/pull/1418))

## 3.12.3

### Fixes
Expand Down
12 changes: 12 additions & 0 deletions src/Sentry/Internal/MainSentryEventProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;

Expand Down Expand Up @@ -56,6 +60,14 @@ public SentryEvent Process(SentryEvent @event)
@event.Contexts[CurrentUiCultureKey] = currentUiCultureMap;
}

#if NETCOREAPP3_0_OR_GREATER
@event.Contexts[IsDynamicCodeKey] = new Dictionary<string, bool>
{
{ IsDynamicCodeCompiledKey, RuntimeFeature.IsDynamicCodeCompiled },
{ IsDynamicCodeSupportedKey, RuntimeFeature.IsDynamicCodeSupported }
};
#endif

AddMemoryInfo(@event.Contexts);
AddThreadPoolInfo(@event.Contexts);
if (@event.ServerName == null)
Expand Down