本文整理汇总了C#中RemoteAsyncOperation类的典型用法代码示例。如果您正苦于以下问题:C# RemoteAsyncOperation类的具体用法?C# RemoteAsyncOperation怎么用?C# RemoteAsyncOperation使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RemoteAsyncOperation类属于命名空间,在下文中一共展示了RemoteAsyncOperation类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: SetPathsAsync
public void SetPathsAsync(
RemoteAsyncOperation<RemoteExecutionResult> operation,
string[] referenceSearchPaths,
string[] sourceSearchPaths,
string baseDirectory)
{
Debug.Assert(operation != null);
Debug.Assert(referenceSearchPaths != null);
Debug.Assert(sourceSearchPaths != null);
Debug.Assert(baseDirectory != null);
lock (_lastTaskGuard)
{
_lastTask = SetPathsAsync(_lastTask, operation, referenceSearchPaths, sourceSearchPaths, baseDirectory);
}
}
开发者ID:XieShuquan,项目名称:roslyn,代码行数:16,代码来源:InteractiveHost.Service.cs
示例2: AddReferenceAsync
private async Task<TaskResult> AddReferenceAsync(Task<TaskResult> lastTask, RemoteAsyncOperation<bool> operation, string reference)
{
var result = await ReportUnhandledExceptionIfAny(lastTask).ConfigureAwait(false);
var success = false;
var options = result.Options;
try
{
string fullPath = ResolveReferencePath(options, reference, baseFilePath: null);
if (fullPath != null)
{
success = LoadReference(fullPath, suppressWarnings: false, addReference: true, options: ref options);
}
else
{
Console.Error.WriteLine(string.Format(FeaturesResources.CannotResolveReference, reference));
}
}
catch (Exception e)
{
ReportUnhandledException(e);
}
finally
{
operation.Completed(success);
}
return result.With(options);
}
开发者ID:noahstein,项目名称:roslyn,代码行数:27,代码来源:InteractiveHost.Service.cs
示例3: ExecuteFileAsync
private async Task<EvaluationState> ExecuteFileAsync(
RemoteAsyncOperation<RemoteExecutionResult> operation,
Task<EvaluationState> lastTask,
string path)
{
var state = await ReportUnhandledExceptionIfAny(lastTask).ConfigureAwait(false);
var success = false;
try
{
var fullPath = ResolveRelativePath(path, state.WorkingDirectory, state.SourceSearchPaths, displayPath: false);
var newScriptState = await ExecuteFileAsync(state, fullPath).ConfigureAwait(false);
if (newScriptState != null)
{
success = true;
state = state.WithScriptState(newScriptState);
}
}
finally
{
state = CompleteExecution(state, operation, success);
}
return state;
}
开发者ID:MichalStrehovsky,项目名称:roslyn,代码行数:25,代码来源:InteractiveHost.Service.cs
示例4: ExecuteFileAsync
public void ExecuteFileAsync(RemoteAsyncOperation<RemoteExecutionResult> operation, string path)
{
Debug.Assert(operation != null);
Debug.Assert(path != null);
lock (_lastTaskGuard)
{
_lastTask = ExecuteFileAsync(operation, _lastTask, path);
}
}
开发者ID:XieShuquan,项目名称:roslyn,代码行数:10,代码来源:InteractiveHost.Service.cs
示例5: InitializeContextAsync
/// <summary>
/// Loads references, set options and execute files specified in the initialization file.
/// Also prints logo unless <paramref name="isRestarting"/> is true.
/// </summary>
private async Task<EvaluationState> InitializeContextAsync(
Task<EvaluationState> lastTask,
RemoteAsyncOperation<RemoteExecutionResult> operation,
string initializationFileOpt,
bool isRestarting)
{
Debug.Assert(initializationFileOpt == null || PathUtilities.IsAbsolute(initializationFileOpt));
var state = await ReportUnhandledExceptionIfAny(lastTask).ConfigureAwait(false);
try
{
// TODO (tomat): this is also done in CommonInteractiveEngine, perhaps we can pass the parsed command lines to here?
if (!isRestarting)
{
Console.Out.WriteLine(_replServiceProvider.Logo);
}
if (File.Exists(initializationFileOpt))
{
Console.Out.WriteLine(string.Format(FeaturesResources.Loading_context_from_0, Path.GetFileName(initializationFileOpt)));
var parser = _replServiceProvider.CommandLineParser;
// The base directory for relative paths is the directory that contains the .rsp file.
// Note that .rsp files included by this .rsp file will share the base directory (Dev10 behavior of csc/vbc).
var rspDirectory = Path.GetDirectoryName(initializationFileOpt);
var args = parser.Parse(new[] { "@" + initializationFileOpt }, rspDirectory, RuntimeEnvironment.GetRuntimeDirectory(), null);
foreach (var error in args.Errors)
{
var writer = (error.Severity == DiagnosticSeverity.Error) ? Console.Error : Console.Out;
writer.WriteLine(error.GetMessage(CultureInfo.CurrentCulture));
}
if (args.Errors.Length == 0)
{
var metadataResolver = CreateMetadataReferenceResolver(args.ReferencePaths, rspDirectory);
var sourceResolver = CreateSourceReferenceResolver(args.SourcePaths, rspDirectory);
var metadataReferences = new List<PortableExecutableReference>();
foreach (CommandLineReference cmdLineReference in args.MetadataReferences)
{
// interactive command line parser doesn't accept modules or linked assemblies
Debug.Assert(cmdLineReference.Properties.Kind == MetadataImageKind.Assembly && !cmdLineReference.Properties.EmbedInteropTypes);
var resolvedReferences = metadataResolver.ResolveReference(cmdLineReference.Reference, baseFilePath: null, properties: MetadataReferenceProperties.Assembly);
if (!resolvedReferences.IsDefaultOrEmpty)
{
metadataReferences.AddRange(resolvedReferences);
}
}
var scriptPathOpt = args.SourceFiles.IsEmpty ? null : args.SourceFiles[0].Path;
var rspState = new EvaluationState(
state.ScriptStateOpt,
state.ScriptOptions.
WithFilePath(scriptPathOpt).
WithReferences(metadataReferences).
WithImports(CommandLineHelpers.GetImports(args)).
WithMetadataResolver(metadataResolver).
WithSourceResolver(sourceResolver),
args.SourcePaths,
args.ReferencePaths,
rspDirectory);
_globals.ReferencePaths.Clear();
_globals.ReferencePaths.AddRange(args.ReferencePaths);
_globals.SourcePaths.Clear();
_globals.SourcePaths.AddRange(args.SourcePaths);
_globals.Args.AddRange(args.ScriptArguments);
if (scriptPathOpt != null)
{
var newScriptState = await TryExecuteFileAsync(rspState, scriptPathOpt).ConfigureAwait(false);
if (newScriptState != null)
{
// remove references and imports from the options, they have been applied and will be inherited from now on:
rspState = rspState.
WithScriptState(newScriptState).
WithOptions(rspState.ScriptOptions.RemoveImportsAndReferences());
}
}
state = rspState;
}
}
if (!isRestarting)
{
Console.Out.WriteLine(FeaturesResources.Type_Sharphelp_for_more_information);
}
}
//.........这里部分代码省略.........
开发者ID:XieShuquan,项目名称:roslyn,代码行数:101,代码来源:InteractiveHost.Service.cs
示例6: AddReferenceAsync
public void AddReferenceAsync(RemoteAsyncOperation<bool> operation, string reference)
{
Debug.Assert(operation != null);
Debug.Assert(reference != null);
lock (_lastTaskGuard)
{
_lastTask = AddReferenceAsync(_lastTask, operation, reference);
}
}
开发者ID:XieShuquan,项目名称:roslyn,代码行数:10,代码来源:InteractiveHost.Service.cs
示例7: ExecuteAsync
public void ExecuteAsync(RemoteAsyncOperation<RemoteExecutionResult> operation, string text)
{
Debug.Assert(operation != null);
Debug.Assert(text != null);
lock (_lastTaskGuard)
{
_lastTask = ExecuteAsync(_lastTask, operation, text);
}
}
开发者ID:XieShuquan,项目名称:roslyn,代码行数:10,代码来源:InteractiveHost.Service.cs
示例8: InitializeContextAsync
public void InitializeContextAsync(RemoteAsyncOperation<RemoteExecutionResult> operation, string initializationFile, bool isRestarting)
{
Debug.Assert(operation != null);
var success = false;
try
{
InitializeContext(initializationFile, isRestarting);
success = true;
}
catch (Exception e)
{
ReportUnhandledException(e);
}
finally
{
CompleteExecution(operation, success);
}
}
开发者ID:WiiGe,项目名称:roslyn,代码行数:20,代码来源:InteractiveHost.Service.cs
示例9: AddReferenceAsync
public void AddReferenceAsync(RemoteAsyncOperation<bool> operation, string reference)
{
Debug.Assert(operation != null);
Debug.Assert(reference != null);
var success = false;
try
{
// TODO (tomat): This lock blocks all other session operations.
// We should be able to run multiple assembly resolutions and code execution in parallel.
string fullPath;
lock (_sessionGuard)
{
fullPath = ResolveReferencePath(reference, baseFilePath: null);
if (fullPath != null)
{
success = LoadReference(fullPath, suppressWarnings: false, addReference: true);
}
}
if (fullPath == null)
{
Console.Error.WriteLine(string.Format(FeaturesResources.CannotResolveReference, reference));
}
}
catch (Exception e)
{
ReportUnhandledException(e);
}
finally
{
operation.Completed(success);
}
}
开发者ID:WiiGe,项目名称:roslyn,代码行数:34,代码来源:InteractiveHost.Service.cs
示例10: ExecuteFileAsync
private async Task<TaskResult> ExecuteFileAsync(
RemoteAsyncOperation<RemoteExecutionResult> operation,
Task<TaskResult> lastTask,
Func<ScriptOptions, string> getFullPath)
{
var result = await ReportUnhandledExceptionIfAny(lastTask).ConfigureAwait(false);
var success = false;
try
{
var fullPath = getFullPath(result.Options);
var executeResult = await ExecuteFileAsync(result, fullPath).ConfigureAwait(false);
result = executeResult.Result;
success = executeResult.Success;
}
finally
{
result = CompleteExecution(result, operation, success);
}
return result;
}
开发者ID:noahstein,项目名称:roslyn,代码行数:20,代码来源:InteractiveHost.Service.cs
示例11: SetPathsAsync
public void SetPathsAsync(
RemoteAsyncOperation<object> operation,
string[] referenceSearchPaths,
string[] sourceSearchPaths,
string baseDirectory)
{
Debug.Assert(operation != null);
Debug.Assert(referenceSearchPaths != null);
Debug.Assert(sourceSearchPaths != null);
Debug.Assert(baseDirectory != null);
lock (_sessionGuard)
{
_hostObject.ReferencePaths.Clear();
_hostObject.ReferencePaths.AddRange(referenceSearchPaths);
_options = _options.WithSearchPaths(referenceSearchPaths).WithBaseDirectory(baseDirectory);
_hostObject.SourcePaths.Clear();
_hostObject.SourcePaths.AddRange(sourceSearchPaths);
_sourceSearchPaths = sourceSearchPaths.AsImmutable();
Directory.SetCurrentDirectory(baseDirectory);
}
operation.Completed(null);
}
开发者ID:WiiGe,项目名称:roslyn,代码行数:26,代码来源:InteractiveHost.Service.cs
示例12: InitializeContextAsync
/// <summary>
/// Loads references, set options and execute files specified in the initialization file.
/// Also prints logo unless <paramref name="isRestarting"/> is true.
/// </summary>
private async Task<TaskResult> InitializeContextAsync(
Task<TaskResult> lastTask,
RemoteAsyncOperation<RemoteExecutionResult> operation,
string initializationFileOpt,
bool isRestarting)
{
Debug.Assert(initializationFileOpt == null || PathUtilities.IsAbsolute(initializationFileOpt));
var result = await ReportUnhandledExceptionIfAny(lastTask).ConfigureAwait(false);
try
{
// TODO (tomat): this is also done in CommonInteractiveEngine, perhaps we can pass the parsed command lines to here?
if (!isRestarting)
{
Console.Out.WriteLine(_repl.GetLogo());
}
if (File.Exists(initializationFileOpt))
{
Console.Out.WriteLine(string.Format(FeaturesResources.LoadingContextFrom, Path.GetFileName(initializationFileOpt)));
var parser = _repl.GetCommandLineParser();
// The base directory for relative paths is the directory that contains the .rsp file.
// Note that .rsp files included by this .rsp file will share the base directory (Dev10 behavior of csc/vbc).
var rspDirectory = Path.GetDirectoryName(initializationFileOpt);
var args = parser.Parse(new[] { "@" + initializationFileOpt }, rspDirectory, RuntimeEnvironment.GetRuntimeDirectory(), null /* TODO: pass a valid value*/);
foreach (var error in args.Errors)
{
var writer = (error.Severity == DiagnosticSeverity.Error) ? Console.Error : Console.Out;
writer.WriteLine(error.GetMessage(CultureInfo.CurrentCulture));
}
if (args.Errors.Length == 0)
{
// TODO (tomat): other arguments
// TODO (tomat): parse options
var referencePaths = args.ReferencePaths;
result = result.With(result.Options.AddSearchPaths(referencePaths));
_hostObject.ReferencePaths.Clear();
_hostObject.ReferencePaths.AddRange(referencePaths);
// TODO (tomat): consolidate with other reference resolving
foreach (CommandLineReference cmdLineReference in args.MetadataReferences)
{
// interactive command line parser doesn't accept modules or linked assemblies
Debug.Assert(cmdLineReference.Properties.Kind == MetadataImageKind.Assembly && !cmdLineReference.Properties.EmbedInteropTypes);
var options = result.Options;
string fullPath = ResolveReferencePath(options, cmdLineReference.Reference, baseFilePath: null);
LoadReference(fullPath, suppressWarnings: true, addReference: true, options: ref options);
result = result.With(options);
}
foreach (CommandLineSourceFile file in args.SourceFiles)
{
// execute all files as scripts (matches csi/vbi semantics)
string fullPath = ResolveRelativePath(file.Path, rspDirectory, displayPath: true);
if (fullPath != null)
{
var executeResult = await ExecuteFileAsync(result, fullPath).ConfigureAwait(false);
result = executeResult.Result;
}
}
}
}
if (!isRestarting)
{
Console.Out.WriteLine(FeaturesResources.TypeHelpForMoreInformation);
}
}
catch (Exception e)
{
ReportUnhandledException(e);
}
finally
{
result = CompleteExecution(result, operation, true);
}
return result;
}
开发者ID:noahstein,项目名称:roslyn,代码行数:90,代码来源:InteractiveHost.Service.cs
示例13: ExecuteAsync
private async Task<TaskResult> ExecuteAsync(Task<TaskResult> lastTask, RemoteAsyncOperation<RemoteExecutionResult> operation, string text)
{
var result = await ReportUnhandledExceptionIfAny(lastTask).ConfigureAwait(false);
var success = false;
try
{
Script<object> script;
try
{
var options = result.Options;
var state = result.State;
script = Compile(state, text, null, ref options);
result = new TaskResult(options, state);
}
catch (CompilationErrorException e)
{
DisplayInteractiveErrors(e.Diagnostics, Console.Error);
script = null;
}
if (script != null)
{
success = true; // successful if compiled
var executeResult = await ExecuteOnUIThread(result, script).ConfigureAwait(false);
result = executeResult.Result;
if (executeResult.Success)
{
bool hasValue;
var resultType = script.GetCompilation().GetSubmissionResultType(out hasValue);
if (hasValue)
{
if (resultType != null && resultType.SpecialType == SpecialType.System_Void)
{
Console.Out.WriteLine(_objectFormatter.VoidDisplayString);
}
else
{
Console.Out.WriteLine(_objectFormatter.FormatObject(executeResult.Value, _formattingOptions));
}
}
}
}
}
catch (Exception e)
{
ReportUnhandledException(e);
}
finally
{
result = CompleteExecution(result, operation, success);
}
return result;
}
开发者ID:noahstein,项目名称:roslyn,代码行数:57,代码来源:InteractiveHost.Service.cs
示例14: ExecuteAsync
public void ExecuteAsync(RemoteAsyncOperation<RemoteExecutionResult> operation, string text)
{
Debug.Assert(operation != null);
Debug.Assert(text != null);
var success = false;
try
{
success = Execute(text);
}
catch (Exception e)
{
ReportUnhandledException(e);
}
finally
{
CompleteExecution(operation, success);
}
}
开发者ID:WiiGe,项目名称:roslyn,代码行数:19,代码来源:InteractiveHost.Service.cs
示例15: ExecuteFileAsync
public void ExecuteFileAsync(RemoteAsyncOperation<RemoteExecutionResult> operation, string path)
{
Debug.Assert(operation != null);
Debug.Assert(path != null);
string fullPath = null;
bool success = false;
try
{
fullPath = ResolveRelativePath(path, _options.BaseDirectory, displayPath: false);
success = fullPath != null && ExecuteFile(fullPath);
}
catch (Exception e)
{
ReportUnhandledException(e);
}
finally
{
CompleteExecution(operation, success, fullPath);
}
}
开发者ID:WiiGe,项目名称:roslyn,代码行数:21,代码来源:InteractiveHost.Service.cs
示例16: CompleteExecution
private void CompleteExecution(RemoteAsyncOperation<RemoteExecutionResult> operation, bool success, string resolvedPath = null)
{
// TODO (tomat): we should be resetting this info just before the execution to ensure that the services see the same
// as the next execution.
// send any updates to the host object and current directory back to the client:
var newSourcePaths = _hostObject.SourcePaths.List.GetNewContent();
var newReferencePaths = _hostObject.ReferencePaths.List.GetNewContent();
var currentDirectory = Directory.GetCurrentDirectory();
var oldWorkingDirectory = _options.BaseDirectory;
var newWorkingDirectory = (oldWorkingDirectory != currentDirectory) ? currentDirectory : null;
// update local search paths, the client updates theirs on operation completion:
if (newSourcePaths != null)
{
_sourceSearchPaths = newSourcePaths.AsImmutable();
}
if (newReferencePaths != null)
{
_options = _options.WithSearchPaths(newReferencePaths);
}
_options = _options.WithBaseDirectory(currentDirectory);
operation.Completed(new RemoteExecutionResult(success, newSourcePaths, newReferencePaths, newWorkingDirectory, resolvedPath));
}
开发者ID:WiiGe,项目名称:roslyn,代码行数:28,代码来源:InteractiveHost.Service.cs
示例17: ExecuteAsync
private async Task<EvaluationState> ExecuteAsync(Task<EvaluationState> lastTask, RemoteAsyncOperation<RemoteExecutionResult> operation, string text)
{
var state = await ReportUnhandledExceptionIfAny(lastTask).ConfigureAwait(false);
bool success = false;
try
{
Script<object> script = TryCompile(state.ScriptStateOpt?.Script, text, null, state.ScriptOptions);
if (script != null)
{
// successful if compiled
success = true;
var newScriptState = await ExecuteOnUIThread(script, state.ScriptStateOpt).ConfigureAwait(false);
if (newScriptState != null)
{
DisplaySubmissionResult(newScriptState);
state = state.WithScriptState(newScriptState);
}
}
}
catch (Exception e)
{
ReportUnhandledException(e);
}
finally
{
state = CompleteExecution(state, operation, success);
}
return state;
}
开发者ID:MichalStrehovsky,项目名称:roslyn,代码行数:32,代码来源:InteractiveHost.Service.cs
示例18: CompleteExecution
private EvaluationState CompleteExecution(EvaluationState state, RemoteAsyncOperation<RemoteExecutionResult> operation, bool success)
{
// send any updates to the host object and current directory back to the client:
var currentSourcePaths = _globals.SourcePaths.ToArray();
var currentReferencePaths = _globals.ReferencePaths.ToArray();
var currentWorkingDirectory = Directory.GetCurrentDirectory();
var changedSourcePaths = currentSourcePaths.SequenceEqual(state.SourceSearchPaths) ? null : currentSourcePaths;
var changedReferencePaths = currentReferencePaths.SequenceEqual(state.ReferenceSearchPaths) ? null : currentReferencePaths;
var changedWorkingDirectory = currentWorkingDirectory == state.WorkingDirectory ? null : currentWorkingDirectory;
operation.Completed(new RemoteExecutionResult(success, changedSourcePaths, changedReferencePaths, changedWorkingDirectory));
// no changes in resolvers:
if (changedReferencePaths == null && changedSourcePaths == null && changedWorkingDirectory == null)
{
return state;
}
var newSourcePaths = ImmutableArray.CreateRange(currentSourcePaths);
var newReferencePaths = ImmutableArray.CreateRange(currentReferencePaths);
var newWorkingDirectory = currentWorkingDirectory;
ScriptOptions newOptions = state.ScriptOptions;
if (changedReferencePaths != null || changedWorkingDirectory != null)
{
newOptions = newOptions.WithMetadataResolver(CreateMetadataReferenceResolver(newReferencePaths, newWorkingDirectory));
}
if (changedSourcePaths != null || changedWorkingDirectory != null)
{
newOptions = newOptions.WithSourceResolver(CreateSourceReferenceResolver(newSourcePaths, newWorkingDirectory));
}
return new EvaluationState(
state.ScriptStateOpt,
newOptions,
newSourcePaths,
newReferencePaths,
workingDirectory: newWorkingDirectory);
}
开发者ID:XieShuquan,项目名称:roslyn,代码行数:41,代码来源:InteractiveHost.Service.cs
示例19: InitializeContextAsync
/// <summary>
/// Loads references, set options and execute files specified in the initialization file.
/// Also prints logo unless <paramref name="isRestarting"/> is true.
/// </summary>
private async Task<EvaluationState> InitializeContextAsync(
Task<EvaluationState> lastTask,
RemoteAsyncOperation<RemoteExecutionResult> operation,
string initializationFileOpt,
bool isRestarting)
{
Debug.Assert(initializationFileOpt == null || PathUtilities.IsAbsolute(initializationFileOpt));
var state = await ReportUnhandledExceptionIfAny(lastTask).ConfigureAwait(false);
try
{
// TODO (tomat): this is also done in CommonInteractiveEngine, perhaps we can pass the parsed command lines to here?
if (!isRestarting)
{
Console.Out.WriteLine(_replServiceProvider.Logo);
}
if (File.Exists(initializationFileOpt))
{
Console.Out.WriteLine(string.Format(FeaturesResources.LoadingContextFrom, Path.GetFileName(initializationFileOpt)));
var parser = _replServiceProvider.CommandLineParser;
// The base directory for relative paths is the directory that contains the .rsp file.
// Note that .rsp files included by this .rsp file will share the base directory (Dev10 behavior of csc/vbc).
var rspDirectory = Path.GetDirectoryName(initializationFileOpt);
var args = parser.Parse(new[] { "@" + initializationFileOpt }, rspDirectory, RuntimeEnvironment.GetRuntimeDirectory(), null /* TODO: pass a valid value*/);
foreach (var error in args.Errors)
{
var writer = (error.Severity == DiagnosticSeverity.Error) ? Console.Error : Console.Out;
writer.WriteLine(error.GetMessage(CultureInfo.CurrentCulture));
}
if (args.Errors.Length == 0)
{
// TODO (tomat): other arguments
// TODO (tomat): parse options
var metadataResolver = CreateMetadataReferenceResolver(args.ReferencePaths, rspDirectory);
_hostObject.ReferencePaths.Clear();
_hostObject.ReferencePaths.AddRange(args.ReferencePaths);
_hostObject.SourcePaths.Clear();
var metadataReferences = new List<PortableExecutableReference>();
foreach (CommandLineReference cmdLineReference in args.MetadataReferences)
{
// interactive command line parser doesn't accept modules or linked assemblies
Debug.Assert(cmdLineReference.Properties.Kind == MetadataImageKind.Assembly && !cmdLineReference.Properties.EmbedInteropTypes);
var resolvedReferences = metadataResolver.ResolveReference(cmdLineReference.Reference, baseFilePath: null, properties: MetadataReferenceProperties.Assembly);
if (!resolvedReferences.IsDefaultOrEmpty)
{
metadataReferences.AddRange(resolvedReferences);
}
}
// only search for scripts next to the .rsp file:
var sourceSearchPaths = ImmutableArray<string>.Empty;
var rspState = new EvaluationState(
state.ScriptStateOpt,
state.ScriptOptions.AddReferences(metadataReferences),
sourceSearchPaths,
args.ReferencePaths,
rspDirectory);
foreach (CommandLineSourceFile file in args.SourceFiles)
{
// execute all files as scripts (matches csi/vbi semantics)
string fullPath = ResolveRelativePath(file.Path, rspDirectory, sourceSearchPaths, displayPath: true);
if (fullPath != null)
{
var newScriptState = await ExecuteFileAsync(rspState, fullPath).ConfigureAwait(false);
if (newScriptState != null)
{
rspState = rspState.WithScriptState(newScriptState);
}
}
}
state = new EvaluationState(
rspState.ScriptStateOpt,
rspState.ScriptOptions,
ImmutableArray<string>.Empty,
args.ReferencePaths,
state.WorkingDirectory);
}
}
if (!isRestarting)
{
//.........这里部分代码省略.........
开发者ID:MichalStrehovsky,项目名称:roslyn,代码行数:101,代码来源:InteractiveHost.Service.cs
示例20: SetPathsAsync
private async Task<TaskResult> SetPathsAsync(
Task<TaskResult> lastTask,
RemoteAsyncOperation<object> operation,
string[] referenceSearchPaths,
string[] sourceSearchPaths,
string baseDirectory)
{
var result = await ReportUnhandledExceptionIfAny(lastTask).ConfigureAwait(false);
var options = result.Options;
try
{
Directory.SetCurrentDirectory(baseDirectory);
_hostObject.ReferencePaths.Clear();
_hostObject.ReferencePaths.AddRange(referenceSearchPaths);
options = options.WithSearchPaths(referenceSearchPaths).WithBaseDirectory(baseDirectory);
_hostObject.SourcePaths.Clear();
_hostObject.SourcePaths.AddRange(sourceSearchPaths);
_sourceSearchPaths = sourceSearchPaths.AsImmutable();
}
finally
{
operation.Completed(null);
}
return result.With(options);
}
开发者ID:noahstein,项目名称:roslyn,代码行数:27,代码来源:InteractiveHost.Service.cs
注:本文中的RemoteAsyncOperation类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论