这是indexloc提供的服务,不要输入任何密码
Skip to content
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
7 changes: 5 additions & 2 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
<Import Project="eng\targets\NuGet.targets" />

<PropertyGroup>
<PackageIconUrl>http://go.microsoft.com/fwlink/?LinkID=288859</PackageIconUrl>

<PackageIcon>icon.png</PackageIcon>
<!-- private repo, don't do source-link -->
<DeterministicSourcePaths>false</DeterministicSourcePaths>
<EnableSourceLink>false</EnableSourceLink>
Expand All @@ -15,6 +14,10 @@
<NoWarn>$(NoWarn);NU5104</NoWarn>
</PropertyGroup>

<ItemGroup>
<None Include="$(MSBuildThisFileDirectory)icon.png" Pack="true" PackagePath="\"/>
</ItemGroup>

<PropertyGroup>
<!-- These properties are needed so that version number can be same for MLS.Agent.Tools and the libraries that depend on it -->
<NewtonsoftJsonVersion>12.0.02</NewtonsoftJsonVersion>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@
"sortText": "SetOut",
"insertText": "SetOut",
"documentation": {
"value": "Sets the System.Console.Out property to the specified System.IO.TextWriter object.",
"value": "Sets the System.Console.Out property to target the System.IO.TextWriter object.",
"isTrusted": false
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
"name": "index",
"label": "int index",
"documentation": {
"value": "**index**: The starting position in buffer.",
"value": "**index**: The starting position in buffer .",
"isTrusted": false
}
},
Expand Down Expand Up @@ -234,7 +234,7 @@
"name": "arg0",
"label": "object arg0",
"documentation": {
"value": "**arg0**: An object to write using format.",
"value": "**arg0**: An object to write using format .",
"isTrusted": false
}
}
Expand All @@ -260,15 +260,15 @@
"name": "arg0",
"label": "object arg0",
"documentation": {
"value": "**arg0**: The first object to write using format.",
"value": "**arg0**: The first object to write using format .",
"isTrusted": false
}
},
{
"name": "arg1",
"label": "object arg1",
"documentation": {
"value": "**arg1**: The second object to write using format.",
"value": "**arg1**: The second object to write using format .",
"isTrusted": false
}
}
Expand All @@ -294,23 +294,23 @@
"name": "arg0",
"label": "object arg0",
"documentation": {
"value": "**arg0**: The first object to write using format.",
"value": "**arg0**: The first object to write using format .",
"isTrusted": false
}
},
{
"name": "arg1",
"label": "object arg1",
"documentation": {
"value": "**arg1**: The second object to write using format.",
"value": "**arg1**: The second object to write using format .",
"isTrusted": false
}
},
{
"name": "arg2",
"label": "object arg2",
"documentation": {
"value": "**arg2**: The third object to write using format.",
"value": "**arg2**: The third object to write using format .",
"isTrusted": false
}
}
Expand All @@ -336,7 +336,7 @@
"name": "arg",
"label": "params object[] arg",
"documentation": {
"value": "**arg**: An array of objects to write using format.",
"value": "**arg**: An array of objects to write using format .",
"isTrusted": false
}
}
Expand Down
2 changes: 1 addition & 1 deletion MLS.Agent.Tests/MLS.Agent.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.AspNetCore.TestHost" Version="3.0.0-preview7.19365.7" />
<PackageReference Include="Microsoft.AspNetCore.TestHost" Version="3.0.0-rc1.19457.4" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.02" />
<PackageReference Include="Pocket.Disposable" Version="1.0.5">
<PrivateAssets>all</PrivateAssets>
Expand Down
6 changes: 6 additions & 0 deletions MLS.Agent.Tools/TypeExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

using System;
using System.IO;
using System.Linq;

namespace MLS.Agent.Tools
{
Expand All @@ -11,6 +12,11 @@ public static class TypeExtensions
public static string ReadManifestResource(this Type type, string resourceName)
{
var assembly = type.Assembly;
if (!assembly.GetManifestResourceNames().Contains(resourceName))
{
throw new ArgumentException(assembly + " " + resourceName);
}

using (var reader = new StreamReader(assembly.GetManifestResourceStream(resourceName)))
{
return reader.ReadToEnd();
Expand Down
5 changes: 4 additions & 1 deletion MLS.Agent/MLS.Agent.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
<PackageReference Include="Markdig" Version="0.17.1" />
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.3.0" />
<PackageReference Include="Microsoft.AspNetCore.Blazor.Server" Version="3.0.0-preview7.19365.7" />
<PackageReference Include="Microsoft.AspNetCore.Http.Features" Version="3.0.0-rc1.19457.4" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="3.0.0-preview7.19365.7" />
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="2.9.4" PrivateAssets="all" />
<PackageReference Include="Serilog.Sinks.RollingFileAlternate" Version="2.0.9" />
Expand Down Expand Up @@ -113,7 +114,9 @@
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="..\MLS.PackageTool\MLS.PackageTool.csproj" />
<EmbeddedResource Include="..\MLS.PackageTool\Program.cs" />
<EmbeddedResource Include="..\MLS.PackageTool\Program.cs">
<LogicalName>MLS.Agent.Program.cs</LogicalName>
</EmbeddedResource>
<EmbeddedResource Include="$(IntermediateOutputPath)/demo.zip">
<LogicalName>demo.zip</LogicalName>
</EmbeddedResource>
Expand Down
1 change: 0 additions & 1 deletion MLS.Agent/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,6 @@ public void ConfigureServices(IServiceCollection services)
options.MimeTypes = ResponseCompressionDefaults.MimeTypes.Concat(new[]
{
MediaTypeNames.Application.Octet,
WasmMediaTypeNames.Application.Wasm
});
});

Expand Down
4 changes: 1 addition & 3 deletions MLS.Blazor/App.razor
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
<Router AppAssembly="typeof(Program).Assembly">
<NotFoundContent>
<p>Sorry, there's nothing at this address.</p>
</NotFoundContent>

</Router>
9 changes: 5 additions & 4 deletions MLS.Blazor/MLS.Blazor.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Blazor" Version="3.0.0-preview7.19365.7" />
<PackageReference Include="Microsoft.AspNetCore.Blazor.Build" Version="3.0.0-preview7.19365.7" PrivateAssets="all" />
<PackageReference Include="Microsoft.AspNetCore.Blazor.DevServer" Version="3.0.0-preview7.19365.7" PrivateAssets="all" />
<PackageReference Include="Microsoft.AspNetCore.Blazor" Version="3.0.0-preview9.19457.4" />
<PackageReference Include="Microsoft.AspNetCore.Blazor.Build" Version="3.0.0-preview9.19424.4" PrivateAssets="all" />
<PackageReference Include="Microsoft.AspNetCore.Blazor.DevServer" Version="3.0.0-preview9.19424.4" PrivateAssets="all" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.2" />
</ItemGroup>

Expand All @@ -34,7 +34,8 @@
</ItemGroup>

<ItemGroup>
<EmbeddedResource Include="Linker.xml" />
<EmbeddedResource Include="Linker.xml" />
<EmbeddedResource Include="App.razor" />
<EmbeddedResource Include="Program.cs" />
<EmbeddedResource Include="Startup.cs" />
<EmbeddedResource Include="wwwroot\index.html" />
Expand Down
63 changes: 32 additions & 31 deletions MLS.Blazor/Pages/Index.razor
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@
@inject IJSRuntime jsRuntime;
<h1>Hello, world!</h1>

Welcome to your new app.

<SurveyPrompt Title="How is Blazor working for you?" />

@using Newtonsoft.Json;
@using Newtonsoft.Json.Linq;
Expand All @@ -15,44 +12,48 @@ Welcome to your new app.

private CodeRunner runner = new CodeRunner();

protected override async Task OnAfterRenderAsync()
protected override async Task OnAfterRenderAsync(bool firstRender)
{
await base.OnAfterRenderAsync();
await base.OnAfterRenderAsync(firstRender);

if (firstRender)
{
await jsRuntime.InvokeAsync<object>(
"BlazorInterop.install",
DotNetObjectRef.Create(this));

await PostMessage(JObject.FromObject(new { ready = true }).ToString());
}
"BlazorInterop.install",
DotNetObjectReference.Create(this));

public Task<string> PostMessage(string message)
{
// Implemented in interop.js
return jsRuntime.InvokeAsync<string>(
"BlazorInterop.postMessage",
message);
await PostMessage(JObject.FromObject(new { ready = true }).ToString());
}
}

[JSInvokable("MLS.Blazor.PostMessageAsync")]
public async Task<string> PostMessageAsync(string message)
{
try
public ValueTask<string> PostMessage(string message)
{
var result = runner.ProcessRunRequest(message);
var logMsg = $"Computed {JObject.FromObject(result).ToString()}";
await jsRuntime.InvokeAsync<string>("BlazorInterop.log", logMsg);
// Implemented in interop.js
return jsRuntime.InvokeAsync<string>
("BlazorInterop.postMessage", message);
}

if (result != null)
[JSInvokable("MLS.Blazor.PostMessageAsync")]
public async Task<string>
PostMessageAsync(string message)
{
try
{
var result = runner.ProcessRunRequest(message);
var logMsg = $"Computed {JObject.FromObject(result).ToString()}";
await jsRuntime.InvokeAsync<string>("BlazorInterop.log", logMsg);

if (result != null)
{
return JObject.FromObject(result).ToString();
// await PostMessage(JObject.FromObject(result).ToString());
}
}
catch
{
}

return null;
}
}
catch
{
}

return null;
}
}
}
2 changes: 1 addition & 1 deletion MLS.Blazor/_Imports.razor
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@using System.Net.Http
@using Microsoft.AspNetCore.Components.Forms
@using Microsoft.AspNetCore.Components.Layouts
@using Microsoft.AspNetCore.Components.Web
@using Microsoft.AspNetCore.Components.Routing
@using Microsoft.JSInterop
@using MLS.Blazor
1 change: 1 addition & 0 deletions WorkspaceServer.Tests/BlazorPackageInitializerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ public async Task Initializes_project_with_right_files()
await initializer.Initialize(dir);

var rootFiles = dir.GetFiles();
rootFiles.Should().Contain(f => f.Name == "App.razor");
rootFiles.Should().Contain(f => f.Name == "Program.cs");
rootFiles.Should().Contain(f => f.Name == "Startup.cs");
rootFiles.Should().Contain(f => f.Name == "Linker.xml");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -718,7 +718,7 @@ public static IEnumerable<int> Fibonacci()

sample.Parameters.ElementAt(1).Name.Should().Be("arg");
sample.Parameters.ElementAt(1).Label.Should().Be("params object[] arg");
sample.Parameters.ElementAt(1).Documentation.Value.Should().Contain("An array of objects to write using format.");
sample.Parameters.ElementAt(1).Documentation.Value.Should().Contain("An array of objects to write using format .");
}
}
}
4 changes: 2 additions & 2 deletions WorkspaceServer/Packaging/BlazorPackageInitializer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public class BlazorPackageInitializer : PackageInitializer
private readonly List<(string packageName, string packageVersion)> _addPackages;

public BlazorPackageInitializer(string name, List<(string packageName, string packageVersion)> addPackages) :
base("blazor", "MLS.Blazor")
base("blazorwasm", "MLS.Blazor")
{
_name = name;
var packages = addPackages ?? throw new ArgumentNullException(nameof(addPackages));
Expand Down Expand Up @@ -84,7 +84,7 @@ private void AddEmbeddedResourceContentToProject(string root)
{
var wwwRootFiles = new[] { "index.html", "interop.js" };
var pagesFiles = new[] { "Index.razor" };
var rootFiles = new[] { "Program.cs", "Startup.cs", "CodeRunner.cs", "InteropMessage.cs", "SerializableDiagnostic.cs", "WasmCodeRunnerRequest.cs", "WasmCodeRunnerResponse.cs", "CommandLineBuilderExtensions.cs", "EntryPointDiscoverer.cs", "PreserveConsoleState.cs", "_Imports.razor", "Linker.xml" };
var rootFiles = new[] {"App.razor", "Program.cs", "Startup.cs", "CodeRunner.cs", "InteropMessage.cs", "SerializableDiagnostic.cs", "WasmCodeRunnerRequest.cs", "WasmCodeRunnerResponse.cs", "CommandLineBuilderExtensions.cs", "EntryPointDiscoverer.cs", "PreserveConsoleState.cs", "_Imports.razor", "Linker.xml" };

WriteResourcesToLocation(wwwRootFiles, Path.Combine(root, "wwwroot"));
WriteResourcesToLocation(pagesFiles, Path.Combine(root, "Pages"));
Expand Down
1 change: 1 addition & 0 deletions WorkspaceServer/WorkspaceServer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@
<EmbeddedResource Include="..\MLS.Blazor\wwwroot\interop.js" />
<!--<EmbeddedResource Include="..\MLS.Blazor\Pages\_Imports.razor" />-->
<EmbeddedResource Include="..\MLS.Blazor\_Imports.razor" />
<EmbeddedResource Include="..\MLS.Blazor\App.razor" />
<EmbeddedResource Include="..\MLS.Blazor\Pages\Index.razor" />

<EmbeddedResource Include="..\WasmCodeRunner\CodeRunner.cs" />
Expand Down
4 changes: 2 additions & 2 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ variables:
- name: _DotNetArtifactsCategory
value: .NETCore
- name: BlazorTemplateVersion
value: 3.0.0-preview7.19365.7
value: 3.0.0-preview9.19457.4
- name: DotNetSdkVersion
value: 3.0.100-preview7-012821
value: 3.0.100-rc1-014190
- name: NodeJSVersion
value: '>=12'
- name: TryDotNetPackagesPath
Expand Down
4 changes: 2 additions & 2 deletions global.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"sdk": {
"version": "3.0.100-preview7-012821"
"version": "3.0.100-rc1-014190"
},
"tools": {
"dotnet": "3.0.100-preview7-012821"
"dotnet": "3.0.100-rc1-014190"
},
"msbuild-sdks": {
"Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19461.7"
Expand Down
Binary file added icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.