Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Dotnet.Script.Core/DebugScriptRunner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public override Task<TReturn> Execute<TReturn, THost>(ScriptContext context, THo
{
// https://github.com/dotnet/roslyn/blob/version-2.0.0-beta4/src/Compilers/CSharp/Portable/Syntax/CSharpSyntaxTree.ParsedSyntaxTree.cs#L19
var encodingField = syntaxTree.GetType().GetField("_encodingOpt", BindingFlags.Instance | BindingFlags.NonPublic);
encodingField.SetValue(syntaxTree, Encoding.UTF8);
encodingField.SetValue(syntaxTree, context.Code.Encoding);

// https://github.com/dotnet/roslyn/blob/version-2.0.0-beta4/src/Compilers/CSharp/Portable/Syntax/CSharpSyntaxTree.ParsedSyntaxTree.cs#L21
var lazyTextField = syntaxTree.GetType().GetField("_lazyText", BindingFlags.Instance | BindingFlags.NonPublic);
Expand Down
4 changes: 2 additions & 2 deletions src/Dotnet.Script/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,15 @@ private static void RunScript(string file, string config, bool debugMode, IEnume
}

var directory = Path.IsPathRooted(file) ? Path.GetDirectoryName(file) : Path.GetDirectoryName(Path.Combine(Directory.GetCurrentDirectory(), file));
var sourceText = SourceText.From(new FileStream(file, FileMode.Open), Encoding.UTF8);
var sourceText = SourceText.From(new FileStream(file, FileMode.Open));
var context = new ScriptContext(sourceText, directory, config, args, file);

Run(debugMode, context);
}

private static void RunCode(string code, string config, bool debugMode, IEnumerable<string> args, string currentWorkingDirectory)
{
var sourceText = SourceText.From(code, Encoding.UTF8);
var sourceText = SourceText.From(code);
var context = new ScriptContext(sourceText, currentWorkingDirectory ?? Directory.GetCurrentDirectory(), config, args);

Run(debugMode, context);
Expand Down