Skip to content

fix(generator): handle missing AssemblyInformationalVersion gracefully#111

Merged
j-d-ha merged 2 commits into
mainfrom
fix/version-not-showing-in-generated-code-attribute
Apr 19, 2026
Merged

fix(generator): handle missing AssemblyInformationalVersion gracefully#111
j-d-ha merged 2 commits into
mainfrom
fix/version-not-showing-in-generated-code-attribute

Conversation

@j-d-ha
Copy link
Copy Markdown
Collaborator

@j-d-ha j-d-ha commented Apr 19, 2026

Summary

  • Prevents GeneratedCode attributes from using an empty or missing version string when assembly metadata is incomplete.
  • Uses informational version metadata first, then assembly version, and finally unknown as a safe fallback.

Changes

  • Updated generator version resolution in MapperEmitter to read AssemblyInformationalVersionAttribute before AssemblyName.Version.
  • Added null-safe fallback chain so code generation remains stable even when version metadata is absent.

Validation

  • Ran dotnet test --project test/LayeredCraft.DynamoMapper.Generators.Tests/LayeredCraft.DynamoMapper.Generators.Tests.csproj.
  • Current failures are snapshot mismatches in verify tests due generated GeneratedCode version text changing from scrubbed REPLACED to a concrete informational version value.

- Fallback to `AssemblyName.Version` when `AssemblyInformationalVersionAttribute` is unavailable.
- Default to "unknown" if both values are missing.
@github-actions github-actions Bot added the type: fix Bug fix label Apr 19, 2026
- Enhanced regex to match version strings with a "+" suffix, e.g., `1.2.3+buildinfo`.
- Adjusted formatting for better readability and maintenance.
@j-d-ha j-d-ha merged commit 52de3fd into main Apr 19, 2026
4 checks passed
@j-d-ha j-d-ha deleted the fix/version-not-showing-in-generated-code-attribute branch April 19, 2026 23:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: fix Bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant