Skip to content
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 @@ -29,6 +29,11 @@ namespace Microsoft.CodeAnalysis.EditAndContinue;

internal abstract partial class AbstractEditAndContinueAnalyzer : IEditAndContinueAnalyzer
{
// TODO: https://github.com/dotnet/roslyn/issues/81728
// Temporarily disabled until https://devdiv.visualstudio.com/DevDiv/_queries/edit/1835505 is implemented.
// Only enabled in dotnet-watch and tests.
internal static bool EnableProjectLevelAnalysis = false;

internal const int DefaultStatementPart = 0;
private const string CreateNewOnMetadataUpdateAttributeName = "CreateNewOnMetadataUpdateAttribute";
private const string RestartRequiredOnMetadataUpdateAttributeName = "RestartRequiredOnMetadataUpdateAttribute";
Expand Down Expand Up @@ -578,7 +583,7 @@ public async Task<DocumentAnalysisResults> AnalyzeDocumentAsync(
// since the option changed would have different semantics than the parts that have changed.
//
// Skip further analysis of the document if we detect any such change (classified as rude edits) in parse options.
if (GetParseOptionsRudeEdits(oldTree.Options, newTree.Options).Any())
if (EnableProjectLevelAnalysis && GetParseOptionsRudeEdits(oldTree.Options, newTree.Options).Any())
{
log.Write($"Parse options differ for '{filePath}'");

Expand Down
4 changes: 2 additions & 2 deletions src/Features/Core/Portable/EditAndContinue/EditSession.cs
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ internal static async ValueTask<bool> HasDifferencesAsync(Project oldProject, Pr
return false;
}

if (HasProjectLevelDifferences(oldProject, newProject, differences) && differences == null)
if (AbstractEditAndContinueAnalyzer.EnableProjectLevelAnalysis && HasProjectLevelDifferences(oldProject, newProject, differences) && differences == null)
{
return true;
}
Expand Down Expand Up @@ -1213,7 +1213,7 @@ void UpdateChangedDocumentsStaleness(bool isStale)

var projectSummary = GetProjectAnalysisSummary(changedDocumentAnalyses);

if (HasProjectSettingsBlockingRudeEdits(oldProject, newProject, projectDiagnostics))
if (AbstractEditAndContinueAnalyzer.EnableProjectLevelAnalysis && HasProjectSettingsBlockingRudeEdits(oldProject, newProject, projectDiagnostics))
{
// If the project settings have changed and the change is a rude edit,
// block applying the changes even if there no other changes to the project documents.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ public readonly struct Updates
public HotReloadService(HostWorkspaceServices services, ImmutableArray<string> capabilities)
: this(services.SolutionServices, () => ValueTask.FromResult(AddImplicitDotNetCapabilities(capabilities)))
{
AbstractEditAndContinueAnalyzer.EnableProjectLevelAnalysis = true;
}

private DebuggingSessionId GetDebuggingSession()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ namespace Microsoft.CodeAnalysis.EditAndContinue.UnitTests;

public abstract class EditAndContinueWorkspaceTestBase : TestBase, IDisposable
{
static EditAndContinueWorkspaceTestBase()
{
// TODO: remove https://github.com/dotnet/roslyn/issues/81728
AbstractEditAndContinueAnalyzer.EnableProjectLevelAnalysis = true;
}

private protected static readonly Guid s_solutionTelemetryId = Guid.Parse("00000000-AAAA-AAAA-AAAA-000000000000");
private protected static readonly Guid s_defaultProjectTelemetryId = Guid.Parse("00000000-AAAA-AAAA-AAAA-111111111111");
private protected static readonly Regex s_timePropertiesRegex = new("[|](EmitDifferenceMilliseconds|TotalAnalysisMilliseconds)=[0-9]+");
Expand Down
Loading