-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Prevent assert if stack trace has function pointer #63787
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 8 commits
6b7c32a
301bce4
d19c78f
97d04b9
723a237
0ea16ce
25e4b89
ee5c9e4
eb91287
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -312,6 +312,21 @@ public void ToString_NullFrame_ThrowsNullReferenceException() | |
Assert.Equal(Environment.NewLine, stackTrace.ToString()); | ||
} | ||
|
||
[Fact] | ||
public unsafe void ToString_FunctionPointerSignature() | ||
{ | ||
// This is sepate from ToString_Invoke_ReturnsExpected since unsafe cannot be used for iterators | ||
var stackTrace = FunctionPointerParameter(null); | ||
if (PlatformDetection.IsMonoRuntime) | ||
{ | ||
Assert.Contains("System.Diagnostics.Tests.StackTraceTests.FunctionPointerParameter(MonoFNPtrFakeClass x)", stackTrace.ToString()); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The Mono behavior is a bug that we'll want to fix eventually. Could you instead add (It doesn't make sense to cut a new bug for it; we have plenty of Mono bugs - Mono will either be fixed when 11354 is fixed, or there will be a new Mono-specific bug that we'll need to open as part of fixing 11354 to block all the failing tests added at that point.) |
||
} | ||
else | ||
{ | ||
Assert.Contains("System.Diagnostics.Tests.StackTraceTests.FunctionPointerParameter(IntPtr x)", stackTrace.ToString()); | ||
} | ||
} | ||
|
||
[ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] | ||
public void ToString_ShowILOffset() | ||
{ | ||
|
@@ -384,6 +399,9 @@ public void ToString_ShowILOffset() | |
[MethodImpl(MethodImplOptions.NoOptimization | MethodImplOptions.NoInlining)] | ||
private static StackTrace TwoParameters(int x, string y) => new StackTrace(); | ||
|
||
[MethodImpl(MethodImplOptions.NoOptimization | MethodImplOptions.NoInlining)] | ||
kant2002 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
private unsafe static StackTrace FunctionPointerParameter(delegate*<void> x) => new StackTrace(); | ||
|
||
[MethodImpl(MethodImplOptions.NoOptimization | MethodImplOptions.NoInlining)] | ||
private static StackTrace Generic<T>() => new StackTrace(); | ||
[MethodImpl(MethodImplOptions.NoOptimization | MethodImplOptions.NoInlining)] | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Usage of explicit type (for reference: Coding Guidelines))
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see
var
style used a lot in this file. I would say most of the time.