Imported Upstream version 5.4.0.167

Former-commit-id: 5624ac747d633e885131e8349322922b6a59baaa
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2017-08-21 15:34:15 +00:00
parent e49d6f06c0
commit 536cd135cc
12856 changed files with 563812 additions and 223249 deletions

View File

@ -37,7 +37,6 @@ namespace System.Activities.Debugger
static Type threadWorkerControllerType = typeof(ThreadWorkerController);
static MethodInfo islandWorkerMethodInfo = threadWorkerControllerType.GetMethod("IslandWorker", BindingFlags.Static | BindingFlags.Public);
const string Md5Identifier = "406ea660-64cf-4c82-b6f0-42d48172a799";
internal const string MethodWithPrimingPrefix = "_";
List<LogicalThread> threads;
@ -681,7 +680,7 @@ namespace System.Activities.Debugger
[SecurityCritical]
void InitDynamicModule(string asmName)
{
// See http://blogs.msdn.com/[....]/archive/2005/02/03/366429.aspx for a simple example
// See http://blogs.msdn.com/Microsoft/archive/2005/02/03/366429.aspx for a simple example
// of debuggable reflection-emit.
Fx.Assert(dynamicModule == null, "can only be initialized once");
@ -791,7 +790,7 @@ namespace System.Activities.Debugger
if (checksumBytes != null)
{
documentWriter.SetCheckSum(new Guid(Md5Identifier), checksumBytes);
documentWriter.SetCheckSum(SymbolHelper.ChecksumProviderId, checksumBytes);
}
}
return documentWriter;

View File

@ -14,6 +14,24 @@ namespace System.Activities.Debugger.Symbol
internal static class SymbolHelper
{
static readonly Guid Md5IdentifierGuid = new Guid("406ea660-64cf-4c82-b6f0-42d48172a799");
static readonly Guid Sha1IdentifierGuid = new Guid("ff1816ec-aa5e-4d10-87f7-6f4963833460");
public static Guid ChecksumProviderId
{
get
{
if (LocalAppContextSwitches.UseMD5ForWFDebugger)
{
return Md5IdentifierGuid;
}
else
{
return Sha1IdentifierGuid;
}
}
}
// This is the same Encode/Decode logic as the WCF FramingEncoder
public static int ReadEncodedInt32(BinaryReader reader)
{
@ -61,8 +79,6 @@ namespace System.Activities.Debugger.Symbol
return count;
}
[SuppressMessage("Microsoft.Cryptographic.Standard", "CA5350:MD5CannotBeUsed",
Justification = "Design has been approved. We are not using MD5 for any security or cryptography purposes but rather as a hash.")]
public static byte[] CalculateChecksum(string fileName)
{
Fx.Assert(!string.IsNullOrEmpty(fileName), "fileName should not be empty or null");
@ -71,8 +87,10 @@ namespace System.Activities.Debugger.Symbol
{
using (StreamReader streamReader = new StreamReader(fileName))
{
MD5 md5 = new MD5CryptoServiceProvider();
checksum = md5.ComputeHash(streamReader.BaseStream);
using (HashAlgorithm hashAlgorithm = CreateHashProvider())
{
checksum = hashAlgorithm.ComputeHash(streamReader.BaseStream);
}
}
}
catch (IOException)
@ -108,7 +126,28 @@ namespace System.Activities.Debugger.Symbol
internal static bool ValidateChecksum(byte[] checksumToValidate)
{
// We are using MD5.ComputeHash, which will return a 16 byte array.
return checksumToValidate.Length == 16;
if (LocalAppContextSwitches.UseMD5ForWFDebugger)
{
return checksumToValidate.Length == 16;
}
else
{
return checksumToValidate.Length == 20;
}
}
[SuppressMessage("Microsoft.Cryptographic.Standard", "CA5350:MD5CannotBeUsed",
Justification = "Design has been approved. We are not using MD5 for any security or cryptography purposes but rather as a hash.")]
static HashAlgorithm CreateHashProvider()
{
if (LocalAppContextSwitches.UseMD5ForWFDebugger)
{
return new MD5CryptoServiceProvider();
}
else
{
return new SHA1CryptoServiceProvider();
}
}
}
}

View File

@ -1 +1 @@
b9cf8fe7e52450ceff6d1c34154cba802c4c505e
417960427bfc30cc142d10ff973cd735255bf300

View File

@ -599,7 +599,7 @@ namespace System.Activities.Runtime
}
// We need to null this out once we've recreated the dictionary to avoid
// having out of [....] data
// having out of sync data
this.rawDeserializedLists = null;
// then walk our instance list, fixup parent references, and perform basic validation

View File

@ -114,12 +114,12 @@ namespace System.Activities.Statements
}
}
return BeginMakeMethodCall(context, targetInstance, callback, state); // defer to concrete instance for [....]/async variations
return BeginMakeMethodCall(context, targetInstance, callback, state); // defer to concrete instance for sync/async variations
}
public void EndExecuteMethod(AsyncCodeActivityContext context, IAsyncResult result)
{
EndMakeMethodCall(context, result); // defer to concrete instance for [....]/async variations
EndMakeMethodCall(context, result); // defer to concrete instance for sync/async variations
}
[SuppressMessage("Reliability", "Reliability108:IsFatalRule",

View File

@ -355,7 +355,7 @@ namespace System.Activities.Statements
{
return null;
}
else // For a regular [....] method, ambiguity is distinct from no match and gets an explicit error message
else // For a regular sync method, ambiguity is distinct from no match and gets an explicit error message
{
throw;
}

View File

@ -1 +1 @@
ff9b74d7295d3a52cf91057ee647d184edec0c5e
952c17975ba5a0c0d5e525db02d26f5ee47de911

View File

@ -74,7 +74,7 @@ namespace System.Activities
{
// In the interest of allocating less objects we don't implement
// the full async pattern here. Instead, we've flattened it to
// do the [....] part and then optionally delegate down to the inner
// do the sync part and then optionally delegate down to the inner
// BeginCommit.
if (this.contextOwnedTransaction != null)