private void SessionEnded_Handler(object sender, SessionEndEventArgs e) { string tmpAttachment = Path.Combine(_tempDirectoryPath, Guid.NewGuid().ToString("N"), "DataCollectorAttachmentProcessor_1.txt"); Directory.CreateDirectory(Path.GetDirectoryName(tmpAttachment)); File.WriteAllText(tmpAttachment, $"SessionEnded_Handler_{Guid.NewGuid():N}"); _dataCollectionSink.SendFileAsync(_context.SessionDataCollectionContext, tmpAttachment, true); }
private void OnSessionEnd(object sender, SessionEndEventArgs e) { Trace.TraceInformation("Session ended"); mSessionEnded(); mFileWriterThing.LastOrDefaultAsync().Wait(); mDataSink.SendFileAsync(e.Context, mDataFilePath, true); }
/// <summary> /// Sends attachment file to test platform /// </summary> /// <param name="attachmentPath">Attachment file path</param> private void SendAttachment(string attachmentPath) { if (_fileHelper.Exists(attachmentPath)) { // Send coverage attachment to test platform. _eqtTrace.Verbose("{0}: Sending attachment to test platform", CoverletConstants.DataCollectorName); _dataSink.SendFileAsync(_dataCollectionContext, attachmentPath, false); } else { _eqtTrace.Warning("{0}: Attachment file does not exist", CoverletConstants.DataCollectorName); } }
private void Events_SessionEnd(object sender, SessionEndEventArgs e) { try { foreach (var file in Directory.GetFiles(_traceDirectory)) { _logger.LogWarning(e.Context, $"Saving event pipe session: {file}"); _dataSink.SendFileAsync(e.Context, file, deleteFile: true); } } catch (Exception ex) { _logger.LogError(e.Context, "Error during SessionEnd", ex); } }