Skip to content

Rename XML model serialization helper method from Write to WriteXml#9750

Merged
jorgerangel-msft merged 3 commits intomainfrom
copilot/rename-write-method-xml-model
Feb 20, 2026
Merged

Rename XML model serialization helper method from Write to WriteXml#9750
jorgerangel-msft merged 3 commits intomainfrom
copilot/rename-write-method-xml-model

Conversation

Copy link
Contributor

Copilot AI commented Feb 19, 2026

The private Write(XmlWriter, ModelReaderWriterOptions, string) helper method in XML model serialization collides with model properties named Write (e.g., Azure Storage's BlobAnalyticsLogging.Write), causing compile errors in generated code.

Changes

  • Core rename: XmlWriteMethodName constant changed from "Write" to "WriteXml" in MrwSerializationTypeDefinition.Xml.cs
  • Test filters updated: MockMrwProvider and FilteredMethodsTypeProvider lambdas in XmlSerializationTests.cs updated to match both "WriteXml" (private helper) and "Write" (the IPersistableModel<T>.Write explicit interface method)
  • Test data files: All expected output files updated with the new private helper method name WriteXml; the IPersistableModel<T>.Write explicit interface method is preserved unchanged
  • Generated files: Sample-TypeSpec generated serialization files updated to reflect the rename

Before / After

// Before — collides with model properties named "Write"
private void Write(XmlWriter writer, ModelReaderWriterOptions options, string nameHint) { ... }

// After
private void WriteXml(XmlWriter writer, ModelReaderWriterOptions options, string nameHint) { ... }
Original prompt

This section details on the original issue you should resolve

<issue_title>Rename Write Method in XML Model Serialization</issue_title>
<issue_description>The Write method name is too generic and it already is leading to a collision in Storage with one of the model's properties.</issue_description>

Comments on the Issue (you are @copilot in this section)


🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

…perties

Co-authored-by: jorgerangel-msft <102122018+jorgerangel-msft@users.noreply.github.com>
@microsoft-github-policy-service microsoft-github-policy-service bot added the emitter:client:csharp Issue for the C# client emitter: @typespec/http-client-csharp label Feb 19, 2026
Copilot AI changed the title [WIP] Rename Write method in XML model serialization Rename XML model serialization helper method from Write to WriteXml Feb 19, 2026
…ivate XML helper to WriteXml

Co-authored-by: jorgerangel-msft <102122018+jorgerangel-msft@users.noreply.github.com>
@jorgerangel-msft jorgerangel-msft added this pull request to the merge queue Feb 19, 2026
Merged via the queue into main with commit dd866a7 Feb 20, 2026
23 checks passed
@jorgerangel-msft jorgerangel-msft deleted the copilot/rename-write-method-xml-model branch February 20, 2026 00:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

emitter:client:csharp Issue for the C# client emitter: @typespec/http-client-csharp

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Rename Write Method in XML Model Serialization

3 participants

Comments