Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Feb 2, 2026

Description:

Addresses review feedback from PR #887 regarding null safety and XML encoding in XML documentation generation.

Null Reference Fix:

  • Added null-conditional operator for document.Tags access to prevent NullReferenceException when OpenAPI document has no tags

XML Escaping Enhancement:

  • Extended EscapeSymbols method to escape & character (in addition to existing < and >)
  • Ensures proper encoding order: ampersand first, then angle brackets, to avoid double-escaping
  • Prevents malformed XML when documentation contains special characters

Test Coverage:

  • Can_Handle_Null_Document_Tags - validates safe handling of null tags collection
  • Can_Escape_Xml_Special_Characters_In_Interface_Doc - verifies XML entity encoding in interface summaries
  • Can_Escape_Xml_Special_Characters_In_Method_Summary - verifies XML entity encoding in method documentation

Example OpenAPI Specifications:

openapi: 3.0.0
info:
  title: Test API
paths:
  /users:
    get:
      summary: Get users <admin> & filter
      tags:
        - Users
      responses:
        '200':
          description: Success

Example generated Refit interface

Before:

/// <summary>Get users <admin> & filter</summary>  // Invalid XML
[Get("/users")]
Task GetUsers();

After:

/// <summary>Get users &lt;admin&gt; &amp; filter</summary>  // Valid XML
[Get("/users")]
Task GetUsers();

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • collector.exceptionless.io
    • Triggering command: /home/REDACTED/work/refitter/refitter/src/Refitter.Tests/bin/Release/net8.0/Refitter.Tests /home/REDACTED/work/refitter/refitter/src/Refitter.Tests/bin/Release/net8.0/Refitter.Tests --server dotnettestcli --dotnet-test-pipe /tmp/d7f4e169f85e40a6a990ba2a40dd3467 (dns block)
    • Triggering command: /home/REDACTED/work/refitter/refitter/src/Refitter.Tests/bin/Release/net8.0/Refitter.Tests /home/REDACTED/work/refitter/refitter/src/Refitter.Tests/bin/Release/net8.0/Refitter.Tests --server dotnettestcli --dotnet-test-pipe /tmp/cc8db2bd32014527829c9449c50731fa 607570477388aac361639dd7b0/Project.csproj (dns block)
  • config.exceptionless.io
    • Triggering command: /home/REDACTED/work/refitter/refitter/src/Refitter.Tests/bin/Release/net8.0/Refitter.Tests /home/REDACTED/work/refitter/refitter/src/Refitter.Tests/bin/Release/net8.0/Refitter.Tests --server dotnettestcli --dotnet-test-pipe /tmp/d7f4e169f85e40a6a990ba2a40dd3467 (dns block)
    • Triggering command: /home/REDACTED/work/refitter/refitter/src/Refitter.Tests/bin/Release/net8.0/Refitter.Tests /home/REDACTED/work/refitter/refitter/src/Refitter.Tests/bin/Release/net8.0/Refitter.Tests --server dotnettestcli --dotnet-test-pipe /tmp/cc8db2bd32014527829c9449c50731fa 607570477388aac361639dd7b0/Project.csproj (dns block)
  • developers.intellihr.io
    • Triggering command: /home/REDACTED/work/refitter/refitter/src/Refitter.Tests/bin/Release/net8.0/Refitter.Tests /home/REDACTED/work/refitter/refitter/src/Refitter.Tests/bin/Release/net8.0/Refitter.Tests --server dotnettestcli --dotnet-test-pipe /tmp/d7f4e169f85e40a6a990ba2a40dd3467 (dns block)
    • Triggering command: /home/REDACTED/work/refitter/refitter/src/Refitter.Tests/bin/Release/net8.0/Refitter.Tests /home/REDACTED/work/refitter/refitter/src/Refitter.Tests/bin/Release/net8.0/Refitter.Tests --server dotnettestcli --dotnet-test-pipe /tmp/cc8db2bd32014527829c9449c50731fa 607570477388aac361639dd7b0/Project.csproj (dns block)
  • heartbeat.exceptionless.io
    • Triggering command: /home/REDACTED/work/refitter/refitter/src/Refitter.Tests/bin/Release/net8.0/Refitter.Tests /home/REDACTED/work/refitter/refitter/src/Refitter.Tests/bin/Release/net8.0/Refitter.Tests --server dotnettestcli --dotnet-test-pipe /tmp/d7f4e169f85e40a6a990ba2a40dd3467 (dns block)
    • Triggering command: /home/REDACTED/work/refitter/refitter/src/Refitter.Tests/bin/Release/net8.0/Refitter.Tests /home/REDACTED/work/refitter/refitter/src/Refitter.Tests/bin/Release/net8.0/Refitter.Tests --server dotnettestcli --dotnet-test-pipe /tmp/cc8db2bd32014527829c9449c50731fa 607570477388aac361639dd7b0/Project.csproj (dns block)
  • petstore.swagger.io
    • Triggering command: /home/REDACTED/work/refitter/refitter/src/Refitter.Tests/bin/Release/net8.0/Refitter.Tests /home/REDACTED/work/refitter/refitter/src/Refitter.Tests/bin/Release/net8.0/Refitter.Tests --server dotnettestcli --dotnet-test-pipe /tmp/d7f4e169f85e40a6a990ba2a40dd3467 (dns block)
    • Triggering command: /home/REDACTED/work/refitter/refitter/src/Refitter.Tests/bin/Release/net8.0/Refitter.Tests /home/REDACTED/work/refitter/refitter/src/Refitter.Tests/bin/Release/net8.0/Refitter.Tests --server dotnettestcli --dotnet-test-pipe /tmp/cc8db2bd32014527829c9449c50731fa 607570477388aac361639dd7b0/Project.csproj (dns block)
  • petstore3.swagger.io
    • Triggering command: /home/REDACTED/work/refitter/refitter/src/Refitter.Tests/bin/Release/net8.0/Refitter.Tests /home/REDACTED/work/refitter/refitter/src/Refitter.Tests/bin/Release/net8.0/Refitter.Tests --server dotnettestcli --dotnet-test-pipe /tmp/d7f4e169f85e40a6a990ba2a40dd3467 (dns block)
    • Triggering command: /home/REDACTED/work/refitter/refitter/src/Refitter.Tests/bin/Release/net8.0/Refitter.Tests /home/REDACTED/work/refitter/refitter/src/Refitter.Tests/bin/Release/net8.0/Refitter.Tests --server dotnettestcli --dotnet-test-pipe /tmp/cc8db2bd32014527829c9449c50731fa 607570477388aac361639dd7b0/Project.csproj (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

Apply changes based on the comments in this thread


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@sonarqubecloud
Copy link

sonarqubecloud bot commented Feb 2, 2026

Copilot AI changed the title [WIP] Apply changes based on review comments Fix null reference and XML escaping in XmlDocumentationGenerator Feb 2, 2026
Copilot AI requested a review from christianhelle February 2, 2026 09:49
@codecov
Copy link

codecov bot commented Feb 2, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.33%. Comparing base (f049330) to head (9a8b9de).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #890   +/-   ##
=======================================
  Coverage   93.33%   93.33%           
=======================================
  Files          23       23           
  Lines        1395     1396    +1     
=======================================
+ Hits         1302     1303    +1     
  Misses         47       47           
  Partials       46       46           
Flag Coverage Δ
unittests 93.33% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

2 participants