Skip to content

Assembly loading exception when using DependencyInjection library #19

@rezanid

Description

@rezanid

After I converting my package to use dependency injection, I get assembly load exceptions. I checked the public key of the libraries and all of them are correct. The files are physically in the same folder as the main assembly. I even tried signing my assemblies and all the open source assemblies and still have the same problem. Here is a log from ActivityLog.xml that shows that Community.VisualStudio.Toolkit.DependencyInjection.Core assembly is not able to load the main Community.VisualStudio.Toolkit assembly.

  <entry>
    <record>2026</record>
    <time>2024/09/10 16:22:40.491</time>
    <type>Error</type>
    <source>VisualStudio</source>
    <description>CreateInstance failed for package [XrmGenPackage]Source: &apos;mscorlib&apos; Description: Could not load file or assembly &apos;Community.VisualStudio.Toolkit, Version=17.0.482.0, Culture=neutral, PublicKeyToken=79441d341a79572c&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;Community.VisualStudio.Toolkit, Version=17.0.482.0, Culture=neutral, PublicKeyToken=79441d341a79572c&apos; or one of its dependencies. The system cannot find the file specified.&#x000D;&#x000A;File name: &apos;Community.VisualStudio.Toolkit, Version=17.0.482.0, Culture=neutral, PublicKeyToken=79441d341a79572c&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;=== Pre-bind state information ===&#x000D;&#x000A;LOG: DisplayName = Community.VisualStudio.Toolkit, Version=17.0.482.0, Culture=neutral, PublicKeyToken=79441d341a79572c&#x000A; (Fully-specified)&#x000D;&#x000A;LOG: Appbase = file:///C:/Program Files/Microsoft Visual Studio/2022/Professional/Common7/IDE/&#x000D;&#x000A;LOG: Initial PrivatePath = NULL&#x000D;&#x000A;Calling assembly : Community.VisualStudio.Toolkit.DependencyInjection.Core, Version=17.0.20.0, Culture=neutral, PublicKeyToken=79441d341a79572c.&#x000D;&#x000A;===&#x000D;&#x000A;LOG: This bind starts in LoadFrom load context.&#x000D;&#x000A;WRN: Native image will not be probed in LoadFrom context. Native image will only be probed in default load context, like with Assembly.Load().&#x000D;&#x000A;LOG: Using application configuration file: C:\Users\G99202\AppData\Local\Microsoft\VisualStudio\17.0_353ed674Exp\devenv.exe.config&#x000D;&#x000A;LOG: Using host configuration file: &#x000D;&#x000A;LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config.&#x000D;&#x000A;LOG: Post-policy reference: Community.VisualStudio.Toolkit, Version=17.0.482.0, Culture=neutral, PublicKeyToken=79441d341a79572c&#x000D;&#x000A;LOG: The same bind was seen before, and was failed with hr = 0x80070002.&#x000D;&#x000A;</description>
    <guid>{9D0B1940-11E7-41CC-A95A-AD5A6ED3C73B}</guid>
    <hr>0x80004005 - E_FAIL</hr>
    <errorinfo></errorinfo>
  </entry>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions