title: Roslyn scripting entry point?
body: <p>I am building a REPL interface with Blazor webassembly.</p>
  <p>I have build a textarea where you can write code. The code compiles successfully. The problem is that the textarea is empty. Normally, as a C# developer, you would see an entry point (the Main method) by which the program starts.</p>
  <p>How do I fix that?</p>
  <p><a href="https://try.dot.net/" rel="nofollow noreferrer">Try dotnet</a> is an good example of what I want to achieve. In my case the textarea is empty, but I can program in there. Not sure what the entry point is in my case.</p>
  <p>I am really stuck here since I cannot find much about Roslyn scripting with Blazor.</p>
  <p>Please help me out.</p>
  <p>My code to compile input:</p>
  <pre><code>private ScriptState _scriptState = null;
      private StringWriter _sw;
      private string _output;
  
      public ChallengeCompiler()
      {
          _sw = new StringWriter();
          Console.SetOut(_sw);
          Console.SetError(_sw);
      }
  
      public string CompileCode(string input)
      {
          string[] references =
          {
              &quot;System&quot;,
              &quot;System.Collections&quot;,
              &quot;System.Collections.Generic&quot;,
              &quot;System.Collections.Concurrent&quot;,
              &quot;System.Console&quot;,
              &quot;System.Diagnostics.Debug&quot;,
              &quot;System.Diagnostics.Process&quot;,
              &quot;System.Diagnostics.StackTrace&quot;,
              &quot;System.Globalization&quot;,
              &quot;System.IO&quot;,
              &quot;System.Reflection&quot;,
              &quot;System.Runtime&quot;,
              &quot;System.Runtime.InteropServices&quot;,
              &quot;System.Text&quot;,
              &quot;System.Text.Encoding&quot;,
              &quot;System.Text.RegularExpressions&quot;,
              &quot;System.Threading&quot;,
              &quot;System.Threading.Tasks&quot;,
              &quot;System.Threading.Tasks.Parallel&quot;,
              &quot;System.Threading.Thread&quot;,
              &quot;System.ValueTuple&quot;,
          };
  
          try
          {
              if (_scriptState == null)
              {
                  _scriptState = CSharpScript.RunAsync(input, ScriptOptions.Default.WithImports(references)).Result;
              }
              else
              {
                  _scriptState = _scriptState.ContinueWithAsync(input).Result;
              }
  
              if (_scriptState.ReturnValue != null &amp;&amp; !string.IsNullOrEmpty(_scriptState.ReturnValue.ToString()))
              {
                  _output = _scriptState.ReturnValue.ToString();
              }
              else
              {
                  _output = _sw.ToString();
              }
          }
          catch (CompilationErrorException e)
          {
              _output = &quot;-----------------------------------\n&quot;;
              _output += string.Join(Environment.NewLine, e.Diagnostics);
          }
  
          return _output;
      }
  </code></pre>