I have a project that is using Entity Framework 6 with a POCO code first approach. I have a set of class libraries that i have included in my project to allow for code reuse. These libraries utilize Code Contracts.
I have also enabled Static and Runtime checking for my start-up project.
The project builds fine and executes correctly. The database is created successfully when I execute "Update-Database".
My problem arises when I try to call a method in an external library that uses code contracts during the Seeding of the database. If I omit these functions it seeds correctly. If I include a function that has code contract then I get the following when I execute the "Update-Database". It is important to note that the SQL to generate the table structures executes correctly. This only affects the SQL for seeding.
Running Seed method. System.Runtime.Serialization.SerializationException: Type is not resolved for member 'System.Diagnostics.Contracts._ContractsRuntime+ContractException+ContractExceptionData,WebForms, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. at System.AppDomain.DoCallBack(CrossAppDomainDelegate callBackDelegate)
at System.Data.Entity.Migrations.Design.ToolingFacade.Run(BaseRunner runner) at System.Data.Entity.Migrations.Design.ToolingFacade.Update(String targetMigration, Boolean force) at System.Data.Entity.Migrations.UpdateDatabaseCommand.<>c_DisplayClass2.<.ctor>b_0() at System.Data.Entity.Migrations.MigrationsDomainCommand.Execute(Action command) Type is not resolved for member 'System.Diagnostics.Contracts._ContractsRuntime+ContractException+ContractExceptionData,WebForms, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.
ContractExceptionclass being internal and therefore not raising the exception detail to the console, possibly a problem with crossing the 'AppDomain' boundary. - nicodemus13