-2

ERROR: Activated Event Time Duration Thread Exception: Exception thrown: 'System.TypeInitializationException' in EntityFramework.dll ("The type initializer for 'System.Data.Entity.Internal.AppConfig' threw an exception."). Exception thrown: 'System.TypeInitializationException' in EntityFramework.dll ("The type initializer for 'System.Data.Entity.Internal.AppConfig' threw an exception.")

Cœur
  • 37,241
  • 25
  • 195
  • 267
esmaeil
  • 7
  • 5
  • Not enough to give an opinion. please edit your post with the scenario details when you face this exception. As you are new, please do not provide sensitive information, such as password or private key or database address when you edit this. – Md. Tazbir Ur Rahman Bhuiyan Apr 29 '19 at 08:14
  • Please check this article before asking a question o SO : https://stackoverflow.com/help/how-to-ask – Fourat Apr 29 '19 at 08:15
  • it looks like your EF install could have been corrupted try repairing the install from nuget – MikeT Apr 29 '19 at 08:19
  • What you need guidance for guidance???@Md.TazbirUrRahmanBhuiyan – esmaeil Apr 29 '19 at 08:21
  • @esmaeil Code where it's being thrown could be a start – JamesS Apr 29 '19 at 08:24
  • @MikeT How can I solve this problem? – esmaeil Apr 29 '19 at 08:33
  • as i said uninstalling and reinstalling the framework, i would suggest using the Nuget gui built into Visual studio, however the commands are `Uninstall-Package EntityFramework -RemoveDependencies` `Install-Package EntityFramework -Version 6.2.0` – MikeT Apr 29 '19 at 10:53
  • @Fourat My question is standard . This problem is not related to the Syntax code . It is the fault of system files . But I don't know how to solve this problem ? – esmaeil Apr 29 '19 at 12:05
  • @Fourat this error is as connections by Entity framework My system. – esmaeil Apr 29 '19 at 12:13
  • @MikeT I did your proposed solution, but the problem was not solved. Do you have another solution? – esmaeil Apr 30 '19 at 07:35
  • then you need to give more details, when does the error occur, is it associated with a certain line of code, have you got the valid entries in your config? – MikeT Apr 30 '19 at 08:53
  • try having a look at this https://stackoverflow.com/questions/17585611/the-type-initializer-for-system-data-entity-internal-appconfig-threw-an-except they are getting the same error but gave enough detail that someone could answer them – MikeT Apr 30 '19 at 08:58

1 Answers1

0

The steps s for solving my problem:

1.I removed EntityFramework 6.2.0 and installed it again.

2.I deleted ModelData Base and added to project it again.

With this solution, my problem solved.

esmaeil
  • 7
  • 5