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

Permit Installing .NET via a package.json file #1976

Merged
merged 5 commits into from
Oct 4, 2024

Conversation

nagilson
Copy link
Member

@nagilson nagilson commented Oct 3, 2024

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 their package.json,

This should go at the root of a package.json, and not in the contributes section.

"x-dotnet-acquire": {
    "version": "8.0",
    "mode": "aspnetcore"
}

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)
image
(On install)
image

If you had already installed the extension, the request is also made.
(On Opening VS Code)
image

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.

Extensions that rely on .NET often have a slow startup time due to our existing API.

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.

They should add a [IDotnetAcquireContext](https://github.com/dotnet/vscode-dotnet-runtime/blob/main/vscode-dotnet-runtime-library/src/IDotnetAcquireContext.ts) object in a section titled 'x-dotnet-acquire' to do so. They don't need to include the `requestingExtensionId`, since this is already in their `package.json`,

This should go at the root of a `package.json`, and not in the `contributes` section.
```
"x-dotnet-acquire": {
    "version": "8.0",
    "mode": "aspnetcore"
}
```

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>

You can easily test this by modifying the SDK extension and adding this, then packging t 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.

If you had already installed the extension, the request is also made.
@nagilson nagilson requested a review from a team October 3, 2024 23:50
Documentation/commands.md Outdated Show resolved Hide resolved
@jacdavis
Copy link

jacdavis commented Oct 3, 2024

shipit

@nagilson nagilson merged commit 2a876ac into dotnet:main Oct 4, 2024
9 checks passed
@nagilson
Copy link
Member Author

nagilson commented Oct 4, 2024

Thanks for your review. We still need to get the branding for the versions PR approved and a few other minor PRs for the release, so I expect it will take a few days.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants