@@ -53,8 +53,8 @@ public NativeClient(BacktraceConfiguration configuration, BacktraceBreadcrumbs b
5353 {
5454 return ;
5555 }
56+ HandleNativeCrashes ( attachments ) ;
5657 AddScopedAttributes ( clientAttributes ) ;
57- HandleNativeCrashes ( clientAttributes , attachments ) ;
5858 }
5959
6060 public void GetAttributes ( IDictionary < string , string > attributes )
@@ -86,18 +86,18 @@ public void SetAttribute(string key, string value)
8686
8787 private void AddScopedAttributes ( IDictionary < string , string > attributes )
8888 {
89- foreach ( var attribute in attributes )
89+ if ( ! CaptureNativeCrashes )
9090 {
91- if ( string . IsNullOrEmpty ( attribute . Key ) || attribute . Value == null )
92- {
93- continue ;
94- }
91+ return ;
92+ }
9593
96- BacktraceAddAttribute ( attribute . Key , attribute . Value ) ;
94+ foreach ( var attribute in attributes )
95+ {
96+ SetAttribute ( attribute . Key , attribute . Value ) ;
9797 }
9898 }
9999
100- private void HandleNativeCrashes ( IDictionary < string , string > clientAttributes , IEnumerable < string > attachments )
100+ private void HandleNativeCrashes ( IEnumerable < string > attachments )
101101 {
102102 var integrationDisabled = ! _configuration . CaptureNativeCrashes || ! _configuration . Enabled ;
103103 if ( integrationDisabled )
@@ -108,19 +108,25 @@ private void HandleNativeCrashes(IDictionary<string, string> clientAttributes, I
108108 var minidumpUrl = new BacktraceCredentials ( _configuration . GetValidServerUrl ( ) ) . GetMinidumpSubmissionUrl ( ) . ToString ( ) ;
109109 var dumpPath = _configuration . GetFullDatabasePath ( ) ;
110110
111- foreach ( var attachment in attachments )
111+ if ( string . IsNullOrEmpty ( dumpPath ) || ! Directory . Exists ( dumpPath ) )
112112 {
113- var name = Path . GetFileName ( attachment ) ;
114- BacktraceAddFile ( name , attachment ) ;
113+ Debug . LogWarning ( "Backtrace native integration status: database path doesn't exist" ) ;
114+ return ;
115115 }
116-
117116 CaptureNativeCrashes = BacktraceNativeXboxInit ( minidumpUrl , dumpPath ) ;
118117
119118 if ( ! CaptureNativeCrashes )
120119 {
121120 Debug . LogWarning ( "Backtrace native integration status: Cannot initialize the Native Crash Reporting client" ) ;
122121 return ;
123122 }
123+
124+ BacktraceAddAttribute ( ErrorTypeAttribute , CrashType ) ;
125+
126+ foreach ( var attachment in attachments )
127+ {
128+ BacktraceAddFile ( Path . GetFileName ( attachment ) , attachment ) ;
129+ }
124130 }
125131 }
126132}
0 commit comments