diff --git a/sdk/network/Azure.ResourceManager.Network/CHANGELOG.md b/sdk/network/Azure.ResourceManager.Network/CHANGELOG.md index 5a7af8e0c99a..78c7eb9b5a8d 100644 --- a/sdk/network/Azure.ResourceManager.Network/CHANGELOG.md +++ b/sdk/network/Azure.ResourceManager.Network/CHANGELOG.md @@ -1,14 +1,10 @@ # Release History -## 1.12.0-beta.1 (Unreleased) - -### Features Added - -### Breaking Changes +## 1.11.1 (2025-07-01) ### Bugs Fixed -### Other Changes +- Fixed an issue that if `LoadBalancingRuleData.FrontendIPConfigurationId` or other hidden properties on `LoadBalancingRuleData` class are assigned with values, the corresponding service operation would fail with `NullReferenceException` because the collection properties on `LoadBalancingRuleData` class are not initialized. ## 1.11.0 (2025-05-22) diff --git a/sdk/network/Azure.ResourceManager.Network/src/Azure.ResourceManager.Network.csproj b/sdk/network/Azure.ResourceManager.Network/src/Azure.ResourceManager.Network.csproj index ca158ce78b99..4a485684c409 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Azure.ResourceManager.Network.csproj +++ b/sdk/network/Azure.ResourceManager.Network/src/Azure.ResourceManager.Network.csproj @@ -1,6 +1,6 @@ - 1.12.0-beta.1 + 1.11.1 1.11.0 Azure.ResourceManager.Network diff --git a/sdk/network/Azure.ResourceManager.Network/src/Customization/LoadBalancingRuleData.cs b/sdk/network/Azure.ResourceManager.Network/src/Customization/LoadBalancingRuleData.cs index ea19aa453ace..41695ce1fbcb 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Customization/LoadBalancingRuleData.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Customization/LoadBalancingRuleData.cs @@ -3,9 +3,9 @@ #nullable disable -using System; using System.Collections.Generic; using System.ComponentModel; +using System.Runtime.CompilerServices; using Azure.Core; using Azure.ResourceManager.Network.Models; using Azure.ResourceManager.Resources.Models; @@ -14,6 +14,12 @@ namespace Azure.ResourceManager.Network { public partial class LoadBalancingRuleData : NetworkResourceData { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private void EnsureProperties() + { + Properties ??= new LoadBalancingRuleProperties(default, default); + } + /// Gets or sets Id. [EditorBrowsable(EditorBrowsableState.Never)] public ResourceIdentifier FrontendIPConfigurationId @@ -21,10 +27,7 @@ public ResourceIdentifier FrontendIPConfigurationId get => Properties?.FrontendIPConfigurationId; set { - if (Properties is null) - { - Properties = new LoadBalancingRuleProperties(); - } + EnsureProperties(); Properties.FrontendIPConfigurationId = value; } } @@ -36,17 +39,21 @@ public ResourceIdentifier BackendAddressPoolId get => Properties?.BackendAddressPoolId; set { - if (Properties is null) - { - Properties = new LoadBalancingRuleProperties(); - } + EnsureProperties(); Properties.BackendAddressPoolId = value; } } /// An array of references to pool of DIPs. [EditorBrowsable(EditorBrowsableState.Never)] - public IList BackendAddressPools => Properties?.BackendAddressPools; + public IList BackendAddressPools + { + get + { + EnsureProperties(); + return Properties.BackendAddressPools; + } + } /// Gets or sets Id. [EditorBrowsable(EditorBrowsableState.Never)] @@ -55,10 +62,7 @@ public ResourceIdentifier ProbeId get => Properties?.ProbeId; set { - if (Properties is null) - { - Properties = new LoadBalancingRuleProperties(); - } + EnsureProperties(); Properties.ProbeId = value; } } @@ -70,10 +74,7 @@ public LoadBalancingTransportProtocol? Protocol get => Properties?.Protocol; set { - if (Properties is null) - { - Properties = new LoadBalancingRuleProperties(); - } + EnsureProperties(); Properties.Protocol = value ?? default; } } @@ -85,10 +86,7 @@ public LoadDistribution? LoadDistribution get => Properties?.LoadDistribution; set { - if (Properties is null) - { - Properties = new LoadBalancingRuleProperties(); - } + EnsureProperties(); Properties.LoadDistribution = value; } } @@ -100,10 +98,7 @@ public int? FrontendPort get => Properties?.FrontendPort; set { - if (Properties is null) - { - Properties = new LoadBalancingRuleProperties(); - } + EnsureProperties(); Properties.FrontendPort = value ?? default; } } @@ -115,10 +110,7 @@ public int? BackendPort get => Properties?.BackendPort; set { - if (Properties is null) - { - Properties = new LoadBalancingRuleProperties(); - } + EnsureProperties(); Properties.BackendPort = value; } } @@ -130,10 +122,7 @@ public int? IdleTimeoutInMinutes get => Properties?.IdleTimeoutInMinutes; set { - if (Properties is null) - { - Properties = new LoadBalancingRuleProperties(); - } + EnsureProperties(); Properties.IdleTimeoutInMinutes = value; } } @@ -145,10 +134,7 @@ public bool? EnableFloatingIP get => Properties?.EnableFloatingIP; set { - if (Properties is null) - { - Properties = new LoadBalancingRuleProperties(); - } + EnsureProperties(); Properties.EnableFloatingIP = value; } } @@ -160,10 +146,7 @@ public bool? EnableTcpReset get => Properties?.EnableTcpReset; set { - if (Properties is null) - { - Properties = new LoadBalancingRuleProperties(); - } + EnsureProperties(); Properties.EnableTcpReset = value; } } @@ -175,10 +158,7 @@ public bool? DisableOutboundSnat get => Properties?.DisableOutboundSnat; set { - if (Properties is null) - { - Properties = new LoadBalancingRuleProperties(); - } + EnsureProperties(); Properties.DisableOutboundSnat = value; } }