Skip to content

Fix VerifySettings copy constructor, temp cleanup, and stream/extensi…#1768

Merged
SimonCropp merged 2 commits into
mainfrom
Fix-VerifySettings-copy-constructor,-temp-cleanup,-and-stream/extension-edge-cases
Jul 5, 2026
Merged

Fix VerifySettings copy constructor, temp cleanup, and stream/extensi…#1768
SimonCropp merged 2 commits into
mainfrom
Fix-VerifySettings-copy-constructor,-temp-cleanup,-and-stream/extension-edge-cases

Conversation

@SimonCropp

Copy link
Copy Markdown
Member

…on edge cases

  • VerifySettings copy ctor: copy throwException (was dropped, so settings.AutoVerify(throwException: true) passed as an instance silently did not throw on mismatch)
  • VerifySettings copy ctor: clone the mutable collections it was aliasing (appendedFiles, the extension stream/string comparer dictionaries, and the inner lists of ExtensionMappedInstanceScrubbers), so per-test fluent config no longer leaks into a shared base settings instance
  • TempDirectory/TempFile cleanup: catch IOException/UnauthorizedAccessException for aged-out orphans instead of DirectoryNotFoundException/FileNotFoundException (which File.Delete never throws), so a locked or read-only orphan no longer fails the module initializer on every run
  • IoHelpers.WriteStream: fall back to copying through the handle when File.Copy cannot re-open the source by path (writable / FileShare.None, or a handle-based stream), resetting position only in that fallback
  • Extensions.Extension(FileStream): return "noextension" for extension-less files instead of throwing ArgumentOutOfRangeException
  • TempDirectory/TempFile: guard the AsyncLocal path list with a lock on add/remove/scrub iteration
  • Add tests for the above

…on edge cases

- VerifySettings copy ctor: copy throwException (was dropped, so
  settings.AutoVerify(throwException: true) passed as an instance silently
  did not throw on mismatch)
- VerifySettings copy ctor: clone the mutable collections it was aliasing
  (appendedFiles, the extension stream/string comparer dictionaries, and the
  inner lists of ExtensionMappedInstanceScrubbers), so per-test fluent config
  no longer leaks into a shared base settings instance
- TempDirectory/TempFile cleanup: catch IOException/UnauthorizedAccessException
  for aged-out orphans instead of DirectoryNotFoundException/FileNotFoundException
  (which File.Delete never throws), so a locked or read-only orphan no longer
  fails the module initializer on every run
- IoHelpers.WriteStream: fall back to copying through the handle when File.Copy
  cannot re-open the source by path (writable / FileShare.None, or a handle-based
  stream), resetting position only in that fallback
- Extensions.Extension(FileStream): return "noextension" for extension-less
  files instead of throwing ArgumentOutOfRangeException
- TempDirectory/TempFile: guard the AsyncLocal path list with a lock on
  add/remove/scrub iteration
- Add tests for the above
@SimonCropp SimonCropp added this to the 31.21.0 milestone Jul 5, 2026
@SimonCropp
SimonCropp merged commit f1bf84c into main Jul 5, 2026
3 checks passed
@SimonCropp
SimonCropp deleted the Fix-VerifySettings-copy-constructor,-temp-cleanup,-and-stream/extension-edge-cases branch July 5, 2026 10:16
This was referenced Jul 6, 2026
agocke pushed a commit to serdedotnet/serde that referenced this pull request Jul 20, 2026
Updated [Verify](https://github.com/VerifyTests/Verify) from 31.20.0 to
31.25.0.

<details>
<summary>Release notes</summary>

_Sourced from [Verify's
releases](https://github.com/VerifyTests/Verify/releases)._

## 31.25.0

- [x] [#​1758](VerifyTests/Verify#1758)
UseProjectRelative + SourceFileRelativeDirectory
- [x] [#​1800](VerifyTests/Verify#1800) Add
mirror source structure for verified files

## 31.24.3

- [x] [#​1799](VerifyTests/Verify#1799) Better
line ending failure diagnostics

## 31.24.2

- [ ] [#​1794](VerifyTests/Verify#1794)
Normalize scrubbed-to-empty text to emptyString
- [x] [#​1798](VerifyTests/Verify#1798) Bump
package references

## 31.24.1

- [x] [#​1790](VerifyTests/Verify#1790) Only
load referenced plugins

## 31.24.0

- [x] [#​1789](VerifyTests/Verify#1789) Add
ExcludeTargets with converter-side IsTargetExcluded check

## 31.23.0

- [x] [#​1785](VerifyTests/Verify#1785) Fix
chunk boundary scrubber bugs and test adapter defects
- [x] [#​1788](VerifyTests/Verify#1788) Add
exclude targets to omit targets by extension

## 31.22.0

- [x] [#​1778](VerifyTests/Verify#1778) Allow
conversion splitters for text extensions
- [x] [#​1779](VerifyTests/Verify#1779) Fix
chunk boundary scrubber bugs and test adapter defects
- [x] [#​1781](VerifyTests/Verify#1781) stop
using MSTest metapackage
- [x] [#​1782](VerifyTests/Verify#1782) Migrate
CI to Microsoft.Testing.Platform so all tests run
- [x] [#​1783](VerifyTests/Verify#1783) Guard
against duplicate xunit attachment names
- [x] [#​1784](VerifyTests/Verify#1784) Add Kill
process locking file option

## 31.21.0

- [x] [#​1656](VerifyTests/Verify#1656) throw
for greedy RegisterFileConverter
- [x] [#​1762](VerifyTests/Verify#1762) Reject
carriage returns in verified files instead of normalizing
- [x] [#​1767](VerifyTests/Verify#1767) Fix
correctness and perf issues in compare, recording, naming and checks
- [x] [#​1768](VerifyTests/Verify#1768) Fix
VerifySettings copy constructor, temp cleanup, and stream/extensi…
- [x] [#​1769](VerifyTests/Verify#1769) Fix
combination runner/converter, Expecto directory verification, and…
- [x] [#​1770](VerifyTests/Verify#1770) Fix
serialization scrub/convert bugs and reduce per-value scrubbing
allocations
- [x] [#​1771](VerifyTests/Verify#1771) Fix
verifier cleanup composition, stream/xml disposal and comparison
- [x] [#​1772](VerifyTests/Verify#1772) Bump
Argon from 0.34.0 to 0.35.0
- [x] [#​1773](VerifyTests/Verify#1773) Bump
DiffEngine from 19.2.0 to 19.3.0
- [x] [#​1774](VerifyTests/Verify#1774) Clear
synchronization context in to task()
- [x] [#​1775](VerifyTests/Verify#1775) Throw
for greedy RegisterFileConverter<object>

Commits viewable in [compare
view](VerifyTests/Verify@31.20.0...31.25.0).
</details>

[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=Verify&package-manager=nuget&previous-version=31.20.0&new-version=31.25.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[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

Development

Successfully merging this pull request may close these issues.

2 participants