Skip to content

Updating useRestrictiveXamlReader flag documentation and expectations - #13018

Merged
dipeshmsft merged 2 commits into
mainfrom
user/dipesh/restrictivexamlreader-doc
Aug 27, 2026
Merged

Updating useRestrictiveXamlReader flag documentation and expectations#13018
dipeshmsft merged 2 commits into
mainfrom
user/dipesh/restrictivexamlreader-doc

Conversation

@dipeshmsft

@dipeshmsft dipeshmsft commented Aug 21, 2026

Copy link
Copy Markdown
Member

Summary

In this PR, I have updated the XamlReader document, especifically useRestrictiveXamlReader flags usage, capabilities and constraints. This is in alignment with the change here: dotnet/docs-desktop#2278

  • Updated XamlReader's Load, LoadAsync and Parse method overload using useRestrictiveXamlReader flag.
  • Added security remarks regarding the capabilities of the restrictive XAML reader mode in WPF.

Internal previews

File Preview link
xml/System.Windows.Markup/XamlReader.xml Learn preview

Build report

@dipeshmsft
dipeshmsft requested a review from a team as a code owner August 21, 2026 12:15
Copilot AI lite review requested due to automatic review settings August 21, 2026 12:15

Copilot AI 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

Updates WPF XamlReader documentation for restrictive-reader behavior, usage, and security expectations.

Changes:

  • Documents useRestrictiveXamlReader across Load, LoadAsync, and Parse.
  • Adds restrictive-mode security guidance.
  • Expands parameter, return-value, and exception documentation.
Suppressed comments (2)

xml/System.Windows.Markup/XamlReader.xml:689

  • This overload returns object, not a Task, and WPF completes the event-based load through LoadCompleted; the copied paragraph therefore describes behavior this API doesn't have. It also omits that the returned root can be populated later and that parsing is asynchronous only when the root contains x:SynchronousMode="Async" (otherwise the load is synchronous). Replace the task paragraph with the event-based async behavior documented by the sibling overload.
This method stores in the task it returns all non-usage exceptions that the method's synchronous counterpart can throw. If an exception is stored into the returned task, that exception will be thrown when the task is awaited. Usage exceptions, such as <see cref="T:System.ArgumentException" />, are still thrown synchronously. For the stored exceptions, see the exceptions thrown by <see cref="M:System.Windows.Markup.XamlReader.Load(System.Xml.XmlReader,System.Boolean)" />.</remarks>

xml/System.Windows.Markup/XamlReader.xml:729

  • This overload returns object, not a Task, and WPF completes the event-based load through LoadCompleted; the copied paragraph therefore describes behavior this API doesn't have. It also omits that the returned root can be populated later and that parsing is asynchronous only when the root contains x:SynchronousMode="Async" (otherwise the load is synchronous). Replace the task paragraph with the event-based async behavior documented by the sibling overload.
This method stores in the task it returns all non-usage exceptions that the method's synchronous counterpart can throw. If an exception is stored into the returned task, that exception will be thrown when the task is awaited. Usage exceptions, such as <see cref="T:System.ArgumentException" />, are still thrown synchronously. For the stored exceptions, see the exceptions thrown by <see cref="M:System.Windows.Markup.XamlReader.Load(System.IO.Stream,System.Windows.Markup.ParserContext,System.Boolean)" />.</remarks>

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread xml/System.Windows.Markup/XamlReader.xml Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@dipeshmsft
dipeshmsft merged commit 33710c5 into main Aug 27, 2026
7 checks passed
@dipeshmsft
dipeshmsft deleted the user/dipesh/restrictivexamlreader-doc branch August 27, 2026 09:28
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.

4 participants