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

Followup work to handle ForegroundThreadAffinitizedObject removal. #73049

Merged
merged 15 commits into from
Apr 19, 2024

Conversation

CyrusNajmabadi
Copy link
Member

@CyrusNajmabadi CyrusNajmabadi commented Apr 16, 2024

Fixes #73048.

Followup to #73029.

@dotnet-issue-labeler dotnet-issue-labeler bot added Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead labels Apr 16, 2024
@@ -146,75 +146,15 @@ private static string GetFixCategory(DiagnosticSeverity severity)
throw new NotImplementedException($"We implement {nameof(GetSuggestedActionCategoriesAsync)}. This should not be called.");
}

private async Task<TextSpan?> GetSpanAsync(ReferenceCountedDisposable<State> state, SnapshotSpan range, CancellationToken cancellationToken)
Copy link
Member Author

Choose a reason for hiding this comment

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

this was some overwrought code to get the user's selection. inlined to callsite.

await _threadingContext.InvokeBelowInputPriorityAsync(() =>
{
// Make sure we were not disposed between kicking off this work and getting to this point.
using var state = _state.TryAddReference();
Copy link
Member Author

Choose a reason for hiding this comment

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

@sharwell it feels like this was unnecessary (and was not ported to callsite). taht code already is holding onto the state in a local, so the ref count can't go away while we're switching to teh UI to get the selection.

@@ -70,7 +70,7 @@ private partial class SuggestedActionsSource : IAsyncSuggestedActionsSource
CancellationToken cancellationToken)
{
_threadingContext.ThrowIfNotOnUIThread();
using var state = SourceState.TryAddReference();
using var state = _state.TryAddReference();
Copy link
Member Author

Choose a reason for hiding this comment

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

remove this property that did nothing more than return the state.


private static string GetFixCategory(DiagnosticSeverity severity)
Copy link
Member Author

Choose a reason for hiding this comment

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

called in only one location. inlined.

{
using var state = _state.TryAddReference();
Copy link
Member Author

Choose a reason for hiding this comment

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

no need to grab this again. it can be passed in.

@@ -140,6 +140,21 @@ void FireEventsForDocument(DocumentId documentId)
codeModel.FireEvents();
return;
}

// Returns true if any keyboard or mouse button input is pending on the message queue.
static bool IsInputPending()
Copy link
Member Author

Choose a reason for hiding this comment

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

only called here. moved to this location.

@CyrusNajmabadi CyrusNajmabadi marked this pull request as ready for review April 16, 2024 19:31
@CyrusNajmabadi CyrusNajmabadi requested a review from a team as a code owner April 16, 2024 19:31
@CyrusNajmabadi
Copy link
Member Author

@sharwell this is ready for review.

@CyrusNajmabadi
Copy link
Member Author

@sharwell ptal.

@CyrusNajmabadi
Copy link
Member Author

@sharwell ptal

@CyrusNajmabadi CyrusNajmabadi merged commit 584940e into dotnet:main Apr 19, 2024
25 checks passed
@dotnet-policy-service dotnet-policy-service bot added this to the Next milestone Apr 19, 2024
@CyrusNajmabadi CyrusNajmabadi deleted the foregroundObject2 branch April 20, 2024 23:45
@CyrusNajmabadi
Copy link
Member Author

@jasonmalinowski For review when you get back.

@dibarbet dibarbet modified the milestones: Next, 17.11 P1 Apr 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Followup work to consider after removing ForegroundThreadAffinitizedObject
3 participants