diff --git a/CHANGELOG.md b/CHANGELOG.md index b02bc6f9..196216f3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,9 @@ ## Version 2.0.5 - Unity compatibility patch / .NET 2 + 2 Subset (https://github.com/backtrace-labs/backtrace-unity/pull/10) +- Untiy .NET Standard 2.0 support, +- Expose minidump type option to Backtrace Client configuration in the UI, +- Changes LangVersion to Mono/Il2CPP depends on scripting backend - right now we will use Mono or IL2CPP - not Mono/IL2CPP value. ## Version 2.0.4 diff --git a/Editor/Menu/BacktraceClientConfigurationEditor.cs b/Editor/Menu/BacktraceClientConfigurationEditor.cs index c94db7be..a28a9bf4 100644 --- a/Editor/Menu/BacktraceClientConfigurationEditor.cs +++ b/Editor/Menu/BacktraceClientConfigurationEditor.cs @@ -17,6 +17,7 @@ public class BacktraceClientConfigurationEditor : UnityEditor.Editor #if UNITY_2018_4_OR_NEWER public const string LABEL_IGNORE_SSL_VALIDATION = "Ignore SSL validation"; #endif + public const string LABEL_MINIDUMP_SUPPORT = "Minidump type"; public const string LABEL_DEDUPLICATION_RULES = "Deduplication rules"; public const string LABEL_GAME_OBJECT_DEPTH = "Game object depth limit"; diff --git a/Editor/Menu/BacktraceConfigurationEditor.cs b/Editor/Menu/BacktraceConfigurationEditor.cs index 522a1ee3..223fb2e2 100644 --- a/Editor/Menu/BacktraceConfigurationEditor.cs +++ b/Editor/Menu/BacktraceConfigurationEditor.cs @@ -22,6 +22,8 @@ public class BacktraceConfigurationEditor : UnityEditor.Editor public const string LABEL_DESTROY_CLIENT_ON_SCENE_LOAD = "Destroy client on new scene load (false - Backtrace managed)"; + public const string LABEL_MINIDUMP_SUPPORT = "Minidump type"; + public const string LABEL_PATH = "Backtrace database path"; public const string LABEL_AUTO_SEND_MODE = "Auto send mode"; public const string LABEL_CREATE_DATABASE_DIRECTORY = "Create database directory"; @@ -83,6 +85,12 @@ public override void OnInspectorGUI() EditorGUILayout.HelpBox("Please insert valid Backtrace database path!", MessageType.Error); } +#if UNITY_STANDALONE_WIN + EditorGUILayout.HelpBox("Minidump support works only on Windows machines.", MessageType.Warning); + SerializedProperty miniDumpType = serializedObject.FindProperty("MinidumpType"); + EditorGUILayout.PropertyField(miniDumpType, new GUIContent(LABEL_MINIDUMP_SUPPORT)); +#endif + SerializedProperty autoSendMode = serializedObject.FindProperty("AutoSendMode"); EditorGUILayout.PropertyField(autoSendMode, new GUIContent(LABEL_AUTO_SEND_MODE)); diff --git a/Editor/Menu/BacktraceDatabaseConfigurationEditor.cs b/Editor/Menu/BacktraceDatabaseConfigurationEditor.cs index 08f7d45d..91c04133 100644 --- a/Editor/Menu/BacktraceDatabaseConfigurationEditor.cs +++ b/Editor/Menu/BacktraceDatabaseConfigurationEditor.cs @@ -31,6 +31,13 @@ public override void OnInspectorGUI() { EditorGUILayout.HelpBox("Please insert valid Backtrace database path!", MessageType.Error); } + +#if UNITY_STANDALONE_WIN + settings.MinidumpType = (MiniDumpType)EditorGUILayout.EnumPopup(LABEL_MINIDUMP_SUPPORT, settings.MinidumpType); +#else + settings.MinidumpType = MiniDumpType.None; + +#endif settings.AutoSendMode = EditorGUILayout.Toggle(LABEL_AUTO_SEND_MODE, settings.AutoSendMode); settings.CreateDatabase = EditorGUILayout.Toggle(LABEL_CREATE_DATABASE_DIRECTORY, settings.CreateDatabase); settings.MaxRecordCount = EditorGUILayout.IntField(LABEL_MAX_REPORT_COUNT, settings.MaxRecordCount); diff --git a/src/BacktraceClient.cs b/src/BacktraceClient.cs index 35040292..d8363697 100644 --- a/src/BacktraceClient.cs +++ b/src/BacktraceClient.cs @@ -17,6 +17,7 @@ namespace Backtrace.Unity public class BacktraceClient : MonoBehaviour, IBacktraceClient { public BacktraceConfiguration Configuration; + public bool Enabled { get; private set; } /// @@ -193,6 +194,13 @@ public void Refresh() } Enabled = true; +#if UNITY_STANDALONE_WIN + MiniDumpType = Configuration.MinidumpType; +#else + MiniDumpType = MiniDumpType.None; + +#endif + Annotations.GameObjectDepth = Configuration.GameObjectDepth; HandleUnhandledExceptions(); _reportLimitWatcher = new ReportLimitWatcher(Convert.ToUInt32(Configuration.ReportPerMin)); diff --git a/src/Common/MiniDumpExceptionInformation.cs b/src/Common/MiniDumpExceptionInformation.cs index 748a08e7..aba13611 100644 --- a/src/Common/MiniDumpExceptionInformation.cs +++ b/src/Common/MiniDumpExceptionInformation.cs @@ -17,6 +17,18 @@ namespace Backtrace.Unity.Common [StructLayout(LayoutKind.Sequential, Pack = 4)] internal struct MiniDumpExceptionInformation { + + //==================================================================== + // Win32 Exception stuff + // These are mostly interesting for Structured exception handling, + // but need to be exposed for all exceptions (not just SEHException). + //==================================================================== + //[System.Security.SecurityCritical] // auto-generated_required + //[System.Runtime.Versioning.ResourceExposure(System.Runtime.Versioning.ResourceScope.None)] + //[System.Runtime.CompilerServices.MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)] + //[System.Runtime.InteropServices.ComVisible(true)] + //public static extern /* struct _EXCEPTION_POINTERS* */ IntPtr GetExceptionPointers(); + /// /// current thread id /// @@ -44,6 +56,27 @@ internal static MiniDumpExceptionInformation GetInstance(MinidumpException excep exp.ThreadId = SystemHelper.GetCurrentThreadId(); exp.ClientPointers = false; exp.ExceptionPointers = IntPtr.Zero; + // right now Unity environment doesn't support + // GetExceptionPointers + // because of that we cannot pass exception pointer to minidump write method + + //right now GetExceptionPointers method is not available in .NET Standard +//#if !NET_STANDARD_2_0 +// try +// { +// if (exceptionInfo == MinidumpException.Present) +// { +// exp.ExceptionPointers = GetExceptionPointers(); +// } +// } +// catch (Exception e) +// { +//#if DEBUG +// UnityEngine.Debug.Log(string.Format("Cannot add exception information to minidump file. Reason: {0}", e)); +//#endif +// ///Operation not supported; +// } +//#endif return exp; } } diff --git a/src/JsonNet/Bson/BsonBinaryWriter.cs b/src/JsonNet/Bson/BsonBinaryWriter.cs index 83ab551d..617df04a 100644 --- a/src/JsonNet/Bson/BsonBinaryWriter.cs +++ b/src/JsonNet/Bson/BsonBinaryWriter.cs @@ -56,7 +56,7 @@ public void Flush() public void Close() { -#if !(DOTNET || PORTABLE40 || PORTABLE) +#if !(DOTNET || PORTABLE40 || PORTABLE || NET_STANDARD_2_0) _writer.Close(); #else _writer.Dispose(); diff --git a/src/JsonNet/Bson/BsonReader.cs b/src/JsonNet/Bson/BsonReader.cs index a1fb9b93..e0decf76 100644 --- a/src/JsonNet/Bson/BsonReader.cs +++ b/src/JsonNet/Bson/BsonReader.cs @@ -233,7 +233,7 @@ public override void Close() if (CloseInput && _reader != null) { -#if !(DOTNET || PORTABLE40 || PORTABLE) +#if !(DOTNET || PORTABLE40 || PORTABLE || NET_STANDARD_2_0) _reader.Close(); #else _reader.Dispose(); diff --git a/src/JsonNet/Bson/BsonWriter.cs b/src/JsonNet/Bson/BsonWriter.cs index e3e0a9d4..4ce3810f 100644 --- a/src/JsonNet/Bson/BsonWriter.cs +++ b/src/JsonNet/Bson/BsonWriter.cs @@ -375,7 +375,7 @@ public override void WriteValue(char value) { base.WriteValue(value); string s = null; -#if !(DOTNET || PORTABLE40 || PORTABLE) +#if !(DOTNET || PORTABLE40 || PORTABLE || NET_STANDARD_2_0) s = value.ToString(CultureInfo.InvariantCulture); #else s = value.ToString(); diff --git a/src/JsonNet/Converters/BinaryConverter.cs b/src/JsonNet/Converters/BinaryConverter.cs index a49fd733..38e25ac1 100644 --- a/src/JsonNet/Converters/BinaryConverter.cs +++ b/src/JsonNet/Converters/BinaryConverter.cs @@ -23,7 +23,7 @@ // OTHER DEALINGS IN THE SOFTWARE. #endregion -#if !(DOTNET || PORTABLE40 || PORTABLE) +#if !(DOTNET || PORTABLE40 || PORTABLE || NET_STANDARD_2_0) using System; using System.Globalization; using Backtrace.Newtonsoft.Utilities; diff --git a/src/JsonNet/JsonConvert.cs b/src/JsonNet/JsonConvert.cs index 95bc99c5..2fe3746a 100644 --- a/src/JsonNet/JsonConvert.cs +++ b/src/JsonNet/JsonConvert.cs @@ -370,7 +370,7 @@ internal static string ToString(Guid value, char quoteChar) { string text; string qc; -#if !(DOTNET || PORTABLE40 || PORTABLE) +#if !(DOTNET || PORTABLE40 || PORTABLE || NET_STANDARD_2_0) text = value.ToString("D", CultureInfo.InvariantCulture); qc = quoteChar.ToString(CultureInfo.InvariantCulture); #else diff --git a/src/JsonNet/JsonException.cs b/src/JsonNet/JsonException.cs index adea97e4..88abcdf4 100644 --- a/src/JsonNet/JsonException.cs +++ b/src/JsonNet/JsonException.cs @@ -36,7 +36,7 @@ namespace Backtrace.Newtonsoft /// /// The exception thrown when an error occurs during JSON serialization or deserialization. /// -#if !(DOTNET || PORTABLE40 || PORTABLE) +#if !(DOTNET || PORTABLE40 || PORTABLE || NET_STANDARD_2_0) [Serializable] #endif [Preserve] @@ -70,7 +70,7 @@ public JsonException(string message, Exception innerException) { } -#if !(DOTNET || PORTABLE40 || PORTABLE) +#if !(DOTNET || PORTABLE40 || PORTABLE || NET_STANDARD_2_0) /// /// Initializes a new instance of the class. /// diff --git a/src/JsonNet/JsonReaderException.cs b/src/JsonNet/JsonReaderException.cs index 020c1ed7..bb9dc749 100644 --- a/src/JsonNet/JsonReaderException.cs +++ b/src/JsonNet/JsonReaderException.cs @@ -86,7 +86,7 @@ public JsonReaderException(string message, Exception innerException) { } -#if !(DOTNET || PORTABLE40 || PORTABLE) +#if !(DOTNET || PORTABLE40 || PORTABLE || NET_STANDARD_2_0) /// /// Initializes a new instance of the class. /// diff --git a/src/JsonNet/JsonSerializationException.cs b/src/JsonNet/JsonSerializationException.cs index 6c8247e5..845f5885 100644 --- a/src/JsonNet/JsonSerializationException.cs +++ b/src/JsonNet/JsonSerializationException.cs @@ -34,7 +34,7 @@ namespace Backtrace.Newtonsoft /// /// The exception thrown when an error occurs during JSON serialization or deserialization. /// -#if !(DOTNET || PORTABLE40 || PORTABLE) +#if !(DOTNET || PORTABLE40 || PORTABLE || NET_STANDARD_2_0) [Serializable] #endif [Preserve] @@ -68,7 +68,7 @@ public JsonSerializationException(string message, Exception innerException) { } -#if !(DOTNET || PORTABLE40 || PORTABLE) +#if !(DOTNET || PORTABLE40 || PORTABLE || NET_STANDARD_2_0) /// /// Initializes a new instance of the class. /// diff --git a/src/JsonNet/JsonTextReader.cs b/src/JsonNet/JsonTextReader.cs index 5780e508..ee628013 100644 --- a/src/JsonNet/JsonTextReader.cs +++ b/src/JsonNet/JsonTextReader.cs @@ -2383,7 +2383,7 @@ public override void Close() if (CloseInput && _reader != null) { -#if !(DOTNET || PORTABLE40 || PORTABLE) +#if !(DOTNET || PORTABLE40 || PORTABLE || NET_STANDARD_2_0) _reader.Close(); #else _reader.Dispose(); diff --git a/src/JsonNet/JsonTextWriter.cs b/src/JsonNet/JsonTextWriter.cs index 992b6e31..5d0d1051 100644 --- a/src/JsonNet/JsonTextWriter.cs +++ b/src/JsonNet/JsonTextWriter.cs @@ -181,7 +181,7 @@ public override void Close() if (CloseOutput && _writer != null) { -#if !(DOTNET || PORTABLE40 || PORTABLE) +#if !(DOTNET || PORTABLE40 || PORTABLE || NET_STANDARD_2_0) _writer.Close(); #else _writer.Dispose(); @@ -664,7 +664,7 @@ public override void WriteValue(Guid value) string text = null; -#if !(DOTNET || PORTABLE40 || PORTABLE) +#if !(DOTNET || PORTABLE40 || PORTABLE || NET_STANDARD_2_0) text = value.ToString("D", CultureInfo.InvariantCulture); #else text = value.ToString("D"); diff --git a/src/JsonNet/JsonWriterException.cs b/src/JsonNet/JsonWriterException.cs index 4fa65042..d6438b69 100644 --- a/src/JsonNet/JsonWriterException.cs +++ b/src/JsonNet/JsonWriterException.cs @@ -34,7 +34,7 @@ namespace Backtrace.Newtonsoft /// /// The exception thrown when an error occurs while reading JSON text. /// -#if !(DOTNET || PORTABLE40 || PORTABLE) +#if !(DOTNET || PORTABLE40 || PORTABLE || NET_STANDARD_2_0) [Serializable] #endif [Preserve] @@ -74,7 +74,7 @@ public JsonWriterException(string message, Exception innerException) { } -#if !(DOTNET || PORTABLE40 || PORTABLE) +#if !(DOTNET || PORTABLE40 || PORTABLE || NET_STANDARD_2_0) /// /// Initializes a new instance of the class. /// diff --git a/src/JsonNet/Linq/BacktraceJObject.cs b/src/JsonNet/Linq/BacktraceJObject.cs index cb7fa30b..21b28fe9 100644 --- a/src/JsonNet/Linq/BacktraceJObject.cs +++ b/src/JsonNet/Linq/BacktraceJObject.cs @@ -52,7 +52,7 @@ namespace Backtrace.Newtonsoft.Linq /// [Preserve] public class BacktraceJObject : BacktraceJContainer, IDictionary, INotifyPropertyChanged -#if !(DOTNET || PORTABLE40 || PORTABLE) +#if !(DOTNET || PORTABLE40 || PORTABLE || NET_STANDARD_2_0) , ICustomTypeDescriptor #endif #if !(NET20 || PORTABLE40 || PORTABLE) @@ -215,7 +215,7 @@ internal override void MergeItem(object content, JsonMergeSettings settings) internal void InternalPropertyChanged(BacktraceJProperty childProperty) { OnPropertyChanged(childProperty.Name); -#if !(DOTNET || PORTABLE40 || PORTABLE) +#if !(DOTNET || PORTABLE40 || PORTABLE || NET_STANDARD_2_0) if (_listChanged != null) { OnListChanged(new ListChangedEventArgs(ListChangedType.ItemChanged, IndexOfItem(childProperty))); @@ -721,7 +721,7 @@ protected virtual void OnPropertyChanging(string propertyName) } #endif -#if !(DOTNET || PORTABLE40 || PORTABLE) +#if !(DOTNET || PORTABLE40 || PORTABLE || NET_STANDARD_2_0) // include custom type descriptor on JObject rather than use a provider because the properties are specific to a type #region ICustomTypeDescriptor diff --git a/src/JsonNet/Linq/JContainer.cs b/src/JsonNet/Linq/JContainer.cs index ea4e8866..062ea121 100644 --- a/src/JsonNet/Linq/JContainer.cs +++ b/src/JsonNet/Linq/JContainer.cs @@ -52,7 +52,7 @@ namespace Backtrace.Newtonsoft.Linq /// [Preserve] public abstract class BacktraceJContainer : JToken, IList -#if !(DOTNET || PORTABLE || PORTABLE40) +#if !(DOTNET || PORTABLE || PORTABLE40 || NET_STANDARD_2_0) , ITypedList, IBindingList #endif , IList @@ -60,7 +60,7 @@ public abstract class BacktraceJContainer : JToken, IList , INotifyCollectionChanged #endif { -#if !(DOTNET || PORTABLE40 || PORTABLE) +#if !(DOTNET || PORTABLE40 || PORTABLE || NET_STANDARD_2_0) internal ListChangedEventHandler _listChanged; #pragma warning disable CS0436 // Type conflicts with imported type internal AddingNewEventHandler _addingNew; @@ -142,7 +142,7 @@ internal virtual IList CreateChildrenCollection() return new List(); } -#if !(DOTNET || PORTABLE40 || PORTABLE) +#if !(DOTNET || PORTABLE40 || PORTABLE || NET_STANDARD_2_0) #pragma warning disable CS0436 // Type conflicts with imported type /// /// Raises the event. @@ -400,7 +400,7 @@ internal virtual void InsertItem(int index, JToken item, bool skipParentCheck) children.Insert(index, item); -#if !(DOTNET || PORTABLE40 || PORTABLE) +#if !(DOTNET || PORTABLE40 || PORTABLE || NET_STANDARD_2_0) if (_listChanged != null) { OnListChanged(new ListChangedEventArgs(ListChangedType.ItemAdded, index)); @@ -448,7 +448,7 @@ internal virtual void RemoveItemAt(int index) children.RemoveAt(index); -#if !(DOTNET || PORTABLE40 || PORTABLE) +#if !(DOTNET || PORTABLE40 || PORTABLE || NET_STANDARD_2_0) if (_listChanged != null) { OnListChanged(new ListChangedEventArgs(ListChangedType.ItemDeleted, index)); @@ -528,7 +528,7 @@ internal virtual void SetItem(int index, JToken item) existing.Previous = null; existing.Next = null; -#if !(DOTNET || PORTABLE || PORTABLE40) +#if !(DOTNET || PORTABLE || PORTABLE40 || NET_STANDARD_2_0) if (_listChanged != null) { OnListChanged(new ListChangedEventArgs(ListChangedType.ItemChanged, index)); @@ -557,7 +557,7 @@ internal virtual void ClearItems() children.Clear(); -#if !(DOTNET || PORTABLE40 || PORTABLE) +#if !(DOTNET || PORTABLE40 || PORTABLE || NET_STANDARD_2_0) if (_listChanged != null) { OnListChanged(new ListChangedEventArgs(ListChangedType.Reset, -1)); @@ -891,7 +891,7 @@ internal int ContentsHashCode() return hashCode; } -#if !(DOTNET || PORTABLE40 || PORTABLE) +#if !(DOTNET || PORTABLE40 || PORTABLE || NET_STANDARD_2_0) string ITypedList.GetListName(PropertyDescriptor[] listAccessors) { return string.Empty; @@ -1067,7 +1067,7 @@ object ICollection.SyncRoot #endregion #region IBindingList Members -#if !(DOTNET || PORTABLE || PORTABLE40) +#if !(DOTNET || PORTABLE || PORTABLE40 || NET_STANDARD_2_0) void IBindingList.AddIndex(PropertyDescriptor property) { } diff --git a/src/JsonNet/Linq/JToken.cs b/src/JsonNet/Linq/JToken.cs index 661c4773..c1f3510b 100644 --- a/src/JsonNet/Linq/JToken.cs +++ b/src/JsonNet/Linq/JToken.cs @@ -50,7 +50,7 @@ namespace Backtrace.Newtonsoft.Linq /// [Preserve] public abstract class JToken : IJEnumerable, IJsonLineInfo -#if !(DOTNET || PORTABLE40 || PORTABLE) +#if !(DOTNET || PORTABLE40 || PORTABLE || NET_STANDARD_2_0) , ICloneable #endif #if !((NET35 || NET_2_0 || NET_2_0_SUBSET) || NET20 || PORTABLE40 ) @@ -2105,7 +2105,7 @@ DynamicMetaObject IDynamicMetaObjectProvider.GetMetaObject(Expression parameter) } #endif -#if !(DOTNET || PORTABLE || PORTABLE40) +#if !(DOTNET || PORTABLE || PORTABLE40 || NET_STANDARD_2_0) object ICloneable.Clone() { return DeepClone(); diff --git a/src/JsonNet/Linq/JTokenWriter.cs b/src/JsonNet/Linq/JTokenWriter.cs index ce7bc7c3..46642f4d 100644 --- a/src/JsonNet/Linq/JTokenWriter.cs +++ b/src/JsonNet/Linq/JTokenWriter.cs @@ -372,7 +372,7 @@ public override void WriteValue(char value) { base.WriteValue(value); string s = null; -#if !(DOTNET || PORTABLE40 || PORTABLE) +#if !(DOTNET || PORTABLE40 || PORTABLE || NET_STANDARD_2_0) s = value.ToString(CultureInfo.InvariantCulture); #else s = value.ToString(); diff --git a/src/JsonNet/Linq/JValue.cs b/src/JsonNet/Linq/JValue.cs index c2a73050..b527e760 100644 --- a/src/JsonNet/Linq/JValue.cs +++ b/src/JsonNet/Linq/JValue.cs @@ -533,7 +533,7 @@ private static JTokenType GetValueType(JTokenType? current, object value) { return JTokenType.Null; } -#if !(DOTNET || PORTABLE40 || PORTABLE) +#if !(DOTNET || PORTABLE40 || PORTABLE || NET_STANDARD_2_0) else if (value == DBNull.Value) { return JTokenType.Null; diff --git a/src/JsonNet/Schema/JsonSchemaException.cs b/src/JsonNet/Schema/JsonSchemaException.cs index 29383526..0c8e8e1a 100644 --- a/src/JsonNet/Schema/JsonSchemaException.cs +++ b/src/JsonNet/Schema/JsonSchemaException.cs @@ -36,7 +36,7 @@ namespace Backtrace.Newtonsoft.Schema /// JSON Schema validation has been moved to its own package. See http://www.newtonsoft.com/jsonschema for more details. /// /// -#if !(DOTNET || PORTABLE40 || PORTABLE) +#if !(DOTNET || PORTABLE40 || PORTABLE || NET_STANDARD_2_0) [Serializable] #endif [Obsolete("JSON Schema validation has been moved to its own package. See http://www.newtonsoft.com/jsonschema for more details.")] @@ -88,7 +88,7 @@ public JsonSchemaException(string message, Exception innerException) { } -#if !(DOTNET || PORTABLE40 || PORTABLE) +#if !(DOTNET || PORTABLE40 || PORTABLE || NET_STANDARD_2_0) /// /// Initializes a new instance of the class. /// diff --git a/src/JsonNet/Schema/JsonSchemaGenerator.cs b/src/JsonNet/Schema/JsonSchemaGenerator.cs index d5dd864b..075c6e84 100644 --- a/src/JsonNet/Schema/JsonSchemaGenerator.cs +++ b/src/JsonNet/Schema/JsonSchemaGenerator.cs @@ -193,7 +193,7 @@ private string GetDescription(Type type) return containerAttribute.Description; } -#if !(DOTNET || PORTABLE40 || PORTABLE) +#if !(DOTNET || PORTABLE40 || PORTABLE || NET_STANDARD_2_0) DescriptionAttribute descriptionAttribute = ReflectionUtils.GetAttribute(type); if (descriptionAttribute != null) { diff --git a/src/JsonNet/Serialization/DefaultContractResolver.cs b/src/JsonNet/Serialization/DefaultContractResolver.cs index 77d6a1d0..141b11f6 100644 --- a/src/JsonNet/Serialization/DefaultContractResolver.cs +++ b/src/JsonNet/Serialization/DefaultContractResolver.cs @@ -413,7 +413,7 @@ protected virtual JsonObjectContract CreateObjectContract(Type objectType) } else if (contract.MemberSerialization == MemberSerialization.Fields) { -#if !(DOTNET || PORTABLE40 || PORTABLE) +#if !(DOTNET || PORTABLE40 || PORTABLE || NET_STANDARD_2_0) // mimic DataContractSerializer behaviour when populating fields by overriding default creator to create an uninitialized object // note that this is only possible when the application is fully trusted so fall back to using the default constructor (if available) in partial trust if (JsonTypeReflector.FullyTrusted) @@ -1032,7 +1032,7 @@ protected virtual JsonLinqContract CreateLinqContract(Type objectType) return contract; } -#if !(DOTNET || PORTABLE40 || PORTABLE) +#if !(DOTNET || PORTABLE40 || PORTABLE || NET_STANDARD_2_0) /// /// Creates a for the given type. /// @@ -1136,7 +1136,7 @@ protected virtual JsonContract CreateContract(Type objectType) return CreateStringContract(objectType); } -#if !(DOTNET || PORTABLE40 || PORTABLE) +#if !(DOTNET || PORTABLE40 || PORTABLE || NET_STANDARD_2_0) if (!IgnoreSerializableInterface && typeof(ISerializable).IsAssignableFrom(t)) { return CreateISerializableContract(objectType); @@ -1183,7 +1183,7 @@ internal static bool IsIConvertible(Type t) internal static bool CanConvertToString(Type type) { -#if !(DOTNET || PORTABLE40 || PORTABLE) +#if !(DOTNET || PORTABLE40 || PORTABLE || NET_STANDARD_2_0) TypeConverter converter = ConvertUtils.GetConverter(type); // use the objectType's TypeConverter if it has one and can convert to a string @@ -1312,7 +1312,7 @@ protected virtual IValueProvider CreateMemberValueProvider(MemberInfo member) // warning - this method use to cause errors with Intellitrace. Retest in VS Ultimate after changes IValueProvider valueProvider; -#if !(PORTABLE40 || PORTABLE || DOTNET || AOT) +#if !(PORTABLE40 || PORTABLE || DOTNET || AOT || NET_STANDARD_2_0) if (DynamicCodeGeneration) { valueProvider = new DynamicValueProvider(member); @@ -1434,7 +1434,7 @@ private void SetPropertySettingsFromAttributes(JsonProperty property, object att JsonTypeReflector.GetAttribute(attributeProvider) != null // automatically ignore extension data dictionary property if it is public || JsonTypeReflector.GetAttribute(attributeProvider) != null -#if !(DOTNET || PORTABLE40 || PORTABLE) +#if !(DOTNET || PORTABLE40 || PORTABLE || NET_STANDARD_2_0) || JsonTypeReflector.GetAttribute(attributeProvider) != null #endif ; diff --git a/src/JsonNet/Serialization/DynamicValueProvider.cs b/src/JsonNet/Serialization/DynamicValueProvider.cs index aee09f5f..15acb1e3 100644 --- a/src/JsonNet/Serialization/DynamicValueProvider.cs +++ b/src/JsonNet/Serialization/DynamicValueProvider.cs @@ -23,7 +23,7 @@ // OTHER DEALINGS IN THE SOFTWARE. #endregion -#if !(PORTABLE40 || PORTABLE || DOTNET || AOT) +#if !(PORTABLE40 || PORTABLE || DOTNET || AOT || NET_STANDARD_2_0) using System; using System.Collections.Generic; #if NET20 diff --git a/src/JsonNet/Serialization/JsonFormatterConverter.cs b/src/JsonNet/Serialization/JsonFormatterConverter.cs index 45721bae..0d14aff7 100644 --- a/src/JsonNet/Serialization/JsonFormatterConverter.cs +++ b/src/JsonNet/Serialization/JsonFormatterConverter.cs @@ -23,7 +23,7 @@ // OTHER DEALINGS IN THE SOFTWARE. #endregion -#if !(DOTNET || PORTABLE40 || PORTABLE) +#if !(DOTNET || PORTABLE40 || PORTABLE || NET_STANDARD_2_0) using System; using System.Globalization; using System.Runtime.Serialization; diff --git a/src/JsonNet/Serialization/JsonObjectContract.cs b/src/JsonNet/Serialization/JsonObjectContract.cs index 1b7feb4f..ed7626dc 100644 --- a/src/JsonNet/Serialization/JsonObjectContract.cs +++ b/src/JsonNet/Serialization/JsonObjectContract.cs @@ -210,7 +210,7 @@ public JsonObjectContract(Type underlyingType) Properties = new JsonPropertyCollection(UnderlyingType); } -#if !(DOTNET || PORTABLE40 || PORTABLE) +#if !(DOTNET || PORTABLE40 || PORTABLE || NET_STANDARD_2_0) #if !(NET20 || (NET35 || NET_2_0 || NET_2_0_SUBSET)) [SecuritySafeCritical] #endif diff --git a/src/JsonNet/Serialization/JsonSerializerInternalReader.cs b/src/JsonNet/Serialization/JsonSerializerInternalReader.cs index 39f6eaa0..70ba799c 100644 --- a/src/JsonNet/Serialization/JsonSerializerInternalReader.cs +++ b/src/JsonNet/Serialization/JsonSerializerInternalReader.cs @@ -318,7 +318,7 @@ private object CreateValueInternal(JsonReader reader, Type objectType, JsonContr return EnsureType(reader, constructorName, CultureInfo.InvariantCulture, contract, objectType); case JsonToken.Null: case JsonToken.Undefined: -#if !(DOTNET || PORTABLE40 || PORTABLE) +#if !(DOTNET || PORTABLE40 || PORTABLE || NET_STANDARD_2_0) if (objectType == typeof(DBNull)) { return DBNull.Value; @@ -567,7 +567,7 @@ private object CreateObject(JsonReader reader, Type objectType, JsonContract con JsonDynamicContract dynamicContract = (JsonDynamicContract)contract; return CreateDynamic(reader, dynamicContract, member, id); #endif -#if !(DOTNET || PORTABLE40 || PORTABLE) +#if !(DOTNET || PORTABLE40 || PORTABLE || NET_STANDARD_2_0) case JsonContractType.Serializable: JsonISerializableContract serializableContract = (JsonISerializableContract)contract; return CreateISerializable(reader, serializableContract, member, id); @@ -1661,7 +1661,7 @@ private object PopulateList(IList list, JsonReader reader, JsonArrayContract con return underlyingList; } -#if !(DOTNET || PORTABLE40 || PORTABLE) +#if !(DOTNET || PORTABLE40 || PORTABLE || NET_STANDARD_2_0) private object CreateISerializable(JsonReader reader, JsonISerializableContract contract, JsonProperty member, string id) { Type objectType = contract.UnderlyingType; diff --git a/src/JsonNet/Serialization/JsonSerializerInternalWriter.cs b/src/JsonNet/Serialization/JsonSerializerInternalWriter.cs index 2a9ce1bb..dd7e8860 100644 --- a/src/JsonNet/Serialization/JsonSerializerInternalWriter.cs +++ b/src/JsonNet/Serialization/JsonSerializerInternalWriter.cs @@ -200,7 +200,7 @@ private void SerializeValue(JsonWriter writer, object value, JsonContract valueC SerializeDynamic(writer, (IDynamicMetaObjectProvider)value, (JsonDynamicContract)valueContract, member, containerContract, containerProperty); break; #endif -#if !(DOTNET || PORTABLE40 || PORTABLE) +#if !(DOTNET || PORTABLE40 || PORTABLE || NET_STANDARD_2_0) case JsonContractType.Serializable: SerializeISerializable(writer, (ISerializable)value, (JsonISerializableContract)valueContract, member, containerContract, containerProperty); break; @@ -381,7 +381,7 @@ private string GetReference(JsonWriter writer, object value) internal static bool TryConvertToString(object value, Type type, out string s) { -#if !(DOTNET || PORTABLE40 || PORTABLE) +#if !(DOTNET || PORTABLE40 || PORTABLE || NET_STANDARD_2_0) TypeConverter converter = ConvertUtils.GetConverter(type); // use the objectType's TypeConverter if it has one and can convert to a string @@ -835,7 +835,7 @@ private bool WriteStartArray(JsonWriter writer, object values, JsonArrayContract return writeMetadataObject; } -#if !(DOTNET || PORTABLE40 || PORTABLE) +#if !(DOTNET || PORTABLE40 || PORTABLE || NET_STANDARD_2_0) #if !(NET20 || (NET35 || NET_2_0 || NET_2_0_SUBSET)) [SecuritySafeCritical] #endif diff --git a/src/JsonNet/Serialization/JsonTypeReflector.cs b/src/JsonNet/Serialization/JsonTypeReflector.cs index 36b00c5d..819fcb8e 100644 --- a/src/JsonNet/Serialization/JsonTypeReflector.cs +++ b/src/JsonNet/Serialization/JsonTypeReflector.cs @@ -143,7 +143,7 @@ public static MemberSerialization GetObjectMemberSerialization(Type objectType, } #endif -#if !(DOTNET || PORTABLE40 || PORTABLE) +#if !(DOTNET || PORTABLE40 || PORTABLE || NET_STANDARD_2_0) if (!ignoreSerializableAttribute) { SerializableAttribute serializableAttribute = GetCachedAttribute(objectType); @@ -391,7 +391,7 @@ public static bool DynamicCodeGeneration { if (_dynamicCodeGeneration == null) { -#if !(DOTNET || PORTABLE40 || PORTABLE) +#if !(DOTNET || PORTABLE40 || PORTABLE || NET_STANDARD_2_0) try { new ReflectionPermission(ReflectionPermissionFlag.MemberAccess).Demand(); @@ -449,7 +449,7 @@ public static ReflectionDelegateFactory ReflectionDelegateFactory { get { -#if !(PORTABLE40 || PORTABLE || DOTNET) +#if !(PORTABLE40 || PORTABLE || DOTNET || NET_STANDARD_2_0) #if !AOT if (DynamicCodeGeneration) { diff --git a/src/JsonNet/SerializationBinder.cs b/src/JsonNet/SerializationBinder.cs index cd445901..328aef9c 100644 --- a/src/JsonNet/SerializationBinder.cs +++ b/src/JsonNet/SerializationBinder.cs @@ -1,5 +1,5 @@  -#if (DOTNET || PORTABLE40 || PORTABLE) +#if (DOTNET || PORTABLE40 || PORTABLE || NET_STANDARD_2_0) using System; using System.Reflection; using Backtrace.Newtonsoft.Shims; diff --git a/src/JsonNet/TraceLevel.cs b/src/JsonNet/TraceLevel.cs index 11d5f22c..41993ef1 100644 --- a/src/JsonNet/TraceLevel.cs +++ b/src/JsonNet/TraceLevel.cs @@ -1,5 +1,5 @@  -#if (DOTNET || PORTABLE40 || PORTABLE) +#if (DOTNET || PORTABLE40 || PORTABLE || NET_STANDARD_2_0) using Backtrace.Newtonsoft.Serialization; using Backtrace.Newtonsoft.Shims; diff --git a/src/JsonNet/Utilities/ConvertUtils.cs b/src/JsonNet/Utilities/ConvertUtils.cs index 1389bd58..d5c3e1b7 100644 --- a/src/JsonNet/Utilities/ConvertUtils.cs +++ b/src/JsonNet/Utilities/ConvertUtils.cs @@ -474,7 +474,7 @@ private static ConvertResult TryConvertInternal(object initialValue, CultureInfo return ConvertResult.Success; } #endif -#if !(DOTNET || PORTABLE40 || PORTABLE) +#if !(DOTNET || PORTABLE40 || PORTABLE || NET_STANDARD_2_0) // handle DBNull and INullable if (initialValue == DBNull.Value) { diff --git a/src/JsonNet/Utilities/DynamicReflectionDelegateFactory.cs b/src/JsonNet/Utilities/DynamicReflectionDelegateFactory.cs index 2c8de04c..e3a34873 100644 --- a/src/JsonNet/Utilities/DynamicReflectionDelegateFactory.cs +++ b/src/JsonNet/Utilities/DynamicReflectionDelegateFactory.cs @@ -23,7 +23,7 @@ // OTHER DEALINGS IN THE SOFTWARE. #endregion -#if !(DOTNET || PORTABLE || PORTABLE40 || AOT) +#if !(DOTNET || PORTABLE || PORTABLE40 || AOT || NET_STANDARD_2_0) using System; using System.Collections.Generic; #if NET20 diff --git a/src/JsonNet/Utilities/ILGeneratorExtensions.cs b/src/JsonNet/Utilities/ILGeneratorExtensions.cs index e8985b99..61603609 100644 --- a/src/JsonNet/Utilities/ILGeneratorExtensions.cs +++ b/src/JsonNet/Utilities/ILGeneratorExtensions.cs @@ -23,7 +23,7 @@ // OTHER DEALINGS IN THE SOFTWARE. #endregion -#if !(DOTNET || PORTABLE40 || PORTABLE || AOT) +#if !(DOTNET || PORTABLE40 || PORTABLE || AOT || NET_STANDARD_2_0) using System; using System.Reflection.Emit; using System.Reflection; diff --git a/src/Model/BacktraceClientConfiguration.cs b/src/Model/BacktraceClientConfiguration.cs index 5d401696..7987efa0 100644 --- a/src/Model/BacktraceClientConfiguration.cs +++ b/src/Model/BacktraceClientConfiguration.cs @@ -14,6 +14,7 @@ public class BacktraceClientConfiguration : ScriptableObject public bool DestroyOnLoad = true; public int GameObjectDepth = 0; public DeduplicationStrategy DeduplicationStrategy = DeduplicationStrategy.None; + public MiniDumpType MinidumpType = MiniDumpType.None; public void UpdateServerUrl() { diff --git a/src/Model/BacktraceConfiguration.cs b/src/Model/BacktraceConfiguration.cs index f87d4bac..55a65f80 100644 --- a/src/Model/BacktraceConfiguration.cs +++ b/src/Model/BacktraceConfiguration.cs @@ -33,6 +33,11 @@ public class BacktraceConfiguration : ScriptableObject /// public bool IgnoreSslValidation = false; + /// + /// Determine minidump type support - minidump generation is supported on Windows. + /// + public MiniDumpType MinidumpType = MiniDumpType.None; + /// /// Directory path where reports and minidumps are stored /// diff --git a/src/Model/BacktraceData.cs b/src/Model/BacktraceData.cs index 69187261..7f3cf549 100644 --- a/src/Model/BacktraceData.cs +++ b/src/Model/BacktraceData.cs @@ -188,7 +188,12 @@ private void SetReportInformation() { Uuid = Report.Uuid; Timestamp = Report.Timestamp; - LangVersion = "Mono/IL2CPP"; +#if ENABLE_IL2CPP + LangVersion = "IL2CPP"; +#else + LangVersion = "Mono"; +#endif + AgentVersion = "2.0.5-alpha"; Classifier = Report.ExceptionTypeReport ? new[] { Report.Classifier } : null; } diff --git a/src/Services/BacktraceApi.cs b/src/Services/BacktraceApi.cs index bbd7d716..7c4ebab6 100644 --- a/src/Services/BacktraceApi.cs +++ b/src/Services/BacktraceApi.cs @@ -166,6 +166,7 @@ private IEnumerator SendAttachment(string rxId, Stack attachments) { string fileName = System.IO.Path.GetFileName(attachment); string serverUrl = GetAttachmentUploadUrl(rxId, fileName); + Debug.Log("Server url = " + serverUrl); using (var request = new UnityWebRequest(serverUrl, "POST")) { @@ -194,7 +195,7 @@ private IEnumerator SendAttachment(string rxId, Stack attachments) private string GetAttachmentUploadUrl(string rxId, string attachmentName) { return _credentials == null || string.IsNullOrEmpty(_credentials.Token) - ? string.Format("{0}?object={1}&attachment_name={2}", _credentials.BacktraceHostUri.AbsoluteUri, rxId, + ? string.Format("{0}&object={1}&attachment_name={2}", _credentials.BacktraceHostUri.AbsoluteUri, rxId, UrlEncode(attachmentName)) : string.Format("{0}/api/post?token={1}&object={2}&attachment_name={3}", _credentials.BacktraceHostUri.AbsoluteUri, _credentials.Token, rxId, UrlEncode(attachmentName)); diff --git a/src/Types/MinidumpOption.cs b/src/Types/MinidumpOption.cs index d35a34e8..52d96d6f 100644 --- a/src/Types/MinidumpOption.cs +++ b/src/Types/MinidumpOption.cs @@ -7,12 +7,11 @@ namespace Backtrace.Unity.Types /// /// Minidump generation options. These values are available in dbghelp.h and you can get more information here: http://blog.kalmbach-software.de/2008/12/13/writing-minidumps-in-c/ /// - [Flags] - public enum MiniDumpType : uint + public enum MiniDumpType: uint { #pragma warning disable 1591 // From dbghelp.h: - None = 0xffffffff, + None = 0x7FFFE, Normal = 0x00000000, WithDataSegs = 0x00000001, WithFullMemory = 0x00000002,