Report an empty metadata file as unparseable, not missing - #24
Merged
Merged
Conversation
GeneratorBase dropped additional files with no text before looking them up
by name, so an empty things.json that was wired up correctly was reported
as MetadataFileMissing ("not supplied as an AdditionalFile"), pointing the
user at their .csproj instead of the file. Empty files now reach
Deserialize and report MetadataParseFailed, the same as whitespace-only
ones. Among duplicates of one name, a file with content is still preferred.
Fixes #23
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014jCUYfoRMwhybsUaSa1NFm
|
This was referenced Sep 27, 2026
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.



Fixes #23
What was wrong
GeneratorBase.Initializefiltered out additional files with no text (.Where(file => file.Text.Length > 0)) before looking them up by name. An emptythings.jsonthat was correctly wired up was therefore reported as MetadataFileMissing, with the message "not supplied as an AdditionalFile". That message points the user at their.csproj, when the real problem is the file's contents. A whitespace-only file got past the filter and correctly reported MetadataParseFailed, so the two cases behaved inconsistently.Change
GetTextreturned null, now reachesDeserializeand reportsMetadataParseFailed.MetadataFileMissing.AMissingMetadataFileIsReportedRatherThanSilentlyProducingNothingandAMultiFileGeneratorReportsEachFileThatIsAbsentstill pass.Behaviour change to review:
AnEmptyMetadataFileCountsAsMissingcame in with the initial extraction and pinned the old behaviour. It is replaced byAnEmptyMetadataFileIsReportedAsUnparseableNotMissing, which is the issue's acceptance test. It runs against both an empty and a whitespace-only file.Tests
With
GeneratorBase.csreverted, the empty-file case fails. With the fix, the full suite passes: 49/49.🤖 Generated with Claude Code
https://claude.ai/code/session_014jCUYfoRMwhybsUaSa1NFm
Generated by Claude Code