Skip to content

Async functionality not working -- everything runs sync #97

Closed
@ash47

Description

@ash47

The C# code is not run async, it is running sync.

Sample code:

const edge = require('electron-edge-js');

let someCommand = edge.func(`
    async (input) => { 
        while(true){}
        return ".NET Welcomes " + input.ToString(); 
    }
`)

console.log('a');
someCommand('javascript', function() {
    console.log('c');
});
console.log('b');

I see "a" in the console, and then the entire app freezes due to the infinite loop within the C# code. According to the documentation, the C# code is meant to run async, meaning that it can be as CPU intense as it likes, take as long as it likes, and the JavaScript v8 engine code will continue to run.

I have also tried specifying "sync: false" specifically and even "sync: true", this didn't help.

How do I make the C# code run async?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions