Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom Diagnostic Data is not captured in case of ANR or when crash has occured. #336

Open
Aksh627 opened this issue Jul 14, 2021 · 3 comments
Labels
backlog We hope to fix this feature/bug in the future feature request Request for a new feature

Comments

@Aksh627
Copy link

Aksh627 commented Jul 14, 2021

Describe the bug

I am not able to see the additional data(Custom Diagnostic Data) with a bugsnag report if an ANR is recorded or a crash is recorded. For normal exceptions of type "NullReference" or "ArgumentOutOfRange" exceptions i am able to see the custom diagnostic data.

Steps to reproduce

  1. Integrate bugsnag v5.1.1 in unity project
  2. Now add some custom diagnostic data on some actions to be seen with a bugsnag ANR/crash report
  3. After doing some actions (basically recording some custom diagnostic data) just force a crash or ANR. (For this bugnsag sample unity project on github already has the script to throw ANR/Crash)
  4. Now go to bugsnag dashboard and observer the ANR/Crash data.
  5. There is no custom diagnostic data attached.
  6. Now open the application again and do some actoins (to record custom diagnostic data)
  7. After that just trigger an exception
  8. Now go to bugsnag dashboard and observe that the custom data is recorded.
  9. So it is getting recorded for an exception but not for a crash or ANR.

Environment

  • Bugsnag version: 5.1.1 (unity)
  • Unity version: 2019.4.15f1
  • Android version: 8.1.0, 9, 11
  • simulator/emulator or physical device: Galaxy A11, Lenovo Tab E10
  • Initializing bugsnag via a Unity GameObject or in code?: via Unity GameObject
  • Player Settings:
    • Scripting backend (Mono or IL2CPP): IL2CPP
    • API compatibility level for .NET: .Net Standard 2.0
    • Stack Trace level for all error types (None/ScriptOnly/Full): Script Only
@abigailbramble
Copy link

Hi @Aksh627 - Thanks for raising this. Unfortunately at this time the Bugsnag Unity callback is only applied to handled crashes and Unity managed crashes i.e. crashes which are sent to Bugsnag during the current application session. For any crashes which terminate the application, and are sent on next launch of the application, the Bugsnag Unity callback is not called.
We are working on a major uplift of our Unity notifier where we are looking to improve this functionality. Do let us know if you have further questions in the meantime.

You can always look into applying metadata globally with Bugsnag.Metadata.Add. This metadata will be applied to all types of crashes. https://docs.bugsnag.com/platforms/unity/#attaching-custom-diagnostics

@abigailbramble abigailbramble added backlog We hope to fix this feature/bug in the future feature request Request for a new feature labels Jul 19, 2021
@Aksh627
Copy link
Author

Aksh627 commented Jul 22, 2021

hi @phillipsam - Thanks for your response, I am actually applying metadata gloabally only with Bugsnag.Metadata.Add. When any ANR or crash occurs i am not able to see the data attached with Bugsnag.Metadata. I am attaching below the code snippet which i use to apply metadata. This method is called by performing some different set of user actions in the application.

private static void AddBugsnagMetaData(string key, string value)
    {
        string mainKey = "";
        string metaDataValue = "";
        Dictionary<string, string> dataCollection = new Dictionary<string, string>();   
        mainKey = "some method name"; 
        metaDataValue = key + " : " + value;        
        string metadataKey = "";
        int currentIndex = dataCollection.Count;
        currentIndex++;
        metadataKey = currentIndex.ToString();
        dataCollection.Add(metadataKey,metaDataValue);
        Bugsnag.Metadata[mainKey] = dataCollection;
    }

@abigailbramble
Copy link

Hi @Aksh627 - thanks for the additional information. If you call Bugsnag.Metadata.Add(mainKey, dataCollection); instead of Bugsnag.Metadata[mainKey] = dataCollection;, this will work for you as expected and add the metadata to your ANRs. Using the Add method will add the metadata to the native client.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backlog We hope to fix this feature/bug in the future feature request Request for a new feature
Projects
None yet
Development

No branches or pull requests

2 participants