Skip to content

Fail on self-decompilation #3441

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

Open
greenozon opened this issue Mar 30, 2025 · 1 comment
Open

Fail on self-decompilation #3441

greenozon opened this issue Mar 30, 2025 · 1 comment
Labels
Bug Decompiler The decompiler engine itself

Comments

@greenozon
Copy link

Input code

One of the ILSpy dlls failed to decompile
McMaster.Extensions.CommandLineUtils.dll

Erroneous output

Error decompiling for 'McMaster.Extensions.CommandLineUtils.Abstractions\StockValueParsers.cs'
in assembly "C:\IL9\McMaster.Extensions.CommandLineUtils.dll"
 ---> ICSharpCode.ILSpy.AssertionFailedException: 
   at ICSharpCode.ILSpy.ILSpyTraceListener.Fail(String message, String detailMessage) in offset 379
   at System.Diagnostics.TraceInternal.Fail(String message, String detailMessage) in offset 48
   at System.Diagnostics.Debug.Fail(String message, String detailMessage) in offset 0
   at ICSharpCode.Decompiler.CSharp.Transforms.DeclareVariables.ResolveCollisions() in DeclareVariables.cs:line 483
   at ICSharpCode.Decompiler.CSharp.Transforms.DeclareVariables.Analyze(AstNode rootNode) in DeclareVariables.cs:line 173
   at ICSharpCode.Decompiler.CSharp.Transforms.PatternStatementTransform.Run(AstNode rootNode, TransformContext context) in PatternStatementTransform.cs:line 47
   at ICSharpCode.Decompiler.CSharp.CSharpDecompiler.RunTransforms(AstNode rootNode, DecompileRun decompileRun, ITypeResolveContext decompilationContext) in CSharpDecompiler.cs:line 572
   at ICSharpCode.Decompiler.CSharp.CSharpDecompiler.DecompileTypes(IEnumerable`1 types) in CSharpDecompiler.cs:line 958
   at ICSharpCode.Decompiler.CSharp.ProjectDecompiler.WholeProjectDecompiler.<>c__DisplayClass46_0.<WriteCodeFilesInProject>b__5(IGrouping`2 file) in WholeProjectDecompiler.cs:line 290
-- continuing with outer exception (ICSharpCode.Decompiler.DecompilerException) --
   at ICSharpCode.Decompiler.CSharp.ProjectDecompiler.WholeProjectDecompiler.<>c__DisplayClass46_0.<WriteCodeFilesInProject>b__5(IGrouping`2 file) in WholeProjectDecompiler.cs:line 314
   at System.Threading.Tasks.Parallel.<>c__DisplayClass43_0`2.<PartitionerForEachWorker>b__1(IEnumerator& partitionState, Int64 timeout, Boolean& replicationDelegateYieldedBeforeCompletion) in offset 259
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() in offset 17
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw(Exception source) in offset 0
   at System.Threading.Tasks.Parallel.<>c__DisplayClass43_0`2.<PartitionerForEachWorker>b__1(IEnumerator& partitionState, Int64 timeout, Boolean& replicationDelegateYieldedBeforeCompletion) in offset 609
   at System.Threading.Tasks.TaskReplicator.Replica.Execute() in offset 35

Details

  • Product in use:
  • ILSpy version 9.0.0.7953+247f161eb35b9159705a92c73c8cf83d0c5e71e4
  • .NET version 8.0.11+9cb3b725e3ad2b57ddc9fb2dd48d2d170563a8f5
@greenozon greenozon added Bug Decompiler The decompiler engine itself labels Mar 30, 2025
@siegfriedpammer
Copy link
Member

@dgrunwald this is a bug in DeclareVariables. It doesn't properly handle variables in disjunct scopes that have the same name. Not sure, if that is specific to out variables, but in this case the variables involved are out variables.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Decompiler The decompiler engine itself
Projects
None yet
Development

No branches or pull requests

2 participants