GithubHelp home page GithubHelp logo

mindscapehq / raygun4net Goto Github PK

View Code? Open in Web Editor NEW
122.0 33.0 90.0 49.33 MB

Raygun provider for .NET

Home Page: https://raygun.com

License: MIT License

C# 95.18% Shell 0.36% PowerShell 0.28% Batchfile 0.02% HTML 0.15% Objective-C 4.02%
raygun crash-reporting error-handling error-monitoring webapi aspnet aspnet-core error-reporting crash-reporting-tool

raygun4net's Introduction

Raygun4Net

Raygun provider for .NET Framework

Supported platforms/frameworks

Projects built with the following frameworks are supported:

  • .NET 4.6.2+, up to .NET 8.0
  • ASP.NET
  • ASP.NET MVC
  • ASP.NET WebApi
  • WinForms, WPF, console apps etc
  • Xamarin.iOS and Xamarin.Mac (Both unified and classic)
  • Xamarin.Android

Install the NuGet package to a project which uses one of the above frameworks and the correct assembly will be referenced.

For Xamarin we recommended adding either Raygun4Xamarin.Forms, or the Mindscape.Raygun4Net.Xamarin.Android & Mindscape.Raygun4Net.Xamarin.iOS.Unified packages.

For .NET Core and .NET versions 5.0 or higher, we recommend using the Mindscape.Raygun4Net.NetCore package.

Installation

  • The easiest way to install this provider is by either using the below dotnet CLI command, or in the NuGet management GUI in the IDE you use.
dotnet add package Mindscape.Raygun4Net

See the Raygun docs for more detailed instructions on how to use this provider.

Where is my app API key?

When sending exceptions to the Raygun service, an app API key is required to map the messages to your application.

When you create a new application in your Raygun dashboard, your app API key is displayed within the instructions page. You can also find the API key by clicking the "Application Settings" button in the side bar of the Raygun dashboard.

Namespace

The main classes can be found in the Mindscape.Raygun4Net namespace.

Usage

The Raygun4Net provider includes support for many .NET frameworks. Scroll down to find information about using Raygun for your type of application.

ASP.NET 5+

As of version 5.0.0, ASP.NET support has been moved into a new NuGet package. If you have a ASP.NET project, please uninstall the Raygun4Net NuGet package and install the Mindscape.Raygun4Net.AspNetCore NuGet package instead.

Once the package is installed, add the following code to your appsettings.json (if you're using another type of config, add it there):

"RaygunSettings": {
  "ApiKey":  "YOUR_APP_API_KEY"
}

Configure the Raygun Middleware to handle exceptions that have been triggered and send unhandled exceptions automatically.

In Program.cs:

  1. Add using Mindscape.Raygun4Net.AspNetCore; to your using statements.
  2. Add builder.Services.AddRaygun(builder.Configuration);.
  3. Add app.UseRaygun(); after any other ExceptionHandling methods e.g. app.UseDeveloperExceptionPage() or app.UseExceptionHandler("/Home/Error").
using Mindscape.Raygun4Net.AspNetCore;
var builder = WebApplication.CreateBuilder(args);

// Add services to the container.
builder.Services.AddRaygun(builder.Configuration);
  
/*The rest of your builder setup*/

var app = builder.Build();

// Configure the HTTP request pipeline.
if (!app.Environment.IsDevelopment())
{
    app.UseExceptionHandler("/Error");

    // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
    app.UseHsts();
}

app.MapGet("/throw", (Func<string>)(() => throw new Exception("Exception in request pipeline")));

app.UseRaygun();

/*The rest of your app setup*/

The above set up will cause all unhandled exceptions to be sent to your Raygun account, where you can easily view all of your error monitoring and crash report data.

TLS configuration for .NET 3.5 or earlier

Raygun's ingestion nodes require TLS 1.2 or TLS 1.3 If you are using .NET 3.5 or earlier, you may need to enable these protocols in your application and patch your OS.

Check out the TLS troubleshooting guide from Microsoft for their recommendations.

Updating the protocol property in your application's startup code.

protected void Application_Start()
  {
    // Enable TLS 1.2 and TLS 1.3
    ServicePointManager.SecurityProtocol |=  ( (SecurityProtocolType)3072 /*TLS 1.2*/ | (SecurityProtocolType)12288 /*TLS 1.3*/  );
  }

ASP.NET Framework

In your Web.config file, find or add a <configSections> element, which should be nested under the <configuration> element, and add the following entry:

<section name="RaygunSettings" type="Mindscape.Raygun4Net.RaygunSettings, Mindscape.Raygun4Net"/>

Then reference it by adding the following line somewhere after the configSections tag.

<RaygunSettings apikey="YOUR_APP_API_KEY" />

Now you can either setup Raygun to send unhandled exceptions automatically or/and send exceptions manually.

To send unhandled exceptions automatically, use the Raygun HTTP module within the <configuration> element in web.config. This is done slightly differently depending on what version of IIS you're using. If in doubt, just try them both:

<system.web>
  <httpModules>
    <add name="RaygunErrorModule" type="Mindscape.Raygun4Net.RaygunHttpModule"/>
  </httpModules>
</system.web>

For IIS 7.0, use system.webServer

<system.webServer>
  <modules>
    <add name="RaygunErrorModule" type="Mindscape.Raygun4Net.RaygunHttpModule"/>
  </modules>
</system.webServer>

Anywhere in you code, you can also send exception reports manually simply by creating a new instance of the RaygunClient and call one of the Send or SendInBackground methods. This is most commonly used to send exceptions caught in a try/catch block.

try
{
  
}
catch (Exception e)
{
  new RaygunClient().SendInBackground(e);
}

Or to send exceptions in your own handlers rather than using the automatic setup above.

protected void Application_Error()
{
  var exception = Server.GetLastError();
  new RaygunClient().Send(exception);
}

Additional ASP.NET configuration options

Exclude errors by HTTP status code

If using the HTTP module then you can exclude errors by their HTTP status code by providing a comma separated list of status codes to ignore in the configuration. For example if you wanted to exclude errors that return the I'm a teapot response code, you could use the configuration below.

<RaygunSettings apikey="YOUR_APP_API_KEY" excludeHttpStatusCodes="418" />

Exclude errors that originate from a local origin

Toggle this boolean and the HTTP module will not send errors to Raygun if the request originated from a local origin. i.e. A way to prevent local debug/development from notifying Raygun without having to resort to Web.config transforms.

<RaygunSettings apikey="YOUR_APP_API_KEY" excludeErrorsFromLocal="true" />

Remove sensitive request data

If you have sensitive data in an HTTP request that you wish to prevent being transmitted to Raygun, you can provide lists of possible keys (names) to remove. Keys to ignore can be specified on the RaygunSettings tag in web.config, (or you can use the equivalent methods on RaygunClient if you are setting things up in code). The available options are:

  • ignoreFormFieldNames
  • ignoreHeaderNames
  • ignoreCookieNames
  • ignoreServerVariableNames

These can be set to be a comma separated list of keys to ignore. Setting an option as * will indicate that all the keys will not be sent to Raygun. Placing * before, after or at both ends of a key will perform an ends-with, starts-with or contains operation respectively. For example, ignoreFormFieldNames="*password*" will cause Raygun to ignore all form fields that contain "password" anywhere in the name. These options are not case sensitive.

Providing a custom RaygunClient to the http module

Sometimes when setting up Raygun using the http module to send exceptions automatically, you may need to provide the http module with a custom RaygunClient instance in order to use some of the optional feature described at the end of this file. To do this, get your Http Application to implement the IRaygunApplication interface. Implement the GenerateRaygunClient method to return a new (or previously created) RaygunClient instance. The http module will use the RaygunClient returned from this method to send the unhandled exceptions. In this method you can setup any additional options on the RaygunClient instance that you need - more information about each feature is described at the end of this file.

ASP.NET MVC

As of version 4.0.0, Mvc support has been moved into a new NuGet package. If you have an Mvc project, please uninstall the Raygun4Net NuGet package and install the Mindscape.Raygun4Net.Mvc NuGet package instead.

Once the package is installed, see the package README for instructions on configuration.

The Mvc and WebApi NuGet packages can be installed in the same project safely.

ASP.NET Web API

As of version 4.0.0, WebApi support has been moved into a new NuGet package. If you have a WebApi project, please uninstall the Raygun4Net NuGet package and install the Mindscape.Raygun4Net.WebApi NuGet package instead.

Once the package is installed, see the package README for instructions on configuration.

The Mvc and WebApi NuGet packages can be installed in the same project safely.

WPF

Create an instance of RaygunClient by passing your app API key in the constructor. Attach an event handler to the DispatcherUnhandledException event of your application. In the event handler, use the RaygunClient.Send method to send the Exception.

private RaygunClient _client = new RaygunClient("YOUR_APP_API_KEY");

public App()
{
  DispatcherUnhandledException += OnDispatcherUnhandledException;
}

void OnDispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e)
{
  _client.Send(e.Exception);
}

WinForms

Create an instance of RaygunClient by passing your app API key in the constructor. Attach an event handler to the Application.ThreadException event BEFORE calling Application.Run(...). In the event handler, use the RaygunClient.Send method to send the Exception.

private static readonly RaygunClient _raygunClient = new RaygunClient("YOUR_APP_API_KEY");

[STAThread]
static void Main()
{
  Application.EnableVisualStyles();
  Application.SetCompatibleTextRenderingDefault(false);

  Application.ThreadException += new ThreadExceptionEventHandler(Application_ThreadException);

  Application.Run(new Form1());
}

private static void Application_ThreadException(object sender, ThreadExceptionEventArgs e)
{
  _raygunClient.Send(e.Exception);
}

WinRT

In the App.xaml.cs constructor (or any main entry point to your application), call the static RaygunClient.Attach method using your API key.

public App()
{
  RaygunClient.Attach("YOUR_APP_API_KEY");
}

At any point after calling the Attach method, you can use RaygunClient.Current to get the static instance. This can be used for manually sending messages (via the Send methods) or changing options such as the User identity string.

Limitations of WinRT UnhandledException event and Wrap() workarounds

The options available in WinRT for catching unhandled exceptions at this point in time are more limited compared to the options in the more mature .NET framework. The UnhandledException event will be raised when invalid XAML is parsed, in addition to other runtime exceptions that happen on the main UI thread. While many errors will be picked up this way and therefore be able to be sent to Raygun, others will be missed by this exception handler. In particular asynchronous code or Tasks that execute on background threads will not have their exceptions caught.

A workaround for this issue is provided with the Wrap() method. These allow you to pass the code you want to execute to an instance of the Raygun client - it will simply call it surrounded by a try-catch block. If the method you pass in does result in an exception being thrown this will be transmitted to Raygun, and the exception will again be thrown. Two overloads are available; one for methods that return void and another for methods that return an object.

Fody

Another option is to use the Fody library, and its AsyncErrorHandler extension. This will automatically catch async exceptions and pass them to a handler of your choice (which would send to Raygun as above). See the installation instructions here, then check out the sample project for how to use.

Xamarin for Android

In the main/entry Activity of your application, use the static RaygunClient.Attach method using your app API key. There is also an overload for the Attach method that lets you pass in a user-identity string which is useful for tracking affected users in your Raygun dashboard.

RaygunClient.Attach("YOUR_APP_API_KEY");

At any point after calling the Attach method, you can use RaygunClient.Current to get the static instance. This can be used for manually sending messages or changing options such as the User identity string.

Xamarin for iOS

In the main entry point of the application, use the static RaygunClient.Attach method using your app API key.

static void Main(string[] args)
{
  RaygunClient.Attach("YOUR_APP_API_KEY");

  UIApplication.Main(args, null, "AppDelegate");
}

There is also an overload for the Attach method that lets you enable native iOS crash reporting.

static void Main(string[] args)
{
  RaygunClient.Attach("YOUR_APP_API_KEY", true, true);

  UIApplication.Main(args, null, "AppDelegate");
}

The first boolean parameter is simply to enable the native iOS error reporting. The second boolean parameter is whether or not to hijack some of the native signals – this is to solve the well known iOS crash reporter issue where null reference exceptions within a try/catch block can cause the application to crash. By setting the second boolean parameter to true, the managed code will take over the SIGBUS and SIGSEGV iOS signals which solves the null reference issue. Doing this however prevents SIGBUS and SIGSEGV native errors from being detected, meaning they don’t get sent to Raygun. This is why we provide this as an option – so if you don’t have any issues with null reference exceptions occurring within try/catch blocks and you want to maximize the native errors that you can be notified of, then set the second boolean parameter to false.

At any point after calling the Attach method, you can use RaygunClient.Current to get the static instance. This can be used for manually sending messages or changing options such as the User identity string.

Xamarin for Mac

In the main entry point of the application, use the static RaygunClient.Attach method using your app API key.

static void Main(string[] args)
{
  RaygunClient.Attach("YOUR_APP_API_KEY");

  NSApplication.Init();
  NSApplication.Main(args);
}

At any point after calling the Attach method, you can use RaygunClient.Current to get the static instance. This can be used for manually sending messages or changing options such as the User identity string.

Additional features for all .Net frameworks:

Modify or cancel message

On a RaygunClient instance, attach an event handler to the SendingMessage event. This event handler will be called just before the RaygunClient sends an exception - either automatically or manually. The event arguments provide the RaygunMessage object that is about to be sent. One use for this event handler is to add or modify any information on the RaygunMessage. Another use for this method is to identify exceptions that you never want to send to raygun, and if so, set e.Cancel = true to cancel the send.

Strip wrapper exceptions

If you have common outer exceptions that wrap a valuable inner exception which you'd prefer to group by, you can specify these by using the multi-parameter method:

raygunClient.AddWrapperExceptions(typeof(TargetInvocationException));

In this case, if a TargetInvocationException occurs, it will be removed and replaced with the actual InnerException that was the cause. Note that HttpUnhandledException and TargetInvocationException are already added to the wrapper exception list; you do not have to add these manually. This method is useful if you have your own custom wrapper exceptions, or a framework is throwing exceptions using its own wrapper.

Affected user tracking

There is a property named User on RaygunClient which you can set to be the current user's ID. This allows you to see the count of affected users for each error in the Raygun dashboard.

If you want more detailed information about users (and the ability to use the new Affected User reporting feature when it is released), you can set the UserInfo property on the RaygunClient to a new RaygunIdentifierMessage object. This class has a number of properties on it to help identifier the user who experienced a crash.

Make sure to abide by any privacy policies that your company follows when using this feature.

Properties

The only required field is Identifier.

Identifier is the unique identifier from your system for this user.

IsAnonymous is a flag indicating whether the user is logged in (or identifiable) or if they are anonymous. An anonymous user can still have a unique identifier.

Email The user's email address. If you use email addresses to identify your users, feel free to set the identifier to their email and leave this blank, as we will use the identifier as the email address if it looks like one, and no email address is not specified.

FullName The user's full name.

FirstName The user's first (or preferred) name.

UUID A device identifier. Could be used to identify users across devices, or machines that are breaking for many users.

Usage

raygunClient.User = "[email protected]";
// OR
raygunClient.UserInfo = new RaygunIdentifierMessage("[email protected]")
{
  IsAnonymous = false,
  FullName = "Robbie Raygun",
  FirstName = "Robbie"
};

Version numbering

By default, Raygun will send the assembly version of your project with each report.

If you need to provide your own custom version value, you can do so by setting the ApplicationVersion property of the RaygunClient (in the format x.x.x.x where x is a positive integer).

Tags and custom data

When sending exceptions manually, you can also send an arbitrary list of tags (an array of strings), and a collection of custom data (a dictionary of any objects). This can be done using the various Send and SendInBackground method overloads.

Proxy settings

The Raygun4NET provider uses the default Windows proxy settings (as set in Internet Explorer's Connection tab, or Web.config) when sending messages to the Raygun API. If your proxy requires authentication credentials, you can provide these by setting the ProxyCredentials property after instantiating a RaygunClient, then using it to send later:

var raygunClient = new RaygunClient()
{
  ProxyCredentials = new NetworkCredential("user", "password")
};

Custom grouping keys

You can provide your own grouping key if you wish. We only recommend this you're having issues with errors not being grouped properly.

On a RaygunClient instance, attach an event handler to the CustomGroupingKey event. This event handler will be called after Raygun has built the RaygunMessage object, but before the SendingMessage event is called. The event arguments provide the RaygunMessage object that is about to be sent, and the original exception that triggered it. You can use anything you like to generate the key, and set it by CustomGroupingKey property on the event arguments. Setting it to null or empty string will leave the exception to be grouped by Raygun, setting it to something will cause Raygun to group it with other exceptions you've sent with that key.

The key has a maximum length of 100.

Troubleshooting

Raygun4Net does not send crash reports and there are no errors to help troubleshoot why this is happening

  • Raygun4net has the throwOnError property set to false by default. The first thing is to allow what ever error occurring in Raygun4Net to bubble up the stack and be reported as an unhandled exception, so add this attribute in the raygun4Net Config section or enable it in the config options of the client.
    <RaygunSettings apikey="[Raygun4Net api key goes here]" throwOnError="true"/>
  • These errors will start going to the event viewer or you could attach a trace listener and have them logged to a text file as well
  • There are many reasons why crash reports may not be sent through. In the Event that the error message mentions “The underlying connection was closed: An unexpected error occurred on a send.” This is probably a TLS handshake issue. Confirm this by inspecting the inner exception or the rest of the trace and look for cipher mismatch phrase. This will be a clear indication that there is a TLS issue. - To Resolve this Add the following global config where it is most convenient e.g. Global.asax ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12 Taking care not to include the less secure protocols like SSL3 and to some extent the TLS1.1.

raygun4net's People

Contributors

aarnott avatar alexandrejobin avatar crystalqdm avatar darcythomas avatar deacon-mcintyre avatar dougwaldron avatar filip-dimitrievski avatar fundead avatar grugcrood82 avatar jamiepenney avatar jasenpalmer avatar jesperll avatar josh- avatar joshrobb avatar kendaleiv avatar kogir avatar krisdages avatar krishnakapadia avatar martin308 avatar mattwarren avatar mduncan26 avatar phillip-haydon avatar proredcat avatar quantumnightmare avatar robfe avatar simoncropp avatar snakefoot avatar sumitramanga avatar ubermouse avatar xenolightning avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

raygun4net's Issues

RaygunHttpModule forces AspNet Mvc reference

I'd like to use Raygun in an ASP.NET application where there is no Mvc usage. However, its currently impossible due to direct calls into Mvc in RaygunHttpModule

As far as I see, without these calls it should work without Mvc present, even though the assembly references Mvc.

It doesn't seem sensible to force AspNet Mvc reference. Would it be possible to get rid of it?

Send and SendInBackground overloads

At the moment, there are 3 overloads for RaygunClient.Send and RaygunClient.SendInBackground:

void Send(Exception exception)
void Send(Exception exception, IList<string> tags)
void Send(Exception exception, IList<string> tags, IDictionary userCustomData)

I think it's better to have one Send and SendInBackground method with optional parameters:

void Send(Exception exception, IList<string> tags = null, IDictionary userCustomData = null)

Sending exception with IPAddress in Exception.Data fails

Sending an exception with an object in the Exception.Data dictionary that contains a non-null, valid System.Net.IPAddress member fails during serialization (of the IPAddress object), at line 1945 of SimpleJson.cs.

Simple Gist that illustrates the issue:
https://gist.github.com/kcargile/7238e243ca1d5ea4aece.js

Error returned from the Raygun client is:

Error Logging Exception to Raygun.io The attempted operation is not supported for the type of object referenced

Exception Details:

System.Net.Sockets.SocketException was unhandled
  HResult=-2147467259
  Message=The attempted operation is not supported for the type of object referenced
  Source=System
  ErrorCode=10045
  NativeErrorCode=10045
  StackTrace:
       at System.Net.IPAddress.get_ScopeId()
       at lambda_method(Closure , Object )
       at Mindscape.Raygun4Net.Reflection.ReflectionUtils.<>c__DisplayClassd.<GetGetMethodByExpression>b__c(Object source) in e:\Users\Jason\Documents\GitHub\raygun4net\Mindscape.Raygun4Net\SimpleJson.cs:line 1938
       at Mindscape.Raygun4Net.PocoJsonSerializerStrategy.TrySerializeUnknownTypes(Object input, Object& output) in e:\Users\Jason\Documents\GitHub\raygun4net\Mindscape.Raygun4Net\SimpleJson.cs:line 1538
       at Mindscape.Raygun4Net.PocoJsonSerializerStrategy.TrySerializeNonPrimitiveObject(Object input, Object& output) in e:\Users\Jason\Documents\GitHub\raygun4net\Mindscape.Raygun4Net\SimpleJson.cs:line 1352
       at Mindscape.Raygun4Net.SimpleJson.SerializeValue(IJsonSerializerStrategy jsonSerializerStrategy, Object value, StringBuilder builder) in e:\Users\Jason\Documents\GitHub\raygun4net\Mindscape.Raygun4Net\SimpleJson.cs:line 1047
       at Mindscape.Raygun4Net.SimpleJson.SerializeObject(IJsonSerializerStrategy jsonSerializerStrategy, IEnumerable keys, IEnumerable values, StringBuilder builder) in e:\Users\Jason\Documents\GitHub\raygun4net\Mindscape.Raygun4Net\SimpleJson.cs:line 1077
       at Mindscape.Raygun4Net.SimpleJson.SerializeValue(IJsonSerializerStrategy jsonSerializerStrategy, Object value, StringBuilder builder) in e:\Users\Jason\Documents\GitHub\raygun4net\Mindscape.Raygun4Net\SimpleJson.cs:line 1024
       at Mindscape.Raygun4Net.SimpleJson.SerializeValue(IJsonSerializerStrategy jsonSerializerStrategy, Object value, StringBuilder builder) in e:\Users\Jason\Documents\GitHub\raygun4net\Mindscape.Raygun4Net\SimpleJson.cs:line 1049
       at Mindscape.Raygun4Net.SimpleJson.SerializeObject(IJsonSerializerStrategy jsonSerializerStrategy, IEnumerable keys, IEnumerable values, StringBuilder builder) in e:\Users\Jason\Documents\GitHub\raygun4net\Mindscape.Raygun4Net\SimpleJson.cs:line 1077
       at Mindscape.Raygun4Net.SimpleJson.SerializeValue(IJsonSerializerStrategy jsonSerializerStrategy, Object value, StringBuilder builder) in e:\Users\Jason\Documents\GitHub\raygun4net\Mindscape.Raygun4Net\SimpleJson.cs:line 1024
       at Mindscape.Raygun4Net.SimpleJson.SerializeValue(IJsonSerializerStrategy jsonSerializerStrategy, Object value, StringBuilder builder) in e:\Users\Jason\Documents\GitHub\raygun4net\Mindscape.Raygun4Net\SimpleJson.cs:line 1049
       at Mindscape.Raygun4Net.SimpleJson.SerializeArray(IJsonSerializerStrategy jsonSerializerStrategy, IEnumerable anArray, StringBuilder builder) in e:\Users\Jason\Documents\GitHub\raygun4net\Mindscape.Raygun4Net\SimpleJson.cs:line 1094
       at Mindscape.Raygun4Net.SimpleJson.SerializeValue(IJsonSerializerStrategy jsonSerializerStrategy, Object value, StringBuilder builder) in e:\Users\Jason\Documents\GitHub\raygun4net\Mindscape.Raygun4Net\SimpleJson.cs:line 1037
       at Mindscape.Raygun4Net.SimpleJson.SerializeObject(IJsonSerializerStrategy jsonSerializerStrategy, IEnumerable keys, IEnumerable values, StringBuilder builder) in e:\Users\Jason\Documents\GitHub\raygun4net\Mindscape.Raygun4Net\SimpleJson.cs:line 1077
       at Mindscape.Raygun4Net.SimpleJson.SerializeValue(IJsonSerializerStrategy jsonSerializerStrategy, Object value, StringBuilder builder) in e:\Users\Jason\Documents\GitHub\raygun4net\Mindscape.Raygun4Net\SimpleJson.cs:line 1024
       at Mindscape.Raygun4Net.SimpleJson.SerializeValue(IJsonSerializerStrategy jsonSerializerStrategy, Object value, StringBuilder builder) in e:\Users\Jason\Documents\GitHub\raygun4net\Mindscape.Raygun4Net\SimpleJson.cs:line 1049
       at Mindscape.Raygun4Net.SimpleJson.SerializeObject(IJsonSerializerStrategy jsonSerializerStrategy, IEnumerable keys, IEnumerable values, StringBuilder builder) in e:\Users\Jason\Documents\GitHub\raygun4net\Mindscape.Raygun4Net\SimpleJson.cs:line 1077
       at Mindscape.Raygun4Net.SimpleJson.SerializeValue(IJsonSerializerStrategy jsonSerializerStrategy, Object value, StringBuilder builder) in e:\Users\Jason\Documents\GitHub\raygun4net\Mindscape.Raygun4Net\SimpleJson.cs:line 1024
       at Mindscape.Raygun4Net.SimpleJson.SerializeValue(IJsonSerializerStrategy jsonSerializerStrategy, Object value, StringBuilder builder) in e:\Users\Jason\Documents\GitHub\raygun4net\Mindscape.Raygun4Net\SimpleJson.cs:line 1049
       at Mindscape.Raygun4Net.SimpleJson.SerializeObject(IJsonSerializerStrategy jsonSerializerStrategy, IEnumerable keys, IEnumerable values, StringBuilder builder) in e:\Users\Jason\Documents\GitHub\raygun4net\Mindscape.Raygun4Net\SimpleJson.cs:line 1077
       at Mindscape.Raygun4Net.SimpleJson.SerializeValue(IJsonSerializerStrategy jsonSerializerStrategy, Object value, StringBuilder builder) in e:\Users\Jason\Documents\GitHub\raygun4net\Mindscape.Raygun4Net\SimpleJson.cs:line 1024
       at Mindscape.Raygun4Net.SimpleJson.SerializeValue(IJsonSerializerStrategy jsonSerializerStrategy, Object value, StringBuilder builder) in e:\Users\Jason\Documents\GitHub\raygun4net\Mindscape.Raygun4Net\SimpleJson.cs:line 1049
       at Mindscape.Raygun4Net.SimpleJson.SerializeObject(Object json, IJsonSerializerStrategy jsonSerializerStrategy) in e:\Users\Jason\Documents\GitHub\raygun4net\Mindscape.Raygun4Net\SimpleJson.cs:line 609
       at Mindscape.Raygun4Net.SimpleJson.SerializeObject(Object json) in e:\Users\Jason\Documents\GitHub\raygun4net\Mindscape.Raygun4Net\SimpleJson.cs:line 615
       at Mindscape.Raygun4Net.RaygunClientBase.Send(RaygunMessage raygunMessage) in e:\Users\Jason\Documents\GitHub\raygun4net\Mindscape.Raygun4Net45\RaygunClientBase.cs:line 361
       at Mindscape.Raygun4Net.RaygunClientBase.Send(Exception exception, IList`1 tags, IDictionary userCustomData) in e:\Users\Jason\Documents\GitHub\raygun4net\Mindscape.Raygun4Net45\RaygunClientBase.cs:line 221
       at Mindscape.Raygun4Net.RaygunClientBase.Send(Exception exception) in e:\Users\Jason\Documents\GitHub\raygun4net\Mindscape.Raygun4Net45\RaygunClientBase.cs:line 195
       at RaygunSerializationExperiments.Program.Main(String[] args) in c:\Projects\sandbox\RaygunSerializationExperiments\RaygunSerializationExperiments\Program.cs:line 24
       at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
       at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
       at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException: 

Unhandled Exception with Duplicate cookies

I just found an unhandled exception. When I have duplicate cookies:

image

I get the RaygunClient throwing a stacktrace like:

Exception information: 
    Exception type: ArgumentException 
    Exception message: An item with the same key has already been added.
   at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
   at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
   at System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement](IEnumerable`1 source, Func`2 keySelector, Func`2 elementSelector, IEqualityComparer`1 comparer)
   at Mindscape.Raygun4Net.Messages.RaygunRequestMessage.GetCookies(HttpCookieCollection cookieCollection, IEnumerable`1 ignoredFormNames) in e:\Users\Jason\Documents\GitHub\raygun4net\Mindscape.Raygun4Net\Messages\RaygunRequestMessage.cs:line 58
   at Mindscape.Raygun4Net.Messages.RaygunRequestMessage..ctor(HttpRequest request, List`1 ignoredFormNames) in e:\Users\Jason\Documents\GitHub\raygun4net\Mindscape.Raygun4Net\Messages\RaygunRequestMessage.cs:line 26
   at Mindscape.Raygun4Net.RaygunMessageBuilder.SetHttpDetails(HttpContext context, List`1 ignoredFormNames) in e:\Users\Jason\Documents\GitHub\raygun4net\Mindscape.Raygun4Net\RaygunMessageBuilder.cs:line 135
   at Mindscape.Raygun4Net.RaygunClient.BuildMessage(Exception exception, IList`1 tags, IDictionary userCustomData) in e:\Users\Jason\Documents\GitHub\raygun4net\Mindscape.Raygun4Net\RaygunClient.cs:line 203
   at Mindscape.Raygun4Net.RaygunClient.SendInBackground(Exception exception) in e:\Users\Jason\Documents\GitHub\raygun4net\Mindscape.Raygun4Net\RaygunClient.cs:line 165
   at Pushpay.Base.Raygun.Send(Exception ex) in c:\Dev\pp\pushpay\Source\Pushpay.Base\Raygun.cs:line 15
[... details...]
   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

It's probably worth checking the other HttpRequest collections as I'm pretty sure they can all contain duplicate keys (Form/QueryString etc).

Bug in RaygunClientBase in FlagAsSent

Seeing quite a few of these on our end.

Application ID: /LM/W3SVC/1/ROOT

Process ID: 3176

Exception: System.ArgumentException

Message: The value "AlreadySentByRaygun" is not of type "RabbitMQ.Client.AmqpTcpEndpoint" and cannot be used in this generic collection.
Parameter name: key

StackTrace: at System.ThrowHelper.ThrowWrongKeyTypeArgumentException(Object key, Type targetType)
at System.Collections.Generic.Dictionary2.System.Collections.IDictionary.set_Item(Object key, Object value) at Mindscape.Raygun4Net.RaygunClient.FlagAsSent(Exception exception) in e:\Users\Jason\Documents\GitHub\raygun4net\Mindscape.Raygun4Net\RaygunClient.cs:line 269 at Mindscape.Raygun4Net.RaygunClient.SendInBackground(Exception exception, IList1 tags, IDictionary userCustomData) in e:\Users\Jason\Documents\GitHub\raygun4net\Mindscape.Raygun4Net\RaygunClient.cs:line 246
at Insightly.Core.Queue.Dispatcher.QueueMessageDispatcher.<>c__DisplayClass1.b__0(Object o) in c:\TeamCity\buildAgent\work\a143f4b26d146d88\InsightlyCore\Insightly.Core\Queue\Dispatcher\QueueMessageDispatcher.cs:line 38
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
at System.Threading.ThreadPoolWorkQueue.Dispatch()

send raw data instead of transformed ones

hi everyone,

the error message is presently composed of the exceptionType name and the exception message. In my opinion, this property should only include the exception message. In fact, all the properties should be populated from raw data and no aggregation should be done. If someone want to merge two properties into one, it should be done server side where it receive the data.

So instead of this code

public RaygunErrorMessage(Exception exception)
{
   var exceptionType = exception.GetType();

   Message = string.Format("{0}: {1}", exceptionType.Name, exception.Message);
   ClassName = exceptionType.FullName;
   ...
}

it should be:

public RaygunErrorMessage(Exception exception)
{
   var exceptionType = exception.GetType();

   Message = exception.Message;
   ClassName = exceptionType.FullName;
   ...
}

what's your thought?

Make CanSend a virtual method

I'd like to add some custom logic to the method 'protected bool CanSend(Exception exception)' inside the RaygunHttpModule, but I can't because it's not virtual.
Please make this method virtual.

Nuget Package

We need to create a nuget package to allow people to easily add the adapter to their project

No way to add extra informaiton

Lets say I have explicitly caught an exception and I want to log some extra information about it. Perhaps a small message to give context and the state of some variables to help with debugging. I dont believe this is possible with the current API.

Build.Bat fails to build

Downloaded and ran Build.bat and build failed on windows 7

BuildFailed

Looks like a missing type in the WinRT Project.

Opening the solution in Visual Studio 2012 and building results in a successful build. Build.bat will start building successfully after this.

A missing type is a missing type.... so not quite sure why a VS build will fix this

Request is not available in this context

Sending an exception from a HttpApplication.Application_Start results in

System.Web.HttpException occurred
  HResult=-2147467259
  Message=Request is not available in this context
  Source=System.Web
  ErrorCode=-2147467259
  WebEventCode=0
  StackTrace:
       at System.Web.HttpContext.get_Request()
       at Mindscape.Raygun4Net.RaygunMessageBuilder.SetHttpDetails(HttpContext context, List`1 ignoredFormNames) in e:\Users\Jason\Documents\GitHub\raygun4net\Mindscape.Raygun4Net\RaygunMessageBuilder.cs:line 129
  InnerException: 

http://stackoverflow.com/questions/2518057/request-is-not-available-in-this-context

Raygun forces web.config / app.config not allowing webactivator / in code configuration

https://github.com/MindscapeHQ/raygun4net/blob/master/Mindscape.Raygun4Net/RaygunSettings.cs#L8

 private static readonly RaygunSettings settings = 
                   ConfigurationManager.GetSection("RaygunSettings") as RaygunSettings;

Which is consumed by

 return settings ?? new RaygunSettings { ApiKey = "", ApiEndpoint = new Uri(DefaultApiEndPoint) };

means it's only possible to configure the api key for the standard usage of raygun through configuration.

If you made the RaygunSettings field be a public static this would resolve that issue.

Using test exception <p

I tried to validate that I have connected the application to RayGun correctly and I get this response from the .NET client. Note, my test exception was to enter <p into our search box (which apparently is not escaped correctly when being reported downstream).

    System.Web.HttpRequestValidationException (0x80004005): A potentially dangerous Request.QueryString value was detected from the client (Term="<p").
       at System.Web.HttpRequest.ValidateString(String value, String collectionKey, RequestValidationSource requestCollection)
       at Microsoft.Web.Infrastructure.DynamicValidationHelper.ValidationUtility.CollectionReplacer.<>c__DisplayClass12.<ReplaceCollection>b__d(String value, String key)
       at Microsoft.Web.Infrastructure.DynamicValidationHelper.LazilyEvaluatedNameObjectEntry.ValidateObject()
       at Microsoft.Web.Infrastructure.DynamicValidationHelper.LazilyValidatingArrayList.get_Item(Int32 index)
       at System.Collections.Specialized.NameObjectCollectionBase.BaseGetAllKeys()
       at System.Collections.Specialized.NameValueCollection.get_AllKeys()
       at Mindscape.Raygun4Net.Messages.RaygunRequestMessage.ToDictionary(NameValueCollection nameValueCollection, Boolean truncateValues) in e:\Users\Jason\Documents\GitHub\raygun4net\Mindscape.Raygun4Net\Messages\RaygunRequestMessage.cs:line 46
       at Mindscape.Raygun4Net.Messages.RaygunRequestMessage..ctor(HttpRequest request) in e:\Users\Jason\Documents\GitHub\raygun4net\Mindscape.Raygun4Net\Messages\RaygunRequestMessage.cs:line 20
       at Mindscape.Raygun4Net.RaygunMessageBuilder.SetHttpDetails(HttpContext context) in e:\Users\Jason\Documents\GitHub\raygun4net\Mindscape.Raygun4Net\RaygunMessageBuilder.cs:line 155
       at Mindscape.Raygun4Net.RaygunClient.BuildMessage(Exception exception) in e:\Users\Jason\Documents\GitHub\raygun4net\Mindscape.Raygun4Net\RaygunClient.cs:line 1197
       at Mindscape.Raygun4Net.RaygunClient.Send(Exception exception) in e:\Users\Jason\Documents\GitHub\raygun4net\Mindscape.Raygun4Net\RaygunClient.cs:line 558

More responsive chart labels

While moving the mouse over the chart, a label is displayed with a slow fading animation. This is fine for the first time the mouse enters the chart, but when moving the mouse to other points in the chart, the slow animation is not ideal. It would be great to be able to move the mouse across the chart and quickly see the labels.

Support for Web API

Any chance of getting built-in support for Web API? I know there is WebApiContrib.Logging.Raygun, but that's lacking some fairly important features e.g. tags, custom data and data sanitization (IgnoreFormDataNames).

Do you have any plans to support Web API officially, or should I head over to WebApiContrib to make a PR for the stuff I need?

Alternatively, if you have plans for it here but haven't gotten round to it yet, I'd be happy to help out.

Allow seeing API key on RaygunClient

Would be handy to make this settable as a property rather than always relying on the config existing IMO.

Happy to debate this though, but sometimes I find certain times you just want to spin it up, rip it down in some crusty app or test environment without needing to setup a config file.

Allow to modify RaygunSettings at runtime

Setting a configuration property at runtime results in an exception: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Configuration.ConfigurationErrorsException: The configuration is read only.

Consider adding IsReadOnly() override to the RaygunSettings class to enable modifying settings at runtime.

public override bool IsReadOnly()
      {
          return false;
      }

The project log4net.Raygun attempts to set the property ThrowOnError but fails with the exception above.

If raygun is down or responding with error all messages are silently destroyed

View lines

https://github.com/MindscapeHQ/raygun4net/blob/master/Mindscape.Raygun4Net/RaygunClient.cs#L294
https://github.com/MindscapeHQ/raygun4net/blob/master/Mindscape.Raygun4Net/RaygunClient.cs#L111

These show global

 catch(exception) { do nothing }

This is beyond bad practice. You cannot just silently destroy an application's capability to record unhandled exceptions.

I understand why you would not want these exceptions to bubble up, but your take your ball and go home is not a solution.

You should expose an event that can be listened to for unhandled exceptions caused by raygun. The event should expose both the raygun error, and the original error (or original message, or both).

COMException: (HRESULT: 0x80010002 (RPC_E_CALL_CANCELED)) when getting cpu info

When getting cpu info on one of the computer I have received this error. Propably reason security.

StackTrace:
System.Runtime.InteropServices.Marshal ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo):-1
System.Management.ManagementScope InitializeGuts(Object o):271
System.Management.ManagementScope Initialize():82
System.Management.ManagementObject Initialize(Boolean getObject):271
System.Management.ManagementClass GetInstances(EnumerationOptions options):45
System.Management.ManagementClass GetInstances():0
Mindscape.Raygun4Net.Messages.RaygunEnvironmentMessage GetCpu():11
Mindscape.Raygun4Net.Messages.RaygunEnvironmentMessage .ctor():233
Mindscape.Raygun4Net.RaygunMessageBuilder SetEnvironmentDetails():0
Mindscape.Raygun4Net.RaygunClient BuildMessage(Exception exception):0
Mindscape.Raygun4Net.RaygunClient Send(Exception exception, IList`1 tags, IDictionary userCustomData, String version):0

Option to ignore all form POST data

An option to ignore all form post data, rather than IgnoreFormDataNames which just black lists certain parameter names.

This could also allow for a white list of form data to include.

I'm happy to contribute, so if you think it's a good idea I'll submit a pull request.

ObjectDisposedException

ObjectDisposedException: Cannot access a disposed object. Object name: 'System.Net.HttpWebResponse'.
Using version 2.0.0 of the Raygun4Net NuGet package.

[ObjectDisposedException: Cannot access a disposed object. Object name: 'System.Net.HttpWebResponse'.]
System.Net.HttpWebResponse.CheckDisposed():0
System.Net.HttpWebResponse.get_StatusCode():6
Mindscape.Raygun4Net.RaygunMessageBuilder.SetExceptionDetails(Exception exception) in e:\Users\Jason\Documents\GitHub\raygun4net\Mindscape.Raygun4Net\RaygunMessageBuilder.cs:84
Mindscape.Raygun4Net.RaygunClient.BuildMessage(Exception exception, IList`1 tags, IDictionary userCustomData) in e:\Users\Jason\Documents\GitHub\raygun4net\Mindscape.Raygun4Net\RaygunClient.cs:179

Here's the logged error ID in Raygun, so you can look up the error inside the Raygun database ;-) 352682142

HttpModule

Create an HttpModule to handle web application exceptions

Web Api support doesn't record request or user information

Up until now we have been using the web api contrib version. That implementation has been working well. By comparison, there are some things that the new "official" version is missing.

Our version records the following:

{
     "MachineName": null,
     "Version": null,
     "Error": {
          "InnerError": null,
          "Data": {
               "MS_LoggedBy": [
                    {},
                    {}
               ]
          },
          "ClassName": "System.SystemException",
          "Message": "SystemException: Raygun testing",
          "StackTrace": [
              <clipped>
          ]
     },
     "Environment": {
          "ProcessorCount": 8,
          "OSVersion": "Microsoft Windows NT 6.2.9200.0",
          "Architecture": "x86",
          "Locale": "English (Australia)",
          "UtcOffset": 10,
          "DiskSpaceFree": [
               84.50210952758789,
               717.150806427002,
               203.04984664916992
          ]
     },
     "User": {
          "Identifier": "Test"
     },
     "Request": {
          "HostName": "localhost",
          "Url": "/api/customer",
          "HttpMethod": "POST",
          "RawData": "",
          "Headers": {
               "Connection": "keep-alive",
               "Accept": "*/*",
               "Accept-Encoding": "gzip,deflate,sdch",
               "Accept-Language": "en-AU,en; q=0.8",
               "Cookie": "<clipped>",
               "Host": "localhost:44301",
               "Referer": "https://localhost:44301/PersonalDetails",
               "User-Agent": "Mozilla/5.0,(Windows NT 6.3; WOW64),AppleWebKit/537.36,(KHTML, like Gecko),Chrome/36.0.1985.125,Safari/537.36",
               "Origin": "https://localhost:44301",
               "X-Requested-With": "XMLHttpRequest",
               "X-RequestVerificationToken": "<clipped>",
               "DNT": "1",
               "Content-Length": "128",
               "Content-Type": "application/x-www-form-urlencoded"
          },
          "IPAddress": "::1"
     },
     "Client": {
          "Name": "WebApiContrib.Logging.Raygun",
          "Version": "0.9.14.0",
          "ClientUrl": "https://github.com/WebApiContrib/WebApiContrib.Logging.Raygun"
     }
}

The following is what we get from the Raygun version.

{
     "MachineName": "<clipped>",
     "Version": "Not supplied",
     "Error": {
          "InnerError": null,
          "Data": [],
          "ClassName": "Mindscape.Raygun4Net.WebApi.RaygunWebApiHttpException",
          "Message": "RaygunWebApiHttpException: HTTP 400 returned while handling URL https://localhost:44301/api/customer",
          "StackTrace": [
               {
                    "LineNumber": 46,
                    "ClassName": "Mindscape.Raygun4Net.WebApi.RaygunWebApiActionFilter",
                    "FileName": "e:\\Users\\Jason\\Documents\\GitHub\\raygun4net\\Mindscape.Raygun4Net45\\WebApi\\RaygunWebApiFilters.cs",
                    "MethodName": "OnActionExecuted(HttpActionExecutedContext context)"
               }
          ]
     },
     "Environment": {
          "ProcessorCount": 8,
          "OSVersion": "6.3.9600",
          "WindowBoundsWidth": 3840,
          "WindowBoundsHeight": 1200,
          "ResolutionScale": null,
          "CurrentOrientation": null,
          "Cpu": "Intel(R) Xeon(R) CPU E3-1230 v3 @ 3.30GHz",
          "PackageVersion": null,
          "Architecture": "x86",
          "TotalVirtualMemory": 2047,
          "AvailableVirtualMemory": 1253,
          "DiskSpaceFree": [
               84.36605453491211,
               717.1511993408203,
               203.04984664916992
          ],
          "TotalPhysicalMemory": 16314,
          "AvailablePhysicalMemory": 7624,
          "DeviceName": null,
          "UtcOffset": 10,
          "Locale": "English (Australia)"
     },
     "Client": {
          "Name": "Raygun4Net",
          "Version": "3.2.0.0",
          "ClientUrl": "https://github.com/MindscapeHQ/raygun4net"
     },
     "Tags": null,
     "UserCustomData": null,
     "User": null,
     "Request": null,
     "Response": {
          "StatusCode": 400,
          "StatusDescription": "BadRequest"
     }
}

What we noticed is that the Raygun version is missing request and user information but does correctly capture server machine name. It only records a single stack frame though rather than the very large stacktrace from the contrib version. There is a decent amount of contextual information being left out that makes web api error reports not as valuable.

Exception reports do not include all exception information

We just got an error report on a System.Web.Http.HttpResponseException but the Raygun report does not contain any information about the exception to do anything about it. For example, the following is the exception detail reported.

"Error": {
          "Data": [],
          "ClassName": "System.Web.Http.HttpResponseException",
          "Message": "HttpResponseException: Processing of the HTTP request resulted in an exception. Please see the HTTP response returned by the 'Response' property of this exception for details.",
          "StackTrace": [
               {
                    "LineNumber": 50,
                    "ClassName": "System.Web.Http.Controllers.ApiControllerActionSelector+ActionSelectorCacheItem",
                    "MethodName": "SelectAction(HttpControllerContext controllerContext)"
               },
               {
                    "LineNumber": 27,
                    "ClassName": "System.Web.Http.Controllers.ApiControllerActionSelector",
                    "MethodName": "SelectAction(HttpControllerContext controllerContext)"
               },
               {
                    "LineNumber": 28,
                    "ClassName": "Mindscape.Raygun4Net.WebApi.RaygunWebApiActionSelector",
                    "FileName": "e:\\Users\\Jason\\Documents\\GitHub\\raygun4net\\Mindscape.Raygun4Net45\\WebApi\\RaygunWebApiSelectors.cs",
                    "MethodName": "SelectAction(HttpControllerContext controllerContext)"
               },
               {
                    "LineNumber": 82,
                    "ClassName": "System.Web.Http.ApiController",
                    "MethodName": "ExecuteAsync(HttpControllerContext controllerContext, CancellationToken cancellationToken)"
               },
               {
                    "LineNumber": 291,
                    "ClassName": "System.Web.Http.Dispatcher.HttpControllerDispatcher+<SendAsync>d__1",
                    "MethodName": "MoveNext()"
               }
          ]
     }

Given the fields reported (Message, InnerError, Type and StackTrace), the exception is not JSON serialized. Instead it looks like just the Message, InnerException and StackTrace properties are picked out. This misses out a lot of detail from many exceptions that are raised. SqlException is another classic one where the detail is not in the message, but in custom child properties and collections.

Is it possible to serialize and report on the entire exception instance?

Send(RaygunMessage raygunMessage) is public when many raygunMessage methods are not

https://github.com/MindscapeHQ/raygun4net/blob/master/Mindscape.Raygun4Net/RaygunClient.cs#L278 shows

public void Send(RaygunMessage raygunMessage)

However

internal RaygunMessage BuildMessage(Exception exception)
private RaygunMessage CreateMessage(Exception exception,
                               [Optional] IList<string> tags, [Optional] IDictionary userCustomData)

The builder for raygunmessage seems to be non trivial, sure a user could copy and paste the code from those methods since it appears the builder is public, but is that actually helpful?

SendInBackground is useless and actually dangerous

The SendInBackground methods https://github.com/MindscapeHQ/raygun4net/blob/master/Mindscape.Raygun4Net/RaygunClient.cs#L268 seems to serve no real purpose.

If you really want to support sending in background, you should queue items and then release them every X, perhaps every 1 minutes etc.

Take your existing implementation. Suppose a consumer of raygun releases their application where a commonly accessed page now results in unhandled exception, they're using SendInBackground to deliver the errors. This will result in taking a thread from the ThreadPool for every concurrent user. This will very very very quickly lead to starvation of IIS worker threads, then bringing down the entire application, or possibly the entire IIS server.

I'm on not sure of the exact correct implementation for this, but i think a Timer is the correct solution to only be consuming 1 thread for send in background as opposed to potentially infinite threads.

Calling Send() from WCF gives HttpException

When a WCF service calls the RaygunClient.Send() method, an HttpException is thrown:

"This method or property is not supported after HttpRequest.GetBufferlessInputStream has been invoked."

Stack Trace:

at System.Web.HttpRequest.get_InputStream()
at Mindscape.Raygun4Net.Messages.RaygunRequestMessage..ctor(HttpContext httpContext) in c:\Mindscape\github\raygun4net\Mindscape.Raygun4Net\Messages\RaygunRequestMessage.cs:line 50
at Mindscape.Raygun4Net.RaygunClient.BuildMessage(Exception exception) in c:\Mindscape\github\raygun4net\Mindscape.Raygun4Net\RaygunClient.cs:line 254
at Mindscape.Raygun4Net.RaygunClient.Send(Exception exception) in c:\Mindscape\github\raygun4net\Mindscape.Raygun4Net\RaygunClient.cs:line 175
at InfoCaster.VVVArnhemNijmegen.lib.ExceptionHelper.LogException(Exception exception) in c:\Users\kipusoep\Documents\InfoCaster\svn\instances\VVV Arnhem Nijmegen\Website\Sources\trunk\lib\ExceptionHelper.cs:line 31
at InfoCaster.VVVArnhemNijmegen.lib.ExceptionHelper.LogMessage(String message) in c:\Users\kipusoep\Documents\InfoCaster\svn\instances\VVV Arnhem Nijmegen\Website\Sources\trunk\lib\ExceptionHelper.cs:line 46
at InfoCaster.VVVArnhemNijmegen.webservices.Partners.AddLogMessage(String authKey, String message, Boolean messageIsImportant) in c:\Users\kipusoep\Documents\InfoCaster\svn\instances\VVV Arnhem Nijmegen\Website\Sources\trunk\webservices\Partners.svc.cs:line 208
at SyncInvokeAddLogMessage(Object , Object[] , Object[] )
at System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(Object instance, Object[] inputs, Object[]& outputs)
at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc& rpc)

OSS License

We need to decide what license we want to release this on and add a license file before we release

WinRT should allow Exceptions to be sent

If you throw your own exception and want to send it to Raygun, the .Send method only allows for UnhandledExceptionsArgs, would be nice to send an Exception without having to wrap my own inside a RaygunMessage.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.