Skip to content

Modify New-AzVmss Vmss Flex defaulting logic to avoid null reference errors #17610

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Mar 31, 2022

Conversation

Sandido
Copy link
Contributor

@Sandido Sandido commented Mar 24, 2022

Description

New-AzVmss when used with a VmssConfig object with OrchestrationMode set (Vmss Flex) hits a null reference error.
This was due to an incorrect usage of the c# syntax 'object?.property?.property2 == null' if check. This caused null to be returned not only when property2 was null, but when property was null. When the code in the if check then referred to property, a null reference occurred.

This update will prevent this issue by adding an explicit if check for object?.property != null before proceeding with the code.

Checklist

  • I have read the Submitting Changes section of CONTRIBUTING.md
  • The title of the PR is clear and informative
  • The appropriate ChangeLog.md file(s) has been updated:
    • For any service, the ChangeLog.md file can be found at src/{{SERVICE}}/{{SERVICE}}/ChangeLog.md
    • A snippet outlining the change(s) made in the PR should be written under the ## Upcoming Release header -- no new version header should be added
  • The PR does not introduce breaking changes
  • If applicable, the changes made in the PR have proper test coverage
  • For public API changes to cmdlets:

@Sandido Sandido changed the title MOdify New-AzVmss Vmss Flex defaulting logic to avoid null reference errors Modify New-AzVmss Vmss Flex defaulting logic to avoid null reference errors Mar 24, 2022
@Sandido Sandido marked this pull request as ready for review March 28, 2022 14:21
@dingmeng-xue dingmeng-xue changed the base branch from main to release-2022-04-05 March 31, 2022 06:36
@BethanyZhou BethanyZhou merged commit bae0919 into release-2022-04-05 Mar 31, 2022
@isra-fel isra-fel deleted the adsandor/flexbug branch March 31, 2022 07:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants