elsa-workflows / elsa-workflows/elsa-extensions
Elsa 3.6-rc 2 Agent Persestnent Error
- Dominant language
- C#
- Stars
- 49
- Forks
- 48
- Avg merge
- 21h 35m
- Merged PRs (30d)
- 20
Description
.Net Runtime: 10.0
Elsa Version: 3.6.0-RC2
---
I tried to implement the following [example](https://sipkeschoorstra.medium.com/orchestrating-intelligent-agents-with-elsa-workflows-f3346b91dc17) using Elsa 3.6.0-rc2 but when i run the program i get the following error:
`Unhandled exception. System.TypeLoadException: Could not load type 'Elsa.Agents.Persistence.Contracts.IApiKeyStore' from assembly 'Elsa.Agents.Persistence, Version=3.6.0.0, Culture=neutral, PublicKeyToken=null'`
I guess the problem is that the `Elsa.Agents.Persistence.EntityFrameworkCore.SqlServer` doesnt have a `3.6.0-rc2` package in the nuget store though i tried to install the latest from the preview repository with the same result
below some outputs i out form the system
### Terminal output
```md
dotnet watch 🔥 Hot reload enabled. For a list of supported edits, see https://aka.ms/dotnet/hot-reload.
dotnet watch 💡 Press Ctrl+R to restart.
dotnet watch 🔨 Building D:\test\Elsa\Server\Server.csproj ...
dotnet watch 🔨 Build succeeded: D:\test\Elsa\Server\Server.csproj
Using launch settings from D:\test\Elsa\Server\Properties\launchSettings.json...
Unhandled exception. System.TypeLoadException: Could not load type 'Elsa.Agents.Persistence.Contracts.IApiKeyStore' from assembly 'Elsa.Agents.Persistence, Version=3.6.0.0, Culture=neutral, PublicKeyToken=null'.
at Elsa.Agents.Persistence.EntityFrameworkCore.EFCoreAgentPersistenceFeature.<>c.b__1_0(AgentPersistenceFeature feature)
at Elsa.Agents.Persistence.EntityFrameworkCore.EFCoreAgentPersistenceFeature.<>c.b__1_0(AgentPersistenceFeature feature)
at Elsa.Features.Implementations.Module.Configure[T](Func`2 factory, Action`1 configure)
at Elsa.Features.Implementations.Module.Configure[T](Action`1 configure)
at Elsa.Agents.Persistence.EntityFrameworkCore.EFCoreAgentPersistenceFeature.Configure()
at Elsa.Features.Implementations.Module.ConfigureFeature(IFeature feature)
at Elsa.Features.Implementations.Module.Configure[T](Func`2 factory, Action`1 configure)
at Elsa.Features.Implementations.Module.Configure[T](Action`1 configure)
at Elsa.Agents.Extensions.UseEntityFrameworkCore(AgentPersistenceFeature feature, Action`1 configure)
at Program.<>c__DisplayClass0_0.<$>b__8(AgentPersistenceFeature ea) in D:\test\Elsa\Server\Program.cs:line 57
at Elsa.Features.Implementations.Module.Configure[T](Func`2 factory, Action`1 configure)
at Elsa.Features.Implementations.Module.Configure[T](Action`1 configure)
at Elsa.Extensions.DependencyInjectionExtensions.Use[T](IModule module, Action`1 configure)
at Elsa.Extensions.ModuleExtensions.UseAgentPersistence(IModule module, Action`1 configure)
at Program.<>c__DisplayClass0_0.<$>b__0(IModule elsa) in D:\test\Elsa\Server\Program.cs:line 55
at Elsa.Features.AppFeature.Configure()
at Elsa.Features.Implementations.Module.ConfigureFeature(IFeature feature)
at Elsa.Features.Implementations.Module.Apply()
at Elsa.Extensions.ModuleExtensions.AddElsa(IServiceCollection services, Action`1 configure)
at Program.$(String[] args) in D:\test\Elsa\Server\Program.cs:line 15
dotnet watch ❌ [Server (net10.0)] Exited with error code -532462766
dotnet watch ⏳ Waiting for a file to change before restarting ...
```
### Packages
```XML
net10.0
enable
enable
```
### Program.cs
```C#
using Elsa.Agents;
using Elsa.EntityFrameworkCore.Extensions;
using Elsa.EntityFrameworkCore.Modules.Management;
using Elsa.EntityFrameworkCore.Modules.Runtime;
using Elsa.Extensions;
using FastEndpoints.Swagger;
using Microsoft.AspNetCore.Mvc;
var builder = WebApplication.CreateBuilder(args);
builder.WebHost.UseStaticWebAssets();
var services = builder.Services;
var configuration = builder.Configuration;
services.AddElsa(elsa =>
{
elsa.UseWorkflowManagement(management =>
{
management.UseEntityFrameworkCore(mef =>
{
mef.UseSqlServer(configuration.GetConnectionString("Default")!, new Elsa.EntityFrameworkCore.ElsaDbContextOptions()
{
SchemaName = "ElsaMGMT"
});
});
});
elsa.UseWorkflowRuntime(runtime =>
{
runtime.UseEntityFrameworkCore(rtef =>
{
rtef.UseSqlServer(configuration.GetConnectionString("Default")!, new Elsa.EntityFrameworkCore.ElsaDbContextOptions()
{
SchemaName = "ElsaRT"
});
});
});
elsa.UseIdentity(identity =>
{
identity.TokenOptions = options=> options.SigningKey = "88550a502ac54615bdcafa8ae84ee1fe";
identity.UseAdminUserProvider();
});
elsa.AddFastEndpointsFromModule();
elsa.UseWorkflowsApi();
elsa.UseDefaultAuthentication(auth=>auth.UseAdminApiKey());
elsa.UseScheduling();
elsa.UseJavaScript();
elsa.UseLiquid();
elsa.UseCSharp();
elsa.UseHttp(http =>
{
http.ConfigureHttpOptions = options=>configuration.GetSection("Http").Bind(options);
});
elsa.UseAgentActivities();
elsa.UseAgentPersistence(ea =>
{
ea.UseEntityFrameworkCore(eaf =>
{
eaf.UseSqlServer(configuration.GetConnectionString("Default")!,new Elsa.EntityFrameworkCore.ElsaDbContextOptions()
{
SchemaName="ElsaAGNT",
});
});
});
elsa.AddSwagger();
elsa.UseAgentsApi();
elsa.AddActivitiesFrom();
elsa.AddWorkflowsFrom();
});
services.AddCors(cors =>
{
cors.AddDefaultPolicy(policy =>
{
policy.AllowAnyHeader().AllowAnyMethod().AllowAnyOrigin().WithExposedHeaders("*");
});
});
services.AddRazorPages(options =>
{
options.Conventions.ConfigureFilter(new IgnoreAntiforgeryTokenAttribute());
});
var app = builder.Build();
app.UseHttpsRedirection();
// app.UseBlazorFrameworkFiles();
app.MapStaticAssets();
app.UseRouting();
app.UseCors();
app.UseStaticFiles();
app.UseSwaggerGen();
app.UseAuthentication();
app.UseAuthorization();
app.UseWorkflowsApi();
app.UseWorkflows();
app.MapFallbackToPage("/_Host");
app.Run();
```
Contributor guide
Assessment
This issue has not been assessed yet.