Skip to content

Forward IsExternalInit from the .NET builds of Microsoft.Extensions.VectorData.Abstractions - #7931

Open
Laurianti wants to merge 1 commit into
dotnet:mainfrom
Laurianti:fix-vectordata-isexternalinit-forward
Open

Laurianti wants to merge 1 commit into
dotnet:mainfrom
Laurianti:fix-vectordata-isexternalinit-forward

Conversation

@Laurianti

@Laurianti Laurianti commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

A library compiled for netstandard2.0 that sets an init property of this package, like VectorStoreMetadata.VectorStoreName, fails on .NET 8 and .NET 9 with MissingMethodException. In the netstandard2.0 build the setter carries the IsExternalInit of this assembly; the application gets the net8.0 build, where it carries the one of the runtime.

This comes from CommunityToolkit/AI#87, which removes net8.0 from the providers.

Changes

  • TypeForwardedTo for IsExternalInit in the .NET builds.
  • A test for the forward.

Tests

  • The new test fails without the forward and passes with it, on .NET 10.
  • A .NET 8 and a .NET 9 console app with the .NET Standard build of two providers of CommunityToolkit/AI, Chroma against chromadb/chroma:1.5.9 and Milvus without a server. Both failed when the store was created. With the forward and Microsoft.Bcl.AsyncInterfaces in the provider, Milvus created its store and collection, and Chroma, which also needs the same forward in ChromaDotNet.Client, wrote, read, filtered and searched.
  • On 8 other providers the runtime resolves every reference of the .NET Standard build with the forward and the package, and does not without them. PgVector still misses 5 references, from Npgsql 8.0.7, not from this package.
  • That build was made outside the build of this repository, from the sources of 10.8.2; the full build is left to the CI of this draft.
Microsoft Reviewers: Open in CodeFlow

Not in this PR

  • Microsoft.Extensions.AI.Abstractions and Microsoft.Extensions.AI also have init setters and both .NET Standard and .NET builds. I did not test them.

@github-actions github-actions Bot added the area-ai-eval Microsoft.Extensions.AI.Evaluation and related label Nov 9, 2026
@dotnet-comment-bot

Copy link
Copy Markdown
Collaborator

‼️ Found issues ‼️

Project Coverage Type Expected Actual
Microsoft.Extensions.AI Line 89 87.81 🔻
Microsoft.Extensions.AI Branch 89 79.23 🔻
Microsoft.Extensions.AI.OpenAI Line 75 68.8 🔻
Microsoft.Extensions.AI.OpenAI Branch 75 60.3 🔻
Microsoft.Extensions.DataIngestion.MarkItDown Line 75 4.46 🔻
Microsoft.Extensions.DataIngestion.MarkItDown Branch 75 0.75 🔻
Microsoft.Extensions.Diagnostics.ResourceMonitoring Line 99 96.06 🔻
Microsoft.Extensions.Diagnostics.ResourceMonitoring Branch 99 92.28 🔻
Microsoft.Extensions.Diagnostics.ResourceMonitoring.Kubernetes Line 99 97.73 🔻
Microsoft.Extensions.Diagnostics.ResourceMonitoring.Kubernetes Branch 99 92.86 🔻
Microsoft.Extensions.Diagnostics.Testing Line 99 98.22 🔻
Microsoft.Extensions.Diagnostics.Testing Branch 99 93.66 🔻
Microsoft.Extensions.ServiceDiscovery Line 75 59.27 🔻
Microsoft.Extensions.ServiceDiscovery Branch 75 64.41 🔻
Microsoft.Extensions.ServiceDiscovery.Abstractions Line 75 41.14 🔻
Microsoft.Extensions.ServiceDiscovery.Abstractions Branch 75 45.1 🔻
Microsoft.Extensions.ServiceDiscovery.Dns Line 75 62.53 🔻
Microsoft.Extensions.ServiceDiscovery.Dns Branch 75 73.96 🔻
Microsoft.Extensions.ServiceDiscovery.Yarp Line 75 73.85 🔻
Microsoft.Extensions.ServiceDiscovery.Yarp Branch 75 60 🔻
Microsoft.Extensions.Telemetry Line 93 90.47 🔻
Microsoft.Extensions.Telemetry Branch 93 86.83 🔻
Microsoft.Extensions.VectorData.Abstractions Line 75 32.15 🔻
Microsoft.Extensions.VectorData.Abstractions Branch 75 26.31 🔻

🎉 Good job! The coverage increased 🎉
Update MinCodeCoverage in the project files.

Project Expected Actual
Microsoft.Extensions.AI.Evaluation.NLP 0 74
Microsoft.Extensions.Caching.Hybrid 81 82
Microsoft.Extensions.DataIngestion 75 77
Microsoft.Extensions.DataIngestion.Markdig 75 88
Microsoft.Extensions.DocumentExtraction 80 94
Microsoft.Extensions.DocumentExtraction.Abstractions 80 100
Microsoft.Extensions.Documents.Abstractions 80 98
Microsoft.Gen.MetadataExtractor 57 72
Microsoft.Gen.MetricsReports 67 69

Full code coverage report: https://dev.azure.com/dnceng-public/public/_build/results?buildId=1670856&view=codecoverage-tab

@Laurianti
Laurianti marked this pull request as ready for review November 9, 2026 23:00
Copilot AI balanced review requested due to automatic review settings November 9, 2026 23:00

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.

🟢 Approval recommended

No active review issues block the IsExternalInit compatibility fix.

No open issues 🎉

What changed in this PR

This PR addresses MissingMethodException when consumers compiled against the .NET Standard build of Microsoft.Extensions.VectorData.Abstractions call init setters using the .NET build at runtime.

Changes:

  • Forward IsExternalInit to the runtime type in .NET builds.
  • Add a .NET-only test verifying that the assembly exposes the forward.
File Description
test/​Libraries/​Microsoft.Extensions.VectorData.Abstractions.Tests/​TypeForwardingTests.cs Verifies that IsExternalInit is forwarded to the runtime type.
src/​Libraries/​Microsoft.Extensions.VectorData.Abstractions/​TypeForwards.cs Adds the conditional type forward and explains its compatibility purpose.

Review effort: Balanced

@dotnet-comment-bot

Copy link
Copy Markdown
Collaborator

‼️ Found issues ‼️

Project Coverage Type Expected Actual
Microsoft.Extensions.AI Line 89 87.81 🔻
Microsoft.Extensions.AI Branch 89 79.23 🔻
Microsoft.Extensions.AI.OpenAI Line 75 68.8 🔻
Microsoft.Extensions.AI.OpenAI Branch 75 60.3 🔻
Microsoft.Extensions.DataIngestion.MarkItDown Line 75 4.46 🔻
Microsoft.Extensions.DataIngestion.MarkItDown Branch 75 0.75 🔻
Microsoft.Extensions.Diagnostics.ResourceMonitoring Line 99 96.06 🔻
Microsoft.Extensions.Diagnostics.ResourceMonitoring Branch 99 92.28 🔻
Microsoft.Extensions.Diagnostics.ResourceMonitoring.Kubernetes Line 99 97.73 🔻
Microsoft.Extensions.Diagnostics.ResourceMonitoring.Kubernetes Branch 99 92.86 🔻
Microsoft.Extensions.Diagnostics.Testing Line 99 98.22 🔻
Microsoft.Extensions.Diagnostics.Testing Branch 99 93.66 🔻
Microsoft.Extensions.ServiceDiscovery Line 75 58.1 🔻
Microsoft.Extensions.ServiceDiscovery Branch 75 64.41 🔻
Microsoft.Extensions.ServiceDiscovery.Abstractions Line 75 41.14 🔻
Microsoft.Extensions.ServiceDiscovery.Abstractions Branch 75 45.1 🔻
Microsoft.Extensions.ServiceDiscovery.Dns Line 75 62.53 🔻
Microsoft.Extensions.ServiceDiscovery.Dns Branch 75 73.96 🔻
Microsoft.Extensions.ServiceDiscovery.Yarp Line 75 73.85 🔻
Microsoft.Extensions.ServiceDiscovery.Yarp Branch 75 60 🔻
Microsoft.Extensions.Telemetry Line 93 90.47 🔻
Microsoft.Extensions.Telemetry Branch 93 86.83 🔻
Microsoft.Extensions.VectorData.Abstractions Line 75 32.15 🔻
Microsoft.Extensions.VectorData.Abstractions Branch 75 26.31 🔻

🎉 Good job! The coverage increased 🎉
Update MinCodeCoverage in the project files.

Project Expected Actual
Microsoft.Extensions.AI.Evaluation.NLP 0 74
Microsoft.Extensions.Caching.Hybrid 81 82
Microsoft.Extensions.DataIngestion 75 77
Microsoft.Extensions.DataIngestion.Markdig 75 88
Microsoft.Extensions.DocumentExtraction 80 94
Microsoft.Extensions.DocumentExtraction.Abstractions 80 100
Microsoft.Extensions.Documents.Abstractions 80 98
Microsoft.Gen.MetadataExtractor 57 72
Microsoft.Gen.MetricsReports 67 69

Full code coverage report: https://dev.azure.com/dnceng-public/public/_build/results?buildId=1671827&view=codecoverage-tab

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

area-ai-eval Microsoft.Extensions.AI.Evaluation and related

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants