Skip to content

C#: Attempt to parse as XML instead of reading everything as text in the FileContent processing. - #22915

Draft
michaelnebel wants to merge 3 commits into
github:mainfrom
michaelnebel:csharp/filecontentparseasxml
Draft

michaelnebel wants to merge 3 commits into
github:mainfrom
michaelnebel:csharp/filecontentparseasxml

Conversation

@michaelnebel

@michaelnebel michaelnebel commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Instead of searching through all files (including source code files) we attempt to read the files as XML instead for detecting framework and package dependencies (and other project related settings). This will

  • Implicitly enable "fail-fast" (as an exception will be thrown if a file is not XML).
  • Make it easier to extend the logic for detecting certain properties.

Note, that this change impacts the semantics of the heuristic.

  • Only files parseable as XML are taken into consideration.
  • The matching is made case-sensitive.

We expect this to be an implicit improvement as well

  • Accuracy improvement: XML snippets in text files (or source code files) are no longer taken into consideration.
  • Performance improvement: We do less parsing of text as the XmlReader gives up and throws an exception, when a file is not parseable as XML (before we read all text from all files and did regular expression matching).

DCA looks good

  • Drastic reduction in the number of calls with missing call target for dotnet/efcore.
  • Performance appears unaffected.

@github-actions github-actions Bot added the C# label Oct 28, 2026
@michaelnebel
michaelnebel force-pushed the csharp/filecontentparseasxml branch from 9b8ebe2 to 291ac2e Compare October 28, 2026 13:56
@michaelnebel michaelnebel changed the title C#: Use an XML parser instead of reading everything as text in the FileContent processing. C#: Attempt to parse as XML instead of reading everything as text in the FileContent processing. Oct 28, 2026
@michaelnebel
michaelnebel force-pushed the csharp/filecontentparseasxml branch from 291ac2e to 781f085 Compare October 30, 2026 09:37

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant