Skip to content

Remove asynchrony from service registration#79493

Merged
CyrusNajmabadi merged 2 commits intomainfrom
peServiceRegistration
Jul 21, 2025
Merged

Remove asynchrony from service registration#79493
CyrusNajmabadi merged 2 commits intomainfrom
peServiceRegistration

Conversation

@CyrusNajmabadi
Copy link
Contributor

Fixes #79395

@CyrusNajmabadi CyrusNajmabadi requested a review from a team as a code owner July 21, 2025 14:45
await JoinableTaskFactory.SwitchToMainThreadAsync(ct);
return new TempPECompilerService(workspace.Services.GetService<IMetadataService>());
});
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jasonmalinowski i can also take this further. If we're just registering a callback for some future point, then no need to have this as a task on PackageInitializationBackgroundThreadAsync. We can just early register this.

Note: i don't know this part of the system super well. so LMK if that's undesirable for some reason.

Copy link
Member

Choose a reason for hiding this comment

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

I'd say let's just leave that as is for now; that way everything is going through the registration system we have rather than a mix of things.

Ideally, I'd like to be to a point where we can delete all the fancy registration stuff, not because it's bad, but hopefully we're to the point where we have so little in our package startup that we don't really need the fanciness again. But we're not remotely there yet.

Function(_1, _2) New TempPECompilerFactory(Me.ComponentModel.GetService(Of VisualStudioWorkspace)()))
Catch ex As Exception When FatalError.ReportAndPropagateUnlessCanceled(ex)
Throw ExceptionUtilities.Unreachable
End Try
Copy link
Contributor Author

Choose a reason for hiding this comment

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

same thing here. this can all avoid this packageinitializetasks work if not needed.

Copy link
Member

Choose a reason for hiding this comment

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

Ditto: let's leave it for consistency, we'll switch over once we have things cleaned up a lot more.

Copy link
Member

@jasonmalinowski jasonmalinowski left a comment

Choose a reason for hiding this comment

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

This service is already being registered in src\VisualStudio\CSharp\Impl\PackageRegistration.pkgdef; we should edit that (or delete it) rather than adding a registration in code as one will win and it's not well defined who.

@CyrusNajmabadi
Copy link
Contributor Author

I'm a fan of code, so i'll delete hte pkgdef part :)

@jasonmalinowski
Copy link
Member

I'm a fan of code, so i'll delete hte pkgdef part :)

Fine with me; I'm a bit confused on the source control history here though. IIRC we had gotten rid of the code definitions because the SDK wasn't working well with dotnet builds, but I see that

is set. @tmat any idea what the intent was here?

@CyrusNajmabadi CyrusNajmabadi enabled auto-merge July 21, 2025 20:43
@CyrusNajmabadi CyrusNajmabadi merged commit 0e686f3 into main Jul 21, 2025
24 of 25 checks passed
@dotnet-policy-service dotnet-policy-service bot added this to the Next milestone Jul 21, 2025
@CyrusNajmabadi CyrusNajmabadi deleted the peServiceRegistration branch July 22, 2025 08:16
@RikkiGibson RikkiGibson modified the milestones: Next, 18.0 P1 Aug 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Delete AbstractPackage.RegisterService used by TempPE registration

3 participants