diff --git a/ICSharpCode.Decompiler.Tests/TestCases/Pretty/FunctionPointers.cs b/ICSharpCode.Decompiler.Tests/TestCases/Pretty/FunctionPointers.cs index d2638e0b3..faa752bcf 100644 --- a/ICSharpCode.Decompiler.Tests/TestCases/Pretty/FunctionPointers.cs +++ b/ICSharpCode.Decompiler.Tests/TestCases/Pretty/FunctionPointers.cs @@ -107,11 +107,10 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty public unsafe delegate* F1; public unsafe delegate* F2; - // TODO: re-enable test after https://github.com/dotnet/roslyn/issues/47487 is fixed - //public unsafe int CallF1(byte b, char c, out float f) - //{ - // return F1(1, ref c, out f); - //} + public unsafe int CallF1(byte b, char c, out float f) + { + return F1(in b, ref c, out f); + } public unsafe void CallF2(byte b, char c, out float f) { diff --git a/ICSharpCode.Decompiler/IL/ControlFlow/AsyncAwaitDecompiler.cs b/ICSharpCode.Decompiler/IL/ControlFlow/AsyncAwaitDecompiler.cs index d1670735a..335dffa36 100644 --- a/ICSharpCode.Decompiler/IL/ControlFlow/AsyncAwaitDecompiler.cs +++ b/ICSharpCode.Decompiler/IL/ControlFlow/AsyncAwaitDecompiler.cs @@ -815,9 +815,11 @@ namespace ICSharpCode.Decompiler.IL.ControlFlow void CheckSetResultAndExit(BlockContainer blockContainer, Block block, ref int pos) { + // [optional] call Complete(ldflda <>t__builder(ldloc this)) (Roslyn >=3.9) // call SetResult(ldflda <>t__builder(ldloc this), ldloc result) // [optional] call Complete(ldflda <>t__builder(ldloc this)) // leave IL_0000 + MatchCompleteCall(block, ref pos); if (!MatchCall(block.Instructions[pos], "SetResult", out var args)) throw new SymbolicAnalysisFailedException(); if (!IsBuilderOrPromiseFieldOnThis(args[0])) @@ -846,12 +848,7 @@ namespace ICSharpCode.Decompiler.IL.ControlFlow break; } pos++; - if (MatchCall(block.Instructions[pos], "Complete", out args)) - { - if (!(args.Count == 1 && IsBuilderFieldOnThis(args[0]))) - throw new SymbolicAnalysisFailedException(); - pos++; - } + MatchCompleteCall(block, ref pos); if (!block.Instructions[pos].MatchLeave(blockContainer)) throw new SymbolicAnalysisFailedException(); } @@ -913,6 +910,9 @@ namespace ICSharpCode.Decompiler.IL.ControlFlow } } MatchHoistedLocalCleanup(catchBlock, ref pos); + // [optional] call Complete(ldfld <>t__builder(ldloc this)) + MatchCompleteCall(catchBlock, ref pos); + // call SetException(ldfld <>t__builder(ldloc this), ldloc exception) if (!MatchCall(catchBlock.Instructions[pos], "SetException", out var args)) throw new SymbolicAnalysisFailedException(); @@ -925,12 +925,7 @@ namespace ICSharpCode.Decompiler.IL.ControlFlow pos++; // [optional] call Complete(ldfld <>t__builder(ldloc this)) - if (MatchCall(catchBlock.Instructions[pos], "Complete", out args)) - { - if (!(args.Count == 1 && IsBuilderFieldOnThis(args[0]))) - throw new SymbolicAnalysisFailedException(); - pos++; - } + MatchCompleteCall(catchBlock, ref pos); // leave IL_0000 if (!catchBlock.Instructions[pos].MatchLeave((BlockContainer)moveNextFunction.Body)) @@ -940,6 +935,16 @@ namespace ICSharpCode.Decompiler.IL.ControlFlow throw new SymbolicAnalysisFailedException(); } + private void MatchCompleteCall(Block block, ref int pos) + { + if (MatchCall(block.Instructions[pos], "Complete", out var args)) + { + if (!(args.Count == 1 && IsBuilderFieldOnThis(args[0]))) + throw new SymbolicAnalysisFailedException(); + pos++; + } + } + bool IsBuilderFieldOnThis(ILInstruction inst) { IField field; diff --git a/packages.props b/packages.props index 9b41da256..eb8beb3ed 100644 --- a/packages.props +++ b/packages.props @@ -10,7 +10,7 @@ 5.0.0 5.0.1 5.0.0 - 3.8.0 + 3.9.0 0.11.3 6.1.1 3.12.0