Skip to content

Commit b358dab

Browse files
Patch/4.44.350 (#11476)
* Update version to 4.1044.350 * Clear release notes * Adding empty remote message check in the SystemLogger (#11473) * Adding empty string check. * Revise release notes structure and content Updated release notes format and added new entries. --------- Co-authored-by: azure-functions-release[bot] <223311270+azure-functions-release[bot]@users.noreply.github.com>
1 parent a9abdf3 commit b358dab

File tree

4 files changed

+61
-11
lines changed

4 files changed

+61
-11
lines changed

release_notes.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,4 @@
33
<!-- Please add your release notes in the following format:
44
- My change description (#PR)
55
-->
6-
-->
7-
- Update Python Worker Version to [4.40.2](https://github.com/Azure/azure-functions-python-worker/releases/tag/4.40.2)
8-
- Add JitTrace Files for v4.1044
6+
- Adding empty remote message check in the SystemLogger (#11473)

src/Directory.Version.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<Project>
22
<PropertyGroup>
3-
<VersionPrefix>4.1044.300</VersionPrefix>
3+
<VersionPrefix>4.1044.350</VersionPrefix>
44
<UpdateBuildNumber>true</UpdateBuildNumber>
55
</PropertyGroup>
66
</Project>

src/WebJobs.Script.WebHost/Extensions/ExceptionExtensions.cs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,15 +63,17 @@ public static (string InnerExceptionType, string InnerExceptionMessage, string D
6363
var formattedDetails = exception.ToFormattedString();
6464

6565
if (exception is FunctionInvocationException && baseException is RpcException { RemoteMessage: var remoteMsg }
66-
&& remoteMsg is not null)
66+
&& !string.IsNullOrWhiteSpace(remoteMsg))
6767
{
6868
var redacted = GetRedactedExceptionMessage(remoteMsg);
6969

70-
var innerExceptionMessage = Sanitizer.Sanitize(
71-
originalMessage.Replace(remoteMsg, redacted, StringComparison.Ordinal));
70+
var innerExceptionMessage = string.IsNullOrWhiteSpace(originalMessage)
71+
? string.Empty
72+
: Sanitizer.Sanitize(originalMessage.Replace(remoteMsg, redacted, StringComparison.Ordinal));
7273

73-
var detailsSanitized = Sanitizer.Sanitize(
74-
formattedDetails.Replace(remoteMsg, redacted, StringComparison.Ordinal));
74+
var detailsSanitized = string.IsNullOrWhiteSpace(formattedDetails)
75+
? string.Empty
76+
: Sanitizer.Sanitize(formattedDetails.Replace(remoteMsg, redacted, StringComparison.Ordinal));
7577

7678
return (innerType, innerExceptionMessage, detailsSanitized, formattedMessage);
7779
}

test/WebJobs.Script.Tests/Extensions/ExceptionExtensionsTests.cs

Lines changed: 52 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
// Copyright (c) .NET Foundation. All rights reserved.
1+
// Copyright (c) .NET Foundation. All rights reserved.
22
// Licensed under the MIT License. See License.txt in the project root for license information.
33

44
using System;
5+
using Microsoft.Azure.WebJobs.Host;
6+
using Microsoft.Azure.WebJobs.Script.Workers.Rpc;
57
using Xunit;
68

79
namespace Microsoft.Azure.WebJobs.Script.Tests.Extensions
@@ -31,7 +33,55 @@ public void GetExceptionDetails_ReturnsExpectedResult()
3133
Assert.Contains("System.Exception : some outer exception ---> System.InvalidOperationException : Some inner exception", exceptionDetails);
3234
Assert.Contains("End of inner exception", exceptionDetails);
3335
Assert.Contains("at Microsoft.Azure.WebJobs.Script.Tests.Extensions.ExceptionExtensionsTests.GetExceptionDetails_ReturnsExpectedResult()", exceptionDetails);
34-
Assert.Contains("ExceptionExtensionsTests.cs : 20", exceptionDetails);
36+
Assert.Contains("ExceptionExtensionsTests.cs", exceptionDetails);
37+
}
38+
39+
[Fact]
40+
public void GetExceptionDetails_Rpc()
41+
{
42+
string rpcMessage = "rpcMessage";
43+
Exception innerException = new RpcException("result", rpcMessage, "stack");
44+
Exception outerException = new FunctionInvocationException("message", innerException);
45+
Exception fullException;
46+
47+
try
48+
{
49+
throw outerException;
50+
}
51+
catch (Exception e)
52+
{
53+
fullException = e;
54+
}
55+
56+
(string exceptionType, string exceptionMessage, string exceptionDetails, string formattedText) = fullException.GetSanitizedExceptionDetails("safe text");
57+
58+
Assert.Equal("Microsoft.Azure.WebJobs.Script.Workers.Rpc.RpcException", exceptionType);
59+
Assert.DoesNotContain(rpcMessage, exceptionMessage);
60+
Assert.DoesNotContain(rpcMessage, exceptionDetails);
61+
Assert.Contains("safe text", formattedText);
62+
}
63+
64+
[Fact]
65+
public void GetExceptionDetails_Rpc_Empty()
66+
{
67+
Exception innerException = new RpcException(string.Empty, string.Empty, string.Empty);
68+
Exception outerException = new FunctionInvocationException(string.Empty, innerException);
69+
Exception fullException;
70+
71+
try
72+
{
73+
throw outerException;
74+
}
75+
catch (Exception e)
76+
{
77+
fullException = e;
78+
}
79+
80+
(string exceptionType, string exceptionMessage, _, string formattedText) = fullException.GetSanitizedExceptionDetails("safe text");
81+
82+
Assert.Equal("Microsoft.Azure.WebJobs.Script.Workers.Rpc.RpcException", exceptionType);
83+
Assert.Equal("Result: \nType: \nException: \nStack: ", exceptionMessage);
84+
Assert.Contains("safe text", formattedText);
3585
}
3686
}
3787
}

0 commit comments

Comments
 (0)