1

I'm working on this program for a friend, but I'm having an issue. The program keeps throwing "The given assembly name or codebase was invalid. (Exception from HRESULT: 0x80131047)" It's trying to load Microsoft.ExtendedReflection.dll for the ProvinceCopier.dll plugin. The full exception that my program outputed to a log is as follow:

01/11/18 13:05:26: PluginHandler.cs: A critical error has occured: Message: Could not load file or assembly 'C:\\Users\\user\\AppData\\Local\\Tech N Gamer\\Mod Copier\\Plugins\\Province.Copier.Plugin\\dependency\\Microsoft.ExtendedReflection.dll' or one of its dependencies. The given assembly name or codebase was invalid. (Exception from HRESULT: 0x80131047)
Stacktrace:    at System.Reflection.AssemblyName.nInit(RuntimeAssembly& assembly, Boolean forIntrospection, Boolean raiseResolveEvent)
    at System.Reflection.RuntimeAssembly.CreateAssemblyName(String assemblyString, Boolean forIntrospection, RuntimeAssembly& assemblyFromResolveEvent)
    at System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean forIntrospection)
    at System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
    at System.AppDomain.Load(String assemblyString)
    at System.AppDomain.Load(String assemblyString)
    at Utility.Workers.Handlers.PluginHandler.LoadPlugin() in E:\Personal Files\Programs\Git Repositories\Mod Copier\Utility\Workers\Handlers\PluginHandler.cs:line 93

The line that is throwing this is here:

pluginDomain.Load( file );

I have no idea why it's throwing it, but it's a separate AppDomain from the main one so it can dynamically load and unload plugins. Even if I do the following code it still throws the error:

AppDomain.CurrentDomain.Load( file );

The plugin's dependency is located at AppData\Local\Tech N Gamer\Mod Copier\Plugins\Province.Copier.Plugin\dependency

Is their something that I'm missing?

Kyu Vulpes
  • 79
  • 11
  • You might find something useful here: https://social.msdn.microsoft.com/Forums/en-US/02be3d7e-cff5-47a7-a00a-1c5ebfcb47a7/hresult-0x80131047-while-trying-to-debug-an-application?forum=Vsexpressvb or another SO post here: https://stackoverflow.com/questions/12520212/exception-from-hresult-0x80131047 – dsmeclipse Jan 11 '18 at 19:47
  • @dsmeclipse I'm not sure those links help, for one, this program doesn't know if any plugin exists until it looks. Secondly, these are files that are generated with the Province Copier project outside the ModCopier project. So if I change the name of Microsoft.ExtendedReflection.dll to something else, would that make it work? – Kyu Vulpes Jan 11 '18 at 20:17
  • If I rename Microsoft.ExtendedReflection.dll it loads, but then Province Copier.dll then yells that it cannot find Microsoft.ExtendedReflections. – Kyu Vulpes Jan 11 '18 at 20:28
  • What happens if you move the file and point the location outside of AppData? Create a folder on your root, dump the file there, point it, then try again. I've run into issues with permissions pointing to files on the root of c as well as the user folders within Windows 7/10. – dsmeclipse Jan 11 '18 at 20:48
  • I know it seems silly to ask since I'm sure you've already checked, but that's just me: What do you have for the Assembly name here: Project > Project Properties? – dsmeclipse Jan 11 '18 at 20:59
  • One more thing that may help: http://www.dependencywalker.com/. That tool should help you find any missing dependencies for the dll in question. – dsmeclipse Jan 11 '18 at 23:15
  • @dsmeclipse Moving it to root is going to be hard since the program looks in AppData for everything relating to the plugin. Its name is 'Province Copier', I'll have a look at dependency walker and report back. I have opened dotPeek from JetBrains and when I double click the dll in it it shows this: (look in other comment) – Kyu Vulpes Jan 12 '18 at 16:57
  • // Assembly Province Copier, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null // MVID: 4EAFA2F6-FE92-4473-BBC5-4CF221AD99A3 // Assembly references: // mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 // BasePlugin, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null // System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 // System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a // System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 – Kyu Vulpes Jan 12 '18 at 16:59
  • For the Dependency Walker program, it thew an error and only showed ProvinceCopier.dll. – Kyu Vulpes Jan 12 '18 at 17:01

0 Answers0