mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-08 04:07:40 +02:00
[AOT compatible] Clean up some AOT build issue in FilePreviewCommon and MarkdownPreviewHandler (#36207)
* Use AppContext.BaseDirectory to replace assembly.GetExeAseembly.Location. Fix json serilizer aot issue. * clean up some AOT build issue * Update src/modules/previewpane/MarkdownPreviewHandler/MarkdownPreviewHandlerControl.cs Co-authored-by: Jeremy Sinclair <4016293+snickler@users.noreply.github.com> * Update src/common/FilePreviewCommon/Formatters/JsonFormatter.cs Co-authored-by: Jeremy Sinclair <4016293+snickler@users.noreply.github.com> --------- Co-authored-by: Yu Leng (from Dev Box) <yuleng@microsoft.com> Co-authored-by: Jeremy Sinclair <4016293+snickler@users.noreply.github.com>
This commit is contained in:
@@ -14,7 +14,6 @@ namespace Microsoft.PowerToys.FilePreviewCommon.Monaco.Formatters
|
||||
|
||||
private static readonly JsonSerializerOptions _serializerOptions = new JsonSerializerOptions
|
||||
{
|
||||
WriteIndented = true,
|
||||
Encoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping,
|
||||
};
|
||||
|
||||
@@ -28,7 +27,8 @@ namespace Microsoft.PowerToys.FilePreviewCommon.Monaco.Formatters
|
||||
|
||||
using (var jDocument = JsonDocument.Parse(value, new JsonDocumentOptions { CommentHandling = JsonCommentHandling.Skip }))
|
||||
{
|
||||
return JsonSerializer.Serialize(jDocument, _serializerOptions);
|
||||
FilePreviewJsonSerializerContext context = new(_serializerOptions);
|
||||
return JsonSerializer.Serialize(jDocument, context.JsonDocument);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user