1 instantiation of ScriptState
Microsoft.CodeAnalysis.Scripting (1)
Script.cs (1)
584
return new
ScriptState
<T>(executionState, this, result, exceptionOpt?.Value);
152 references to ScriptState
Microsoft.CodeAnalysis.CSharp.Scripting (2)
CSharpScript.cs (2)
98
public static Task<
ScriptState
<T>> RunAsync<T>(string code, ScriptOptions options = null, object globals = null, Type globalsType = null, CancellationToken cancellationToken = default(CancellationToken))
112
public static Task<
ScriptState
<object>> RunAsync(string code, ScriptOptions options = null, object globals = null, Type globalsType = null, CancellationToken cancellationToken = default(CancellationToken))
Microsoft.CodeAnalysis.CSharp.Scripting.Desktop.UnitTests (41)
InteractiveSessionReferencesTests.cs (41)
45
var
s0 = await CSharpScript.RunAsync("", options);
60
var
s0 = await CSharpScript.RunAsync("using System.Diagnostics;", ScriptOptions);
72
var
s0 = await CSharpScript.RunAsync("using System.Diagnostics;", ScriptOptions);
174
var
state = await script.RunAsync().ContinueWith<IEnumerable<int>>("x", options.WithFilePath(null));
186
var
s0 = await CSharpScript.RunAsync<Process>($@"
199
var
s1 = await s0.ContinueWithAsync<System.Xml.XmlDocument>(@"
207
var
s2 = await s1.ContinueWithAsync(@"
215
var
s3 = await s2.ContinueWithAsync<System.Windows.Forms.Form>(@"
501
var
s0 = await CSharpScript.RunAsync<int>("x", options, new C());
515
var
s1 = await s0.ContinueWithAsync($@"
537
var
s0 = await CSharpScript.Create("new C()", options: ScriptOptions.AddReferences(portableLibRef), assemblyLoader: loader).RunAsync();
632
var
s0 = await CSharpScript.RunAsync($@"#r ""{file1.Path}""", ScriptOptions);
633
var
s1 = await s0.ContinueWithAsync($@"var l1 = new Lib1();");
634
var
s2 = await s1.ContinueWithAsync($@"#r ""{file2.Path}""");
635
var
s3 = await s2.ContinueWithAsync($@"var l2 = new Lib2();");
636
var
s4 = await s3.ContinueWithAsync($@"l2.libBase.X");
690
var
s0 = await CSharpScript.RunAsync($@"#r ""{file1.Path}""", ScriptOptions);
691
var
s1 = await s0.ContinueWithAsync($@"var l1 = new Lib1();");
692
var
s2 = await s1.ContinueWithAsync($@"#r ""{file2.Path}""");
693
var
s3 = await s2.ContinueWithAsync($@"var l2 = new Lib2();");
694
var
s4 = await s3.ContinueWithAsync($@"l2.libBase.X");
756
var
s0 = await CSharpScript.RunAsync($@"#r ""{file1.Path}""", ScriptOptions);
757
var
s1 = await s0.ContinueWithAsync($@"var l1 = new Lib1();");
758
var
s2 = await s1.ContinueWithAsync($@"#r ""{file2.Path}""");
824
var
s0 = await CSharpScript.RunAsync($@"#r ""{file1.Path}""", ScriptOptions);
825
var
s1 = await s0.ContinueWithAsync($@"new Lib1().libBase.X");
826
var
s2 = await s1.ContinueWithAsync($@"#r ""{file2.Path}""");
892
var
s0 = await CSharpScript.RunAsync($@"#r ""{file1.Path}""", ScriptOptions);
893
var
s1 = await s0.ContinueWithAsync($@"new Lib1().libBase.X");
894
var
s2 = await s1.ContinueWithAsync($@"#r ""{file2.Path}""");
960
var
s0 = await CSharpScript.RunAsync($@"#r ""{file1.Path}""", ScriptOptions);
961
var
s1 = await s0.ContinueWithAsync($@"new Lib1().libBase.X");
962
var
s2 = await s1.ContinueWithAsync($@"#r ""{file2.Path}""");
1028
var
s0 = await CSharpScript.RunAsync($@"#r ""{file1.Path}""", ScriptOptions);
1029
var
s1 = await s0.ContinueWithAsync($@"var l1 = new Lib1().libBase.X;");
1030
var
s2 = await s1.ContinueWithAsync($@"#r ""{file2.Path}""");
1096
var
s0 = await CSharpScript.RunAsync($@"#r ""{file1.Path}""", ScriptOptions);
1097
var
s1 = await s0.ContinueWithAsync($@"new Lib1().libBase.X");
1099
var
s2 = await s1.ContinueWithAsync($@"#r ""{file2.Path}""");
1100
var
s3 = await s2.ContinueWithAsync($@"new Lib2().libBase.X");
1122
var
s0 = await CSharpScript.RunAsync("C c;", ScriptOptions.WithReferences(libFile.Path));
Microsoft.CodeAnalysis.CSharp.Scripting.UnitTests (68)
InteractiveSessionTests.cs (38)
622
var
s0 = await CSharpScript.RunAsync("int x = 1;", ScriptOptions);
626
var
s1 = await s0.ContinueWithAsync("x = 2; x = 10");
631
var
s2 = await s1.ContinueWithAsync("int y = 2;");
635
var
s3 = await s2.ContinueWithAsync("x + y");
649
var
state0 = await CSharpScript.RunAsync("", options: ScriptOptions, globals: new HostObjectWithOverrides());
651
var
state1 = await state0.ContinueWithAsync<bool>("Equals(null)");
654
var
state2 = await state1.ContinueWithAsync<int>("GetHashCode()");
657
var
state3 = await state2.ContinueWithAsync<string>("ToString()");
664
var
state0 = await CSharpScript.RunAsync("", options: ScriptOptions, globals: new object());
665
var
state1 = await state0.ContinueWithAsync<bool>(@"
672
var
state2 = await state1.ContinueWithAsync<string>("ToString()");
675
var
state3 = await state2.ContinueWithAsync<bool>("Equals(null)");
1043
var
s1 = await CSharpScript.RunAsync<int[]>("new int[] { 1,2,3,4,5,6 }", ScriptOptions);
1046
var
s2 = await s1.ContinueWithAsync<int[]>("new int[] { 1,2,3,4,5,6,7 }", ScriptOptions);
1049
var
s3 = await s2.ContinueWithAsync<int[]>("new int[] { 1,2,3,4,5,6,7,8 }", ScriptOptions);
1093
var
s0 = await CSharpScript.RunAsync(@"
1105
var
s1 = await s0.ContinueWithAsync("F(async () => await Task.FromResult(4))");
1108
var
s2 = await s1.ContinueWithAsync("G(5, async x => await Task.FromResult(x))");
1119
var
state =
1137
var
state =
1152
var
state = await CSharpScript.RunAsync("var x = (false, 4);", ScriptOptions);
1161
var
state = await CSharpScript.RunAsync("object x = 1;", options: options);
1556
var
s0 = await CSharpScript.RunAsync<int>("Z()", options: ScriptOptions, globals: c, globalsType: typeof(I));
1564
var
s1 = await s0.ContinueWithAsync<string>("N");
1930
var
state1 = await s1.RunAsync(catchException: e => true);
1934
var
state2 = await state1.ContinueWithAsync<int>("F()");
1957
var
state2 = await s2.RunAsync(catchException: e => true);
1961
var
state3 = await state2.ContinueWithAsync<int>("F()");
1985
var
state3 = await s3.RunAsync(catchException: e => true);
1989
var
state4 = await state3.ContinueWithAsync<int>("F()");
1998
var
state0 = await CSharpScript.RunAsync(@"
2001
var
state1 = await state0.ContinueWithAsync(@"
2009
var
state2 = await state1.ContinueWithAsync<int>(@"
2017
var
state4 = await state2.ContinueWithAsync(@"
2048
var
state3 = await s3.RunAsync(globals, catchException: e => true, cancellationToken: cancellationSource.Token);
2052
var
state4 = await state3.ContinueWithAsync<int>("F()");
2082
var
state3 = await s3.RunAsync(globals, catchException: e => true, cancellationToken: cancellationSource.Token);
2086
var
state4 = await state3.ContinueWithAsync<int>("F()");
ScriptTests.cs (30)
65
var
state = await CSharpScript.RunAsync("1 + 2", options: ScriptOptions, globals: new ScriptTests());
73
var
state = await CSharpScript.RunAsync("1 + 2", options: ScriptOptions, globals: new ScriptTests());
132
var
state = await CSharpScript.RunAsync("1 + 2", ScriptOptions);
140
var
state = await script.RunAsync();
149
var
state = await script.RunAsync();
164
var
state = await CSharpScript.RunAsync("1 + 2", ScriptOptions);
171
var
state = ScriptingTestHelpers.RunScriptWithOutput(
180
var
state = await CSharpScript.RunAsync(
290
var
state = await CSharpScript.RunAsync("X + Y", options: ScriptOptions, globals: new Globals { X = 1, Y = 2 });
298
var
state = await script.RunAsync(new Globals { X = 1, Y = 2 });
333
var
state = await CSharpScript.RunAsync("X + Y", options: ScriptOptions, globals: new Globals());
341
var
state1 = await CSharpScript.RunAsync("X + Y + 1", options: ScriptOptions, globals: new Globals());
342
var
state2 = await CSharpScript.RunAsync("X + Y + 2", options: ScriptOptions, globals: new Globals());
351
var
state = await CSharpScript.RunAsync("int X = 100;", ScriptOptions).ContinueWith("X + X");
365
var
state = await CSharpScript.RunAsync("", ScriptOptions);
401
var
state = await script.RunAsync(globals);
421
var
s1 = await script.RunAsync();
430
var
s3 = await s1.ContinueWithAsync("x");
438
var
state = await CSharpScript.RunAsync(@"
459
var
state1 = await CSharpScript.RunAsync("int M(int x) { return x + x; }", ScriptOptions);
463
var
state2 = await state1.ContinueWithAsync("int M(int x) { return x * x; } M(5)");
468
var
state3 = await state1.ContinueWithAsync("M(5)");
475
var
state0 = await CSharpScript.RunAsync("static int Add(int x, int y) => x + y;", options: ScriptOptions.WithLanguageVersion(LanguageVersion.Preview));
476
var
state1 = await state0.ContinueWithAsync("System.Func<int, int, int> adder = Add;");
477
var
state2 = await state1.ContinueWithAsync("adder(1, 1)");
484
var
state0 = await CSharpScript.RunAsync("class Id<T> { static T Core(T t) => t; public static System.Func<T, T> Get => Core; }", ScriptOptions);
485
var
state1 = await state0.ContinueWithAsync("Id<int>.Get(1)");
492
var
state0 = await CSharpScript.RunAsync("class Id { static T Core<T>(T t) => t; public static System.Func<T, T> Get<T>() => Core; }", ScriptOptions);
493
var
state1 = await state0.ContinueWithAsync("Id.Get<int>()(1)");
852
var
script = await CSharpScript.RunAsync(code, opts);
Microsoft.CodeAnalysis.InteractiveHost (12)
Interactive\Core\InteractiveHost.Service.cs (12)
69
internal readonly
ScriptState
<object>? ScriptState;
73
ScriptState
<object>? scriptState,
90
internal EvaluationState WithScriptState(
ScriptState
<object> state)
373
var
newScriptState = await ExecuteOnUIThreadAsync(script, state.ScriptState, displayResult: true).ConfigureAwait(false);
587
var
newScriptState = await TryExecuteFileAsync(rspState, initializationScriptPath).ConfigureAwait(false);
685
var
newScriptState = await TryExecuteFileAsync(state, fullPath).ConfigureAwait(false);
702
private async Task<
ScriptState
<object>?> TryExecuteFileAsync(EvaluationState state, string fullPath)
748
private Task<
ScriptState
<object>> ExecuteOnUIThreadAsync(Script<object> script,
ScriptState
<object>? state, bool displayResult)
750
return (Task<
ScriptState
<object>>)_invokeOnMainThread((Func<Task<
ScriptState
<object>>>)(async () =>
758
var
newState = await task.ConfigureAwait(false);
Microsoft.CodeAnalysis.Scripting (15)
Hosting\CommandLine\CommandLineRunner.cs (2)
229
ScriptState
<object>? state = null;
296
private void BuildAndRun(Script<object> newScript, InteractiveScriptGlobals globals, ref
ScriptState
<object>? state, ref ScriptOptions options, bool displayResult, CancellationToken cancellationToken)
Script.cs (8)
382
=> RunAsync(globals, catchException, cancellationToken).CastAsync<
ScriptState
<T>, ScriptState>();
385
=> RunFromAsync(previousState, catchException, cancellationToken).CastAsync<
ScriptState
<T>, ScriptState>();
469
public new Task<
ScriptState
<T>> RunAsync(object globals, CancellationToken cancellationToken)
487
public new Task<
ScriptState
<T>> RunAsync(object globals = null, Func<Exception, bool> catchException = null, CancellationToken cancellationToken = default(CancellationToken))
530
public new Task<
ScriptState
<T>> RunFromAsync(ScriptState previousState, CancellationToken cancellationToken)
547
public new Task<
ScriptState
<T>> RunFromAsync(ScriptState previousState, Func<Exception, bool> catchException = null, CancellationToken cancellationToken = default(CancellationToken))
560
return Task.FromResult((
ScriptState
<T>)previousState);
575
private async Task<
ScriptState
<T>> RunSubmissionsAsync(
ScriptState.cs (4)
142
public Task<
ScriptState
<object>> ContinueWithAsync(string code, ScriptOptions options, CancellationToken cancellationToken)
156
public Task<
ScriptState
<object>> ContinueWithAsync(string code, ScriptOptions options = null, Func<Exception, bool> catchException = null, CancellationToken cancellationToken = default(CancellationToken))
166
public Task<
ScriptState
<TResult>> ContinueWithAsync<TResult>(string code, ScriptOptions options, CancellationToken cancellationToken)
180
public Task<
ScriptState
<TResult>> ContinueWithAsync<TResult>(string code, ScriptOptions options = null, Func<Exception, bool> catchException = null, CancellationToken cancellationToken = default(CancellationToken))
Utilities\TaskExtensions.cs (1)
19
internal static async Task<T> GetEvaluationResultAsync<T>(this Task<
ScriptState
<T>> task)
Microsoft.CodeAnalysis.Scripting.TestUtilities (12)
ScriptingTestHelpers.cs (4)
19
public static
ScriptState
<T> RunScriptWithOutput<T>(Script<T> script, string expectedOutput)
23
ScriptState
<T> result = null;
49
public static void ContinueRunScriptWithOutput<T>(Task<
ScriptState
<T>> scriptState, string code, string expectedOutput)
70
internal static void AssertCompilationError<T>(Task<
ScriptState
<T>> state, string code, params DiagnosticDescription[] expectedDiagnostics)
ScriptTaskExtensions.cs (8)
15
public static async Task<
ScriptState
<object>> ContinueWith(this Task<ScriptState> task, string code, ScriptOptions options = null, CancellationToken cancellationToken = default(CancellationToken))
20
public static async Task<
ScriptState
<object>> ContinueWith(this Task<
ScriptState
<object>> task, string code, ScriptOptions options = null, CancellationToken cancellationToken = default(CancellationToken))
25
public static async Task<
ScriptState
<T>> ContinueWith<T>(this Task<ScriptState> task, string code, ScriptOptions options = null, CancellationToken cancellationToken = default(CancellationToken))
30
public static async Task<
ScriptState
<T>> ContinueWith<T>(this Task<
ScriptState
<object>> task, string code, ScriptOptions options = null, CancellationToken cancellationToken = default(CancellationToken))
35
public static async Task<
ScriptState
<object>> ContinueWith<S>(this Task<
ScriptState
<S>> task, string code, ScriptOptions options = null, CancellationToken cancellationToken = default(CancellationToken))
Microsoft.CodeAnalysis.VisualBasic.Scripting (2)
VisualBasicScript.vb (2)
46
Optional cancellationToken As CancellationToken = Nothing) As Task(Of
ScriptState
(Of T))
56
Optional cancellationToken As CancellationToken = Nothing) As Task(Of
ScriptState
(Of Object))