Update for new frameworks
This commit is contained in:
parent
a5ae4e6391
commit
6d7a54cd84
@ -663,8 +663,13 @@ namespace System.Diagnostics
|
|||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (type == typeof(Task))
|
if (type == typeof(Task) || type.DeclaringType == typeof(Task))
|
||||||
{
|
{
|
||||||
|
if (method.Name.Contains(".cctor"))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
switch (method.Name)
|
switch (method.Name)
|
||||||
{
|
{
|
||||||
case "ExecuteWithThreadLocal":
|
case "ExecuteWithThreadLocal":
|
||||||
@ -672,15 +677,24 @@ namespace System.Diagnostics
|
|||||||
case "ExecutionContextCallback":
|
case "ExecutionContextCallback":
|
||||||
case "ExecuteEntry":
|
case "ExecuteEntry":
|
||||||
case "InnerInvoke":
|
case "InnerInvoke":
|
||||||
|
case "ExecuteEntryUnsafe":
|
||||||
|
case "ExecuteFromThreadPool":
|
||||||
|
case "s_ecCallback":
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (type == typeof(ExecutionContext))
|
if (type == typeof(ExecutionContext))
|
||||||
{
|
{
|
||||||
|
if (method.Name.Contains(".cctor"))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
switch (method.Name)
|
switch (method.Name)
|
||||||
{
|
{
|
||||||
case "RunInternal":
|
case "RunInternal":
|
||||||
case "Run":
|
case "Run":
|
||||||
|
case "RunFromThreadPoolDispatchLoop":
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -60,9 +60,8 @@ namespace System.Diagnostics
|
|||||||
}
|
}
|
||||||
|
|
||||||
var genericPartIndex = type.Name.IndexOf('`');
|
var genericPartIndex = type.Name.IndexOf('`');
|
||||||
Debug.Assert(genericPartIndex >= 0);
|
|
||||||
|
|
||||||
return type.Name.Substring(0, genericPartIndex);
|
return (genericPartIndex >= 0) ? type.Name.Substring(0, genericPartIndex) : type.Name;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void ProcessType(StringBuilder builder, Type type, DisplayNameOptions options)
|
private static void ProcessType(StringBuilder builder, Type type, DisplayNameOptions options)
|
||||||
|
|||||||
@ -37,14 +37,28 @@ namespace Ben.Demystifier.Test
|
|||||||
var trace = string.Join("", stackTrace.Split(new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries)
|
var trace = string.Join("", stackTrace.Split(new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries)
|
||||||
// Remove items that vary between test runners
|
// Remove items that vary between test runners
|
||||||
.Where(s =>
|
.Where(s =>
|
||||||
s != " at Task Ben.Demystifier.Test.DynamicCompilation.DoesNotPreventStackTrace()+() => { }" &&
|
(s != " at Task Ben.Demystifier.Test.DynamicCompilation.DoesNotPreventStackTrace()+() => { }" &&
|
||||||
!s.Contains("System.Threading.Tasks.Task.WaitAll")
|
!s.Contains("System.Threading.Tasks.Task.WaitAll"))
|
||||||
)
|
)
|
||||||
.Skip(1)
|
.Skip(1)
|
||||||
.ToArray())
|
.ToArray())
|
||||||
// Remove Full framework back arrow
|
// Remove Full framework back arrow
|
||||||
.Replace("<---", "");
|
.Replace("<---", "");
|
||||||
|
#if NET5_0 || NETCOREAPP3_1
|
||||||
|
var expected = string.Join("", new[] {
|
||||||
|
" ---> System.ArgumentException: Value does not fall within the expected range.",
|
||||||
|
" at async Task Ben.Demystifier.Test.AggregateException.Throw1()",
|
||||||
|
" at async void Ben.Demystifier.Test.AggregateException.DemystifiesAggregateExceptions()+(?) => { }",
|
||||||
|
" --- End of inner exception stack trace ---",
|
||||||
|
" at void Ben.Demystifier.Test.AggregateException.DemystifiesAggregateExceptions()",
|
||||||
|
" ---> (Inner Exception #1) System.NullReferenceException: Object reference not set to an instance of an object.",
|
||||||
|
" at async Task Ben.Demystifier.Test.AggregateException.Throw2()",
|
||||||
|
" at async void Ben.Demystifier.Test.AggregateException.DemystifiesAggregateExceptions()+(?) => { }",
|
||||||
|
" ---> (Inner Exception #2) System.InvalidOperationException: Operation is not valid due to the current state of the object.",
|
||||||
|
" at async Task Ben.Demystifier.Test.AggregateException.Throw3()",
|
||||||
|
" at async void Ben.Demystifier.Test.AggregateException.DemystifiesAggregateExceptions()+(?) => { }"
|
||||||
|
});
|
||||||
|
#else
|
||||||
var expected = string.Join("", new[] {
|
var expected = string.Join("", new[] {
|
||||||
" at async Task Ben.Demystifier.Test.AggregateException.Throw1()",
|
" at async Task Ben.Demystifier.Test.AggregateException.Throw1()",
|
||||||
" at async void Ben.Demystifier.Test.AggregateException.DemystifiesAggregateExceptions()+(?) => { }",
|
" at async void Ben.Demystifier.Test.AggregateException.DemystifiesAggregateExceptions()+(?) => { }",
|
||||||
@ -59,7 +73,7 @@ namespace Ben.Demystifier.Test
|
|||||||
"---> (Inner Exception #2) System.InvalidOperationException: Operation is not valid due to the current state of the object.",
|
"---> (Inner Exception #2) System.InvalidOperationException: Operation is not valid due to the current state of the object.",
|
||||||
" at async Task Ben.Demystifier.Test.AggregateException.Throw3()",
|
" at async Task Ben.Demystifier.Test.AggregateException.Throw3()",
|
||||||
" at async void Ben.Demystifier.Test.AggregateException.DemystifiesAggregateExceptions()+(?) => { }"});
|
" at async void Ben.Demystifier.Test.AggregateException.DemystifiesAggregateExceptions()+(?) => { }"});
|
||||||
|
#endif
|
||||||
Assert.Equal(expected, trace);
|
Assert.Equal(expected, trace);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -44,6 +44,7 @@ namespace Ben.Demystifier.Test
|
|||||||
s != " at void System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, object state)" &&
|
s != " at void System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, object state)" &&
|
||||||
s != " at Task Ben.Demystifier.Test.DynamicCompilation.DoesNotPreventStackTrace()+() => { }"
|
s != " at Task Ben.Demystifier.Test.DynamicCompilation.DoesNotPreventStackTrace()+() => { }"
|
||||||
)
|
)
|
||||||
|
.Select(s => Regex.Replace(s, "lambda_method[0-9]+\\(", "lambda_method("))
|
||||||
.ToArray();
|
.ToArray();
|
||||||
|
|
||||||
Assert.Equal(
|
Assert.Equal(
|
||||||
|
|||||||
@ -31,13 +31,24 @@ namespace Ben.Demystifier.Test
|
|||||||
stackTrace = LineEndingsHelper.RemoveLineEndings(stackTrace);
|
stackTrace = LineEndingsHelper.RemoveLineEndings(stackTrace);
|
||||||
var trace = stackTrace.Split(new[]{Environment.NewLine}, StringSplitOptions.None);
|
var trace = stackTrace.Split(new[]{Environment.NewLine}, StringSplitOptions.None);
|
||||||
|
|
||||||
|
#if NETCOREAPP3_1 || NET5_0
|
||||||
Assert.Equal(
|
Assert.Equal(
|
||||||
new[] {
|
new[] {
|
||||||
"System.Exception: Exception of type 'System.Exception' was thrown. ---> System.Exception: Exception of type 'System.Exception' was thrown.",
|
"System.Exception: Exception of type 'System.Exception' was thrown.",
|
||||||
|
" ---> System.Exception: Exception of type 'System.Exception' was thrown.",
|
||||||
" at Task Ben.Demystifier.Test.NonThrownException.DoesNotPreventThrowStackTrace()+() => { }",
|
" at Task Ben.Demystifier.Test.NonThrownException.DoesNotPreventThrowStackTrace()+() => { }",
|
||||||
" at async Task Ben.Demystifier.Test.NonThrownException.DoesNotPreventThrowStackTrace()",
|
" at async Task Ben.Demystifier.Test.NonThrownException.DoesNotPreventThrowStackTrace()",
|
||||||
" --- End of inner exception stack trace ---"},
|
" --- End of inner exception stack trace ---"},
|
||||||
trace);
|
trace);
|
||||||
|
#else
|
||||||
|
Assert.Equal(
|
||||||
|
new[] {
|
||||||
|
"System.Exception: Exception of type 'System.Exception' was thrown. ---> System.Exception: Exception of type 'System.Exception' was thrown.",
|
||||||
|
" at Task Ben.Demystifier.Test.NonThrownException.DoesNotPreventThrowStackTrace()+() => { }",
|
||||||
|
" at async Task Ben.Demystifier.Test.NonThrownException.DoesNotPreventThrowStackTrace()",
|
||||||
|
" --- End of inner exception stack trace ---"},
|
||||||
|
trace);
|
||||||
|
#endif
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
try
|
try
|
||||||
@ -54,6 +65,18 @@ namespace Ben.Demystifier.Test
|
|||||||
stackTrace = LineEndingsHelper.RemoveLineEndings(stackTrace);
|
stackTrace = LineEndingsHelper.RemoveLineEndings(stackTrace);
|
||||||
trace = stackTrace.Split(new[] { Environment.NewLine }, StringSplitOptions.None);
|
trace = stackTrace.Split(new[] { Environment.NewLine }, StringSplitOptions.None);
|
||||||
|
|
||||||
|
#if NETCOREAPP3_1 || NET5_0
|
||||||
|
Assert.Equal(
|
||||||
|
new[] {
|
||||||
|
"System.Exception: Exception of type 'System.Exception' was thrown.",
|
||||||
|
" ---> System.Exception: Exception of type 'System.Exception' was thrown.",
|
||||||
|
" at Task Ben.Demystifier.Test.NonThrownException.DoesNotPreventThrowStackTrace()+() => { }",
|
||||||
|
" at async Task Ben.Demystifier.Test.NonThrownException.DoesNotPreventThrowStackTrace()",
|
||||||
|
" --- End of inner exception stack trace ---",
|
||||||
|
" at async Task Ben.Demystifier.Test.NonThrownException.DoesNotPreventThrowStackTrace()"
|
||||||
|
},
|
||||||
|
trace);
|
||||||
|
#else
|
||||||
Assert.Equal(
|
Assert.Equal(
|
||||||
new[] {
|
new[] {
|
||||||
"System.Exception: Exception of type 'System.Exception' was thrown. ---> System.Exception: Exception of type 'System.Exception' was thrown.",
|
"System.Exception: Exception of type 'System.Exception' was thrown. ---> System.Exception: Exception of type 'System.Exception' was thrown.",
|
||||||
@ -63,6 +86,7 @@ namespace Ben.Demystifier.Test
|
|||||||
" at async Task Ben.Demystifier.Test.NonThrownException.DoesNotPreventThrowStackTrace()"
|
" at async Task Ben.Demystifier.Test.NonThrownException.DoesNotPreventThrowStackTrace()"
|
||||||
},
|
},
|
||||||
trace);
|
trace);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user