Exemplo n.º 1
0
        public async Task <ActionResult> About()
        {
            try
            {
                var random = new Random();
                if (random.Next(0, 10) < 5)
                {
                    System.IO.File.ReadAllBytes("path to not existing file");
                }
            }
            catch (FileNotFoundException exception)
            {
                string hostUrl = ConfigurationManager.AppSettings["hostUrl"];
                string token   = ConfigurationManager.AppSettings["token"];

                var backtraceCredentials = new BacktraceCredentials(
                    backtraceHostUrl: hostUrl,
                    accessToken: token);

                BacktraceClient backtraceClient = new BacktraceClient(backtraceCredentials);
                var             backtraceResult = await backtraceClient.SendAsync(exception);

                Debug.WriteLine($"Backtrace Server result: {backtraceResult.Status}");
            }

            ViewBag.Message = "Your application description page.";
            return(View());
        }
Exemplo n.º 2
0
        public virtual void Setup()
        {
            var api = new Mock <IBacktraceApi>();

            api.Setup(n => n.Send(It.IsAny <BacktraceData>()))
            .Returns(new BacktraceResult()
            {
                Status = Types.BacktraceResultStatus.Ok
            });

            var credentials = new BacktraceCredentials(@"https://validurl.com/", "validToken");

            _backtraceClient = new BacktraceClient(credentials)
            {
                BacktraceApi = api.Object
            };

            //set one scoped attribute
            _backtraceClient.Attributes["ScopedAttributes"] = true;

            _testAttributes.Add(new Dictionary <string, object>()
            {
                { "boolAttribute", true },
                { "numberAttribute", 123 },
                { "stringAttribute", "attribute" },
                { "objectAttribute", new { Name = "Konrad", WorkType = "UnitTest" } }
            });

            _testAttributes.Add(new Dictionary <string, object>());
            _testAttributes.Add(null);
        }
Exemplo n.º 3
0
 /// <summary>
 /// Initialize new client instance with BacktraceCredentials
 /// </summary>
 /// <param name="backtraceCredentials">Backtrace credentials to access Backtrace API</param>
 /// <param name="attributes">Additional information about current application</param>
 /// <param name="databaseSettings">Backtrace database settings</param>
 /// <param name="reportPerMin">Number of reports sending per one minute. If value is equal to zero, there is no request sending to API. Value have to be greater than or equal to 0</param>
 public BacktraceBase(
     BacktraceCredentials backtraceCredentials,
     Dictionary <string, object> attributes     = null,
     BacktraceDatabaseSettings databaseSettings = null,
     uint reportPerMin = 3)
     : this(backtraceCredentials, attributes, new BacktraceDatabase(databaseSettings),
            reportPerMin)
 {
 }
Exemplo n.º 4
0
 /// <summary>
 /// Create a new instance of Backtrace API
 /// </summary>
 /// <param name="credentials">API credentials</param>
 public BacktraceApi(BacktraceCredentials credentials, uint reportPerMin = 3)
 {
     if (credentials == null)
     {
         throw new ArgumentException($"{nameof(BacktraceCredentials)} cannot be null");
     }
     _serverurl         = credentials.GetSubmissionUrl().ToString();
     reportLimitWatcher = new ReportLimitWatcher(reportPerMin);
 }
Exemplo n.º 5
0
        public void GenerateSubmissionUrl_FromValidHostName_ValidSubmissionUrl(string host)
        {
            const string token       = "1234";
            var          credentials = new BacktraceCredentials(host, token);

            string expectedUrl = $"{credentials.BacktraceHostUri.AbsoluteUri}post?format=json&token={credentials.Token}";

            Assert.AreEqual(credentials.GetSubmissionUrl(), expectedUrl);
        }
Exemplo n.º 6
0
        /// <summary>
        /// Create a new instance of Backtrace API
        /// </summary>
        /// <param name="credentials">API credentials</param>
        public BacktraceApi(BacktraceCredentials credentials)
        {
            _credentials = credentials;
            if (_credentials == null)
            {
                throw new ArgumentException(string.Format("{0} cannot be null", "BacktraceCredentials"));
            }

            _serverurl = credentials.GetSubmissionUrl();
        }
 /// <summary>
 /// Create a new instance of Backtrace API
 /// </summary>
 /// <param name="credentials">API credentials</param>
 public BacktraceApi(BacktraceCredentials credentials, uint reportPerMin = 3)
 {
     if (credentials == null)
     {
         throw new ArgumentException($"{nameof(BacktraceCredentials)} cannot be null");
     }
     _credentials       = credentials;
     _serverurl         = $"{credentials.BacktraceHostUri.AbsoluteUri}post?format=json&token={credentials.Token}";
     reportLimitWatcher = new ReportLimitWatcher(reportPerMin);
 }
Exemplo n.º 8
0
        /// <summary>
        /// Create a new instance of Backtrace API
        /// </summary>
        /// <param name="credentials">API credentials</param>
        public BacktraceApi(BacktraceCredentials credentials, bool ignoreSslValidation = false)
        {
            _credentials = credentials;
            if (_credentials == null)
            {
                throw new ArgumentException(string.Format("{0} cannot be null", "BacktraceCredentials"));
            }

            _ignoreSslValidation = ignoreSslValidation;
            _serverurl           = credentials.GetSubmissionUrl();
        }
Exemplo n.º 9
0
 /// <summary>
 /// Initialize new client instance with BacktraceCredentials
 /// </summary>
 /// <param name="backtraceCredentials">Backtrace credentials to access Backtrace API</param>
 /// <param name="attributes">Additional information about current application</param>
 /// <param name="databaseDirectory">Database path</param>
 /// <param name="reportPerMin">Number of reports sending per one minute. If value is equal to zero, there is no request sending to API. Value have to be greater than or equal to 0</param>
 public BacktraceBase(
     BacktraceCredentials backtraceCredentials,
     Dictionary <string, T> attributes = null,
     string databaseDirectory          = "",
     uint reportPerMin = 3)
 {
     _attributes    = attributes ?? new Dictionary <string, T>();
     _database      = new BacktraceDatabase <T>(databaseDirectory);
     _backtraceApi  = new BacktraceApi <T>(backtraceCredentials);
     _reportWatcher = new ReportWatcher <T>(reportPerMin);
 }
Exemplo n.º 10
0
 /// <summary>
 /// Initialize new client instance with BacktraceCredentials
 /// </summary>
 /// <param name="backtraceCredentials">Backtrace credentials to access Backtrace API</param>
 /// <param name="attributes">Additional information about current application</param>
 /// <param name="databaseSettings">Backtrace database settings</param>
 /// <param name="reportPerMin">Number of reports sending per one minute. If value is equal to zero, there is no request sending to API. Value have to be greater than or equal to 0</param>
 public BacktraceBase(
     BacktraceCredentials backtraceCredentials,
     Dictionary <string, object> attributes = null,
     IBacktraceDatabase database            = null,
     uint reportPerMin = 3)
 {
     Attributes   = attributes ?? new Dictionary <string, object>();
     BacktraceApi = new BacktraceApi(backtraceCredentials, reportPerMin);
     Database     = database ?? new BacktraceDatabase();
     Database.SetApi(BacktraceApi);
     Database.Start();
 }
Exemplo n.º 11
0
        /// <summary>
        /// Create a new instance of Backtrace API
        /// </summary>
        /// <param name="credentials">API credentials</param>
        public BacktraceApi(BacktraceCredentials credentials, uint reportPerMin = 3)
        {
            if (credentials == null)
            {
                throw new ArgumentException($"{nameof(BacktraceCredentials)} cannot be null");
            }
            _serverurl         = credentials.GetSubmissionUrl();
            reportLimitWatcher = new ReportLimitWatcher(reportPerMin);
#if !NET35
            InitializeHttpClient(credentials.Proxy);
#endif
        }
        public void Setup()
        {
            _lastRecord = GetRecord();
            //get project path
            string projectPath = Path.GetTempPath();
            //setup credentials
            var credentials = new BacktraceCredentials("https://validurl.com/", "validToken");
            //mock api
            var serverUrl = $"{credentials.BacktraceHostUri.AbsoluteUri}post?format=json&token={credentials.Token}";
            var mockHttp  = new MockHttpMessageHandler();

            mockHttp.When(serverUrl)
            .Respond("application/json", "{'object' : 'aaa'}");
            var api = new BacktraceApi(credentials, 0)
            {
                HttpClient = mockHttp.ToHttpClient()
            };

            //mock file context
            var mockFileContext = new Mock <IBacktraceDatabaseFileContext>();

            mockFileContext.Setup(n => n.GetRecords())
            .Returns(new List <FileInfo>());
            mockFileContext.Setup(n => n.RemoveOrphaned(It.IsAny <IEnumerable <BacktraceDatabaseRecord> >()));

            //mock cache
            var mockCacheContext = new Mock <IBacktraceDatabaseContext>();

            mockCacheContext.Setup(n => n.Add(It.IsAny <BacktraceData>(), MiniDumpType.None))
            .Callback(() =>
            {
                mockCacheContext.Object.Add(_lastRecord);
                _lastRecord = GetRecord();
            })
            .Returns(_lastRecord);


            var database = new BacktraceDatabase(new BacktraceDatabaseSettings(projectPath)
            {
                RetryBehavior = RetryBehavior.NoRetry
            })
            {
                BacktraceDatabaseContext     = mockCacheContext.Object,
                BacktraceDatabaseFileContext = mockFileContext.Object,
            };

            //setup new client
            _backtraceClient = new BacktraceClient(backtraceCredentials: credentials, database: database, reportPerMin: 0)
            {
                BacktraceApi = api
            };
        }
Exemplo n.º 13
0
        public void Setup()
        {
            //prepare mock object
            //mock database
            var database = new Mock <IBacktraceDatabase>();

            database.Setup(n =>
                           n.Add(It.IsAny <BacktraceReport>(),
                                 It.IsAny <Dictionary <string, object> >(),
                                 It.IsAny <MiniDumpType>()));

            database.Setup(n =>
                           n.Delete(It.IsAny <BacktraceDatabaseRecord>()));

            var credentials = new BacktraceCredentials("https://validurl.com/", "validToken");

            //mock api
            var serverUrl = $"{credentials.BacktraceHostUri.AbsoluteUri}post?format=json&token={credentials.Token}";
            var mockHttp  = new MockHttpMessageHandler();

            mockHttp.When(serverUrl)
            .Respond("application/json", "{'object' : 'aaa'}");
            var api = new BacktraceApi(credentials, 0)
            {
                HttpClient = mockHttp.ToHttpClient()
            };

            //setup new client
            _backtraceClient = new BacktraceClient(credentials, database: database.Object)
            {
                BacktraceApi = api
            };

            //Add new scoped attributes
            _backtraceClient.Attributes["ClientAttributeNumber"]      = 1;
            _backtraceClient.Attributes["ClientAttributeString"]      = "string attribute";
            _backtraceClient.Attributes["ClientAttributeCustomClass"] = new
            {
                Name = "BacktraceIntegrationTest",
                Type = "Library"
            };
            _backtraceClient.Attributes["ComplexObject"] = new Dictionary <string, Uri>()
            {
                { "backtrace.io", new Uri("http://backtrace.io") },
                { "Google url", new Uri("http://google.com") }
            };
            //to check if client report limit reached use OnClientReportLimitReached
            _backtraceClient.OnClientReportLimitReached = (BacktraceReport report) =>
            {
                clientReportLimitReached = true;
            };
        }
Exemplo n.º 14
0
        /// <summary>
        /// Create a new instance of Backtrace API
        /// </summary>
        /// <param name="credentials">API credentials</param>
        public BacktraceApi(
            BacktraceCredentials credentials,
            bool ignoreSslValidation = false)
        {
            _credentials = credentials;
            if (_credentials == null)
            {
                throw new ArgumentException(string.Format("{0} cannot be null", "BacktraceCredentials"));
            }

            _serverUrl   = credentials.GetSubmissionUrl();
            _minidumpUrl = credentials.GetMinidumpSubmissionUrl().ToString();
            _httpClient.IgnoreSslValidation = ignoreSslValidation;
        }
Exemplo n.º 15
0
        public void Setup()
        {
            var credentials        = new BacktraceCredentials("https://validurl.com/", "validToken");
            var invalidCredentials = new BacktraceCredentials("https://validurl.com/", "invalidToken");
            //mock API
            var serverUrl  = $"{credentials.BacktraceHostUri.AbsoluteUri}post?format=json&token={credentials.Token}";
            var invalidUrl = $"{credentials.BacktraceHostUri.AbsoluteUri}post?format=json&token={credentials.Token}";

            var mockHttp = new MockHttpMessageHandler();

            mockHttp.When(serverUrl)
            .Respond("application/json", "{'object' : 'aaa'}");

            mockHttp.When(invalidUrl)
            .Respond("application/json", "{'message': 'invalid data'}");
            var api = new BacktraceApi(credentials, 0)
            {
                HttpClient = mockHttp.ToHttpClient()
            };

            var apiWithInvalidUrl = new BacktraceApi(invalidCredentials, 100)
            {
                HttpClient = mockHttp.ToHttpClient()
            };


            //mock database
            var database = new Mock <IBacktraceDatabase>();

            database.Setup(n =>
                           n.Add(It.IsAny <BacktraceReport>(),
                                 It.IsAny <Dictionary <string, object> >(),
                                 It.IsAny <MiniDumpType>()));

            database.Setup(n =>
                           n.Delete(It.IsAny <BacktraceDatabaseRecord>()));

            //setup new client
            _backtraceClient = new BacktraceClient(credentials, database: database.Object, reportPerMin: 0)
            {
                BacktraceApi = api,
                Database     = database.Object
            };
            _clientWithInvalidParameters = new BacktraceClient(invalidCredentials, database: database.Object, reportPerMin: 0)
            {
                BacktraceApi = apiWithInvalidUrl,
                Database     = database.Object
            };
        }
Exemplo n.º 16
0
        public void GenerateBacktraceSubmitUrl_FromSubmitUrl_ValidSubmissionUrl(string host)
        {
            var credentials = new BacktraceCredentials(host);

            if (!host.StartsWith("https://") && !host.StartsWith("http://"))
            {
                host = $"https://{host}";
            }

            if (!host.EndsWith("/"))
            {
                host += '/';
            }
            Assert.AreEqual(host, credentials.GetSubmissionUrl().ToString());
        }
Exemplo n.º 17
0
        public static BacktraceClient GetBacktraceClient()
        {
            IrcConfigModel.IrcSettings settings =
                ConfigHelpers.LoadConfig <IrcConfigModel.IrcSettings>(ConfigHelpers.ConfigPaths.IrcConfig);
            if (settings.BacktraceSubmitUrl == null || settings.BacktraceToken == null)
            {
                return(null);
            }
            var credentials = new BacktraceCredentials(settings.BacktraceSubmitUrl, settings.BacktraceToken);
            var client      = new BacktraceClient(credentials);

            client.Attributes.Add("Network", settings.ConnectionUri.ToString());
            client.Attributes.Add("BotName", settings.Nick);
            return(client);
        }
Exemplo n.º 18
0
        private void SetupClient(Framework.Settings settings)
        {
            // setup new Backtrace client instance
            var credentials = new BacktraceCredentials(settings.BacktraceHost, settings.BacktraceToken);

            _client = new BacktraceClient(credentials, _attributes, settings.BacktraceDatabasePath, settings.BacktraceClientSiteLimiting);
            _client.HandleApplicationException();
            _client.AsyncRequest = true;
            _client.HandleApplicationException();
            _client.OnServerAnswer = (BacktraceServerResponse response) =>
            {
                Trace.WriteLine(response);
            };

            _client.WhenServerUnvailable = (Exception e) =>
            {
                Trace.WriteLine(e.Message);
            };
        }
Exemplo n.º 19
0
        private void UploadSymbols(string serverUrl, string symbolsToken, string symbolsPath)
        {
            Debug.Log($"Uploading symbols archive : {symbolsPath} to server {serverUrl}. Please wait...");
            var backtraceCredentials = new BacktraceCredentials(serverUrl);


            var boundaryId      = string.Format("----------{0:N}", Guid.NewGuid());
            var boundaryIdBytes = Encoding.ASCII.GetBytes(boundaryId);

            try
            {
                var bytes    = File.ReadAllBytes(symbolsPath);
                var formData = new List <IMultipartFormSection>
                {
                    new MultipartFormFileSection("upload_file", bytes)
                };
                using (var request = UnityWebRequest.Post(
                           uri: backtraceCredentials.GetSymbolsSubmissionUrl(symbolsToken).ToString(),
                           multipartFormSections: formData,
                           boundary: boundaryIdBytes))
                {
                    request.SetRequestHeader("Content-Type", "multipart/form-data; boundary=" + boundaryId);
                    request.timeout = 15000;
                    request.SendWebRequest();
                    while (!request.isDone)
                    {
                        EditorUtility.DisplayProgressBar("Backtrace symbols upload", "Symbols upload progress:", request.uploadProgress);
                    }
                    var failure = request.isNetworkError || request.isHttpError;
                    if (failure)
                    {
                        Debug.LogWarning(string.Format("Cannot upload symbols to Backtrace. Reason: {0}", request.downloadHandler.text));
                        return;
                    }
                    Debug.Log("Symbols are available in your Backtrace instance");
                }
            }
            catch (Exception e)
            {
                Debug.LogWarning(string.Format("Cannot upload symbols to Backtrace. Reason: {0}", e.Message));
            }
        }
Exemplo n.º 20
0
        public void Setup()
        {
            var credentials = new BacktraceCredentials("https://validurl.com/", "validToken");

            //mock api
            var serverUrl = $"{credentials.BacktraceHostUri.AbsoluteUri}post?format=json&token={credentials.Token}";
            var mockHttp  = new MockHttpMessageHandler();

            mockHttp.When(serverUrl)
            .Respond("application/json", "{'object' : 'aaa'}");
            var api = new BacktraceApi(credentials, 0)
            {
                HttpClient = mockHttp.ToHttpClient()
            };

            //setup new client
            _backtraceClient = new BacktraceClient(credentials)
            {
                BacktraceApi = api
            };
        }
Exemplo n.º 21
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            //setup database
            // we get external storage directory and special directory created for databse - Backtrace directory
            string directoryPath = Path.Combine(Android.OS.Environment.ExternalStorageDirectory.AbsolutePath, "Backtrace");
            var    database      = new BacktraceDatabase(new BacktraceDatabaseSettings(directoryPath));

            //setup client configuration
            var credentials         = new BacktraceCredentials(ApplicationSettings.Host, ApplicationSettings.Token);
            var clientConfiguration = new BacktraceClientConfiguration(credentials);

            // Initialize new BacktraceClient
            BacktraceClient client = new BacktraceClient(clientConfiguration, database);

            // Send async report to a server with custom client message
            var result = client.SendAsync("Hello from Xamarin").Result;

            base.OnCreate(savedInstanceState);
            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);
        }
Exemplo n.º 22
0
        public void Setup()
        {
            //prepare mock object
            var credentials = new BacktraceCredentials("https://validurl.com/", "validToken");
            //mock api
            var serverUrl = $"{credentials.BacktraceHostUri.AbsoluteUri}post?format=json&token={credentials.Token}";

            var mockHttp = new MockHttpMessageHandler();

            mockHttp.When(serverUrl)
            .Respond("application/json", "{'object' : 'aaa'}");

            var api = new BacktraceApi(credentials, 0)
            {
                HttpClient = mockHttp.ToHttpClient(),
                //avoid real submission
                RequestHandler = (string host, string boundaryId, BacktraceData data) =>
                {
                    return(new BacktraceResult());
                }
            };

            //mock database
            var database = new Mock <IBacktraceDatabase>();

            database.Setup(n =>
                           n.Add(It.IsAny <BacktraceReport>(),
                                 It.IsAny <Dictionary <string, object> >(),
                                 It.IsAny <MiniDumpType>()));

            database.Setup(n =>
                           n.Delete(It.IsAny <BacktraceDatabaseRecord>()));


            //setup new client
            _backtraceClient = new BacktraceClient(credentials, database: database.Object, reportPerMin: 0)
            {
                BacktraceApi = api
            };
        }
        public virtual void Setup()
        {
            var api = new Mock <IBacktraceApi>();

            api.Setup(n => n.Send(It.IsAny <BacktraceData>()))
            .Returns(new BacktraceResult()
            {
                Status = BacktraceResultStatus.Ok
            });

            api.Setup(n => n.SendAsync(It.IsAny <BacktraceData>()))
            .ReturnsAsync(() => new BacktraceResult()
            {
                Status = BacktraceResultStatus.Ok
            });

            var credentials = new BacktraceCredentials(@"https://validurl.com/", "validToken");

            _backtraceClient = new BacktraceClient(credentials)
            {
                BacktraceApi             = api.Object,
                UnpackAggregateExcetpion = true
            };
        }
Exemplo n.º 24
0
 /// <summary>
 /// Create a new instance of Backtrace API
 /// </summary>
 /// <param name="credentials">API credentials</param>
 public BacktraceApi(BacktraceCredentials credentials)
 {
     _http      = new HttpClient();
     _serverurl = $"{credentials.BacktraceHostUri.AbsoluteUri}post?format=json&token={credentials.Token}";
 }
Exemplo n.º 25
0
        static void Main(string[] args)
        {
            //initialize new BacktraceClient with custom configuration section readed from file App.config
            //Client will be initialized with values stored in default section name "BacktraceCredentials"
            BacktraceClient backtraceClient = new BacktraceClient();

            var credentials = new BacktraceCredentials(@"https://myserver.sp.backtrace.io:6097", "4dca18e8769d0f5d10db0d1b665e64b3d716f76bf182fbcdad5d1d8070c12db0");
            var backtraceClientWithCredentials = new BacktraceClient(credentials);

            //Add new scoped attributes
            backtraceClient.Attributes["ClientAttributeNumber"]      = 1;
            backtraceClient.Attributes["ClientAttributeString"]      = "string attribute";
            backtraceClient.Attributes["ClientAttributeCustomClass"] = new
            {
                Name = "Backtrace",
                Type = "Library"
            };
            backtraceClient.OnServerResponse = (BacktraceServerResponse response) =>
            {
                System.Diagnostics.Trace.WriteLine(response.Object);
            };
            backtraceClient.OnServerError = (Exception e) =>
            {
                System.Diagnostics.Trace.WriteLine(e.Message);
            };
            //Add your own handler to client API
            backtraceClient.BeforeSend =
                (BacktraceData <object> model) =>
            {
                var data = model;
                data.Attributes.Add("eventAtrtibute", "EventAttributeValue");
                return(data);
            };

            //Report a new exception from current application
            try
            {
                try
                {
                    int.Parse("abc");
                }
                catch (Exception inner)
                {
                    try
                    {
                        var openLog = File.Open("Not existing path", FileMode.Open);
                    }
                    catch
                    {
                        throw new FileNotFoundException("OutterException", inner);
                    }
                }
            }
            catch (Exception e)
            {
                var report = new BacktraceReport(
                    exception: e,
                    attributes: new Dictionary <string, object>()
                {
                    { "AttributeString", "string" }
                },
                    attachmentPaths: new List <string>()
                {
                    @"path to file attachment", @"patch to another file attachment"
                }
                    );
                backtraceClient.Send(report);
            }
            //Report a new message
            backtraceClient.Send("Client message");
        }
Exemplo n.º 26
0
        static void Main(string[] args)
        {
            //setup tls support for tested server
            ServicePointManager.SecurityProtocol =
                SecurityProtocolType.Tls
                | (SecurityProtocolType)0x00000300
                | (SecurityProtocolType)0x00000C00;

            var credentials = new BacktraceCredentials(ApplicationSettings.Host, ApplicationSettings.Token);
            // create Backtrace library configuration
            var configuartion = new BacktraceClientConfiguration(credentials)
            {
                ReportPerMin = 0
            };

            //initialize new BacktraceClient with custom configuration section readed from file App.config
            //Client will be initialized with values stored in default section name "BacktraceCredentials"
            BacktraceClient backtraceClientWithSectionCredentials = new BacktraceClient();

            //create new backtrace database settings
            BacktraceDatabaseSettings databaseSettings = new BacktraceDatabaseSettings(ApplicationSettings.DatabasePath);
            //create Backtrace database
            var database = new BacktraceDatabase(databaseSettings);
            //setup new client
            var backtraceClient = new BacktraceClient(credentials, databaseSettings);

            //Add new scoped attributes
            backtraceClient.Attributes["ClientAttributeNumber"]      = 1;
            backtraceClient.Attributes["ClientAttributeString"]      = "/string attribute";
            backtraceClient.Attributes["ClientAttributeCustomClass"] = new
            {
                Name = "Backtrace",
                Type = "Library"
            };
            //Add your own handler to client API
            backtraceClient.BeforeSend =
                (BacktraceData model) =>
            {
                var data = model;
                data.Attributes.Add("eventAtrtibute", "EventAttributeValue");
                return(data);
            };

            //Report a new exception from current application
            try
            {
                try
                {
                    int.Parse("abc");
                }
                catch (Exception inner)
                {
                    try
                    {
                        var openLog = File.Open("Not existing path", FileMode.Open);
                    }
                    catch
                    {
                        throw new FileNotFoundException("OutterException", inner);
                    }
                }
            }
            catch (Exception e)
            {
                var report = new BacktraceReport(
                    exception: e,
                    attributes: new Dictionary <string, object>()
                {
                    { "AttributeString", "string" }
                },
                    attachmentPaths: new List <string>()
                {
                    @"path to file attachment", @"patch to another file attachment"
                }
                    );
                var response = backtraceClient.Send(report);
            }
            //Report a new message
            var sendResult = backtraceClient.Send("Client message");
        }