Skip to content

Commit 43d87b4

Browse files
committed
Upgrading to .NET Core 2.1
1 parent 5f96fe9 commit 43d87b4

File tree

13 files changed

+119
-29
lines changed

13 files changed

+119
-29
lines changed

build/common.props

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,4 +50,9 @@
5050
<ItemGroup>
5151
<AdditionalFiles Include="$(MSBuildThisFileDirectory)..\stylecop.json" Link="stylecop.json" />
5252
</ItemGroup>
53+
<ItemGroup>
54+
<PackageReference Include="Microsoft.CodeAnalysis" Version="2.8.2" />
55+
<PackageReference Include="Microsoft.CodeAnalysis.Common" Version="2.8.2" />
56+
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="2.8.2" />
57+
</ItemGroup>
5358
</Project>

src/WebJobs.Script.Grpc/WebJobs.Script.Grpc.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
<PackageReference Include="Grpc.Tools" Version="1.4.1">
2121
<PrivateAssets>All</PrivateAssets>
2222
</PackageReference>
23-
<PackageReference Include="Microsoft.Extensions.Logging" Version="2.0.0" />
24-
<PackageReference Include="Microsoft.Extensions.Configuration" Version="2.0.0" />
23+
<PackageReference Include="Microsoft.Extensions.Logging" Version="2.1.0" />
24+
<PackageReference Include="Microsoft.Extensions.Configuration" Version="2.1.0" />
2525
<PackageReference Include="StyleCop.Analyzers" Version="1.1.0-beta004">
2626
<PrivateAssets>all</PrivateAssets>
2727
</PackageReference>

src/WebJobs.Script.Host/WebJobs.Script.Host.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project Sdk="Microsoft.NET.Sdk">
22
<Import Project="..\..\build\common.props" />
33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>netcoreapp2.0</TargetFramework>
5+
<TargetFramework>netcoreapp2.1</TargetFramework>
66
<Version>2.0.0-beta1$(VersionSuffix)</Version>
77
</PropertyGroup>
88
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">

src/WebJobs.Script.WebHost/Models/FileCallbackResult.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
using System.IO;
66
using System.Threading.Tasks;
77
using Microsoft.AspNetCore.Mvc;
8-
using Microsoft.AspNetCore.Mvc.Internal;
8+
using Microsoft.AspNetCore.Mvc.Infrastructure;
99
using Microsoft.Extensions.DependencyInjection;
1010
using Microsoft.Extensions.Logging;
1111
using Microsoft.Net.Http.Headers;
@@ -89,7 +89,7 @@ public FileCallbackResultExecutor(ILoggerFactory loggerFactory)
8989

9090
public Task ExecuteAsync(ActionContext context, FileCallbackResult result)
9191
{
92-
SetHeadersAndLog(context, result, null);
92+
SetHeadersAndLog(context, result, null, true);
9393
return result.Callback(context.HttpContext.Response.Body, context);
9494
}
9595
}

src/WebJobs.Script.WebHost/WebJobs.Script.WebHost.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk.Web">
22
<Import Project="..\..\build\common.props" />
33
<PropertyGroup>
4-
<TargetFramework>netcoreapp2.0</TargetFramework>
4+
<TargetFramework>netcoreapp2.1</TargetFramework>
55
<AssemblyName>Microsoft.Azure.WebJobs.Script.WebHost</AssemblyName>
66
<RootNamespace>Microsoft.Azure.WebJobs.Script.WebHost</RootNamespace>
77
<PackageId>Microsoft.Azure.WebJobs.Script.WebHost</PackageId>
@@ -37,9 +37,9 @@
3737

3838
<ItemGroup>
3939
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="4.2.0" />
40-
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.3" />
40+
<PackageReference Include="Microsoft.AspNetCore.App" Version="2.1.0" />
4141
<PackageReference Include="Microsoft.AspNetCore.Buffering" Version="0.4.0-preview2-28189" />
42-
<PackageReference Include="Microsoft.Azure.AppService.Proxy.Client" Version="2.0.4780001-beta-0fed1b79" />
42+
<PackageReference Include="Microsoft.Azure.AppService.Proxy.Client" Version="2.0.5150001-beta-b9e0da04" />
4343
<PackageReference Include="Microsoft.Azure.WebJobs" Version="3.0.0-beta6-11316" />
4444
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions" Version="3.0.0-beta6-10622" />
4545
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions.Http" Version="3.0.0-beta6-10622">
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
// Copyright (c) .NET Foundation. All rights reserved.
2+
// Licensed under the MIT License. See License.txt in the project root for license information.
3+
4+
using System;
5+
using System.Collections.Generic;
6+
using System.Collections.Immutable;
7+
using Microsoft.CodeAnalysis;
8+
9+
namespace Microsoft.Azure.WebJobs.Script.Description
10+
{
11+
public sealed class CacheMetadataResolver : MetadataReferenceResolver
12+
{
13+
private readonly MetadataReferenceResolver _innerResolver;
14+
private static Dictionary<string, ImmutableArray<PortableExecutableReference>> _referenceCache = new Dictionary<string, ImmutableArray<PortableExecutableReference>>();
15+
16+
public CacheMetadataResolver(MetadataReferenceResolver innerResolver)
17+
{
18+
_innerResolver = innerResolver ?? throw new ArgumentNullException(nameof(innerResolver));
19+
}
20+
21+
public override bool Equals(object other)
22+
{
23+
return _innerResolver.Equals(other);
24+
}
25+
26+
public override int GetHashCode()
27+
{
28+
return _innerResolver.GetHashCode();
29+
}
30+
31+
public override PortableExecutableReference ResolveMissingAssembly(MetadataReference definition, AssemblyIdentity referenceIdentity)
32+
{
33+
return base.ResolveMissingAssembly(definition, referenceIdentity);
34+
}
35+
36+
public override ImmutableArray<PortableExecutableReference> ResolveReference(string reference, string baseFilePath, MetadataReferenceProperties properties)
37+
{
38+
string cacheKey = $"{reference}:{baseFilePath}";
39+
if (_referenceCache.TryGetValue(cacheKey, out ImmutableArray<PortableExecutableReference> result))
40+
{
41+
return result;
42+
}
43+
44+
result = _innerResolver.ResolveReference(reference, baseFilePath, properties);
45+
46+
if (result.Length > 0)
47+
{
48+
_referenceCache[cacheKey] = result;
49+
}
50+
51+
return result;
52+
}
53+
}
54+
}

src/WebJobs.Script/Description/DotNet/DotNetConstants.cs

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,13 @@ public static class DotNetConstants
2222
public static string[] FrameworkReferences = new[]
2323
{
2424
"Microsoft.CSharp",
25+
"Microsoft.Net.Http.Headers",
2526
"Microsoft.VisualBasic",
2627
"Microsoft.Win32.Primitives",
2728
"Microsoft.Win32.Registry",
2829
"mscorlib",
2930
"netstandard",
31+
"SOS.NETCore",
3032
"System",
3133
"System.AppContext",
3234
"System.Buffers",
@@ -37,20 +39,27 @@ public static class DotNetConstants
3739
"System.Collections.Specialized",
3840
"System.ComponentModel",
3941
"System.ComponentModel.Annotations",
40-
"System.ComponentModel.Composition",
4142
"System.ComponentModel.DataAnnotations",
4243
"System.ComponentModel.EventBasedAsync",
4344
"System.ComponentModel.Primitives",
4445
"System.ComponentModel.TypeConverter",
46+
"System.Composition.AttributedModel",
47+
"System.Composition.Convention",
48+
"System.Composition.Hosting",
49+
"System.Composition.Runtime",
50+
"System.Composition.TypedParts",
4551
"System.Configuration",
52+
"System.Configuration.ConfigurationManager",
4653
"System.Console",
4754
"System.Core",
4855
"System.Data",
4956
"System.Data.Common",
57+
"System.Data.SqlClient",
5058
"System.Diagnostics.Contracts",
5159
"System.Diagnostics.Debug",
5260
"System.Diagnostics.DiagnosticSource",
5361
"System.Diagnostics.FileVersionInfo",
62+
"System.Diagnostics.PerformanceCounter",
5463
"System.Diagnostics.Process",
5564
"System.Diagnostics.StackTrace",
5665
"System.Diagnostics.TextWriterTraceListener",
@@ -63,8 +72,12 @@ public static class DotNetConstants
6372
"System.Globalization",
6473
"System.Globalization.Calendars",
6574
"System.Globalization.Extensions",
75+
"System.IdentityModel.Tokens.Jwt",
76+
"System.Interactive.Async",
6677
"System.IO",
78+
"System.IO.Abstractions",
6779
"System.IO.Compression",
80+
"System.IO.Compression.Brotli",
6881
"System.IO.Compression.FileSystem",
6982
"System.IO.Compression.ZipFile",
7083
"System.IO.FileSystem",
@@ -74,14 +87,18 @@ public static class DotNetConstants
7487
"System.IO.FileSystem.Watcher",
7588
"System.IO.IsolatedStorage",
7689
"System.IO.MemoryMappedFiles",
90+
"System.IO.Pipelines",
7791
"System.IO.Pipes",
92+
"System.IO.Pipes.AccessControl",
7893
"System.IO.UnmanagedMemoryStream",
7994
"System.Linq",
8095
"System.Linq.Expressions",
8196
"System.Linq.Parallel",
8297
"System.Linq.Queryable",
98+
"System.Memory",
8399
"System.Net",
84100
"System.Net.Http",
101+
"System.Net.Http.Formatting",
85102
"System.Net.HttpListener",
86103
"System.Net.Mail",
87104
"System.Net.NameResolution",
@@ -97,6 +114,7 @@ public static class DotNetConstants
97114
"System.Net.WebProxy",
98115
"System.Net.WebSockets",
99116
"System.Net.WebSockets.Client",
117+
"System.Net.WebSockets.WebSocketProtocol",
100118
"System.Numerics",
101119
"System.Numerics.Vectors",
102120
"System.ObjectModel",
@@ -105,6 +123,10 @@ public static class DotNetConstants
105123
"System.Private.Uri",
106124
"System.Private.Xml",
107125
"System.Private.Xml.Linq",
126+
"System.Reactive.Core",
127+
"System.Reactive.Interfaces",
128+
"System.Reactive.Linq",
129+
"System.Reactive.PlatformServices",
108130
"System.Reflection",
109131
"System.Reflection.DispatchProxy",
110132
"System.Reflection.Emit",
@@ -118,6 +140,7 @@ public static class DotNetConstants
118140
"System.Resources.ResourceManager",
119141
"System.Resources.Writer",
120142
"System.Runtime",
143+
"System.Runtime.CompilerServices.Unsafe",
121144
"System.Runtime.CompilerServices.VisualC",
122145
"System.Runtime.Extensions",
123146
"System.Runtime.Handles",
@@ -139,17 +162,25 @@ public static class DotNetConstants
139162
"System.Security.Cryptography.Csp",
140163
"System.Security.Cryptography.Encoding",
141164
"System.Security.Cryptography.OpenSsl",
165+
"System.Security.Cryptography.Pkcs",
142166
"System.Security.Cryptography.Primitives",
167+
"System.Security.Cryptography.ProtectedData",
143168
"System.Security.Cryptography.X509Certificates",
169+
"System.Security.Cryptography.Xml",
170+
"System.Security.Permissions",
144171
"System.Security.Principal",
145172
"System.Security.Principal.Windows",
146173
"System.Security.SecureString",
147174
"System.ServiceModel.Web",
148175
"System.ServiceProcess",
176+
"System.Spatial",
149177
"System.Text.Encoding",
178+
"System.Text.Encoding.CodePages",
150179
"System.Text.Encoding.Extensions",
180+
"System.Text.Encodings.Web",
151181
"System.Text.RegularExpressions",
152182
"System.Threading",
183+
"System.Threading.Channels",
153184
"System.Threading.Overlapped",
154185
"System.Threading.Tasks",
155186
"System.Threading.Tasks.Dataflow",
@@ -173,6 +204,7 @@ public static class DotNetConstants
173204
"System.Xml.XmlSerializer",
174205
"System.Xml.XPath",
175206
"System.Xml.XPath.XDocument",
207+
"System.Xml.XPath.XmlDocument",
176208
"WindowsBase"
177209
};
178210
}

src/WebJobs.Script/Description/DotNet/ScriptFunctionMetadataResolver.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
using System.Linq;
1111
using System.Reflection;
1212
using System.Runtime.Loader;
13+
using System.Text;
1314
using System.Threading.Tasks;
1415
using Microsoft.Azure.WebJobs.Script.Extensibility;
1516
using Microsoft.CodeAnalysis;
@@ -34,7 +35,7 @@ public sealed class ScriptFunctionMetadataResolver : MetadataReferenceResolver,
3435
private readonly ExtensionSharedAssemblyProvider _extensionSharedAssemblyProvider;
3536

3637
private PackageAssemblyResolver _packageAssemblyResolver;
37-
private ScriptMetadataResolver _scriptResolver;
38+
private MetadataReferenceResolver _scriptResolver;
3839

3940
private static readonly string[] DefaultAssemblyReferences =
4041
{
@@ -77,7 +78,8 @@ public ScriptFunctionMetadataResolver(string scriptFilePath, ICollection<ScriptB
7778
_scriptFilePath = scriptFilePath;
7879
_packageAssemblyResolver = new PackageAssemblyResolver(_scriptFileDirectory);
7980
_privateAssembliesPath = GetBinDirectory(_scriptFileDirectory);
80-
_scriptResolver = ScriptMetadataResolver.Default.WithSearchPaths(_privateAssembliesPath);
81+
var scriptResolver = ScriptMetadataResolver.Default.WithSearchPaths(_privateAssembliesPath);
82+
_scriptResolver = new CacheMetadataResolver(scriptResolver);
8183
_extensionSharedAssemblyProvider = new ExtensionSharedAssemblyProvider(bindingProviders);
8284
_logger = logger;
8385
}

src/WebJobs.Script/WebJobs.Script.csproj

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
<PackageReference Include="Google.Protobuf" Version="3.3.0" />
2626
<PackageReference Include="Grpc.Core" Version="1.4.1" />
2727
<PackageReference Include="Microsoft.ApplicationInsights" Version="2.5.0" />
28-
<PackageReference Include="Microsoft.AspNetCore.Mvc.WebApiCompatShim" Version="2.0.2">
28+
<PackageReference Include="Microsoft.AspNetCore.Mvc.WebApiCompatShim" Version="2.1.0">
2929
<NoWarn>NU1701</NoWarn>
3030
</PackageReference>
3131
<PackageReference Include="Microsoft.Azure.AppService.Proxy.Client" Version="2.0.4780001-beta-0fed1b79" />
@@ -39,14 +39,14 @@
3939
<PackageReference Include="Microsoft.Azure.WebJobs.Logging" Version="3.0.0-beta6-11316" />
4040
<PackageReference Include="Microsoft.Azure.WebJobs.Logging.ApplicationInsights" Version="3.0.0-beta6-11316" />
4141
<PackageReference Include="Microsoft.Build" Version="15.3.409" />
42-
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Scripting" Version="2.4.0" />
43-
<PackageReference Include="Microsoft.DotNet.PlatformAbstractions" Version="2.0.4" />
44-
<PackageReference Include="Microsoft.Extensions.Logging" Version="2.0.0" />
45-
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="2.0.0" />
46-
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="2.0.0" />
42+
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Scripting" Version="2.8.2" />
43+
<PackageReference Include="Microsoft.DotNet.PlatformAbstractions" Version="2.1.0" />
44+
<PackageReference Include="Microsoft.Extensions.Logging" Version="2.1.0" />
45+
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="2.1.0" />
46+
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="2.1.0" />
4747
<PackageReference Include="Microsoft.FSharp.Compiler" Version="4.2.0-rc-170621-0" />
4848
<PackageReference Include="ncrontab" Version="3.3.0" />
49-
<PackageReference Include="Newtonsoft.Json" Version="10.0.3" />
49+
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
5050
<PackageReference Include="NuGet.Frameworks" Version="4.4.0" />
5151
<PackageReference Include="NuGet.LibraryModel" Version="4.4.0" />
5252
<PackageReference Include="NuGet.ProjectModel" Version="4.4.0" />

test/TestFunctions/TestFunctions.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>netcoreapp2.0</TargetFramework>
4+
<TargetFramework>netcoreapp2.1</TargetFramework>
55
</PropertyGroup>
66

77
<ItemGroup>

0 commit comments

Comments
 (0)