Storage: fix the cmdlets hang in event issue
The PR fixed 1 issues:
Call some storage cmdlets from event will hang. To fix the issue add ConfigureAwait(false) for all aycn call. (https://msdn.microsoft.com/en-us/library/system.threading.tasks.task.configureawait%28v=vs.110%29.aspx)
We have verified the cmdlets won't hang in WPF or WinForm event now. and it also work well when call from Console.
Issue Link : https://github.com/Azure/azure-powershell/issues/3205
This is a safe change since:
This is a Best Practices in Asynchronous Programming https://msdn.microsoft.com/en-us/magazine/jj991977.aspx , the exception is “Methods that require context”
For the storage cmdlets that use Async call, I have checked they are all Azure Server request or DMlib transfer job, which don’t require context. So it’s safe to add ConfigureAwait(false) to avoid the hang.
And as PowerShell is not GUI program, it’s even safe to add ConfigureAwait(false).
Storage team regression and On Demand test both pass with the code change:
This checklist is used to make sure that common guidelines for a pull request are followed. You can find a more complete discussion of PowerShell cmdlet best practices [here](https://msdn.microsoft.com/en-us/library/dd878270(v=vs.85).aspx).
- [ Y] **I have read the [contribution guidelines](https://github.com/Azure/azure-powershell/blob/dev/CONTRIBUTING.md).**
- [ Y] **If changes were made to any cmdlet, the XML help was regenerated using the [platyPSHelp module](https://github.com/Azure/azure-powershell/blob/dev/documentation/platyPSHelp-documentation.md).** - No change to interface, so no help change
- [ Y] **If any large changes are made to a service, they are reflected in the respective [change log](https://github.com/Azure/azure-powershell/blob/dev/CONTRIBUTING.md#updating-the-change-log).** -No large change
### [General Guidelines](https://github.com/Azure/azure-powershell/blob/dev/CONTRIBUTING.md#general-guidelines)
- [ Y] Title of the pull request is clear and informative.
- [Y ] There are a small number of commits, each of which have an informative message. This means that previously merged commits do not appear in the history of the PR. For more information on cleaning up the commits in your PR, [see this page](https://github.com/Azure/azure-powershell/blob/dev/documentation/cleaning-up-commits.md).
- [Y ] The pull request does not introduce [breaking changes](https://github.com/Azure/azure-powershell/blob/dev/documentation/breaking-changes.md) (unless a major version change occurs in the assembly and module).
### [Testing Guidelines](https://github.com/Azure/azure-powershell/blob/dev/CONTRIBUTING.md#testing-guidelines)
- [Y ] Pull request includes test coverage for the included changes.
- [Y] PowerShell scripts used in tests should do any necessary setup as part of the test or suite setup, and should not use hard-coded values for locations or existing resources.
### [Cmdlet Signature Guidelines](https://github.com/Azure/azure-powershell/blob/dev/CONTRIBUTING.md#cmdlet-signature-guidelines) - no cmdlet change
- [N/A ] New cmdlets that make changes or have side effects should implement `ShouldProcess` and have `SupportShouldProcess=true` specified in the cmdlet attribute. You can find more information on `ShouldProcess` [here](https://gist.github.com/markcowl/338e16fe5c8bbf195aff9f8af0db585d#what-is-the-change).
- [N/A ] Cmdlet specifies `OutputType` attribute if any output is produced - if the cmdlet produces no output, it should implement a `PassThrough` parameter.
### [Cmdlet Parameter Guidelines](https://github.com/Azure/azure-powershell/blob/dev/CONTRIBUTING.md#cmdlet-parameter-guidelines) - no cmdlets parameter change
- [N/A ] Parameter types should not expose types from the management library - complex parameter types should be defined in the module.
- [N/A ] Complex parameter types are discouraged - a parameter type should be simple types as often as possible. If complex types are used, they should be shallow and easily creatable from a constructor or another cmdlet.
- [N/A ] Cmdlet parameter sets should be mutually exclusive - each parameter set must have at least one mandatory parameter not in other parameter sets.