问题描述
我的VS2013终极副本编译该$ C $下60+秒:
My copy of VS2013 Ultimate compiles this code for 60+ seconds:
class Program
{
static void Main(string[] args)
{
double dichotomy = Dichotomy(
d =>
{
try
{
int size = (int) d;
byte[] b = new byte[size];
return -b.Length;
}
catch (Exception)
{
return 0;
}
},
0,
int.MaxValue,
1);
Console.WriteLine(dichotomy);
Console.ReadKey();
}
private static double Dichotomy(
Func<double, double> func,
double a,
double b,
double epsilon)
{
double delta = epsilon / 10;
while (b - a >= epsilon)
{
double middle = (a + b) / 2;
double lambda = middle - delta, mu = middle + delta;
if (func(lambda) < func(mu))
b = mu;
else
a = lambda;
}
return (a + b) / 2;
}
}
但是,如果我把双
与 INT
,它会立即编译。怎样才能解释它...?
But if I replace double
with int
, it compiles immediately. How can be it explained...?
推荐答案
我瑞普,27秒我的机器上。恶人是MsMpEng.exe,它燃烧100%的核心为长。
I repro, 27 seconds on my machine. The evil-doer is MsMpEng.exe, it burns 100% core for that long.
这是Windows Defender服务,一个实际执行恶意软件扫描。受一是不要选中了实时保护打开禁用它选项便可立即修复的延迟。因此,不增加我的项目存储到排除的文件位置框中,可能是你的preferred方式的路径。
This is the Windows Defender service, the one that actually performs the malware scans. Disabling it by unticking the "Turn on real-time protection" option instantly fixes the delay. So does adding the path where I store projects to the "Excluded file locations" box, probably your preferred approach.
我讨厌不得不猜测的根本原因,但假设你的源$ C $ C是触发恶意软件的规则。不是一个很好的解释,我没有看到的延迟,当我指定一个.NET版本&LT; 4.0。好吧,我放弃了:)
I'd hate to have to guess at the underlying reason, but have to assume that your source code is triggering a malware rule. Not a great explanation, I don't see the delay when I target a .NET version < 4.0. Okay, I give up :)
这篇关于Visual Studio和MSSE杀毒编译时错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!