Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ControlFlow SwitchDetection Assertion Failed Exception #1304

Closed
bprg opened this issue Oct 21, 2018 · 1 comment
Closed

ControlFlow SwitchDetection Assertion Failed Exception #1304

bprg opened this issue Oct 21, 2018 · 1 comment

Comments

@bprg
Copy link

bprg commented Oct 21, 2018

Code

        private static int MyMethod()
        {
            int num = 0;
            while (num == 0)
            {
                num++;
            }
            if (num == 0)
                return -1;
            return num;
        }
Error decompiling ConsoleApp17.Program.MyMethod
 ---> ICSharpCode.ILSpy.AssertionFailedException: 
   at ICSharpCode.ILSpy.ILSpyTraceListener.Fail(String message, String detailMessage) in offset 380
   at ICSharpCode.ILSpy.ILSpyTraceListener.Fail(String message) in offset 9
   at System.Diagnostics.TraceInternal.Fail(String message) in offset 55
   at System.Diagnostics.Debug.Assert(Boolean condition) in offset 6
   at ICSharpCode.Decompiler.IL.ControlFlow.SwitchDetection.AnalyzeControlFlow() in offset 387
   at ICSharpCode.Decompiler.IL.ControlFlow.SwitchDetection.UseCSharpSwitch(KeyValuePair`2& defaultSection) in offset 324
   at ICSharpCode.Decompiler.IL.ControlFlow.SwitchDetection.ProcessBlock(Block block, Boolean& blockContainerNeedsCleanup) in offset 17
   at ICSharpCode.Decompiler.IL.ControlFlow.SwitchDetection.Run(ILFunction function, ILTransformContext context) in offset 106
   at ICSharpCode.Decompiler.CSharp.CSharpDecompiler.DecompileBody(IMethod method, EntityDeclaration entityDecl, DecompileRun decompileRun, ITypeResolveContext decompilationContext) in offset 581
-- continuing with outer exception (ICSharpCode.Decompiler.DecompilerException) --
   at ICSharpCode.Decompiler.CSharp.CSharpDecompiler.DecompileBody(IMethod method, EntityDeclaration entityDecl, DecompileRun decompileRun, ITypeResolveContext decompilationContext) in offset 1058
   at ICSharpCode.Decompiler.CSharp.CSharpDecompiler.DoDecompile(IMethod method, DecompileRun decompileRun, ITypeResolveContext decompilationContext) in offset 249
   at ICSharpCode.Decompiler.CSharp.CSharpDecompiler.DoDecompile(ITypeDefinition typeDef, DecompileRun decompileRun, ITypeResolveContext decompilationContext) in offset 746
   at ICSharpCode.Decompiler.CSharp.CSharpDecompiler.Decompile(IList`1 definitions) in offset 304
   at ICSharpCode.Decompiler.CSharp.CSharpDecompiler.Decompile(EntityHandle[] definitions) in offset 1
   at ICSharpCode.ILSpy.CSharpLanguage.DecompileType(ITypeDefinition type, ITextOutput output, DecompilationOptions options) in offset 79
   at ICSharpCode.ILSpy.TreeNodes.TypeTreeNode.Decompile(Language language, ITextOutput output, DecompilationOptions options) in offset 15
   at ICSharpCode.ILSpy.TextView.DecompilerTextView.DecompileNodes(DecompilationContext context, ITextOutput textOutput) in offset 69
   at ICSharpCode.ILSpy.TextView.DecompilerTextView.<>c__DisplayClass34_0.<DecompileAsync>b__0() in offset 38
@chadfords
Copy link

chadfords commented Oct 30, 2018

Same happened here. Is this related to netcore?

dgrunwald added a commit to Chicken-Bones/ILSpy that referenced this issue Nov 13, 2018
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 10, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants