Backport resourcehealth deserializationfix#2293
Merged
vcolin7 merged 1 commit intorelease/azure/2.xfrom Mar 31, 2026
Merged
Conversation
…`DateTimeOffset?` (#2292) Changed approach to use `string?` instead of `DateTimeOffset?`
resourcehealth deserialization to use string? instead of DateTimeOffset? (#2292)resourcehealth deserializationfix
anuchandy
approved these changes
Mar 31, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Backports the Resource Health fix for Azure API responses that include datetime strings without timezone designators (notably the 0001-01-01T00:00:00 sentinel), preventing System.Text.Json deserialization failures in the resourcehealth tools.
Changes:
- Changed internal Resource Health response models to deserialize datetime fields as
string?instead ofDateTimeOffset?. - Added a lenient
string? -> DateTimeOffset?parsing helper during internal-to-public model conversion. - Added unit tests covering mixed timezone/no-timezone datetime formats for service health events and availability status.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tools/Azure.Mcp.Tools.ResourceHealth/src/Models/Internal/ServiceHealthEventResponse.cs | Switches datetime fields to string? for resilient JSON deserialization. |
| tools/Azure.Mcp.Tools.ResourceHealth/src/Models/Internal/AvailabilityStatusResponse.cs | Switches datetime fields to string? for resilient JSON deserialization. |
| tools/Azure.Mcp.Tools.ResourceHealth/src/Models/Internal/ResponseModelExtensions.cs | Adds lenient datetime parsing when mapping internal responses to public models. |
| tools/Azure.Mcp.Tools.ResourceHealth/tests/Azure.Mcp.Tools.ResourceHealth.UnitTests/ServiceHealthEvents/ServiceHealthEventDeserializationTests.cs | Adds coverage for service health event datetime formats (with/without timezone, nulls, mixed). |
| tools/Azure.Mcp.Tools.ResourceHealth/tests/Azure.Mcp.Tools.ResourceHealth.UnitTests/AvailabilityStatus/AvailabilityStatusDeserializationTests.cs | Adds coverage for availability status datetime formats (with/without timezone, nulls, single vs list). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Backport 105990a from PR #2292
GitHub issue number?
#2000
Pre-merge Checklist
servers/Azure.Mcp.Server/README.mdand/orservers/Fabric.Mcp.Server/README.mddocumentationREADME.mdchanges running the script./eng/scripts/Process-PackageReadMe.ps1. See Package READMEToolDescriptionEvaluatorand obtained a score of0.4or more and a top 3 ranking for all related test promptsconsolidated-tools.jsonbreaking-changelabelservers/Azure.Mcp.Server/docs/azmcp-commands.md./eng/scripts/Update-AzCommandsMetadata.ps1to update tool metadata inazmcp-commands.md(required for CI)servers/Azure.Mcp.Server/docs/e2eTestPrompts.mdcrypto mining, spam, data exfiltration, etc.)/azp run mcp - pullrequest - liveto run Live Test Pipeline