Skip to content

Add support for launching a browser on file change #24220

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 1 commit into from
Jul 24, 2020

Conversation

pranavkm
Copy link
Contributor

@pranavkm pranavkm commented Jul 22, 2020

Contributes to #23412

@ghost ghost added the area-commandlinetools Includes: Command line tools, dotnet-dev-certs, dotnet-user-jwts, and OpenAPI label Jul 22, 2020

async Task WebSocketRequest(HttpContext context)
{
if (!context.WebSockets.IsWebSocketRequest)
Copy link
Member

Choose a reason for hiding this comment

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

Who is attaching with a WebSocket connection? (The browser I know, but how?)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There's a follow up which will inject a hosting startup via environment variable.

@pranavkm
Copy link
Contributor Author

Updated

@pranavkm pranavkm force-pushed the prkrishn/launch-browser branch from ad03f58 to e0967c6 Compare July 23, 2020 06:50
@pranavkm
Copy link
Contributor Author

Good to go

<ItemGroup>
<_RuntimeFramework Include="@(RuntimeFramework)" />
<RuntimeFramework Remove="@(RuntimeFramework)" />
<RuntimeFramework Include="Microsoft.AspNetCore.App" FrameworkName="Microsoft.AspNetCore.App" Version="5.0.0-preview" />
Copy link
Member

Choose a reason for hiding this comment

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

Is there a way to do this that doesn't require manually changing this for example when we aren't preview anymore?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm on point for fixing this in 5.0. We basically want to stamp the current runtime version in here. This was copied from https://github.com/dotnet/aspnetcore/blob/master/src/Components/WebAssembly/DevServer/src/Microsoft.AspNetCore.Components.WebAssembly.DevServer.csproj#L41 so we have a few places to fix this.

_files = new HashSet<string>(files, StringComparer.OrdinalIgnoreCase);
}

public bool Contains(string filePath) => _files.Contains(filePath);

public int Count => _files.Count;

public static IFileSet Empty = new FileSet(Array.Empty<string>());
public bool IsNetCoreApp31OrNewer { get; }
Copy link
Member

Choose a reason for hiding this comment

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

What is stopping 2.1 from working?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The HTML injection middleware has to target whatever version we choose here. We could have it just launch the browser the first time, but that's not very useful in itself. Picking 3.1 seems like a good middleground.

@dotnet dotnet deleted a comment from BrennanConroy Jul 23, 2020
@pranavkm pranavkm force-pushed the prkrishn/launch-browser branch from e230871 to 80b38e8 Compare July 23, 2020 22:20
@pranavkm pranavkm requested a review from Tratcher as a code owner July 23, 2020 22:20
@pranavkm pranavkm force-pushed the prkrishn/launch-browser branch from 80b38e8 to b5c9bba Compare July 23, 2020 22:21
@Tratcher
Copy link
Member

Bad rebase?

@pranavkm pranavkm changed the base branch from master to release/5.0-preview8 July 23, 2020 22:32
@pranavkm
Copy link
Contributor Author

Wrong base branch.

@pranavkm pranavkm added this to the 5.0.0-preview8 milestone Jul 23, 2020
@mkArtakMSFT mkArtakMSFT merged commit 11835cf into release/5.0-preview8 Jul 24, 2020
@mkArtakMSFT mkArtakMSFT deleted the prkrishn/launch-browser branch July 24, 2020 00:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-commandlinetools Includes: Command line tools, dotnet-dev-certs, dotnet-user-jwts, and OpenAPI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants