Skip to content

Commit

Permalink
Upgrading to .NET Core 2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
fabiocav committed Jun 5, 2018
1 parent 5f96fe9 commit 43d87b4
Show file tree
Hide file tree
Showing 13 changed files with 119 additions and 29 deletions.
5 changes: 5 additions & 0 deletions build/common.props
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,9 @@
<ItemGroup>
<AdditionalFiles Include="$(MSBuildThisFileDirectory)..\stylecop.json" Link="stylecop.json" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis" Version="2.8.2" />
<PackageReference Include="Microsoft.CodeAnalysis.Common" Version="2.8.2" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="2.8.2" />
</ItemGroup>
</Project>
4 changes: 2 additions & 2 deletions src/WebJobs.Script.Grpc/WebJobs.Script.Grpc.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
<PackageReference Include="Grpc.Tools" Version="1.4.1">
<PrivateAssets>All</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.Logging" Version="2.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="2.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="2.1.0" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="2.1.0" />
<PackageReference Include="StyleCop.Analyzers" Version="1.1.0-beta004">
<PrivateAssets>all</PrivateAssets>
</PackageReference>
Expand Down
4 changes: 2 additions & 2 deletions src/WebJobs.Script.Host/WebJobs.Script.Host.csproj
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\build\common.props" />
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.0</TargetFramework>
<TargetFramework>netcoreapp2.1</TargetFramework>
<Version>2.0.0-beta1$(VersionSuffix)</Version>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
Expand Down
4 changes: 2 additions & 2 deletions src/WebJobs.Script.WebHost/Models/FileCallbackResult.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using System.IO;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.AspNetCore.Mvc.Infrastructure;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Microsoft.Net.Http.Headers;
Expand Down Expand Up @@ -89,7 +89,7 @@ public FileCallbackResultExecutor(ILoggerFactory loggerFactory)

public Task ExecuteAsync(ActionContext context, FileCallbackResult result)
{
SetHeadersAndLog(context, result, null);
SetHeadersAndLog(context, result, null, true);
return result.Callback(context.HttpContext.Response.Body, context);
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/WebJobs.Script.WebHost/WebJobs.Script.WebHost.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<Import Project="..\..\build\common.props" />
<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
<TargetFramework>netcoreapp2.1</TargetFramework>
<AssemblyName>Microsoft.Azure.WebJobs.Script.WebHost</AssemblyName>
<RootNamespace>Microsoft.Azure.WebJobs.Script.WebHost</RootNamespace>
<PackageId>Microsoft.Azure.WebJobs.Script.WebHost</PackageId>
Expand Down Expand Up @@ -37,9 +37,9 @@

<ItemGroup>
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="4.2.0" />
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.3" />
<PackageReference Include="Microsoft.AspNetCore.App" Version="2.1.0" />
<PackageReference Include="Microsoft.AspNetCore.Buffering" Version="0.4.0-preview2-28189" />
<PackageReference Include="Microsoft.Azure.AppService.Proxy.Client" Version="2.0.4780001-beta-0fed1b79" />
<PackageReference Include="Microsoft.Azure.AppService.Proxy.Client" Version="2.0.5150001-beta-b9e0da04" />
<PackageReference Include="Microsoft.Azure.WebJobs" Version="3.0.0-beta6-11316" />
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions" Version="3.0.0-beta6-10622" />
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions.Http" Version="3.0.0-beta6-10622">
Expand Down
54 changes: 54 additions & 0 deletions src/WebJobs.Script/Description/CacheMetadataResolver.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.

using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using Microsoft.CodeAnalysis;

namespace Microsoft.Azure.WebJobs.Script.Description
{
public sealed class CacheMetadataResolver : MetadataReferenceResolver
{
private readonly MetadataReferenceResolver _innerResolver;
private static Dictionary<string, ImmutableArray<PortableExecutableReference>> _referenceCache = new Dictionary<string, ImmutableArray<PortableExecutableReference>>();

public CacheMetadataResolver(MetadataReferenceResolver innerResolver)
{
_innerResolver = innerResolver ?? throw new ArgumentNullException(nameof(innerResolver));
}

public override bool Equals(object other)
{
return _innerResolver.Equals(other);
}

public override int GetHashCode()
{
return _innerResolver.GetHashCode();
}

public override PortableExecutableReference ResolveMissingAssembly(MetadataReference definition, AssemblyIdentity referenceIdentity)
{
return base.ResolveMissingAssembly(definition, referenceIdentity);
}

public override ImmutableArray<PortableExecutableReference> ResolveReference(string reference, string baseFilePath, MetadataReferenceProperties properties)
{
string cacheKey = $"{reference}:{baseFilePath}";
if (_referenceCache.TryGetValue(cacheKey, out ImmutableArray<PortableExecutableReference> result))
{
return result;
}

result = _innerResolver.ResolveReference(reference, baseFilePath, properties);

if (result.Length > 0)
{
_referenceCache[cacheKey] = result;
}

return result;
}
}
}
34 changes: 33 additions & 1 deletion src/WebJobs.Script/Description/DotNet/DotNetConstants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,13 @@ public static class DotNetConstants
public static string[] FrameworkReferences = new[]
{
"Microsoft.CSharp",
"Microsoft.Net.Http.Headers",
"Microsoft.VisualBasic",
"Microsoft.Win32.Primitives",
"Microsoft.Win32.Registry",
"mscorlib",
"netstandard",
"SOS.NETCore",
"System",
"System.AppContext",
"System.Buffers",
Expand All @@ -37,20 +39,27 @@ public static class DotNetConstants
"System.Collections.Specialized",
"System.ComponentModel",
"System.ComponentModel.Annotations",
"System.ComponentModel.Composition",
"System.ComponentModel.DataAnnotations",
"System.ComponentModel.EventBasedAsync",
"System.ComponentModel.Primitives",
"System.ComponentModel.TypeConverter",
"System.Composition.AttributedModel",
"System.Composition.Convention",
"System.Composition.Hosting",
"System.Composition.Runtime",
"System.Composition.TypedParts",
"System.Configuration",
"System.Configuration.ConfigurationManager",
"System.Console",
"System.Core",
"System.Data",
"System.Data.Common",
"System.Data.SqlClient",
"System.Diagnostics.Contracts",
"System.Diagnostics.Debug",
"System.Diagnostics.DiagnosticSource",
"System.Diagnostics.FileVersionInfo",
"System.Diagnostics.PerformanceCounter",
"System.Diagnostics.Process",
"System.Diagnostics.StackTrace",
"System.Diagnostics.TextWriterTraceListener",
Expand All @@ -63,8 +72,12 @@ public static class DotNetConstants
"System.Globalization",
"System.Globalization.Calendars",
"System.Globalization.Extensions",
"System.IdentityModel.Tokens.Jwt",
"System.Interactive.Async",
"System.IO",
"System.IO.Abstractions",
"System.IO.Compression",
"System.IO.Compression.Brotli",
"System.IO.Compression.FileSystem",
"System.IO.Compression.ZipFile",
"System.IO.FileSystem",
Expand All @@ -74,14 +87,18 @@ public static class DotNetConstants
"System.IO.FileSystem.Watcher",
"System.IO.IsolatedStorage",
"System.IO.MemoryMappedFiles",
"System.IO.Pipelines",
"System.IO.Pipes",
"System.IO.Pipes.AccessControl",
"System.IO.UnmanagedMemoryStream",
"System.Linq",
"System.Linq.Expressions",
"System.Linq.Parallel",
"System.Linq.Queryable",
"System.Memory",
"System.Net",
"System.Net.Http",
"System.Net.Http.Formatting",
"System.Net.HttpListener",
"System.Net.Mail",
"System.Net.NameResolution",
Expand All @@ -97,6 +114,7 @@ public static class DotNetConstants
"System.Net.WebProxy",
"System.Net.WebSockets",
"System.Net.WebSockets.Client",
"System.Net.WebSockets.WebSocketProtocol",
"System.Numerics",
"System.Numerics.Vectors",
"System.ObjectModel",
Expand All @@ -105,6 +123,10 @@ public static class DotNetConstants
"System.Private.Uri",
"System.Private.Xml",
"System.Private.Xml.Linq",
"System.Reactive.Core",
"System.Reactive.Interfaces",
"System.Reactive.Linq",
"System.Reactive.PlatformServices",
"System.Reflection",
"System.Reflection.DispatchProxy",
"System.Reflection.Emit",
Expand All @@ -118,6 +140,7 @@ public static class DotNetConstants
"System.Resources.ResourceManager",
"System.Resources.Writer",
"System.Runtime",
"System.Runtime.CompilerServices.Unsafe",
"System.Runtime.CompilerServices.VisualC",
"System.Runtime.Extensions",
"System.Runtime.Handles",
Expand All @@ -139,17 +162,25 @@ public static class DotNetConstants
"System.Security.Cryptography.Csp",
"System.Security.Cryptography.Encoding",
"System.Security.Cryptography.OpenSsl",
"System.Security.Cryptography.Pkcs",
"System.Security.Cryptography.Primitives",
"System.Security.Cryptography.ProtectedData",
"System.Security.Cryptography.X509Certificates",
"System.Security.Cryptography.Xml",
"System.Security.Permissions",
"System.Security.Principal",
"System.Security.Principal.Windows",
"System.Security.SecureString",
"System.ServiceModel.Web",
"System.ServiceProcess",
"System.Spatial",
"System.Text.Encoding",
"System.Text.Encoding.CodePages",
"System.Text.Encoding.Extensions",
"System.Text.Encodings.Web",
"System.Text.RegularExpressions",
"System.Threading",
"System.Threading.Channels",
"System.Threading.Overlapped",
"System.Threading.Tasks",
"System.Threading.Tasks.Dataflow",
Expand All @@ -173,6 +204,7 @@ public static class DotNetConstants
"System.Xml.XmlSerializer",
"System.Xml.XPath",
"System.Xml.XPath.XDocument",
"System.Xml.XPath.XmlDocument",
"WindowsBase"
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
using System.Linq;
using System.Reflection;
using System.Runtime.Loader;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Azure.WebJobs.Script.Extensibility;
using Microsoft.CodeAnalysis;
Expand All @@ -34,7 +35,7 @@ public sealed class ScriptFunctionMetadataResolver : MetadataReferenceResolver,
private readonly ExtensionSharedAssemblyProvider _extensionSharedAssemblyProvider;

private PackageAssemblyResolver _packageAssemblyResolver;
private ScriptMetadataResolver _scriptResolver;
private MetadataReferenceResolver _scriptResolver;

private static readonly string[] DefaultAssemblyReferences =
{
Expand Down Expand Up @@ -77,7 +78,8 @@ public ScriptFunctionMetadataResolver(string scriptFilePath, ICollection<ScriptB
_scriptFilePath = scriptFilePath;
_packageAssemblyResolver = new PackageAssemblyResolver(_scriptFileDirectory);
_privateAssembliesPath = GetBinDirectory(_scriptFileDirectory);
_scriptResolver = ScriptMetadataResolver.Default.WithSearchPaths(_privateAssembliesPath);
var scriptResolver = ScriptMetadataResolver.Default.WithSearchPaths(_privateAssembliesPath);
_scriptResolver = new CacheMetadataResolver(scriptResolver);
_extensionSharedAssemblyProvider = new ExtensionSharedAssemblyProvider(bindingProviders);
_logger = logger;
}
Expand Down
14 changes: 7 additions & 7 deletions src/WebJobs.Script/WebJobs.Script.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<PackageReference Include="Google.Protobuf" Version="3.3.0" />
<PackageReference Include="Grpc.Core" Version="1.4.1" />
<PackageReference Include="Microsoft.ApplicationInsights" Version="2.5.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.WebApiCompatShim" Version="2.0.2">
<PackageReference Include="Microsoft.AspNetCore.Mvc.WebApiCompatShim" Version="2.1.0">
<NoWarn>NU1701</NoWarn>
</PackageReference>
<PackageReference Include="Microsoft.Azure.AppService.Proxy.Client" Version="2.0.4780001-beta-0fed1b79" />
Expand All @@ -39,14 +39,14 @@
<PackageReference Include="Microsoft.Azure.WebJobs.Logging" Version="3.0.0-beta6-11316" />
<PackageReference Include="Microsoft.Azure.WebJobs.Logging.ApplicationInsights" Version="3.0.0-beta6-11316" />
<PackageReference Include="Microsoft.Build" Version="15.3.409" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Scripting" Version="2.4.0" />
<PackageReference Include="Microsoft.DotNet.PlatformAbstractions" Version="2.0.4" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="2.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="2.0.0" />
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="2.0.0" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Scripting" Version="2.8.2" />
<PackageReference Include="Microsoft.DotNet.PlatformAbstractions" Version="2.1.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="2.1.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="2.1.0" />
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="2.1.0" />
<PackageReference Include="Microsoft.FSharp.Compiler" Version="4.2.0-rc-170621-0" />
<PackageReference Include="ncrontab" Version="3.3.0" />
<PackageReference Include="Newtonsoft.Json" Version="10.0.3" />
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
<PackageReference Include="NuGet.Frameworks" Version="4.4.0" />
<PackageReference Include="NuGet.LibraryModel" Version="4.4.0" />
<PackageReference Include="NuGet.ProjectModel" Version="4.4.0" />
Expand Down
4 changes: 2 additions & 2 deletions test/TestFunctions/TestFunctions.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
<TargetFramework>netcoreapp2.1</TargetFramework>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\build\common.props" />
<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
<TargetFramework>netcoreapp2.1</TargetFramework>
<IsPackable>false</IsPackable>
<AssemblyName>Microsoft.Azure.WebJobs.Script.Scaling.Tests</AssemblyName>
<RootNamespace>Microsoft.Azure.WebJobs.Script.Scaling.Tests</RootNamespace>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\build\common.props" />
<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
<TargetFramework>netcoreapp2.1</TargetFramework>

<IsPackable>false</IsPackable>

Expand All @@ -25,19 +25,16 @@
<PackageReference Include="Microsoft.AspNet.WebApi.Core" Version="5.2.3">
<NoWarn>NU1701</NoWarn>
</PackageReference>
<PackageReference Include="Microsoft.AspNetCore.TestHost" Version="2.0.1" />
<PackageReference Include="Microsoft.Azure.AppService.Proxy.Client" Version="2.0.4780001-beta-0fed1b79" />
<PackageReference Include="Microsoft.AspNetCore.TestHost" Version="2.1.0" />
<PackageReference Include="Microsoft.Azure.DocumentDB.Core" Version="1.9.1" />
<PackageReference Include="Microsoft.Azure.EventHubs" Version="1.0.3" />
<PackageReference Include="Microsoft.Azure.Functions.JavaWorker" Version="1.1.0-beta2-10041" />
<PackageReference Include="Microsoft.Azure.Functions.NodeJsWorker" Version="1.0.0-beta1-10031" />
<PackageReference Include="Microsoft.Azure.Mobile.Client" Version="4.0.2" />
<PackageReference Include="Microsoft.Azure.ServiceBus" Version="2.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="2.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="2.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="2.1.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.5.0" />
<PackageReference Include="Moq" Version="4.7.145" />
<PackageReference Include="Newtonsoft.Json" Version="10.0.3" />
<PackageReference Include="xunit" Version="2.3.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.3.1" />
</ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion test/WebJobs.Script.Tests/WebJobs.Script.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\build\common.props" />
<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
<TargetFramework>netcoreapp2.1</TargetFramework>

<IsPackable>false</IsPackable>

Expand Down

0 comments on commit 43d87b4

Please sign in to comment.