title: The 'xs:group' start tag on line 21 position 4 does not match the end tag of 'xr:group'
body: <p>I am working with MVC3 project and when deployed to production Im getting this error</p>
  
  <pre><code>The 'xs:group' start tag on line 21 position 4 does not match the end tag of 'xr:group'. Line 30, position 5.
  </code></pre>
  
  <p>Stacktrace below</p>
  
  <pre><code>    at System.Xml.XmlTextReaderImpl.Throw(String res, String[] args)
     at System.Xml.XmlTextReaderImpl.ThrowTagMismatch(NodeData startTag)
     at System.Xml.XmlTextReaderImpl.ParseEndElement()
     at System.Xml.XmlTextReaderImpl.ParseElementContent()
     at System.Xml.Schema.XmlSchema.Read(XmlReader reader, ValidationEventHandler validationEventHandler)
     at System.Data.EntityModel.SchemaObjectModel.Schema.SomSchemaSetHelper.AddXmlSchemaToSet(XmlSchemaSet schemaSet, XmlSchemaResource schemaResource, HashSet`1 schemasAlreadyAdded)
     at System.Data.EntityModel.SchemaObjectModel.Schema.SomSchemaSetHelper.ComputeSchemaSet(SchemaDataModelOption dataModel)
     at System.Data.Common.Utils.Memoizer`2.Result.GetValue()
     at System.Data.Common.Utils.Memoizer`2.Evaluate(TArg arg)
     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&amp; 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.MetadataCache.EdmMetadataEntry.LoadEdmItemCollection(MetadataArtifactLoader loader)
     at System.Data.Metadata.Edm.MetadataCache.LoadItemCollection[T](IItemCollectionLoader`1 itemCollectionLoader, T entry)
     at System.Data.Metadata.Edm.MetadataCache.GetOrCreateEdmItemCollection(String cacheKey, MetadataArtifactLoader loader, Object&amp; entryToken)
     at System.Data.EntityClient.EntityConnection.GetMetadataWorkspace(Boolean initializeAllCollections)
     at System.Data.Objects.ObjectContext..ctor(EntityConnection connection, Boolean isConnectionConstructor)
     at System.Data.Entity.Internal.InternalConnection.CreateObjectContextFromConnectionModel()
     at System.Data.Entity.Internal.LazyInternalContext.InitializeContext()
     at System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(Type entityType)
     at System.Data.Entity.Internal.Linq.InternalSet`1.Initialize()
     at System.Data.Entity.Internal.Linq.InternalSet`1.get_InternalContext()
     at System.Data.Entity.Infrastructure.DbQuery`1.System.Linq.IQueryable.get_Provider()
     at System.Linq.Queryable.Join[TOuter,TInner,TKey,TResult](IQueryable`1 outer, IEnumerable`1 inner, Expression`1 outerKeySelector, Expression`1 innerKeySelector, Expression`1 resultSelector)
     at FRMobileApplication.Controllers.PreScreenController.GetClientDetails(String jobCode) in C:\Users\AAM\Documents\Choy Projects\FRMobile\FRMobileApplication\FRMobileApplication\Controllers\PreScreenController.cs:line 492
     at FRMobileApplication.Controllers.PreScreenController.PreScreen() in C:\Users\AAM\Documents\Choy Projects\FRMobile\FRMobileApplication\FRMobileApplication\Controllers\PreScreenController.cs:line 30
     at lambda_method(Closure , ControllerBase , Object[] )
     at System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters)
     at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters)
     at System.Web.Mvc.ControllerActionInvoker.&lt;&gt;c__DisplayClass15.&lt;InvokeActionMethodWithFilters&gt;b__12()
     at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation)
     at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodWithFilters(ControllerContext controllerContext, IList`1 filters, ActionDescriptor actionDescriptor, IDictionary`2 parameters)
     at System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName)
  </code></pre>
  
  <p>This page works in the other domain. also tried to add System.Xml.Linq but still no luck.
  Thanks in advance.</p>
  
  <p>I have this method GetClientDetails() that executed LINQ, it seems that the error is caused by that LINQ, I used EF4.</p>
  
  <pre><code>using (frEntities db = new frEntities())
  {
      var client = (from c in db.CLIENTs
                    join p in db.POSITIONs on c.CLIENT_ID equals p.CLIENT_ID
                    join cf in db.Client_Features on c.CLIENT_ID equals cf.Client_ID
                    where p.POSITION_JobCode == jobCode
                    select new{
                        c.CLIENT_ID,
                        p.POSITIONTYPE_ID
                    }).FirstOrDefault();
   }
  </code></pre>
  
  <p><strong>Answer Update</strong></p>
  
  <p>I got it working, we just updated the EF4 to EF6.1 and fixed some references.</p>