Skip to content

Commit dd20a67

Browse files
committed
Package.json + removed file writer
1 parent a91d846 commit dd20a67

File tree

3 files changed

+43
-39
lines changed

3 files changed

+43
-39
lines changed

package.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"name": "Backtrace-unity",
3+
"displayName": "Backtrace-Unity",
4+
"version": "1.0.0",
5+
"unity" : "2017.1",
6+
"description": "Backtrace's integration with Unity games allows customers to capture and report handled and unhandled Unity exceptions to their Backtrace instance, instantly offering the ability to prioritize and debug software errors.",
7+
"keywords": ["Backtrace", "Error", "Diagnostic", "Tools", "Debug" ,"Bug" ,"Bugs" ,"StackTrace"],
8+
"category": "Editor plugin + Script plugin"
9+
}

package.json.meta

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Model/BacktraceUnhandledException.cs

Lines changed: 27 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
using System;
22
using System.Collections.Generic;
33
using System.Diagnostics;
4-
using System.IO;
54

65
namespace Backtrace.Unity.Model
76
{
@@ -45,47 +44,36 @@ private void ConvertStackFrames()
4544
var frames = _stacktrace.Trim().Split('\n');
4645
foreach (var frameString in frames)
4746
{
48-
using (var outputFile = new StreamWriter(Path.Combine(@"C:\Users\konra\source\BacktraceLogs\", $"errors-unhandled-stacktrace.txt"), true))
47+
int methodNameEndIndex = frameString.IndexOf(')');
48+
//methodname index should be greater than 0 AND '(' should be before ')'
49+
if (methodNameEndIndex < 1 && frameString[methodNameEndIndex - 1] != '(')
4950
{
50-
try
51-
{
52-
outputFile.WriteLine("STACK FRAME : " + frameString.ToString());
53-
int methodNameEndIndex = frameString.IndexOf(')');
54-
//methodname index should be greater than 0 AND '(' should be before ')'
55-
if (methodNameEndIndex < 1 && frameString[methodNameEndIndex - 1] != '(')
56-
{
57-
//invalid stack frame
58-
return;
59-
}
60-
string routingPaths = frameString.Substring(0, methodNameEndIndex - 1);
61-
var routingParams = routingPaths.Trim().Split('.');
62-
string methodPath = string.Empty;
63-
int fileLine = 0;
51+
//invalid stack frame
52+
return;
53+
}
54+
string routingPaths = frameString.Substring(0, methodNameEndIndex - 1);
55+
var routingParams = routingPaths.Trim().Split('.');
56+
string methodPath = string.Empty;
57+
int fileLine = 0;
6458

65-
int sourceInformationStartIndex = frameString.IndexOf('(', methodNameEndIndex + 1);
66-
if (sourceInformationStartIndex > -1)
67-
{
68-
// -1 because we don't want additional ')' in the end of the string
69-
int sourceStringLength = frameString.Length - sourceInformationStartIndex - 1;
70-
string sourceString =
71-
frameString.Substring(sourceInformationStartIndex, sourceStringLength);
72-
var sourceInfo = sourceString.Split(':');
73-
methodPath = sourceInfo[0].Substring(sourceInfo[0].IndexOf(' '));
74-
int.TryParse(sourceInfo[1], out fileLine);
75-
}
76-
StackFrames.Add(new BacktraceStackFrame()
77-
{
78-
FunctionName = routingParams[1],
79-
Library = routingParams[0],
80-
Line = fileLine,
81-
SourceCode = methodPath
82-
});
83-
}
84-
catch(Exception e)
85-
{
86-
outputFile.WriteLine(e.ToString());
87-
}
59+
int sourceInformationStartIndex = frameString.IndexOf('(', methodNameEndIndex + 1);
60+
if (sourceInformationStartIndex > -1)
61+
{
62+
// -1 because we don't want additional ')' in the end of the string
63+
int sourceStringLength = frameString.Length - sourceInformationStartIndex - 1;
64+
string sourceString =
65+
frameString.Substring(sourceInformationStartIndex, sourceStringLength);
66+
var sourceInfo = sourceString.Split(':');
67+
methodPath = sourceInfo[0].Substring(sourceInfo[0].IndexOf(' '));
68+
int.TryParse(sourceInfo[1], out fileLine);
8869
}
70+
StackFrames.Add(new BacktraceStackFrame()
71+
{
72+
FunctionName = routingParams[1],
73+
Library = routingParams[0],
74+
Line = fileLine,
75+
SourceCode = methodPath
76+
});
8977

9078
}
9179
}

0 commit comments

Comments
 (0)