2

How can I use ExceptionLess on a Visual Studio Class Library project without create a settings file?

In other words, the Class Library project creates a DLL with some methods inside it, but I want to report exceptions and notifications during call of these methods of the DLL with ExceptionLess.

Something like:

using System;
using System.Threading.Tasks;
using Exceptionless.Configuration;
...
...
namespace LibraryName
{
    public class Activities
    {
        public static string MethodOne(string var1, string var2)
        {
            ...
            try
            {
                ...code...
            }
            catch(Exception ex)
            {
                ex.ToExceptionless().Submit();
            }
        }
        public static int MethodTwo(int var1, int var2)
        {
            ...
            try
            {
                ...code...
            }
            catch(Exception ex)
            {
                ex.ToExceptionless().Submit();
            }
        }
     }
}

So, I should be able to "port" the LibraryName.dll and ExceptionLess DLLs.

Grant Winney
  • 65,241
  • 13
  • 115
  • 165
Gabms
  • 83
  • 1
  • 7

1 Answers1

2

Done!

How?

  1. Installing nuGet package ExceptionLess (last stable version) to Class Library project.
  2. Adding directive Exceptionless (using ExceptionLess;)
  3. Setting the api key directly on the default instance (ExceptionlessClient.Default.Configuration.ApiKey = "3BC1Ntsdjhf*********JGytyuiiud7";)

and submitting logs and exceptions from code.

Thanks.

Gabms
  • 83
  • 1
  • 7
  • You can use this or attributes, or specify the api key in the Startup() method (depending on your implementation. If you have any questions please let us know. Here is a link to the configuration docs https://github.com/exceptionless/Exceptionless.Net/wiki/Configuration#exceptionlessclient-configuration – Blake Niemyjski Jul 07 '17 at 02:02