Beispiel #1
0
 private PSSenderInfo(SerializationInfo info, StreamingContext context)
 {
     if (info != null)
     {
         string source = null;
         try
         {
             source = info.GetValue("CliXml", typeof(string)) as string;
         }
         catch (Exception)
         {
             return;
         }
         if (source != null)
         {
             try
             {
                 PSSenderInfo info2 = DeserializingTypeConverter.RehydratePSSenderInfo(PSObject.AsPSObject(PSSerializer.Deserialize(source)));
                 this.userPrinicpal        = info2.userPrinicpal;
                 this.clientTimeZone       = info2.ClientTimeZone;
                 this.connectionString     = info2.connectionString;
                 this.applicationArguments = info2.applicationArguments;
             }
             catch (Exception)
             {
                 return;
             }
         }
     }
 }
Beispiel #2
0
        /// <summary>
        /// Deserialization constructor
        /// </summary>
        /// <param name="info"></param>
        /// <param name="context"></param>
        private PSSenderInfo(SerializationInfo info, StreamingContext context)
        {
            if (info == null)
            {
                return;
            }

            string serializedData = null;

            try
            {
                serializedData = info.GetValue("CliXml", typeof(string)) as string;
            }
            catch (Exception)
            {
                // When a workflow is run locally, there won't be PSSenderInfo
                return;
            }

            if (serializedData == null)
            {
                return;
            }

            try
            {
                PSObject     result     = PSObject.AsPSObject(PSSerializer.Deserialize(serializedData));
                PSSenderInfo senderInfo = DeserializingTypeConverter.RehydratePSSenderInfo(result);

                UserInfo              = senderInfo.UserInfo;
                ConnectionString      = senderInfo.ConnectionString;
                _applicationArguments = senderInfo._applicationArguments;

#if !CORECLR // TimeZone Not In CoreCLR
                this.clientTimeZone = senderInfo.ClientTimeZone;
#endif
            }
            catch (Exception)
            {
                // Ignore conversion errors
                return;
            }
        }