I have an enum definition on a .NETCore server that looks as follows:
public enum SubscriptionState
{
Active = 1,
WaitingForPayment = 2,
RenewedActive = 3,
Expired = 4,
ExpiredLocked = 5,
Archived = 6,
Evaluating = 7,
}
I always init enums starting with 1 since 0 has a special meaning in my software.
This is, what is generated when I generate the DTO file in Visual Studio 2017:
public enum SubscriptionState
{
Active = Active,
WaitingForPayment = WaitingForPayment,
RenewedActive = RenewedActive,
Expired = Expired,
ExpiredLocked = ExpiredLocked,
Archived = Archived,
Evaluating = Evaluating,
}
And of course this generates an error when compiling:
1>D:\Projects\BizBusOpsManagerClient\OpsManager.DTOs\BizBusGatewayDTOs.dtos.cs(83,9,83,15): error CS0110: The evaluation of the constant value for 'SubscriptionState.Active' involves a circular definition
1>D:\Projects\BizBusOpsManagerClient\OpsManager.DTOs\BizBusGatewayDTOs.dtos.cs(84,9,84,26): error CS0110: The evaluation of the constant value for 'SubscriptionState.WaitingForPayment' involves a circular definition
1>D:\Projects\BizBusOpsManagerClient\OpsManager.DTOs\BizBusGatewayDTOs.dtos.cs(85,9,85,22): error CS0110: The evaluation of the constant value for 'SubscriptionState.RenewedActive' involves a circular definition
1>D:\Projects\BizBusOpsManagerClient\OpsManager.DTOs\BizBusGatewayDTOs.dtos.cs(86,9,86,16): error CS0110: The evaluation of the constant value for 'SubscriptionState.Expired' involves a circular definition
1>D:\Projects\BizBusOpsManagerClient\OpsManager.DTOs\BizBusGatewayDTOs.dtos.cs(87,9,87,22): error CS0110: The evaluation of the constant value for 'SubscriptionState.ExpiredLocked' involves a circular definition
1>D:\Projects\BizBusOpsManagerClient\OpsManager.DTOs\BizBusGatewayDTOs.dtos.cs(88,9,88,17): error CS0110: The evaluation of the constant value for 'SubscriptionState.Archived' involves a circular definition
1>D:\Projects\BizBusOpsManagerClient\OpsManager.DTOs\BizBusGatewayDTOs.dtos.cs(89,9,89,19): error CS0110: The evaluation of the constant value for 'SubscriptionState.Evaluating' involves a circular definition
Any idea what is going wrong here?