Skip to content

Commit 20bd759

Browse files
committed
Version 2.1.3
1 parent ee034ba commit 20bd759

15 files changed

+73
-207
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# Backtrace Unity Release Notes
22

3+
## Version 2.1.3
4+
5+
- `BacktraceUnhandledException` will generate environment stack trace if Unity stack trace is empty. BacktraceReport will still generate normalized fingerprint for unhandled exception without stack trace.
6+
- `BacktraceUnhandledException` will provide information from Unity Error logger in source code property, which should improve error analysis in web debugger.
7+
- `BacktraceAttributes` won't try to collect `Annotations` anymore.
8+
- `Annotations` won't use ComplexAttributes property anymore.
9+
310
## Version 2.1.2
411

512
- `BacktraceReport` will generate report fingerprint for exceptions without stack trace.

Runtime/Model/BacktraceData.cs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,12 @@ public static BacktraceData Deserialize(string json)
174174
/// </summary>
175175
private void SetThreadInformations()
176176
{
177-
ThreadData = new ThreadData(Report.DiagnosticStack);
177+
var faultingThread =
178+
Report.Exception is BacktraceUnhandledException
179+
&& string.IsNullOrEmpty(Report.Exception.StackTrace)
180+
? false
181+
: true;
182+
ThreadData = new ThreadData(Report.DiagnosticStack, faultingThread);
178183
ThreadInformations = ThreadData.ThreadInformations;
179184
MainThread = ThreadData.MainThread;
180185
if (Report.Exception is BacktraceUnhandledException)
@@ -190,7 +195,7 @@ private void SetThreadInformations()
190195
private void SetAttributes(Dictionary<string, object> clientAttributes)
191196
{
192197
Attributes = new BacktraceAttributes(Report, clientAttributes);
193-
Annotation = new Annotations(Attributes.ComplexAttributes);
198+
Annotation = new Annotations();
194199
}
195200

196201
/// <summary>
@@ -206,7 +211,7 @@ private void SetReportInformation()
206211
LangVersion = "Mono";
207212
#endif
208213

209-
AgentVersion = "2.1.2";
214+
AgentVersion = "2.1.3";
210215
Classifier = Report.ExceptionTypeReport ? new[] { Report.Classifier } : null;
211216
}
212217
}

Runtime/Model/BacktraceUnhandledException.cs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,17 @@ public override string StackTrace
4343

4444
public BacktraceUnhandledException(string message, string stacktrace) : base(message)
4545
{
46-
_stacktrace = stacktrace;
4746
_message = message;
48-
ConvertStackFrames();
47+
if (!string.IsNullOrEmpty(stacktrace))
48+
{
49+
_stacktrace = stacktrace;
50+
ConvertStackFrames();
51+
} else
52+
{
53+
_stacktrace = string.Empty;
54+
var backtraceStackTrace = new BacktraceStackTrace(null);
55+
StackFrames = backtraceStackTrace.StackFrames;
56+
}
4957
CreateUnhandledExceptionLogInformation();
5058
}
5159

@@ -56,7 +64,7 @@ private void CreateUnhandledExceptionLogInformation()
5664
{
5765
SourceCode = new BacktraceSourceCode()
5866
{
59-
Text = string.Format("Unity Exception:\n{0}\n{1}", _message, _stacktrace)
67+
Text = string.Format("Unity exception information\nMessage :{0}\nStack trace :{1}", _message, _stacktrace)
6068
};
6169
// assign log information to first stack frame
6270
if (StackFrames.Count == 0)

Runtime/Model/JsonData/Annotations.cs

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
using Backtrace.Newtonsoft;
22
using Backtrace.Newtonsoft.Linq;
3-
using System;
43
using System.Collections.Generic;
54
using UnityEngine;
65
using UnityEngine.SceneManagement;
@@ -45,22 +44,12 @@ public Dictionary<string, string> EnvironmentVariables
4544
}
4645

4746

48-
/// <summary>
49-
/// Get built-in complex attributes
50-
/// </summary>
51-
public Dictionary<string, object> ComplexAttributes = new Dictionary<string, object>();
52-
53-
public Annotations()
54-
{
55-
}
5647
/// <summary>
5748
/// Create new instance of Annotations class
5849
/// </summary>
59-
/// <param name="complexAttributes">Built-in complex attributes</param>
60-
public Annotations(Dictionary<string, object> complexAttributes)
50+
public Annotations()
6151
{
6252
var environment = new EnvironmentVariables();
63-
ComplexAttributes = complexAttributes;
6453
_environmentVariables = environment.Variables;
6554
}
6655

@@ -84,12 +73,6 @@ public BacktraceJObject ToJson()
8473
}
8574
annotations[ENVIRONMENT_VARIABLE_KEY] = envVariables;
8675

87-
foreach (var annotation in ComplexAttributes)
88-
{
89-
annotations[annotation.Key] = BacktraceJObject.FromObject(annotation.Value);
90-
}
91-
92-
9376
if (GameObjectDepth > -1)
9477
{
9578
var activeScene = SceneManager.GetActiveScene();

Runtime/Model/JsonData/BacktraceAttributes.cs

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,6 @@ public class BacktraceAttributes
2222

2323
internal const string APPLICATION_ATTRIBUTE_NAME = "application";
2424

25-
/// <summary>
26-
/// Get built-in complex attributes
27-
/// </summary>
28-
public Dictionary<string, object> ComplexAttributes = new Dictionary<string, object>();
29-
3025
/// <summary>
3126
/// Create instance of Backtrace Attribute
3227
/// </summary>
@@ -168,20 +163,6 @@ private void ConvertAttributes(BacktraceReport report, Dictionary<string, object
168163
{
169164
Attributes.Add(attribute.Key, attribute.Value);
170165
}
171-
else
172-
{
173-
ComplexAttributes.Add(attribute.Key, attribute.Value);
174-
}
175-
}
176-
//add exception information to Complex attributes.
177-
if (report.ExceptionTypeReport)
178-
{
179-
ComplexAttributes.Add("Exception Properties", new
180-
{
181-
Type = report.Classifier,
182-
report.Message,
183-
StackTrace = report.ExceptionTypeReport ? report.Exception.StackTrace : string.Empty
184-
});
185166
}
186167
}
187168

Runtime/Model/JsonData/SourceCodeData.cs

Lines changed: 0 additions & 89 deletions
This file was deleted.

Runtime/Model/JsonData/SourceCodeData.cs.meta

Lines changed: 0 additions & 11 deletions
This file was deleted.

Runtime/Model/JsonData/ThreadData.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,14 @@ public class ThreadData
2424
/// <summary>
2525
/// Create instance of ThreadData class to collect information about used threads
2626
/// </summary>
27-
internal ThreadData(IEnumerable<BacktraceStackFrame> exceptionStack)
27+
internal ThreadData(IEnumerable<BacktraceStackFrame> exceptionStack, bool faultingThread)
2828
{
2929

3030
var current = Thread.CurrentThread;
3131
//get current thread id
3232
string generatedMainThreadId = current.GenerateValidThreadName().ToLower();
3333

34-
ThreadInformations[generatedMainThreadId] = new ThreadInformation(current, exceptionStack, true);
34+
ThreadInformations[generatedMainThreadId] = new ThreadInformation(current, exceptionStack, faultingThread);
3535
//set currentThreadId
3636
MainThread = generatedMainThreadId;
3737
}

Runtime/Model/JsonData/ThreadInformation.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,11 @@ public ThreadInformation(string threadName, bool fault, IEnumerable<BacktraceSta
6161
/// </summary>
6262
/// <param name="thread">Thread to analyse</param>
6363
/// <param name="stack">Exception stack information</param>
64-
/// <param name="currentThread">Is current thread flag</param>
65-
public ThreadInformation(Thread thread, IEnumerable<BacktraceStackFrame> stack, bool currentThread = false)
64+
/// <param name="faultingThread">Faulting thread flag</param>
65+
public ThreadInformation(Thread thread, IEnumerable<BacktraceStackFrame> stack, bool faultingThread = false)
6666
: this(
6767
threadName: thread.GenerateValidThreadName().ToLower(),
68-
fault: currentThread, //faulting thread = current thread
68+
fault: faultingThread,
6969
stack: stack)
7070
{ }
7171

Runtime/Properties.meta

Lines changed: 0 additions & 8 deletions
This file was deleted.

0 commit comments

Comments
 (0)