Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 22, 2026

Motivation and Context

Providers like Gemini reject the generic "image/*" MIME type and require specific types (e.g., image/png, image/jpeg). When data URIs containing explicit MIME types are passed, the hardcoded "image/*" parameter overrides the actual type, causing "Bad Request" errors. Additionally, regular image URIs were not inferring MIME types from file extensions.

Description

Changes for data URIs:
Removed the "image/*" parameter from DataContent constructor calls when processing data URIs. The constructor already extracts MIME types from data URI format (data:image/png;base64,...).

Changes for regular URIs:
Added ImageUriToMediaType helper method to all three converter files to infer MIME types from file extensions (e.g., .pngimage/png, .jpgimage/jpeg, .gifimage/gif, etc.). Updated UriContent constructions to use this helper instead of hardcoded "image/*".

Files modified:

  • ItemContentConverter.cs - Responses API converter (added helper method and updated both DataContent and UriContent constructions)
  • MessageContentPartConverter.cs - Chat completions converter (updated DataContent construction)
  • ChatMessageExtensions.cs - Declarative workflows helper (added helper method and updated both DataContent and UriContent constructions)

Before:

? new DataContent(inputImage.ImageUrl, "image/*")
: new UriContent(inputImage.ImageUrl, "image/*")

After:

? new DataContent(inputImage.ImageUrl)
: new UriContent(inputImage.ImageUrl, ImageUriToMediaType(inputImage.ImageUrl))

The DataContent constructor parses the MIME type from the data URI when no override is provided, and ImageUriToMediaType infers the type from file extensions for regular URIs, falling back to "image/*" for unknown extensions. This ensures consistent MIME type handling across all three converters.

Test coverage added:

  • ItemContentConverterTests.cs (18 tests): Data URI MIME type preservation, HTTP URI extension inference, case-insensitive handling, edge cases
  • MessageContentPartConverterTests.cs (24 tests): Image data/HTTP URIs, audio format conversions, file content handling, edge cases
  • ChatMessageExtensionsTests.cs (4 new tests): Data URI vs HTTP URI MIME type behavior with extension inference, round-trip conversion testing

All const local variables in tests follow PascalCase naming convention per IDE1006 requirements.

Contribution Checklist

  • The code builds clean without any errors or warnings
  • The PR follows the Contribution Guidelines
  • All unit tests pass, and I have added new tests where possible
  • Is this a breaking change? If yes, add "[BREAKING]" prefix to the title of the PR.

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix MIME type handling for image uploads Fix MIME type override in DataContent constructors for data URIs Jan 22, 2026
Copilot AI requested a review from stephentoub January 22, 2026 21:07
Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com>
Copilot AI changed the title Fix MIME type override in DataContent constructors for data URIs Fix MIME type handling for image URIs in DataContent and UriContent constructors Jan 22, 2026
@stephentoub
Copy link
Member

@copilot, can you add tests for this?

@markwallace-microsoft markwallace-microsoft added .NET workflows Related to Workflows in agent-framework labels Jan 22, 2026
@github-actions github-actions bot changed the title Fix MIME type handling for image URIs in DataContent and UriContent constructors .NET: Fix MIME type handling for image URIs in DataContent and UriContent constructors Jan 22, 2026
@callendorph
Copy link

@copilot You are working so hard - good bot.

Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Jan 22, 2026

@copilot, can you add tests for this?

Added comprehensive tests! Created test files covering:

  • ItemContentConverterTests.cs (18 tests): Data URI MIME type preservation, HTTP URI extension inference, edge cases
  • MessageContentPartConverterTests.cs (24 tests): Image/audio/file content, MIME type handling
  • ChatMessageExtensionsTests.cs (4 new tests): Data URI vs HTTP URI MIME type behavior

All tests pass successfully. (commit c1c2930)

Copilot AI changed the title .NET: Fix MIME type handling for image URIs in DataContent and UriContent constructors Fix MIME type handling for image URIs in DataContent and UriContent constructors Jan 22, 2026
Copilot AI requested a review from stephentoub January 22, 2026 21:46
…t MIME type inference

Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com>
@stephentoub stephentoub marked this pull request as ready for review January 22, 2026 22:19
Copilot AI review requested due to automatic review settings January 22, 2026 22:19
Copy link
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 fixes MIME type handling for image URIs to support providers like Gemini that require specific MIME types (e.g., image/png, image/jpeg) rather than the generic "image/*".

Changes:

  • Removed hardcoded "image/*" override for data URIs, allowing DataContent constructor to parse MIME types from data URI format
  • Added ImageUriToMediaType helper method to infer MIME types from file extensions for regular HTTP/HTTPS URIs
  • Added comprehensive test coverage (46 new tests) for data URI MIME type preservation, HTTP URI extension inference, and edge cases

Reviewed changes

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

Show a summary per file
File Description
ItemContentConverter.cs Added ImageUriToMediaType helper and updated image handling to preserve data URI MIME types and infer from extensions
MessageContentPartConverter.cs Removed "image/*" override for data URIs, added ImageUriToMediaType helper for extension-based inference
ChatMessageExtensions.cs Added ImageUriToMediaType helper and updated GetImageContent to properly handle data URIs and infer MIME types
ItemContentConverterTests.cs Added 18 tests covering data URI MIME type preservation, HTTP URI extension inference, and edge cases
MessageContentPartConverterTests.cs Added 24 tests covering image data/HTTP URIs, audio formats, file content, and edge cases
ChatMessageExtensionsTests.cs Added 4 tests for data URI vs HTTP URI MIME type behavior with round-trip conversion testing

@stephentoub
Copy link
Member

@copilot there are formatting diagnostics:

Running 30 analyzers on Microsoft.Agents.AI.Hosting.OpenAI.UnitTests(net10.0).
Running 30 analyzers on Microsoft.Agents.AI.Hosting.OpenAI.UnitTests(net9.0).
Running 30 analyzers on Microsoft.Agents.AI.Hosting.OpenAI.UnitTests(net8.0).
/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/MessageContentPartConverterTests.cs(92,22): error IDE1006: Naming rule violation: These words must begin with upper case characters: dataUri [/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests.csproj]
/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/MessageContentPartConverterTests.cs(112,22): error IDE1006: Naming rule violation: These words must begin with upper case characters: uri [/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests.csproj]
/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/MessageContentPartConverterTests.cs(132,22): error IDE1006: Naming rule violation: These words must begin with upper case characters: text [/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests.csproj]
/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/MessageContentPartConverterTests.cs(173,22): error IDE1006: Naming rule violation: These words must begin with upper case characters: audioData [/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests.csproj]
/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/MessageContentPartConverterTests.cs(196,22): error IDE1006: Naming rule violation: These words must begin with upper case characters: fileId [/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests.csproj]
/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/MessageContentPartConverterTests.cs(215,22): error IDE1006: Naming rule violation: These words must begin with upper case characters: fileData [/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests.csproj]
/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/MessageContentPartConverterTests.cs(216,22): error IDE1006: Naming rule violation: These words must begin with upper case characters: filename [/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests.csproj]
/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/MessageContentPartConverterTests.cs(3,1): error IDE0005: Using directive is unnecessary. [/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests.csproj]
/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/MessageContentPartConverterTests.cs(24,38): error IDE0090: 'new' expression can be simplified [/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests.csproj]
/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/MessageContentPartConverterTests.cs(51,38): error IDE0090: 'new' expression can be simplified [/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests.csproj]
/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/MessageContentPartConverterTests.cs(73,38): error IDE0090: 'new' expression can be simplified [/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests.csproj]
/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/MessageContentPartConverterTests.cs(93,38): error IDE0090: 'new' expression can be simplified [/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests.csproj]
/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/MessageContentPartConverterTests.cs(113,38): error IDE0090: 'new' expression can be simplified [/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests.csproj]
/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/MessageContentPartConverterTests.cs(133,36): error IDE0090: 'new' expression can be simplified [/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests.csproj]
/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/MessageContentPartConverterTests.cs(151,38): error IDE0090: 'new' expression can be simplified [/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests.csproj]
/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/MessageContentPartConverterTests.cs(174,38): error IDE0090: 'new' expression can be simplified [/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests.csproj]
/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/MessageContentPartConverterTests.cs(197,36): error IDE0090: 'new' expression can be simplified [/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests.csproj]
/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/MessageContentPartConverterTests.cs(217,36): error IDE0090: 'new' expression can be simplified [/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests.csproj]
/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/ItemContentConverterTests.cs(92,22): error IDE1006: Naming rule violation: These words must begin with upper case characters: dataUri [/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests.csproj]
/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/ItemContentConverterTests.cs(112,22): error IDE1006: Naming rule violation: These words must begin with upper case characters: uri [/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests.csproj]
/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/ItemContentConverterTests.cs(132,22): error IDE1006: Naming rule violation: These words must begin with upper case characters: fileId [/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests.csproj]
/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/ItemContentConverterTests.cs(183,22): error IDE1006: Naming rule violation: These words must begin with upper case characters: uri [/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests.csproj]
/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/ItemContentConverterTests.cs(3,1): error IDE0005: Using directive is unnecessary. [/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests.csproj]
/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/ItemContentConverterTests.cs(24,44): error IDE0090: 'new' expression can be simplified [/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests.csproj]
/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/ItemContentConverterTests.cs(51,44): error IDE0090: 'new' expression can be simplified [/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests.csproj]
/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/ItemContentConverterTests.cs(73,44): error IDE0090: 'new' expression can be simplified [/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests.csproj]
/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/ItemContentConverterTests.cs(93,44): error IDE0090: 'new' expression can be simplified [/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests.csproj]
/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/ItemContentConverterTests.cs(113,44): error IDE0090: 'new' expression can be simplified [/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests.csproj]
/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/ItemContentConverterTests.cs(133,44): error IDE0090: 'new' expression can be simplified [/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests.csproj]
/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/ItemContentConverterTests.cs(151,44): error IDE0090: 'new' expression can be simplified [/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests.csproj]
/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/ItemContentConverterTests.cs(167,44): error IDE0090: 'new' expression can be simplified [/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests.csproj]
/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/ItemContentConverterTests.cs(184,44): error IDE0090: 'new' expression can be simplified [/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests.csproj]
/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/ItemContentConverterTests.cs(92,22): error IDE1006: Naming rule violation: These words must begin with upper case characters: dataUri [/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests.csproj]
/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/ItemContentConverterTests.cs(112,22): error IDE1006: Naming rule violation: These words must begin with upper case characters: uri [/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests.csproj]
/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/ItemContentConverterTests.cs(132,22): error IDE1006: Naming rule violation: These words must begin with upper case characters: fileId [/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests.csproj]
/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/ItemContentConverterTests.cs(183,22): error IDE1006: Naming rule violation: These words must begin with upper case characters: uri [/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests.csproj]
/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/ItemContentConverterTests.cs(3,1): error IDE0005: Using directive is unnecessary. [/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests.csproj]
/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/ItemContentConverterTests.cs(24,44): error IDE0090: 'new' expression can be simplified [/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests.csproj]
/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/ItemContentConverterTests.cs(51,44): error IDE0090: 'new' expression can be simplified [/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests.csproj]
/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/ItemContentConverterTests.cs(73,44): error IDE0090: 'new' expression can be simplified [/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests.csproj]
/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/ItemContentConverterTests.cs(93,44): error IDE0090: 'new' expression can be simplified [/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests.csproj]
/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/ItemContentConverterTests.cs(113,44): error IDE0090: 'new' expression can be simplified [/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests.csproj]
/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/ItemContentConverterTests.cs(133,44): error IDE0090: 'new' expression can be simplified [/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests.csproj]
/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/ItemContentConverterTests.cs(151,44): error IDE0090: 'new' expression can be simplified [/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests.csproj]
/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/ItemContentConverterTests.cs(167,44): error IDE0090: 'new' expression can be simplified [/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests.csproj]
/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/ItemContentConverterTests.cs(184,44): error IDE0090: 'new' expression can be simplified [/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests.csproj]
/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/MessageContentPartConverterTests.cs(92,22): error IDE1006: Naming rule violation: These words must begin with upper case characters: dataUri [/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests.csproj]
/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/MessageContentPartConverterTests.cs(112,22): error IDE1006: Naming rule violation: These words must begin with upper case characters: uri [/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests.csproj]
/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/MessageContentPartConverterTests.cs(132,22): error IDE1006: Naming rule violation: These words must begin with upper case characters: text [/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests.csproj]
/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/MessageContentPartConverterTests.cs(173,22): error IDE1006: Naming rule violation: These words must begin with upper case characters: audioData [/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests.csproj]
/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/MessageContentPartConverterTests.cs(196,22): error IDE1006: Naming rule violation: These words must begin with upper case characters: fileId [/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests.csproj]
/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/MessageContentPartConverterTests.cs(215,22): error IDE1006: Naming rule violation: These words must begin with upper case characters: fileData [/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests.csproj]
/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/MessageContentPartConverterTests.cs(216,22): error IDE1006: Naming rule violation: These words must begin with upper case characters: filename [/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests.csproj]
/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/MessageContentPartConverterTests.cs(3,1): error IDE0005: Using directive is unnecessary. [/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests.csproj]
/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/MessageContentPartConverterTests.cs(24,38): error IDE0090: 'new' expression can be simplified [/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests.csproj]
/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/MessageContentPartConverterTests.cs(51,38): error IDE0090: 'new' expression can be simplified [/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests.csproj]
/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/MessageContentPartConverterTests.cs(73,38): error IDE0090: 'new' expression can be simplified [/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests.csproj]
/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/MessageContentPartConverterTests.cs(93,38): error IDE0090: 'new' expression can be simplified [/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests.csproj]
/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/MessageContentPartConverterTests.cs(113,38): error IDE0090: 'new' expression can be simplified [/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests.csproj]
/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/MessageContentPartConverterTests.cs(133,36): error IDE0090: 'new' expression can be simplified [/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests.csproj]
/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/MessageContentPartConverterTests.cs(151,38): error IDE0090: 'new' expression can be simplified [/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests.csproj]
/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/MessageContentPartConverterTests.cs(174,38): error IDE0090: 'new' expression can be simplified [/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests.csproj]
/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/MessageContentPartConverterTests.cs(197,36): error IDE0090: 'new' expression can be simplified [/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests.csproj]
/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/MessageContentPartConverterTests.cs(217,36): error IDE0090: 'new' expression can be simplified [/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests.csproj]
/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/ItemContentConverterTests.cs(92,22): error IDE1006: Naming rule violation: These words must begin with upper case characters: dataUri [/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests.csproj]
/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/ItemContentConverterTests.cs(112,22): error IDE1006: Naming rule violation: These words must begin with upper case characters: uri [/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests.csproj]
/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/ItemContentConverterTests.cs(132,22): error IDE1006: Naming rule violation: These words must begin with upper case characters: fileId [/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests.csproj]
/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/ItemContentConverterTests.cs(183,22): error IDE1006: Naming rule violation: These words must begin with upper case characters: uri [/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests.csproj]
/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/ItemContentConverterTests.cs(3,1): error IDE0005: Using directive is unnecessary. [/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests.csproj]
/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/ItemContentConverterTests.cs(24,44): error IDE0090: 'new' expression can be simplified [/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests.csproj]
/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/ItemContentConverterTests.cs(51,44): error IDE0090: 'new' expression can be simplified [/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests.csproj]
/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/ItemContentConverterTests.cs(73,44): error IDE0090: 'new' expression can be simplified [/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests.csproj]
/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/ItemContentConverterTests.cs(93,44): error IDE0090: 'new' expression can be simplified [/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests.csproj]
/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/ItemContentConverterTests.cs(113,44): error IDE0090: 'new' expression can be simplified [/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests.csproj]
/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/ItemContentConverterTests.cs(133,44): error IDE0090: 'new' expression can be simplified [/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests.csproj]
/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/ItemContentConverterTests.cs(151,44): error IDE0090: 'new' expression can be simplified [/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests.csproj]
/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/ItemContentConverterTests.cs(167,44): error IDE0090: 'new' expression can be simplified [/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests.csproj]
/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/ItemContentConverterTests.cs(184,44): error IDE0090: 'new' expression can be simplified [/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests.csproj]
/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/MessageContentPartConverterTests.cs(92,22): error IDE1006: Naming rule violation: These words must begin with upper case characters: dataUri [/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests.csproj]
/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/MessageContentPartConverterTests.cs(112,22): error IDE1006: Naming rule violation: These words must begin with upper case characters: uri [/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests.csproj]
/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/MessageContentPartConverterTests.cs(132,22): error IDE1006: Naming rule violation: These words must begin with upper case characters: text [/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests.csproj]
/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/MessageContentPartConverterTests.cs(173,22): error IDE1006: Naming rule violation: These words must begin with upper case characters: audioData [/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests.csproj]
/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/MessageContentPartConverterTests.cs(196,22): error IDE1006: Naming rule violation: These words must begin with upper case characters: fileId [/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests.csproj]
/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/MessageContentPartConverterTests.cs(215,22): error IDE1006: Naming rule violation: These words must begin with upper case characters: fileData [/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests.csproj]
/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/MessageContentPartConverterTests.cs(216,22): error IDE1006: Naming rule violation: These words must begin with upper case characters: filename [/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests.csproj]
/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/MessageContentPartConverterTests.cs(3,1): error IDE0005: Using directive is unnecessary. [/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests.csproj]
/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/MessageContentPartConverterTests.cs(24,38): error IDE0090: 'new' expression can be simplified [/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests.csproj]
/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/MessageContentPartConverterTests.cs(51,38): error IDE0090: 'new' expression can be simplified [/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests.csproj]
/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/MessageContentPartConverterTests.cs(73,38): error IDE0090: 'new' expression can be simplified [/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests.csproj]
/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/MessageContentPartConverterTests.cs(93,38): error IDE0090: 'new' expression can be simplified [/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests.csproj]
/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/MessageContentPartConverterTests.cs(113,38): error IDE0090: 'new' expression can be simplified [/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests.csproj]
/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/MessageContentPartConverterTests.cs(133,36): error IDE0090: 'new' expression can be simplified [/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests.csproj]
/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/MessageContentPartConverterTests.cs(151,38): error IDE0090: 'new' expression can be simplified [/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests.csproj]
/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/MessageContentPartConverterTests.cs(174,38): error IDE0090: 'new' expression can be simplified [/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests.csproj]
/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/MessageContentPartConverterTests.cs(197,36): error IDE0090: 'new' expression can be simplified [/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests.csproj]
/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/MessageContentPartConverterTests.cs(217,36): error IDE0090: 'new' expression can be simplified [/app/dotnet/tests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests/Microsoft.Agents.AI.Hosting.OpenAI.UnitTests.csproj]

…in tests

Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Jan 25, 2026

@copilot there are formatting diagnostics:

Running 30 analyzers on Microsoft.Agents.AI.Hosting.OpenAI.UnitTests(net10.0).

...

Fixed! Updated all const local variable names to use PascalCase (DataUri, Uri, Text, AudioData, FileId, Filename) to comply with IDE1006 naming rules. All tests continue to pass. (commit 3edd739)

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

Labels

.NET workflows Related to Workflows in agent-framework

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants