diff --git a/Mindscape.Raygun4Net.NetCore.Common/Platforms/AndroidPlatform.cs b/Mindscape.Raygun4Net.NetCore.Common/Platforms/AndroidPlatform.cs index 71ec3dbd..64b72425 100644 --- a/Mindscape.Raygun4Net.NetCore.Common/Platforms/AndroidPlatform.cs +++ b/Mindscape.Raygun4Net.NetCore.Common/Platforms/AndroidPlatform.cs @@ -1,5 +1,6 @@ using System; using System.Diagnostics; +using System.Diagnostics.CodeAnalysis; using System.Reflection; namespace Mindscape.Raygun4Net.Platforms @@ -8,6 +9,9 @@ internal static class AndroidPlatform { private static Assembly AndroidAssembly; +#if NET6_0_OR_GREATER + [DynamicDependency("UnhandledExceptionRaiser", "Android.Runtime.AndroidEnvironment", "Mono.Android")] +#endif public static bool TryAttachExceptionHandlers() { try diff --git a/Mindscape.Raygun4Net.NetCore.Common/Platforms/WindowsPlatform.cs b/Mindscape.Raygun4Net.NetCore.Common/Platforms/WindowsPlatform.cs index 3c3958a2..d0057c30 100644 --- a/Mindscape.Raygun4Net.NetCore.Common/Platforms/WindowsPlatform.cs +++ b/Mindscape.Raygun4Net.NetCore.Common/Platforms/WindowsPlatform.cs @@ -1,5 +1,6 @@ using System; using System.Diagnostics; +using System.Diagnostics.CodeAnalysis; using System.Reflection; namespace Mindscape.Raygun4Net.Platforms @@ -10,6 +11,9 @@ internal static class WindowsPlatform private static Exception _lastFirstChanceException; +#if NET6_0_OR_GREATER + [DynamicDependency("UnhandledException", "Microsoft.UI.Xaml.Application", "Microsoft.WinUI")] +#endif public static bool TryAttachExceptionHandlers() { try