Skip to content

Commit 63f1b11

Browse files
committed
Version 2.0.5: .NET Standard Support + minidump type option in the Backtrace menu
1 parent 193a35a commit 63f1b11

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+133
-62
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
## Version 2.0.5
44

55
- Unity compatibility patch / .NET 2 + 2 Subset (https://github.com/backtrace-labs/backtrace-unity/pull/10)
6+
- Untiy .NET Standard 2.0 support,
7+
- Expose minidump type option to Backtrace Client configuration in the UI,
8+
- Changes LangVersion to Mono/Il2CPP depends on scripting backend - right now we will use Mono or IL2CPP - not Mono/IL2CPP value.
69

710
## Version 2.0.4
811

Editor/Menu/BacktraceClientConfigurationEditor.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ public class BacktraceClientConfigurationEditor : UnityEditor.Editor
1717
#if UNITY_2018_4_OR_NEWER
1818
public const string LABEL_IGNORE_SSL_VALIDATION = "Ignore SSL validation";
1919
#endif
20+
public const string LABEL_MINIDUMP_SUPPORT = "Minidump type";
2021
public const string LABEL_DEDUPLICATION_RULES = "Deduplication rules";
2122
public const string LABEL_GAME_OBJECT_DEPTH = "Game object depth limit";
2223

Editor/Menu/BacktraceConfigurationEditor.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ public class BacktraceConfigurationEditor : UnityEditor.Editor
2222

2323
public const string LABEL_DESTROY_CLIENT_ON_SCENE_LOAD = "Destroy client on new scene load (false - Backtrace managed)";
2424

25+
public const string LABEL_MINIDUMP_SUPPORT = "Minidump type";
26+
2527
public const string LABEL_PATH = "Backtrace database path";
2628
public const string LABEL_AUTO_SEND_MODE = "Auto send mode";
2729
public const string LABEL_CREATE_DATABASE_DIRECTORY = "Create database directory";
@@ -83,6 +85,12 @@ public override void OnInspectorGUI()
8385
EditorGUILayout.HelpBox("Please insert valid Backtrace database path!", MessageType.Error);
8486
}
8587

88+
#if UNITY_STANDALONE_WIN
89+
EditorGUILayout.HelpBox("Minidump support works only on Windows machines.", MessageType.Warning);
90+
SerializedProperty miniDumpType = serializedObject.FindProperty("MinidumpType");
91+
EditorGUILayout.PropertyField(miniDumpType, new GUIContent(LABEL_MINIDUMP_SUPPORT));
92+
#endif
93+
8694
SerializedProperty autoSendMode = serializedObject.FindProperty("AutoSendMode");
8795
EditorGUILayout.PropertyField(autoSendMode, new GUIContent(LABEL_AUTO_SEND_MODE));
8896

Editor/Menu/BacktraceDatabaseConfigurationEditor.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,13 @@ public override void OnInspectorGUI()
3131
{
3232
EditorGUILayout.HelpBox("Please insert valid Backtrace database path!", MessageType.Error);
3333
}
34+
35+
#if UNITY_STANDALONE_WIN
36+
settings.MinidumpType = (MiniDumpType)EditorGUILayout.EnumPopup(LABEL_MINIDUMP_SUPPORT, settings.MinidumpType);
37+
#else
38+
settings.MinidumpType = MiniDumpType.None;
39+
40+
#endif
3441
settings.AutoSendMode = EditorGUILayout.Toggle(LABEL_AUTO_SEND_MODE, settings.AutoSendMode);
3542
settings.CreateDatabase = EditorGUILayout.Toggle(LABEL_CREATE_DATABASE_DIRECTORY, settings.CreateDatabase);
3643
settings.MaxRecordCount = EditorGUILayout.IntField(LABEL_MAX_REPORT_COUNT, settings.MaxRecordCount);

src/BacktraceClient.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ namespace Backtrace.Unity
1717
public class BacktraceClient : MonoBehaviour, IBacktraceClient
1818
{
1919
public BacktraceConfiguration Configuration;
20+
2021
public bool Enabled { get; private set; }
2122

2223
/// <summary>
@@ -193,6 +194,13 @@ public void Refresh()
193194
}
194195

195196
Enabled = true;
197+
#if UNITY_STANDALONE_WIN
198+
MiniDumpType = Configuration.MinidumpType;
199+
#else
200+
MiniDumpType = MiniDumpType.None;
201+
202+
#endif
203+
196204
Annotations.GameObjectDepth = Configuration.GameObjectDepth;
197205
HandleUnhandledExceptions();
198206
_reportLimitWatcher = new ReportLimitWatcher(Convert.ToUInt32(Configuration.ReportPerMin));

src/Common/MiniDumpExceptionInformation.cs

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,18 @@ namespace Backtrace.Unity.Common
1717
[StructLayout(LayoutKind.Sequential, Pack = 4)]
1818
internal struct MiniDumpExceptionInformation
1919
{
20+
21+
//====================================================================
22+
// Win32 Exception stuff
23+
// These are mostly interesting for Structured exception handling,
24+
// but need to be exposed for all exceptions (not just SEHException).
25+
//====================================================================
26+
//[System.Security.SecurityCritical] // auto-generated_required
27+
//[System.Runtime.Versioning.ResourceExposure(System.Runtime.Versioning.ResourceScope.None)]
28+
//[System.Runtime.CompilerServices.MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)]
29+
//[System.Runtime.InteropServices.ComVisible(true)]
30+
//public static extern /* struct _EXCEPTION_POINTERS* */ IntPtr GetExceptionPointers();
31+
2032
/// <summary>
2133
/// current thread id
2234
/// </summary>
@@ -44,6 +56,27 @@ internal static MiniDumpExceptionInformation GetInstance(MinidumpException excep
4456
exp.ThreadId = SystemHelper.GetCurrentThreadId();
4557
exp.ClientPointers = false;
4658
exp.ExceptionPointers = IntPtr.Zero;
59+
// right now Unity environment doesn't support
60+
// GetExceptionPointers
61+
// because of that we cannot pass exception pointer to minidump write method
62+
63+
//right now GetExceptionPointers method is not available in .NET Standard
64+
//#if !NET_STANDARD_2_0
65+
// try
66+
// {
67+
// if (exceptionInfo == MinidumpException.Present)
68+
// {
69+
// exp.ExceptionPointers = GetExceptionPointers();
70+
// }
71+
// }
72+
// catch (Exception e)
73+
// {
74+
//#if DEBUG
75+
// UnityEngine.Debug.Log(string.Format("Cannot add exception information to minidump file. Reason: {0}", e));
76+
//#endif
77+
// ///Operation not supported;
78+
// }
79+
//#endif
4780
return exp;
4881
}
4982
}

src/JsonNet/Bson/BsonBinaryWriter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public void Flush()
5656

5757
public void Close()
5858
{
59-
#if !(DOTNET || PORTABLE40 || PORTABLE)
59+
#if !(DOTNET || PORTABLE40 || PORTABLE || NET_STANDARD_2_0)
6060
_writer.Close();
6161
#else
6262
_writer.Dispose();

src/JsonNet/Bson/BsonReader.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ public override void Close()
233233

234234
if (CloseInput && _reader != null)
235235
{
236-
#if !(DOTNET || PORTABLE40 || PORTABLE)
236+
#if !(DOTNET || PORTABLE40 || PORTABLE || NET_STANDARD_2_0)
237237
_reader.Close();
238238
#else
239239
_reader.Dispose();

src/JsonNet/Bson/BsonWriter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ public override void WriteValue(char value)
375375
{
376376
base.WriteValue(value);
377377
string s = null;
378-
#if !(DOTNET || PORTABLE40 || PORTABLE)
378+
#if !(DOTNET || PORTABLE40 || PORTABLE || NET_STANDARD_2_0)
379379
s = value.ToString(CultureInfo.InvariantCulture);
380380
#else
381381
s = value.ToString();

src/JsonNet/Converters/BinaryConverter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
// OTHER DEALINGS IN THE SOFTWARE.
2424
#endregion
2525

26-
#if !(DOTNET || PORTABLE40 || PORTABLE)
26+
#if !(DOTNET || PORTABLE40 || PORTABLE || NET_STANDARD_2_0)
2727
using System;
2828
using System.Globalization;
2929
using Backtrace.Newtonsoft.Utilities;

0 commit comments

Comments
 (0)