{"id":28512114,"url":"https://github.com/mindscapehq/raygun4blazor","last_synced_at":"2026-02-21T17:02:05.874Z","repository":{"id":258100290,"uuid":"812784897","full_name":"MindscapeHQ/raygun4blazor","owner":"MindscapeHQ","description":"Raygun provider for .NET Blazor","archived":false,"fork":false,"pushed_at":"2026-02-03T01:37:56.000Z","size":425,"stargazers_count":0,"open_issues_count":1,"forks_count":1,"subscribers_count":6,"default_branch":"main","last_synced_at":"2026-02-19T17:56:14.002Z","etag":null,"topics":["blazor","blazor-components","blazor-server","blazor-wasm","blazor-webassembly","crash-reporting","error-handling","error-reporting","raygun","unhandled-exceptions","user-tracking"],"latest_commit_sha":null,"homepage":"https://raygun.com","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MindscapeHQ.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-06-09T21:39:49.000Z","updated_at":"2026-02-03T01:37:32.000Z","dependencies_parsed_at":"2024-10-31T10:20:41.592Z","dependency_job_id":"19c0e489-af43-4d81-8976-2e6602836225","html_url":"https://github.com/MindscapeHQ/raygun4blazor","commit_stats":null,"previous_names":["mindscapehq/raygun4blazor"],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/MindscapeHQ/raygun4blazor","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MindscapeHQ%2Fraygun4blazor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MindscapeHQ%2Fraygun4blazor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MindscapeHQ%2Fraygun4blazor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MindscapeHQ%2Fraygun4blazor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MindscapeHQ","download_url":"https://codeload.github.com/MindscapeHQ/raygun4blazor/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MindscapeHQ%2Fraygun4blazor/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29688216,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-21T15:51:39.154Z","status":"ssl_error","status_checked_at":"2026-02-21T15:49:03.425Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["blazor","blazor-components","blazor-server","blazor-wasm","blazor-webassembly","crash-reporting","error-handling","error-reporting","raygun","unhandled-exceptions","user-tracking"],"created_at":"2025-06-09T00:30:42.735Z","updated_at":"2026-02-21T17:02:05.869Z","avatar_url":"https://github.com/MindscapeHQ.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Raygun for Blazor\n\n## Usage\n\n### Installation\n\n#### NuGet Package manager\nThe best way to install Raygun is to use the NuGet package manager. Right-click on your project and select \"**Manage NuGet Packages....**\". Navigate to the Browse tab, then use the search box to find **Raygun.Blazor** and install it.\n\n#### .NET Cli\n\nTo install the latest version:\n\n``` \ndotnet add package Raygun.Blazor\n```\n\nAlternatively, you can specify a version tag to install a specific version of the package. See [Raygun.Blazor NuGet Gallery page](https://nuget.org/packages/Raygun.Blazor) for information on available versions.\n\n```\ndotnet add package Raygun.Blazor --version x.y.z\n```\n\n### Setup\n\nSee the packages [Blazor WebAssembly](https://www.nuget.org/packages/Raygun.Blazor.WebAssembly), [Blazor Server](https://www.nuget.org/packages/Raygun.Blazor.Server) and [MAUI Blazor Hybrid](https://www.nuget.org/packages/Raygun.Blazor.Maui) for specific setup instructions depending on the project type.\n\n#### Raygun Settings\n\nRaygun for Blazor uses the `appsettings.json` to load configuration settings.\n\n`RaygunSettings` will be obtained from the configuration section name `Raygun`.\n\nFor example:\n\n```json\n{\n  \"Raygun\": {\n    \"ApiKey\": \"YOUR_API_KEY\",\n    \"CatchUnhandledExceptions\": \"false\",\n    \"LogLevel\": \"Debug\"\n  }\n}\n```\n\nFor all configuration values, check the `RaygunSettings` class under `src/Raygun.Blazor/RaygunSettings.cs`.\n\nSee [Configuration in ASP.NET Core](https://learn.microsoft.com/en-us/aspnet/core/fundamentals/configuration/?view=aspnetcore-8.0) to learn more about managing application settings.\n\n#### Initialize the client\n\nInject the `RaygunBlazorClient` in your code:\n\n```cs\n@inject RaygunBlazorClient raygunClient;\n```\n\nAnd call to `raygunClient.InitializeAsync()` at least once.\n\nThis method should be called as early as possible in the course of using the app. The best place to do it is inside the\n`OnAfterRenderAsync` method of the main layout page. However, it will also be called automatically before sending any\nexceptions, just in case.\n\n### Recording an error\n\nTo send an exception to Raygun call to `raygunClient.RecordExceptionAsync(...)`\n\nThis method accepts the following arguments:\n\n- `ex`: The `Exception` to send back to Raygun.\n- `userDetails`: Optional. Attach user details to exception, takes priority over `IRaygunUserProvider`.\n- `tags`: Optional. User-specified tags that should be applied to the error.\n- `userCustomData`: Optional. Any custom data that you like sent with the report to assist with troubleshooting.\n- `cancellationToken`: Optional. A `CancellationToken` to allow you to cancel the current request, if necessary.\n\n### Recording a breadcrumb\n\nRecords a Breadcrumb to help you track what was going on in your application before an error occurred.\n\nCall to `raygunClient.RecordBreadcrumb(...);`\n\nThis method accepts the following arguments:\n\n- `message`: The message you want to record for this Breadcrumb.\n- `type`: The `BreadcrumbType` for the message. Defaults to `BreadcrumbType.Manual`.\n- `category`: A custom value used to arbitrarily group this Breadcrumb.\n- `customData`: Any custom data you want to record about application state when the Breadcrumb was recorded.\n\n### Stack traces and portable debug data\n\nRaygun for Blazor attaches both stack traces and the necessary info for portable debug data automatically.\n\n#### Blazor stack traces\n\nExceptions originating within the Blazor environment should contain a stack trace attached.\nFor details, check the \"Raw Data\" tab on the Raygun error report. \nThe stack trace is contained inside `error.stackTrace` property.\n\nFor example:\n\n```json\n\"error\": {\n  \"className\": \"System.DivideByZeroException\",\n  \"message\": \"Attempted to divide by zero.\",\n  \"stackTrace\": [\n    {\n      \"className\": \"Raygun.Samples.Blazor.Server.Components.Pages.Sample\",\n      \"columnNumber\": 75,\n      \"fileName\": \"...\\\\src\\\\Raygun.Samples.Blazor.Server\\\\Components\\\\Pages\\\\Sample.razor\",\n      \"ilOffset\": 5,\n      \"lineNumber\": 13,\n      \"methodName\": \"\",\n      \"methodToken\": 100663352\n    },\n    // ...\n  ]\n},\n```\n\nThis also works for exceptions originating in Blazor WebAssembly applications.\nFor example, this exception captured on WebAssembly:\n\n```json\n\"error\": {\n  \"className\": \"System.DivideByZeroException\",\n  \"message\": \"Attempted to divide by zero.\",\n  \"stackTrace\": [\n    {\n      \"className\": \"Raygun.Samples.Blazor.WebAssembly.ViewModels.CounterViewModel\",\n      \"columnNumber\": 17,\n      \"fileName\": \"...\\\\src\\\\Raygun.Samples.Blazor.WebAssembly\\\\ViewModels\\\\CounterViewModel.cs\",\n      \"ilOffset\": 34,\n      \"lineNumber\": 48,\n      \"methodName\": \"IncrementCountAsync\",\n      \"methodToken\": 100663343\n    },\n    // ...\n  ]\n},\n```\n\n#### JavaScript stack traces\n\nExceptions happening in the JavaScript side of a Blazor application should contain a stack trace referring to the JavaScript code that caused the error.\n\nFor example:\n\n```\nReferenceError: undefinedfunction3 is not defined\nat causeErrors (https://localhost:7254/myfunctions.js:10:9)\nat window.onmessage (https://localhost:7254/:21:17)\n```\n\n#### Portable debug data (PDB)\n\nRaygun for Blazor supports debugging reports using PDB files when running on Blazor Server and MAUI applications.\nThe necessary image information will be attached automatically to error reports.\n\nThe debug data can be found in the `error.images` property:\n\n```json\n\"error\": {\n  \"className\": \"System.DivideByZeroException\",\n  \"images\": [\n    {\n      \"signature\": \"a93d65be-ba53-4743-a1a5-4743716b7a42\",\n      \"checksum\": \"SHA256:BE653DA953BA4337A1A54743716B7A42A678F57568949BE3C375DB0BABF8EC35\",\n      \"file\": \"...\\\\src\\\\Raygun.Samples.Blazor.Server\\\\obj\\\\Debug\\\\net8.0\\\\Raygun.Samples.Blazor.Server.pdb\",\n      \"timestamp\": \"A1E84548\"\n    },\n    // ...\n  ],\n},\n```\n\nYou can learn more about Portable PDB Support [on Raygun's .Net Framework documentation](https://raygun.com/documentation/language-guides/dotnet/crash-reporting/net-framework/#portable-pdb-support).\n\n### Environment details\n\nRaygun for Blazor captures environment details differently depending on the platform where the error originated.\n\nThe availability of each environment detail properties depend on the platform itself, so some of them may not be always available.\n\nFor more information, you can check the `EnvironmentDetails.cs` file.\n\n#### Browser environment details\n\nWhen the application is running on a browser, for example when using Blazor WebAssembly, or when running MAUI Blazor Hybrid applications on mobile, the attached environment details are obtained from the browser layer on the client side.\n\nFor example:\n\n```json\n\"environment\": {\n  \"browser-Height\": 982,\n  \"browserName\": \"Mozilla\",\n  \"browser-Width\": 1512,\n  \"color-Depth\": 24,\n  // etc ...\n}\n```\n\n#### Server environment details\n\nWhen the application is running on a server machine, for example when using Blazor Server, or when running MAUI Blazor Hybrid applications on desktop, the attached environment details are obtained from the operating system of the running platform.\n\nFor example:\n\n```json\n\"environment\": {\n  \"architecture\": \"X64\",\n  \"availablePhysicalMemory\": 1,\n  \"cpu\": \"X64\",\n  \"deviceName\": \"WINDOWS-PC\",\n  // etc ...\n}\n```\n\nThe client side environment details from the browser, if available, will be also attached as part of the **User Custom Data** under `BrowserEnvironment`:\n\n```json\n\"userCustomData\": {\n  \"BrowserEnvironment\": {\n    \"browser-Height\": 1392,\n    \"browser\": \"Google\",\n    \"browserName\": \"Chrome\",\n    \"browser-Version\": \"129.0.6668.100\",\n    \"browser-Width\": 2560,\n    // etc ...\n  }\n}   \n```\n\n### Attaching user details\n\nRaygun for Blazor provides two ways to attach user details to error reports:\n\n1. Provide `UserDetails` in the `RecordExceptionAsync` method call.\n2. Implement a `IRaygunUserProvider`.\n\n#### User details class\n\nThe following properties can be provided as user details:\n\n- `UserId`: Unique identifier for the user is the user identifier.\n- `IsAnonymous`: Flag indicating if the user is anonymous or not.\n- `Email`: User's email address.\n- `FullName`: User's full name.\n- `FirstName`: User's first name (what you would use if you were emailing them - \"Hi {{firstName}}, ...\")\n- `DeviceId`: Device unique identifier. Useful if sending errors from a mobile device.\n\nAll properties are strings except isAnonymous, which is a boolean. As well, they are all optional.\n\n#### User details in `RecordExceptionAsync`\n\nThe simplest way to attach user details to an error report, is to do it when calling to `RecordExceptionAsync`.\n\nPass a `UserDetails` object to the method call:\n\n```cs\nvar userDetails = new UserDetails() { Email = \"test@example.com\", FullName = \"Test User\", UserId = \"123456\" };\n\nawait RaygunClient.RecordExceptionAsync(ex, userDetails);\n```\n\n#### Implementing `IRaygunUserProvider`\n\nProviding an instance of `IRaygunUserProvider` to the Raygun Blazor client allows you to attach user details also to errors reported automatically, for example, captured unhandled exceptions or exceptions from the JavaScript layer.\n\nImplement an `IRaygunUserProvider`, for example:\n\n```cs\npublic class MyUserProvider : IRaygunUserProvider\n{\n    public Task\u003cUserDetails?\u003e GetCurrentUser()\n    {\n        return Task.FromResult(new UserDetails());\n    }\n}\n```\n\nAnd inject it into the Raygun Blazor client:\n\n```cs\nbuilder.Services.AddSingleton\u003cIRaygunUserProvider, MyUserProvider\u003e();\n```\n\nFor a complete example on how to implement a `IRaygunUserProvider` with the `AuthenticationStateProvider` check the example project file `src/Raygun.Samples.Blazor.WebAssembly/Program.cs`.\n\n### Background processing\n\nYou can enable a throttled background message processor for the Raygun provider by setting the `UseBackgroundQueue` to `true`.\n\n```json\n{\n  \"Raygun\": {\n    \"UseBackgroundQueue\": true\n  }\n}\n```\n\n**Background processing is disabled by default.**\n\nYou can adjust the following background processor settings as well:\n\n- `BackgroundMessageQueueMax` to set the maximum queue size.\n- `BackgroundMessageWorkerCount` to set the maximum number of workers.\n- `BackgroundMessageWorkerBreakpoint` to set a threshold on when a new worker will be added.\n\nCheck the `RaygunSettings` class for a complete documentation of these parameters and their default values.\n\n### Modifying or cancelling requests\n\nThe RaygunClient exposes the `OnBeforeSend` event listener, which allows you to modify or cancel error message requests before they are sent to Raygun.\n\nTo cancel sending a request, set the `Cancel` property to `false` inside your listener:\n\n```cs\nRaygunClient.OnBeforeSend += (sender, args) =\u003e\n{\n  // Example of how to cancel sending a message to Raygun\n  if (args.Request.Details.Error.Message == \"Cancel me\")\n  {\n    // If the error message is \"Cancel me\"\n    // then cancel the send\n    args.Cancel = true;\n  }\n}\n```\n\nAs well, you can modify the `Request` payload:\n\n```cs\nRaygunClient.OnBeforeSend += (sender, args) =\u003e\n{\n  args.Request.Details.Error.Message = \"Changed message\";\n};\n```\n\n### Offline storage configuration\n\nRaygun for Blazor supports storing error reports when they can't be sent, for example, if the communication between the server and Raygun is interrupted.\n\nYou can enable offline storage support by setting the `UseOfflineStore` to `true`.\n\n```json\n{\n  \"Raygun\": {\n    \"UseOfflineStore\": true\n  }\n}\n```\n\n**Offline storage is disabled by default.**\n\nYou can adjust the following offline store settings as well:\n\n- `DirectoryName` to set the folder to store crash reports, relative to the system local application data.\n- `MaxOfflineFiles` to set the maximum number of stored reports, defaults to 50.\n\nFor example:\n\n```json\n{\n  \"Raygun\": {\n    \"UseOfflineStore\": true,\n    \"DirectoryName\": \"MyApp\",\n    \"MaxOfflineFiles\": 100\n  }\n}\n```\n\nWith this configuration, Raygun will store a maximum of 100 Raygun offline reports under `C:\\Users\\\u003cUSER\u003e\\AppData\\Local\\MyApp`.\n\n### Internal logger\n\nRaygun for Blazor uses an internal logger to help facilitate the integration of the package.\nThe default log level is `\"Warning\"`.\nTo completely disable the internal logger, set the `\"LogLevel\"` setting to `\"None\"`.\n\nFor example:\n\n```json\n{\n  \"Raygun\": {\n    \"LogLevel\": \"None\"\n  }\n}\n```\n\nFor all configuration values, check the `RaygunLogLevel` enum under `src/Raygun.Blazor/Logging/RaygunLogLevel.cs`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmindscapehq%2Fraygun4blazor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmindscapehq%2Fraygun4blazor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmindscapehq%2Fraygun4blazor/lists"}