Skip to content

Commit

Permalink
Merge pull request #23029 from adamralph/submission-stack-trace-only
Browse files Browse the repository at this point in the history
scripting hosts: print the submission stack trace only to the console
  • Loading branch information
tmat authored Nov 10, 2017
2 parents 125e9c0 + 4175350 commit 4b6ad2a
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Scripting/CSharpTest.Desktop/CsiTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,9 @@ public void LineNumber_Information_On_Exception()

Assert.True(result.ContainsErrors);
AssertEx.AssertEqualToleratingWhitespaceDifferences("OK", result.Output);
AssertEx.AssertStartsWithToleratingWhitespaceDifferences($@"
System.Exception: Error!
at Submission#0.<<Initialize>>d__0.MoveNext() in {cwd}{Path.DirectorySeparatorChar}a.csx:line 2
AssertEx.AssertEqualToleratingWhitespaceDifferences($@"
Error!
+ <Initialize>.MoveNext() at {cwd}{Path.DirectorySeparatorChar}a.csx : 2
", result.Errors);
}
}
Expand Down
5 changes: 5 additions & 0 deletions src/Scripting/Core/Hosting/CommandLine/CommandLineRunner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,11 @@ private int RunScript(ScriptOptions options, SourceText code, ErrorLogger errorL
_compiler.ReportErrors(e.Diagnostics, _console.Error, errorLogger);
return CommonCompiler.Failed;
}
catch (Exception e)
{
DisplayException(e);
return e.HResult;
}
}

private void RunInteractiveLoop(ScriptOptions options, string initialScriptCodeOpt, CancellationToken cancellationToken)
Expand Down
7 changes: 7 additions & 0 deletions src/Scripting/Core/Hosting/CommonMemberFilter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@ internal class CommonMemberFilter : MemberFilter
public override bool Include(StackFrame frame)
{
var method = frame.GetMethod();

// TODO (https://github.com/dotnet/roslyn/issues/23101): investigate which submission frames *can* be excluded
if (method.DeclaringType?.FullName.StartsWith("Submission#0").ToThreeState() == ThreeState.True)
{
return true;
}

if (IsHiddenMember(method))
{
return false;
Expand Down

0 comments on commit 4b6ad2a

Please sign in to comment.