From 265cb71dfdb0cd3c272acd9651938e6272785d34 Mon Sep 17 00:00:00 2001 From: Tyrrrz Date: Tue, 27 Jul 2021 13:02:45 +0300 Subject: [PATCH] Add note explaining why Razor templates are not rendered directly --- .../Exporting/Writers/HtmlMessageWriter.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/DiscordChatExporter.Core/Exporting/Writers/HtmlMessageWriter.cs b/DiscordChatExporter.Core/Exporting/Writers/HtmlMessageWriter.cs index c547029..bd79edf 100644 --- a/DiscordChatExporter.Core/Exporting/Writers/HtmlMessageWriter.cs +++ b/DiscordChatExporter.Core/Exporting/Writers/HtmlMessageWriter.cs @@ -25,6 +25,8 @@ namespace DiscordChatExporter.Core.Exporting.Writers { var templateContext = new PreambleTemplateContext(Context, _themeName); + // We are not writing directly to output because Razor + // does not actually do asynchronous writes to stream. await _writer.WriteLineAsync( await PreambleTemplate.RenderAsync(templateContext) ); @@ -34,6 +36,8 @@ namespace DiscordChatExporter.Core.Exporting.Writers { var templateContext = new MessageGroupTemplateContext(Context, messageGroup); + // We are not writing directly to output because Razor + // does not actually do asynchronous writes to stream. await _writer.WriteLineAsync( await MessageGroupTemplate.RenderAsync(templateContext) ); @@ -66,6 +70,8 @@ namespace DiscordChatExporter.Core.Exporting.Writers var templateContext = new PostambleTemplateContext(Context, MessagesWritten); + // We are not writing directly to output because Razor + // does not actually do asynchronous writes to stream. await _writer.WriteLineAsync( await PostambleTemplate.RenderAsync(templateContext) );