Skip to content

Commit 51e391d

Browse files
authored
Merge branch 'master' into dougbu/dotnet.msbuild
2 parents fc607e9 + 2787157 commit 51e391d

25 files changed

+7202
-29
lines changed

eng/Version.Details.xml

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,33 +13,33 @@
1313
<Uri>https://github.com/dotnet/blazor</Uri>
1414
<Sha>dd7fb4d3931d556458f62642c2edfc59f6295bfb</Sha>
1515
</Dependency>
16-
<Dependency Name="dotnet-ef" Version="5.0.0-preview.6.20276.2">
16+
<Dependency Name="dotnet-ef" Version="5.0.0-preview.6.20277.5">
1717
<Uri>https://github.com/dotnet/efcore</Uri>
18-
<Sha>46636e00447b1303e1ea439b68bfada1cdcb8393</Sha>
18+
<Sha>5dbadb2ecbfcaf82bedaf829cc33c259fa781ce6</Sha>
1919
</Dependency>
20-
<Dependency Name="Microsoft.EntityFrameworkCore.InMemory" Version="5.0.0-preview.6.20276.2">
20+
<Dependency Name="Microsoft.EntityFrameworkCore.InMemory" Version="5.0.0-preview.6.20277.5">
2121
<Uri>https://github.com/dotnet/efcore</Uri>
22-
<Sha>46636e00447b1303e1ea439b68bfada1cdcb8393</Sha>
22+
<Sha>5dbadb2ecbfcaf82bedaf829cc33c259fa781ce6</Sha>
2323
</Dependency>
24-
<Dependency Name="Microsoft.EntityFrameworkCore.Relational" Version="5.0.0-preview.6.20276.2">
24+
<Dependency Name="Microsoft.EntityFrameworkCore.Relational" Version="5.0.0-preview.6.20277.5">
2525
<Uri>https://github.com/dotnet/efcore</Uri>
26-
<Sha>46636e00447b1303e1ea439b68bfada1cdcb8393</Sha>
26+
<Sha>5dbadb2ecbfcaf82bedaf829cc33c259fa781ce6</Sha>
2727
</Dependency>
28-
<Dependency Name="Microsoft.EntityFrameworkCore.Sqlite" Version="5.0.0-preview.6.20276.2">
28+
<Dependency Name="Microsoft.EntityFrameworkCore.Sqlite" Version="5.0.0-preview.6.20277.5">
2929
<Uri>https://github.com/dotnet/efcore</Uri>
30-
<Sha>46636e00447b1303e1ea439b68bfada1cdcb8393</Sha>
30+
<Sha>5dbadb2ecbfcaf82bedaf829cc33c259fa781ce6</Sha>
3131
</Dependency>
32-
<Dependency Name="Microsoft.EntityFrameworkCore.SqlServer" Version="5.0.0-preview.6.20276.2">
32+
<Dependency Name="Microsoft.EntityFrameworkCore.SqlServer" Version="5.0.0-preview.6.20277.5">
3333
<Uri>https://github.com/dotnet/efcore</Uri>
34-
<Sha>46636e00447b1303e1ea439b68bfada1cdcb8393</Sha>
34+
<Sha>5dbadb2ecbfcaf82bedaf829cc33c259fa781ce6</Sha>
3535
</Dependency>
36-
<Dependency Name="Microsoft.EntityFrameworkCore.Tools" Version="5.0.0-preview.6.20276.2">
36+
<Dependency Name="Microsoft.EntityFrameworkCore.Tools" Version="5.0.0-preview.6.20277.5">
3737
<Uri>https://github.com/dotnet/efcore</Uri>
38-
<Sha>46636e00447b1303e1ea439b68bfada1cdcb8393</Sha>
38+
<Sha>5dbadb2ecbfcaf82bedaf829cc33c259fa781ce6</Sha>
3939
</Dependency>
40-
<Dependency Name="Microsoft.EntityFrameworkCore" Version="5.0.0-preview.6.20276.2">
40+
<Dependency Name="Microsoft.EntityFrameworkCore" Version="5.0.0-preview.6.20277.5">
4141
<Uri>https://github.com/dotnet/efcore</Uri>
42-
<Sha>46636e00447b1303e1ea439b68bfada1cdcb8393</Sha>
42+
<Sha>5dbadb2ecbfcaf82bedaf829cc33c259fa781ce6</Sha>
4343
</Dependency>
4444
<Dependency Name="Microsoft.Extensions.Caching.Abstractions" Version="5.0.0-preview.6.20271.10">
4545
<Uri>https://github.com/dotnet/runtime</Uri>

eng/Versions.props

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -130,13 +130,13 @@
130130
<!-- Packages from dotnet/blazor -->
131131
<MicrosoftAspNetCoreBlazorMonoPackageVersion>3.2.0-preview1.20067.1</MicrosoftAspNetCoreBlazorMonoPackageVersion>
132132
<!-- Packages from dotnet/efcore -->
133-
<dotnetefPackageVersion>5.0.0-preview.6.20276.2</dotnetefPackageVersion>
134-
<MicrosoftEntityFrameworkCoreInMemoryPackageVersion>5.0.0-preview.6.20276.2</MicrosoftEntityFrameworkCoreInMemoryPackageVersion>
135-
<MicrosoftEntityFrameworkCoreRelationalPackageVersion>5.0.0-preview.6.20276.2</MicrosoftEntityFrameworkCoreRelationalPackageVersion>
136-
<MicrosoftEntityFrameworkCoreSqlitePackageVersion>5.0.0-preview.6.20276.2</MicrosoftEntityFrameworkCoreSqlitePackageVersion>
137-
<MicrosoftEntityFrameworkCoreSqlServerPackageVersion>5.0.0-preview.6.20276.2</MicrosoftEntityFrameworkCoreSqlServerPackageVersion>
138-
<MicrosoftEntityFrameworkCoreToolsPackageVersion>5.0.0-preview.6.20276.2</MicrosoftEntityFrameworkCoreToolsPackageVersion>
139-
<MicrosoftEntityFrameworkCorePackageVersion>5.0.0-preview.6.20276.2</MicrosoftEntityFrameworkCorePackageVersion>
133+
<dotnetefPackageVersion>5.0.0-preview.6.20277.5</dotnetefPackageVersion>
134+
<MicrosoftEntityFrameworkCoreInMemoryPackageVersion>5.0.0-preview.6.20277.5</MicrosoftEntityFrameworkCoreInMemoryPackageVersion>
135+
<MicrosoftEntityFrameworkCoreRelationalPackageVersion>5.0.0-preview.6.20277.5</MicrosoftEntityFrameworkCoreRelationalPackageVersion>
136+
<MicrosoftEntityFrameworkCoreSqlitePackageVersion>5.0.0-preview.6.20277.5</MicrosoftEntityFrameworkCoreSqlitePackageVersion>
137+
<MicrosoftEntityFrameworkCoreSqlServerPackageVersion>5.0.0-preview.6.20277.5</MicrosoftEntityFrameworkCoreSqlServerPackageVersion>
138+
<MicrosoftEntityFrameworkCoreToolsPackageVersion>5.0.0-preview.6.20277.5</MicrosoftEntityFrameworkCoreToolsPackageVersion>
139+
<MicrosoftEntityFrameworkCorePackageVersion>5.0.0-preview.6.20277.5</MicrosoftEntityFrameworkCorePackageVersion>
140140
</PropertyGroup>
141141
<!--
142142
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
[assembly: BenchmarkDotNet.Attributes.AspNetCoreBenchmark]
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
// Copyright (c) .NET Foundation. All rights reserved.
2+
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
3+
4+
using System;
5+
using System.IO;
6+
using BenchmarkDotNet.Attributes;
7+
using Microsoft.AspNetCore.Mvc.Razor.Extensions;
8+
using Microsoft.AspNetCore.Razor.Language;
9+
10+
namespace Microsoft.AspNetCore.Razor.Performance
11+
{
12+
public class CodeGenerationBenchmark
13+
{
14+
public CodeGenerationBenchmark()
15+
{
16+
var current = new DirectoryInfo(AppContext.BaseDirectory);
17+
while (current != null && !File.Exists(Path.Combine(current.FullName, "MSN.cshtml")))
18+
{
19+
current = current.Parent;
20+
}
21+
22+
var root = current;
23+
var fileSystem = RazorProjectFileSystem.Create(root.FullName);
24+
25+
ProjectEngine = RazorProjectEngine.Create(RazorConfiguration.Default, fileSystem, b => RazorExtensions.Register(b)); ;
26+
27+
MSN = fileSystem.GetItem(Path.Combine(root.FullName, "MSN.cshtml"), FileKinds.Legacy);
28+
}
29+
30+
public RazorProjectEngine ProjectEngine { get; }
31+
32+
public RazorProjectItem MSN { get; }
33+
34+
[Benchmark(Description = "Razor Design Time Code Generation of MSN.com")]
35+
public void CodeGeneration_DesignTime_LargeStaticFile()
36+
{
37+
var codeDocument = ProjectEngine.ProcessDesignTime(MSN);
38+
var generated = codeDocument.GetCSharpDocument();
39+
40+
if (generated.Diagnostics.Count != 0)
41+
{
42+
throw new Exception("Error!" + Environment.NewLine + string.Join(Environment.NewLine, generated.Diagnostics));
43+
}
44+
}
45+
46+
[Benchmark(Description = "Razor Runtime Code Generation of MSN.com")]
47+
public void CodeGeneration_Runtime_LargeStaticFile()
48+
{
49+
var codeDocument = ProjectEngine.Process(MSN);
50+
var generated = codeDocument.GetCSharpDocument();
51+
52+
if (generated.Diagnostics.Count != 0)
53+
{
54+
throw new Exception("Error!" + Environment.NewLine + string.Join(Environment.NewLine, generated.Diagnostics));
55+
}
56+
}
57+
}
58+
}

src/Razor/perf/Microsoft.AspNetCore.Razor.Performance/MSN.cshtml

Lines changed: 3983 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFramework>netcoreapp2.1</TargetFramework>
5+
<OutputType>Exe</OutputType>
6+
<ServerGarbageCollection>true</ServerGarbageCollection>
7+
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
8+
<IsPackable>false</IsPackable>
9+
<ExcludeFromSourceBuild>true</ExcludeFromSourceBuild>
10+
</PropertyGroup>
11+
12+
<ItemGroup>
13+
<Reference Include="Microsoft.AspNetCore.Mvc.Razor.Extensions" />
14+
<Reference Include="BenchmarkDotNet" />
15+
<Reference Include="Newtonsoft.Json" />
16+
</ItemGroup>
17+
18+
<ItemGroup>
19+
<Compile Include="$(SharedSourceRoot)BenchmarkRunner\*.cs" />
20+
</ItemGroup>
21+
22+
</Project>
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
// Copyright (c) .NET Foundation. All rights reserved.
2+
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
3+
4+
using System;
5+
using System.IO;
6+
using System.Linq;
7+
using BenchmarkDotNet.Attributes;
8+
using Microsoft.AspNetCore.Mvc.Razor.Extensions;
9+
using Microsoft.AspNetCore.Razor.Language;
10+
11+
namespace Microsoft.AspNetCore.Razor.Performance
12+
{
13+
public class SyntaxTreeGenerationBenchmark
14+
{
15+
public SyntaxTreeGenerationBenchmark()
16+
{
17+
var current = new DirectoryInfo(AppContext.BaseDirectory);
18+
while (current != null && !File.Exists(Path.Combine(current.FullName, "MSN.cshtml")))
19+
{
20+
current = current.Parent;
21+
}
22+
23+
var root = current;
24+
var fileSystem = RazorProjectFileSystem.Create(root.FullName);
25+
26+
ProjectEngine = RazorProjectEngine.Create(RazorConfiguration.Default, fileSystem, b => RazorExtensions.Register(b)); ;
27+
28+
var projectItem = fileSystem.GetItem(Path.Combine(root.FullName, "MSN.cshtml"), FileKinds.Legacy);
29+
MSN = RazorSourceDocument.ReadFrom(projectItem);
30+
31+
var directiveFeature = ProjectEngine.EngineFeatures.OfType<IRazorDirectiveFeature>().FirstOrDefault();
32+
Directives = directiveFeature?.Directives.ToArray() ?? Array.Empty<DirectiveDescriptor>();
33+
}
34+
35+
public RazorProjectEngine ProjectEngine { get; }
36+
37+
public RazorSourceDocument MSN { get; }
38+
39+
public DirectiveDescriptor[] Directives { get; }
40+
41+
[Benchmark(Description = "Razor Design Time Syntax Tree Generation of MSN.com")]
42+
public void SyntaxTreeGeneration_DesignTime_LargeStaticFile()
43+
{
44+
var options = RazorParserOptions.CreateDesignTime(o =>
45+
{
46+
foreach (var directive in Directives)
47+
{
48+
o.Directives.Add(directive);
49+
}
50+
});
51+
var syntaxTree = RazorSyntaxTree.Parse(MSN, options);
52+
53+
if (syntaxTree.Diagnostics.Count != 0)
54+
{
55+
throw new Exception("Error!" + Environment.NewLine + string.Join(Environment.NewLine, syntaxTree.Diagnostics));
56+
}
57+
}
58+
59+
[Benchmark(Description = "Razor Runtime Syntax Tree Generation of MSN.com")]
60+
public void SyntaxTreeGeneration_Runtime_LargeStaticFile()
61+
{
62+
var options = RazorParserOptions.Create(o =>
63+
{
64+
foreach (var directive in Directives)
65+
{
66+
o.Directives.Add(directive);
67+
}
68+
});
69+
var syntaxTree = RazorSyntaxTree.Parse(MSN, options);
70+
71+
if (syntaxTree.Diagnostics.Count != 0)
72+
{
73+
throw new Exception("Error!" + Environment.NewLine + string.Join(Environment.NewLine, syntaxTree.Diagnostics));
74+
}
75+
}
76+
}
77+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
Compile the solution in Release mode (so binaries are available in release)
2+
3+
To run a specific benchmark add it as parameter.
4+
```
5+
dotnet run -c Release <benchmark_name>
6+
```
7+
8+
If you run without any parameters, you'll be offered the list of all benchmarks and get to choose.
9+
```
10+
dotnet run -c Release
11+
```

src/Razor/perf/Microsoft.AspNetCore.Razor.Performance/taghelpers.json

Lines changed: 1 addition & 0 deletions
Large diffs are not rendered by default.

src/Razor/test/Directory.Build.props

Lines changed: 0 additions & 7 deletions
This file was deleted.

src/Razor/test/Microsoft.AspNetCore.Razor.Test.ComponentShim/Microsoft.AspNetCore.Razor.Test.ComponentShim.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
<PropertyGroup>
44
<TargetFrameworks>netstandard2.0;net461</TargetFrameworks>
5-
<DisablePubternalApiCheck>true</DisablePubternalApiCheck>
65
</PropertyGroup>
76

87
</Project>

0 commit comments

Comments
 (0)