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

Regression in 1.4.13 with SYNC_ONLY #90

Open
persn opened this issue Feb 25, 2025 · 0 comments
Open

Regression in 1.4.13 with SYNC_ONLY #90

persn opened this issue Feb 25, 2025 · 0 comments

Comments

@persn
Copy link

persn commented Feb 25, 2025

I have the following code using version 1.4.11, it generates the code as I expect it to

        [Zomp.SyncMethodGenerator.CreateSyncVersion(OmitNullableDirective = true)]
        public async Task Foo3Async()
        {
            string a = await Task.FromResult("");
            int b = 0;

            if (a != null)
            {
                b = 50;
            }

#if SYNC_ONLY
            _ = a + b;
#else
            _ = a + b + await Task.FromResult(30);
#endif
        }

However if I upgrade to 1.4.13 the generated code drops the if, this happens completely silently without compiler failures so an unknown amount of code is affected by this problem. As a result I cannot upgrade the NuGet for my project because it's too dangerous. This issue is similar to #45, but is different because the #if SYNC_ONLY doesn't touch the if keyword directly, and it wasn't present in the versions before 1.4.13

        public void Foo()
        {
            string a = "";
            int b = 0;

            _ = a + b;
        }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant