locked
VS 2012 RC 'Microsoft.VisualStudio.Editor.Implementation.EditorPackage' error/bug RRS feed

  • Question

  • Every time I load my package I get an error

    The 'Microsoft.VisualStudio.Editor.Implementation.EditorPackage' package did not load correctly.

    Looking in the activity log, there is an error

     <entry>
        <record>423</record>
        <time>2012/07/17 13:50:24.089</time>
        <type>Error</type>
        <source>VisualStudio</source>
        <description>SetSite failed for packageSetSite failed for package</description>
        <guid>{E269B994-EF71-4CE0-8BCD-581C217372E8}</guid>
        <hr>80070002</hr>
        <errorinfo>Could not load file or assembly MyPackage, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.</errorinfo>
      </entry>

    I can't get rid of this error message except by using /resetsettings and then it comes back again next time I start VS 2012.

    My package does load and work ok, as far as I can see.

    Any ideas?

    Dermot

     

    Tuesday, July 17, 2012 2:16 PM

Answers

  • Right ball park! ... but not the exact answer. I've just spent the last two days tracking this down - and eventually found the answer.

    1) signing the assembly and adding a BindingPath entry in the registry solved the original exception and and annoying pop-up but revealed another problem, which was that the outlining (and all my other special margin glyphs, etc.) wasn't working. Since this is produced by MEF, it looked like MEF wasn't working.

    2) and MEF indeed wasn't working. The reason was that I was using a *link* to the manifest file. So the link was in C:\Program Files\Microsoft Visual Studio 11.0\Common7\IDE\Extensions\MyProgram as "extension.vsixmanifest.lnk" which pointed to the real manifest file in the directory where all my dlls were stored. The link was the only file there. The real manifest file just had <MefComponent>MyPackage.dll</MefComponent> as the MEF reference. Replacing the link to teh manifest file in the Extensions directories with a manifest file which contained the absolute position of the DLL like this

    <MefComponent>C:\Program Files\MyProduct\MyPackage.dll</MefComponent>

    caused the outlining to start functioning. I then got rid of the BindingPath registry entry and it still worked. So using a real manifest file with an absolute DLL reference works - you don't need a binding path.

    Now my old method *did* work fine in VS2010 ... however, the joys of upgrading are endless.

    Thanks for the help guys!

    Dermot

    Friday, July 20, 2012 1:25 PM

All replies

  • Is your package throwing an exception? Set a breakpoint in Initialize or set the debugger to break on first chance exceptions.

    Ryan

    Tuesday, July 17, 2012 2:39 PM
  • No - there are no exceptions.

    The MyPackage initialization ends (I can see the end message) and then the problem occurs.

    I've just tried running the project and attaching from another instance of VS - and it works fine. This is what I observed when debugging it - no problems when running in the experimental instance.

    Dermot

    Tuesday, July 17, 2012 3:48 PM
  • Well the message is from a managed exception, did you enable first chance exceptions in the debugger?

    Ryan

    Tuesday, July 17, 2012 3:59 PM
  • Yes - Common Language Runtime Exceptions and Managed Debugging Assistants are both fulliy enabled in the attaching devenv. No exception is thrown when the debugger is attached (so it seems). The execption only occurs when there is no debugger attached.

    Dermot

    Tuesday, July 17, 2012 4:24 PM
  • Have you turned off Enable Just My Code? If so I would need a repro.

    Ryan

    Tuesday, July 17, 2012 4:35 PM
  • Enable Just My Code -> off produces some exceptions now.

    Nothing that looks suspicious though - and I don't get the original error message even with the exceptions coming through. All the exceptions are caught (at least all mine are) so nothing ever produces the original message.

    Dermot

    Tuesday, July 17, 2012 5:45 PM
  • You aren't seeing a FileNotFoundException?  Generally there should be NO exceptions from SetSite, which if you are using MPF is basically a call to your packages Initialize method. FileNotFound is odd, though it could be for a secondary assembly you reference but don't deploy. You can check the binding log by running fuslogvw from the VS command prompt, turning on 'Log bind failures to disk' under the Settings dialog and then rerunning VS / causing your package to load.  The log should say what file it is looking for that it can't find, if indeed that is happening (but from the original error it seems it is).

    Ryan

    Tuesday, July 17, 2012 6:02 PM
  • That produced something ... when I get the error (that is with no debugger attached) fuslogvw produces this

    *** Assembly Binder Log Entry  (17/07/2012 @ 19:12:17) ***

    The operation failed.
    Bind result: hr = 0x80070002. The system cannot find the file specified.

    Assembly manager loaded from:  C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll
    Running under executable  C:\Program Files\Microsoft Visual Studio 11.0\Common7\IDE\devenv.exe
    --- A detailed error log follows.

    === Pre-bind state information ===
    LOG: User = VPC\dermot
    LOG: DisplayName = MyPackage, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null
     (Fully-specified)
    LOG: Appbase = file:///C:/Program Files/Microsoft Visual Studio 11.0/Common7/IDE/
    LOG: Initial PrivatePath = NULL
    LOG: Dynamic Base = NULL
    LOG: Cache Base = NULL
    LOG: AppName = devenv.exe
    Calling assembly : (Unknown).
    ===
    LOG: This bind starts in default load context.
    LOG: Using application configuration file: C:\Users\dermot\AppData\Local\Microsoft\VisualStudio\11.0\devenv.exe.config
    LOG: Using host configuration file:
    LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
    LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
    LOG: Attempting download of new URL file:///C:/Program Files/Microsoft Visual Studio 11.0/Common7/IDE/MyPackage.DLL.
    LOG: Attempting download of new URL file:///C:/Program Files/Microsoft Visual Studio 11.0/Common7/IDE/MyPackage/MyPackage.DLL.
    LOG: Attempting download of new URL file:///C:/Program Files/Microsoft Visual Studio 11.0/Common7/IDE/PublicAssemblies/MyPackage.DLL.
    LOG: Attempting download of new URL file:///C:/Program Files/Microsoft Visual Studio 11.0/Common7/IDE/PublicAssemblies/MyPackage/MyPackage.DLL.
    LOG: Attempting download of new URL file:///C:/Program Files/Microsoft Visual Studio 11.0/Common7/IDE/PrivateAssemblies/MyPackage.DLL.
    LOG: Attempting download of new URL file:///C:/Program Files/Microsoft Visual Studio 11.0/Common7/IDE/PrivateAssemblies/MyPackage/MyPackage.DLL.
    LOG: Attempting download of new URL file:///C:/Program Files/Microsoft Visual Studio 11.0/Common7/IDE/CommonExtensions/Microsoft/TemplateProviders/MyPackage.DLL.
    LOG: Attempting download of new URL file:///C:/Program Files/Microsoft Visual Studio 11.0/Common7/IDE/CommonExtensions/Microsoft/TemplateProviders/MyPackage/MyPackage.DLL.
    LOG: Attempting download of new URL file:///C:/Program Files/Microsoft Visual Studio 11.0/Common7/IDE/CommonExtensions/Platform/Debugger/MyPackage.DLL.
    LOG: Attempting download of new URL file:///C:/Program Files/Microsoft Visual Studio 11.0/Common7/IDE/CommonExtensions/Platform/Debugger/MyPackage/MyPackage.DLL.
    LOG: Attempting download of new URL file:///C:/Program Files/Microsoft Visual Studio 11.0/Common7/IDE/PrivateAssemblies/DataCollectors/MyPackage.DLL.
    LOG: Attempting download of new URL file:///C:/Program Files/Microsoft Visual Studio 11.0/Common7/IDE/PrivateAssemblies/DataCollectors/MyPackage/MyPackage.DLL.
    LOG: Attempting download of new URL file:///C:/Program Files/Microsoft Visual Studio 11.0/Common7/IDE/PrivateAssemblies/DataCollectors/x86/MyPackage.DLL.
    LOG: Attempting download of new URL file:///C:/Program Files/Microsoft Visual Studio 11.0/Common7/IDE/PrivateAssemblies/DataCollectors/x86/MyPackage/MyPackage.DLL.
    LOG: Attempting download of new URL file:///C:/Program Files/Microsoft Visual Studio 11.0/Common7/IDE/MyPackage.EXE.
    LOG: Attempting download of new URL file:///C:/Program Files/Microsoft Visual Studio 11.0/Common7/IDE/MyPackage/MyPackage.EXE.
    LOG: Attempting download of new URL file:///C:/Program Files/Microsoft Visual Studio 11.0/Common7/IDE/PublicAssemblies/MyPackage.EXE.
    LOG: Attempting download of new URL file:///C:/Program Files/Microsoft Visual Studio 11.0/Common7/IDE/PublicAssemblies/MyPackage/MyPackage.EXE.
    LOG: Attempting download of new URL file:///C:/Program Files/Microsoft Visual Studio 11.0/Common7/IDE/PrivateAssemblies/MyPackage.EXE.
    LOG: Attempting download of new URL file:///C:/Program Files/Microsoft Visual Studio 11.0/Common7/IDE/PrivateAssemblies/MyPackage/MyPackage.EXE.
    LOG: Attempting download of new URL file:///C:/Program Files/Microsoft Visual Studio 11.0/Common7/IDE/CommonExtensions/Microsoft/TemplateProviders/MyPackage.EXE.
    LOG: Attempting download of new URL file:///C:/Program Files/Microsoft Visual Studio 11.0/Common7/IDE/CommonExtensions/Microsoft/TemplateProviders/MyPackage/MyPackage.EXE.
    LOG: Attempting download of new URL file:///C:/Program Files/Microsoft Visual Studio 11.0/Common7/IDE/CommonExtensions/Platform/Debugger/MyPackage.EXE.
    LOG: Attempting download of new URL file:///C:/Program Files/Microsoft Visual Studio 11.0/Common7/IDE/CommonExtensions/Platform/Debugger/MyPackage/MyPackage.EXE.
    LOG: Attempting download of new URL file:///C:/Program Files/Microsoft Visual Studio 11.0/Common7/IDE/PrivateAssemblies/DataCollectors/MyPackage.EXE.
    LOG: Attempting download of new URL file:///C:/Program Files/Microsoft Visual Studio 11.0/Common7/IDE/PrivateAssemblies/DataCollectors/MyPackage/MyPackage.EXE.
    LOG: Attempting download of new URL file:///C:/Program Files/Microsoft Visual Studio 11.0/Common7/IDE/PrivateAssemblies/DataCollectors/x86/MyPackage.EXE.
    LOG: Attempting download of new URL file:///C:/Program Files/Microsoft Visual Studio 11.0/Common7/IDE/PrivateAssemblies/DataCollectors/x86/MyPackage/MyPackage.EXE.
    LOG: All probing URLs attempted and failed.


    *** Assembly Binder Log Entry  (17/07/2012 @ 19:12:17) ***

    The operation failed.
    Bind result: hr = 0x80070002. The system cannot find the file specified.

    Assembly manager loaded from:  C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll
    Running under executable  C:\Program Files\Microsoft Visual Studio 11.0\Common7\IDE\devenv.exe
    --- A detailed error log follows.

    === Pre-bind state information ===
    LOG: User = VPC\dermot
    LOG: DisplayName = MyPackage, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null
     (Fully-specified)
    LOG: Appbase = file:///C:/Program Files/Microsoft Visual Studio 11.0/Common7/IDE/
    LOG: Initial PrivatePath = NULL
    LOG: Dynamic Base = NULL
    LOG: Cache Base = NULL
    LOG: AppName = devenv.exe
    Calling assembly : (Unknown).
    ===
    LOG: This bind starts in default load context.
    LOG: Using application configuration file: C:\Users\dermot\AppData\Local\Microsoft\VisualStudio\11.0\devenv.exe.config
    LOG: Using host configuration file:
    LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
    LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
    LOG: Attempting download of new URL file:///C:/Program Files/Microsoft Visual Studio 11.0/Common7/IDE/MyPackage.DLL.
    LOG: Attempting download of new URL file:///C:/Program Files/Microsoft Visual Studio 11.0/Common7/IDE/MyPackage/MyPackage.DLL.
    LOG: Attempting download of new URL file:///C:/Program Files/Microsoft Visual Studio 11.0/Common7/IDE/PublicAssemblies/MyPackage.DLL.
    LOG: Attempting download of new URL file:///C:/Program Files/Microsoft Visual Studio 11.0/Common7/IDE/PublicAssemblies/MyPackage/MyPackage.DLL.
    LOG: Attempting download of new URL file:///C:/Program Files/Microsoft Visual Studio 11.0/Common7/IDE/PrivateAssemblies/MyPackage.DLL.
    LOG: Attempting download of new URL file:///C:/Program Files/Microsoft Visual Studio 11.0/Common7/IDE/PrivateAssemblies/MyPackage/MyPackage.DLL.
    LOG: Attempting download of new URL file:///C:/Program Files/Microsoft Visual Studio 11.0/Common7/IDE/CommonExtensions/Microsoft/TemplateProviders/MyPackage.DLL.
    LOG: Attempting download of new URL file:///C:/Program Files/Microsoft Visual Studio 11.0/Common7/IDE/CommonExtensions/Microsoft/TemplateProviders/MyPackage/MyPackage.DLL.
    LOG: Attempting download of new URL file:///C:/Program Files/Microsoft Visual Studio 11.0/Common7/IDE/CommonExtensions/Platform/Debugger/MyPackage.DLL.
    LOG: Attempting download of new URL file:///C:/Program Files/Microsoft Visual Studio 11.0/Common7/IDE/CommonExtensions/Platform/Debugger/MyPackage/MyPackage.DLL.
    LOG: Attempting download of new URL file:///C:/Program Files/Microsoft Visual Studio 11.0/Common7/IDE/PrivateAssemblies/DataCollectors/MyPackage.DLL.
    LOG: Attempting download of new URL file:///C:/Program Files/Microsoft Visual Studio 11.0/Common7/IDE/PrivateAssemblies/DataCollectors/MyPackage/MyPackage.DLL.
    LOG: Attempting download of new URL file:///C:/Program Files/Microsoft Visual Studio 11.0/Common7/IDE/PrivateAssemblies/DataCollectors/x86/MyPackage.DLL.
    LOG: Attempting download of new URL file:///C:/Program Files/Microsoft Visual Studio 11.0/Common7/IDE/PrivateAssemblies/DataCollectors/x86/MyPackage/MyPackage.DLL.
    LOG: Attempting download of new URL file:///C:/Program Files/Microsoft Visual Studio 11.0/Common7/IDE/MyPackage.EXE.
    LOG: Attempting download of new URL file:///C:/Program Files/Microsoft Visual Studio 11.0/Common7/IDE/MyPackage/MyPackage.EXE.
    LOG: Attempting download of new URL file:///C:/Program Files/Microsoft Visual Studio 11.0/Common7/IDE/PublicAssemblies/MyPackage.EXE.
    LOG: Attempting download of new URL file:///C:/Program Files/Microsoft Visual Studio 11.0/Common7/IDE/PublicAssemblies/MyPackage/MyPackage.EXE.
    LOG: Attempting download of new URL file:///C:/Program Files/Microsoft Visual Studio 11.0/Common7/IDE/PrivateAssemblies/MyPackage.EXE.
    LOG: Attempting download of new URL file:///C:/Program Files/Microsoft Visual Studio 11.0/Common7/IDE/PrivateAssemblies/MyPackage/MyPackage.EXE.
    LOG: Attempting download of new URL file:///C:/Program Files/Microsoft Visual Studio 11.0/Common7/IDE/CommonExtensions/Microsoft/TemplateProviders/MyPackage.EXE.
    LOG: Attempting download of new URL file:///C:/Program Files/Microsoft Visual Studio 11.0/Common7/IDE/CommonExtensions/Microsoft/TemplateProviders/MyPackage/MyPackage.EXE.
    LOG: Attempting download of new URL file:///C:/Program Files/Microsoft Visual Studio 11.0/Common7/IDE/CommonExtensions/Platform/Debugger/MyPackage.EXE.
    LOG: Attempting download of new URL file:///C:/Program Files/Microsoft Visual Studio 11.0/Common7/IDE/CommonExtensions/Platform/Debugger/MyPackage/MyPackage.EXE.
    LOG: Attempting download of new URL file:///C:/Program Files/Microsoft Visual Studio 11.0/Common7/IDE/PrivateAssemblies/DataCollectors/MyPackage.EXE.
    LOG: Attempting download of new URL file:///C:/Program Files/Microsoft Visual Studio 11.0/Common7/IDE/PrivateAssemblies/DataCollectors/MyPackage/MyPackage.EXE.
    LOG: Attempting download of new URL file:///C:/Program Files/Microsoft Visual Studio 11.0/Common7/IDE/PrivateAssemblies/DataCollectors/x86/MyPackage.EXE.
    LOG: Attempting download of new URL file:///C:/Program Files/Microsoft Visual Studio 11.0/Common7/IDE/PrivateAssemblies/DataCollectors/x86/MyPackage/MyPackage.EXE.
    LOG: All probing URLs attempted and failed.

     

    which I guess is saying that it's looking for MyPackage in the wrong place and not finding it.

     Dermot

    Tuesday, July 17, 2012 6:20 PM
  • Yep, how are you attemping to deploy/install the package? Typically there's a registry key or .pkgdef entry that would point the IDE to your MyPackage.dll.

    Sincerely,


    Ed Dore

    Tuesday, July 17, 2012 6:23 PM
  • Fairly standard installation - pretty much the same as with VS2010 (where there is no problem). The package loads fine, so VS is finding it with no problem in the first place.

    There's the usual keys under HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\11.0_Config\Packages\{mypackageguid} and also under HKLM.

    Dermot

    Tuesday, July 17, 2012 6:36 PM
  • Can you verify the values under that HKCU\....{mypackageguid} key?

    Specifically, the Assembly and InprocServer32 values.

    The latter should be pointing to the valid path to mscoree.dll (might want to verify this as it changes depending upon OS).

    Ed...


    Ed Dore

    Tuesday, July 17, 2012 6:45 PM
  • looks ok ... I assume that VS is co-creating the package. Anyway, if I change the file name(s) in the registry, the package doesn't load, so VS is clearly using that registry setting to load the package.

    Also, that doesn't really explain why when I attach using the debugger, I don't see the problem.

    As I said, everything else seems to work - I just get that annoying message.

    Dermot

    Tuesday, July 17, 2012 7:02 PM
  • Hard to say without a repro, but I find it hard to believe the package loads in the face of a SetSite failure. How are you determining it 'seems to work'?

    Edit:  Ohhh, on re-reading it appears it is the editor pacakge that is failing to load (sorry, missed that). I suspect this is because you contribute MEF contributions and the editor, when trying to consume them, can't locate your DLL. MEF is different than the 'normal' VS extensibility and I believe you need something like a ProvideBindingPathAttribute on your pacakge to insert your install directory in VS' probing path so random reflection based loads will load your assembly properly. Though I thought the VSIX stuff that dealt with MEF took care of any thing here. Your VSIX is marked as containing MEF components I assume?

    VS itself, when loading packages, uses the registry info, and yes, it does CoCreate, but that is not where the failure is coming from, it is in the editor trying to consume something from your package and THAT part is failing.

    Edit 2:  To further excercise my psychic debugging skills.  It says, in fuslogvw, that your pacakge dll is failing to be found. If that dll has MEF contributions in it it should be found. Is this the case that you have two dlls, one with MEF contributions to the editor and another (your package dll) that the MEF contributing dll references? If so are both signed (I believe the default wizard generated package is signed, is your MEF dll also signed)? I believe, but am by no means an expert here, that when reflection loading is in play (i.e. MEF or any other reflection-load based system) that the CLR will NOT automatically resolve references assemblies that happen to be sitting in the same directory. If this is the case adding the ProvdeBindingPathAttribute to your package will help as it will add an entry into VS' assembly resolution paths list that are consulted when the CLR fails to resolve an assembly reference.

    Ryan

    Tuesday, July 17, 2012 7:11 PM
  • Right ball park! ... but not the exact answer. I've just spent the last two days tracking this down - and eventually found the answer.

    1) signing the assembly and adding a BindingPath entry in the registry solved the original exception and and annoying pop-up but revealed another problem, which was that the outlining (and all my other special margin glyphs, etc.) wasn't working. Since this is produced by MEF, it looked like MEF wasn't working.

    2) and MEF indeed wasn't working. The reason was that I was using a *link* to the manifest file. So the link was in C:\Program Files\Microsoft Visual Studio 11.0\Common7\IDE\Extensions\MyProgram as "extension.vsixmanifest.lnk" which pointed to the real manifest file in the directory where all my dlls were stored. The link was the only file there. The real manifest file just had <MefComponent>MyPackage.dll</MefComponent> as the MEF reference. Replacing the link to teh manifest file in the Extensions directories with a manifest file which contained the absolute position of the DLL like this

    <MefComponent>C:\Program Files\MyProduct\MyPackage.dll</MefComponent>

    caused the outlining to start functioning. I then got rid of the BindingPath registry entry and it still worked. So using a real manifest file with an absolute DLL reference works - you don't need a binding path.

    Now my old method *did* work fine in VS2010 ... however, the joys of upgrading are endless.

    Thanks for the help guys!

    Dermot

    Friday, July 20, 2012 1:25 PM
  • I suspect using a .lnk file working previously was sheer luck. I have never heard of anyone doing that nor do I believe it is a tested/supported scenario.

    Ryan

    Friday, July 20, 2012 3:07 PM
  • Looking back at it, it does seem a completely crack-brained solution.

    I remember putting it in a a quick fix a couple of years ago and being somewhat surprised that it worked, and then forgot about it. Till now.

    Hmm.

    Dermot

    Friday, July 20, 2012 5:21 PM
  • For me it was as simple as disabling the 'Visual Studio Achievements for VS 2012' extension.

    When examining the ActivityLog.xml file in C:\Users\<username>\AppData\Roaming\Microsoft\VisualStudio\11.0\ folder, I saw this:

    VSA:Microsoft.CSharp.RuntimeBinder.RuntimeBinderException: 'System.__ComObject' does not contain a definition for 'Project' at CallSite.Target(Closure , CallSite , ComObject ) at System.Dynamic.UpdateDelegates.UpdateAndExecute1[T0,TRet](CallSite site, T0 arg0) at CallSite.Target(Closure , CallSite , Object ) at System.Dynamic.UpdateDelegates.UpdateAndExecute1[T0,TRet](CallSite site, T0 arg0) at Coding4Fun.VSAchievements.AzureAchievements.PublishToAzureProductionServerAchievementBase.GetIVsCfgs(IVsHierarchy hierarchy)

    My first guess that this extension was the leading cause of the error:

    SetSite failed for package [Microsoft.VisualStudio.Editor.Implementation.EditorPackage]

    So I went to the Extensions And Updates Manager and disable the extension, Solve my problem at least.

    Monday, August 12, 2013 9:59 AM
  • I had the same problem with Visual Studio 2012 Ultimate edition. The information in C:\Users\<user>\AppData\Roaming\Microsoft\VisualStudio\11.0\ActivityLog.xml didn't help me in any way to resolve this problem. Luckily googling led me to a link (I cannot include the link till my account is verified) which helped me resolve this problem. I believe this issue started happening after windows update and restart.
    Monday, April 21, 2014 7:21 AM
  • sathish2014--

    I've found when I stumble into this issue, if I clean out the 

    C:\Users\[user]\AppData\Local\Microsoft\VisualStudio\[version]\ComponentModelCache 


    directory and my 

    C:\Users\[user]\AppData\Local\Temp  

    for good measure -- the problem goes away.

    I've only experienced this, though - when trying to load a solution, and it stemmed from an unexpected reboot on the machine as I was coding -- when it came back up the project wouldn't load and crash with that error.    Emptying those folders, fixed my problem.

    Thursday, July 10, 2014 6:13 PM