提交 ddba4f28 编写于 作者: D Dustin Campbell

Ensure project paths aren't added to map twice

In MSBuildWorkspaceProjectLoader, there is a map of "discovered" projects that stores the results of any project references. If a
project reference can't be loaded (for example, because it is a reference to, say, an F# project), it can end up in the map twice if the
project referencing it is multi-targeted. For example, a multi-targeted C# project that references an F# project will fail when loaded
because the path to the F# project will get added twice with an empty array of ProjectInfos. The reason for this is that the code assumes
that the loaded project will end up in the primary loaded project map, but in this case, the project couldn't be loaded and isn't there. To
avoid this situation, we call TryGetValue on the "discovered" projects map and return the results before trying to load the project again.
上级 70bacafc
......@@ -224,7 +224,8 @@ private async Task<ImmutableArray<ProjectFileInfo>> LoadProjectFileInfosAsync(st
private async Task<ImmutableArray<ProjectInfo>> LoadProjectInfosFromPathAsync(
string projectPath, DiagnosticReportingOptions reportingOptions, CancellationToken cancellationToken)
{
if (_projectMap.TryGetProjectInfosByProjectPath(projectPath, out var results))
if (_projectMap.TryGetProjectInfosByProjectPath(projectPath, out var results) ||
_pathToDiscoveredProjectInfosMap.TryGetValue(projectPath, out results))
{
return results;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册