public static PSReadLineProxy LoadAndCreate( ILoggerFactory loggerFactory, string bundledModulePath, SMA.PowerShell pwsh) { pwsh.ImportModule(Path.Combine(bundledModulePath, "PSReadLine")); Type psConsoleReadLineType = pwsh.AddScript("return [Microsoft.PowerShell.PSConsoleReadLine]") .InvokeAndClear <Type>().FirstOrDefault(); RuntimeHelpers.RunClassConstructor(psConsoleReadLineType.TypeHandle); return(new PSReadLineProxy(loggerFactory, psConsoleReadLineType)); }