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)
Ezi
  • 2,212
  • 8
  • 33
  • 60
  • 1
    That sounds suspiciously like a 32-bit .NET application trying to load a 64-bit assembly. Was your application compiled with a platform target of `x86`? – Brendan Green Dec 18 '14 at 21:32
  • no, its compiled as 'any cpu', in any case why is it trying to load that assembly? – Ezi Dec 18 '14 at 21:55
  • I recompiled one of the applications and specified x64, same error. – Ezi Dec 18 '14 at 22:48

2 Answers2

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.

Community
  • 1
  • 1
Frank
  • 4,461
  • 13
  • 28
  • I did search and found nothing... question is how is it working correctly on other computers (that run on the same os as mine)? – Ezi Dec 19 '14 at 02:23
  • That makes sense, I'll try it and report back, Thank you! – Ezi Dec 19 '14 at 03:13
  • I think alternatively that you could remove the Oracle data provider from app.config and that might fix the problem. – BateTech Dec 19 '14 at 04:18
  • I searched ALL files (including the app.config) the wordd oracle is not found even once. – Ezi Dec 21 '14 at 01:19
  • You should search in "Add/Remove Software" in control panel and remove it from there – Frank Dec 21 '14 at 07:44
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...

Ezi
  • 2,212
  • 8
  • 33
  • 60