C# generator includes unnecessary usings in Operations files, causing compilation errors
See original GitHub issueIn our IOperations classes, when using an up to date version of AutoRest, I am seeing this change:
- using System.Linq;
+ using Microsoft.Azure;
+ using Microsoft.Azure.Batch;
using Microsoft.Rest;
using Microsoft.Rest.Azure;
+ using Microsoft.Rest.Serialization;
using Models;
+ using Newtonsoft.Json;
+ using System.Collections;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Net;
+ using System.Net.Http;
+ using System.Threading;
+ using System.Threading.Tasks;
The issue is that using Microsoft.Azure
and using 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>>
the NodeAgentSku
type is flagged as duplicate because it exists in both the Microsoft.Azure.Batch
namespace, and the Models
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)?
Issue Analytics
- State:
- Created 6 years ago
- Comments:6 (6 by maintainers)
Top GitHub Comments
Yes sir!
@dsgouda closing, I assume you have confirmed that the above specific case is fixed? 🙂 @matthchr this will be available with the next AutoRest release (right after Ignite)