diff --git a/.gitignore b/.gitignore index b5450468..7a8c84ce 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,7 @@ EssentialCSharpManuscript.[0-9] .vs/ obj bin +TestResults/ ~$*.do[ct]x ~*.tmp ~$*.dotm diff --git a/Directory.Packages.props b/Directory.Packages.props index 0012ca46..f9fcf955 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -12,6 +12,9 @@ https://pkgs.dev.azure.com/intelliTect/_packaging/EssentialCSharp/nuget/v3/index.json; + + 1.72.0 + @@ -36,8 +39,8 @@ - - + + diff --git a/EssentialCSharp.Chat.Tests/PgVectorConnectorTests.cs b/EssentialCSharp.Chat.Tests/PgVectorConnectorTests.cs new file mode 100644 index 00000000..ed5c9fe9 --- /dev/null +++ b/EssentialCSharp.Chat.Tests/PgVectorConnectorTests.cs @@ -0,0 +1,28 @@ +using EssentialCSharp.Chat.Common.Models; +using Microsoft.SemanticKernel.Connectors.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). + /// + [Test] + public async Task GetCollection_WithBookContentChunk_DoesNotThrowTypeLoadException() + { + // Arrange — no real DB connection is needed; connections are only opened for actual queries +#pragma warning disable SKEXP0010 // PostgresVectorStore is experimental + using var store = new PostgresVectorStore("Host=localhost;Database=test;Username=test;Password=test"); + + // Act — this triggers loading internal PostgresModelBuilder via PostgresCollection ctor + var collection = store.GetCollection("test-collection"); +#pragma warning restore SKEXP0010 + + // Assert + await Assert.That(collection).IsNotNull(); + } +}