Skip to content

Switch Components E2E manifest generation to DataContractJsonSerializer#66891

Open
Copilot wants to merge 1 commit into
mainfrom
copilot/replace-system-text-json
Open

Switch Components E2E manifest generation to DataContractJsonSerializer#66891
Copilot wants to merge 1 commit into
mainfrom
copilot/replace-system-text-json

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 28, 2026

Switch Components E2E manifest generation to DataContractJsonSerializer

  • You've read the Contributor Guide and Code of Conduct.
  • You've included unit or integration tests for your change, where applicable.
  • You've included inline docs for your change, where applicable.
  • There's an open issue for the PR that you are making. If you'd like to propose a new feature or change, please open an issue to discuss the change or find an existing issue.

Align Components.Testing.Tasks manifest serialization with MVC.Testing.Tasks by replacing System.Text.Json usage with DataContractJsonSerializer while preserving manifest shape and dictionary formatting.

Description

  • Serialization pipeline

    • GenerateE2EManifest now writes manifest JSON via DataContractJsonSerializer + JsonReaderWriterFactory (UTF-8, indented, simple dictionary format).
    • Removed source-generated System.Text.Json context usage from task-side manifest generation.
  • Manifest model contract

    • Added [DataContract] / [DataMember(Name = ...)] to task manifest models so emitted JSON property names remain stable (apps, executable, arguments, workingDirectory, publicUrl, environmentVariables).
  • Task project dependencies

    • Removed the System.Text.Json reference from Microsoft.AspNetCore.Components.Testing.Tasks.csproj.
    • Deleted obsolete tasks/E2EManifestJsonContext.cs.
var serializer = new DataContractJsonSerializer(typeof(E2EManifestModel), new DataContractJsonSerializerSettings
{
    UseSimpleDictionaryFormat = true,
});
using var writer = JsonReaderWriterFactory.CreateJsonWriter(fileStream, Encoding.UTF8, ownsStream: false, indent: true);
serializer.WriteObject(writer, manifest);

…JsonSerializer

Co-authored-by: javiercn <6995051+javiercn@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the Components E2E manifest generation MSBuild task to use DataContractJsonSerializer (matching the approach used in Mvc.Testing.Tasks) instead of System.Text.Json, while preserving the manifest’s JSON shape and dictionary/object formatting expected by existing consumers.

Changes:

  • Switched GenerateE2EManifest to write JSON via DataContractJsonSerializer + JsonReaderWriterFactory (UTF-8, indented, simple dictionary format).
  • Annotated the task-side manifest model types with [DataContract] / [DataMember(Name = ...)] to keep property names stable.
  • Removed the task project’s System.Text.Json reference and deleted the now-obsolete source-generation context file.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
src/Components/Testing/tasks/Microsoft.AspNetCore.Components.Testing.Tasks.csproj Drops the explicit System.Text.Json reference now that task-side serialization no longer depends on it.
src/Components/Testing/tasks/GenerateE2EManifest.cs Replaces System.Text.Json serialization with DataContractJsonSerializer output written directly to the manifest file stream.
src/Components/Testing/tasks/E2EManifestModel.cs Adds DataContract/DataMember attributes to preserve JSON property names under DataContractJsonSerializer.
src/Components/Testing/tasks/E2EManifestJsonContext.cs Removes the task-side System.Text.Json source-generation context (no longer used).

@github-actions github-actions Bot added the area-blazor Includes: Blazor, Razor Components label May 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-blazor Includes: Blazor, Razor Components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Blazor] GenerateE2EManifest task crashes with MissingMethodException on JsonObjectInfoValues<T>.set_PolymorphismOptions in Preview 5

4 participants