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

Create some simple tests for the RoslynWorkspace EA #8607

Merged
merged 1 commit into from
Apr 19, 2023

Conversation

davidwengier
Copy link
Contributor

No description provided.

@davidwengier davidwengier requested a review from a team as a code owner April 18, 2023 06:22
@@ -11,15 +10,12 @@ public class RazorWorkspaceListener : IDisposable
private static readonly TimeSpan s_debounceTime = TimeSpan.FromMilliseconds(100);

private string? _projectRazorJsonFileName;
private readonly Dictionary<string, TaskDelayScheduler> _workQueues;
private readonly Dictionary<ProjectId, TaskDelayScheduler> _workQueues;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed the key here to make testing easier, but also strictly speaking the previous code wouldn't have worked for multi targetting, should that ever be something someone wants to do.

{
scheduler = new TaskDelayScheduler(s_debounceTime, CancellationToken.None);
_workQueues.Add(project.Id, scheduler);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Stupid bug here. I wasn't actually adding anything to the map 🤦‍♂️

case WorkspaceChangeKind.SolutionChanged:
case WorkspaceChangeKind.SolutionReloaded:
foreach (var project in e.OldSolution.Projects)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Figured now that we're using IDs, its better to be a bit more strict with removal so we're not holding stale data in the map. Not a big deal though, as removing and re-adding the same project is essentially the same as queuing an update anyway, and any stale projects here will just be an instance of the TaskDelayScheduler that does nothing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants