autorest
autorest copied to clipboard
C# Code generator with empty models
When you have an empty model, the C# generator creates an invalid model: It has two empty constructors.
This is because of a bug in the ModelTemplate.cshtml file (https://github.com/Azure/autorest/blob/master/AutoRest/Generators/CSharp/CSharp/Templates/ModelTemplate.cshtml).
The lines 37-47 need to be wrapped in an if-statement:
if (!string.IsNullOrEmpty(Model.ConstructorParameters) {
...
}
This was fixed in the dev branch.