Skip to content

Commit 0bd2e01

Browse files
fix: Chat Failure (#901)
## Description Method 'ValidateKeyProperty' in type 'Microsoft.SemanticKernel.Connectors.PgVector.PostgresModelBuilder' from assembly 'Microsoft.SemanticKernel.Connectors.PgVector, Version=1.70.0.0, Culture=neutral, PublicKeyToken=f300afd708cefcd3' does not have an implementation. ### Ensure that your pull request has followed all the steps below: - [ ] Code compilation - [ ] Created tests which fail without the change (if possible) - [ ] All tests passing - [ ] Extended the README / documentation, if necessary
1 parent 63734a8 commit 0bd2e01

3 files changed

Lines changed: 34 additions & 2 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ EssentialCSharpManuscript.[0-9]
66
.vs/
77
obj
88
bin
9+
TestResults/
910
~$*.do[ct]x
1011
~*.tmp
1112
~$*.dotm

Directory.Packages.props

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
https://pkgs.dev.azure.com/intelliTect/_packaging/EssentialCSharp/nuget/v3/index.json;
1313
</RestoreSources>
1414
</PropertyGroup>
15+
<PropertyGroup>
16+
<SemanticKernelVersion>1.72.0</SemanticKernelVersion>
17+
</PropertyGroup>
1518
<ItemGroup Condition="$(AccessToNugetFeed)">
1619
<PackageVersion Include="ContentFeedNuget" Version="$(ToolingPackagesVersion)" />
1720
</ItemGroup>
@@ -36,8 +39,8 @@
3639
<PackageVersion Include="Microsoft.EntityFrameworkCore.Sqlite" Version="10.0.3" />
3740
<PackageVersion Include="Microsoft.EntityFrameworkCore.SqlServer" Version="10.0.3" />
3841
<PackageVersion Include="Microsoft.EntityFrameworkCore.Tools" Version="10.0.3" />
39-
<PackageVersion Include="Microsoft.SemanticKernel" Version="1.72.0" />
40-
<PackageVersion Include="Microsoft.SemanticKernel.Connectors.PgVector" Version="1.70.0-preview" />
42+
<PackageVersion Include="Microsoft.SemanticKernel" Version="$(SemanticKernelVersion)" />
43+
<PackageVersion Include="Microsoft.SemanticKernel.Connectors.PgVector" Version="$(SemanticKernelVersion)-preview" />
4144
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="10.0.103" />
4245
<PackageVersion Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.23.0" />
4346
<PackageVersion Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="10.0.2" />
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
using EssentialCSharp.Chat.Common.Models;
2+
using Microsoft.SemanticKernel.Connectors.PgVector;
3+
4+
namespace EssentialCSharp.Chat.Tests;
5+
6+
public class PgVectorConnectorTests
7+
{
8+
/// <summary>
9+
/// Verifies that PostgresVectorStore.GetCollection does not throw a TypeLoadException,
10+
/// which would indicate a version mismatch between Microsoft.SemanticKernel core and
11+
/// Microsoft.SemanticKernel.Connectors.PgVector (e.g., missing vtable slots on
12+
/// internal types like PostgresModelBuilder).
13+
/// </summary>
14+
[Test]
15+
public async Task GetCollection_WithBookContentChunk_DoesNotThrowTypeLoadException()
16+
{
17+
// Arrange — no real DB connection is needed; connections are only opened for actual queries
18+
#pragma warning disable SKEXP0010 // PostgresVectorStore is experimental
19+
using var store = new PostgresVectorStore("Host=localhost;Database=test;Username=test;Password=test");
20+
21+
// Act — this triggers loading internal PostgresModelBuilder via PostgresCollection ctor
22+
var collection = store.GetCollection<string, BookContentChunk>("test-collection");
23+
#pragma warning restore SKEXP0010
24+
25+
// Assert
26+
await Assert.That(collection).IsNotNull();
27+
}
28+
}

0 commit comments

Comments
 (0)