diff --git a/src/modules/cmdpal/ExtensionTemplate/TemplateCmdPalExtension/TemplateCmdPalExtension/Program.cs b/src/modules/cmdpal/ExtensionTemplate/TemplateCmdPalExtension/TemplateCmdPalExtension/Program.cs index 200ac6e71e32..e6d9c694ceb0 100644 --- a/src/modules/cmdpal/ExtensionTemplate/TemplateCmdPalExtension/TemplateCmdPalExtension/Program.cs +++ b/src/modules/cmdpal/ExtensionTemplate/TemplateCmdPalExtension/TemplateCmdPalExtension/Program.cs @@ -14,11 +14,12 @@ namespace TemplateCmdPalExtension; public class Program { [MTAThread] - public static async Task Main(string[] args) + public static void Main(string[] args) { if (args.Length > 0 && args[0] == "-RegisterProcessAsComServer") { - await using global::Shmuelie.WinRTServer.ComServer server = new(); + global::Shmuelie.WinRTServer.ComServer server = new(); + ManualResetEvent extensionDisposedEvent = new(false); // We are instantiating an extension instance once above, and returning it every time the callback in RegisterExtension below is called. @@ -31,6 +32,8 @@ public static async Task Main(string[] args) // This will make the main thread wait until the event is signalled by the extension class. // Since we have single instance of the extension object, we exit as soon as it is disposed. extensionDisposedEvent.WaitOne(); + server.Stop(); + server.UnsafeDispose(); } else { diff --git a/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/Assets/template.zip b/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/Assets/template.zip index 27ff543eb6f7..f3994c79ef8b 100644 Binary files a/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/Assets/template.zip and b/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/Assets/template.zip differ