Skip to content
Merged
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 @@ -737,6 +737,10 @@ public bool TryGetUserMethodForCompilerGeneratedMember(TypeSystemEntity sourceMe
if (sourceMember == null)
return false;

Debug.Assert(sourceMember is not MethodDesc sourceMethod || sourceMethod.IsTypicalMethodDefinition);
if (sourceMember is AsyncMethodVariant asyncVariant)
sourceMember = asyncVariant.Target;

TypeSystemEntity member = sourceMember;
MethodDesc? userMethodCandidate;
while (TryGetOwningMethodForCompilerGeneratedMember(member, out userMethodCandidate))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

using System;
using System.Diagnostics.CodeAnalysis;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Threading.Tasks;
using Mono.Linker.Tests.Cases.Expectations.Assertions;
Expand All @@ -28,6 +29,7 @@ public static async Task Main()
await RuntimeAsyncWithCorrectParameter(null);
await RuntimeAsyncWithLocalAll();
await RuntimeAsyncWithLambda();
await RuntimeAsyncWithAwaitedLocalMethod();
}

static async Task BasicRuntimeAsyncMethod()
Expand Down Expand Up @@ -116,5 +118,16 @@ static async Task RuntimeAsyncWithLambda()
{
await Task.Run([ExpectedWarning("IL2026", nameof(TypeWithRucMethod.RucMethod))] () => typeof(TypeWithRucMethod).GetMethods());
}

static async Task RuntimeAsyncWithAwaitedLocalMethod()
{
await GetTheMethods();

[ExpectedWarning("IL2026", nameof(TypeWithRucMethod.RucMethod))]
static async Task<MethodInfo[]> GetTheMethods()
{
return typeof(TypeWithRucMethod).GetMethods();
}
}
}
}
Loading