-
Notifications
You must be signed in to change notification settings - Fork 742
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
C# generator includes unnecessary usings in Operations files, causing compilation errors #2558
Comments
Hmm. How long ago (ie, what autorest version) was the last code generation made? I'm surprised that it produces code that is ambiguous since it's a Roslyn based simplifier. If there is a conflict, it should have opted to use the full class names. |
We were using this previously: You can run this file: https://github.com/Azure/azure-sdk-for-net/blob/psSdkJson6/src/SDKs/Batch/DataPlane/generate.cmd and reproduce the issue. Maybe the fact that the conflicts are coming from the .sln which includes directories above the generated directory is the problem? |
The SLN shouldn't be the problem. File selection happens from the csproj file. That looks like it's probably a build from before we moved from Roslyn 1.3 to 2.0. I'm going to have to dig into this-- the simplifier shouldn't be able to produce code that doesn't compile. Can you add |
Yeah, this was the result of us bumping the Roslyn bits. It's "helping" by adding in explicit references when there are implicit references in place (ie, if your namespace is I'm going to add a directive to tweak that, it's going to show up in the 2.0 stable release in september. I can give you a scripting workaround for now... |
- There is currently a bug Azure/autorest#2558 which had to be worked around with a hacky script fix, in fixup.ps1. Once that issue is fixed we should remove fixup.ps1.
…3679) * Update to latest version of AutoRest code generator - There is currently a bug Azure/autorest#2558 which had to be worked around with a hacky script fix, in fixup.ps1. Once that issue is fixed we should remove fixup.ps1. * Remove PORTABLE from Batch.csproj
Yes sir! |
In our IOperations classes, when using an up to date version of AutoRest, I am seeing this change:
The issue is that
using Microsoft.Azure
andusing Microsoft.Azure.Batch
were added. By adding these usings (which aren't needed by the way), we now have ambiguous references in the generated code. Specifically, in the method signature:public async Task<AzureOperationResponse<IPage<NodeAgentSku>,AccountListNodeAgentSkusHeaders>>
theNodeAgentSku
type is flagged as duplicate because it exists in both theMicrosoft.Azure.Batch
namespace, and theModels
namespace.This paradigm has worked for us since we started using AutoRest -- is there a way to configure the code generator to omit the
Microsoft.Azure.Batch
using
statement (which is causing these issues and isn't needed)?The text was updated successfully, but these errors were encountered: