I previously sent this in an email with the link given at the bottom of the given stack trace but never got any response. Thought I'd try here.
Error message:
Current member / type: System.Collections.Generic.IEnumerable`1<System.Int32> TryYieldTest.Class1::Test()
File path: C:\Projects\TryYieldTest\TryYieldTest\bin\Debug\TryYieldTest.dll
Product version: 2015.2.623.1
Exception in: System.Collections.Generic.IEnumerable<u<System.Int32>> Test()
Could not determine the end ot the
try
block
at ..( )
in
c:\Builds\245\Behemoth\ReleaseBranch Production Build\Sources\OpenSource\Cecil.Decompiler\Decompiler\LogicFlow\YieldGuardedBlocksBuilder.cs:line 136
at ..( )
in
c:\Builds\245\Behemoth\ReleaseBranch Production Build\Sources\OpenSource\Cecil.Decompiler\Decompiler\LogicFlow\YieldGuardedBlocksBuilder.cs:line 76
at ..()
in
c:\Builds\245\Behemoth\ReleaseBranch Production Build\Sources\OpenSource\Cecil.Decompiler\Decompiler\LogicFlow\LogicalFlowBuilderStep.cs:line 126
at ..( )
in
c:\Builds\245\Behemoth\ReleaseBranch Production Build\Sources\OpenSource\Cecil.Decompiler\Decompiler\LogicFlow\LogicalFlowBuilderStep.cs:line 51
at ..(MethodBody ILanguage )
in
c:\Builds\245\Behemoth\ReleaseBranch Production Build\Sources\OpenSource\Cecil.Decompiler\Decompiler\DecompilationPipeline.cs:line 88
at ..(MethodBody ILanguage )
in
c:\Builds\245\Behemoth\ReleaseBranch Production Build\Sources\OpenSource\Cecil.Decompiler\Decompiler\DecompilationPipeline.cs:line 70
at ..(MethodBody Func`2 )
in
c:\Builds\245\Behemoth\ReleaseBranch Production Build\Sources\OpenSource\Cecil.Decompiler\Decompiler\Extensions.cs:line 112
at ..(MethodBody )
in
c:\Builds\245\Behemoth\ReleaseBranch Production Build\Sources\OpenSource\Cecil.Decompiler\Decompiler\Extensions.cs:line 146
at ..()
in
c:\Builds\245\Behemoth\ReleaseBranch Production Build\Sources\OpenSource\Cecil.Decompiler\Steps\RebuildYieldStatementsStep.cs:line 149
at ..Match( )
in
c:\Builds\245\Behemoth\ReleaseBranch Production Build\Sources\OpenSource\Cecil.Decompiler\Steps\RebuildYieldStatementsStep.cs:line 49
at ..( )
in
c:\Builds\245\Behemoth\ReleaseBranch Production Build\Sources\OpenSource\Cecil.Decompiler\Steps\RebuildYieldStatementsStep.cs:line 20
at ..(MethodBody ILanguage )
in
c:\Builds\245\Behemoth\ReleaseBranch Production Build\Sources\OpenSource\Cecil.Decompiler\Decompiler\DecompilationPipeline.cs:line 88
at ..(MethodBody ILanguage )
in
c:\Builds\245\Behemoth\ReleaseBranch Production Build\Sources\OpenSource\Cecil.Decompiler\Decompiler\DecompilationPipeline.cs:line 70
at ..( ILanguage MethodBody )
in
c:\Builds\245\Behemoth\ReleaseBranch Production Build\Sources\OpenSource\Cecil.Decompiler\Decompiler\Extensions.cs:line 99
at ..(MethodBody ILanguage )
in
c:\Builds\245\Behemoth\ReleaseBranch Production Build\Sources\OpenSource\Cecil.Decompiler\Decompiler\Extensions.cs:line 62
at ..(ILanguage MethodDefinition )
in
c:\Builds\245\Behemoth\ReleaseBranch Production Build\Sources\OpenSource\Cecil.Decompiler\Decompiler\WriterContextServices\BaseWriterContextService.cs:line 116
_______________________________________
Seems to be caused by a yield break inside of a try.
Original source:
01.
using
System.Collections.Generic;
02.
03.
namespace
TryYieldTest
04.
{
05.
public
class
Class1
06.
{
07.
public
IEnumerable<
int
> Test()
08.
{
09.
int
x = 0;
10.
11.
try
12.
{
13.
while
(
true
)
14.
{
15.
if
(x == 5)
16.
{
17.
yield
break
;
18.
}
19.
else
20.
{
21.
yield
return
x;
22.
}
23.
}
24.
}
25.
finally
26.
{
27.
28.
}
29.
}
30.
}
31.
}