Skip to content

Commit 2f5b25d

Browse files
authored
Potential wrong use of assertion (Azure#34574)
We encountered an error while using the SDK where GetAll would always throw. After looking through the code we saw that where an instance of this class is created (TrafficManagerProfileResource), the ctor with the 3rd parameter is never called. I'm guessing that's from the AutoRest codegen. Maybe adding AssertNotNull rather than AssertNull would fix the problem in the codegen? How we made it work was to use reflection to get _profileData and set it before calling GetAll()
1 parent 04dba6a commit 2f5b25d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

sdk/trafficmanager/Azure.ResourceManager.TrafficManager/src/Customization/TrafficManagerEndpointCollection.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public partial class TrafficManagerEndpointCollection : ArmCollection, IEnumerab
2525
/// /// <param name="profileData">The parent profile data. </param>
2626
internal TrafficManagerEndpointCollection(ArmClient client, ResourceIdentifier id, TrafficManagerProfileData profileData) : this(client, id)
2727
{
28-
Argument.AssertNull(profileData, nameof(profileData));
28+
Argument.AssertNotNull(profileData, nameof(profileData));
2929

3030
this._profileData = profileData;
3131
}

0 commit comments

Comments
 (0)