Azure / autorest.powershell

AutoRest PowerShell Generator
MIT License
112 stars 80 forks source link

Infinite recursion issue when traversing object properties #1333

Closed vidai-msft closed 5 months ago

vidai-msft commented 5 months ago

A typical example is https://github.com/Azure/azure-powershell/blob/main/src/DataProtection/DataProtection.Autorest/generated/api/Models/Api20231201/InnerError.cs#L37. The EmbeddedInnerError will cause infinite loop when accessing its property value.

isra-fel commented 5 months ago

@dolauli to provide RCA.

dolauli commented 5 months ago

Getter of a property will auto create an object is by design. See https://github.com/Azure/autorest.powershell/blob/main/powershell/llcsharp/model/property.ts#L78-L79 for details. We can not make the change since it will break a lot of users. @vidai-msft, for Azure PowerShell circle reference issue, I think we could still follow your proposals. If any such issue is detected either through telemetry or others way, we should put related class(model) in the exception list.