Raygun4Maui 1.0.0-rc1

This is a prerelease version of Raygun4Maui.
There is a newer version of this package available.
See the version list below for details.
dotnet add package Raygun4Maui --version 1.0.0-rc1
NuGet\Install-Package Raygun4Maui -Version 1.0.0-rc1
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Raygun4Maui" Version="1.0.0-rc1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Raygun4Maui --version 1.0.0-rc1
#r "nuget: Raygun4Maui, 1.0.0-rc1"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Raygun4Maui as a Cake Addin
#addin nuget:?package=Raygun4Maui&version=1.0.0-rc1&prerelease

// Install Raygun4Maui as a Cake Tool
#tool nuget:?package=Raygun4Maui&version=1.0.0-rc1&prerelease

Raygun4Maui

Version: 1.0.0

Raygun's Crash Reporting provider for (a) unhandled exceptions and (b) ILogger logging.

Tested on Windows only.

Build Local Nuget

  • Open Visual Studio 22+
  • Open the raygun4maui.sln solution
  • Right-click the project and select properties
  • Ensure the produce a NuGet package on build option is checked
  • Under package, update the version name
  • Click to build the project
  • If the building succeeds, the NuGet file will be created in the bin folder of the project

Installation via Local Nuget

  • Acquire the NuGet package or build it as discussed above
  • Place it in a local folder
  • Open Visual Studio 22+ and your MAUI app
  • Create a new Nuget Package Source
  • Navigate to Options > Nuget Package Manager > Package Sources
  • Create a new source by adding any name and the path to the folder you placed the raygun4maui NuGet file
  • Right-Click on the project and select Manage Nuget Packages
  • Find the NuGet package by typing its name (Mindscape.Raygun4Maui) and, for simplicity, ensure only the newly created custom local package source is selected

Updating Local Nuget

  • Open Visual Studio 22+ and open your MAUI app
  • Add the new Nuget file in the custom local package folder
  • Right-Click on the project and select Manage Nuget Packages
  • Find the currently installed version
  • The system should automatically detect a new version is available; click the update icon

Usage

  • Import the module by:
using Raygun4Maui;
  • To activate (a) unhandled exceptions being sent to Raygun and (b) logging, you need to add raygun4maui to your MauiApp builder. To do so, open you main MauiProgram class (MauiProgram.cs) and change the CreateMauiApp method by adding the AddRaygun4Maui extension method:
        var builder = MauiApp.CreateBuilder();

        builder
            .UseMauiApp<App>()
            ...
            .AddRaygun4Maui("YOUR_APP_API_KEY");
  • To make a log entry:
  • Acquire the reference to the ILogger services your MAUI app maintains:
ILogger logger = Handler.MauiContext.Services.GetService<ILogger<MainPage>>();
  • Invoke the various ILogger log methods from the logger object accordingly. For example:
logger.LogInformation("Raygun4Maui.SampleApp.TestLoggerErrorsSent: {MethodName} @ {Timestamp}", "TestLogInformation", DateTime.UtcNow.ToString("yyyy-MM-dd HH:mm:ss"));
logger.LogCritical("Raygun4Maui.SampleApp.TestLoggerErrorsSent: {MethodName} @ {Timestamp}", "TestLogCritical", DateTime.UtcNow.ToString("yyyy-MM-dd HH:mm:ss"));
  • You can also manually catch-and-log an exception as follows:
try
{
    //Code that throws exception
}
catch (Exception e)
{
    //Example ILogger call. You can use the ILogger method and arguments of your choice.
    _logger.Log(LogLevel.Error, e, "Exception caught at {Timestamp}", DateTime.UtcNow.ToString("yyyy-MM-dd HH:mm:ss"));
}
  • If you require more fine-grain control on sending messages to Raygun, you can create a RaygunClient instance from the package Mindscape.Raygun4Net, which is already wrapped in this module, and then invoke the new client's Send, SendInBackground, etc., methods, as described in Raygun4Net.

Configuration

  • The system supports the following configurations:
  • Any configuration available in Raygun4Net, such the ApiKey
  • SendDefaultTags (default true) that adds the Log Level (e.g., Severe, Warning, etc.,) and the Build Platform (e.g., Windows, Android, iOS, etc.,) to messages sent to Raygun for (a) unhandled exceptions being sent to Raygun and (b) logging
  • SendDefaultCustomData (default true) that adds all available information in the uncaught excpetions' callback as custome data and sends them to Raygun
  • MinLogLevel and MaxLogLevel that specify the range of logging levels that will actually raise a message to Raygun
  • These can be set as follows:
  • The AddRaygun4Maui extension method and the RaygunMauiClient constructor have overloaded methods that can take as an input a RaygunMauiSettings options object, which extends RaygunSettings from Raygun4Net. Hence, both can be configured to run instead of the default values.
  • Create and initialize a new RaygunMauiSettings object:
RaygunMauiSettings raygunMauiSettings = new RaygunMauiSettings(){
    ApiKey = "YOUR_APP_API_KEY",
    SendDefaultTags = true; //Default value
    SendDefaultCustomData = true; //Default value
    MinLogLevel = LogLevel.Debug; //Default value
    MaxLogLevel = LogLevel.Critical; //Default value
}
  • To configure (a) unhandled exceptions being sent to Raygun and (b) logging:
        var builder = MauiApp.CreateBuilder();

        builder
            .UseMauiApp<App>()
            ...
            .AddRaygun4Maui(raygunMauiSettings);
Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-android31.0 is compatible.  net6.0-ios was computed.  net6.0-ios16.1 is compatible.  net6.0-maccatalyst was computed.  net6.0-maccatalyst16.1 is compatible.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net6.0-windows10.0.19041 is compatible.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.0.0 37 4/23/2024
2.0.0-rc-8 78 4/17/2024
1.4.2 706 3/10/2024
1.4.1 739 1/18/2024
1.4.1-pre-1 53 12/21/2023
1.4.0 1,237 11/15/2023
1.4.0-pre-1 87 11/10/2023
1.3.0 150 10/25/2023
1.2.3-pre-1 80 10/14/2023
1.2.2 3,289 5/11/2023
1.1.0 453 4/27/2023
1.0.0 801 2/16/2023
1.0.0-rc1 109 2/16/2023

Support for reporting MAUI .NET unhandled exception and ILogger logs to Raygun with single-step easy-to-use extension method