Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,6 @@ public static async Task Test2(int i)
{
throw new NullReferenceException("Exception from Test2");
}

[MethodImpl(MethodImplOptions.NoOptimization | MethodImplOptions.NoInlining)]
[System.Runtime.CompilerServices.RuntimeAsyncMethodGeneration(false)]
#line 1 "EdiOuter.cs"
public static async Task EdiOuter()
{
await V2Methods.EdiMiddle();
}
}

public class V2Methods
Expand Down Expand Up @@ -214,22 +206,6 @@ public static async Task Baz()
if (Random.Shared.Next(1) == 100) await Task.Yield();
throw new Exception("Exception from Baz method.");
}

[MethodImpl(MethodImplOptions.NoOptimization | MethodImplOptions.NoInlining)]
[System.Runtime.CompilerServices.RuntimeAsyncMethodGeneration(true)]
#line 1 "EdiMiddle.cs"
public static async Task EdiMiddle()
{
await EdiInner();
}

[MethodImpl(MethodImplOptions.NoOptimization | MethodImplOptions.NoInlining)]
[System.Runtime.CompilerServices.RuntimeAsyncMethodGeneration(true)]
#line 1 "EdiInner.cs"
public static async Task EdiInner()
{
throw new InvalidOperationException("Exception from EdiInner");
}
}
}
#line default
Expand Down Expand Up @@ -664,12 +640,6 @@ private static string FileInfoPattern(string fileLinePattern) =>
@"V2Methods\.Baz\(\)" + FileInfoPattern(@".*Baz.*\.cs:line 4"),
@"V2Methods\.Bux\(\)" + FileInfoPattern(@".*Bux.*\.cs:line 6")
}},
{ "EdiOuter", new[] {
@"Exception from EdiInner",
@"V2Methods\.EdiInner\(\)" + FileInfoPattern(@".*EdiInner.*\.cs:line 3"),
@"V2Methods\.EdiMiddle\(\)" + FileInfoPattern(@".*EdiMiddle.*\.cs:line 3"),
@"V1Methods.*EdiOuter"
}},
};

public static IEnumerable<object[]> Ctor_Async_TestData()
Expand All @@ -679,7 +649,6 @@ public static IEnumerable<object[]> Ctor_Async_TestData()
yield return new object[] { () => V2Methods.Quux(), MethodExceptionStrings["Quux"] };
yield return new object[] { () => V2Methods.Quuux(), MethodExceptionStrings["Quuux"] };
yield return new object[] { () => V2Methods.Bux(), MethodExceptionStrings["Bux"] };
yield return new object[] { () => V1Methods.EdiOuter(), MethodExceptionStrings["EdiOuter"] };
}

[ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsRuntimeAsyncSupported))]
Expand Down Expand Up @@ -708,7 +677,6 @@ public async Task ToString_Async(Func<Task> asyncMethod, string[] expectedPatter
Assert.True(match.Success, $"Could not find expected pattern '{pattern}' in exception text:\n{exceptionText} starting at index {startIndex}.");
startIndex = match.Index + match.Length;
}
Assert.DoesNotContain("--- End of stack trace from previous location ---", exceptionText);
}
Comment thread
rcj1 marked this conversation as resolved.

[MethodImpl(MethodImplOptions.NoOptimization | MethodImplOptions.NoInlining)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,11 +237,11 @@ internal void ToString(TraceFormat traceFormat, StringBuilder sb)

sb.Append(" ").Append(word_At).Append(' ');

bool isAsync = (mb.MethodImplementationFlags & MethodImplAttributes.Async) != 0;
bool isAsync = false;
Type? declaringType = mb.DeclaringType;
string methodName = mb.Name;
bool methodChanged = false;
if (!isAsync && declaringType != null && IsDefinedSafe(declaringType, typeof(CompilerGeneratedAttribute), inherit: false))
if (declaringType != null && IsDefinedSafe(declaringType, typeof(CompilerGeneratedAttribute), inherit: false))
{
isAsync = declaringType.IsAssignableTo(typeof(IAsyncStateMachine));
if (isAsync || declaringType.IsAssignableTo(typeof(IEnumerator)))
Expand Down
Loading