mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-05 18:57:19 +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:
@@ -20,7 +20,7 @@ namespace Microsoft.PowerToys.PreviewHandler.Markdown
|
||||
/// <summary>
|
||||
/// Win Form Implementation for Markdown Preview Handler.
|
||||
/// </summary>
|
||||
public class MarkdownPreviewHandlerControl : FormHandlerControl
|
||||
public partial class MarkdownPreviewHandlerControl : FormHandlerControl
|
||||
{
|
||||
private static readonly IFileSystem FileSystem = new FileSystem();
|
||||
private static readonly IPath Path = FileSystem.Path;
|
||||
@@ -66,7 +66,7 @@ namespace Microsoft.PowerToys.PreviewHandler.Markdown
|
||||
{
|
||||
get
|
||||
{
|
||||
string codeBase = Assembly.GetExecutingAssembly().Location;
|
||||
string codeBase = AppContext.BaseDirectory;
|
||||
UriBuilder uri = new UriBuilder(codeBase);
|
||||
string path = Uri.UnescapeDataString(uri.Path);
|
||||
return Path.GetDirectoryName(path);
|
||||
|
||||
Reference in New Issue
Block a user