From fe848ebe91f7a0365652ec08c29f165c4f2f9f26 Mon Sep 17 00:00:00 2001 From: Keith Hill Date: Sun, 7 Feb 2016 17:11:54 -0700 Subject: [PATCH] Fixes issue with notepad.exe running correctly. For some reason, the PowerShell engine thinks notepad.exe is a command-line app and calls the SessionPSHost BeginNotifyApplication() which used to throw NotImplementedException. It now just logs the call. Also updated the PSHost version to pull the version from the services dll. I tried several ways to pull from the host app (reflection Process.GetCurrentProcess().MainModule) but both caused the unit tests to hang. --- .../Session/SessionPSHost.cs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/PowerShellEditorServices/Session/SessionPSHost.cs b/src/PowerShellEditorServices/Session/SessionPSHost.cs index f51dcca34..ca69c6ae8 100644 --- a/src/PowerShellEditorServices/Session/SessionPSHost.cs +++ b/src/PowerShellEditorServices/Session/SessionPSHost.cs @@ -4,6 +4,7 @@ // using Microsoft.PowerShell.EditorServices.Console; +using Microsoft.PowerShell.EditorServices.Utility; using System; using System.Management.Automation.Host; @@ -65,8 +66,10 @@ public override string Name public override Version Version { - // TODO: Pull this from the host application - get { return new Version("0.1.0"); } + get + { + return this.GetType().Assembly.GetName().Version; + } } // TODO: Pull these from IConsoleHost @@ -88,22 +91,22 @@ public override PSHostUserInterface UI public override void EnterNestedPrompt() { - throw new NotImplementedException(); + Logger.Write(LogLevel.Verbose, "EnterNestedPrompt() called."); } public override void ExitNestedPrompt() { - throw new NotImplementedException(); + Logger.Write(LogLevel.Verbose, "ExitNestedPrompt() called."); } public override void NotifyBeginApplication() { - throw new NotImplementedException(); + Logger.Write(LogLevel.Verbose, "NotifyBeginApplication() called."); } public override void NotifyEndApplication() { - throw new NotImplementedException(); + Logger.Write(LogLevel.Verbose, "NotifyEndApplication() called."); } public override void SetShouldExit(int exitCode)