不知道为虾灭,默认情况下,俺们在 VSTS 里是不能把 profiler 挂到其他进程的。
所以当我们设置好一切,点击上面的菜单选项之后,,,
俺们会看到这个提示,continue anyway 之后自然什么结果都得不到。
解决方法备忘如下:
命令行执行:
X:\Program Files\Microsoft Visual Studio 9.0\Team Tools\Performance Tools\VSPerfCLREnv /globalsampleon
重启。
OK。
public override bool Obtain()
{
if (Lucene.Net.Store.FSDirectory.disableLocks)
return true;
bool tmpBool;
if (System.IO.File.Exists(Enclosing_Instance.lockDir.FullName))
tmpBool = true;
else
tmpBool = System.IO.Directory.Exists(Enclosing_Instance.lockDir.FullName);
if (!tmpBool)
{
try
{
System.IO.Directory.CreateDirectory(Enclosing_Instance.lockDir.FullName);
}
catch (Exception)
{
throw new System.IO.IOException("Cannot create lock directory: " + Enclosing_Instance.lockDir);
}
}
try
{
System.IO.FileStream createdFile = lockFile.Create();
createdFile.Close();
return true;
}
catch (Exception)
{
return false;
}
}
IndexWriter writer1 = null;
IndexWriter writer2 = null;
try
{
writer1 = new IndexWriter(@"Index", FullTextAnalyzer.Instance(), true);
writer2 = new IndexWriter(@"Index", FullTextAnalyzer.Instance(), true);
writer1.AddDocument(new Document());
writer2.AddDocument(new Document());
}
catch(Exception e)
{
writer1.Close();
throw e;
}