You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The application throws an unhandled exception related to the loading of System.Data.Common.DbDataSource from assembly 'Npgsql'. This happens when the application attempts to dispose of the PostgresMemoryStore.
To Reproduce
Inject an instance of IMemory store :
builder.Services.AddScoped<IMemoryStore>(provider =>
{
var dataSourceBuilder = new NpgsqlDataSourceBuilder(builder.Configuration.GetConnectionString("PostgresConnectionString"));
dataSourceBuilder.UseVector();
return new PostgresMemoryStore(dataSourceBuilder.Build(), 1536);
});
Expected behavior
The application should smoothly dispose of the PostgresMemoryStore without any errors.
fail: Microsoft.AspNetCore.Server.Kestrel[13]
Connection id "0HMU9S3SSK6LB", Request id "0HMU9S3SSK6LB:00000001": An unhandled exception was thrown by the application.
System.TypeLoadException: Could not load type 'System.Data.Common.DbDataSource' from assembly 'Npgsql, Version=7.0.6.0, Culture=neutral, PublicKeyToken=5d8b90d52f46fda7'.
at Microsoft.SemanticKernel.Connectors.Memory.Postgres.PostgresMemoryStore.Dispose(Boolean disposing)
at Microsoft.SemanticKernel.Connectors.Memory.Postgres.PostgresMemoryStore.Dispose()
at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngineScope.DisposeAsync()
--- End of stack trace from previous location ---
at Microsoft.AspNetCore.Http.Features.RequestServicesFeature.<DisposeAsync>g__Awaited|9_0(RequestServicesFeature servicesFeature, ValueTask vt)
at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.<FireOnCompleted>g__ProcessEvents|242_0(HttpProtocol protocol, Stack`1 events)
info: Microsoft.IdentityModel.LoggingExtensions.IdentityLoggerAdapter[0]
The text was updated successfully, but these errors were encountered:
github-actionsbot
changed the title
System.TypeLoadException Could not load type 'System.Data.Common.DbDataSource' from assembly 'Npgsql'
.Net: System.TypeLoadException Could not load type 'System.Data.Common.DbDataSource' from assembly 'Npgsql'
Oct 10, 2023
### Motivation and Context
<!-- Thank you for your contribution to the semantic-kernel repo!
Please help reviewers and future users, providing the following
information:
1. Why is this change required?
2. What problem does it solve?
3. What scenario does it contribute to?
4. If it fixes an open issue, please link to the issue here.
-->
Fix#3121
### Description
<!-- Describe your changes, the overall approach, the underlying design.
These notes will help understanding how your code works. Thanks! -->
Convert to `IDisposable` to execute `Dispose`.
### Contribution Checklist
<!-- Before submitting this PR, please make sure: -->
- [x] The code builds clean without any errors or warnings
- [x] The PR follows the [SK Contribution
Guidelines](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md)
and the [pre-submission formatting
script](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md#development-scripts)
raises no violations
- [x] All unit tests pass, and I have added new tests where possible
- [x] I didn't break anyone 😄
---------
Co-authored-by: Roger Barreto <19890735+RogerBarreto@users.noreply.github.com>
The application throws an unhandled exception related to the loading of System.Data.Common.DbDataSource from assembly 'Npgsql'. This happens when the application attempts to dispose of the PostgresMemoryStore.
To Reproduce
Inject an instance of IMemory store :
Expected behavior
The application should smoothly dispose of the PostgresMemoryStore without any errors.
Platform
Additional context
The text was updated successfully, but these errors were encountered: