提交 5faaf627 编写于 作者: C CyrusNajmabadi

Fix RPS regression due to overly aggressive assertions.

上级 54efe21b
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Diagnostics;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
......@@ -109,12 +110,18 @@ public void AssertIsForeground()
{
var whenCreatedThread = _foregroundThreadDataWhenCreated.Thread;
var currentThread = Thread.CurrentThread;
Contract.ThrowIfFalse(currentThread == whenCreatedThread,
// In debug, provide a lot more information so that we can track down unit test flakeyness.
// This is too expensive to do in retail as it creates way too many allocations.
Debug.Assert(currentThread == whenCreatedThread,
"When created kind : " + _foregroundThreadDataWhenCreated.Kind + "\r\n" +
"When created thread id : " + whenCreatedThread?.ManagedThreadId + "\r\n" +
"When created thread name: " + whenCreatedThread?.Name + "\r\n" +
"Current thread id : " + currentThread?.ManagedThreadId + "\r\n" +
"Current thread id : " + currentThread?.ManagedThreadId + "\r\n" +
"Current thread name : " + currentThread?.Name);
// But, in retail, do the check as well, so that we can catch problems that happen in the wild.
Contract.ThrowIfFalse(currentThread == whenCreatedThread);
}
public void AssertIsBackground()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册