From 3003c2ab72579ef66d0f771fd244a8916f05d409 Mon Sep 17 00:00:00 2001 From: apkd Date: Sat, 3 Oct 2020 15:05:41 +0200 Subject: [PATCH] Use ordinal string comparison --- src/CacheDictionary.cs | 6 +- src/Detour.cs | 4 +- src/EnhancedStackFrame.cs | 31 +++++---- src/EnhancedStackTrace.Frames.cs | 100 ++++++++++++++-------------- src/EnhancedStackTrace.cs | 46 ++++++------- src/Enumerable/EnumerableIList.cs | 6 +- src/Enumerable/EnumeratorIList.cs | 6 +- src/ExceptionExtensions.cs | 14 +--- src/Internal/ILReader.cs | 2 +- src/Internal/ReflectionHelper.cs | 2 +- src/Internal/StringBuilder.cs | 7 +- src/ResolvedMethod.cs | 101 +++++++++++++++-------------- src/ResolvedParameter.cs | 2 +- src/TypeNameHelper.cs | 2 +- src/UnityEditorOverrides.cs | 18 +++-- src/ValueTupleResolvedParameter.cs | 5 +- 16 files changed, 176 insertions(+), 176 deletions(-) diff --git a/src/CacheDictionary.cs b/src/CacheDictionary.cs index 7208bb4..d9c1126 100644 --- a/src/CacheDictionary.cs +++ b/src/CacheDictionary.cs @@ -2,16 +2,16 @@ namespace Apkd.Internal { - internal sealed class CacheDictionary where TKey : class where TValue : class + sealed class CacheDictionary where TKey : class where TValue : class { readonly int cacheSize; readonly Queue objectReferenceQueue; readonly System.Runtime.CompilerServices.ConditionalWeakTable weakTable = new System.Runtime.CompilerServices.ConditionalWeakTable(); - const int defaultCacheSize = 256; + const int DefaultCacheSize = 256; - public CacheDictionary(int cacheSize = 256) + public CacheDictionary(int cacheSize = DefaultCacheSize) #if APKD_STACKTRACE_NOCACHE { } #else diff --git a/src/Detour.cs b/src/Detour.cs index c65ada2..96fdcac 100644 --- a/src/Detour.cs +++ b/src/Detour.cs @@ -1,7 +1,7 @@ using System; using System.Reflection; -using System.Diagnostics; using static System.Reflection.BindingFlags; +// ReSharper disable once RedundantUsingDirective using static Apkd.Internal.UnityEditorOverrides; namespace Apkd.Internal @@ -11,7 +11,7 @@ static class Detour { // This is based on an interesting technique from the RimWorld ComunityCoreLibrary project, originally credited to RawCode: // https://github.com/RimWorldCCLTeam/CommunityCoreLibrary/blob/master/DLL_Project/Classes/Static/Detours.cs - internal static unsafe void TryDetourFromTo(MethodInfo src, MethodInfo dst) + static unsafe void TryDetourFromTo(MethodInfo src, MethodInfo dst) { try { diff --git a/src/EnhancedStackFrame.cs b/src/EnhancedStackFrame.cs index 7e6e067..ca99d60 100644 --- a/src/EnhancedStackFrame.cs +++ b/src/EnhancedStackFrame.cs @@ -1,12 +1,13 @@ // Copyright (c) Ben A Adams. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +using System; using System.Diagnostics; using System.Reflection; namespace Apkd.Internal { - internal sealed class EnhancedStackFrame : StackFrame + sealed class EnhancedStackFrame : StackFrame { string _fileName; int _lineNumber; @@ -51,31 +52,33 @@ public override string GetFileName() if (string.IsNullOrWhiteSpace(_fileName)) return null; - if (_fileName.StartsWith(@"C:\buildslave\unity", System.StringComparison.Ordinal)) - return null; - - return System.IO.Path.GetFileName(_fileName); - // return _fileName; + return !_fileName.StartsWith(@"C:\buildslave\unity", StringComparison.Ordinal) + ? System.IO.Path.GetFileName(_fileName) + : null; } internal string GetFullFilename() { if (string.IsNullOrWhiteSpace(_fileName)) return null; - int index = _fileName.IndexOf("\\Assets\\"); - if (index >= 0) - return _fileName.Substring(index + 1); - return _fileName; + + int index = _fileName.IndexOf("\\Assets\\", StringComparison.Ordinal); + + return index >= 0 + ? _fileName.Substring(index + 1) + : _fileName; } internal StringBuilder AppendFullFilename(StringBuilder sb) { if (string.IsNullOrWhiteSpace(_fileName)) return sb; - int index = _fileName.IndexOf("\\Assets\\"); - if (index >= 0) - return sb.Append(_fileName, index + 1); - return sb.Append(_fileName); + + int index = _fileName.IndexOf("\\Assets\\", StringComparison.Ordinal); + + return index >= 0 + ? sb.Append(_fileName, index + 1) + : sb.Append(_fileName); } internal bool IsEmpty => MethodInfo == null; diff --git a/src/EnhancedStackTrace.Frames.cs b/src/EnhancedStackTrace.Frames.cs index 90f0505..68923b3 100644 --- a/src/EnhancedStackTrace.Frames.cs +++ b/src/EnhancedStackTrace.Frames.cs @@ -17,7 +17,7 @@ namespace Apkd.Internal { - internal sealed partial class EnhancedStackTrace + sealed partial class EnhancedStackTrace { static readonly Type StackTraceHiddenAttibuteType = Type.GetType("System.Diagnostics.StackTraceHiddenAttribute", false); static readonly MethodInfo UnityEditorInspectorWindowOnGuiMethod = typeof(UnityEditor.Editor).Assembly.GetType("UnityEditor.InspectorWindow", false)?.GetMethod("OnGUI", NonPublic | Instance); @@ -52,8 +52,8 @@ IEnumerable EnumerateEnhancedFrames(StackTrace st) IEnumerable EnumerateFrames(StackTrace st2) { foreach (var inner in GetInnerStackTraces(st2)) - foreach (var frame in EnumerateFrames(inner)) - yield return frame; + foreach (var frame in EnumerateFrames(inner)) + yield return frame; for (var i = 0; i < st2.FrameCount; i++) yield return st2.GetFrame(i); @@ -65,7 +65,8 @@ EnhancedStackFrame MakeEnhancedFrame(StackFrame frame, MethodBase method) methodInfo: GetResolvedMethod(method), fileName: frame.GetFileName(), lineNumber: frame.GetFileLineNumber(), - colNumber: frame.GetFileColumnNumber()); + colNumber: frame.GetFileColumnNumber() + ); bool collapseNext = false; StackFrame current = null; @@ -74,35 +75,35 @@ EnhancedStackFrame MakeEnhancedFrame(StackFrame frame, MethodBase method) { try { - if (current != null) - { - var method = current.GetMethod(); + if (current == null) + continue; - if (method == null) // TODO: remove this - continue; + var method = current.GetMethod(); - bool shouldExcludeFromCollapse = ShouldExcludeFromCollapse(method); - if (shouldExcludeFromCollapse) - collapseNext = false; + if (method == null) // TODO: remove this + continue; + + bool shouldExcludeFromCollapse = ShouldExcludeFromCollapse(method); + if (shouldExcludeFromCollapse) + collapseNext = false; - if ((collapseNext || ShouldCollapseStackFrames(method)) && !shouldExcludeFromCollapse) + if ((collapseNext || ShouldCollapseStackFrames(method)) && !shouldExcludeFromCollapse) + { + if (ShouldCollapseStackFrames(next.GetMethod())) { - if (ShouldCollapseStackFrames(next.GetMethod())) - { - collapseNext = true; - continue; - } - else - { - collapseNext = false; - } + collapseNext = true; + continue; + } + else + { + collapseNext = false; } + } - if (!ShouldShowInStackTrace(method)) - continue; + if (!ShouldShowInStackTrace(method)) + continue; - yield return MakeEnhancedFrame(current, method); - } + yield return MakeEnhancedFrame(current, method); } finally { @@ -125,6 +126,7 @@ static bool IsDefined(MemberInfo member) foreach (var attr in GetCustomAttributes(member)) if (attr is T) return true; + return false; } @@ -251,7 +253,7 @@ internal static ResolvedMethod GetResolvedMethodInternal(MethodBase methodBase) if (i > 0) builder.Append(',').Append(' '); - TypeNameHelper.AppendTypeDisplayName(builder, genericArguments[i], fullName: false, includeGenericParameterNames: true); + builder.AppendTypeDisplayName(genericArguments[i], fullName: false, includeGenericParameterNames: true); } builder.Append('>'); @@ -317,14 +319,16 @@ static bool TryResolveGeneratedName(ref MethodBase method, out Type type, out st var localNameStart = generatedName.IndexOf((char)kind, closeBracketOffset + 1); if (localNameStart < 0) break; + localNameStart += 3; if (localNameStart < generatedName.Length) { - var localNameEnd = generatedName.IndexOf("|", localNameStart); + var localNameEnd = generatedName.IndexOf("|", localNameStart, StringComparison.Ordinal); if (localNameEnd > 0) subMethodName = generatedName.Substring(localNameStart, localNameEnd - localNameStart); } + break; case GeneratedNameKind.LambdaMethod: subMethodName = ""; @@ -401,6 +405,7 @@ static bool TryResolveSourceMethod(IEnumerable candidateMethods, Gen var rawIL = methodBody?.GetILAsByteArray(); if (rawIL == null) continue; + var reader = new ILReader(rawIL); while (reader.Read(candidateMethod)) { @@ -475,15 +480,17 @@ static string GetMatchHint(GeneratedNameKind kind, MethodBase method) switch (kind) { case GeneratedNameKind.LocalFunction: - var start = methodName.IndexOf("|"); + var start = methodName.IndexOf("|", StringComparison.Ordinal); if (start < 1) return null; - var end = methodName.IndexOf("_", start) + 1; + + var end = methodName.IndexOf("_", start, StringComparison.Ordinal) + 1; if (end <= start) return null; return methodName.Substring(start, end - start); } + return null; } @@ -593,14 +600,16 @@ static ResolvedParameter GetParameter(ParameterInfo parameter) if (attr is Attribute tena && tena.IsTupleElementNameAttribute()) tupleNameAttribute = tena; + // ReSharper disable ExpressionIsAlwaysNull #if APKD_STACKTRACE_FULLPARAMS var tupleNames = tupleNameAttribute?.GetTransformNames(); #else - var tupleNames = null as IList; + var tupleNames = null as IList; #endif if (tupleNameAttribute != null) return GetValueTupleParameter(tupleNames, prefix, parameter.Name, parameterType); + // ReSharper restore ExpressionIsAlwaysNull } if (parameterType.IsByRef) @@ -635,8 +644,7 @@ static string GetValueTupleParameterName(IList tupleNames, Type paramete if (i > 0) sb.Append(',').Append(' '); - - TypeNameHelper.AppendTypeDisplayName(sb, args[i], fullName: false, includeGenericParameterNames: true); + sb.AppendTypeDisplayName(args[i], fullName: false, includeGenericParameterNames: true); if (i >= tupleNames.Count) continue; @@ -657,23 +665,20 @@ static bool ShouldCollapseStackFrames(MethodBase method) { var comparison = StringComparison.Ordinal; string typeName = method?.DeclaringType?.FullName; + if (string.IsNullOrWhiteSpace(typeName)) return false; + return typeName.StartsWith("UnityEditor.", comparison) || - typeName.StartsWith("UnityEngine.", comparison) || - typeName.StartsWith("System.", comparison) || - typeName.StartsWith("UnityScript.Lang.", comparison) || - typeName.StartsWith("Odin.Editor.", comparison) || - typeName.StartsWith("Boo.Lang.", comparison); + typeName.StartsWith("UnityEngine.", comparison) || + typeName.StartsWith("System.", comparison) || + typeName.StartsWith("UnityScript.Lang.", comparison) || + typeName.StartsWith("Odin.Editor.", comparison) || + typeName.StartsWith("Boo.Lang.", comparison); } static bool ShouldExcludeFromCollapse(MethodBase method) - { - if (method == UnityEditorInspectorWindowOnGuiMethod) - return true; - - return false; - } + => method == UnityEditorInspectorWindowOnGuiMethod; static bool ShouldShowInStackTrace(MethodBase method) { @@ -734,9 +739,9 @@ static bool ShouldShowInStackTrace(MethodBase method) return false; } else if (type == typeof(TaskAwaiter) || - type == typeof(TaskAwaiter<>) || - type == typeof(ConfiguredTaskAwaitable.ConfiguredTaskAwaiter) || - type == typeof(ConfiguredTaskAwaitable<>.ConfiguredTaskAwaiter)) + type == typeof(TaskAwaiter<>) || + type == typeof(ConfiguredTaskAwaitable.ConfiguredTaskAwaiter) || + type == typeof(ConfiguredTaskAwaitable<>.ConfiguredTaskAwaiter)) { switch (method.Name) { @@ -791,6 +796,7 @@ static bool IsStackTraceHidden(MemberInfo memberInfo) { if (attr.GetType() == StackTraceHiddenAttibuteType) return true; + return false; } } diff --git a/src/EnhancedStackTrace.cs b/src/EnhancedStackTrace.cs index 755e77a..56cede9 100644 --- a/src/EnhancedStackTrace.cs +++ b/src/EnhancedStackTrace.cs @@ -5,11 +5,10 @@ using System.Collections; using System.Collections.Generic; using System.Diagnostics; -using System.IO; namespace Apkd.Internal { - internal sealed partial class EnhancedStackTrace : StackTrace, IEnumerable + sealed partial class EnhancedStackTrace : StackTrace, IEnumerable { internal static EnhancedStackTrace Current() => new EnhancedStackTrace(new StackTrace(1 /* skip this one frame */, true)); @@ -62,6 +61,7 @@ internal EnhancedStackTrace(StackTrace stackTrace) /// An array of type System.Diagnostics.StackFrame representing the function calls /// in the stack trace. /// + // ReSharper disable once CoVariantArrayConversion public override StackFrame[] GetFrames() => _frames.ToArray(); /// @@ -97,33 +97,33 @@ internal void Append(StringBuilder sb) else { frame.MethodInfo.Append(sb); + string filePath = frame.GetFileName(); - var filePath = frame.GetFileName(); - if (!string.IsNullOrEmpty(filePath) && !frame.MethodInfo.Name.StartsWith("Log")) + if (string.IsNullOrEmpty(filePath) || frame.MethodInfo.Name.StartsWith("Log")) + continue; + + if (!loggedFullFilepath) + { + sb.Append(" (at "); + frame.AppendFullFilename(sb); + loggedFullFilepath = true; + } + else { - if (!loggedFullFilepath) - { - sb.Append(" (at "); - frame.AppendFullFilename(sb); - loggedFullFilepath = true; - } - else - { #if !APKD_STACKTRACE_NOFORMAT - sb.Append(" →(at "); + sb.Append(" →(at "); #else sb.Append(" (at "); #endif - sb.Append(filePath); - } - - var lineNo = frame.GetFileLineNumber(); - if (lineNo != 0) - { - sb.Append(':'); - sb.Append(lineNo); - sb.Append(')'); - } + sb.Append(filePath); + } + + var lineNo = frame.GetFileLineNumber(); + if (lineNo != 0) + { + sb.Append(':'); + sb.Append(lineNo); + sb.Append(')'); } } } diff --git a/src/Enumerable/EnumerableIList.cs b/src/Enumerable/EnumerableIList.cs index e8fa81c..5f1ee1d 100644 --- a/src/Enumerable/EnumerableIList.cs +++ b/src/Enumerable/EnumerableIList.cs @@ -6,14 +6,14 @@ namespace Apkd.Internal { - internal static class EnumerableIList + static class EnumerableIList { internal static EnumerableIList Create(IList list) => new EnumerableIList(list); } - internal struct EnumerableIList : IEnumerableIList, IList + struct EnumerableIList : IEnumerableIList, IList { - private readonly IList _list; + readonly IList _list; public EnumerableIList(IList list) => _list = list; diff --git a/src/Enumerable/EnumeratorIList.cs b/src/Enumerable/EnumeratorIList.cs index 9e1ab25..3165d49 100644 --- a/src/Enumerable/EnumeratorIList.cs +++ b/src/Enumerable/EnumeratorIList.cs @@ -6,10 +6,10 @@ namespace Apkd.Internal { - internal struct EnumeratorIList : IEnumerator + struct EnumeratorIList : IEnumerator { - private readonly IList _list; - private int _index; + readonly IList _list; + int _index; internal EnumeratorIList(IList list) { diff --git a/src/ExceptionExtensions.cs b/src/ExceptionExtensions.cs index 47942cd..af492d2 100644 --- a/src/ExceptionExtensions.cs +++ b/src/ExceptionExtensions.cs @@ -2,18 +2,16 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; -using System.Collections.Generic; -using System.Diagnostics; using System.Reflection; namespace Apkd.Internal { /// - internal static class ExceptionExtensions + static class ExceptionExtensions { - private static readonly FieldInfo stackTraceString = typeof(Exception).GetField("_stackTraceString", BindingFlags.Instance | BindingFlags.NonPublic); + static readonly FieldInfo stackTraceString = typeof(Exception).GetField("_stackTraceString", BindingFlags.Instance | BindingFlags.NonPublic); - private static void SetStackTracesString(this Exception exception, string value) + static void SetStackTracesString(this Exception exception, string value) => stackTraceString.SetValue(exception, value); /// @@ -26,17 +24,11 @@ internal static T Demystify(this T exception) where T : Exception var stackTrace = new EnhancedStackTrace(exception); if (stackTrace.FrameCount > 0) - { exception.SetStackTracesString(stackTrace.ToString()); - } if (exception is AggregateException aggEx) - { foreach (var ex in EnumerableIList.Create(aggEx.InnerExceptions)) - { ex.Demystify(); - } - } exception.InnerException?.Demystify(); } diff --git a/src/Internal/ILReader.cs b/src/Internal/ILReader.cs index 3560d51..406c19b 100644 --- a/src/Internal/ILReader.cs +++ b/src/Internal/ILReader.cs @@ -4,7 +4,7 @@ namespace Apkd.Internal { - internal sealed class ILReader + sealed class ILReader { static OpCode[] singleByteOpCode; static OpCode[] doubleByteOpCode; diff --git a/src/Internal/ReflectionHelper.cs b/src/Internal/ReflectionHelper.cs index 4f314c1..47fb748 100644 --- a/src/Internal/ReflectionHelper.cs +++ b/src/Internal/ReflectionHelper.cs @@ -11,7 +11,7 @@ namespace Apkd.Internal /// /// A helper class that contains utilities methods for dealing with reflection. /// - internal static class ReflectionHelper + static class ReflectionHelper { static PropertyInfo tranformerNamesLazyPropertyInfo; static readonly Type isReadOnlyAttribute = Type.GetType("System.Runtime.CompilerServices.IsReadOnlyAttribute", false); diff --git a/src/Internal/StringBuilder.cs b/src/Internal/StringBuilder.cs index 0f05c6e..9e67bb4 100644 --- a/src/Internal/StringBuilder.cs +++ b/src/Internal/StringBuilder.cs @@ -56,12 +56,7 @@ public char this[int index] /// Return the string result public override string ToString() - { - if (_cachedString == null) - _cachedString = new string(_buffer, 0, _bufferPos); - - return _cachedString; - } + => _cachedString ?? (_cachedString = new string(_buffer, 0, _bufferPos)); /// Clears the StringBuilder instance (preserving allocated capacity) public StringBuilder Clear() diff --git a/src/ResolvedMethod.cs b/src/ResolvedMethod.cs index 85b00c7..d38a2b0 100644 --- a/src/ResolvedMethod.cs +++ b/src/ResolvedMethod.cs @@ -2,13 +2,11 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; -using System.Diagnostics; using System.Reflection; -using System.Linq; namespace Apkd.Internal { - internal sealed class ResolvedMethod + sealed class ResolvedMethod { internal MethodBase MethodBase { get; set; } @@ -53,7 +51,6 @@ internal StringBuilder Append(StringBuilder builder) if (DeclaringType != null) { - if (Name == ".ctor") { if (!hasSubMethodOrLambda) @@ -161,53 +158,16 @@ internal StringBuilder Append(StringBuilder builder) #endif #endif - if (hasSubMethodOrLambda) - { - builder.Append('+'); - builder.Append(SubMethod); - if (IsLambda) - { - builder.Append('('); - if (SubMethodBase != null) - { - var isFirst = true; - builder.AppendFormattingChar('‹'); - foreach (var param in SubMethodParameters) - { - if (isFirst) - isFirst = false; - else - builder.Append(',').Append(' '); - - param.AppendTypeName(builder); - } - builder.AppendFormattingChar('›'); - } - else - { - builder.Append('?'); - } - builder.Append(")➞ "); - - var returnType = (SubMethodBase as MethodInfo)?.ReturnType; - if (returnType != null) - TypeNameHelper.AppendTypeDisplayName(builder, returnType, fullName: false, includeGenericParameterNames: false); - else - builder.Append("{…}"); + if (!hasSubMethodOrLambda) + return builder; - if (Ordinal.HasValue) - { - builder.Append(' '); - builder.Append('['); - builder.Append(Ordinal.Value); - builder.Append(']'); - } - builder.AppendFormattingChar('‼'); - } - else + builder.Append('+'); + builder.Append(SubMethod); + if (IsLambda) + { + builder.Append('('); + if (SubMethodBase != null) { - builder.AppendFormattingChar('‼'); - builder.Append('('); var isFirst = true; builder.AppendFormattingChar('‹'); foreach (var param in SubMethodParameters) @@ -219,9 +179,50 @@ internal StringBuilder Append(StringBuilder builder) param.AppendTypeName(builder); } + builder.AppendFormattingChar('›'); - builder.Append(')'); } + else + { + builder.Append('?'); + } + + builder.Append(")➞ "); + + var returnType = (SubMethodBase as MethodInfo)?.ReturnType; + if (returnType != null) + builder.AppendTypeDisplayName(returnType, fullName: false, includeGenericParameterNames: false); + else + builder.Append("{…}"); + + if (Ordinal.HasValue) + { + builder.Append(' '); + builder.Append('['); + builder.Append(Ordinal.Value); + builder.Append(']'); + } + + builder.AppendFormattingChar('‼'); + } + else + { + builder.AppendFormattingChar('‼'); + builder.Append('('); + var isFirst = true; + builder.AppendFormattingChar('‹'); + foreach (var param in SubMethodParameters) + { + if (isFirst) + isFirst = false; + else + builder.Append(',').Append(' '); + + param.AppendTypeName(builder); + } + + builder.AppendFormattingChar('›'); + builder.Append(')'); } return builder; diff --git a/src/ResolvedParameter.cs b/src/ResolvedParameter.cs index 29c38a6..8ac300d 100644 --- a/src/ResolvedParameter.cs +++ b/src/ResolvedParameter.cs @@ -3,7 +3,7 @@ namespace Apkd.Internal { - internal class ResolvedParameter + class ResolvedParameter { internal string Name { get; set; } diff --git a/src/TypeNameHelper.cs b/src/TypeNameHelper.cs index a3e0884..cf6fa4e 100644 --- a/src/TypeNameHelper.cs +++ b/src/TypeNameHelper.cs @@ -7,7 +7,7 @@ namespace Apkd.Internal { // Adapted from https://github.com/aspnet/Common/blob/dev/shared/Microsoft.Extensions.TypeNameHelper.Sources/TypeNameHelper.cs - internal static class TypeNameHelper + static class TypeNameHelper { internal static readonly Dictionary BuiltInTypeNames = new Dictionary { diff --git a/src/UnityEditorOverrides.cs b/src/UnityEditorOverrides.cs index 73d8ddd..36d3609 100644 --- a/src/UnityEditorOverrides.cs +++ b/src/UnityEditorOverrides.cs @@ -140,13 +140,17 @@ internal static void ExtractStringFromExceptionInternal(object topLevel, out str try { StringBuilder temp = CachedBuilderLarge; - Exception current = topLevel as Exception; + Exception current = (Exception)topLevel; temp.Clear(); - if (current.Message != null) - message = temp.Append(current.GetType().ToString()).Append(": ").Append(current.Message).ToString(); - else - message = current.GetType().ToString(); + + message = current.Message != null + ? temp + .Append(current.GetType().ToString()) + .Append(": ") + .Append(current.Message) + .ToString() + : current.GetType().ToString(); temp.Clear(); while (current != null) @@ -157,7 +161,7 @@ internal static void ExtractStringFromExceptionInternal(object topLevel, out str } else { - temp.Append($" ---> "); + temp.Append(" ---> "); temp.Append('\n'); if (!string.IsNullOrEmpty(current.Message)) @@ -179,7 +183,7 @@ internal static void ExtractStringFromExceptionInternal(object topLevel, out str } catch (Exception ex) { - message = $"{topLevel}\n\nDemistifier: Unable to extract stack trace from exception: {(topLevel as Exception).GetType().Name}."; + message = $"{topLevel}\n\nDemystifier: Unable to extract stack trace from exception: {(topLevel as Exception).GetType().Name}."; stackTrace = ex.ToString(); } } diff --git a/src/ValueTupleResolvedParameter.cs b/src/ValueTupleResolvedParameter.cs index 9981636..5e9ee66 100644 --- a/src/ValueTupleResolvedParameter.cs +++ b/src/ValueTupleResolvedParameter.cs @@ -2,11 +2,10 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System.Collections.Generic; -using System.Diagnostics; namespace Apkd.Internal { - internal sealed class ValueTupleResolvedParameter : ResolvedParameter + sealed class ValueTupleResolvedParameter : ResolvedParameter { internal IList TupleNames { get; set; } @@ -27,7 +26,7 @@ internal override void AppendTypeName(StringBuilder sb) } - void AppendValueTupleParameterName(StringBuilder sb, System.Type parameterType) + static void AppendValueTupleParameterName(StringBuilder sb, System.Type parameterType) { sb.Append('('); var args = parameterType.GetGenericArguments();