Skip to content

Adding empty remote message check in the SystemLogger#11473

Merged
RohitRanjanMS merged 3 commits into
devfrom
roranjan/Exception-Handling
Nov 5, 2025
Merged

Adding empty remote message check in the SystemLogger#11473
RohitRanjanMS merged 3 commits into
devfrom
roranjan/Exception-Handling

Conversation

@RohitRanjanMS

@RohitRanjanMS RohitRanjanMS commented Nov 5, 2025

Copy link
Copy Markdown
Member

string.Replace is throwing exception if the remote message is empty.

Pull request checklist

IMPORTANT: Currently, changes must be backported to the in-proc branch to be included in Core Tools and non-Flex deployments.

  • Backporting to the in-proc branch is not required
    • Otherwise: Link to backporting PR
  • My changes do not require documentation changes
    • Otherwise: Documentation issue linked to PR
  • My changes should not be added to the release notes for the next release
    • Otherwise: I've added my notes to release_notes.md
  • My changes do not need to be backported to a previous version
    • Otherwise: Backport tracked by issue/PR #issue_or_pr
  • My changes do not require diagnostic events changes
    • Otherwise: I have added/updated all related diagnostic events and their documentation (Documentation issue linked to PR)
  • I have added all required tests (Unit tests, E2E tests)

Additional information

Additional PR information

@RohitRanjanMS RohitRanjanMS marked this pull request as ready for review November 5, 2025 19:51
@RohitRanjanMS RohitRanjanMS requested a review from a team as a code owner November 5, 2025 19:51
Copilot AI review requested due to automatic review settings November 5, 2025 19:51
@RohitRanjanMS RohitRanjanMS changed the title Adding empty string check in the SystemLogger Adding empty remote message check in the SystemLogger Nov 5, 2025

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR enhances the exception sanitization logic to handle empty or whitespace strings in RPC exceptions. The changes prevent unnecessary string operations on null or whitespace strings when redacting remote messages from RPC exceptions.

  • Modified the condition to check for non-whitespace remote messages instead of just non-null values
  • Added null/whitespace checks before performing string replacement operations to avoid errors

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 7 comments.

File Description
src/WebJobs.Script.WebHost/Extensions/ExceptionExtensions.cs Enhanced null/whitespace handling in GetSanitizedExceptionDetails by adding guards before string.Replace operations
test/WebJobs.Script.Tests/Extensions/ExceptionExtensionsTests.cs Added test coverage for RPC exception sanitization with both populated and empty string scenarios

Comment thread src/WebJobs.Script.WebHost/Extensions/ExceptionExtensions.cs Outdated
Comment thread src/WebJobs.Script.WebHost/Extensions/ExceptionExtensions.cs Outdated
Comment thread src/WebJobs.Script.WebHost/Extensions/ExceptionExtensions.cs
Comment thread test/WebJobs.Script.Tests/Extensions/ExceptionExtensionsTests.cs
Comment thread test/WebJobs.Script.Tests/Extensions/ExceptionExtensionsTests.cs Outdated
Comment thread test/WebJobs.Script.Tests/Extensions/ExceptionExtensionsTests.cs
Comment thread test/WebJobs.Script.Tests/Extensions/ExceptionExtensionsTests.cs
Comment thread src/WebJobs.Script.WebHost/Extensions/ExceptionExtensions.cs
@fabiocav fabiocav requested review from fabiocav and mathewc November 5, 2025 20:17
@RohitRanjanMS RohitRanjanMS merged commit de87f37 into dev Nov 5, 2025
9 checks passed
@RohitRanjanMS RohitRanjanMS deleted the roranjan/Exception-Handling branch November 5, 2025 20:47
RohitRanjanMS added a commit that referenced this pull request Nov 5, 2025
RohitRanjanMS added a commit that referenced this pull request Nov 5, 2025
This was referenced Nov 5, 2025
RohitRanjanMS added a commit that referenced this pull request Nov 5, 2025
* Update version to 4.1044.500

* Clear release notes

* Adding empty remote message check in the SystemLogger (#11473)

* Adding empty string check.

* Update release notes formatting and content

---------

Co-authored-by: azure-functions-release[bot] <223311270+azure-functions-release[bot]@users.noreply.github.com>
RohitRanjanMS added a commit that referenced this pull request Nov 6, 2025
@RohitRanjanMS RohitRanjanMS mentioned this pull request Nov 6, 2025
9 tasks
RohitRanjanMS added a commit that referenced this pull request Nov 6, 2025
* 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants