提交 9fe95f5d 编写于 作者: A Andrew Casey

Handle not-yet-loaded projects in GetENCBuildState

VsENCRebuildableProjectImpl.GetNECBuildState was not accounting for the
possibility that there might not (yet) be a roslyn project for a given VS
project.  If we ever encounter this, we should just report that the
project is unchanged.

We have a number of dumps for this issue, but no concrete repro steps.
上级 c8f14b30
......@@ -783,8 +783,23 @@ public int GetENCBuildState(ShellInterop.ENC_BUILD_STATE[] pENCBuildState)
}
else if (_encService.EditSession != null)
{
_projectBeingEmitted = _vsProject.VisualStudioWorkspace.CurrentSolution.GetProject(_vsProject.Id);
_lastEditSessionSummary = GetProjectAnalysisSummary(_projectBeingEmitted);
// Fetch the latest snapshot of the project and get an analysis summary for any changes
// made since the break mode was entered.
var currentProject = _vsProject.VisualStudioWorkspace.CurrentSolution.GetProject(_vsProject.Id);
if (currentProject == null)
{
// If the project has yet to be loaded into the solution (which may be the case,
// since they are loaded on-demand), then it stands to reason that it has not yet
// been modified.
// TODO (https://github.com/dotnet/roslyn/issues/1204): this check should be unnecessary.
_lastEditSessionSummary = ProjectAnalysisSummary.NoChanges;
log.Write($"Project '{_vsProject.DisplayName}' has not yet been loaded into the solution");
}
else
{
_projectBeingEmitted = currentProject;
_lastEditSessionSummary = GetProjectAnalysisSummary(_projectBeingEmitted);
}
_encService.EditSession.LogBuildState(_lastEditSessionSummary);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册