Support for PowerGUI 3.5

Jan 29, 2013 at 5:08 PM

I'm using alpha version 1.6.1 and Visual Studio 2012. After upgrade PowerGUI to 3.5 I can't to load extension and my project is no opening anymore. Are there any workarounds for this issue?

Thanks for great tool!

Exception details:
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> PowerGui.AddOn.PowerGuiInstallationException: This extension expects version [3.2] of PowerGUI. You currently have version [] installed. Please visit to download this version of PowerGUI.
   at PowerGui.AddOn.PowerGuiInstallationException.ThrowOnInvalidVersion(Version installedVersion)
   at PowerGuiVsx.Core.PowerGuiAssemblyLoader.GetInstallPath()
   at PowerGuiVsx.Core.PowerGuiAssemblyLoader.get_InstallPath()
   at PowerGuiVsx.Core.PowerGuiAssemblyLoader.LoadAssemblies()
   at PowerGui.AddOn.PowerGuiComposer.Compose(Object obj, Boolean initialize)
   at PowerGUIVsx.UserInterface.InputOutputWindowWrapper..ctor()
   at PowerGUIVsx.InputOutputToolWindow..ctor()
   --- End of inner exception stack trace ---
   at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck)
   at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)
   at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)
   at System.Activator.CreateInstance(Type type, Boolean nonPublic)
   at System.Activator.CreateInstance(Type type)
   at Microsoft.VisualStudio.Shell.Package.CreateToolWindow(Type toolWindowType, Int32 id, ProvideToolWindowAttribute tool)
   at Microsoft.VisualStudio.Shell.Package.FindToolWindow(Type toolWindowType, Int32 id, Boolean create, ProvideToolWindowAttribute tool)
   at Microsoft.VisualStudio.Shell.Package.Microsoft.VisualStudio.Shell.Interop.IVsToolWindowFactory.CreateToolWindow(Guid& toolWindowType, UInt32 id)
   at Microsoft.VisualStudio.Platform.WindowManagement.WindowFrame.ConstructContent()

Jan 30, 2013 at 10:10 PM
Edited Jan 30, 2013 at 10:10 PM
I am looking forward to this vs extension being updated to 3.5 eagerly.

Hopefully any changes required are easy to implement.
Feb 12, 2013 at 1:38 AM
Workin on it! Stay tuned.
Feb 21, 2013 at 8:27 AM
In the mean time can you change the link to 3.2 on the homepage from:
Would save people a bit of time, thanks
Mar 11, 2013 at 10:21 PM
Adam, any updates?
Would love to have PS support back in VS2012 (worked nicely before we updated to 3.5).
Minor bug was that CTRL-F did not work as expected so could not search for anything.
Mar 29, 2013 at 5:36 AM
I managed to make this working by downloading the latest source and did a few modifications.
The most important is to search a few Resources.resx files and replace this
<data name="SupportedVersion" xml:space="preserve">

<data name="SupportedVersion" xml:space="preserve">

These should be the affected files inside: Extension.VS11\ folde

<SupportedFrameworkRuntimeEdition MinVersion="4.0" MaxVersion="4.0" />
<SupportedFrameworkRuntimeEdition MinVersion="4.0" MaxVersion="4.5" />
(if you want to use .net framework 4.5 as the target framework)

I replaced this method: PSSyntaxEditorControl Debugger_SwitchTabForDebugger(SelectFileArgs arg) to avoid some annoying popup message boxes
    PSSyntaxEditorControl Debugger_SwitchTabForDebugger(SelectFileArgs arg)
            lock (Locker)
                PsControlWrapper editor =
                        m =>
                        string.Equals(m.Document.Filename, arg.FileName, StringComparison.CurrentCultureIgnoreCase));

                return editor;
                // PsControlWrapper cannot be created within this thread. It must have been created before.
                if (editor == null)
                    //throw new Exception("Syntax editor hasn't been created");

                    bool isNew = editor == null;
                    if (isNew && arg.OpenIfNotExist)
                        editor = new PsControlWrapper(this, Debugger, Package);

                        editor.Disposed += SDisposed;
                    return editor;
            //foreach (var n in PowerShellDebugger.Notifies)
            //   n.ActivateEditor(editor, isNew);

    catch (Exception ex)
        Log.Error(ex.Message, ex);
        //rad's comment MessageBox.Show(ex.Message, "Error occurred", MessageBoxButtons.OK, MessageBoxIcon.Error);
        return null;

I hope this will help and hopefully I didn't miss anything.

I used this extension to successfully debug installation of complex Nuget package with 50+ dependent nuget packages and I could step line by line.

It is still not polished and hopefully Adam will work on this more. I added a request for highlighting current execution line. Right now you have to look at some Powershell variables to discover where you are in the execution stack.