Author Topic: FileLoadException  (Read 2669 times)

0 Members and 1 Guest are viewing this topic.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
FileLoadException
« on: December 24, 2011, 08:52:32 PM »
System.IO.FileLoadException
A FileLoadException exception is thrown when a managed assembly is found but cannot be loaded.

Quote
Could not load file or assembly 'D:\\ObjectARX 2012\\inc\\AcDbMgd.dll' or one of its dependencies. The given assembly name or codebase was invalid. (Exception from HRESULT: 0x80131047)

Any Ideas.
Perhaps I'm too full of Christmas cheer to make sense of this  :?
Code - C#: [Select]
  1. Using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Reflection;
  5. using System.Text;
  6. using System.IO;
  7. using System.Drawing;
  8.  
  9. namespace ReflectionStuff
  10. {
  11.     class Program
  12.     {
  13.         static void Main(string[] args)
  14.         {
  15.             Assembly.ReflectionOnlyLoadFrom( @"C:\Windows\Microsoft.NET\Framework\v4.0.30319\System.dll");
  16.             Assembly.ReflectionOnlyLoadFrom( @"C:\Windows\Microsoft.NET\Framework\v4.0.30319\System.Core.dll");
  17.             Assembly.ReflectionOnlyLoadFrom( @"C:\Windows\Microsoft.NET\Framework\v4.0.30319\System.Drawing.dll");
  18.             Assembly.ReflectionOnlyLoadFrom( @"C:\Windows\Microsoft.NET\Framework\v4.0.30319\System.Windows.Forms.dll");
  19.             Assembly.ReflectionOnlyLoadFrom( @"C:\Windows\Microsoft.NET\Framework\v4.0.30319\System.configuration.dll");
  20.             Assembly.ReflectionOnlyLoadFrom( @"C:\Windows\Microsoft.NET\Framework\v4.0.30319\System.XML.dll");
  21.  
  22.             Assembly.ReflectionOnlyLoadFrom( @"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.VisualBasic.dll");
  23.             Assembly.ReflectionOnlyLoadFrom( @"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.VisualC.Dll");
  24.  
  25.             Assembly.ReflectionOnlyLoadFrom( @"C:\Windows\Microsoft.NET\Framework\v4.0.30319\WPF\PresentationCore.dll");
  26.             Assembly.ReflectionOnlyLoadFrom( @"C:\Windows\Microsoft.NET\Framework\v4.0.30319\WPF\PresentationFramework.dll");
  27.             Assembly.ReflectionOnlyLoadFrom( @"C:\Windows\Microsoft.NET\Framework\v4.0.30319\WPF\WindowsBase.dll");
  28.             //Assembly.ReflectionOnlyLoadFrom( @"");          
  29.             try
  30.             {
  31.                 Assembly assemblyMscorlib = Assembly.ReflectionOnlyLoad("mscorlib");
  32.                 Assembly assemblyAcDbMgd = Assembly.ReflectionOnlyLoad(@"D:\ObjectARX 2012\inc\AcDbMgd.dll");
  33.                 Type[] types = assemblyAcDbMgd.GetTypes();
  34.             }
  35.             catch (ReflectionTypeLoadException e)
  36.             {
  37.                 System.Exception[] ex = e.LoaderExceptions;
  38.                 System.Windows.Forms.MessageBox.Show(e.Message);
  39.             }
  40.         }
  41.     }
  42. }

Solution zip attached :
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

fixo

  • Guest
Re: FileLoadException
« Reply #1 on: December 25, 2011, 03:28:26 PM »

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: FileLoadException
« Reply #2 on: December 26, 2011, 06:44:24 AM »

Oleg,
Thanks for the reply. I think it may be a bit more complicated than I'd hoped.
I'll put it down untill a rainy day.

kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.