malware-dev/MDK-SE

(VS'22) After installing the extension VS gives me the "package did not load correctly" error

ryuji-terix opened this issue ยท 18 comments

I read in the release note that something with the cache creates this problem but it's already my 10th time restarting VS and clearing caches that i don't know what to do now

Here the error window:
devenv_gKpsrmpY4m

And checking the logs it seems like it's missing some files:

  <entry>
    <record>1998</record>
    <time>2023/04/30 15:17:00.211</time>
    <type>Error</type>
    <source>VisualStudio</source>
    <description>CreateInstance failed for package [MDKPackage]Source: &apos;mscorlib&apos; Description: Could not load file or assembly &apos;System.Collections.Immutable, Version=7.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a&apos; or one of its dependencies. The system cannot find the file specified.&#x000D;&#x000A;System.IO.FileNotFoundException: Could not load file or assembly &apos;System.Collections.Immutable, Version=7.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a&apos; or one of its dependencies. The system cannot find the file specified.&#x000D;&#x000A;File name: &apos;System.Collections.Immutable, Version=7.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a&apos;&#x000D;&#x000A;   at System.Reflection.RuntimeAssembly.GetType(RuntimeAssembly assembly, String name, Boolean throwOnError, Boolean ignoreCase, ObjectHandleOnStack type)&#x000D;&#x000A;   at System.Reflection.RuntimeAssembly.GetType(String name, Boolean throwOnError, Boolean ignoreCase)&#x000D;&#x000A;   at System.Activator.CreateInstanceFromInternal(String assemblyFile, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityInfo)&#x000D;&#x000A;   at System.AppDomain.CreateInstanceFrom(String assemblyFile, String typeName)&#x000D;&#x000A;&#x000D;&#x000A;WRN: Assembly binding logging is turned OFF.&#x000D;&#x000A;To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.&#x000D;&#x000A;Note: There is some performance penalty associated with assembly bind failure logging.&#x000D;&#x000A;To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].&#x000D;&#x000A;</description>
    <guid>{7B9C2D3E-B001-4A3E-86A8-00DC6F2AF032}</guid>
    <hr>0x80004005 - E_FAIL</hr>
    <errorinfo></errorinfo>
  </entry>

Full log

I thought that i might have missed some components during the installation process but it seems like I've got them all (it's not only these but they are the required ones in the get started doc)
Installed components:

  • .NET desktop development
  • .NET 4.6.1 targeting pack
  • .NET 4.8.1 targeting pack
  • .NET SDK

Yeah like I said in the release notes, just keep clearing , rebuilding and restarting ๐Ÿ˜’

:(
Are there, like, more effective cache files to clear or just delete all files?

MPvI commented

This is not a caching issue.
I've just set up a fresh Win10 VM with VS2022 (17.5.4) and this .vsconfig:

{
  "version": "1.0",
  "components": [
    "Component.Microsoft.VisualStudio.LiveShare.2022",
    "Microsoft.Component.ClickOnce",
    "Microsoft.Component.MSBuild",
    "Microsoft.ComponentGroup.ClickOnce.Publish",
    "Microsoft.Net.Component.4.6.1.TargetingPack"
    "Microsoft.Net.Component.4.6.2.TargetingPack",
    "Microsoft.Net.Component.4.6.TargetingPack",
    "Microsoft.Net.Component.4.7.1.TargetingPack",
    "Microsoft.Net.Component.4.7.2.TargetingPack",
    "Microsoft.Net.Component.4.7.TargetingPack",
    "Microsoft.Net.Component.4.8.1.TargetingPack",
    "Microsoft.Net.Component.4.8.SDK",
    "Microsoft.Net.Component.4.8.TargetingPack",
    "Microsoft.Net.ComponentGroup.4.8.DeveloperTools",
    "Microsoft.Net.ComponentGroup.DevelopmentPrerequisites",
    "Microsoft.NetCore.Component.DevelopmentTools",
    "Microsoft.NetCore.Component.Runtime.6.0",
    "Microsoft.NetCore.Component.Runtime.7.0",
    "Microsoft.NetCore.Component.SDK",
    "Microsoft.VisualStudio.Component.CoreEditor",
    "Microsoft.VisualStudio.Component.Debugger.JustInTime",
    "Microsoft.VisualStudio.Component.FSharp",
    "Microsoft.VisualStudio.Component.IntelliCode",
    "Microsoft.VisualStudio.Component.JavaScript.TypeScript",
    "Microsoft.VisualStudio.Component.ManagedDesktop.Core",
    "Microsoft.VisualStudio.Component.ManagedDesktop.Prerequisites",
    "Microsoft.VisualStudio.Component.NuGet",
    "Microsoft.VisualStudio.Component.Roslyn.Compiler",
    "Microsoft.VisualStudio.Component.Roslyn.LanguageServices",
    "Microsoft.VisualStudio.Component.SQL.CLR",
    "Microsoft.VisualStudio.Component.TextTemplating",
    "Microsoft.VisualStudio.Component.TypeScript.TSServer",
    "Microsoft.VisualStudio.ComponentGroup.WebToolsExtensions",
    "Microsoft.VisualStudio.Workload.CoreEditor",
    "Microsoft.VisualStudio.Workload.ManagedDesktop",
  ]
}

I get the exact same error as @JustPCode, i.e. System.IO.FileNotFoundException for System.Collections.Immutable, Version=7.0.0.0.

Am I missing some components for VS or could this be some form of dependency issue with the bundled .vsix?

No, it's Visual Studio being an idiot. I had to clear/rebuild and reload several times before VS realized everything actually was a-ok. I'm trying to figure out how I can help this along. Visual Studio is just being it's... um... interesting... self.

Oh, you're saying you get the error with a new install.

Crap.

How nice of VS to be consistent.

It's too late for me to do anything now but I have one thing I can try. Will do so tomorrow.

Manually copying System.Collections.Immutable.dll Version 7.0.0 for netstandard2.0 to the extension folder C:\Users\<USERNAME>\AppData\Local\Microsoft\VisualStudio\<VS_VERSION>\Extensions\<RANDOM_IDENTIFIER>\ seems to fix this issue.
For <RANDOM_IDENTIFIER>, Choose the folder that contains MDK.pkgdef among others.
Something in MDK must require version 7.0.0.

And DON'T uninstall the extension, or you will have to do the above again.

Visual Studio does ship with this DLL, but currently, it's version 6.0.0.
But the current preview branch comes with 7.0.0, so once it is pushed to production, this particular issue might solve on its own. However, I haven't tested if it works on the preview version yet.

@SpaceBeeGaming
I don't have any "Microsoft" folder in "Appdata\Local" and in Appdata\Roaming\Microsoft\VisualStudio there isn't the "extensions" one.
Other than than, where do i find the System.Collections.Immutable.dll file?
edit: I checked and on my pc there is the 7.0.5/net7.0 package

If you don't have those folders, you don't have Visual Studio...

@SpaceBeeGaming Yes, it's referencing the Immutable nuget package. But I might be able to push it back to 6.0.0, maybe that'll solve that problem...
but with nuget packages the dlls are supposed to be included in the package.

If you don't have those folders, you don't have Visual Studio...

I'll try a fresh install

I'm actively working on fixing this problem right now. You shouldn't need to fix this manually.

If you just want to get your work done, and don't really want to be bothered with issues like these, you could always fall back to the latest release (for VS'19) for now. No judgement from me. This prerelease is bound to have problems. However, I'll be grateful for testing as I won't be able to fix this without getting feedback.

VS'19 and VS'22 can be installed side-by-side.

Ok, I'm hoping the new update will fix this issue.

Ok, I'm hoping the new update will fix this issue.

I'm outside now, I'll try it in a couple hours, hopefully

All good now :)

MPvI commented

I can confirm its working on a fresh install now aswell ๐Ÿ‘

Excellent, thank you for your feedback.