Quantcast
Channel: Entity Framework
Viewing all articles
Browse latest Browse all 10318

Commented Issue: Assert thrown when running P1 test case "ChangeComplexReturnTypeToCompatible" [1373]

$
0
0
The test case has following assert twice. After clicking Ignore on it, the test case passes eventually. Here is the text from the Assert.

```
---------------------------
Assertion Failed: Abort=Quit, Retry=Debug, Ignore=Continue
---------------------------
propertyMappings order does not correspond to the order of properties in the structuredType.



at System.Data.Entity.Core.Mapping.StorageMappingItemLoader.TryConvertToProperyMappings(StructuralType structuralType, RowType cTypeTvfElementType, RowType sTypeTvfElementType, EdmFunction functionImport, FunctionImportStructuralTypeMappingKB functionImportKB, IXmlLineInfo navLineInfo, List`1& propertyMappings)

at System.Data.Entity.Core.Mapping.StorageMappingItemLoader.TryCreateFunctionImportMappingComposableWithStructuralResult(EdmFunction functionImport, EdmFunction cTypeTargetFunction, List`1 typeMappings, RowType cTypeTvfElementType, RowType sTypeTvfElementType, IXmlLineInfo lineInfo, FunctionImportMappingComposable& mapping)

at System.Data.Entity.Core.Mapping.StorageMappingItemLoader.LoadFunctionImportMapping(XPathNavigator nav, StorageEntityContainerMapping entityContainerMapping)

at System.Data.Entity.Core.Mapping.StorageMappingItemLoader.LoadEntityContainerMappingChildNodes(XPathNavigator......

<truncated>
---------------------------
Abort Retry Ignore
---------------------------
```

This is complete stack trace
```
> EntityFramework.dll!System.Data.Entity.Core.Mapping.StorageMappingItemLoader.TryConvertToProperyMappings(System.Data.Entity.Core.Metadata.Edm.StructuralType structuralType, System.Data.Entity.Core.Metadata.Edm.RowType cTypeTvfElementType, System.Data.Entity.Core.Metadata.Edm.RowType sTypeTvfElementType, System.Data.Entity.Core.Metadata.Edm.EdmFunction functionImport, System.Data.Entity.Core.Mapping.FunctionImportStructuralTypeMappingKB functionImportKB, System.Xml.IXmlLineInfo navLineInfo, out System.Collections.Generic.List<System.Data.Entity.Core.Mapping.StoragePropertyMapping> propertyMappings) Line 2695 + 0x191 bytes C#
EntityFramework.dll!System.Data.Entity.Core.Mapping.StorageMappingItemLoader.TryCreateFunctionImportMappingComposableWithStructuralResult(System.Data.Entity.Core.Metadata.Edm.EdmFunction functionImport, System.Data.Entity.Core.Metadata.Edm.EdmFunction cTypeTargetFunction, System.Collections.Generic.List<System.Data.Entity.Core.Mapping.FunctionImportStructuralTypeMapping> typeMappings, System.Data.Entity.Core.Metadata.Edm.RowType cTypeTvfElementType, System.Data.Entity.Core.Metadata.Edm.RowType sTypeTvfElementType, System.Xml.IXmlLineInfo lineInfo, out System.Data.Entity.Core.Mapping.FunctionImportMappingComposable mapping) Line 2316 + 0x1f bytes C#
EntityFramework.dll!System.Data.Entity.Core.Mapping.StorageMappingItemLoader.LoadFunctionImportMapping(System.Xml.XPath.XPathNavigator nav, System.Data.Entity.Core.Mapping.StorageEntityContainerMapping entityContainerMapping) Line 1712 + 0x2e bytes C#
EntityFramework.dll!System.Data.Entity.Core.Mapping.StorageMappingItemLoader.LoadEntityContainerMappingChildNodes(System.Xml.XPath.XPathNavigator nav, System.Data.Entity.Core.Mapping.StorageEntityContainerMapping entityContainerMapping, System.Data.Entity.Core.Metadata.Edm.EntityContainer storageEntityContainerType) Line 435 + 0x2e bytes C#
EntityFramework.dll!System.Data.Entity.Core.Mapping.StorageMappingItemLoader.LoadEntityContainerMapping(System.Xml.XPath.XPathNavigator nav) Line 399 + 0x31 bytes C#
EntityFramework.dll!System.Data.Entity.Core.Mapping.StorageMappingItemLoader.LoadMappingChildNodes(System.Xml.XPath.XPathNavigator nav) Line 309 + 0x2d bytes C#
EntityFramework.dll!System.Data.Entity.Core.Mapping.StorageMappingItemLoader.LoadMappingItems(System.Xml.XPath.XPathNavigator nav) Line 243 + 0x1f bytes C#
EntityFramework.dll!System.Data.Entity.Core.Mapping.StorageMappingItemLoader.LoadMappingItems(System.Xml.XmlReader innerReader) Line 209 + 0x1f bytes C#
EntityFramework.dll!System.Data.Entity.Core.Mapping.StorageMappingItemLoader.StorageMappingItemLoader(System.Xml.XmlReader reader, System.Data.Entity.Core.Mapping.StorageMappingItemCollection storageMappingItemCollection, string fileName, System.Collections.Generic.Dictionary<System.Data.Entity.Core.Metadata.Edm.EdmMember,System.Collections.Generic.KeyValuePair<System.Data.Entity.Core.Metadata.Edm.TypeUsage,System.Data.Entity.Core.Metadata.Edm.TypeUsage>> scalarMemberMappings) Line 117 + 0x12 bytes C#
EntityFramework.dll!System.Data.Entity.Core.Mapping.StorageMappingItemCollection.LoadItems(System.Collections.Generic.IEnumerable<System.Xml.XmlReader> xmlReaders, System.Collections.Generic.IList<string> mappingSchemaUris, System.Collections.Generic.Dictionary<System.Data.Entity.Core.Metadata.Edm.EntitySetBase,System.Data.Entity.Core.Mapping.ViewGeneration.GeneratedView> userDefinedQueryViewsDict, System.Collections.Generic.Dictionary<System.Data.Entity.Core.Common.Utils.Pair<System.Data.Entity.Core.Metadata.Edm.EntitySetBase,System.Data.Entity.Core.Common.Utils.Pair<System.Data.Entity.Core.Metadata.Edm.EntityTypeBase,bool>>,System.Data.Entity.Core.Mapping.ViewGeneration.GeneratedView> userDefinedQueryViewsOfTypeDict, double expectedVersion) Line 1307 + 0x2b bytes C#
EntityFramework.dll!System.Data.Entity.Core.Mapping.StorageMappingItemCollection.Init(System.Data.Entity.Core.Metadata.Edm.EdmItemCollection edmCollection, System.Data.Entity.Core.Metadata.Edm.StoreItemCollection storeCollection, System.Collections.Generic.IEnumerable<System.Xml.XmlReader> xmlReaders, System.Collections.Generic.IList<string> filePaths, bool throwOnError) Line 740 + 0x27 bytes C#
EntityFramework.dll!System.Data.Entity.Core.Mapping.StorageMappingItemCollection.StorageMappingItemCollection(System.Data.Entity.Core.Metadata.Edm.EdmItemCollection edmItemCollection, System.Data.Entity.Core.Metadata.Edm.StoreItemCollection storeItemCollection, System.Collections.Generic.IEnumerable<System.Xml.XmlReader> xmlReaders, System.Collections.Generic.IList<string> filePaths, out System.Collections.Generic.IList<System.Data.Entity.Core.Metadata.Edm.EdmSchemaError> errors) Line 673 + 0x1d bytes C#
EntityFramework.dll!System.Data.Entity.Core.Mapping.StorageMappingItemCollection.Create(System.Data.Entity.Core.Metadata.Edm.EdmItemCollection edmItemCollection, System.Data.Entity.Core.Metadata.Edm.StoreItemCollection storeItemCollection, System.Collections.Generic.IEnumerable<System.Xml.XmlReader> xmlReaders, System.Collections.Generic.IList<string> filePaths, out System.Collections.Generic.IList<System.Data.Entity.Core.Metadata.Edm.EdmSchemaError> errors) Line 1500 + 0x25 bytes C#
Microsoft.Data.Entity.Design.Model.dll!Microsoft.Data.Entity.Design.Model.Validation.RuntimeMetadataValidator.ValidateMapping(Microsoft.Data.Entity.Design.Model.EntityDesignArtifact designArtifact, System.Data.Entity.Core.Metadata.Edm.EdmItemCollection edmItemCollection, System.Data.Entity.Core.Metadata.Edm.StoreItemCollection storeItemCollection) + 0x2bf bytes
Microsoft.Data.Entity.Design.Model.dll!Microsoft.Data.Entity.Design.Model.Validation.RuntimeMetadataValidator.ValidateArtifactSet(Microsoft.Data.Entity.Design.Model.EFArtifactSet artifactSet, bool forceValidation, bool validateMsl, bool runViewGen) + 0x16e bytes
Microsoft.Data.Entity.Design.Model.dll!Microsoft.Data.Entity.Design.Model.Validation.RuntimeMetadataValidator.ValidateAndCompileMappings(Microsoft.Data.Entity.Design.Model.EFArtifactSet artifactSet, bool validateMapping) + 0x35 bytes
Microsoft.Data.Entity.Design.Model.dll!Microsoft.Data.Entity.Design.Model.EntityDesignModelManager.ValidateAndCompileMappings(Microsoft.Data.Entity.Design.Model.EntityDesignArtifactSet artifactSet, bool doEscherValidation) + 0x143 bytes
Microsoft.Data.Entity.Design.dll!Microsoft.Data.Entity.Design.VisualStudio.VisualStudioEdmxValidator.ValidateArtifactAndWriteErrors(Microsoft.Data.Entity.Design.Model.EFArtifact artifact, Microsoft.VisualStudio.Shell.Interop.IVsHierarchy hierarchy, uint itemId, bool doEscherValidation) + 0x219 bytes
Microsoft.Data.Entity.Design.dll!Microsoft.Data.Entity.Design.VisualStudio.VisualStudioEdmxValidator.ValidateArtifactAndWriteErrors(Microsoft.Data.Entity.Design.Model.EFArtifact artifact, Microsoft.Data.Entity.Design.VisualStudio.VSFileFinder.VSFileInfo vsFileInfo, bool doEscherValidation) + 0x41 bytes
Microsoft.Data.Entity.Design.dll!Microsoft.Data.Entity.Design.VisualStudio.VisualStudioEdmxValidator.LoadAndValidateFiles(System.Collections.Generic.IEnumerable<Microsoft.Data.Entity.Design.VisualStudio.VSFileFinder.VSFileInfo> edmxFilesToValidate, bool doEscherValidation, System.Func<Microsoft.Data.Entity.Design.Model.EFArtifact,bool> shouldValidateArtifact) + 0x17c bytes
Microsoft.Data.Entity.Design.dll!Microsoft.Data.Entity.Design.VisualStudio.VisualStudioEdmxValidator.LoadAndValidateAllFilesInProject(Microsoft.VisualStudio.Shell.Interop.IVsHierarchy pHierProj, bool doEscherValidation, System.Func<Microsoft.Data.Entity.Design.Model.EFArtifact,bool> shouldValidateArtifact) + 0xc8 bytes
Microsoft.Data.Entity.Design.dll!Microsoft.Data.Entity.Design.VisualStudio.EdmUpdateSolutionEvents.Microsoft.VisualStudio.Shell.Interop.IVsUpdateSolutionEvents2.UpdateProjectCfg_Begin(Microsoft.VisualStudio.Shell.Interop.IVsHierarchy pHierProj, Microsoft.VisualStudio.Shell.Interop.IVsCfg pCfgProj, Microsoft.VisualStudio.Shell.Interop.IVsCfg pCfgSln, uint dwAction, ref int pfCancel) + 0xa4 bytes
"
```

The file where the assert is: \entityframework\src\EntityFramework\Core\Mapping\StorageMappingItemLoader.cs


Comments: Issue is that at line 2677 of StorageMappingItemLoader (and also at line 2667 though we're not hitting that in this scenario) we are creating and adding errors to the list but failing to set the local flag errorsFound to true. Later this means we a) raise the Assert and b) return true where we should return false. If we had returned false we would have returned false immediately from the next method in the call stack (and so on down the stack); instead we create other objects and return an invalid true - which leads the runtime to think it's constructing a valid model when it isn't. Recommend we fix. Fix is fairly simple - just setting errorsFound = true in those 2 locations.

Viewing all articles
Browse latest Browse all 10318

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>