From ebb527d34733e21e9c220597ab3833d2f6872166 Mon Sep 17 00:00:00 2001 From: Ryan Nowak Date: Tue, 19 Feb 2019 18:10:17 -0800 Subject: [PATCH 1/3] [wip] Update Razor SDK and resolve issues I'm still chasing one more issue. (cherry picked from commit 616a4a36f575d16f911db7bdcbec38841497ffb8) --- eng/Version.Details.xml | 18 +- eng/Versions.props | 10 +- .../Build/test/BindRazorIntegrationTest.cs | 28 +- .../test/RenderingRazorIntegrationTest.cs | 79 ++- .../Components/src/EventCallbackFactory.cs | 71 +-- .../Components/src/RuntimeHelpers.cs | 503 +++++++++++++++++- .../test/EventCallbackFactoryTest.cs | 150 +++++- ...scadingValueReceiveFixedByInterface.cshtml | 2 + .../EventCallbackCases.cshtml | 12 +- .../SimpleValidationComponent.cshtml | 2 +- .../TypicalValidationComponent.cshtml | 20 +- 11 files changed, 760 insertions(+), 135 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index c72f509ca1..0c58a8e17a 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,4 +1,4 @@ - + - + https://github.com/aspnet/AspNetCore-Tooling - 408b123a6454841884c1d840fb853eec8de12c10 + 182b2c81a5a3c2d5219cf20205e49dbe86823e18 - + https://github.com/aspnet/AspNetCore-Tooling - 408b123a6454841884c1d840fb853eec8de12c10 + 182b2c81a5a3c2d5219cf20205e49dbe86823e18 - + https://github.com/aspnet/AspNetCore-Tooling - 408b123a6454841884c1d840fb853eec8de12c10 + 182b2c81a5a3c2d5219cf20205e49dbe86823e18 - + https://github.com/aspnet/AspNetCore-Tooling - 408b123a6454841884c1d840fb853eec8de12c10 + 182b2c81a5a3c2d5219cf20205e49dbe86823e18 https://github.com/aspnet/EntityFrameworkCore diff --git a/eng/Versions.props b/eng/Versions.props index a84ba66432..322ea925c9 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -1,4 +1,4 @@ - + - 3.0.0-preview-19107-04 - 3.0.0-preview-19107-04 - 3.0.0-preview-19107-04 - 3.0.0-preview-19107-04 + 3.0.0-preview3.19119.5 + 3.0.0-preview3.19119.5 + 3.0.0-preview3.19119.5 + 3.0.0-preview3.19119.5 + GoogleProtobufPackageVersion=$(GoogleProtobufPackageVersion); + GrpcAspNetCoreServerPackageVersion=$(GrpcAspNetCoreServerPackageVersion); + GrpcCorePackageVersion=$(GrpcCorePackageVersion); + GrpcToolsPackageVersion=$(GrpcToolsPackageVersion); MicrosoftAspNetCoreMvcRazorRuntimeCompilationPackageVersion=$(MicrosoftAspNetCoreMvcRazorRuntimeCompilationPackageVersion); MicrosoftEntityFrameworkCoreSqlitePackageVersion=$(MicrosoftEntityFrameworkCoreSqlitePackageVersion); MicrosoftEntityFrameworkCoreSqlServerPackageVersion=$(MicrosoftEntityFrameworkCoreSqlServerPackageVersion); @@ -39,6 +43,8 @@ + + diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/GrpcService-CSharp/.template.config/dotnetcli.host.json b/src/ProjectTemplates/Web.ProjectTemplates/content/GrpcService-CSharp/.template.config/dotnetcli.host.json new file mode 100644 index 0000000000..51aa5b982e --- /dev/null +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/GrpcService-CSharp/.template.config/dotnetcli.host.json @@ -0,0 +1,16 @@ +{ + "$schema": "http://json.schemastore.org/dotnetcli.host", + "symbolInfo": { + "skipRestore": { + "longName": "no-restore", + "shortName": "" + }, + "ExcludeLaunchSettings": { + "longName": "exclude-launch-settings", + "shortName": "" + } + }, + "usageExamples": [ + "" + ] +} diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/GrpcService-CSharp/.template.config/template.json b/src/ProjectTemplates/Web.ProjectTemplates/content/GrpcService-CSharp/.template.config/template.json new file mode 100644 index 0000000000..665a8e064c --- /dev/null +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/GrpcService-CSharp/.template.config/template.json @@ -0,0 +1,102 @@ +{ + "$schema": "http://json.schemastore.org/template", + "author": "Microsoft", + "classifications": [ + "Web", + "gRPC" + ], + "name": "ASP.NET Core gRPC Service", + "generatorVersions": "[1.0.0.0-*)", + "description": "A project template for creating a gRPC ASP.NET Core service.", + "groupIdentity": "Microsoft.Web.Grpc", + "precedence": "5000", + "identity": "Microsoft.Grpc.Service.CSharp.3.0", + "shortName": "grpc", + "tags": { + "language": "C#", + "type": "project" + }, + "sourceName": "GrpcService-CSharp", + "preferNameDirectory": true, + "guids": [ + "4C26868E-5E7C-458D-82E3-040509D0C71F", + "5990939C-7E7B-4CFA-86FF-44CA5756498A", + "650B3CE7-2E93-4CC4-9F46-466686815EAA" + ], + "sources": [ + { + "modifiers": [ + { + "condition": "(ExcludeLaunchSettings)", + "exclude": [ + "GrpcService-CSharp.Server/Properties/launchSettings.json" + ] + }, + { + "condition": "(HostIdentifier != \"dotnetcli\" && HostIdentifier != \"dotnetcli-preview\")", + "exclude": [ + "GrpcService-CSharp.sln" + ] + } + ] + } + ], + "symbols": { + "HostIdentifier": { + "type": "bind", + "binding": "HostIdentifier" + }, + "Framework": { + "type": "parameter", + "description": "The target framework for the project.", + "datatype": "choice", + "choices": [ + { + "choice": "netcoreapp3.0", + "description": "Target netcoreapp3.0" + } + ], + "defaultValue": "netcoreapp3.0" + }, + "ExcludeLaunchSettings": { + "type": "parameter", + "datatype": "bool", + "defaultValue": "false", + "description": "Whether to exclude launchSettings.json from the generated template." + }, + "skipRestore": { + "type": "parameter", + "datatype": "bool", + "description": "If specified, skips the automatic restore of the project on create.", + "defaultValue": "false" + } + }, + "primaryOutputs": [ + { + "condition": "(HostIdentifier == \"dotnetcli\" || HostIdentifier == \"dotnetcli-preview\")", + "path": "GrpcService-CSharp.sln" + }, + { + "condition": "(HostIdentifier != \"dotnetcli\" && HostIdentifier != \"dotnetcli-preview\")", + "path": "GrpcService-CSharp.Server/GrpcService-CSharp.Server.csproj" + }, + { + "condition": "(HostIdentifier != \"dotnetcli\" && HostIdentifier != \"dotnetcli-preview\")", + "path": "GrpcService-CSharp.Client/GrpcService-CSharp.Client.csproj" + } + ], + "defaultName": "GrpcService-CSharp1", + "postActions": [ + { + "condition": "(!skipRestore)", + "description": "Restore NuGet packages required by this project.", + "manualInstructions": [ + { + "text": "Run 'dotnet restore'" + } + ], + "actionId": "210D431B-A78B-4D2F-B762-4ED3E3EA9025", + "continueOnError": true + } + ] +} diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/GrpcService-CSharp/.template.config/vs-2017.3.host.json b/src/ProjectTemplates/Web.ProjectTemplates/content/GrpcService-CSharp/.template.config/vs-2017.3.host.json new file mode 100644 index 0000000000..56170fd196 --- /dev/null +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/GrpcService-CSharp/.template.config/vs-2017.3.host.json @@ -0,0 +1,19 @@ +{ + "$schema": "http://json.schemastore.org/vs-2017.3.host", + "name": { + "text": "gRPC Service", + "package": "{0CD94836-1526-4E85-87D3-FB5274C5AFC9}", + "id": "1027" + }, + "description": { + "text": "A project template for creating a gRPC ASP.NET Core service.", + "package": "{0CD94836-1526-4E85-87D3-FB5274C5AFC9}", + "id": "1028" + }, + "order": 100, + "icon": "vs-2017.3/Empty.png", + "learnMoreLink": "https://go.microsoft.com/fwlink/?LinkID=784883", + "uiFilters": [ "oneaspnet" ], + "supportsDocker": true, + "excludeLaunchSettings": false +} diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/GrpcService-CSharp/.template.config/vs-2017.3/Empty.png b/src/ProjectTemplates/Web.ProjectTemplates/content/GrpcService-CSharp/.template.config/vs-2017.3/Empty.png new file mode 100644 index 0000000000000000000000000000000000000000..ea4b7e2492e49a6cbf0f4c8974264f780a26dfda GIT binary patch literal 303 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1|*BCs=fdz&H|6fVg?4jBOuH;Rhv&5DEQFR z#WAEJ?(OxBT!#z<*dCl#b*|mwByO5;{9Nt)Z>+CwY`kEut(Ci2&SioycUO7yUenXZ zqJ*q~*<-vL*LX{n1E*1f(WT*0=6;r(8{1sYsVE9N$JoZz=qxHX@# z?DyN>avo-!5#67n142cQR3EhR<_L7S|2^RPR*NQvSsY9+6e{>Rlq>jGC~z$3RA`WE z`rcpw#3oJO5Bw| 0 ? args[0] : "50051"; + + var channel = new Channel("localhost:" + port, ChannelCredentials.Insecure); + var client = new Greeter.GreeterClient(channel); + + var reply = await client.SayHelloAsync(new HelloRequest { Name = "GreeterClient" }); + Console.WriteLine("Greeting: " + reply.Message); + + await channel.ShutdownAsync(); + + Console.WriteLine("Press any key to exit..."); + Console.ReadKey(); + } + } +} diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/GrpcService-CSharp/GrpcService-CSharp.Server/Program.cs b/src/ProjectTemplates/Web.ProjectTemplates/content/GrpcService-CSharp/GrpcService-CSharp.Server/Program.cs new file mode 100644 index 0000000000..94905231a0 --- /dev/null +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/GrpcService-CSharp/GrpcService-CSharp.Server/Program.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Hosting; +using Microsoft.Extensions.Hosting; + +namespace GrpcService_CSharp +{ + public class Program + { + public static void Main(string[] args) + { + CreateHostBuilder(args).Build().Run(); + } + + public static IHostBuilder CreateHostBuilder(string[] args) => + Host.CreateDefaultBuilder(args) + .ConfigureWebHostDefaults(webBuilder => + { + webBuilder.UseStartup(); + }); + } +} diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/GrpcService-CSharp/GrpcService-CSharp.Server/Properties/launchSettings.json b/src/ProjectTemplates/Web.ProjectTemplates/content/GrpcService-CSharp/GrpcService-CSharp.Server/Properties/launchSettings.json new file mode 100644 index 0000000000..6e2866b911 --- /dev/null +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/GrpcService-CSharp/GrpcService-CSharp.Server/Properties/launchSettings.json @@ -0,0 +1,12 @@ +{ + "profiles": { + "GrpcService-CSharp": { + "commandName": "Project", + "launchBrowser": false, + "applicationUrl": "http://localhost:50051", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + } + } +} \ No newline at end of file diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/GrpcService-CSharp/GrpcService-CSharp.Server/Services/GreeterService.cs b/src/ProjectTemplates/Web.ProjectTemplates/content/GrpcService-CSharp/GrpcService-CSharp.Server/Services/GreeterService.cs new file mode 100644 index 0000000000..2e67465c6e --- /dev/null +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/GrpcService-CSharp/GrpcService-CSharp.Server/Services/GreeterService.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Greet; +using Grpc.Core; + +namespace GrpcService_CSharp +{ + public class GreeterService : Greeter.GreeterBase + { + public override Task SayHello(HelloRequest request, ServerCallContext context) + { + return Task.FromResult(new HelloReply + { + Message = "Hello " + request.Name + }); + } + } +} diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/GrpcService-CSharp/GrpcService-CSharp.Server/Startup.cs b/src/ProjectTemplates/Web.ProjectTemplates/content/GrpcService-CSharp/GrpcService-CSharp.Server/Startup.cs new file mode 100644 index 0000000000..fd4841db07 --- /dev/null +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/GrpcService-CSharp/GrpcService-CSharp.Server/Startup.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Hosting; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Hosting; + +namespace GrpcService_CSharp +{ + public class Startup + { + // This method gets called by the runtime. Use this method to add services to the container. + // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940 + public void ConfigureServices(IServiceCollection services) + { + services.AddGrpc(); + } + + // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. + public void Configure(IApplicationBuilder app, IWebHostEnvironment env) + { + if (env.IsDevelopment()) + { + app.UseDeveloperExceptionPage(); + } + + app.UseRouting(routes => + { + routes.MapGrpcService(); + }); + } + } +} diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/GrpcService-CSharp/GrpcService-CSharp.Server/appsettings.Development.json b/src/ProjectTemplates/Web.ProjectTemplates/content/GrpcService-CSharp/GrpcService-CSharp.Server/appsettings.Development.json new file mode 100644 index 0000000000..e203e9407e --- /dev/null +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/GrpcService-CSharp/GrpcService-CSharp.Server/appsettings.Development.json @@ -0,0 +1,9 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Debug", + "System": "Information", + "Microsoft": "Information" + } + } +} diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/GrpcService-CSharp/GrpcService-CSharp.Server/appsettings.json b/src/ProjectTemplates/Web.ProjectTemplates/content/GrpcService-CSharp/GrpcService-CSharp.Server/appsettings.json new file mode 100644 index 0000000000..efb26250e8 --- /dev/null +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/GrpcService-CSharp/GrpcService-CSharp.Server/appsettings.json @@ -0,0 +1,14 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Warning", + "Microsoft.Hosting.Lifetime": "Information" + } + }, + "AllowedHosts": "*", + "Kestrel": { + "EndpointDefaults": { + "Protocols": "Http2" + } + } +} diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/GrpcService-CSharp/GrpcService-CSharp.sln b/src/ProjectTemplates/Web.ProjectTemplates/content/GrpcService-CSharp/GrpcService-CSharp.sln new file mode 100644 index 0000000000..929080211c --- /dev/null +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/GrpcService-CSharp/GrpcService-CSharp.sln @@ -0,0 +1,50 @@ +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.27130.2027 +MinimumVisualStudioVersion = 15.0.26124.0 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GrpcService-CSharp.Server", "GrpcService-CSharp.Server\GrpcService-CSharp.Server.csproj", "{650B3CE7-2E93-4CC4-9F46-466686815EAA}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GrpcService-CSharp.Client", "GrpcService-CSharp.Client\GrpcService-CSharp.Client.csproj", "{5990939C-7E7B-4CFA-86FF-44CA5756498A}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|Any CPU = Release|Any CPU + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {5990939C-7E7B-4CFA-86FF-44CA5756498A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5990939C-7E7B-4CFA-86FF-44CA5756498A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5990939C-7E7B-4CFA-86FF-44CA5756498A}.Debug|x64.ActiveCfg = Debug|Any CPU + {5990939C-7E7B-4CFA-86FF-44CA5756498A}.Debug|x64.Build.0 = Debug|Any CPU + {5990939C-7E7B-4CFA-86FF-44CA5756498A}.Debug|x86.ActiveCfg = Debug|Any CPU + {5990939C-7E7B-4CFA-86FF-44CA5756498A}.Debug|x86.Build.0 = Debug|Any CPU + {5990939C-7E7B-4CFA-86FF-44CA5756498A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5990939C-7E7B-4CFA-86FF-44CA5756498A}.Release|Any CPU.Build.0 = Release|Any CPU + {5990939C-7E7B-4CFA-86FF-44CA5756498A}.Release|x64.ActiveCfg = Release|Any CPU + {5990939C-7E7B-4CFA-86FF-44CA5756498A}.Release|x64.Build.0 = Release|Any CPU + {5990939C-7E7B-4CFA-86FF-44CA5756498A}.Release|x86.ActiveCfg = Release|Any CPU + {5990939C-7E7B-4CFA-86FF-44CA5756498A}.Release|x86.Build.0 = Release|Any CPU + {650B3CE7-2E93-4CC4-9F46-466686815EAA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {650B3CE7-2E93-4CC4-9F46-466686815EAA}.Debug|Any CPU.Build.0 = Debug|Any CPU + {650B3CE7-2E93-4CC4-9F46-466686815EAA}.Debug|x64.ActiveCfg = Debug|Any CPU + {650B3CE7-2E93-4CC4-9F46-466686815EAA}.Debug|x64.Build.0 = Debug|Any CPU + {650B3CE7-2E93-4CC4-9F46-466686815EAA}.Debug|x86.ActiveCfg = Debug|Any CPU + {650B3CE7-2E93-4CC4-9F46-466686815EAA}.Debug|x86.Build.0 = Debug|Any CPU + {650B3CE7-2E93-4CC4-9F46-466686815EAA}.Release|Any CPU.ActiveCfg = Release|Any CPU + {650B3CE7-2E93-4CC4-9F46-466686815EAA}.Release|Any CPU.Build.0 = Release|Any CPU + {650B3CE7-2E93-4CC4-9F46-466686815EAA}.Release|x64.ActiveCfg = Release|Any CPU + {650B3CE7-2E93-4CC4-9F46-466686815EAA}.Release|x64.Build.0 = Release|Any CPU + {650B3CE7-2E93-4CC4-9F46-466686815EAA}.Release|x86.ActiveCfg = Release|Any CPU + {650B3CE7-2E93-4CC4-9F46-466686815EAA}.Release|x86.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {4C26868E-5E7C-458D-82E3-040509D0C71F} + EndGlobalSection +EndGlobal diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/GrpcService-CSharp/Protos/greet.proto b/src/ProjectTemplates/Web.ProjectTemplates/content/GrpcService-CSharp/Protos/greet.proto new file mode 100644 index 0000000000..75721ab7d1 --- /dev/null +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/GrpcService-CSharp/Protos/greet.proto @@ -0,0 +1,19 @@ +syntax = "proto3"; + +package Greet; + +// The greeting service definition. +service Greeter { + // Sends a greeting + rpc SayHello (HelloRequest) returns (HelloReply) {} +} + +// The request message containing the user's name. +message HelloRequest { + string name = 1; +} + +// The response message containing the greetings. +message HelloReply { + string message = 1; +} From 26006e5b10ce73110370a517edf956c77e21a18c Mon Sep 17 00:00:00 2001 From: Artak Mkrtchyan Date: Thu, 21 Feb 2019 13:42:53 -0800 Subject: [PATCH 3/3] Updated the survey link for 0.9 release --- .../BlazorHosted-CSharp.Client/Shared/SurveyPrompt.cshtml | 2 +- .../content/BlazorStandalone-CSharp/Shared/SurveyPrompt.cshtml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Components/Blazor/Templates/src/content/BlazorHosted-CSharp/BlazorHosted-CSharp.Client/Shared/SurveyPrompt.cshtml b/src/Components/Blazor/Templates/src/content/BlazorHosted-CSharp/BlazorHosted-CSharp.Client/Shared/SurveyPrompt.cshtml index 7264f2d548..e534ca64fc 100644 --- a/src/Components/Blazor/Templates/src/content/BlazorHosted-CSharp/BlazorHosted-CSharp.Client/Shared/SurveyPrompt.cshtml +++ b/src/Components/Blazor/Templates/src/content/BlazorHosted-CSharp/BlazorHosted-CSharp.Client/Shared/SurveyPrompt.cshtml @@ -4,7 +4,7 @@ Please take our - brief survey + brief survey and tell us what you think. diff --git a/src/Components/Blazor/Templates/src/content/BlazorStandalone-CSharp/Shared/SurveyPrompt.cshtml b/src/Components/Blazor/Templates/src/content/BlazorStandalone-CSharp/Shared/SurveyPrompt.cshtml index 7264f2d548..e534ca64fc 100644 --- a/src/Components/Blazor/Templates/src/content/BlazorStandalone-CSharp/Shared/SurveyPrompt.cshtml +++ b/src/Components/Blazor/Templates/src/content/BlazorStandalone-CSharp/Shared/SurveyPrompt.cshtml @@ -4,7 +4,7 @@ Please take our - brief survey + brief survey and tell us what you think.