Skip to content

Commit fe848eb

Browse files
committed
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.
1 parent 98f986d commit fe848eb

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

src/PowerShellEditorServices/Session/SessionPSHost.cs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
//
55

66
using Microsoft.PowerShell.EditorServices.Console;
7+
using Microsoft.PowerShell.EditorServices.Utility;
78
using System;
89
using System.Management.Automation.Host;
910

@@ -65,8 +66,10 @@ public override string Name
6566

6667
public override Version Version
6768
{
68-
// TODO: Pull this from the host application
69-
get { return new Version("0.1.0"); }
69+
get
70+
{
71+
return this.GetType().Assembly.GetName().Version;
72+
}
7073
}
7174

7275
// TODO: Pull these from IConsoleHost
@@ -88,22 +91,22 @@ public override PSHostUserInterface UI
8891

8992
public override void EnterNestedPrompt()
9093
{
91-
throw new NotImplementedException();
94+
Logger.Write(LogLevel.Verbose, "EnterNestedPrompt() called.");
9295
}
9396

9497
public override void ExitNestedPrompt()
9598
{
96-
throw new NotImplementedException();
99+
Logger.Write(LogLevel.Verbose, "ExitNestedPrompt() called.");
97100
}
98101

99102
public override void NotifyBeginApplication()
100103
{
101-
throw new NotImplementedException();
104+
Logger.Write(LogLevel.Verbose, "NotifyBeginApplication() called.");
102105
}
103106

104107
public override void NotifyEndApplication()
105108
{
106-
throw new NotImplementedException();
109+
Logger.Write(LogLevel.Verbose, "NotifyEndApplication() called.");
107110
}
108111

109112
public override void SetShouldExit(int exitCode)

0 commit comments

Comments
 (0)