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

Unreachable code in operations #1477

Closed
molnarm opened this issue Jul 24, 2018 · 2 comments
Closed

Unreachable code in operations #1477

molnarm opened this issue Jul 24, 2018 · 2 comments

Comments

@molnarm
Copy link
Contributor

molnarm commented Jul 24, 2018

Using version 11.17.21 from NuGet.

Example yaml and generated code in a gist here.

When generating a client for operations with typed default responses, after all the different cases for status codes, an extra else branch is added to handle the default response, but after this, an extra line (line 135 in my example) is added with a return, which causes build errors because it's dead code (all branches of the status if either throw or return).

I didn't try to understand all possible cases in the corresponding template, but I see that if I remove the default response from the YAML, then there's no conditionless branch in the if-else, so this last return statement makes sense, but in other cases, it's problematic.

@RicoSuter
Copy link
Owner

Just avoiding

                    return default(ExampleClass);

in this case would solve the problem?

@molnarm
Copy link
Contributor Author

molnarm commented Jul 25, 2018

Yes, that would fix this particular case.

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

2 participants