Fix null reference and XML escaping in XmlDocumentationGenerator #890
+43
−6
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.



Description:
Addresses review feedback from PR #887 regarding null safety and XML encoding in XML documentation generation.
Null Reference Fix:
document.Tagsaccess to preventNullReferenceExceptionwhen OpenAPI document has no tagsXML Escaping Enhancement:
EscapeSymbolsmethod to escape&character (in addition to existing<and>)Test Coverage:
Can_Handle_Null_Document_Tags- validates safe handling of null tags collectionCan_Escape_Xml_Special_Characters_In_Interface_Doc- verifies XML entity encoding in interface summariesCan_Escape_Xml_Special_Characters_In_Method_Summary- verifies XML entity encoding in method documentationExample OpenAPI Specifications:
Example generated Refit interface
Before:
After:
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/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)/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/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)/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/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)/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/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)/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/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)/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/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)/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
💡 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.