Receiving "The 'PostSharpPackage' package did not load correctly" error on Visual Studio startup

billster6809's Avatar

billster6809

19 Mar, 2018 05:31 PM

I have PostSharp 5.0.48 installed on my 3 computers: a desktop, a laptop, and a tablet (Microsoft Surface Pro 4). On the tablet, a problem started showing up. I am receiving an error about the PostSharp package not loading correctly when I start up Visual Studio 2017 Ultimate, 15.6.2. I do not know if this was due to upgrades to VS17, updating to PS5.0.48, or something else. The other 2 computers are fine, though they have the same version of VS17 and PS.

As one of my tests to resolve it, I actually uninstalled PS using Tools | Extensions. When I restarted VS17, the error was still there, and the PostSharp menu item still present. I looked through the registry and removed all entries with "PostSharp" in them, but that did not solve the problem.

Can you tell me how to clean up the installation on the tablet? I have attached a screen capture of the dialog, and a copy of the ActivityLog.xml from Visual Studio.

  1. Support Staff 1 Posted by PostSharp Techn... on 20 Mar, 2018 09:24 AM

    PostSharp Technologies's Avatar

    Hello,

    I'm sorry to see you've got such an experience with PostSharp Tools for Visual Studio. It looks like the installation of this extension got corrupted. Just to make the cause clearer, did you first update Visual Studio or PostSharp? Which version of Visual Studio and PostSharp have you had before the updates? If you have any additional info on how to reproduce this behavior, we'd be glad if you could share it with us, so we can avoid such behavior in the future.

    Now let me help you to remedy this situation. After the unsuccessful uninstall attempt, do you still see PostSharp in the Tools | Extensions menu? If you do, could you please try to uninstall the extension again? When you close Visual Studio after asking to uninstall the PostSharp extension, the pop-up dialog shown on the attached screen-shot should appear after a while. It's quite easy to miss it when you don't wait after closing the Visual Studio.

    If PostSharp is no longer present in the Tools | Extensions menu, the installation would be really corrupted. First thing to try is to install the extension again. Removing the registry entries, which you have attempted, might work as well, but with Visual Studio 2017 this is more tricky as it no longer uses the main Windows registry hive. See this blog post for example: https://visualstudioextensions.vlasovstudio.com/2017/06/29/changing...

    Faster and cleaner way to fix a corrupted Visual Studio instance is to save your settings and reset the instance. This would keep your settings, but it requires to reinstall all extensions. On the other hand, it makes you sure you have a clean environment. Here are the steps to reset the instance. If you decide to give this a try, please follow the steps carefully to avoid additional damage to your environment.

    1) Click on Visual Studio menu Tools > Import and export settings...
    2) Pick "Export selected environment settings" and click on Next.
    3) Check all checkboxes including those with a warning and click on Next.
    4) Pick a file name you note or remember and a location outside of %APPDATA%\Microsoft\VisualStudio\ and %LOCALAPPDATA%\Microsoft\VisualStudio\ folders and click on finish.

    5) MAKE SURE the file you have just created actually exists and is located outside of the %APPDATA%\Microsoft\VisualStudio\ and %LOCALAPPDATA%\Microsoft\VisualStudio\ folders. Do not continue if this is not true. You would loose your Visual Studio settings.

    6) Close all instances of Visual Studio 2017.
    7) Delete all folders with names starting with 15.0_ in %APPDATA%\Microsoft\VisualStudio\ and %LOCALAPPDATA%\Microsoft\VisualStudio\.
    8) Delete %LOCALAPPDATA%\Microsoft\VisualStudio\vshub\ folder
    9) Reinstall all extensions including PostSharp.
    10) Import back your settings using the Visual Studio menu Tools > Import and export settings.

    I hope some of these suggestion will help you to solve your issue.

    Best regards,
    -tony

  2. 2 Posted by billster6809 on 21 Mar, 2018 01:44 PM

    billster6809's Avatar

    I was able to get the PostSharp installation functional, but it ended up requiring a complete reinstallation of Visual Studio.
    Details are below, in case you track such things.

    Replies to your questions:
       - I cannot say for sure whether I first upgraded PostSharp to 5.0.48, or Visual Studio to 15.6.2.  I only detected the problem the next day.

       - Prior, they were PS 5.0.46, VS 15.6.2
       - A similar failure happened to me in an earlier VS2017Enterprise update, but with Devart dotConnect MySQL & SQLite, and it affected 2 out of my 3 computers.  If it occurs again, I will try to remember the exact scenario and forward that on, since corrupted installations are no fun....  There could easily be an interaction with some other extension I use, especially since PS alters the compilation chain.  In that previous failure, I did a visual studio "Repair" and reinstalled extensions, which worked.
       - After I uninstalled PostSharp, it no longer showed up in the Extensions list, but it did still have the "PostSharp" entry on the top-level Visual Studio menu.
       - Before contacting you, I had already uninstalled & reinstalled PostSharp several times, with and without "Run As Administrator", with and without computer reboots.
    Following your email, this is what I tried:
       - The Visual Studio private registry was new information for me.  Interesting!  I mounted it and removed all PostSharp references.  Restarting VS2017, the "PostSharp" menu had been removed.  Partial success.  I reinstalled PS 5.0.48 as Admin.  The "PostSharp" menu did not reappear, but PS did show up in extensions.  Half success.  I tried a few more cycles, but the PS menu would not reappear.
       - I went through the steps you mentioned for clearing appdata locations.  Reinstalled PS only.  Again no menu, but it did appear in extensions.  
       - Tried the above with reboots.  No difference.
       - Apparently, software rot had gone too far.  I uninstalled Visual Studio 2017, entirely deleted the folders in appdata, restarted the computer, then reinstalled visual studio (now 15.6.3).  I again restarted.
       - I verified that Visual Studio ran correctly.
       - Installed PostSharp 5.0.48 as administrator.  Success!  It is in extensions, and has its menu.
       - I installed my other extensions, checking after each.  Everything stayed sane.
    So I was able to get it to work, but it required a full wipe of Visual. Studio.
    Just for reference, these are other things I add to Visual Studio 2017 Enterprise: PostSharp, Resharper Ultimate, DevExpress Ultimate, SyncFusion Essentials, NDepend add-in, OzCode, Devart dotConnect SQLite/MySQL, Remobjects ElementsWith my chosen VS install configuration, preinstalled extensions are: ReadyRoll, various Xamarin, various Azure, GitHub, Unity, Powershell tools, Dotfuscator,
    Thanks for assisting!  I will report back if the scenario reoccurs.
    Thanks,
    --Bill Lee

        On Tuesday, March 20, 2018, 2:24:12 AM PDT, PostSharp Technologies <[email blocked]> wrote:

  3. Support Staff 3 Posted by PostSharp Techn... on 21 Mar, 2018 04:55 PM

    PostSharp Technologies's Avatar

    Hello Bill,

    Thanks a lot for sharing this detailed report. I'm happy to hear you've managed to get back your environment, even though the path was quite painful.

    We are going to close this request as we believe it was solved. Please feel free to reopen the discussion if you need more help.

    Best regards,
    -tony

  4. PostSharp Technologies closed this discussion on 21 Mar, 2018 04:55 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac