Skip to main content

Hi All,


I'm trying to upload process that included dll files (It's about dll for connect database via NHibernate). I do this on server event and start the activity every 1 minute when my function is called. I get the error 'An item with the same key has already been added'.


I don't know what the error is about. Could anyone help me for this?


Thank you,


Kanok

A few questions:


1) is this error happening when you upload the process defintion, or at runtime when your process is executing (it looks like it happens when the  process is running?)


2) can you verify whether this error is being thrown from K2, or from your code? The easiest way to do this, is to add 'Console.WriteLine();' statements into your code, and run K2 server in console mode This should help you to narrow down where the error is being thrown. You could also attach a debugger to the K2Server process and  step into your code, but then you will need to install the remote debugging service on your K2 server and copy your assembly debug symbols (.pdb) files over to the k2 server as well.


3) this error usually happens when you have a C# collection that has ID's (a namevalue collection maybe, or a dictionary), and for some reason a duplicate ID is being added. If the error is being thrown from your code, perhaps check where the ID's are coming from that you are attempting to add to the collection - maybe there is a duplicate row somewhere


4)  'start the activity every 1 minute' - what does this mean? Are you starting an instance of the process every 1 minute? Or are you looping back to the same activity and starting a new instance of the same activity every minute (if this is the case, I suspect that there is a duplicate identifier being added to a collection, as described in point 3 above)


Cheerio


Neil


Sorry Neil,



I apologize to be so late to answer you. My problem is solved.



The problem is,


I create static variable on server then my code try to create the same data everytime I call this event.
So, I have to check null value before I create that variable.

Thank you for your quick response,
Kanok


Reply