Skip to content

Factor WebAssembly debugging infrastructure out of Microsoft.AspNetCore.Components.Server #6519

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
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions build/artifacts.props
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ This can be done once #4246 is complete, and done in conjunction with converting
<PackageArtifact Include="Microsoft.AspNetCore.Blazor" Category="ship" />
<PackageArtifact Include="Microsoft.AspNetCore.Blazor.Build" Category="ship" />
<PackageArtifact Include="Microsoft.AspNetCore.Blazor.Cli" Category="ship" />
<PackageArtifact Include="Microsoft.AspNetCore.Blazor.Server" Category="ship" />
Copy link
Member

Choose a reason for hiding this comment

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

<3

<PackageArtifact Include="Microsoft.AspNetCore.Blazor.Templates" Category="ship" />
<PackageArtifact Include="Microsoft.AspNetCore.Components.Analyzers" Category="ship" />
<PackageArtifact Include="Microsoft.AspNetCore.Components.Browser" Category="ship" />
Expand Down
11 changes: 11 additions & 0 deletions src/Components/Components.sln
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Compon
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Components.Build", "src\Microsoft.AspNetCore.Components.Build\Microsoft.AspNetCore.Components.Build.csproj", "{ABDBB486-6F40-4EA0-8ED1-BF995F534F13}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.AspNetCore.Blazor.Server", "blazor\src\Microsoft.AspNetCore.Blazor.Server\Microsoft.AspNetCore.Blazor.Server.csproj", "{EA44F350-F410-41B4-BA21-00CD31D17384}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -344,6 +346,14 @@ Global
{ABDBB486-6F40-4EA0-8ED1-BF995F534F13}.Release|Any CPU.Build.0 = Release|Any CPU
{ABDBB486-6F40-4EA0-8ED1-BF995F534F13}.ReleaseNoVSIX|Any CPU.ActiveCfg = Release|Any CPU
{ABDBB486-6F40-4EA0-8ED1-BF995F534F13}.ReleaseNoVSIX|Any CPU.Build.0 = Release|Any CPU
{EA44F350-F410-41B4-BA21-00CD31D17384}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{EA44F350-F410-41B4-BA21-00CD31D17384}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EA44F350-F410-41B4-BA21-00CD31D17384}.DebugNoVSIX|Any CPU.ActiveCfg = Debug|Any CPU
{EA44F350-F410-41B4-BA21-00CD31D17384}.DebugNoVSIX|Any CPU.Build.0 = Debug|Any CPU
{EA44F350-F410-41B4-BA21-00CD31D17384}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EA44F350-F410-41B4-BA21-00CD31D17384}.Release|Any CPU.Build.0 = Release|Any CPU
{EA44F350-F410-41B4-BA21-00CD31D17384}.ReleaseNoVSIX|Any CPU.ActiveCfg = Release|Any CPU
{EA44F350-F410-41B4-BA21-00CD31D17384}.ReleaseNoVSIX|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down Expand Up @@ -389,6 +399,7 @@ Global
{85813607-297F-4D39-92F7-89379FD80D70} = {32B33872-B599-4913-9F90-EDB5F9E24B18}
{E52F5005-26EA-4764-8ECF-41D324AAA6D9} = {B867E038-B3CE-43E3-9292-61568C46CDEB}
{ABDBB486-6F40-4EA0-8ED1-BF995F534F13} = {B867E038-B3CE-43E3-9292-61568C46CDEB}
{EA44F350-F410-41B4-BA21-00CD31D17384} = {AD41FFD8-2C0C-4F0C-9537-25C2A3A7A1F4}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {504DA352-6788-4DC0-8705-82167E72A4D3}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>netcoreapp3.0</TargetFramework>
Expand All @@ -21,6 +21,7 @@

<ItemGroup>
<ProjectReference Include="..\..\..\src\Microsoft.AspNetCore.Components.Server\Microsoft.AspNetCore.Components.Server.csproj" />
<ProjectReference Include="..\..\src\Microsoft.AspNetCore.Blazor.Server\Microsoft.AspNetCore.Blazor.Server.csproj" />
<ProjectReference Include="..\HostedInAspNet.Client\HostedInAspNet.Client.csproj" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using Microsoft.AspNetCore.Builder;
Expand All @@ -21,6 +21,7 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env)
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
app.UseBlazorDebugging();
}

app.UseBlazor<Client.Program>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,6 @@

<ItemGroup>
<ProjectReference Include="..\..\..\src\Microsoft.AspNetCore.Components.Server\Microsoft.AspNetCore.Components.Server.csproj" />
<ProjectReference Include="..\Microsoft.AspNetCore.Blazor.Server\Microsoft.AspNetCore.Blazor.Server.csproj" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using Microsoft.AspNetCore.Components.Server;
Expand Down Expand Up @@ -38,6 +38,7 @@ public void Configure(IApplicationBuilder app, IConfiguration configuration)

var clientAssemblyPath = FindClientAssemblyPath(app);
app.UseBlazor(new BlazorOptions { ClientAssemblyPath = clientAssemblyPath });
app.UseBlazorDebugging();
}

private static void EnableConfiguredPathbase(IApplicationBuilder app, IConfiguration configuration)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<Description>Runtime server features for ASP.NET Core Blazor applications.</Description>
<IsProductPackage>true</IsProductPackage>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Hosting.Abstractions" Version="$(AspNetCorePackageVersion)" />
<PackageReference Include="Microsoft.AspNetCore.WebSockets" Version="$(AspNetCorePackageVersion)" />
<PackageReference Include="Microsoft.AspNetCore.Hosting.Abstractions" Version="$(AspNetCorePackageVersion)" />
<PackageReference Include="Newtonsoft.Json" Version="$(NewtonsoftJsonPackageVersion)" />

<!-- Used by ws-proxy sources only. Remove this once we're able to consume ws-proxy as a NuGet package. -->
<PackageReference Include="Mono.Cecil" Version="0.10.0-beta7" />
Copy link
Member

Choose a reason for hiding this comment

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

I'm sure this will come up at some point, and it's OK to use an issue to track - but is there a stable version we can use? We don't generally want to depend on prerelease in release, and it looks like that would be easy to happen.

Copy link

Choose a reason for hiding this comment

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

Looks like there have been 2 stable releases of Mono.Cecil on nuget since the 0.10.0-beta7 version. Latest version: Mono.Cecil 0.10.1

Copy link
Member Author

Choose a reason for hiding this comment

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

Good points. Thanks for the info. To avoid waiting for another long CI build, I'm going to make the Mono.Cecil version change in #6562.

</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,16 @@

namespace Microsoft.AspNetCore.Builder
{
internal static class MonoDebugProxyAppBuilderExtensions
/// <summary>
/// Provides infrastructure for debugging Blazor applications.
/// </summary>
public static class BlazorMonoDebugProxyAppBuilderExtensions
{
public static void UseMonoDebugProxy(this IApplicationBuilder app)
/// <summary>
/// Adds middleware for needed for debugging Blazor applications
/// inside Chromium dev tools.
/// </summary>
public static void UseBlazorDebugging(this IApplicationBuilder app)
{
app.UseWebSockets();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,6 @@ public static IApplicationBuilder UseBlazor(
});
}

// Accept debugger connections
if (config.EnableDebugging)
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 plan/need to clean this up in BlazorConfig? Or is this a temporary thing while we figure out how to ship all of this.

Personally, I feel like having this show up in startup code is an improvement because it's more inline with our other diagnostics features.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, I'm sure we'll review and change the Blazor build/hosting mechanisms as we head towards a stable release of that.

{
app.UseMonoDebugProxy();
}

// Finally, use SPA fallback routing (serve default page for anything else,
// excluding /_framework/*)
app.MapWhen(IsNotFrameworkDir, childAppBuilder =>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
Expand All @@ -17,9 +17,6 @@
<PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="$(AspNetCorePackageVersion)" />
<PackageReference Include="Microsoft.AspNetCore.SpaServices.Extensions" Version="$(AspNetCorePackageVersion)" />
<PackageReference Include="Microsoft.Extensions.FileProviders.Physical" Version="$(AspNetCorePackageVersion)" />

<!-- Used by ws-proxy sources only. Remove this once we're able to consume ws-proxy as a NuGet package. -->
<PackageReference Include="Mono.Cecil" Version="0.10.0-beta7" />
</ItemGroup>

<ItemGroup>
Expand Down