diff --git a/src/Raygun.Blazor/RaygunBlazorClient.cs b/src/Raygun.Blazor/RaygunBlazorClient.cs index 1605e8a..a357e9a 100644 --- a/src/Raygun.Blazor/RaygunBlazorClient.cs +++ b/src/Raygun.Blazor/RaygunBlazorClient.cs @@ -218,19 +218,23 @@ public async Task RecordExceptionAsync(Exception ex, } EnvironmentDetails? environment; - if (OperatingSystem.IsLinux() || OperatingSystem.IsWindows() || OperatingSystem.IsMacOS()) + if (OperatingSystem.IsBrowser() || OperatingSystem.IsIOS() || OperatingSystem.IsAndroid()) { - // If running on Server or Desktop device (MAUI Hybrid), obtain environment details from the runtime + // If running on browser (e.g. WebAssembly) + // or Mobile MAUI Blazor Hybrid apps (iOS or Android), + // obtain environment details from the browser + environment = await _browserInterop.GetBrowserEnvironment(); + } + else + { + // If running on Server (Linux, Windows, MacOS, etc.) + // or Desktop MAUI Hybrid apps (Windows or Mac Catalyst), + // obtain environment details from the runtime environment = EnvironmentDetails.FromRuntime(); - // Add browser details to userCustomData + // Add user browser details to userCustomData userCustomData ??= []; userCustomData.Add("BrowserEnvironment", await _browserInterop.GetBrowserEnvironment()); } - else - { - // If running Browser or Mobile device (MAUI Hybrid), obtain environment details from the browser - environment = await _browserInterop.GetBrowserEnvironment(); - } var request = new RaygunRequest