Duplicate key exception thrown when using Maestro mapService.createMap

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Duplicate key exception thrown when using Maestro mapService.createMap

John Galambos-2
I'm coming across an issue when creating a RuntimeMap within Maestro.

When using the mapService.CreateMap(runTimeMapId, mapDefinition,
metersPerUnit), I am getting the following exception:

System.ArgumentException was unhandled
  HResult=-2147024809
  Message=An item with the same key has already been added.
  Source=mscorlib
  StackTrace:
       at System.ThrowHelper.ThrowArgumentException(ExceptionResource
resource)
       at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue
value, Boolean add)
       at System.Collections.Generic.Dictionary`2.Add(TKey key, TValue
value)
       at
OSGeo.MapGuide.MaestroAPI.Http.Commands.HttpGetResourceContents.PutCompleted(IResource
res) in c:\working\JenkinsCI\home\slave_win\jobs\Maestro
5.0.x\workspace\OSGeo.MapGuide.MaestroAPI.Http\Commands\HttpGetResourceContents.cs:line
51
       at
OSGeo.MapGuide.MaestroAPI.Http.Commands.HttpGetResourceContents.<>c__DisplayClass4.<Execute>b__1(Object
obj) in c:\working\JenkinsCI\home\slave_win\jobs\Maestro
5.0.x\workspace\OSGeo.MapGuide.MaestroAPI.Http\Commands\HttpGetResourceContents.cs:line
77
       at
System.Threading.QueueUserWorkItemCallback.WaitCallback_Context(Object
state)
       at System.Threading.ExecutionContext.RunInternal(ExecutionContext
executionContext, ContextCallback callback, Object state, Boolean
preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext
executionContext, ContextCallback callback, Object state, Boolean
preserveSyncCtx)
       at
System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
       at System.Threading.ThreadPoolWorkQueue.Dispatch()
       at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()
  InnerException:


Stepping through the code, it appears that this is happening because the
same layer is referenced twice within the map definition (although with a
different display name and within a different group).

In the OSGeo.MapGuide.MaestroAPI.Mapping.RunTimeMap class, there is a call
to   _getRes.Execute(GetLayerIds(mdf)).

That call yields all the layer.ResourceIds without checking if there are
duplicate resourceIds. The duplicates result in the exception when running
the
the OSGeo.MapGuide.MaestroAPI.Http.Commands.HttpGetResourceContent.Execute
method which fetches the resource contents of that layer twice and tries to
add it to the _completed dictionary twice with the layer.ResourceId as the
key.

Let me know if I should file this as a bug, or if I may be doing something
wrong.

I'm currently using the Maestro 5.0 branch but I've looked and this code
doesn't appear to be updated within the 5.1 branch. I am also hitting a MGE
2011 server.

Thank you,

John Galambos
_______________________________________________
mapguide-internals mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/mapguide-internals
Reply | Threaded
Open this post in threaded view
|

Re: Duplicate key exception thrown when using Maestro mapService.createMap

Jackie Ng
Yes, please do file this as a bug.

- Jackie