Skip to content

Commit d4bce7d

Browse files
FixGeneratedName argument
1 parent b37f712 commit d4bce7d

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

LightWeight/ExceptionExtensions.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,22 +127,22 @@ private static string FrameToString(StackFrame frame, MethodBase method, string
127127
switch (method.DeclaringType.Name[endIndex + 1])
128128
{
129129
case 'd':
130-
sb.Append(TypeExtensions.FixGeneratedName(method.DeclaringType.DeclaringType.Name))
130+
sb.Append(TypeExtensions.FixGeneratedName(method.DeclaringType.DeclaringType.Name, false))
131131
.Append('.');
132132
ignoreMethod = true;
133133
break;
134134
}
135135
}
136136
}
137137

138-
sb.Append(TypeExtensions.FixGeneratedName(method.DeclaringType.Name));
138+
sb.Append(TypeExtensions.FixGeneratedName(method.DeclaringType.Name, false));
139139
if (!ignoreMethod)
140140
sb.Append('.');
141141
}
142142

143143
if (!ignoreMethod)
144144
{
145-
sb.Append(TypeExtensions.FixGeneratedName(method.Name));
145+
sb.Append(TypeExtensions.FixGeneratedName(method.Name, false));
146146

147147
if (method is MethodInfo mi && mi.IsGenericMethod)
148148
{

LightWeight/TypeExtensions.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public static string GetFriendlyTypeName(this Type type, bool includeNameSpace =
4242
return (includeNameSpace ? type.Namespace + "." : null) + type.Name.Replace('+', '.');
4343
}
4444

45-
public static string FixGeneratedName(string name)
45+
public static string FixGeneratedName(string name, bool includeExtraInfo)
4646
{
4747
if (name.StartsWith('<'))
4848
{
@@ -51,12 +51,12 @@ public static string FixGeneratedName(string name)
5151
{
5252
var fixedName = name[1..endIndex];
5353
return fixedName
54-
+ (name[endIndex + 1] switch
54+
+ (includeExtraInfo ? (name[endIndex + 1] switch
5555
{
5656
'b' => "+AnonymousMethod",
5757
'd' => "+Iterator",
5858
_ => null,
59-
});
59+
}) : "");
6060
}
6161
}
6262

0 commit comments

Comments
 (0)