Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jul 28, 2025

This PR fixes the build errors that occur when updating the dependencies in PR #3227, specifically after updating Fhir.Metrics from 1.3.0 to 1.3.1.

Issue

The build fails with nullability mismatch errors in Ucum.cs:

error CS8620: Argument of type '(string value, string unit, string? codesystem)' cannot be used for parameter 'quantity' of type '(string value, string unit, string codesystem)' in 'Quantity Ucum.quantityFromTuple((string value, string unit, string codesystem) quantity)' due to differences in the nullability of reference types.

Root Cause

The Fhir.Metrics 1.3.1 update introduced stricter nullability annotations. The METRIC_SERVICE methods (TryCanonicalize, TryMultiply, TryDivide) now return tuples with nullable string? for the codesystem parameter, but the local quantityFromTuple method expected a non-nullable string.

Solution

Updated the quantityFromTuple method signature to accept nullable string? for the codesystem parameter:

// Before
private static Quantity quantityFromTuple((string value, string unit, string codesystem) quantity)

// After  
private static Quantity quantityFromTuple((string value, string unit, string? codesystem) quantity)

This minimal change maintains backward compatibility while resolving the nullability mismatch.

Verification

  • ✅ Solution builds successfully in both Debug and Release configurations
  • ✅ All UCUM-related tests continue to pass
  • ✅ Benchmarks project builds with updated BenchmarkDotNet 0.15.2
  • ✅ No new warnings or errors introduced

Fixes #3228.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits July 28, 2025 19:50
Co-authored-by: alexzautke <548617+alexzautke@users.noreply.github.com>
Co-authored-by: alexzautke <548617+alexzautke@users.noreply.github.com>
@alexzautke alexzautke changed the base branch from develop to dependabot/nuget/src/Benchmarks/multi-d164b175f3 July 28, 2025 19:55
@alexzautke alexzautke marked this pull request as ready for review July 28, 2025 19:56
Copilot AI changed the title [WIP] Fix build issue in #3227 Fix build issue with Fhir.Metrics 1.3.1 nullability annotations Jul 28, 2025
Copilot AI requested a review from alexzautke July 28, 2025 19:57
@alexzautke alexzautke merged commit 88bf866 into dependabot/nuget/src/Benchmarks/multi-d164b175f3 Jul 28, 2025
3 of 5 checks passed
@alexzautke alexzautke deleted the copilot/fix-3228 branch July 28, 2025 19:57
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.

Fix build issue in #3227

2 participants