7

On a specific project that uses CC, the following message is displayed in 's Error List window upon build:

CodeContracts: Cannot connect to the cache. The CodeContracs static check will not run

Googling around, I've found out here that it was possible to trace attempts to connect to a cache using the following extra static checker option:

-trace:cache

The CC output then became a bit more verbose:

  • CodeContracts: MyAssembly: [cache] Clousot version string: 1.7.10908.11
  • CodeContracts: MyAssembly: [cache] Slice time stamp : 2014-09-25 10:55:50
  • CodeContracts: MyAssembly: [cache] Cannot open cache: Model compatibility cannot be checked because the database does not contain model metadata. Model compatibility can only be checked for databases created using Code First or Code First Migrations.
  • CodeContracts: MyAssembly: Time spent trying to connect to the cache server: 00:00:01.4948105
  • CodeContracts: MyAssembly: Diagnostic: Failed to connect to any cache.

So somehow this seems like an internal bug inside the CC engine related to the way it stores analysis info into the cache it creates internally (I do not specify any Sql server of mine for cache).

I managed to find out that the default cache files are stored inside AppData/Local/CodeContracts. Unfortunately, even deleting the whole directory didn't solve the problem.

Any ideas on what the next step should be?

Crono
  • 10,211
  • 6
  • 43
  • 75
  • possible duplicate of http://stackoverflow.com/questions/23450183/microsoft-code-contracts-error-codecontracts-diagnostic-failed-to-connect-to – Peter Ritchie Sep 25 '14 at 14:02
  • "Model compatibility cannot be checked because the database does not contain model metadata. Model compatibility can only be checked for databases created using Code First or Code First Migrations" is an Entity Framework error. It sounds like the database schema changed. Have you tried cleaning the project and trying again? Otherwise, I think posting to http://social.msdn.microsoft.com/Forums/en-US/home?forum=codecontracts will get you a faster response. – Peter Ritchie Sep 25 '14 at 15:37
  • @PeterRitchie yes I did try that. I also tried deleting the cache directory but it created more problems than it solved. :) Right now I'm trying a repair on CC installer. If that doesn't help, then yes I'll try posting on that forum. Thanks. – Crono Sep 25 '14 at 15:47

0 Answers0