Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add NFW tracking to Solution.RemoveProjectReference #74965

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 15 additions & 7 deletions src/Workspaces/Core/Portable/Workspace/Solution/Solution.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.Diagnostics;
using Microsoft.CodeAnalysis.ErrorReporting;
using Microsoft.CodeAnalysis.Host;
using Microsoft.CodeAnalysis.Options;
using Microsoft.CodeAnalysis.PooledObjects;
Expand Down Expand Up @@ -626,16 +627,23 @@ public Solution AddProjectReferences(ProjectId projectId, IEnumerable<ProjectRef
/// <exception cref="ArgumentException">The solution does not contain <paramref name="projectId"/>.</exception>
public Solution RemoveProjectReference(ProjectId projectId, ProjectReference projectReference)
{
if (projectReference == null)
throw new ArgumentNullException(nameof(projectReference));
try
{
if (projectReference == null)
throw new ArgumentNullException(nameof(projectReference));

CheckContainsProject(projectId);
CheckContainsProject(projectId);

var oldProject = GetRequiredProjectState(projectId);
if (!oldProject.ProjectReferences.Contains(projectReference))
throw new ArgumentException(WorkspacesResources.Project_does_not_contain_specified_reference, nameof(projectReference));
var oldProject = GetRequiredProjectState(projectId);
if (!oldProject.ProjectReferences.Contains(projectReference))
throw new ArgumentException(WorkspacesResources.Project_does_not_contain_specified_reference, nameof(projectReference));

return WithCompilationState(CompilationState.RemoveProjectReference(projectId, projectReference));
return WithCompilationState(CompilationState.RemoveProjectReference(projectId, projectReference));
}
catch (Exception ex) when (FatalError.ReportAndPropagate(ex))
{
throw ExceptionUtilities.Unreachable();
}
}

/// <summary>
Expand Down
Loading