Skip to content

Commit bf38b70

Browse files
authored
Moving WebJobs.Script to .NET 8 (#10744)
1 parent 37f748b commit bf38b70

16 files changed

+14
-73
lines changed

release_notes.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@
1010
- [Added net9 prelaunch app.](https://github.com/Azure/azure-functions-dotnet-worker/pull/2898)
1111
- Update the `DefaultHttpProxyService` to better handle client disconnect scenarios (#10688)
1212
- Replaced `InvalidOperationException` with `HttpForwardingException` when there is a ForwarderError
13+
- Updated `WebJobs.Script` to target .NET 8 (instead of .NET Standard 2.1)

src/WebJobs.Script/Binding/Http/RawScriptResult.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public async Task ExecuteResultAsync(ActionContext context)
6262
}
6363
else
6464
{
65-
response.Headers.Add(header.Key, header.Value.ToString() ?? string.Empty);
65+
response.Headers.Append(header.Key, header.Value.ToString() ?? string.Empty);
6666
}
6767
}
6868
}

src/WebJobs.Script/Binding/Http/ScriptObjectResult.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ internal void AddResponseHeaders(HttpContext context)
3939
}
4040
else
4141
{
42-
response.Headers.Add(header.Key, header.Value.ToString() ?? string.Empty);
42+
response.Headers.Append(header.Key, header.Value.ToString() ?? string.Empty);
4343
}
4444
}
4545
}

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

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212
namespace Microsoft.Azure.WebJobs.Script.Description
1313
{
14-
[Serializable]
1514
public sealed class CompilationServiceException : Exception
1615
{
1716
public CompilationServiceException()
@@ -25,9 +24,5 @@ public CompilationServiceException(string message) : base(message)
2524
public CompilationServiceException(string message, Exception innerException) : base(message, innerException)
2625
{
2726
}
28-
29-
private CompilationServiceException(SerializationInfo info, StreamingContext context) : base(info, context)
30-
{
31-
}
3227
}
3328
}

src/WebJobs.Script/Extensions/AssemblyExtensions.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@ public static string GetCodeBase(this Assembly assembly)
2525
return codeBase;
2626
}
2727

28+
#pragma warning disable SYSLIB0012 // Type or member is obsolete
2829
return assembly.CodeBase;
30+
#pragma warning restore SYSLIB0012 // Type or member is obsolete
2931
}
3032
}
3133
}

src/WebJobs.Script/ExternalStartupException.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,12 @@ namespace Microsoft.Azure.WebJobs.Script
99
/// An exception that indicates an issue calling into an external Startup class. This will
1010
/// prevent the host from starting.
1111
/// </summary>
12-
[Serializable]
1312
public class ExternalStartupException : Exception
1413
{
1514
public ExternalStartupException() { }
1615

1716
public ExternalStartupException(string message) : base(message) { }
1817

1918
public ExternalStartupException(string message, Exception inner) : base(message, inner) { }
20-
21-
protected ExternalStartupException(
22-
System.Runtime.Serialization.SerializationInfo info,
23-
System.Runtime.Serialization.StreamingContext context) : base(info, context) { }
2419
}
2520
}

src/WebJobs.Script/FunctionConfigurationException.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,12 @@ namespace Microsoft.Azure.WebJobs.Script
99
/// An exception that indicates an issue with a function. These exceptions will be caught and
1010
/// logged, but not cause a host to restart.
1111
/// </summary>
12-
[Serializable]
1312
public class FunctionConfigurationException : Exception
1413
{
1514
public FunctionConfigurationException() { }
1615

1716
public FunctionConfigurationException(string message) : base(message) { }
1817

1918
public FunctionConfigurationException(string message, Exception inner) : base(message, inner) { }
20-
21-
protected FunctionConfigurationException(
22-
System.Runtime.Serialization.SerializationInfo info,
23-
System.Runtime.Serialization.StreamingContext context) : base(info, context) { }
2419
}
2520
}

src/WebJobs.Script/Host/ProxyFunctionProvider.cs

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

103-
ImmutableArray<FunctionMetadata> metadata;
103+
ImmutableArray<FunctionMetadata> metadata = ImmutableArray<FunctionMetadata>.Empty;
104104
if (proxies != null && proxies.Any())
105105
{
106106
metadata = proxies.ToImmutableArray<FunctionMetadata>();

src/WebJobs.Script/HostConfigurationException.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,12 @@ namespace Microsoft.Azure.WebJobs.Script
99
/// An exception that indicates an issue configuring a ScriptHost. This will
1010
/// prevent the host from starting.
1111
/// </summary>
12-
[Serializable]
1312
public class HostConfigurationException : Exception
1413
{
1514
public HostConfigurationException() { }
1615

1716
public HostConfigurationException(string message) : base(message) { }
1817

1918
public HostConfigurationException(string message, Exception inner) : base(message, inner) { }
20-
21-
protected HostConfigurationException(
22-
System.Runtime.Serialization.SerializationInfo info,
23-
System.Runtime.Serialization.StreamingContext context) : base(info, context) { }
2419
}
2520
}

src/WebJobs.Script/HostDisposedException.cs

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ namespace Microsoft.Azure.WebJobs.Script
1111
/// <summary>
1212
/// An exception that indicates that a service was used on a disposed host.
1313
/// </summary>
14-
[Serializable]
1514
public class HostDisposedException : ObjectDisposedException
1615
{
1716
// For this exception, we want a full stack trace to pinpoint the method
@@ -24,31 +23,13 @@ public HostDisposedException(string disposedObjectName, Exception inner)
2423
_stackTraceString = GetStackTraceString();
2524
}
2625

27-
protected HostDisposedException(SerializationInfo info, StreamingContext context)
28-
: base(info, context)
29-
{
30-
if (info == null)
31-
{
32-
throw new ArgumentNullException(nameof(info));
33-
}
34-
35-
_stackTraceString = info.GetString("FullStackTraceString");
36-
}
37-
3826
public override string StackTrace => _stackTraceString;
3927

4028
public string GetStackTraceString()
4129
{
4230
return new StackTrace(true).ToString();
4331
}
4432

45-
public override void GetObjectData(SerializationInfo info, StreamingContext context)
46-
{
47-
base.GetObjectData(info, context);
48-
49-
info.AddValue("FullStackTraceString", _stackTraceString);
50-
}
51-
5233
private static string GetDefaultMessage(string disposedObjectName)
5334
{
5435
string message = $"The host is disposed and cannot be used. Disposed object: '{disposedObjectName}'";

0 commit comments

Comments
 (0)