Exemple #1
0
 private IUnsafeSandboxConfiguration DeserializeFromByteArray(byte[] bytes)
 {
     using (var stream = new MemoryStream(bytes))
         using (var reader = new BuildXLReader(debug: true, stream: stream, leaveOpen: true))
         {
             return(UnsafeSandboxConfigurationExtensions.Deserialize(reader));
         }
 }
Exemple #2
0
        /// <summary>
        /// Deserializes into an instance of <see cref="UnsafeOptions"/>.
        /// </summary>
        public static UnsafeOptions Deserialize(BuildXLReader reader)
        {
            Contract.Requires(reader != null);

            var unsafeConfiguration = UnsafeSandboxConfigurationExtensions.Deserialize(reader);
            var preserveOutputsInfo = reader.ReadNullableStruct(r => new PreserveOutputsInfo(r));

            return(new UnsafeOptions(unsafeConfiguration, preserveOutputsInfo));
        }
Exemple #3
0
        public void TestIsAsSafeOrSaferDynamicWriteOnAbsentProbePolicy(DynamicWriteOnAbsentProbePolicy lhs, DynamicWriteOnAbsentProbePolicy rhs, bool expectedOutcome)
        {
            XAssert.AreEqual(expectedOutcome, UnsafeSandboxConfigurationExtensions.IsAsSafeOrSafer(lhs, rhs));

            var lhsConf = new UnsafeSandboxConfiguration {
                IgnoreDynamicWritesOnAbsentProbes = lhs
            };
            var rhsConf = new UnsafeSandboxConfiguration {
                IgnoreDynamicWritesOnAbsentProbes = rhs
            };

            XAssert.AreEqual(expectedOutcome, lhsConf.IsAsSafeOrSaferThan(rhsConf));
        }