Error "Could not load file" but I didn't ask for it

3

Update: I recompiled for x86, and now it DOES work. but I still need to know what happened here, and why I need to recompile all my .net apps to x86... I never used oracle and I don't plan to do so in the future. why is it making me problems?

Since this morning I can't run all my .net programs that use the entityframework-v5 to connect to msSqlServer, I pasted the stack error below.

I tried the same files from an other pc on the network, it does work correctly. so I suspected its a windows-update that did the trouble overnight, So I did a system restore, still the same issue.

Now I ran out of ideas.. I don't use oracle, and I don't have any reference to it. and as I said the very same files in the same folder, worked yesterday on my pc, and they also work today from other pc's on the network.

    System.BadImageFormatException: Could not load file or assembly 'System.Data.OracleClient.dll' or one of its dependencies.  is not a valid Win32 application. (Exception from HRESULT: 0x800700C1)
   at System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMarkHandle stackMark, IntPtr pPrivHostBinder, Boolean loadTypeFromPartialName, ObjectHandleOnStack type)
   at System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean loadTypeFromPartialName)
   at System.Type.GetType(String typeName)
   at System.Data.Common.DbProviderFactories.IncludeFrameworkFactoryClasses(DataTable configDataTable)
   at System.Data.Common.DbProviderFactories.Initialize()
   at System.Data.EntityClient.EntityConnection.GetFactory(String providerString)
   at System.Data.EntityClient.EntityConnection.ChangeConnectionString(String newConnectionString)
   at System.Data.Entity.Internal.LazyInternalConnection.Initialize()
   at System.Data.Entity.Internal.LazyInternalConnection.CreateObjectContextFromConnectionModel()
   at System.Data.Entity.Internal.LazyInternalContext.InitializeContext()
   at System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(Type entityType)
   at System.Data.Entity.Internal.Linq.InternalSet`1.Initialize()
   at System.Data.Entity.Internal.Linq.InternalSet`1.get_InternalContext()
   at System.Data.Entity.Infrastructure.DbQuery`1.System.Linq.IQueryable.get_Provider()
   at System.Linq.Queryable.Where[TSource](IQueryable`1 source, Expression`1 predicate)
.net
vb.net
entity-framework
asked on Stack Overflow Dec 18, 2014 by Ezi • edited Dec 18, 2014 by Ezi

2 Answers

1

This question indicates that you have installed a 32-bit version of the Oracle Client Components on your machine.

Your stack trace shows the following:

  1. You trigger an Entity Framework operation.
  2. Entity Framework wants to read your connection string.
  3. It needs to initialize all database providers installed on your system.
  4. It finds Oracle and tries to load it.
  5. It fails, because the dependencies don't support 64 bit.

You should either uninstall Oracle Client completely after making sure that no other software depends on it, or additionally install the 64 bit version as stated in the answer linked above.

answered on Stack Overflow Dec 19, 2014 by Frank • edited May 23, 2017 by Community
0

I don't really have a answer to my problem.. I spent a few days trying to solve it, with no success.

I reinstalled windows altogether, and that fixed the issue.

I really hope it doesn't happen again, installing windows (and reinstall all programs) is not something I want to do frequently...

answered on Stack Overflow Dec 24, 2014 by Ezi

User contributions licensed under CC BY-SA 3.0