Skip to content

Explain need for Locator API call #4935

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

Merged
merged 2 commits into from
Apr 29, 2020
Merged

Conversation

Forgind
Copy link
Contributor

@Forgind Forgind commented Mar 13, 2020

Clarify rationale for separating call to Locator API from method using types

Clarify rationale for separating call to Locator API from method using types
@@ -79,7 +79,7 @@ Do not specify `ExcludeAssets=runtime` for the Microsoft.Build.Locator package.

### Register instance before calling MSBuild

Add a call to the Locator API before calling any method that uses MSBuild.
Add a call to the Locator API before calling any method that uses MSBuild. This is important because the just-in-time (JIT) compiler needs to understand the types of the objects it compiles, and when trying to build a project using a specific version of MSBuild, it has to inspect that version before it compiles the code in case those types have changed. Since the JIT compiler works at a method-level granularity, if the call to the Locator API is in the same method as the first use of an MSBuild type (even if it precedes it, and the code involving the type has not yet been executed), the JIT compiler will not be able to JIT the whole method, causing an error. Some types that require the call to the MSBuildLocator API to have already been called include ProjectRootElement, ProjectInstance, and BuildManager.
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this is overly detailed and would be better off with a good and bad example. Writing one up.

Copy link
Contributor Author

@Forgind Forgind Mar 13, 2020

Choose a reason for hiding this comment

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

Perhaps it's just because I think this sort of thing is really cool, but I would appreciate that level of detail if for no other reason than that I'd wonder why Microsoft would put in arbitrary requirements, and this would clarify that. That being said, an example would help, and you could certainly look at it faster.

@ktoliver ktoliver added the aq-pr-triaged tracking label for the PR review team label Mar 13, 2020
@PRMerger12
Copy link
Contributor

@Forgind : Thanks for your contribution! The author(s) have been notified to review your proposed change.

Copy link
Contributor

@rainersigwald rainersigwald left a comment

Choose a reason for hiding this comment

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

@ghogen thoughts?

@PRMerger12
Copy link
Contributor

@Forgind : Thanks for your contribution! The author(s) have been notified to review your proposed change.

@ghogen ghogen merged commit 6b60d34 into MicrosoftDocs:master Apr 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants