#Fatal errors don't upload custom attachments

26 messages · Page 1 of 1 (latest)

dark nest
#

Hey! I'm trying to upload the full player log whenever my game crashes (Unity SDK)

    SentrySdk.ConfigureScope(scope =>
    {
        string logFilePath = Path.Combine(
            #if UNITY_EDITOR
            Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "/Unity/Editor/Editor.log"
            #else
            Application.persistentDataPath + "/../Player.log"
            #endif
        );

        if (File.Exists(logFilePath)) {
            scope.AddAttachment(logFilePath);
        }
    });

I have this running on start, and I can see the log being attached if the error isn't fatal, but if it is, all I get is a ApplicationNotRespondingException with no log attached.

Is there a better way to do this, or am I missing something?
Let me know, thanks!

void garnet
#

crash capture doesnt seem to work at all with sentry.

#

they don't have an official sample for crash reporting either

#

or maybe it used to work, but not with 6000+

silent willow
#

Hey @dark nest, the SDK is currently limited in how it can sync things on the scope between layers. Attachments being one of those things, where the SDK would need to know before getting initialized, where those attachments would be.
Buuut: With the recent changes and the release from two days ago that technical limitation is gone. So after pulling that update we're going to need to extend the scope sync and this will work! I'm tracking this here

silent willow
dark nest
# silent willow Hey <@285164645776621568>, the SDK is currently limited in how it can sync thing...

hey! thanks for the reply, i updated the sentry to the new version but my setup still doesn't work, heres the script im using, in a new unity project, just assigning CrashWait() to a ui button has the crash registered in sentry, but it doesn't attach the log, using the test error function (also assigned to a button) does attach the log though, so only the crash doesn't get the log attached

sudden jewel
#

is it crashing through a stack overflow? I'm not sure those exceptions can be caught, right? try calling SentrySdk.CauseCrash and use one of the native ones (C# exceptions won't crash in Unity as I'm sure u know). Also, what platform are you testing? I don't think we sync down attachments from C# to native SDKs, and sentry-native only got support for attachments (after init) on the latest release shipped this week, so we'd tillneed to add support

dark nest
dark nest
#

is cause crash obselete, do you guys have a different way of testing crashes?

#

actually looks like Utils.ForceCrash seems to work okay

#

logs are attaching too!

#

is there a way to make it so that logs are only attached when the error is fatal?

#

trying this, scope.Level is returning null

#

might not be understanding how this is working fully though

silent willow
#

I think we're misaligning here in terms of expectations:

  • Crashes in C# (i.e. SentrySdk.CauseCrash(CrashType.Managed) have the log attached since it's the C# layer that is sending the report.
  • Crashes outside of C# (i.e. actual C/C++/native crashes) are missing those attachments since they are not yet getting synched to the supporting native SDKs. For this to work we'll need to update the SDK. See feature request here
dark nest
dark nest
dark nest
silent willow
#

The Unity SDK is like a swiss army knive and brings multiple other SDKs depending on what platform you run on. We've got some docs on how this works here
We've got updating the SDK to share attachments across these pretty high on the Todo to be added. It should not take us too long for this to work

willow sonnet
sudden jewel
# willow sonnet hey im trying to achieve a similar thing to tsitski with Unreal Engine but seems...

the latest sdk version is 1.0.0-beta.4, were passed the experimental 0.x train aiming for 1.0.0 release soon: https://github.com/getsentry/sentry-unreal/releases/tag/1.0.0-beta.4

GitHub

Breaking Changes

"Value" suffix has been removed from the get/set function names for tags and extras in SentryScope.
Type of input parameters in certain public API functions was changed ...