elsa-core icon indicating copy to clipboard operation
elsa-core copied to clipboard

[BUG] Variable value is no pass to next activity running in console application but web server is OK

Open engine5d opened this issue 1 year ago • 0 comments

Description

Variable value is no pass to next activity running in console application

Steps to Reproduce

To help us identify the issue more quickly, please follow these guidelines:

  1. Detailed Steps: Provide a step-by-step description of what leads to the bug. Be as specific as possible. Create a workflow including 2 activities. 1. setvariable activity for set a value to a workflow variable named "Variable1" ; 2. then Use write line activity to write the given value of last activity.

the workflow run ok in web server , but writeline a empty value in console application.

  1. Code Snippets: If the issue involves code (e.g., JavaScript error, server request failure), include the relevant snippets where the issue occurs.

workflow json: hello-world.json

c# code:

using e5d.doc.activities;
using Elsa.Extensions;
using Elsa.Testing.Shared;
using Elsa.Workflows.Contracts;
using Elsa.Workflows.Management;
using Elsa.Workflows.Management.Contracts;
using Microsoft.Extensions.DependencyInjection;

// Setup service container.
var services = new ServiceCollection();

// Add Elsa services.
services.AddElsa(
    elsa =>
    {
        //elsa.AddActivitiesFrom<Program>();
        // Setup a SignalR hub for real-time updates from the server.
        elsa.UseRealTimeWorkflows();
        elsa.UseMemoryCache();

        //elsa.AddActivity<PDFForEachActivity>();
        //elsa.AddActivity<PDFDataExtractActivity>();
        //elsa.AddActivity<WriteToPDFFileActivity>();
        
        // Register custom workflows from the application, if any.
        //elsa.AddWorkflowsFrom<Program>();
    }
    );

// Build service container.
var serviceProvider = services.BuildServiceProvider();

// Populate registries. This is only necessary for applications that are not using hosted services.
await serviceProvider.PopulateRegistriesAsync();

// Import a workflow from a JSON file.
var workflowJson = await File.ReadAllTextAsync("hello-world.json");

// Get a serializer to deserialize the workflow.
var serializer = serviceProvider.GetRequiredService<IWorkflowSerializer>();

// Deserialize the workflow.
var workflow = serializer.Deserialize(workflowJson);

// Resolve a workflow runner to run the workflow.
var workflowRunner = serviceProvider.GetRequiredService<IWorkflowRunner>();

// Run the workflow.
await workflowRunner.RunAsync(workflow);

  1. Attachments:

    • Workflow JSON: If your issue is reproducible with a specific workflow, please attach the workflow's JSON file. This will help us understand the exact process that leads to the problem.
    • Sample Project: If possible, attach a minimal sample project or code that reproduces the issue. This could be a simplified version of your project that isolates and demonstrates the bug.
  2. Reproduction Rate: Indicate how often the bug occurs when following these steps (e.g., "every time", "intermittently: about 50% of the time").

  3. Video/Screenshots: Sometimes, complex behaviors are better shown than described. If you think a video or screenshots would help clarify the issue, please include them.

  4. Additional Configuration:

    • Mention any specific settings, features, or configurations that need to be enabled or present to reproduce the issue.

Providing a comprehensive and clear description will greatly assist in diagnosing the problem quickly and accurately. If you're unable to share some of the requested information publicly, please note that, and we can arrange for secure information transfer.

Expected Behavior

Describe what you expected to happen.

console application run the hello-world.json workflow and write a string line :"give me a value"

Actual Behavior

Describe what actually happened. Include screenshots, if applicable.

  1. in web server image image

  2. but in console application image

Screenshots

If possible, add screenshots or screen recordings to help explain the problem.

Environment

  • Elsa Package Version: Specify the version. If you've cloned the repo, mention if you are using the latest source code from the main branch.
  • Operating System: Include your OS version (e.g., Windows 10, macOS Big Sur, Ubuntu 18.04).
  • Browser and Version: If applicable, include your browser and version (e.g., Chrome 92).

win11 vs2022 elsa3.2(latest)

Log Output

Include any relevant log output or error messages that might help diagnose the issue.

Troubleshooting Attempts

Describe any steps you have taken to troubleshoot or resolve the issue yourself.

Additional Context

Add any other context about the problem here. This could include the frequency of the issue (e.g., intermittent, every time), conditions under which the issue appears, etc.

Related Issues

Link to any related issues here.

engine5d avatar Oct 06 '24 03:10 engine5d