• About NBug
  • Quick Start
  • Features
  • Screenshots
  • Download

NBug_icon_128NBug - Automated bug, error, and exception reports, crash minidumps.. for .NET

NBug is a .NET library created to automate the bug reporting process. It automatically creates and sends:
* Bug reports,
* Crash reports with minidump,
* Error/exception reports with stack trace + extended application/system information.
It can also be set up as a user feedback system (i.e. for sending feature requests from within your application).

Integrating NBug to your project is extremely easy. As an example, adding below code to a winforms application's Program.cs file (and adding a reference to NBug.dll) will enable the application to report all unhandled exceptions back to the developer:

NBug.Settings.Destination1 = 
  "Type=Mail;From=me@mycompany.com;To=bugtracker@mycompany.com;SmtpServer=smtp.mycompany.com;";
AppDomain.CurrentDomain.UnhandledException += NBug.Handler.UnhandledException;
Application.ThreadException += NBug.Handler.ThreadException;

You can always use the bundled configurator tool to configure every aspect of this library and also take advantage of encrypted connection strings to secure sensitive information (ie. smtp server information, bug tracker apikey, etc.). You can choose to store your configuration via any supported method; inside your app.config file, in external file, wihin your code, and more. All the reports are compressed to be sended:

reports

configurator_redmine_smallThe compressed files contain queued bug reports which are waiting for the next application lunch to be delay-sended. These zip files also contain extended information about the bug like the serialized exception object, complete stack trace, system and application information, minidump and any other information as desired.

Bug reports can be submitted to any of the following: (* denotes features under development)

  • E-mail addresses
  • Redmine Issue Tracker (using REST api)
  • *Websites (via filling in a form with POST request)
  • *FTP servers
  • *Trac Issue Tracker (using XML-PRC)
  • *GitHub Issues Tracker (using GitHub api with POST (HTTP))
  • *Google Code Issue Tracker (using Google Code api with XML w/ POST)
  • *Databases (using ADO.NET)
  • *Mantis/Bugzill

Integrating NBug to your application is a basic 3-step procedure. First make sure that you add a reference to NBug.dll assembly in your project or use NuGet Package to automatically get it imported. Then you need to add the initialization code to your application’s initial class file as defined below:

If you have a Windows Forms application, open up Program.cs file and make sure that your main method looks as below:

static void Main()
{
  #if !DEBUG
  AppDomain.CurrentDomain.UnhandledException += NBug.Handler.UnhandledException;
  Application.ThreadException += NBug.Handler.ThreadException;
  #endif
 
  Application.EnableVisualStyles();
  Application.SetCompatibleTextRenderingDefault(false);
  Application.Run(new Form1());
}

If you have a Windows Presentation Foundation application, open up App.xml.cs file and make sure that your app method method looks as below:

public partial class App : Application
{
  public App()
  {
    #if !DEBUG
    AppDomain.CurrentDomain.UnhandledException += NBug.Handler.UnhandledException;
    Application.Current.DispatcherUnhandledException += NBug.Handler.DispatcherUnhandledException;
    #endif
  }
}

If you have a Console, Webforms, or any other application, open up Program.cs or whatever the initial class file is, and make sure that your main method begins just as below:

class Program
{
  static void Main(string[] args)
  {
    #if !DEBUG
    AppDomain.CurrentDomain.UnhandledException += NBug.Handler.UnhandledException;
    #endif
  }
}

The #if !DEBUG preprocessors will ensure that NBug not start sending reports during development. Finally, you need to use the configurator tool (which is quite simple and self explanatory) to generate a config file or embed configuration in your application code or app.config file. Any unhandled exceptions will be reported to you using any protocol you configured (e-mail, bug tracker, database, ftp, etc.). You can always access the full project documentation at the Documentation section.

Exception Handling

Currently NBug can be configured to listen to all possible sources of unhandled exception events. Library is specially tuned to listen to below sources of unhandled exceptions:

  • AppDomain.CurrentDomain.UnhandledException (unhandled exceptions at all threads in current domain)
  • Windows.Forms.Application.ThreadException (unhandled exceptions at WinForms UI thread)
  • Windows.Application.Current.DispatcherUnhandledException (unhandled exceptions at WPF UI thread)
  • System.Threading.Tasks.TaskScheduler.UnobservedTaskException (unhandled exceptions at System.Threading.Tasks)
  • *Process and heap corruption, stack overflows, and access violations (via HandleProcessCorruptedStateExceptionsAttribute) (under development)

Bug Report Generation

NBug selectively generates following information when the application crashes:

  • Extended crash information (full stack trace, runtimes, assemblies, etc.)
  • Additional requested information (system, application, configuration, etc.)
  • Fully XML serialized exception object (all the custom properties of different exceptions are preserved)
  • *Minidumps (specially optimized for .NET CLR, takes about 1-2 Mb, still under development)

Fully serialized exception objects are extremely useful at inspecting unhandled exceptions. Minidumps at makes it possible to view the local variables while keeping the memory dump under 1-2 Mb with NBug's special touch and with the help of WinDbg.

Configuration

By default, only needed configuration is a destination to send bug reports to. On the other hand, library can be configured in every possible aspect with the bundled configurator tool without ever touching an .xml file. Created configuration can be stored in any of the following locations:

  • NBug.config (seperate config file)
  • app.config (i.e. embedded in YourApplication.exe.config file)
  • Initializer code with handler.Settings="Destination1...."
  • Application code (all the settings can be accessed in code via static NBug.SecureSettings class from your application code)

Report Submission

NBug can submit bug reports to any e-mail address as a shortcut. In addition, bug reports can be submitted to popular bug tracker software, databases, ftp servers, or even project hosting sites like Google Code's project issue tracker. Where provided, native api to the destination app is consumed (as in RESTful services with Redmine tracker). A full list of supported protocols is kept up-to-date at the "About NBug" page above. You can access the full details of the planned features at the Roadmap section at the project tracker.

configurator_mainconfigurator_mailconfigurator_redmine

testapptestapp_crash_minuitestapp_crash_defaultui

testapp_crash_xdetailsClick on the images to enlarge.

You can get the latest the official releases at the Downloads > NBug sections.

You can also view the latest source code at CodePlex project repository. Note that CodePlex is only used as the project source code repository.

NBug v1.1 Released

01 Jul 2011, Teoman Soygul - avatar Teoman Soygul

NBug v1.1 stable is released. This release fixes 40+ bugs and adds 10 new features. Bugs effecting Windows XP and Windows 7 x64 users are fixed. Also the missing crash minidump feature and ability to silently log background / worker thread exceptions is added. To get a full list of changes, see the Changelog. You can download the library from Downloads section. You can discuss this release at the Forum or submit your feature requests and bug reports via the Tracker.

NBug v1.0.3 Security Release

24 Mar 2011, Teoman Soygul - avatar Teoman Soygul

A security issue related to Redmine Issue Tracker password being sent in plaintext is fixed. Now it is only possible to auto-submit bug reports to Redmine using either ApiKey or anonymously. Also minor issues with the bundled configurator tool were fixed.

NBug v1.0.2 Bugfix Release

23 Mar 2011, Teoman Soygul - avatar Teoman Soygul

NBug v1.0.2 released, fixing issues related to new static initializers. PleaseĀ have a look at the new "Quick Start" to learn about the new initialization methods, which become much simpler.