Exception from build on Ci server

Discussion of open issues, suggestions and bugs regarding Entity Developer - ORM modeling and code generation tool
Post Reply
DavidKSynGro
Posts: 1
Joined: Mon 17 Dec 2018 16:42

Exception from build on Ci server

Post by DavidKSynGro » Tue 18 Dec 2018 10:14

I'm getting the following exception when building on an agent in Azure DevOps:

2018-12-17T15:50:54.9493500Z Error Message:
2018-12-17T15:50:54.9493547Z Initialization method Dash.UnitTests.Services.GroupServiceFixture.TestInitialize threw exception. System.Data.Entity.Core.MetadataException: System.Data.Entity.Core.MetadataException: Unable to load the specified metadata resource..
2018-12-17T15:50:54.9493640Z Stack Trace:
2018-12-17T15:50:54.9493672Z
2018-12-17T15:50:54.9493729Z Server stack trace:
2018-12-17T15:50:54.9493763Z at System.Data.Entity.Core.Metadata.Edm.MetadataArtifactLoaderResource.LoadResource()
2018-12-17T15:50:54.9493798Z at System.Data.Entity.Core.Metadata.Edm.MetadataArtifactLoaderResource.CreateReader()
2018-12-17T15:50:54.9493833Z at System.Data.Entity.Core.Metadata.Edm.MetadataArtifactLoaderResource.CreateReaders(DataSpace spaceToGet)
2018-12-17T15:50:54.9493902Z at System.Data.Entity.Core.Metadata.Edm.MetadataArtifactLoaderComposite.CreateReaders(DataSpace spaceToGet)
2018-12-17T15:50:54.9493937Z at System.Data.Entity.Core.Metadata.Edm.MetadataCache.LoadEdmItemCollection(MetadataArtifactLoader loader)
2018-12-17T15:50:54.9493972Z at System.Data.Entity.Core.Metadata.Edm.MetadataCache.<>c__DisplayClass5.<GetMetadataWorkspace>b__0(String k)
2018-12-17T15:50:54.9494035Z at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)
2018-12-17T15:50:54.9494072Z at System.Data.Entity.Core.Metadata.Edm.MetadataCache.GetMetadataWorkspace(String cacheKey, MetadataArtifactLoader artifactLoader)
2018-12-17T15:50:54.9494108Z at System.Data.Entity.Core.Metadata.Edm.MetadataCache.GetMetadataWorkspace(DbConnectionOptions effectiveConnectionOptions)
2018-12-17T15:50:54.9494165Z at System.Data.Entity.Core.EntityClient.EntityConnection.GetMetadataWorkspace()
2018-12-17T15:50:54.9494200Z at System.Data.Entity.Core.Objects.ObjectContext.RetrieveMetadataWorkspaceFromConnection()
2018-12-17T15:50:54.9494389Z at System.Data.Entity.Core.Objects.ObjectContext..ctor(EntityConnection connection, Boolean isConnectionConstructor, ObjectQueryExecutionPlanFactory objectQueryExecutionPlanFactory, Translator translator, ColumnMapFactory columnMapFactory)
2018-12-17T15:50:54.9494451Z at System.Data.Entity.Internal.InternalConnection.CreateObjectContextFromConnectionModel()
2018-12-17T15:50:54.9494551Z at System.Data.Entity.Internal.LazyInternalConnection.CreateObjectContextFromConnectionModel()
2018-12-17T15:50:54.9494609Z at System.Data.Entity.Internal.LazyInternalContext.InitializeContext()
2018-12-17T15:50:54.9494642Z at System.Data.Entity.Internal.InternalContext.Initialize()
2018-12-17T15:50:54.9494676Z at System.Data.Entity.Internal.InternalContext.ForceOSpaceLoadingForKnownEntityTypes()
2018-12-17T15:50:54.9494736Z at System.Data.Entity.DbContext.System.Data.Entity.Infrastructure.IObjectContextAdapter.get_ObjectContext()
2018-12-17T15:50:54.9494779Z at SyngroObjects.Syngro_DemoEntities..ctor() in D:\a\1\s\Syngro\SyngroDataLayer\APIContext.Context.cs:line 25
2018-12-17T15:50:54.9494816Z at Dash.UnitTests.Services.GroupServiceFixture.TestInitialize() in D:\a\1\s\Syngro\Dashboard.UnitTests\Services\GroupServiceFixture.cs:line 22
2018-12-17T15:50:54.9494874Z at System.Runtime.Remoting.Messaging.Message.Dispatch(Object target)
2018-12-17T15:50:54.9494914Z at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg)
2018-12-17T15:50:54.9494945Z Exception rethrown at [0]:
2018-12-17T15:50:54.9495002Z at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
2018-12-17T15:50:54.9495037Z at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
2018-12-17T15:50:54.9495069Z at Dash.UnitTests.Services.GroupServiceFixture.TestInitialize()
2018-12-17T15:50:55.1097838Z Failed WillGetGroupForUser


This is a unit test that is attempting to connect to the database. I've noted that the project builds currently but I haven't actually installed Entity Developer on the agent and i was hoping that this wasn't required. Local builds work fine.


Any help here would be much appreciated.

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: Exception from build on Ci server

Post by Shalex » Wed 19 Dec 2018 13:54

Please try the following approach:
1) use Metadata Artifact Processing="Copy To Output Directory" to generate the *.ssdl, *.csdl, *.msl files on your development workstation and add them to the web project on your build server
2) set Build Action=Embedded resource in the properties of *.ssdl, *.csdl, *.msl
3) compile your WebApplication1.dll and open it in JustDecompile to find out the actual names of resources to specify them in the connection string

For example, after I added DataModel1.csdl, DataModel1.ssdl, DataModel1.msl to my WebApplication1, the names of resources included the "WebApplication1." prefix, the result connection string was the following:

Code: Select all

connectionString="metadata=res://WebApplication1/WebApplication1.DataModel1.csdl|res://WebApplication1/WebApplication1.DataModel1.ssdl|res://WebApplication1/WebApplication1.DataModel1.msl;...

Post Reply