Ticket T328650
Visible to All Users

DBContext.CompatibleWithModel fails showing wrong version of DLL in error message.

created 9 years ago (modified 9 years ago)

This is possibly a duplicate of T328587

I have the following code

C#
public JobTalkDbContext(string connectionString) : base(connectionString) { if (Database.Exists()) { var isCompatible = Database.CompatibleWithModel(false); //error occurs here etc.

I get the following error

C#
System.IO.FileNotFoundException occurred FileName=DevExpress.Persistent.BaseImpl.EF.v15.1, Version=15.1.7.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a FusionLog==== Pre-bind state information === LOG: DisplayName = DevExpress.Persistent.BaseImpl.EF.v15.1, Version=15.1.7.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a (Fully-specified) LOG: Appbase = file:///E:/EShared/Dev2015/SBD.JobTalk/SBD.JobTalk.Win/bin/Debug/ LOG: Initial PrivatePath = NULL Calling assembly : DevExpress.Data.v15.2, Version=15.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a. === LOG: This bind starts in default load context. LOG: Using application configuration file: E:\EShared\Dev2015\SBD.JobTalk\SBD.JobTalk.Win\bin\Debug\SBD.JobTalk.Win.exe.Config LOG: Using host configuration file: LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config. LOG: Post-policy reference: DevExpress.Persistent.BaseImpl.EF.v15.1, Version=15.1.7.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a LOG: The same bind was seen before, and was failed with hr = 0x80070002. HResult=-2147024894 Message=Could not load file or assembly 'DevExpress.Persistent.BaseImpl.EF.v15.1, Version=15.1.7.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a' or one of its dependencies. The system cannot find the file specified. Source=mscorlib StackTrace: at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) InnerException:
Comments (1)

    Here is CustomLogFile.Log from bin.Debug

    Answers approved by DevExpress Support

    created 9 years ago

    Hello Kirsten,

    The log file does not contain any information about this error. It appears that you have copied it before changes were saved to the file system.
    I suppose that the issue occurs, because the application references an old assembly, and when the Database.CompatibleWithModel method is called, all application's assemblies, including this invalid reference, attempt to loaded. Please perform the following steps to ensure that the project is updated properly.

    1. Convert all project references using the Project Converter tool.
    2. Remove all Bin and Obj folders from the project's modules.
      3. Clear Temporary Internet Files.

    You can find detailed instructions here: Upgrade Notes.
    If this does not help, please provide a log file with the exception's details. If these details are not written there, catch the exception in the debugger, provide a full Call Stack and InnerException details.

      Show previous comments (1)

        Also, reading the upgrade notes it suggests that I rebuild the skins.  I don't have any custom skins so am I right thinking I can skip this step?

        Anatol (DevExpress) 9 years ago

          To tell the truth, I have missed the fact that the issue occurs in a WinForms application. Though the solution surprises me as well, I am happy to hear that the issue is resolved.

          >> I don't have any custom skins so am I right thinking I can skip this step?

          Yes, if you do not have custom skins, you can skin this step.

            Thanks Anatol T328587 may be relevant regarding the wrong dll in the message.

            Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

            Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.