Skip to content

Refactor LanguageTag and LanguageTagBuilder for improved documentation and validation - #77

Merged
ptr727 merged 6 commits into
developfrom
logfix
Feb 1, 2026
Merged

Refactor LanguageTag and LanguageTagBuilder for improved documentation and validation#77
ptr727 merged 6 commits into
developfrom
logfix

Conversation

@ptr727

Copy link
Copy Markdown
Owner
  • Updated XML documentation in LanguageTag.cs to clarify return values and parsing behavior.
  • Enhanced LanguageTagBuilder methods to specify that they set subtags without validation.
  • Improved normalization and validation methods in LanguageTagParser to ensure null checks are handled properly.
  • Added remarks in LogOptions to clarify the effects of setting logger factory and logger after creation.
  • Streamlined async file handling in Rfc5646Data to use 'using' statements for better resource management.
  • Updated tests to inherit from SingleInstanceFixture for consistent test execution and resource management.
  • Refined exception handling in Program.cs to ensure proper logging and cleanup on errors.
  • General code cleanup and consistency improvements across various files.

ptr727and others added 2 commits January 30, 2026 05:40
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: ptr727 <2061579+ptr727@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…n and validation
- Updated XML documentation in LanguageTag.cs to clarify return values and parsing behavior.
- Enhanced LanguageTagBuilder methods to specify that they set subtags without validation.
- Improved normalization and validation methods in LanguageTagParser to ensure null checks are handled properly.
- Added remarks in LogOptions to clarify the effects of setting logger factory and logger after creation.
- Streamlined async file handling in Rfc5646Data to use 'using' statements for better resource management.
- Updated tests to inherit from SingleInstanceFixture for consistent test execution and resource management.
- Refined exception handling in Program.cs to ensure proper logging and cleanup on errors.
- General code cleanup and consistency improvements across various files.
CopilotAI review requested due to automatic review settings January 31, 2026 18:22

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR refactors the LanguageTags library to improve documentation, validation, and code quality. It includes updates to XML documentation for better clarity, enhanced error handling, async resource management improvements, migration from xUnit v2 to v3, and general code cleanup across the codebase.

Changes:

  • Enhanced XML documentation across all public APIs with more detailed parameter descriptions, return value documentation, and usage remarks
  • Improved validation and normalization methods in LanguageTagParser to ensure proper null checking with ArgumentNullException
  • Updated test infrastructure to use xUnit v3 with assembly-level fixtures and removed unnecessary null-forgiving operators
  • Streamlined async file handling using using statements instead of ConfiguredAsyncDisposable
  • Enhanced exception handling and logging in the LanguageTagsCreate CLI tool

Reviewed changes

Copilot reviewed 31 out of 31 changed files in this pull request and generated 2 comments.

Show a summary per file
FileDescription
LanguageTags/LanguageTag.csUpdated XML documentation to clarify parsing behavior and return values
LanguageTags/LanguageTagBuilder.csEnhanced method documentation to specify that builder methods set values without validation
LanguageTags/LanguageTagParser.csChanged Normalize(LanguageTag) to return non-nullable and added ArgumentNullException checks
LanguageTags/LogOptions.csAdded remarks explaining caching behavior of logger factory and logger properties
LanguageTags/Rfc5646Data.csReplaced ConfiguredAsyncDisposable with using statements and added XML documentation
LanguageTags/Iso6392Data.csReplaced ConfiguredAsyncDisposable with using statements and improved documentation
LanguageTags/Iso6393Data.csReplaced ConfiguredAsyncDisposable with using statements and improved documentation
LanguageTags/LanguageLookup.csAdded parameter documentation to helper methods
LanguageTags/Extensions.csSimplified logging extension method calls
LanguageTags/*DataGen.csAdded GeneratedCode attributes and XML documentation to generated code
LanguageTags/LanguageTags.csprojMoved GenerateDocumentationFile property and updated Microsoft.SourceLink.GitHub version
LanguageTags/.editorconfigAdded suppression for missing XML documentation warnings
LanguageTagsTests/Fixture.csRefactored to use xUnit v3 AssemblyFixture pattern with SingleInstanceFixture base class
LanguageTagsTests/*.csUpdated test classes to inherit from SingleInstanceFixture and removed null-forgiving operators
LanguageTagsTests/LanguageTagsTests.csprojMigrated from xunit v2.9.3 to xunit.v3 v3.2.2 and updated xunit.analyzers
LanguageTagsTests/.editorconfigAdded suppressions for test-specific analyzer warnings
LanguageTagsCreate/Program.csAdded try-catch-finally for better exception handling and resource cleanup
LanguageTagsCreate/LoggerFactory.csImproved logger initialization to reuse configured Log.Logger when available
LanguageTagsCreate/CreateTagData.csReplaced ConfiguredAsyncDisposable with using statements
LanguageTagsCreate/HttpClientFactory.csSimplified null checks using property pattern matching
LanguageTagsCreate/Extensions.csSimplified logging extension method calls
LanguageTagsCreate/CommandLine.csMinor formatting improvement for frozen set initialization
CODESTYLE.mdEnhanced documentation guidelines with more detailed examples
.editorconfigUpdated modifier order and added ReSharper settings
LanguageTags.code-workspaceAdded new words to spell checker dictionary

Comment threadLanguageTags/LanguageTagBuilder.cs Outdated
Comment threadLanguageTags/LanguageTagBuilder.cs Outdated
…handling and logging
- Removed unused logger options from LoadDataAsync methods in Iso6392Data, Iso6393Data, and Rfc5646Data classes.
- Enhanced error handling by throwing InvalidDataException when no data is found during loading.
- Updated Find methods in Iso6392Data, Iso6393Data, and Rfc5646Data to throw ArgumentNullException for null inputs.
- Modified LanguageTag and LanguageTagBuilder classes to streamline normalization methods.
- Improved logging options handling in LogOptions class, ensuring proper fallback mechanisms.
- Updated tests for Iso6392Tests, Iso6393Tests, Rfc5646Tests to validate new error handling and logging behavior.
- Removed redundant normalization tests from LanguageTagBuilderTests.
- Removed Options class as it was no longer needed for logging configuration.
- Updated Rfc5646Data, Iso6392Data, and Iso6393Data classes to use async methods for loading and saving data.
- Changed method names from LoadDataAsync and LoadJsonAsync to FromDataAsync and FromJsonAsync for consistency.
- Implemented logging directly within data classes using ILogger.
- Updated tests to reflect changes in method names and removed references to the Options class.
- Revised README to document breaking changes and new usage patterns.
CopilotAI review requested due to automatic review settings February 1, 2026 16:59

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 36 out of 37 changed files in this pull request and generated 5 comments.

Comment threadHISTORY.md Outdated
Comment threadHISTORY.md Outdated
Comment threadHISTORY.md Outdated
Comment threadREADME.md Outdated
Comment threadLanguageTagsTests/Fixture.cs Outdated
@ptr727
ptr727 merged commit ad8a5c4 into developFeb 1, 2026
8 checks passed
@ptr727
ptr727 deleted the logfix branch February 1, 2026 17:20
Sign up for freeto 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.

2 participants

@ptr727