dev and trouble shoot

This commit is contained in:
Kai Tao
2025-11-25 15:49:50 +08:00
parent fac448a3a9
commit 5e1fd47d8e
2 changed files with 29 additions and 12 deletions

View File

@@ -4,10 +4,12 @@
using System;
using System.Diagnostics;
using System.Runtime.InteropServices.Marshalling;
using System.Threading;
using ManagedCommon;
using Microsoft.CmdPal.Ext.PowerToys.ComServer;
using Microsoft.CommandPalette.Extensions;
using WinRT;
namespace Microsoft.CmdPal.Ext.PowerToys;
@@ -30,6 +32,9 @@ public static class Program
if (args.Length > 0 && args[0].Equals("-RegisterProcessAsComServer", StringComparison.OrdinalIgnoreCase))
{
// Ensure cswinrt uses our StrategyBasedComWrappers so the IExtension WinRT interface marshals correctly cross-process.
ComWrappersSupport.InitializeComWrappers(new StrategyBasedComWrappers());
using PowerToysExtensionServer server = new();
using ManualResetEvent extensionDisposed = new(false);
var extensionInstance = new PowerToysExtension(extensionDisposed);
@@ -41,7 +46,6 @@ public static class Program
}
Logger.LogWarning("PowerToys CmdPal extension launched without COM registration arguments. Exiting.");
Console.WriteLine("Microsoft.CmdPal.Ext.PowerToys launched without COM registration arguments. Exiting.");
return 0;
}
}