Skip to content

Commit

Permalink
Upgrade samples to net5.0 (removing netcoreapp2.1) (#579)
Browse files Browse the repository at this point in the history
This does an upgrade to net5.0 (to be followed by a 6.0 jump) to get things current.
  • Loading branch information
NickCraver authored Oct 23, 2021
1 parent 4ae9740 commit f9b191b
Show file tree
Hide file tree
Showing 83 changed files with 244 additions and 136 deletions.
18 changes: 9 additions & 9 deletions MiniProfiler.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.29021.104
# Visual Studio Version 17
VisualStudioVersion = 17.0.31612.314
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "global", "global", "{CC40098D-04F2-4F43-B5CF-B74F74351761}"
ProjectSection(SolutionItems) = preProject
Expand Down Expand Up @@ -37,8 +37,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MiniProfiler.Providers.SqlS
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Samples.Mvc5", "samples\Samples.Mvc5\Samples.Mvc5.csproj", "{C179CF56-7AC2-4340-8D43-2A3DCDB2E448}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Samples.AspNetCore2", "samples\Samples.AspNetCore2\Samples.AspNetCore2.csproj", "{A3946CAB-4BF9-47C1-A517-104CD8D7F46C}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MiniProfiler.AspNetCore", "src\MiniProfiler.AspNetCore\MiniProfiler.AspNetCore.csproj", "{6A2B5B70-1C32-482F-B5C6-0597E2D4E376}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{6A510DBF-E85F-4D2C-B8F7-006DA31B3418}"
Expand Down Expand Up @@ -96,6 +94,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "workflows", "workflows", "{
.github\workflows\main.yml = .github\workflows\main.yml
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Samples.AspNet5", "samples\Samples.AspNet5\Samples.AspNet5.csproj", "{9C7822CD-BE8E-424F-A0C6-86CC986ABB42}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -142,10 +142,6 @@ Global
{C179CF56-7AC2-4340-8D43-2A3DCDB2E448}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C179CF56-7AC2-4340-8D43-2A3DCDB2E448}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C179CF56-7AC2-4340-8D43-2A3DCDB2E448}.Release|Any CPU.Build.0 = Release|Any CPU
{A3946CAB-4BF9-47C1-A517-104CD8D7F46C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A3946CAB-4BF9-47C1-A517-104CD8D7F46C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A3946CAB-4BF9-47C1-A517-104CD8D7F46C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A3946CAB-4BF9-47C1-A517-104CD8D7F46C}.Release|Any CPU.Build.0 = Release|Any CPU
{6A2B5B70-1C32-482F-B5C6-0597E2D4E376}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6A2B5B70-1C32-482F-B5C6-0597E2D4E376}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6A2B5B70-1C32-482F-B5C6-0597E2D4E376}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand Down Expand Up @@ -210,6 +206,10 @@ Global
{D95A09CD-A291-42D0-AA41-8426090D0476}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D95A09CD-A291-42D0-AA41-8426090D0476}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D95A09CD-A291-42D0-AA41-8426090D0476}.Release|Any CPU.Build.0 = Release|Any CPU
{9C7822CD-BE8E-424F-A0C6-86CC986ABB42}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9C7822CD-BE8E-424F-A0C6-86CC986ABB42}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9C7822CD-BE8E-424F-A0C6-86CC986ABB42}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9C7822CD-BE8E-424F-A0C6-86CC986ABB42}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -225,7 +225,6 @@ Global
{D240FC79-651F-4107-95EC-30702AE610DB} = {6A510DBF-E85F-4D2C-B8F7-006DA31B3418}
{0C9A1AA9-F25F-41DF-AF57-7B7B3EBF13DA} = {6A510DBF-E85F-4D2C-B8F7-006DA31B3418}
{C179CF56-7AC2-4340-8D43-2A3DCDB2E448} = {E0DA4035-4D64-4BB8-8EA1-42197DE62519}
{A3946CAB-4BF9-47C1-A517-104CD8D7F46C} = {E0DA4035-4D64-4BB8-8EA1-42197DE62519}
{6A2B5B70-1C32-482F-B5C6-0597E2D4E376} = {6A510DBF-E85F-4D2C-B8F7-006DA31B3418}
{C7E9334A-6BFA-43A7-8FE4-393AC17DD7C1} = {6A510DBF-E85F-4D2C-B8F7-006DA31B3418}
{BC36D84D-F5C6-4E12-8BC7-2F1972A00635} = {6A510DBF-E85F-4D2C-B8F7-006DA31B3418}
Expand All @@ -243,6 +242,7 @@ Global
{BD7A4E74-ECFE-4BBE-86D9-D6DC2BED86DB} = {6A510DBF-E85F-4D2C-B8F7-006DA31B3418}
{D95A09CD-A291-42D0-AA41-8426090D0476} = {E0DA4035-4D64-4BB8-8EA1-42197DE62519}
{A14EA029-60E2-485A-B757-3626511CF2C4} = {5C8ED0C0-7DBB-4660-836E-A760E25160A0}
{9C7822CD-BE8E-424F-A0C6-86CC986ABB42} = {E0DA4035-4D64-4BB8-8EA1-42197DE62519}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {9373F37A-A996-4545-A251-1902C8886E3F}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
#if NET472
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Jobs;
using System.Collections.Generic;
using System.Web.Script.Serialization;

namespace Benchmarks.Benchmarks
{
[ClrJob]
[SimpleJob(RuntimeMoniker.Net472)]
[Config(typeof(Configs.Memory))]
public class CrazySlowJSONBenchmarks
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Jobs;
using StackExchange.Profiling;

namespace Benchmarks
{
[ClrJob, CoreJob]
[SimpleJob(RuntimeMoniker.Net472)]
[SimpleJob(RuntimeMoniker.Net50)]
[Config(typeof(Configs.Memory))]
public class CustomTimingBenchmarks
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Jobs;
using StackExchange.Profiling;
using System.Collections.Concurrent;
using System.Collections.Generic;

namespace Benchmarks.Benchmarks
{
[ClrJob, CoreJob]
[SimpleJob(RuntimeMoniker.Net472)]
[SimpleJob(RuntimeMoniker.Net50)]
[Config(typeof(Configs.Memory))]
public class DictionaryBenchmarks
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Jobs;
using Jil;
using Newtonsoft.Json;
using ServiceStack.Text;
Expand All @@ -7,7 +8,8 @@

namespace Benchmarks
{
[ClrJob, CoreJob]
[SimpleJob(RuntimeMoniker.Net472)]
[SimpleJob(RuntimeMoniker.Net50)]
[Config(typeof(Configs.Memory))]
public class JSONLibBenchmarks
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Jobs;
using StackExchange.Profiling;

namespace Benchmarks
{
[ClrJob, CoreJob]
[SimpleJob(RuntimeMoniker.Net472)]
[SimpleJob(RuntimeMoniker.Net50)]
[Config(typeof(Configs.Memory))]
public class MiniProfilerBenchmarks
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Jobs;
using StackExchange.Profiling;
using StackExchange.Profiling.Internal;

namespace Benchmarks
{
[ClrJob, CoreJob]
[SimpleJob(RuntimeMoniker.Net472)]
[SimpleJob(RuntimeMoniker.Net50)]
[Config(typeof(Configs.Memory))]
public class SerializationBenchmarks
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Jobs;
using StackExchange.Profiling.Helpers;

namespace Benchmarks
{
[ClrJob, CoreJob]
[SimpleJob(RuntimeMoniker.Net472)]
[SimpleJob(RuntimeMoniker.Net50)]
[Config(typeof(Configs.Full))]
public class StackTraceSnippetBenchmarks
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,26 @@
<OutputType>Exe</OutputType>
<RootNamespace>Benchmarks</RootNamespace>
<Configuration>Release</Configuration>
<TargetFrameworks>net472;netcoreapp2.1</TargetFrameworks>
<TargetFrameworks>net472;net5.0</TargetFrameworks>
<RuntimeIdentifier>win7-x64</RuntimeIdentifier>
<PlatformTarget>AnyCPU</PlatformTarget>
<SignAssembly>false</SignAssembly>
<LangVersion>9</LangVersion>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\MiniProfiler.Shared\MiniProfiler.Shared.csproj" />
<PackageReference Include="BenchmarkDotNet" Version="0.12.1" />
<PackageReference Include="BenchmarkDotNet" Version="0.13.1" />
<PackageReference Include="Jil" Version="2.16" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.1" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="System.Ben" Version="1.0.0" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp2.1'">
<PackageReference Include="ServiceStack.Text.Core" Version="5.4.0" />
<ItemGroup Condition="'$(TargetFramework)' == 'net5.0'">
<PackageReference Include="ServiceStack.Text.Core" Version="5.12.0" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net472'">
<PackageReference Include="ServiceStack.Text" Version="5.4.0" />
<PackageReference Include="ServiceStack.Text" Version="5.12.0" />
<Reference Include="System.Web.Extensions" />
</ItemGroup>
</Project>
3 changes: 1 addition & 2 deletions global.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"sdk": {
"version": "3.0.100",
"rollForward": "latestMinor"
"allowPrerelease": false
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,12 @@

namespace Samples.AspNetCore.Controllers
{
[ExampleActionFilter]
public class HomeController : Controller
{
[ExampleLongActionFilter]
//[ExampleActionFilter]
[ExampleAsyncActionFilter]
public IActionResult Index()
{
using (MiniProfiler.Current.Step("Example Step"))
Expand Down
27 changes: 27 additions & 0 deletions samples/Samples.AspNet5/Helpers/ExampleActionFilter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
using System;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc.Filters;

namespace Samples.AspNetCore
{
public class ExampleActionFilterAttribute : ActionFilterAttribute
{
public override void OnActionExecuting(ActionExecutingContext context) => Thread.Sleep(100);
}

public class ExampleLongActionFilterAttribute : ActionFilterAttribute
{
public override void OnActionExecuting(ActionExecutingContext context) => Thread.Sleep(200);
}

[AttributeUsage(AttributeTargets.Method | AttributeTargets.Class, AllowMultiple = true)]
public class ExampleAsyncActionFilterAttribute : Attribute, IAsyncActionFilter
{
public async Task OnActionExecutionAsync(ActionExecutingContext context, ActionExecutionDelegate next)
{
await Task.Delay(300);
await next();
}
}
}
37 changes: 37 additions & 0 deletions samples/Samples.AspNet5/Pages/RazorPagesSample.cshtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
@page

@{
ViewData["Title"] = "Razor Pages Sample";
}
<div class="col-md-12">
<div class="page-header">
<h2>ASP.NET Core 3: Behold MiniProfiler in the top right (Razor Pages Version)!</h2>
</div>
</div>
<div class="row">
<partial name="Index.LeftPanel" />
<partial name="Index.RightPanel" />
</div>
@section scripts {
<script>
$(function () {
// these links should fire ajax requests, not do navigation
$('.ajax-requests a').click(function () {
var $clicked = $(this),
$spinner = $('<span class="glyphicon glyphicon-refresh spinning" title="Working..."></span>').appendTo($clicked.parent()),
$results = $('.ajax-results');
$.ajax({
type: 'GET',
url: this.href,
success: function (data) {
$('<p class="ajax-result">').append(data).appendTo($results);
},
error: function () { $results.append('<p>ERROR!</p>'); },
complete: function () { $spinner.remove(); }
});
return false;
});
});
</script>
}
3 changes: 3 additions & 0 deletions samples/Samples.AspNet5/Pages/_ViewImports.cshtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@using Samples.AspNetCore
@namespace Samples.AspNetCore.Pages
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System.IO;
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;

namespace Samples.AspNetCore
Expand All @@ -9,10 +9,7 @@ public static class Program

public static void Main()
{
var host = new WebHostBuilder()
.UseKestrel()
.UseContentRoot(Directory.GetCurrentDirectory())
.UseIISIntegration()
var host = WebHost.CreateDefaultBuilder()
.UseStartup<Startup>()
.Build();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# ASP.NET Core 2.2
--------
This is a sample project demonstrating how MiniProfiler can be used in ASP.NET Core 2.2.
This is a sample project demonstrating how MiniProfiler can be used in ASP.NET Core 5.0.
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.1</TargetFramework>
<TargetFramework>net5.0</TargetFramework>
<PreserveCompilationContext>true</PreserveCompilationContext>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.All" />
<ProjectReference Include="..\..\src\MiniProfiler.AspNetCore.Mvc\MiniProfiler.AspNetCore.Mvc.csproj" />
<ProjectReference Include="..\..\src\MiniProfiler.EntityFrameworkCore\MiniProfiler.EntityFrameworkCore.csproj" />
<ProjectReference Include="..\..\src\MiniProfiler.Providers.SqlServer\MiniProfiler.Providers.SqlServer.csproj" />
<ProjectReference Include="..\..\src\MiniProfiler.Providers.Sqlite\MiniProfiler.Providers.Sqlite.csproj" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="5.0.9" />
</ItemGroup>
</Project>
Loading

0 comments on commit f9b191b

Please sign in to comment.