Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Console.WriteLine(char value) overload not displaying in Results Panel #225

Closed
xgdoggiex opened this issue Jul 1, 2024 · 6 comments
Closed
Labels
bug Something isn't working

Comments

@xgdoggiex
Copy link

Hello!

I appear to be having an issue displaying the output of the below example code in NetPad:

char a = 'I';
Console.WriteLine("Printing a char");
Console.WriteLine(a);

It appears as though using the Console.WriteLine(char value) overload does not print anything to the Results pane:

NetPad Screenshot

NetPad Version: v0.7.1

@tareqimbasher
Copy link
Owner

Thank you for reporting, I'll get this fixed.

@tareqimbasher tareqimbasher added the bug Something isn't working label Jul 1, 2024
@SimonNyvall
Copy link
Contributor

Have done some digging into the problem.

In the ExternalScriptRunner.cs a process runs the dotnet application and the output ends up in OnProcessOutputRecevied

{
    "type":"HtmlResultsScriptOutput",
    "output": {
        "body":"<div class="group text"><br/></div>",
        "order":1
    }
}

although the only chars gets parsed weired. Have not checked the dll that gets generated in the tmp/Processes, may be an issue there

@tareqimbasher
Copy link
Owner

@SimonNyvall thanks for digging in. The issue is most likely in the ActionTextWriter which derives from TextWriter. There I'm overriding Write(string value) and WriteLine(string value) but when writing a char it doesn't go through that method and most likely goes through WriteLine(char value). We can override all the overloads from TextWriter but I don't think we need to. Instead we can only override a select few that all the other overloads eventually funnel to.

I imagine WriteLine(char value) will have to be overridden since if I had to guess it would be one of those terminal functions that won't call another overload.

@SimonNyvall
Copy link
Contributor

@tareqimbasher thanks you so much for the tip! I looked at the ActionTextWriter yesterday and thought it wrote to the Console output and not to the dll files.

Made a fix and can create a PR if you would like?

@tareqimbasher
Copy link
Owner

That's great! Go ahead and submit a PR. Thanks for working on this.

@tareqimbasher
Copy link
Owner

tareqimbasher commented Aug 11, 2024

PR #240 is merged and fixes this issue. Thank you @SimonNyvall. Will go out with next release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants