So I have a very interesting issue that I could not find a solution to by simply Googling. It started 2 days ago, where I updated my edmx file from the database (as I usual do) for a new column then received the following error:
Error 1 Running transformation: System.BadImageFormatException: Bad IL range.
at System.Data.EntityModel.SchemaObjectModel.SchemaElementLookUpTable`1.KeyFromName(String unnormalizedKey)
at System.Data.EntityModel.SchemaObjectModel.SchemaElementLookUpTable`1.KeyFromElement(T type)
at System.Data.EntityModel.SchemaObjectModel.SchemaElementLookUpTable`1.TryAdd(T type)
at System.Data.EntityModel.SchemaObjectModel.SchemaElementLookUpTable`1.Add(T type, Boolean doNotAddErrorForEmptyName, Func`2 duplicateKeyErrorFormat)
at System.Data.EntityModel.SchemaObjectModel.Schema.TryAddType(SchemaType schemaType, Boolean doNotAddErrorForEmptyName)
at System.Data.EntityModel.SchemaObjectModel.PrimitiveSchema..ctor(SchemaManager schemaManager)
at System.Data.EntityModel.SchemaObjectModel.Schema.HandleAttributesComplete()
at System.Data.EntityModel.SchemaObjectModel.SchemaElement.Parse(XmlReader reader)
at System.Data.EntityModel.SchemaObjectModel.Schema.HandleTopLevelSchemaElement(XmlReader reader)
at System.Data.EntityModel.SchemaObjectModel.Schema.InternalParse(XmlReader sourceReader, String sourceLocation)
at System.Data.EntityModel.SchemaObjectModel.Schema.Parse(XmlReader sourceReader, String sourceLocation)
at System.Data.EntityModel.SchemaObjectModel.SchemaManager.ParseAndValidate(IEnumerable`1 xmlReaders, IEnumerable`1 sourceFilePaths, SchemaDataModelOption dataModel, AttributeValueNotification providerNotification, AttributeValueNotification providerManifestTokenNotification,
ProviderManifestNeeded providerManifestNeeded, IList`1& schemaCollection)
at System.Data.EntityModel.SchemaObjectModel.SchemaManager.ParseAndValidate(IEnumerable`1 xmlReaders, IEnumerable`1 sourceFilePaths, SchemaDataModelOption dataModel, DbProviderManifest providerManifest, IList`1& schemaCollection)
at System.Data.Metadata.Edm.EdmItemCollection.LoadItems(IEnumerable`1 xmlReaders, IEnumerable`1 sourceFilePaths, SchemaDataModelOption dataModelOption, DbProviderManifest providerManifest, ItemCollection itemCollection, Boolean throwOnError)
at System.Data.Metadata.Edm.EdmItemCollection.Init(IEnumerable`1 xmlReaders, IEnumerable`1 filePaths, Boolean throwOnError)
at System.Data.Metadata.Edm.EdmItemCollection..ctor(IEnumerable`1 xmlReaders, ReadOnlyCollection`1 filePaths, IList`1& errors)
at Microsoft.VisualStudio.TextTemplating7F2E5A5930260F7871307ADC1AD37EDD3EC5FA455DC1AAD8564AF25AC467742D9BB9EBE57652DC511A0694845CEC0E6773CEEDED45E9109E11F94D327CF53537.GeneratedTextTransformation.EdmMetadataLoader.CreateEdmItemCollection(String sourcePath)
at Microsoft.VisualStudio.TextTemplating7F2E5A5930260F7871307ADC1AD37EDD3EC5FA455DC1AAD8564AF25AC467742D9BB9EBE57652DC511A0694845CEC0E6773CEEDED45E9109E11F94D327CF53537.GeneratedTextTransformation.TransformText() C:\Users\750859\Documents\Visual Studio 2012\Projects\testingpart2\testingpart2\Models\ModelDB.tt 1 1 testingpart2
Now, I have since created a new project and connected to my database using the Entity Framework and now get a Security Warning pop up message stating "Running this text template can potentially harm your computer. Do not run it if you obtained it from an untrusted source." which is pointing to an internal db server.
Any thoughts about this?
Thanks in advance.