Azure / autorest.csharp

Extension for AutoRest (https://github.com/Azure/autorest) that generates C# code
MIT License
140 stars 160 forks source link

Generated samples fail to build for customized response types #4536

Open JoshLove-msft opened 3 months ago

JoshLove-msft commented 3 months ago

I have a service response of ReceiveResult. I needed to customize the return type. It wasn't possible to simply add or hide properties for the type because there were nested types that also needed to be customized. I customized the generated type to be ReceiveResultInternal, and then added a custom ReceiveResult type with custom serialization. The samples that are generated use the internal type and do not compile.

See https://github.com/Azure/azure-sdk-for-net/pull/43209/files#diff-68514ed562b597382757c424835e69135225af118d0a042def4c6014a5d7a870R416

JoshLove-msft commented 2 months ago

Another instance of this happening in https://github.com/Azure/azure-sdk-for-net/pull/42655 here - https://github.com/Azure/azure-sdk-for-net/pull/42655/files#diff-d35c1f913fe182603cd7b020c4b6eba76e4fbfeb40f2b141aa9a6fd5e298c1d9R58