question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cell runs forever when using interactive.csharp.getVariable in conjunction with console.log in a javascript cell

See original GitHub issue

Describe the bug

Creating the following .dib file and executing the cells (usually) causes the second cell to run indefinitely:

#!csharp

int i = 1234;

#!javascript

let x = 0
interactive.csharp.getVariable('i').then(v => console.log(v))
console.log(x)

.NET Interactive Version

Neither #!about or dotnet interactive --version seemed to work for me, but the vscode extension says it’s the following version: v1.0.2309030

  • OS
    • Windows 11
    • Windows 10
    • macOS
    • Linux (Please specify distro)
    • iOS
    • Android
  • Browser
    • Chrome
    • Edge
    • Firefox
    • Safari
  • Frontend
    • Jupyter Notebook
    • Jupyter Lab
    • nteract
    • Visual Studio Code
    • Visual Studio Code Insiders
    • Other (please specify)

Screenshots

image

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
jonsequiturcommented, Nov 9, 2021

Closing this. interactive.csharp.getVariable has been removed as #!share is now supported in JavaScript kernels.

1reaction
jonsequiturcommented, Jul 8, 2021

maybe more after that promise is fulfilled.

The example code has a race condition. If the cell execution completes before the promise is fulfilled, you’ll only get the 0 output, which is by design. This is what I see most of the time. Occasionally though (and presumably more often on some hardware) it does either print both outputs and complete or run forever.

If I await the promise, I see both outputs 100% of the time, and can’t reproduce the endlessly-running cell. This suggests to me that the race condition is the reason the cell execution doesn’t complete, which would be a bug in our JavaScript evaluation code in the VS Code extension. @RandomFractals or @Treit, do you see the same when running this:

let x = 0
console.log(await interactive.csharp.getVariable('i'))
console.log(x)

@brettfo?

Read more comments on GitHub >

github_iconTop Results From Across the Web

`interactive.csharp` object is undefined · Issue #1803
csharp object is always coming back as undefined. I tried the simple instructions from the readme about sharing variables with javascript (see ...
Read more >
Every time I click the tables cell I want to console.log ...
I am confused how do I return the value of multidimensional array? every time I click the tables cell I want to console.log...
Read more >
Displaying HTML with values from variables in the dotnet ...
1) Using the HTML and JS kernels. In this first example we must create the variable and assign it a value in a...
Read more >
The 10 Most Common Mistakes in C# Programming
Common C# Programming Mistake #1: Using a reference like a value or vice versa. Programmers of C++, and many other languages, are accustomed...
Read more >
Untitled
Angry bird game download java mobile, Alabama rammer yammer ringtone ... but up book online, Paco ignacio taibo ii pdf gratis, 5amsa w...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found