Skip to content

Commit cd289b2

Browse files
fix: Chat runtime failure
Fix failure: 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.
1 parent 63734a8 commit cd289b2

2 files changed

Lines changed: 33 additions & 2 deletions

File tree

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+
#pragma warning disable SKEXP0010 // PgVector APIs are experimental
5+
6+
namespace EssentialCSharp.Chat.Tests;
7+
8+
public class PgVectorConnectorTests
9+
{
10+
/// <summary>
11+
/// Verifies that PostgresVectorStore.GetCollection does not throw a TypeLoadException,
12+
/// which would indicate a version mismatch between Microsoft.SemanticKernel core and
13+
/// Microsoft.SemanticKernel.Connectors.PgVector (e.g., missing vtable slots on
14+
/// internal types like PostgresModelBuilder).
15+
/// </summary>
16+
[Test]
17+
public async Task GetCollection_WithBookContentChunk_DoesNotThrowTypeLoadException()
18+
{
19+
// Arrange — no real DB connection is needed; connections are only opened for actual queries
20+
var store = new PostgresVectorStore("Host=localhost;Database=test;Username=test;Password=test");
21+
22+
// Act — this triggers loading internal PostgresModelBuilder via PostgresCollection ctor
23+
var collection = store.GetCollection<string, BookContentChunk>("test-collection");
24+
25+
// Assert
26+
await Assert.That(collection).IsNotNull();
27+
}
28+
}

0 commit comments

Comments
 (0)