Skip to content

Commit 98e6297

Browse files
authored
Multi-target WebJobs.Script (#11385)
* Multi-target WebJobs.Script * Remove unused extension methods. Port logic from dev for GetDefaultWorkersDirectory * Port dev logic for MemoryMappedFileAccessorWindows.TryOpen
1 parent b6fec12 commit 98e6297

15 files changed

+61
-81
lines changed

eng/build/Engineering.props

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
<DebugType>embedded</DebugType>
2424
<GenerateRuntimeConfigDevFile>true</GenerateRuntimeConfigDevFile><!-- https://github.com/dotnet/runtime/issues/54684 -->
2525
<DisableImplicitNamespaceImports>true</DisableImplicitNamespaceImports>
26+
<CheckEolTargetFramework>false</CheckEolTargetFramework> <!-- We are building net6 until OOP is end of life. -->
2627
</PropertyGroup>
2728

2829
<ItemGroup>

src/WebJobs.Script/Description/Compilation/CompilationServiceException.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,11 @@ public CompilationServiceException(string message, Exception innerException) : b
2626
{
2727
}
2828

29-
private CompilationServiceException(SerializationInfo info, StreamingContext context) : base(info, context)
29+
#if NET8_0_OR_GREATER
30+
[Obsolete]
31+
#endif
32+
private CompilationServiceException(SerializationInfo info, StreamingContext context)
33+
: base(info, context)
3034
{
3135
}
3236
}

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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,15 @@
33

44
using System;
55
using System.Collections.Generic;
6-
using System.Runtime.InteropServices;
76
using Microsoft.Azure.WebJobs.Script.Config;
87

98
namespace Microsoft.Azure.WebJobs.Script.Description
109
{
1110
internal class RuntimeAssembliesInfo
1211
{
12+
private readonly object _loadSyncRoot = new();
1313
private readonly IEnvironment _environment;
1414
private Lazy<Dictionary<string, ScriptRuntimeAssembly>> _runtimeAssemblies;
15-
private object _loadSyncRoot = new object();
1615
private bool? _relaxedUnification;
1716

1817
public RuntimeAssembliesInfo()
@@ -35,10 +34,9 @@ private Dictionary<string, ScriptRuntimeAssembly> GetRuntimeAssemblies()
3534
lock (_loadSyncRoot)
3635
{
3736
_relaxedUnification = FeatureFlags.IsEnabled(ScriptConstants.FeatureFlagRelaxedAssemblyUnification, _environment);
38-
var tfmversion = typeof(string).Assembly.GetName().Version.Major;
3937
var manifestName = _relaxedUnification.Value
4038
? "runtimeassemblies-relaxed.json"
41-
: $"runtimeassemblies-net{tfmversion}.json";
39+
: $"runtimeassemblies.json";
4240

4341
return DependencyHelper.GetRuntimeAssemblies(manifestName);
4442
}

src/WebJobs.Script/Extensions/AssemblyExtensions.cs

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

src/WebJobs.Script/ExternalStartupException.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// Licensed under the MIT License. See License.txt in the project root for license information.
33

44
using System;
5+
using System.Runtime.Serialization;
56

67
namespace Microsoft.Azure.WebJobs.Script
78
{
@@ -18,8 +19,10 @@ public ExternalStartupException(string message) : base(message) { }
1819

1920
public ExternalStartupException(string message, Exception inner) : base(message, inner) { }
2021

21-
protected ExternalStartupException(
22-
System.Runtime.Serialization.SerializationInfo info,
23-
System.Runtime.Serialization.StreamingContext context) : base(info, context) { }
22+
#if NET8_0_OR_GREATER
23+
[Obsolete]
24+
#endif
25+
protected ExternalStartupException(SerializationInfo info, StreamingContext context)
26+
: base(info, context) { }
2427
}
2528
}

src/WebJobs.Script/FunctionConfigurationException.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// Licensed under the MIT License. See License.txt in the project root for license information.
33

44
using System;
5+
using System.Runtime.Serialization;
56

67
namespace Microsoft.Azure.WebJobs.Script
78
{
@@ -18,8 +19,10 @@ public FunctionConfigurationException(string message) : base(message) { }
1819

1920
public FunctionConfigurationException(string message, Exception inner) : base(message, inner) { }
2021

21-
protected FunctionConfigurationException(
22-
System.Runtime.Serialization.SerializationInfo info,
23-
System.Runtime.Serialization.StreamingContext context) : base(info, context) { }
22+
#if NET8_0_OR_GREATER
23+
[Obsolete]
24+
#endif
25+
protected FunctionConfigurationException(SerializationInfo info, StreamingContext context)
26+
: base(info, context) { }
2427
}
2528
}

src/WebJobs.Script/Host/ProxyFunctionProvider.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ private ImmutableArray<FunctionMetadata> LoadFunctionMetadata()
9494
var functionErrors = new Dictionary<string, ICollection<string>>();
9595
Collection<ProxyFunctionMetadata> proxies = ReadProxyMetadata(_scriptOptions.Value.RootScriptPath, _logger, functionErrors);
9696

97-
ImmutableArray<FunctionMetadata> metadata;
97+
ImmutableArray<FunctionMetadata> metadata = default;
9898
if (proxies != null && proxies.Any())
9999
{
100100
metadata = proxies.ToImmutableArray<FunctionMetadata>();

src/WebJobs.Script/HostConfigurationException.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// Licensed under the MIT License. See License.txt in the project root for license information.
33

44
using System;
5+
using System.Runtime.Serialization;
56

67
namespace Microsoft.Azure.WebJobs.Script
78
{
@@ -18,8 +19,10 @@ public HostConfigurationException(string message) : base(message) { }
1819

1920
public HostConfigurationException(string message, Exception inner) : base(message, inner) { }
2021

21-
protected HostConfigurationException(
22-
System.Runtime.Serialization.SerializationInfo info,
23-
System.Runtime.Serialization.StreamingContext context) : base(info, context) { }
22+
#if NET8_0_OR_GREATER
23+
[Obsolete]
24+
#endif
25+
protected HostConfigurationException(SerializationInfo info, StreamingContext context)
26+
: base(info, context) { }
2427
}
2528
}

src/WebJobs.Script/HostDisposedException.cs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,13 @@ public HostDisposedException(string disposedObjectName, Exception inner)
2424
_stackTraceString = GetStackTraceString();
2525
}
2626

27+
#if NET8_0_OR_GREATER
28+
[Obsolete]
29+
#endif
2730
protected HostDisposedException(SerializationInfo info, StreamingContext context)
2831
: base(info, context)
2932
{
30-
if (info == null)
31-
{
32-
throw new ArgumentNullException(nameof(info));
33-
}
34-
33+
ArgumentNullException.ThrowIfNull(info);
3534
_stackTraceString = info.GetString("FullStackTraceString");
3635
}
3736

@@ -42,10 +41,12 @@ public string GetStackTraceString()
4241
return new StackTrace(true).ToString();
4342
}
4443

44+
#if NET8_0_OR_GREATER
45+
[Obsolete]
46+
#endif
4547
public override void GetObjectData(SerializationInfo info, StreamingContext context)
4648
{
4749
base.GetObjectData(info, context);
48-
4950
info.AddValue("FullStackTraceString", _stackTraceString);
5051
}
5152

src/WebJobs.Script/HostInitializationException.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// Licensed under the MIT License. See License.txt in the project root for license information.
33

44
using System;
5+
using System.Runtime.Serialization;
56

67
namespace Microsoft.Azure.WebJobs.Script
78
{
@@ -17,8 +18,10 @@ public HostInitializationException(string message) : base(message) { }
1718

1819
public HostInitializationException(string message, Exception inner) : base(message, inner) { }
1920

20-
protected HostInitializationException(
21-
System.Runtime.Serialization.SerializationInfo info,
22-
System.Runtime.Serialization.StreamingContext context) : base(info, context) { }
21+
#if NET8_0_OR_GREATER
22+
[Obsolete]
23+
#endif
24+
protected HostInitializationException(SerializationInfo info, StreamingContext context)
25+
: base(info, context) { }
2326
}
2427
}

0 commit comments

Comments
 (0)