Git Product home page Git Product logo

backtrace-csharp's People

Contributors

arthur2 avatar konraddysput avatar sbahra avatar

Stargazers

 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

backtrace-csharp's Issues

Adding a null attribute will result in no crash reports

Specifically, if I add a null attribute, then try to save a report to the database, it fails.

Example Code:

string attrib;
_client.Attributes["attrib"] = attrib;
_client.Database?.Add( report, _client.Attributes, _client.MiniDumpType );

This can happen when assigning strings to attributes which could be null.

Workaround is to check before assigning a attribute

string attrib;
if ( !String.IsNullOrEmpty(attrib) )
{
_client.Attributes["attrib"] = attrib;
}

Crash if EXE is not a .NET EXE

Our EXE is a native EXE that ends up calling into .NET through interop.

In this situation we have found the following code that crashes with a index out of range exception and then we end up losing the crash report.

In BacktraceAttributes.cs

        private void SetDebuggerAttributes(Assembly callingAssembly)
        {
            object[] attribs = callingAssembly.GetCustomAttributes(typeof(DebuggableAttribute), false);
   ...
            if (attribs[0] is DebuggableAttribute debuggableAttribute)   <------ this will throw a index out of range exception

The exception is thrown because a native EXE won't have the custom attributes on it

I would recommend changing the code in the if statement to something like the following

            if ( attribs != null && attribs.Length > 0 &&
                 attribs[0] is DebuggableAttribute debuggableAttribute )

Crashes appear to be lost while offline

We recently added the backtrace-csharp SDK to a product and noticed the following behavior while offline.

While offline if a crash occurs, it is taken correctly, it is added to the cache directory.

While still offline when restarting the application, the crash is deleted.

Is this behavior expected/by design? We would have expected the crash to continue to be saved while offline.

Crash when reporting errors from apps published with PublishSingleFile=true

Relevant callstack:

Unhandled exception. System.ArgumentException: The path is empty. (Parameter 'path')
   at System.IO.Path.GetFullPath(String path)
   at System.Diagnostics.FileVersionInfo.GetVersionInfo(String fileName)
   at Backtrace.Model.JsonData.BacktraceAttributes.SetLibraryAttributes(BacktraceReport report)
   at Backtrace.Model.JsonData.BacktraceAttributes..ctor(BacktraceReport report, Dictionary`2 clientAttributes)
   at Backtrace.Model.BacktraceData.SetAttributes(Dictionary`2 clientAttributes)
   at Backtrace.Model.BacktraceData..ctor(BacktraceReport report, Dictionary`2 clientAttributes)
   at Backtrace.Base.BacktraceBase.Send(BacktraceReport report)
   at Backtrace.BacktraceClient.Send(BacktraceReport backtraceReport)
   at Backtrace.BacktraceClient.Send(Exception exception, Dictionary`2 attributes, List`1 attachmentPaths)

The long and short of it is that BacktraceAttributes.SetLibraryAttributes is trying to get the calling assembly's location via Assembly.Location as a reporting attribute, along with passing it to FileVersionInfo.GetVersionInfo to get the version information here.

Assembly.Location always returns the empty string when PublishSingleFile is enabled.

To repro the issue:

  1. Add backtrace to an example project and create a BtClient
  2. call BtClient.Error(new Exception("test")); in Main
  3. dotnet publish /p:PublishSingleFile=true --self-contained true -r win-x64
  4. Run the resulting exe

Bad Cast?

return await SendAsync(Guid.NewGuid(), json, data.Attachments, data.Report as BacktraceReport);

This seems like a bad cast - Any other types derived from BacktraceReportBase will end up nulled out here. Is it intentional that only the BacktraceReport subclass be allowed? If so, the Report/ReportBase seems needlessly complex and confusing.

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.