Browse Source

Fix #1988: handle Roslyn 3.6 task creation pattern in async/await decompiler.

Roslyn 3.6 no longer makes a redundant copy of the `AsyncTaskMethodBuilder`, but directly calls `stateMachine.<>t__builder.Start(ref stateMachine);`
pull/1994/head
Daniel Grunwald 5 years ago
parent
commit
2da513eb24
  1. 7
      ICSharpCode.Decompiler/IL/ControlFlow/AsyncAwaitDecompiler.cs

7
ICSharpCode.Decompiler/IL/ControlFlow/AsyncAwaitDecompiler.cs

@ -257,8 +257,13 @@ namespace ICSharpCode.Decompiler.IL.ControlFlow @@ -257,8 +257,13 @@ namespace ICSharpCode.Decompiler.IL.ControlFlow
return false;
pos--;
}
if (!loadBuilderExpr.MatchLdFld(out var loadStateMachineForBuilderExpr, out builderField))
if (loadBuilderExpr.MatchLdFld(out var loadStateMachineForBuilderExpr, out builderField)) {
// OK, calling Start on copy of stateMachine.<>t__builder
} else if (loadBuilderExpr.MatchLdFlda(out loadStateMachineForBuilderExpr, out builderField)) {
// OK, Roslyn 3.6 started directly calling Start without making a copy
} else {
return false;
}
builderField = (IField)builderField.MemberDefinition;
if (!(loadStateMachineForBuilderExpr.MatchLdLocRef(stateMachineVar) || loadStateMachineForBuilderExpr.MatchLdLoc(stateMachineVar)))
return false;

Loading…
Cancel
Save