I am trying to build a domain on a remote server but i am keep getting the following error

"An item with the same key has already been added."

StackTrace: " at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)\r\n at System.Collections.Generic.Dictionary2.Insert(TKey key, TValue value, Boolean add)\r\n at System.Collections.Generic.Dictionary2.Add(TKey key, TValue value)\r\n at Xtensive.Sql.Model.NodeCollection1.Add(TNode item)\r\n at Xtensive.Sql.Model.PairedNodeCollection2.Add(TNode item)\r\n at Xtensive.Sql.Model.Schema.ChangeCatalog(Catalog value)\r\n at Xtensive.Sql.Model.CatalogNode.set_Catalog(Catalog value)\r\n at Xtensive.Sql.Model.CatalogNode..ctor(Catalog catalog, String name)\r\n at Xtensive.Sql.Model.Schema..ctor(Catalog catalog, String name)\r\n at Xtensive.Sql.Model.Catalog.CreateSchema(String name)\r\n at Xtensive.Sql.SqlServer.v2005.Extractor.ExtractSchemas()\r\n at Xtensive.Sql.SqlServer.v2005.Extractor.ExtractCatalog()\r\n at Xtensive.Sql.SqlServer.v2005.Extractor.ExtractSchema()\r\n at Xtensive.Sql.Model.Extractor.ExtractSchema(String name)\r\n at Xtensive.Sql.SqlDriver.ExtractSchema(SqlConnection connection, DbTransaction transaction, String schemaName)\r\n at Xtensive.Sql.SqlDriver.ExtractDefaultSchema(SqlConnection connection, DbTransaction transaction)\r\n at Xtensive.Storage.Providers.Sql.SchemaUpgradeHandler.GetStorageSchema()\r\n at Xtensive.Storage.Providers.Sql.SchemaUpgradeHandler.GetExtractedSchema()\r\n at Xtensive.Storage.Building.Builders.DomainBuilder.SynchronizeSchema(SchemaUpgradeMode schemaUpgradeMode)\r\n at Xtensive.Storage.Building.Builders.DomainBuilder.BuildDomain(DomainConfiguration configuration, DomainBuilderConfiguration builderConfiguration)\r\n at Xtensive.Storage.Upgrade.UpgradingDomainBuilder.BuildStageDomain(UpgradeStage stage)\r\n at Xtensive.Storage.Upgrade.UpgradingDomainBuilder.Build(DomainConfiguration configuration)\r\n at Xtensive.Storage.Domain.Build(DomainConfiguration configuration)\r\n at fiod.drs.client.Program.Main() in J:\Projecten\Beta\Registratie\drs.client\Program.cs:line 92\r\n at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)\r\n at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)\r\n at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()\r\n at System.Threading.ThreadHelper.ThreadStart_Context(Object state)\r\n at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)\r\n at System.Threading.ThreadHelper.ThreadStart()"

Any idea what is causing this error?

I created a fresh database on the remote server, added a new user to it and a new schema, alter the user with the new schema..but still this error pops up...

Updated at 04.12.2009 21:07:04


By remote server I mean a remote sql server, not a local sql server. I will send you the sql script for my schema on monday when I am back at the office


This thread was imported from our support forum. The original discussion may contain more detailed answer.

asked Dec 04 '09 at 10:40

Martijnvl's gravatar image


What "remote server" really mean? Just a fresh new server? A server accessible via WCF/.NET Remoting?

(Dec 04 '09 at 10:40) Alex Yakunin Alex%20Yakunin's gravatar image

Btw, it looks like there is a bug in extractor. Could you send us SQL script re-generating your schema? It can be produced in SQL Server Management Studio using "Script objects" command.

(Dec 04 '09 at 10:40) Alex Yakunin Alex%20Yakunin's gravatar image

One Answer:

I briefly looked up the code of ExtractSchemas() method - could you send us the output of the following SQL as well:

select s.schema_id, s.name, dp.name from sys.schemas as s inner join sys.database_principals as dp on s.principal_id = dp.principal_id where s.schema_id < 16384

Btw, you're using some old version of DO4. There is no v2005 namespace now (it's called v9 now).

answered Dec 04 '09 at 22:24

Alex%20Yakunin's gravatar image

Alex Yakunin

Hello icodesharp, could you specify your connection url?

Does it contain database schema name? If so, check that database schema name in connection url is equal to database schema name in database. I mean case sensitivity.

(Dec 04 '09 at 22:24) Dmitri Maximov Dmitri%20Maximov's gravatar image


This morning I upgraded my version of doa 4.0.5 to 4.1. Problems seems to be solved now. Sorry for the inconvenience

Regards Martijn

(Dec 04 '09 at 22:24) Martijnvl Martijnvl's gravatar image


Below the outcome of the query you send me

Schema_ID Name          Name
1     dbo           dbo
2     guest         guest
4     sys           sys
5     drs           drs


(Dec 04 '09 at 22:24) Martijnvl Martijnvl's gravatar image
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!
toggle preview


Once you sign in you will be able to subscribe for any updates here



Asked: Dec 04 '09 at 10:40

Seen: 2,180 times

Last updated: Dec 04 '09 at 10:40

powered by OSQA