[Mono-dev] Entity Framework - new issues

Atsushi Eno atsushieno at veritas-vos-liberabit.com
Tue Feb 12 22:02:25 UTC 2013


yw - it still seems like some xml schema issue, namely PSVI handling in 
XmlSchemaValidatingReader (ok, less than 0.1% of people understand it).

In case you don't mind patching EF, here is mine that goes beyond that 
issue.

Atsushi Eno

Олег wrote:
> Many thanks to Atsushi Eno for a solution for previous defect in 
> System.Xml.
>
> But there are new issues with EF. I tried to create simplest console 
> application (file Test.zip attached to this letter, contains 
> MonoDevelop project), it fails with following exception:
>
> System.ArgumentException: An element with the same key already exists 
> in the dictionary.
>   at 
> System.Collections.Generic.Dictionary`2[System.String,System.Object].Add 
> (System.String key, System.Object value) [0x0007e] in 
> /usr/ports/lang/mono/work/mono-3.0.3/mcs/class/corlib/System.Collections.Generic/Dictionary.cs:423
>   at 
> System.Data.Entity.Core.EntityModel.SchemaObjectModel.TypeUsageBuilder.HandleNullableAttribute 
> (System.Xml.XmlReader reader) [0x00015] in 
> /usr/ports/lang/mono/work/mono-3.0.3/external/entityframework/src/EntityFramework/Core/EntityModel/SchemaObjectModel/TypeUsageBuilder.cs:605
>   at 
> System.Data.Entity.Core.EntityModel.SchemaObjectModel.TypeUsageBuilder.InternalHandleAttribute 
> (System.Xml.XmlReader reader) [0x00010] in 
> /usr/ports/lang/mono/work/mono-3.0.3/external/entityframework/src/EntityFramework/Core/EntityModel/SchemaObjectModel/TypeUsageBuilder.cs:300
>   at 
> System.Data.Entity.Core.EntityModel.SchemaObjectModel.TypeUsageBuilder.HandleAttribute 
> (System.Xml.XmlReader reader) [0x00000] in 
> /usr/ports/lang/mono/work/mono-3.0.3/external/entityframework/src/EntityFramework/Core/EntityModel/SchemaObjectModel/TypeUsageBuilder.cs:291
>   at 
> System.Data.Entity.Core.EntityModel.SchemaObjectModel.StructuredProperty.HandleAttribute 
> (System.Xml.XmlReader reader) [0x00040] in 
> /usr/ports/lang/mono/work/mono-3.0.3/external/entityframework/src/EntityFramework/Core/EntityModel/SchemaObjectModel/StructuredProperty.cs:227
>   at 
> System.Data.Entity.Core.EntityModel.SchemaObjectModel.SchemaElement.ParseAttribute 
> (System.Xml.XmlReader reader) [0x0006a] in 
> /usr/ports/lang/mono/work/mono-3.0.3/external/entityframework/src/EntityFramework/Core/EntityModel/SchemaObjectModel/SchemaElement.cs:592
>   at 
> System.Data.Entity.Core.EntityModel.SchemaObjectModel.SchemaElement.Parse 
> (System.Xml.XmlReader reader) [0x0001d] in 
> /usr/ports/lang/mono/work/mono-3.0.3/external/entityframework/src/EntityFramework/Core/EntityModel/SchemaObjectModel/SchemaElement.cs:193
>   at 
> System.Data.Entity.Core.EntityModel.SchemaObjectModel.StructuredType.HandlePropertyElement 
> (System.Xml.XmlReader reader) [0x00007] in 
> /usr/ports/lang/mono/work/mono-3.0.3/external/entityframework/src/EntityFramework/Core/EntityModel/SchemaObjectModel/StructuredType.cs:387
>   at 
> System.Data.Entity.Core.EntityModel.SchemaObjectModel.StructuredType.HandleElement 
> (System.Xml.XmlReader reader) [0x0001f] in 
> /usr/ports/lang/mono/work/mono-3.0.3/external/entityframework/src/EntityFramework/Core/EntityModel/SchemaObjectModel/StructuredType.cs:267
>   at 
> System.Data.Entity.Core.EntityModel.SchemaObjectModel.SchemaEntityType.HandleElement 
> (System.Xml.XmlReader reader) [0x00000] in 
> /usr/ports/lang/mono/work/mono-3.0.3/external/entityframework/src/EntityFramework/Core/EntityModel/SchemaObjectModel/ItemType.cs:198
>   at 
> System.Data.Entity.Core.EntityModel.SchemaObjectModel.SchemaElement.ParseElement 
> (System.Xml.XmlReader reader) [0x0002c] in 
> /usr/ports/lang/mono/work/mono-3.0.3/external/entityframework/src/EntityFramework/Core/EntityModel/SchemaObjectModel/SchemaElement.cs:746
>   at 
> System.Data.Entity.Core.EntityModel.SchemaObjectModel.SchemaElement.Parse 
> (System.Xml.XmlReader reader) [0x000d0] in 
> /usr/ports/lang/mono/work/mono-3.0.3/external/entityframework/src/EntityFramework/Core/EntityModel/SchemaObjectModel/SchemaElement.cs:220
>   at 
> System.Data.Entity.Core.EntityModel.SchemaObjectModel.Schema.HandleEntityTypeElement 
> (System.Xml.XmlReader reader) [0x00007] in 
> /usr/ports/lang/mono/work/mono-3.0.3/external/entityframework/src/EntityFramework/Core/EntityModel/SchemaObjectModel/Schema.cs:1023
>   at 
> System.Data.Entity.Core.EntityModel.SchemaObjectModel.Schema.HandleElement 
> (System.Xml.XmlReader reader) [0x0001f] in 
> /usr/ports/lang/mono/work/mono-3.0.3/external/entityframework/src/EntityFramework/Core/EntityModel/SchemaObjectModel/Schema.cs:592
>   at 
> System.Data.Entity.Core.EntityModel.SchemaObjectModel.SchemaElement.ParseElement 
> (System.Xml.XmlReader reader) [0x0002c] in 
> /usr/ports/lang/mono/work/mono-3.0.3/external/entityframework/src/EntityFramework/Core/EntityModel/SchemaObjectModel/SchemaElement.cs:746
>   at 
> System.Data.Entity.Core.EntityModel.SchemaObjectModel.SchemaElement.Parse 
> (System.Xml.XmlReader reader) [0x000d0] in 
> /usr/ports/lang/mono/work/mono-3.0.3/external/entityframework/src/EntityFramework/Core/EntityModel/SchemaObjectModel/SchemaElement.cs:220
>   at 
> System.Data.Entity.Core.EntityModel.SchemaObjectModel.Schema.HandleTopLevelSchemaElement 
> (System.Xml.XmlReader reader) [0x0000e] in 
> /usr/ports/lang/mono/work/mono-3.0.3/external/entityframework/src/EntityFramework/Core/EntityModel/SchemaObjectModel/Schema.cs:1005
>   at 
> System.Data.Entity.Core.EntityModel.SchemaObjectModel.Schema.InternalParse 
> (System.Xml.XmlReader sourceReader, System.String sourceLocation) 
> [0x0021e] in 
> /usr/ports/lang/mono/work/mono-3.0.3/external/entityframework/src/EntityFramework/Core/EntityModel/SchemaObjectModel/Schema.cs:210
>   at 
> System.Data.Entity.Core.EntityModel.SchemaObjectModel.Schema.Parse 
> (System.Xml.XmlReader sourceReader, System.String sourceLocation) 
> [0x0000f] in 
> /usr/ports/lang/mono/work/mono-3.0.3/external/entityframework/src/EntityFramework/Core/EntityModel/SchemaObjectModel/Schema.cs:100
>   at 
> System.Data.Entity.Core.EntityModel.SchemaObjectModel.SchemaManager.ParseAndValidate 
> (IEnumerable`1 xmlReaders, IEnumerable`1 sourceFilePaths, 
> SchemaDataModelOption dataModel, 
> System.Data.Entity.Core.EntityModel.SchemaObjectModel.AttributeValueNotification 
> providerNotification, 
> System.Data.Entity.Core.EntityModel.SchemaObjectModel.AttributeValueNotification 
> providerManifestTokenNotification, 
> System.Data.Entity.Core.EntityModel.SchemaObjectModel.ProviderManifestNeeded 
> providerManifestNeeded, IList`1& schemaCollection) [0x0008a] in 
> /usr/ports/lang/mono/work/mono-3.0.3/external/entityframework/src/EntityFramework/Core/EntityModel/SchemaObjectModel/SchemaManager.cs:152
>   at 
> System.Data.Entity.Core.EntityModel.SchemaObjectModel.SchemaManager.ParseAndValidate 
> (IEnumerable`1 xmlReaders, IEnumerable`1 sourceFilePaths, 
> SchemaDataModelOption dataModel, 
> System.Data.Entity.Core.Common.DbProviderManifest providerManifest, 
> IList`1& schemaCollection) [0x0000d] in 
> /usr/ports/lang/mono/work/mono-3.0.3/external/entityframework/src/EntityFramework/Core/EntityModel/SchemaObjectModel/SchemaManager.cs:102
>   at System.Data.Entity.Core.Metadata.Edm.EdmItemCollection.LoadItems 
> (IEnumerable`1 xmlReaders, IEnumerable`1 sourceFilePaths, 
> SchemaDataModelOption dataModelOption, 
> System.Data.Entity.Core.Common.DbProviderManifest providerManifest, 
> System.Data.Entity.Core.Metadata.Edm.ItemCollection itemCollection, 
> Boolean throwOnError) [0x00002] in 
> /usr/ports/lang/mono/work/mono-3.0.3/external/entityframework/src/EntityFramework/Core/Metadata/EdmItemCollection.cs:245
>   at System.Data.Entity.Core.Metadata.Edm.EdmItemCollection.Init 
> (IEnumerable`1 xmlReaders, IEnumerable`1 filePaths, Boolean 
> throwOnError) [0x00006] in 
> /usr/ports/lang/mono/work/mono-3.0.3/external/entityframework/src/EntityFramework/Core/Metadata/EdmItemCollection.cs:126
>   at System.Data.Entity.Core.Metadata.Edm.EdmItemCollection..ctor 
> (IEnumerable`1 xmlReaders, IEnumerable`1 filePaths, Boolean 
> skipInitialization) [0x00023] in 
> /usr/ports/lang/mono/work/mono-3.0.3/external/entityframework/src/EntityFramework/Core/Metadata/EdmItemCollection.cs:41
>   at 
> System.Data.Entity.Core.Metadata.Edm.MetadataCache+EdmMetadataEntry.LoadEdmItemCollection 
> (System.Data.Entity.Core.Metadata.Edm.MetadataArtifactLoader loader) 
> [0x00008] in 
> /usr/ports/lang/mono/work/mono-3.0.3/external/entityframework/src/EntityFramework/Core/Metadata/MetadataCache.cs:653
>   at 
> System.Data.Entity.Core.Metadata.Edm.MetadataCache+EdmItemCollectionLoader.LoadItemCollection 
> (System.Data.Entity.Core.Metadata.Edm.EdmMetadataEntry entry) 
> [0x00000] in 
> /usr/ports/lang/mono/work/mono-3.0.3/external/entityframework/src/EntityFramework/Core/Metadata/MetadataCache.cs:834
>   at 
> System.Data.Entity.Core.Metadata.Edm.MetadataCache.LoadItemCollection[EdmMetadataEntry] 
> (IItemCollectionLoader`1 itemCollectionLoader, 
> System.Data.Entity.Core.Metadata.Edm.EdmMetadataEntry entry) [0x00037] 
> in 
> /usr/ports/lang/mono/work/mono-3.0.3/external/entityframework/src/EntityFramework/Core/Metadata/MetadataCache.cs:367
>   at 
> System.Data.Entity.Core.Metadata.Edm.MetadataCache.GetOrCreateEdmItemCollection 
> (System.String cacheKey, 
> System.Data.Entity.Core.Metadata.Edm.MetadataArtifactLoader loader, 
> System.Object& entryToken) [0x00020] in 
> /usr/ports/lang/mono/work/mono-3.0.3/external/entityframework/src/EntityFramework/Core/Metadata/MetadataCache.cs:273
>   at 
> System.Data.Entity.Core.EntityClient.EntityConnection.LoadEdmItemCollection 
> (System.Data.Entity.Core.Metadata.Edm.MetadataWorkspace workspace, 
> System.Data.Entity.Core.Metadata.Edm.MetadataArtifactLoader 
> artifactLoader) [0x0000f] in 
> /usr/ports/lang/mono/work/mono-3.0.3/external/entityframework/src/EntityFramework/Core/EntityClient/EntityConnection.cs:1053
>   at 
> System.Data.Entity.Core.EntityClient.EntityConnection.GetMetadataWorkspace 
> (Boolean initializeAllCollections) [0x000b6] in 
> /usr/ports/lang/mono/work/mono-3.0.3/external/entityframework/src/EntityFramework/Core/EntityClient/EntityConnection.cs:467
>   at 
> System.Data.Entity.Core.Objects.ObjectContext.RetrieveMetadataWorkspaceFromConnection 
> () [0x00017] in 
> /usr/ports/lang/mono/work/mono-3.0.3/external/entityframework/src/EntityFramework/Core/Objects/ObjectContext.cs:1839
>   at System.Data.Entity.Core.Objects.ObjectContext..ctor 
> (System.Data.Entity.Core.EntityClient.EntityConnection connection, 
> Boolean isConnectionConstructor, 
> System.Data.Entity.Core.Objects.Internal.ObjectQueryExecutionPlanFactory 
> objectQueryExecutionPlanFactory, 
> System.Data.Entity.Core.Common.Internal.Materialization.Translator 
> translator) [0x000bc] in 
> /usr/ports/lang/mono/work/mono-3.0.3/external/entityframework/src/EntityFramework/Core/Objects/ObjectContext.cs:192
>   at System.Data.Entity.Core.Objects.ObjectContext..ctor 
> (System.String connectionString) [0x00000] in 
> /usr/ports/lang/mono/work/mono-3.0.3/external/entityframework/src/EntityFramework/Core/Objects/ObjectContext.cs:114
>   at System.Data.Entity.Core.Objects.ObjectContext..ctor 
> (System.String connectionString, System.String defaultContainerName) 
> [0x00000] in 
> /usr/ports/lang/mono/work/mono-3.0.3/external/entityframework/src/EntityFramework/Core/Objects/ObjectContext.cs:134
>   at TestModel.TestEntities..ctor () [0x00000] in 
> /home/Test/Test/TestModel.Designer.cs:46
>   at Test.Program.Main (System.String[] args) [0x00001] in 
> /home/Test/Test/Program.cs:11
>
> Honestly, I'm going to investigate and probably rewrite my code to 
> NHibernate, but if this sample project will be useful for someone who 
> will try to make support of Entity Framework on Mono better, I would 
> be glad to know it.
>
> With best regards,
> Oleg
>
>
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list

-------------- next part --------------
A non-text attachment was scrubbed...
Name: ef-workaround.patch
Type: text/x-patch
Size: 2705 bytes
Desc: not available
URL: <http://lists.ximian.com/pipermail/mono-devel-list/attachments/20130213/8fd6b612/attachment.bin>


More information about the Mono-devel-list mailing list