diff --git a/release_notes.md b/release_notes.md index 84f8fb1ebd..9265356c1d 100644 --- a/release_notes.md +++ b/release_notes.md @@ -3,20 +3,4 @@ -- Emit diagnostic warning for deprecated Azure Functions Proxies usage (#11405) -- Update Python Worker Version to [4.40.2](https://github.com/Azure/azure-functions-python-worker/releases/tag/4.40.2) -- Add JitTrace Files for v4.1044 -- Send `TelemetryHealthCheckPublisher` logs to ScriptHost `ILogger` (#11398) -- Implementing a resolver that resolves worker configurations from specified probing paths (#11258) -- Remove duplicate function names from sync triggers payload(#11371) -- Avoid emitting empty tag values for health check metrics (#11393) -- Run health checks from the active ScriptHost (#11410) -- Publish health check metrics to legacy AppInsights SDK (#11365) -- Fix tag filter for health check live & ready endpoints (#11363) -- Functions host to take a customer specified port in Custom Handler scenario (#11408) -- Updated to version 1.5.8 of Microsoft.Azure.AppService.Middleware.Functions (#11416) -- Enabling worker indexing for Logic Apps app kind behind an enviornment setting -- Adding HttpWorkerFunctionProvider functions to synctrigger payload (#11430) -- Remove the Flex-only AzureMonitorDiagnosticLoggerProvider filter (#11431) -- Add TraceContext attributes for OTel (#11429) -- Add JitTrace Files for v4.1045 +- Adding empty remote message check in the SystemLogger (#11473) diff --git a/src/Directory.Version.props b/src/Directory.Version.props index 99bad7495c..ca03270df6 100644 --- a/src/Directory.Version.props +++ b/src/Directory.Version.props @@ -1,6 +1,6 @@ - 4.1045.100 + 4.1045.200 true diff --git a/src/WebJobs.Script.WebHost/Extensions/ExceptionExtensions.cs b/src/WebJobs.Script.WebHost/Extensions/ExceptionExtensions.cs index 29565c798f..3ab89c9e29 100644 --- a/src/WebJobs.Script.WebHost/Extensions/ExceptionExtensions.cs +++ b/src/WebJobs.Script.WebHost/Extensions/ExceptionExtensions.cs @@ -63,15 +63,17 @@ public static (string InnerExceptionType, string InnerExceptionMessage, string D var formattedDetails = exception.ToFormattedString(); if (exception is FunctionInvocationException && baseException is RpcException { RemoteMessage: var remoteMsg } - && remoteMsg is not null) + && !string.IsNullOrWhiteSpace(remoteMsg)) { var redacted = GetRedactedExceptionMessage(remoteMsg); - var innerExceptionMessage = Sanitizer.Sanitize( - originalMessage.Replace(remoteMsg, redacted, StringComparison.Ordinal)); + var innerExceptionMessage = string.IsNullOrWhiteSpace(originalMessage) + ? string.Empty + : Sanitizer.Sanitize(originalMessage.Replace(remoteMsg, redacted, StringComparison.Ordinal)); - var detailsSanitized = Sanitizer.Sanitize( - formattedDetails.Replace(remoteMsg, redacted, StringComparison.Ordinal)); + var detailsSanitized = string.IsNullOrWhiteSpace(formattedDetails) + ? string.Empty + : Sanitizer.Sanitize(formattedDetails.Replace(remoteMsg, redacted, StringComparison.Ordinal)); return (innerType, innerExceptionMessage, detailsSanitized, formattedMessage); } diff --git a/test/WebJobs.Script.Tests/Extensions/ExceptionExtensionsTests.cs b/test/WebJobs.Script.Tests/Extensions/ExceptionExtensionsTests.cs index 0c27a08b6d..06a555f04b 100644 --- a/test/WebJobs.Script.Tests/Extensions/ExceptionExtensionsTests.cs +++ b/test/WebJobs.Script.Tests/Extensions/ExceptionExtensionsTests.cs @@ -1,7 +1,9 @@ -// Copyright (c) .NET Foundation. All rights reserved. +// 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 Microsoft.Azure.WebJobs.Host; +using Microsoft.Azure.WebJobs.Script.Workers.Rpc; using Xunit; namespace Microsoft.Azure.WebJobs.Script.Tests.Extensions @@ -31,7 +33,55 @@ public void GetExceptionDetails_ReturnsExpectedResult() Assert.Contains("System.Exception : some outer exception ---> System.InvalidOperationException : Some inner exception", exceptionDetails); Assert.Contains("End of inner exception", exceptionDetails); Assert.Contains("at Microsoft.Azure.WebJobs.Script.Tests.Extensions.ExceptionExtensionsTests.GetExceptionDetails_ReturnsExpectedResult()", exceptionDetails); - Assert.Contains("ExceptionExtensionsTests.cs : 20", exceptionDetails); + Assert.Contains("ExceptionExtensionsTests.cs", exceptionDetails); + } + + [Fact] + public void GetExceptionDetails_Rpc() + { + string rpcMessage = "rpcMessage"; + Exception innerException = new RpcException("result", rpcMessage, "stack"); + Exception outerException = new FunctionInvocationException("message", innerException); + Exception fullException; + + try + { + throw outerException; + } + catch (Exception e) + { + fullException = e; + } + + (string exceptionType, string exceptionMessage, string exceptionDetails, string formattedText) = fullException.GetSanitizedExceptionDetails("safe text"); + + Assert.Equal("Microsoft.Azure.WebJobs.Script.Workers.Rpc.RpcException", exceptionType); + Assert.DoesNotContain(rpcMessage, exceptionMessage); + Assert.DoesNotContain(rpcMessage, exceptionDetails); + Assert.Contains("safe text", formattedText); + } + + [Fact] + public void GetExceptionDetails_Rpc_Empty() + { + Exception innerException = new RpcException(string.Empty, string.Empty, string.Empty); + Exception outerException = new FunctionInvocationException(string.Empty, innerException); + Exception fullException; + + try + { + throw outerException; + } + catch (Exception e) + { + fullException = e; + } + + (string exceptionType, string exceptionMessage, _, string formattedText) = fullException.GetSanitizedExceptionDetails("safe text"); + + Assert.Equal("Microsoft.Azure.WebJobs.Script.Workers.Rpc.RpcException", exceptionType); + Assert.Equal("Result: \nType: \nException: \nStack: ", exceptionMessage); + Assert.Contains("safe text", formattedText); } } }