-
Notifications
You must be signed in to change notification settings - Fork 391
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
[WIP] Implement TempPEBuildManager using UnconfiguredProjectHostBridge #4318
Conversation
…dge, to allow better management of CancellationSeries
...icrosoft.VisualStudio.ProjectSystem.Managed.VS/ProjectSystem/VS/TempPE/TempPEBuildManager.cs
Outdated
Show resolved
Hide resolved
...crosoft.VisualStudio.ProjectSystem.Managed.VS/ProjectSystem/VS/TempPE/ITempPEBuildManager.cs
Show resolved
Hide resolved
...icrosoft.VisualStudio.ProjectSystem.Managed.VS/ProjectSystem/VS/TempPE/TempPEBuildManager.cs
Outdated
Show resolved
Hide resolved
...icrosoft.VisualStudio.ProjectSystem.Managed.VS/ProjectSystem/VS/TempPE/TempPEBuildManager.cs
Outdated
Show resolved
Hide resolved
...icrosoft.VisualStudio.ProjectSystem.Managed.VS/ProjectSystem/VS/TempPE/TempPEBuildManager.cs
Outdated
Show resolved
Hide resolved
@davidwengier will this every be called from background threads / multiple threads at once? |
private IActiveConfiguredProjectSubscriptionService ProjectSubscriptionService { get; set; } | ||
|
||
[ProjectAutoLoad] | ||
[AppliesTo(ProjectCapability.CSharpOrVisualBasic)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to be CSharpOrVisualBasicLanguageService.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That doesn't exist. Do you mean DotNetLanguageService
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Depends, what happens when you call into Roslyn and the language is F#?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know. Do we want TempPE for F#? Whats the difference between CSharpOrVisualBasic
and CSharpOrVisualBasicLanguageService
?
...icrosoft.VisualStudio.ProjectSystem.Managed.VS/ProjectSystem/VS/TempPE/TempPEBuildManager.cs
Outdated
Show resolved
Hide resolved
The PreprocessAsync and ApplyAsync methods are called from background threads, though not multiple threads at once to the same instance as far as I know. The ITempPEBuildManager members are both UI thread I think, but again not multiple threads at once. Why do you ask? |
...icrosoft.VisualStudio.ProjectSystem.Managed.VS/ProjectSystem/VS/TempPE/TempPEBuildManager.cs
Outdated
Show resolved
Hide resolved
There is nothing stopping DisposeAsync from being called underneath while either the UI thread is doing something, or while you are processing changes in reaction to data flow changes. |
/// Manages the portable executable (PE) files produced by running custom tools. | ||
/// </summary> | ||
[Export(typeof(BuildManager))] | ||
[AppliesTo(ProjectCapability.CSharpOrVisualBasic)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CSharpOrVisualBasicLanguageService
...icrosoft.VisualStudio.ProjectSystem.Managed.VS/ProjectSystem/VS/Automation/VsBuildManager.cs
Outdated
Show resolved
Hide resolved
...crosoft.VisualStudio.ProjectSystem.Managed.VS/ProjectSystem/VS/Automation/VsProjectEvents.cs
Outdated
Show resolved
Hide resolved
...icrosoft.VisualStudio.ProjectSystem.Managed.VS/ProjectSystem/VS/Automation/VsBuildManager.cs
Outdated
Show resolved
Hide resolved
...icrosoft.VisualStudio.ProjectSystem.Managed.VS/ProjectSystem/VS/Automation/VsBuildManager.cs
Outdated
Show resolved
Hide resolved
...icrosoft.VisualStudio.ProjectSystem.Managed.VS/ProjectSystem/VS/Automation/VsBuildManager.cs
Outdated
Show resolved
Hide resolved
Just trying to reason about the logic. My understanding is that
What you have seems correct. Are callers to |
}, value.DataSourceVersions); | ||
|
||
// Fire off the events | ||
var buildManager = BuildManager.First().Value as VSBuildManager; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have a hard dependency on the BuildManager being; BuildManagerEvents and VSBuildManager. Please just import that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you expand on that? Do you mean directly importing VSBuildManager (need to add another Export attribute to it?) or do you mean importing VSProjectEvents and access through BuildManagerEvents so that we're ensuring our dependency is hooked up correctly?
...icrosoft.VisualStudio.ProjectSystem.Managed.VS/ProjectSystem/VS/TempPE/TempPEBuildManager.cs
Outdated
Show resolved
Hide resolved
...icrosoft.VisualStudio.ProjectSystem.Managed.VS/ProjectSystem/VS/Automation/VsBuildManager.cs
Show resolved
Hide resolved
Cancellation is a little unclear to me, how does this work? Looks like we're compiling on the UI thread in response to someone asking on the UI thread blocking us from presumably updating the AppliedValue, how exactly does cancellation work? |
The cancellation stuff is still just a theory, but you raise a good point. The cancellation would need to happen in PreprocessAsync or ApplyAsync but off the UI thread. The theory is simply to avoid needing the event loop that legacy has, we can simply cancel any current compilation and let the next one happen as change flow through to the UI thread. Now that I'm writing that out though, perhaps thats not necessary at all, and the fact that compilation is happening on the UI thread will be enough - we can just let the current compilations finish and then the next set of changes will push through anyway. |
No, the theory is that the thing doing the cancellation is doing so because its in the process of re-queuing. |
For my own edification, why does compilation need to be on the UI thread? |
The compilation is in response to a call from the UI thread. The UI thread is blocked on the call, nothing else will execute on the UI thread (unless it unblocks the call) until the call is finished. There's probably no benefit to it running on a background thread. However, perhaps we could reconsider the design where there is a benefit? I can't remember what legacy does here, do you remember? |
Legacy uses a background thread. |
Can you expand on that? What benefit is it hoping from using a background thread? |
I don't know why it is using a background thread, there aren't any comments indicating any reasons in the source. I thought we wanted to compile on the UI thread because that way we're guaranteed that the project state is consistent because we're not passing all of the info to Roslyn any more, but relying on the fact that |
UI thread is blocked, so CurrentSolution/AppliedValue cannot change regardless of where you compile. Let me try and understand why/what it is doing. |
I don't claim to be able to read the C++ code well, but in theory the UI thread doesn't have to be blocked on the compile, just the returning of the XML string. That can be done using only file names. Why you would want to tell someone a DLL is somewhere, then schedule a task to make it appear there at some point in time in the future, I certainly don't know. |
I've pushed a bunch of changes including removing the CancellationSeries and adding in support for firing the dirty event when files change. |
There is still lots to be done in this, and most of it not documented in comments, but just wanted to get a quick look over the work so far to make sure its on the right track. The main thing is the TempPEManager and its implementation of UnconfiguredProjectHostBridge.
The idea goes like this:
Big TODO items are:
Have at it. I expect lots of comments :P