diff --git a/Directory.Packages.props b/Directory.Packages.props index da1d16b1..58b5af3b 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -47,7 +47,7 @@ - + diff --git a/EssentialCSharp.Chat.Shared/EssentialCSharp.Chat.Common.csproj b/EssentialCSharp.Chat.Shared/EssentialCSharp.Chat.Common.csproj index 49e62c75..e367599d 100644 --- a/EssentialCSharp.Chat.Shared/EssentialCSharp.Chat.Common.csproj +++ b/EssentialCSharp.Chat.Shared/EssentialCSharp.Chat.Common.csproj @@ -8,7 +8,7 @@ - + diff --git a/EssentialCSharp.Chat.Tests/PgVectorConnectorTests.cs b/EssentialCSharp.Chat.Tests/PgVectorConnectorTests.cs index ed5c9fe9..c0523ef8 100644 --- a/EssentialCSharp.Chat.Tests/PgVectorConnectorTests.cs +++ b/EssentialCSharp.Chat.Tests/PgVectorConnectorTests.cs @@ -1,18 +1,17 @@ using EssentialCSharp.Chat.Common.Models; -using Microsoft.SemanticKernel.Connectors.PgVector; +using CommunityToolkit.VectorData.PgVector; namespace EssentialCSharp.Chat.Tests; public class PgVectorConnectorTests { /// - /// Verifies that PostgresVectorStore.GetCollection does not throw a TypeLoadException, - /// which would indicate a version mismatch between Microsoft.SemanticKernel core and - /// Microsoft.SemanticKernel.Connectors.PgVector (e.g., missing vtable slots on - /// internal types like PostgresModelBuilder). + /// Verifies the runtime vector-data API shape is compatible with the currently resolved + /// CommunityToolkit connector assemblies. If this fails with MissingMethodException + /// (for example on VectorSearchOptions.get_OldFilter()), package versions are out of sync. /// [Test] - public async Task GetCollection_WithBookContentChunk_DoesNotThrowTypeLoadException() + public async Task GetCollection_WithBookContentChunk_RuntimeVectorDataApiShapeIsCompatible() { // Arrange — no real DB connection is needed; connections are only opened for actual queries #pragma warning disable SKEXP0010 // PostgresVectorStore is experimental @@ -24,5 +23,20 @@ public async Task GetCollection_WithBookContentChunk_DoesNotThrowTypeLoadExcepti // Assert await Assert.That(collection).IsNotNull(); + + // Drive the same vector-search path used in production so binary-incompatible package + // combinations fail in tests before deployment. + await using var enumerator = collection + .SearchAsync( + new ReadOnlyMemory(new float[1536]), + 1, + options: new Microsoft.Extensions.VectorData.VectorSearchOptions + { + VectorProperty = x => x.TextEmbedding + }, + cancellationToken: CancellationToken.None) + .GetAsyncEnumerator(); + + await Assert.ThrowsAsync(async () => await enumerator.MoveNextAsync().AsTask()); } } diff --git a/EssentialCSharp.Chat/EssentialCSharp.Chat.csproj b/EssentialCSharp.Chat/EssentialCSharp.Chat.csproj index 01ea6026..33fc4920 100644 --- a/EssentialCSharp.Chat/EssentialCSharp.Chat.csproj +++ b/EssentialCSharp.Chat/EssentialCSharp.Chat.csproj @@ -20,7 +20,7 @@ - +