private static Task Dispatch <T>(StreamJsonRpc.JsonRpc jsonRpc, TestContext?testContext, string message, T param) { if (testContext?.ForceSynchronousMessages == true) { // If we need to force messages to be synchronous, then we always // do 'invoke' instead of 'notify', and we always wait for the task // to finish jsonRpc.InvokeWithParameterObjectAsync <object>(message, param).GetAwaiter().GetResult(); // Return a 'do nothing' task in this case return(Task.FromResult(0)); } return(jsonRpc.NotifyWithParameterObjectAsync(message, param)); }
/// <inheritdoc /> public void WriteLine(EventLevel level, string message) { m_pushRpc .NotifyWithParameterObjectAsync(TraceTargetName, LogMessageParams.Create(level, message)) .IgnoreErrorsAndReturnCompletion(); }
/// <inheritdoc /> public void ReportFindReferencesProgress(FindReferenceProgressParams findReferenceProgress) { Analysis.IgnoreResult(m_mainRpcChannel?.NotifyWithParameterObjectAsync("dscript/findReferenceProgress", findReferenceProgress), "Fire and forget"); }
/// <inheritdoc /> public void ReportWorkspaceFailure(string logFileName, Action openLogFileAction) { Analysis.IgnoreResult(m_mainRpcChannel.NotifyWithParameterObjectAsync("dscript/workspaceLoading", WorkspaceLoadingParams.Fail()), "Fire and forget"); }