Issue reported via Connect -
http://connect.microsoft.com/VisualStudio/feedback/details/800178/cannot-load-mymodel-edmx-specified-cast-is-not-valid-when-clicking-edmx-file-in-project
EF is using a singleton object of the internal Unbounded type for unbounded facet values. To check if a facet is unbounded you just do a reference comparison to the singleton instance. The LegacyProviderManifestWrapper translates EF5 metadata types to EF6 metadata
types and vice versa. When doing the conversion we used the wrong (e.g. the one defined in EF6 (EntityFramework.dll) rather than the one defined in EF5 (System.Data.Entity.dll)) reference for checking if the facet value is unbounded. This resulted in not recognizing
Unbounded value and led to casting the instance of Unbounded type to byte which caused the InvalidCastException.
This was already reported twice after VS2012 RC was shipped. In one case it is impossible to open an edmx file. In the other case it is impossible to import functions - in both cases the culprit seems to be a decimal parameter in a stored proc.