Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Add a parameter to pass through the initial assembly name #53599

Merged
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ public static async Task<CPSProject> CreateCSharpCPSProjectAsync(TestEnvironment
projectGuid,
hierarchy,
binOutputPath,
assemblyName: null,
CancellationToken.None);

cpsProject.SetOptions(ImmutableArray.Create(commandLineArguments));
Expand All @@ -105,6 +106,7 @@ public static async Task<CPSProject> CreateNonCompilableProjectAsync(TestEnviron
Guid.NewGuid(),
hierarchy,
binOutputPath: null,
assemblyName: null,
CancellationToken.None);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

#nullable disable

using System;
using System.Threading;
using System.Threading.Tasks;
Expand All @@ -17,7 +15,11 @@ internal interface IWorkspaceProjectContextFactory
{
/// <inheritdoc cref="CreateProjectContextAsync"/>
[Obsolete("Use CreateProjectContextAsync instead")]
IWorkspaceProjectContext CreateProjectContext(string languageName, string projectUniqueName, string projectFilePath, Guid projectGuid, object hierarchy, string binOutputPath);
IWorkspaceProjectContext CreateProjectContext(string languageName, string projectUniqueName, string projectFilePath, Guid projectGuid, object? hierarchy, string? binOutputPath);

/// <inheritdoc cref="CreateProjectContextAsync"/>
[Obsolete("Use CreateProjectContextAsync instead")]
IWorkspaceProjectContext CreateProjectContext(string languageName, string projectUniqueName, string projectFilePath, Guid projectGuid, object? hierarchy, string? binOutputPath, string? assemblyName);
Copy link
Member

@sharwell sharwell May 21, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😕 Adding a method which from day 1 is obsolete?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So this is "fun": we obsoleted those methods, the project system tried moving to the new methods; that broke, so they rolled back, and we haven't fixed it. @CyrusNajmabadi what's the next step for resolving that?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There was an RPS regression when we tried using the new free-threaded API. The logs for that regression have no expired, so to understand that regression will require another PS insertion.


/// <summary>
/// Creates and initializes a new Workspace project and returns a <see
Expand All @@ -29,8 +31,16 @@ internal interface IWorkspaceProjectContextFactory
/// <param name="projectUniqueName">Unique name for the project.</param>
/// <param name="projectFilePath">Full path to the project file for the project.</param>
/// <param name="projectGuid">Project guid.</param>
/// <param name="hierarchy">Obsolete. The argument is ignored.</param>
/// <param name="hierarchy">The IVsHierarchy for the project; this is used to track linked files across multiple projects when determining contexts.</param>
/// <param name="binOutputPath">Initial project binary output path.</param>
Task<IWorkspaceProjectContext> CreateProjectContextAsync(string languageName, string projectUniqueName, string projectFilePath, Guid projectGuid, object hierarchy, string binOutputPath, CancellationToken cancellationToken);
Task<IWorkspaceProjectContext> CreateProjectContextAsync(
string languageName,
string projectUniqueName,
string projectFilePath,
Guid projectGuid,
object? hierarchy,
string? binOutputPath,
string? assemblyName,
CancellationToken cancellationToken);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

#nullable disable

using System;
using System.ComponentModel.Composition;
using System.Threading;
Expand Down Expand Up @@ -43,25 +41,33 @@ public CPSProjectFactory(
_serviceProvider = (Shell.IAsyncServiceProvider)serviceProvider;
}

IWorkspaceProjectContext IWorkspaceProjectContextFactory.CreateProjectContext(string languageName, string projectUniqueName, string projectFilePath, Guid projectGuid, object hierarchy, string binOutputPath)
IWorkspaceProjectContext IWorkspaceProjectContextFactory.CreateProjectContext(string languageName, string projectUniqueName, string projectFilePath, Guid projectGuid, object? hierarchy, string? binOutputPath)
{
return _threadingContext.JoinableTaskFactory.Run(() =>
this.CreateProjectContextAsync(languageName, projectUniqueName, projectFilePath, projectGuid, hierarchy, binOutputPath, assemblyName: null, CancellationToken.None));
}

IWorkspaceProjectContext IWorkspaceProjectContextFactory.CreateProjectContext(string languageName, string projectUniqueName, string projectFilePath, Guid projectGuid, object? hierarchy, string? binOutputPath, string? assemblyName)
{
return _threadingContext.JoinableTaskFactory.Run(() =>
this.CreateProjectContextAsync(languageName, projectUniqueName, projectFilePath, projectGuid, hierarchy, binOutputPath, CancellationToken.None));
this.CreateProjectContextAsync(languageName, projectUniqueName, projectFilePath, projectGuid, hierarchy, binOutputPath, assemblyName, CancellationToken.None));
}

public async Task<IWorkspaceProjectContext> CreateProjectContextAsync(
string languageName,
string projectUniqueName,
string projectFilePath,
string? projectFilePath,
Guid projectGuid,
object hierarchy,
string binOutputPath,
object? hierarchy,
string? binOutputPath,
string? assemblyName,
CancellationToken cancellationToken)
{
await _threadingContext.JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken);

var creationInfo = new VisualStudioProjectCreationInfo
{
AssemblyName = assemblyName,
FilePath = projectFilePath,
Hierarchy = hierarchy as IVsHierarchy,
ProjectGuid = projectGuid,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public bool LastDesignTimeBuildSucceeded
set => _visualStudioProject.HasAllInformation = value;
}

public CPSProject(VisualStudioProject visualStudioProject, VisualStudioWorkspaceImpl visualStudioWorkspace, IProjectCodeModelFactory projectCodeModelFactory, Guid projectGuid, string binOutputPath)
public CPSProject(VisualStudioProject visualStudioProject, VisualStudioWorkspaceImpl visualStudioWorkspace, IProjectCodeModelFactory projectCodeModelFactory, Guid projectGuid, string? binOutputPath)
{
_visualStudioProject = visualStudioProject;
_visualStudioWorkspace = visualStudioWorkspace;
Expand Down