When profile directory does not exist Then skip MCJ

This commit is contained in:
PiotrP 2016-05-03 12:47:10 -07:00
parent 9f0dab1a08
commit 333fbbd167

View file

@ -36,11 +36,28 @@ namespace Microsoft.DotNet.Cli
{
var profileOptimizationRootPath = new MulticoreJitProfilePathCalculator().MulticoreJitProfilePath;
PathUtility.EnsureDirectory(profileOptimizationRootPath);
if (!TryEnsureDirectory(profileOptimizationRootPath))
{
return;
}
AssemblyLoadContext.Default.SetProfileOptimizationRoot(profileOptimizationRootPath);
AssemblyLoadContext.Default.StartProfileOptimization("dotnet");
}
private bool TryEnsureDirectory(string directoryPath)
{
try
{
PathUtility.EnsureDirectory(directoryPath);
return true;
}
catch (Exception)
{
return false;
}
}
}
}