Skip to content

[Fix] AttributeValueXHTML public constructors no longer leave ExternalObjects or the logger null; fixes #98 - #101

Merged
samatstariongroup merged 1 commit into
developmentfrom
GH98
Oct 19, 2026
Merged

samatstariongroup merged 1 commit into
developmentfrom
GH98

Conversation

@samatstariongroup

Copy link
Copy Markdown
Member

Prerequisites

  • I have written a descriptive pull-request title
  • I have verified that there are no overlapping pull-requests open
  • I have verified that I am following the ReqIFSharp code style guidelines
  • I have provided test coverage for my change (where applicable)

Description

Fixes #98.

The public constructors of AttributeValueXHTML each left a field null:

  • AttributeValueXHTML(ILoggerFactory) did not create ExternalObjects. QueryExternalObjects (ReqIFSharp.Extensions) then threw an ArgumentNullException and QueryBase64PayloadsAsync a NullReferenceException for a spec element holding such a value, and ReqIFContentExtensions.QueryExternalObjects failed for the whole content.
  • AttributeValueXHTML() did not set the logger, so reading into such a value threw an ArgumentNullException.

Changes (AttributeValueXHTML.cs)

  • ExternalObjects is initialised where it is declared, so every constructor gets an empty list; the assignments in the two internal constructors are removed.
  • The parameterless constructor sets NullLogger<AttributeValueXHTML>.Instance, as the other attribute value classes do.
  • The doc comment of the ILoggerFactory constructor named AttributeValueString; it now names AttributeValueXHTML.

Tests

  • AttributeValueXHTMLTestFixture: every public constructor creates an empty ExternalObjects; a value made with new AttributeValueXHTML() can be read (sync and async) and its ReadXmlAsync can be cancelled.
  • SpecElementWithAttributesExtensionTestFixture: QueryExternalObjects and QueryBase64PayloadsAsync return empty results for values made with each public constructor.
  • All four tests fail on the old code.
  • dotnet build -c Release: 0 warnings; dotnet test: 564 passed.

🤖 Generated with Claude Code

…lObjects or the logger null; fixes #98

- Initialise ExternalObjects where it is declared, so every constructor
  gets an empty list; QueryExternalObjects and QueryBase64PayloadsAsync of
  ReqIFSharp.Extensions threw for values made with the ILoggerFactory
  constructor.
- Set a NullLogger in the parameterless constructor; reading into such a
  value threw an ArgumentNullException.
- Correct the doc comment of the ILoggerFactory constructor.
- Add tests for the constructors, reading and cancelling with the
  parameterless constructor, and the Extensions queries.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sonarqubecloud

Copy link
Copy Markdown

@samatstariongroup
samatstariongroup merged commit e9586bd into development Oct 19, 2026
8 checks passed
@samatstariongroup
samatstariongroup deleted the GH98 branch October 19, 2026 12:09
Sign up for free to 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.

[Bug]: The public constructors of AttributeValueXHTML leave ExternalObjects or the logger null

1 participant