Skip to content

fix: avoid Sonar culture-sensitive ToString warning on nullable string concatenation - #1094

Merged
vbreuss merged 2 commits into
mainfrom
fix/sonar-culture-sensitive-tostring
Sep 27, 2026
Merged

vbreuss merged 2 commits into
mainfrom
fix/sonar-culture-sensitive-tostring

Conversation

@vbreuss

@vbreuss vbreuss commented Sep 25, 2026 •

Copy link
Copy Markdown
Member

Fixes several Sonar findings.

  • Culture-sensitive ToString: Sonar flags string.Concat when it is given nullable strings, so DirectoryMock and AssertionHelpers use plain + concatenation instead.
  • SafeHandle.DangerousGetHandle (blocker): MockSafeFileHandleRegistry now looks up mock handles by reference (ConditionalWeakTable) instead of by their raw value. The raw value is never read, and a handle that is never disposed is still released once it is garbage-collected.
  • Cognitive complexity: the per-entry release in ReleaseClosedHandles is now a separate method.
  • Replace without StringComparison: AssertionHelpers uses the ordinal overload where it exists (not on netstandard2.0).

@vbreuss vbreuss self-assigned this Sep 25, 2026
Copilot AI lite review requested due to automatic review settings September 25, 2026 21:03

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@vbreuss
vbreuss enabled auto-merge (squash) September 25, 2026 21:03
@github-actions

Copy link
Copy Markdown

Test Results

     62 files  ±0       62 suites  ±0   1h 17m 16s ⏱️ + 1m 16s
 63 161 tests  - 3   56 359 ✅  - 4   6 801 💤 ±0  1 ❌ +1 
147 246 runs  ±0  128 256 ✅  - 1  18 989 💤 ±0  1 ❌ +1 

For more details on these failures, see this check.

Results for commit 6c6e056. ± Comparison against base commit 015a573.

This pull request removes 60104 and adds 60100 tests. Note that renamed tests count towards both.
  )
)
Testably.Abstractions.AccessControl.Tests.DirectoryInfoAclExtensionsTests ‑ SetAccessControl_ShouldNotUpdateTimes(07a46bab-dc7a-4c80-8200-460a3681588c)
Testably.Abstractions.AccessControl.Tests.DirectoryInfoAclExtensionsTests ‑ SetAccessControl_ShouldNotUpdateTimes(1c5f782d-9ffe-4807-9400-c2bd3a10bbe9)
Testably.Abstractions.AccessControl.Tests.DirectoryInfoAclExtensionsTests ‑ SetAccessControl_ShouldNotUpdateTimes(28a7f2f8-4327-4e6a-bc3e-0f1e2a24828f)
Testably.Abstractions.AccessControl.Tests.DirectoryInfoAclExtensionsTests ‑ SetAccessControl_ShouldNotUpdateTimes(332884ea-4147-463a-bfe4-8b03073fe23f)
Testably.Abstractions.AccessControl.Tests.DirectoryInfoAclExtensionsTests ‑ SetAccessControl_ShouldNotUpdateTimes(7b467c46-d364-4d22-92f0-38812ea655f6)
Testably.Abstractions.AccessControl.Tests.DirectoryInfoAclExtensionsTests ‑ SetAccessControl_ShouldNotUpdateTimes(861085aa-8637-45df-86e6-6af028d3e60e)
Testably.Abstractions.AccessControl.Tests.DirectoryInfoAclExtensionsTests ‑ SetAccessControl_ShouldNotUpdateTimes(932614a8-ee31-406b-b356-e6b49da4f34d)
Testably.Abstractions.AccessControl.Tests.DirectoryInfoAclExtensionsTests ‑ SetAccessControl_ShouldNotUpdateTimes(a55169b7-077d-4a8c-82c0-8c8272eb22a1)
…
Testably.Abstractions.AccessControl.Tests.DirectoryInfoAclExtensionsTests ‑ SetAccessControl_ShouldNotUpdateTimes(1bcdef5d-a004-449f-99bf-933d1d54fb9b)
Testably.Abstractions.AccessControl.Tests.DirectoryInfoAclExtensionsTests ‑ SetAccessControl_ShouldNotUpdateTimes(2b85adc1-41cb-4180-b4a4-d1017a379c50)
Testably.Abstractions.AccessControl.Tests.DirectoryInfoAclExtensionsTests ‑ SetAccessControl_ShouldNotUpdateTimes(2c79062b-82f9-496d-bb12-cbe513dc3c26)
Testably.Abstractions.AccessControl.Tests.DirectoryInfoAclExtensionsTests ‑ SetAccessControl_ShouldNotUpdateTimes(45bf45c0-4040-4757-8fcf-c29b593edccf)
Testably.Abstractions.AccessControl.Tests.DirectoryInfoAclExtensionsTests ‑ SetAccessControl_ShouldNotUpdateTimes(5041f148-79c8-49ce-a13d-d49ce13d761c)
Testably.Abstractions.AccessControl.Tests.DirectoryInfoAclExtensionsTests ‑ SetAccessControl_ShouldNotUpdateTimes(58f6370e-4db5-48ce-a9e7-8336557843a4)
Testably.Abstractions.AccessControl.Tests.DirectoryInfoAclExtensionsTests ‑ SetAccessControl_ShouldNotUpdateTimes(604a4e93-6c01-4ca1-af00-fa52548ba5e0)
Testably.Abstractions.AccessControl.Tests.DirectoryInfoAclExtensionsTests ‑ SetAccessControl_ShouldNotUpdateTimes(78de9855-2b95-434e-847e-54bf627bc10d)
Testably.Abstractions.AccessControl.Tests.DirectoryInfoAclExtensionsTests ‑ SetAccessControl_ShouldNotUpdateTimes(81117122-4fbc-4a5d-b751-8471003c29c1)
Testably.Abstractions.AccessControl.Tests.DirectoryInfoAclExtensionsTests ‑ SetAccessControl_ShouldNotUpdateTimes(847e9eef-8fe6-4326-a3ce-2a43b665dadf)
…
This pull request removes 6743 skipped tests and adds 6743 skipped tests. Note that renamed tests count towards both.
Testably.Abstractions.AccessControl.Tests.DirectoryInfoAclExtensionsTests ‑ SetAccessControl_ShouldNotUpdateTimes(07a46bab-dc7a-4c80-8200-460a3681588c)
Testably.Abstractions.AccessControl.Tests.DirectoryInfoAclExtensionsTests ‑ SetAccessControl_ShouldNotUpdateTimes(1c5f782d-9ffe-4807-9400-c2bd3a10bbe9)
Testably.Abstractions.AccessControl.Tests.DirectoryInfoAclExtensionsTests ‑ SetAccessControl_ShouldNotUpdateTimes(28a7f2f8-4327-4e6a-bc3e-0f1e2a24828f)
Testably.Abstractions.AccessControl.Tests.DirectoryInfoAclExtensionsTests ‑ SetAccessControl_ShouldNotUpdateTimes(332884ea-4147-463a-bfe4-8b03073fe23f)
Testably.Abstractions.AccessControl.Tests.DirectoryInfoAclExtensionsTests ‑ SetAccessControl_ShouldNotUpdateTimes(7b467c46-d364-4d22-92f0-38812ea655f6)
Testably.Abstractions.AccessControl.Tests.DirectoryInfoAclExtensionsTests ‑ SetAccessControl_ShouldNotUpdateTimes(861085aa-8637-45df-86e6-6af028d3e60e)
Testably.Abstractions.AccessControl.Tests.DirectoryInfoAclExtensionsTests ‑ SetAccessControl_ShouldNotUpdateTimes(932614a8-ee31-406b-b356-e6b49da4f34d)
Testably.Abstractions.AccessControl.Tests.DirectoryInfoAclExtensionsTests ‑ SetAccessControl_ShouldNotUpdateTimes(a55169b7-077d-4a8c-82c0-8c8272eb22a1)
Testably.Abstractions.AccessControl.Tests.DirectoryInfoAclExtensionsTests ‑ SetAccessControl_ShouldNotUpdateTimes(b7dcf365-9a2d-41e7-a3eb-6542f684a49d)
Testably.Abstractions.AccessControl.Tests.DirectoryInfoAclExtensionsTests ‑ SetAccessControl_ShouldNotUpdateTimes(bb1eb49e-f407-48a1-a31f-93a9fad83883)
…
Testably.Abstractions.AccessControl.Tests.DirectoryInfoAclExtensionsTests ‑ SetAccessControl_ShouldNotUpdateTimes(1bcdef5d-a004-449f-99bf-933d1d54fb9b)
Testably.Abstractions.AccessControl.Tests.DirectoryInfoAclExtensionsTests ‑ SetAccessControl_ShouldNotUpdateTimes(2b85adc1-41cb-4180-b4a4-d1017a379c50)
Testably.Abstractions.AccessControl.Tests.DirectoryInfoAclExtensionsTests ‑ SetAccessControl_ShouldNotUpdateTimes(2c79062b-82f9-496d-bb12-cbe513dc3c26)
Testably.Abstractions.AccessControl.Tests.DirectoryInfoAclExtensionsTests ‑ SetAccessControl_ShouldNotUpdateTimes(45bf45c0-4040-4757-8fcf-c29b593edccf)
Testably.Abstractions.AccessControl.Tests.DirectoryInfoAclExtensionsTests ‑ SetAccessControl_ShouldNotUpdateTimes(5041f148-79c8-49ce-a13d-d49ce13d761c)
Testably.Abstractions.AccessControl.Tests.DirectoryInfoAclExtensionsTests ‑ SetAccessControl_ShouldNotUpdateTimes(58f6370e-4db5-48ce-a9e7-8336557843a4)
Testably.Abstractions.AccessControl.Tests.DirectoryInfoAclExtensionsTests ‑ SetAccessControl_ShouldNotUpdateTimes(604a4e93-6c01-4ca1-af00-fa52548ba5e0)
Testably.Abstractions.AccessControl.Tests.DirectoryInfoAclExtensionsTests ‑ SetAccessControl_ShouldNotUpdateTimes(78de9855-2b95-434e-847e-54bf627bc10d)
Testably.Abstractions.AccessControl.Tests.DirectoryInfoAclExtensionsTests ‑ SetAccessControl_ShouldNotUpdateTimes(81117122-4fbc-4a5d-b751-8471003c29c1)
Testably.Abstractions.AccessControl.Tests.DirectoryInfoAclExtensionsTests ‑ SetAccessControl_ShouldNotUpdateTimes(847e9eef-8fe6-4326-a3ce-2a43b665dadf)
…

…onHelpers

Looking up mock handles by reference instead of by their value removes the need for DangerousGetHandle, and extracting the per-entry release lowers the cognitive complexity of ReleaseClosedHandles.
@vbreuss
vbreuss force-pushed the fix/sonar-culture-sensitive-tostring branch from 6c6e056 to ef4ba13 Compare September 27, 2026 10:05
@vbreuss
vbreuss disabled auto-merge September 27, 2026 10:25
@vbreuss
vbreuss enabled auto-merge (squash) September 27, 2026 10:25
@sonarqubecloud

Copy link
Copy Markdown

@vbreuss
vbreuss merged commit 02019ff into main Sep 27, 2026
15 checks passed
@vbreuss
vbreuss deleted the fix/sonar-culture-sensitive-tostring branch September 27, 2026 10:43
@github-actions

Copy link
Copy Markdown

This is addressed in release v7.1.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants