Permit Installing .NET via a package.json file #1976
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Intro
Extensions that rely on .NET often have a slow startup time due to our existing API, which needs to be invoked in typescript code.
This is per a request from the Copilot for Azure extension.
Change
For extensions that want the .NET runtime to be installed as soon as possible, they can now also make an API request in their package.json. #1935
They should add a IDotnetAcquireContext object in a section titled 'x-dotnet-acquire' to do so. They don't need to include the
requestingExtensionId
, since this is already in theirpackage.json
,This should go at the root of a
package.json
, and not in thecontributes
section.We run the install on startup and also whenever a new extension is installed via the onDidChange API. https://code.visualstudio.com/api/references/vscode-api#Extension<T>
Testing
You can easily test this by modifying the SDK extension and adding this, then packging it with
vsce
, installing it, and running the Runtime Extension under the Debug tab. If you do so, you will see that:If you install a new extension, the request is made. From my testing, it also doesn't grab focus away from the terminal which is great, I figured that would be a huge pain point. Something to still watch out for as it needs to be improved: #1935
(Before installing extension)
(On install)
If you had already installed the extension, the request is also made.
(On Opening VS Code)
Tests
It's a bit hard to test this functionality comprehensively, so while there's a very basic test, I've added a page about it in our vendor testing as well.