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

yield-return decompiler failed #3400

Open
CreateAndInject opened this issue Feb 15, 2025 · 3 comments
Open

yield-return decompiler failed #3400

CreateAndInject opened this issue Feb 15, 2025 · 3 comments
Labels
Bug Decompiler The decompiler engine itself

Comments

@CreateAndInject
Copy link
Contributor

Original:

        public static IEnumerable<int> Enumerate()
        {
            for (int i = 0; i < 10; i++)
            {
                int result;
                try
                {
                    result = DateTime.Now.Second;
                }
                catch
                {
                    continue;
                }
                yield return result;
            }
        }

ILSpy:

[IteratorStateMachine(typeof(<Enumerate>d__1))]
public static IEnumerable<int> Enumerate()
{
	//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
	return new <Enumerate>d__1(-2);
}
@CreateAndInject CreateAndInject added Bug Decompiler The decompiler engine itself labels Feb 15, 2025
@siegfriedpammer
Copy link
Member

Duplicate of #3396

@siegfriedpammer siegfriedpammer marked this as a duplicate of #3396 Feb 15, 2025
@CreateAndInject
Copy link
Contributor Author

CreateAndInject commented Feb 15, 2025

@siegfriedpammer
But my target is .NET Framework 3.5 rather than .NET 9

Seems compiler change something, ILSpy doesn't work even if such code:

        public static IEnumerable<int> Enumerate()
        {
            for (int i = 0; i < 10; i++)
            {
                yield return i;
            }
        }

@siegfriedpammer
Copy link
Member

siegfriedpammer commented Feb 15, 2025

Yes, exactly, from time to time, the roslyn team is changing their code gen a bit and we need to update the decompiler to support that. Unfortunately, currently there is no publicly available nuget package containing these changes. Usually we update our decompiler tests to always include the latest version of the compiler, but we only can do that if there is a nuget available. Usually, the package is updated in time with each release of VS, but it seems that this time, they take longer to publish the packages. I'd prefer to wait for the official release from nuget to be able to test all the language features at once, without having to resort to hacks or manually writing tests, because it is more time consuming than just following our usual procedure.

Thank you for your understanding.

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