From 65d32c77aa1099d409f1cdb43cc25a646357ca00 Mon Sep 17 00:00:00 2001 From: harrison314 Date: Tue, 24 Nov 2020 20:55:43 +0100 Subject: [PATCH 1/7] #20 Remote new Type[0] --- .../MassiveDynamicProxyGenerator/AbstractTypeBuilder.cs | 8 ++++---- .../TypedDecorator/TypedDecoratorGenerator.cs | 2 +- .../TypedInstanceProxy/InstanceProvicerDescriptor.cs | 4 ++-- .../TypedInstanceProxy/TypedInstanceProxyGenerator.cs | 2 +- .../TypedProxy/InvocationDescriptor.cs | 2 +- .../TypedProxy/TypedProxyGenerator.cs | 2 +- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/Src/MassiveDynamicProxyGenerator/AbstractTypeBuilder.cs b/src/Src/MassiveDynamicProxyGenerator/AbstractTypeBuilder.cs index 1b9a28c..7bb9c7b 100644 --- a/src/Src/MassiveDynamicProxyGenerator/AbstractTypeBuilder.cs +++ b/src/Src/MassiveDynamicProxyGenerator/AbstractTypeBuilder.cs @@ -141,7 +141,7 @@ protected virtual void ImplementConstructor(TypeBuilder typeBuilder, Type interf new Type[] { }); ILGenerator il = constructorBuilder.GetILGenerator(); - ConstructorInfo conObj = typeof(object).GetTypeInfo().GetConstructor(new Type[0]); + ConstructorInfo conObj = typeof(object).GetTypeInfo().GetConstructor(Type.EmptyTypes); il.Emit(OpCodes.Ldarg_0); il.Emit(OpCodes.Call, conObj); il.Emit(OpCodes.Nop); @@ -181,7 +181,7 @@ protected virtual void ImplementMethod(TypeBuilder typeBuilder, Type interfaceTy /// The context. protected virtual void GenerateMethod(MethodInfo interfaceMethod, Type[] parameters, Type interfaceType, ILGenerator il, T context) { - ConstructorInfo ci = typeof(NotImplementedException).GetTypeInfo().GetConstructor(new Type[0]); + ConstructorInfo ci = typeof(NotImplementedException).GetTypeInfo().GetConstructor(Type.EmptyTypes); il.Emit(OpCodes.Nop); il.Emit(OpCodes.Newobj, ci); @@ -238,7 +238,7 @@ protected virtual void ImplementProperty(TypeBuilder typeBuilder, Type interface /// The context. protected virtual void GenerateSetProperty(PropertyInfo interfacePproperty, Type interfaceType, ILGenerator il, T context) { - ConstructorInfo ci = typeof(NotImplementedException).GetTypeInfo().GetConstructor(new Type[0]); + ConstructorInfo ci = typeof(NotImplementedException).GetTypeInfo().GetConstructor(Type.EmptyTypes); il.Emit(OpCodes.Nop); il.Emit(OpCodes.Newobj, ci); @@ -254,7 +254,7 @@ protected virtual void GenerateSetProperty(PropertyInfo interfacePproperty, Type /// The context. protected virtual void GenerateGetProperty(PropertyInfo interfacePproperty, Type interfaceType, ILGenerator il, T context) { - ConstructorInfo ci = typeof(NotImplementedException).GetTypeInfo().GetConstructor(new Type[0]); + ConstructorInfo ci = typeof(NotImplementedException).GetTypeInfo().GetConstructor(Type.EmptyTypes); il.Emit(OpCodes.Nop); il.Emit(OpCodes.Newobj, ci); diff --git a/src/Src/MassiveDynamicProxyGenerator/TypedDecorator/TypedDecoratorGenerator.cs b/src/Src/MassiveDynamicProxyGenerator/TypedDecorator/TypedDecoratorGenerator.cs index 6bcca63..44cb30a 100644 --- a/src/Src/MassiveDynamicProxyGenerator/TypedDecorator/TypedDecoratorGenerator.cs +++ b/src/Src/MassiveDynamicProxyGenerator/TypedDecorator/TypedDecoratorGenerator.cs @@ -73,7 +73,7 @@ protected override void ImplementConstructor(TypeBuilder typeBuilder, Type inter new Type[] { this.callableInterceptorDescriptor.Type, interfaceType }); ILGenerator il = constructorBuilder.GetILGenerator(); - ConstructorInfo conObj = typeof(object).GetTypeInfo().GetConstructor(new Type[0]); + ConstructorInfo conObj = typeof(object).GetTypeInfo().GetConstructor(Type.EmptyTypes); il.Emit(OpCodes.Ldarg_0); il.Emit(OpCodes.Call, conObj); il.Emit(OpCodes.Nop); diff --git a/src/Src/MassiveDynamicProxyGenerator/TypedInstanceProxy/InstanceProvicerDescriptor.cs b/src/Src/MassiveDynamicProxyGenerator/TypedInstanceProxy/InstanceProvicerDescriptor.cs index 7912edf..1dada11 100644 --- a/src/Src/MassiveDynamicProxyGenerator/TypedInstanceProxy/InstanceProvicerDescriptor.cs +++ b/src/Src/MassiveDynamicProxyGenerator/TypedInstanceProxy/InstanceProvicerDescriptor.cs @@ -55,8 +55,8 @@ public MethodInfo GetInstance public InstanceProvicerDescriptor() { this.Type = typeof(IInstanceProvicer); - this.Dispose = this.Type.GetTypeInfo().GetMethod(nameof(IInstanceProvicer.Dispose), new Type[0]); - this.GetInstance = this.Type.GetTypeInfo().GetMethod(nameof(IInstanceProvicer.GetInstance), new Type[0]); + this.Dispose = this.Type.GetTypeInfo().GetMethod(nameof(IInstanceProvicer.Dispose), Type.EmptyTypes); + this.GetInstance = this.Type.GetTypeInfo().GetMethod(nameof(IInstanceProvicer.GetInstance), Type.EmptyTypes); } } } diff --git a/src/Src/MassiveDynamicProxyGenerator/TypedInstanceProxy/TypedInstanceProxyGenerator.cs b/src/Src/MassiveDynamicProxyGenerator/TypedInstanceProxy/TypedInstanceProxyGenerator.cs index 8fa7d10..2c44e1f 100644 --- a/src/Src/MassiveDynamicProxyGenerator/TypedInstanceProxy/TypedInstanceProxyGenerator.cs +++ b/src/Src/MassiveDynamicProxyGenerator/TypedInstanceProxy/TypedInstanceProxyGenerator.cs @@ -54,7 +54,7 @@ protected override void ImplementConstructor(TypeBuilder typeBuilder, Type inter new Type[] { this.descriptor.Type }); ILGenerator il = constructorBuilder.GetILGenerator(); - ConstructorInfo conObj = typeof(object).GetTypeInfo().GetConstructor(new Type[0]); + ConstructorInfo conObj = typeof(object).GetTypeInfo().GetConstructor(Type.EmptyTypes); il.Emit(OpCodes.Ldarg_0); il.Emit(OpCodes.Call, conObj); il.Emit(OpCodes.Nop); diff --git a/src/Src/MassiveDynamicProxyGenerator/TypedProxy/InvocationDescriptor.cs b/src/Src/MassiveDynamicProxyGenerator/TypedProxy/InvocationDescriptor.cs index a989c1c..945af85 100644 --- a/src/Src/MassiveDynamicProxyGenerator/TypedProxy/InvocationDescriptor.cs +++ b/src/Src/MassiveDynamicProxyGenerator/TypedProxy/InvocationDescriptor.cs @@ -154,7 +154,7 @@ public static InvocationDescriptor Create(Type type) throw new ArgumentNullException(message); } - if (type.GetTypeInfo().GetConstructor(new Type[0]) == null) + if (type.GetTypeInfo().GetConstructor(Type.EmptyTypes) == null) { string message = string.Format("Type {0} is must have nonparametric public constructor.", type.FullName); throw new ArgumentNullException(message); diff --git a/src/Src/MassiveDynamicProxyGenerator/TypedProxy/TypedProxyGenerator.cs b/src/Src/MassiveDynamicProxyGenerator/TypedProxy/TypedProxyGenerator.cs index 952a67e..beb88f5 100644 --- a/src/Src/MassiveDynamicProxyGenerator/TypedProxy/TypedProxyGenerator.cs +++ b/src/Src/MassiveDynamicProxyGenerator/TypedProxy/TypedProxyGenerator.cs @@ -74,7 +74,7 @@ protected override void ImplementConstructor(TypeBuilder typeBuilder, Type inter new Type[] { typeof(IInterceptor) }); ILGenerator il = constructorBuilder.GetILGenerator(); - ConstructorInfo conObj = typeof(object).GetTypeInfo().GetConstructor(new Type[0]); + ConstructorInfo conObj = typeof(object).GetTypeInfo().GetConstructor(Type.EmptyTypes); il.Emit(OpCodes.Ldarg_0); il.Emit(OpCodes.Call, conObj); il.Emit(OpCodes.Nop); From ad5166ef735edec4b741e8bcf35d6c66a3f8ca07 Mon Sep 17 00:00:00 2001 From: harrison314 Date: Tue, 24 Nov 2020 21:31:49 +0100 Subject: [PATCH 2/7] Update projectst to new version framework and nugets. --- BuildScripts/Build.ps1 | 90 +++++++++++++------ .../PerformaceExamples.csproj | 5 +- .../SampleWebApplication.csproj | 7 +- .../Services/Contract/ICommonServices.cs | 2 +- src/Samples/SampleWebApplication/Startup.cs | 17 ++-- .../WcfForHipsters.Client.csproj | 7 +- .../Controllers/ExampleServiceController.cs | 2 +- .../Controllers/ValuesController.cs | 9 +- .../WcfForHipsters.WebServer/Startup.cs | 16 +++- .../WcfForHipsters.WebServer.csproj | 12 ++- .../MassiveDynamicProxyGenerator.csproj | 6 +- ...yGenerator.DependencyInjection.Test.csproj | 18 ++-- ...erator.SimpleInjector.Tests.NetCore.csproj | 2 +- .../MassiveDynamicProxyGenerator.Tests.csproj | 50 +++++++++-- .../IInterfaceWithDefaultMethod.cs | 2 + .../TypedProxyTests.cs | 3 + .../app.config | 4 + .../packages.config | 18 ++-- 18 files changed, 180 insertions(+), 90 deletions(-) diff --git a/BuildScripts/Build.ps1 b/BuildScripts/Build.ps1 index dc42c45..3a6e506 100644 --- a/BuildScripts/Build.ps1 +++ b/BuildScripts/Build.ps1 @@ -25,10 +25,6 @@ Specifies the amount of information to be displayed. Shows description about tasks. .PARAMETER DryRun Performs a dry run. -.PARAMETER Experimental -Uses the nightly builds of the Roslyn script engine. -.PARAMETER Mono -Uses the Mono Compiler rather than the Roslyn script engine. .PARAMETER SkipToolPackageRestore Skips restoring of packages. .PARAMETER ScriptArgs @@ -41,7 +37,7 @@ https://cakebuild.net [CmdletBinding()] Param( - [string]$Script = "build.cake", + [string]$Script, [string]$Target, [string]$Configuration, [ValidateSet("Quiet", "Minimal", "Normal", "Verbose", "Diagnostic")] @@ -49,13 +45,33 @@ Param( [switch]$ShowDescription, [Alias("WhatIf", "Noop")] [switch]$DryRun, - [switch]$Experimental, - [switch]$Mono, [switch]$SkipToolPackageRestore, [Parameter(Position=0,Mandatory=$false,ValueFromRemainingArguments=$true)] [string[]]$ScriptArgs ) +# This is an automatic variable in PowerShell Core, but not in Windows PowerShell 5.x +if (-not (Test-Path variable:global:IsCoreCLR)) { + $IsCoreCLR = $false +} + +# Attempt to set highest encryption available for SecurityProtocol. +# PowerShell will not set this by default (until maybe .NET 4.6.x). This +# will typically produce a message for PowerShell v2 (just an info +# message though) +try { + # Set TLS 1.2 (3072), then TLS 1.1 (768), then TLS 1.0 (192), finally SSL 3.0 (48) + # Use integers because the enumeration values for TLS 1.2 and TLS 1.1 won't + # exist in .NET 4.0, even though they are addressable if .NET 4.5+ is + # installed (.NET 4.5 is an in-place upgrade). + # PowerShell Core already has support for TLS 1.2 so we can skip this if running in that. + if (-not $IsCoreCLR) { + [System.Net.ServicePointManager]::SecurityProtocol = 3072 -bor 768 -bor 192 -bor 48 + } + } catch { + Write-Output 'Unable to set PowerShell to use TLS 1.2 and TLS 1.1 due to old .NET Framework installed. If you see underlying connection closed or trust errors, you may need to upgrade to .NET Framework 4.5+ and PowerShell v3' + } + [Reflection.Assembly]::LoadWithPartialName("System.Security") | Out-Null function MD5HashFile([string] $filePath) { @@ -85,7 +101,7 @@ function GetProxyEnabledWebClient { $wc = New-Object System.Net.WebClient $proxy = [System.Net.WebRequest]::GetSystemWebProxy() - $proxy.Credentials = [System.Net.CredentialCache]::DefaultCredentials + $proxy.Credentials = [System.Net.CredentialCache]::DefaultCredentials $wc.Proxy = $proxy return $wc } @@ -96,6 +112,9 @@ if(!$PSScriptRoot){ $PSScriptRoot = Split-Path $MyInvocation.MyCommand.Path -Parent } +if(!$Script){ + $Script = Join-Path $PSScriptRoot "build.cake" +} $TOOLS_DIR = Join-Path $PSScriptRoot "tools" $ADDINS_DIR = Join-Path $TOOLS_DIR "Addins" $MODULES_DIR = Join-Path $TOOLS_DIR "Modules" @@ -107,10 +126,14 @@ $PACKAGES_CONFIG_MD5 = Join-Path $TOOLS_DIR "packages.config.md5sum" $ADDINS_PACKAGES_CONFIG = Join-Path $ADDINS_DIR "packages.config" $MODULES_PACKAGES_CONFIG = Join-Path $MODULES_DIR "packages.config" +$env:CAKE_PATHS_TOOLS = $TOOLS_DIR +$env:CAKE_PATHS_ADDINS = $ADDINS_DIR +$env:CAKE_PATHS_MODULES = $MODULES_DIR + # Make sure tools folder exists if ((Test-Path $PSScriptRoot) -and !(Test-Path $TOOLS_DIR)) { Write-Verbose -Message "Creating tools directory..." - New-Item -Path $TOOLS_DIR -Type directory | out-null + New-Item -Path $TOOLS_DIR -Type Directory | Out-Null } # Make sure that packages.config exist. @@ -146,8 +169,19 @@ if (!(Test-Path $NUGET_EXE)) { } } +# These are automatic variables in PowerShell Core, but not in Windows PowerShell 5.x +if (-not (Test-Path variable:global:ismacos)) { + $IsLinux = $false + $IsMacOS = $false +} + # Save nuget.exe path to environment to be available to child processed -$ENV:NUGET_EXE = $NUGET_EXE +$env:NUGET_EXE = $NUGET_EXE +$env:NUGET_EXE_INVOCATION = if ($IsLinux -or $IsMacOS) { + "mono `"$NUGET_EXE`"" +} else { + "`"$NUGET_EXE`"" +} # Restore tools from NuGet? if(-Not $SkipToolPackageRestore.IsPresent) { @@ -155,16 +189,17 @@ if(-Not $SkipToolPackageRestore.IsPresent) { Set-Location $TOOLS_DIR # Check for changes in packages.config and remove installed tools if true. - [string] $md5Hash = MD5HashFile($PACKAGES_CONFIG) + [string] $md5Hash = MD5HashFile $PACKAGES_CONFIG if((!(Test-Path $PACKAGES_CONFIG_MD5)) -Or - ($md5Hash -ne (Get-Content $PACKAGES_CONFIG_MD5 ))) { + ($md5Hash -ne (Get-Content $PACKAGES_CONFIG_MD5 ))) { Write-Verbose -Message "Missing or changed package.config hash..." Get-ChildItem -Exclude packages.config,nuget.exe,Cake.Bakery | - Remove-Item -Recurse + Remove-Item -Recurse -Force } Write-Verbose -Message "Restoring tools from NuGet..." - $NuGetOutput = Invoke-Expression "&`"$NUGET_EXE`" install -ExcludeVersion -OutputDirectory `"$TOOLS_DIR`"" + + $NuGetOutput = Invoke-Expression "& $env:NUGET_EXE_INVOCATION install -ExcludeVersion -OutputDirectory `"$TOOLS_DIR`"" if ($LASTEXITCODE -ne 0) { Throw "An error occurred while restoring NuGet tools." @@ -173,7 +208,7 @@ if(-Not $SkipToolPackageRestore.IsPresent) { { $md5Hash | Out-File $PACKAGES_CONFIG_MD5 -Encoding "ASCII" } - Write-Verbose -Message ($NuGetOutput | out-string) + Write-Verbose -Message ($NuGetOutput | Out-String) Pop-Location } @@ -184,13 +219,13 @@ if (Test-Path $ADDINS_PACKAGES_CONFIG) { Set-Location $ADDINS_DIR Write-Verbose -Message "Restoring addins from NuGet..." - $NuGetOutput = Invoke-Expression "&`"$NUGET_EXE`" install -ExcludeVersion -OutputDirectory `"$ADDINS_DIR`"" + $NuGetOutput = Invoke-Expression "& $env:NUGET_EXE_INVOCATION install -ExcludeVersion -OutputDirectory `"$ADDINS_DIR`"" if ($LASTEXITCODE -ne 0) { Throw "An error occurred while restoring NuGet addins." } - Write-Verbose -Message ($NuGetOutput | out-string) + Write-Verbose -Message ($NuGetOutput | Out-String) Pop-Location } @@ -201,13 +236,13 @@ if (Test-Path $MODULES_PACKAGES_CONFIG) { Set-Location $MODULES_DIR Write-Verbose -Message "Restoring modules from NuGet..." - $NuGetOutput = Invoke-Expression "&`"$NUGET_EXE`" install -ExcludeVersion -OutputDirectory `"$MODULES_DIR`"" + $NuGetOutput = Invoke-Expression "& $env:NUGET_EXE_INVOCATION install -ExcludeVersion -OutputDirectory `"$MODULES_DIR`"" if ($LASTEXITCODE -ne 0) { Throw "An error occurred while restoring NuGet modules." } - Write-Verbose -Message ($NuGetOutput | out-string) + Write-Verbose -Message ($NuGetOutput | Out-String) Pop-Location } @@ -217,20 +252,23 @@ if (!(Test-Path $CAKE_EXE)) { Throw "Could not find Cake.exe at $CAKE_EXE" } +$CAKE_EXE_INVOCATION = if ($IsLinux -or $IsMacOS) { + "mono `"$CAKE_EXE`"" +} else { + "`"$CAKE_EXE`"" +} - -# Build Cake arguments -$cakeArguments = @("$Script"); -if ($Target) { $cakeArguments += "-target=$Target" } + # Build an array (not a string) of Cake arguments to be joined later +$cakeArguments = @() +if ($Script) { $cakeArguments += "`"$Script`"" } +if ($Target) { $cakeArguments += "-target=`"$Target`"" } if ($Configuration) { $cakeArguments += "-configuration=$Configuration" } if ($Verbosity) { $cakeArguments += "-verbosity=$Verbosity" } if ($ShowDescription) { $cakeArguments += "-showdescription" } if ($DryRun) { $cakeArguments += "-dryrun" } -if ($Experimental) { $cakeArguments += "-experimental" } -if ($Mono) { $cakeArguments += "-mono" } $cakeArguments += $ScriptArgs # Start Cake Write-Host "Running build script..." -&$CAKE_EXE $cakeArguments +Invoke-Expression "& $CAKE_EXE_INVOCATION $($cakeArguments -join " ")" exit $LASTEXITCODE diff --git a/src/Samples/PerformaceExamples/PerformaceExamples.csproj b/src/Samples/PerformaceExamples/PerformaceExamples.csproj index a7f3ca1..fc8b7f4 100644 --- a/src/Samples/PerformaceExamples/PerformaceExamples.csproj +++ b/src/Samples/PerformaceExamples/PerformaceExamples.csproj @@ -1,12 +1,11 @@  - Exe - netcoreapp3.0 + netcoreapp3.1 - + diff --git a/src/Samples/SampleWebApplication/SampleWebApplication.csproj b/src/Samples/SampleWebApplication/SampleWebApplication.csproj index 88d6fda..9424566 100644 --- a/src/Samples/SampleWebApplication/SampleWebApplication.csproj +++ b/src/Samples/SampleWebApplication/SampleWebApplication.csproj @@ -1,14 +1,9 @@  - netcoreapp2.1 + netcoreapp3.1 - - - - - diff --git a/src/Samples/SampleWebApplication/Services/Contract/ICommonServices.cs b/src/Samples/SampleWebApplication/Services/Contract/ICommonServices.cs index 182e07f..bfacc0c 100644 --- a/src/Samples/SampleWebApplication/Services/Contract/ICommonServices.cs +++ b/src/Samples/SampleWebApplication/Services/Contract/ICommonServices.cs @@ -8,7 +8,7 @@ namespace SampleWebApplication.Services.Contract { public interface ICommonServices { - IHostingEnvironment HostingEnvironment + IWebHostEnvironment HostingEnvironment { get; } diff --git a/src/Samples/SampleWebApplication/Startup.cs b/src/Samples/SampleWebApplication/Startup.cs index efadc02..37fe00f 100644 --- a/src/Samples/SampleWebApplication/Startup.cs +++ b/src/Samples/SampleWebApplication/Startup.cs @@ -11,6 +11,7 @@ using SampleWebApplication.Services.Contract; using SampleWebApplication.Services.Implementation; using SampleWebApplication.Services.Interceptors; +using Microsoft.Extensions.Hosting; namespace SampleWebApplication { @@ -36,12 +37,12 @@ public IServiceProvider ConfigureServices(IServiceCollection services) services.AddProxy(); services.AddProxy(); - services.AddMvc(); + services.AddControllers(); return services.BuildIntercepedServiceProvider(); } - public void Configure(IApplicationBuilder app, IHostingEnvironment env) + public void Configure(IApplicationBuilder app, IWebHostEnvironment env) { if (env.IsDevelopment()) { @@ -54,11 +55,15 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env) app.UseStaticFiles(); - app.UseMvc(routes => + app.UseHttpsRedirection(); + + app.UseRouting(); + + app.UseAuthorization(); + + app.UseEndpoints(endpoints => { - routes.MapRoute( - name: "default", - template: "{controller=Home}/{action=Index}/{id?}"); + endpoints.MapControllers(); }); } } diff --git a/src/Samples/WcfForHipsters.Client/WcfForHipsters.Client.csproj b/src/Samples/WcfForHipsters.Client/WcfForHipsters.Client.csproj index b8f821b..4a165a5 100644 --- a/src/Samples/WcfForHipsters.Client/WcfForHipsters.Client.csproj +++ b/src/Samples/WcfForHipsters.Client/WcfForHipsters.Client.csproj @@ -1,10 +1,7 @@  - netcoreapp2.1 - WcfForHipsters.Client - Exe - WcfForHipsters.Client + netcoreapp3.1 @@ -16,7 +13,7 @@ - + diff --git a/src/Samples/WcfForHipsters.WebServer/Controllers/ExampleServiceController.cs b/src/Samples/WcfForHipsters.WebServer/Controllers/ExampleServiceController.cs index e6b1b22..8f90f19 100644 --- a/src/Samples/WcfForHipsters.WebServer/Controllers/ExampleServiceController.cs +++ b/src/Samples/WcfForHipsters.WebServer/Controllers/ExampleServiceController.cs @@ -33,7 +33,7 @@ public ExampleServiceController(EndpointAdapter serviceAdapter, // api/ExampleService POST [HttpPost] - public IActionResult Post([FromBody]JObject value) + public IActionResult Post([FromBody] JObject value) { this.logger.LogTrace("Endpoint invoked"); try diff --git a/src/Samples/WcfForHipsters.WebServer/Controllers/ValuesController.cs b/src/Samples/WcfForHipsters.WebServer/Controllers/ValuesController.cs index c9eb911..417a6c1 100644 --- a/src/Samples/WcfForHipsters.WebServer/Controllers/ValuesController.cs +++ b/src/Samples/WcfForHipsters.WebServer/Controllers/ValuesController.cs @@ -9,33 +9,28 @@ namespace WcfForHipsters.WebServer.Controllers [Route("api/[controller]")] public class ValuesController : Controller { - // GET api/values [HttpGet] public IEnumerable Get() { return new string[] { "value1", "value2" }; } - // GET api/values/5 [HttpGet("{id}")] public string Get(int id) { return "value"; } - // POST api/values [HttpPost] - public void Post([FromBody]string value) + public void Post([FromBody] string value) { } - // PUT api/values/5 [HttpPut("{id}")] - public void Put(int id, [FromBody]string value) + public void Put(int id, [FromBody] string value) { } - // DELETE api/values/5 [HttpDelete("{id}")] public void Delete(int id) { diff --git a/src/Samples/WcfForHipsters.WebServer/Startup.cs b/src/Samples/WcfForHipsters.WebServer/Startup.cs index 0393661..cebce48 100644 --- a/src/Samples/WcfForHipsters.WebServer/Startup.cs +++ b/src/Samples/WcfForHipsters.WebServer/Startup.cs @@ -10,6 +10,7 @@ using WcfForHipsters.WebServer.WcfForHipsters; using WcfForHipsters.WebServer.Contract; using WcfForHipsters.WebServer.Services; +using Microsoft.Extensions.Hosting; namespace WcfForHipsters.WebServer { @@ -28,11 +29,11 @@ public void ConfigureServices(IServiceCollection services) services.AddTransient(); services.AddSingleton(typeof(EndpointAdapter<>)); - services.AddMvc(); + services.AddControllers(); } // This method gets called by the runtime. Use this method to configure the HTTP request pipeline - public void Configure(IApplicationBuilder app, IHostingEnvironment env) + public void Configure(IApplicationBuilder app, IWebHostEnvironment env) { if (env.IsDevelopment()) { @@ -46,7 +47,16 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env) } app.UseStaticFiles(); - app.UseMvc(); + app.UseHttpsRedirection(); + + app.UseRouting(); + + app.UseAuthorization(); + + app.UseEndpoints(endpoints => + { + endpoints.MapControllers(); + }); } } } diff --git a/src/Samples/WcfForHipsters.WebServer/WcfForHipsters.WebServer.csproj b/src/Samples/WcfForHipsters.WebServer/WcfForHipsters.WebServer.csproj index 2ce9cf4..6c564de 100644 --- a/src/Samples/WcfForHipsters.WebServer/WcfForHipsters.WebServer.csproj +++ b/src/Samples/WcfForHipsters.WebServer/WcfForHipsters.WebServer.csproj @@ -1,19 +1,17 @@  - netcoreapp2.1 - Exe + netcoreapp3.1 - - PreserveNewest - + - - + + PreserveNewest + diff --git a/src/Src/MassiveDynamicProxyGenerator/MassiveDynamicProxyGenerator.csproj b/src/Src/MassiveDynamicProxyGenerator/MassiveDynamicProxyGenerator.csproj index 0718092..656be3b 100644 --- a/src/Src/MassiveDynamicProxyGenerator/MassiveDynamicProxyGenerator.csproj +++ b/src/Src/MassiveDynamicProxyGenerator/MassiveDynamicProxyGenerator.csproj @@ -67,11 +67,13 @@ Add Process method to IInvocation. - + + + - + diff --git a/src/Test/MassiveDynamicProxyGenerator.DependencyInjection.Test/MassiveDynamicProxyGenerator.DependencyInjection.Test.csproj b/src/Test/MassiveDynamicProxyGenerator.DependencyInjection.Test/MassiveDynamicProxyGenerator.DependencyInjection.Test.csproj index d98d6c5..a25c20a 100644 --- a/src/Test/MassiveDynamicProxyGenerator.DependencyInjection.Test/MassiveDynamicProxyGenerator.DependencyInjection.Test.csproj +++ b/src/Test/MassiveDynamicProxyGenerator.DependencyInjection.Test/MassiveDynamicProxyGenerator.DependencyInjection.Test.csproj @@ -1,20 +1,20 @@  - netcoreapp2.0 + netcoreapp3.1 false - - - - - - - - + + + + + + + + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/src/Test/MassiveDynamicProxyGenerator.SimpleInjector.Tests.NetCore/MassiveDynamicProxyGenerator.SimpleInjector.Tests.NetCore.csproj b/src/Test/MassiveDynamicProxyGenerator.SimpleInjector.Tests.NetCore/MassiveDynamicProxyGenerator.SimpleInjector.Tests.NetCore.csproj index a65dc30..b3fca3c 100644 --- a/src/Test/MassiveDynamicProxyGenerator.SimpleInjector.Tests.NetCore/MassiveDynamicProxyGenerator.SimpleInjector.Tests.NetCore.csproj +++ b/src/Test/MassiveDynamicProxyGenerator.SimpleInjector.Tests.NetCore/MassiveDynamicProxyGenerator.SimpleInjector.Tests.NetCore.csproj @@ -1,7 +1,7 @@  - netcoreapp2.1 + netcoreapp3.1 diff --git a/src/Test/MassiveDynamicProxyGenerator.Tests/MassiveDynamicProxyGenerator.Tests.csproj b/src/Test/MassiveDynamicProxyGenerator.Tests/MassiveDynamicProxyGenerator.Tests.csproj index ecea8a9..e183ee3 100644 --- a/src/Test/MassiveDynamicProxyGenerator.Tests/MassiveDynamicProxyGenerator.Tests.csproj +++ b/src/Test/MassiveDynamicProxyGenerator.Tests/MassiveDynamicProxyGenerator.Tests.csproj @@ -16,6 +16,8 @@ $(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages False UnitTest + + true @@ -36,22 +38,45 @@ - ..\..\packages\Castle.Core.4.4.0\lib\net45\Castle.Core.dll + ..\..\packages\Castle.Core.4.4.1\lib\net45\Castle.Core.dll + + + ..\..\packages\DiffEngine.6.4.2\lib\net461\DiffEngine.dll + + + ..\..\packages\EmptyFiles.2.3.1\lib\net461\EmptyFiles.dll + + + ..\..\packages\Microsoft.Bcl.AsyncInterfaces.5.0.0\lib\net461\Microsoft.Bcl.AsyncInterfaces.dll - - ..\..\packages\Moq.4.12.0\lib\net45\Moq.dll + + ..\..\packages\Moq.4.15.1\lib\net45\Moq.dll - - ..\..\packages\Shouldly.3.0.2\lib\net451\Shouldly.dll + + ..\..\packages\Shouldly.4.0.1\lib\netstandard2.0\Shouldly.dll + + ..\..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll + - - ..\..\packages\System.Runtime.CompilerServices.Unsafe.4.5.2\lib\netstandard2.0\System.Runtime.CompilerServices.Unsafe.dll + + + ..\..\packages\System.Memory.4.5.4\lib\net461\System.Memory.dll + + + + ..\..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll + + + ..\..\packages\System.Runtime.CompilerServices.Unsafe.5.0.0\lib\net45\System.Runtime.CompilerServices.Unsafe.dll + + + ..\..\packages\System.Runtime.InteropServices.RuntimeInformation.4.3.0\lib\net45\System.Runtime.InteropServices.RuntimeInformation.dll - ..\..\packages\System.Threading.Tasks.Extensions.4.5.3\lib\netstandard2.0\System.Threading.Tasks.Extensions.dll + ..\..\packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll ..\..\packages\System.ValueTuple.4.5.0\lib\net461\System.ValueTuple.dll @@ -129,6 +154,15 @@ + + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + +