internal static void Validate(ApplicationUpgradeDescription description)
        {
            Requires.Argument <Uri>("ApplicationName", description.ApplicationName).NotNullOrWhiteSpace();
            Requires.Argument <string>("TargetApplicationTypeVersion", description.TargetApplicationTypeVersion).NotNullOrWhiteSpace();
            Requires.Argument <UpgradePolicyDescription>("UpgradePolicyDescription", description.UpgradePolicyDescription).NotNull();

            description.UpgradePolicyDescription.Validate();
        }
        internal static unsafe ApplicationUpgradeDescription FromNative(IntPtr descriptionPtr)
        {
            if (descriptionPtr == IntPtr.Zero)
            {
                return(null);
            }

            var castedPtr = (NativeTypes.FABRIC_APPLICATION_UPGRADE_DESCRIPTION *)descriptionPtr;

            var description = new ApplicationUpgradeDescription();

            description.ApplicationName = NativeTypes.FromNativeUri(castedPtr->ApplicationName);
            description.TargetApplicationTypeVersion = NativeTypes.FromNativeString(castedPtr->TargetApplicationTypeVersion);

            if (castedPtr->ApplicationParameters != IntPtr.Zero)
            {
                var castedParamsPtr = (NativeTypes.FABRIC_APPLICATION_PARAMETER_LIST *)castedPtr->ApplicationParameters;
                var parametersList  = ApplicationParameterList.FromNative(castedParamsPtr);
                description.ApplicationParameters = parametersList.AsNameValueCollection();
            }

            if (castedPtr->UpgradeKind == NativeTypes.FABRIC_APPLICATION_UPGRADE_KIND.FABRIC_APPLICATION_UPGRADE_KIND_ROLLING &&
                castedPtr->UpgradePolicyDescription != IntPtr.Zero)
            {
                RollingUpgradePolicyDescription policy = null;

                var castedPolicyPtr = (NativeTypes.FABRIC_ROLLING_UPGRADE_POLICY_DESCRIPTION *)castedPtr->UpgradePolicyDescription;

                if (castedPolicyPtr->RollingUpgradeMode == NativeTypes.FABRIC_ROLLING_UPGRADE_MODE.FABRIC_ROLLING_UPGRADE_MODE_MONITORED)
                {
                    policy = MonitoredRollingApplicationUpgradePolicyDescription.FromNative(castedPtr->UpgradePolicyDescription);
                }
                else
                {
                    policy = RollingUpgradePolicyDescription.FromNative(castedPtr->UpgradePolicyDescription);
                }

                description.UpgradePolicyDescription = policy;
            }

            return(description);
        }