MiniProfiler icon indicating copy to clipboard operation
MiniProfiler copied to clipboard

StackExchange.Profiling.EntityFramework not working with EF5

Open ido-ran opened this issue 12 years ago • 1 comments

I've upgrade my web application project from .NET 4.0 to 4.5. One of the assemblies that was updated was EntityFramework from version 4.1 to version 5.0. I'm using NuGet EntityFramework assemblies.

I saw there is a project for EF6. Should I create another one for EF5 ?

When I run my application now I get this exception:

System.IO.FileLoadException was unhandled by user code
  HResult=-2146234304
  Message=Could not load file or assembly 'EntityFramework, Version=4.4.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
  Source=MiniProfiler.EntityFramework
  FileName=EntityFramework, Version=4.4.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
  FusionLog=""
  StackTrace:
       at StackExchange.Profiling.MiniProfilerEF.IsEF41HackRequired()
       at StackExchange.Profiling.MiniProfilerEF.Initialize(Boolean applyEFHack, Boolean supportExplicitConnectionStrings) in c:\Code\github\SamSaffron\MiniProfiler\StackExchange.Profiling.EntityFramework\MiniProfilerEF.cs:line 53
       at StackExchange.Profiling.MiniProfilerEF.Initialize(Boolean supportExplicitConnectionStrings) in c:\Code\github\SamSaffron\MiniProfiler\StackExchange.Profiling.EntityFramework\MiniProfilerEF.cs:line 25

ido-ran avatar Jul 09 '13 10:07 ido-ran

It looks like calling MiniProfilerEF.InitializeEF42 solve the problem. I confirmed that I have EntityFramework.dll version 5.0.0.0 loaded.

Is that the right way to do that?

ido-ran avatar Jul 09 '13 14:07 ido-ran