none
ArgumentException: "An Item with the same key has already been added" error trying to add Stored Procedures to the model

    Question

  • I am trying to add a number of Stored Procedures to my model in VS2010 project.  The model doesn't contain any stored procedures prior to the add operation.  When I try to add the selected SPs I get an ArgumentException error with message "An Item with the same key has already been added".

    I took a look at the metadata query that EF runtime is running the get the SP information and the returned result set looks as follows:

    c1          c2           c3            c4       c5     c6     c7     c8     c9        c10    c11  

    ----------- ------------ ------------- -------- ------ ------ ------ ------ --------- ------ -----

              1 newton       sp_0p_0r      -             0      0      0      0 -         -      -    

              1 newton       fun_1p_1r     date          0      1      0      0 delta     int    IN   

              1 newton       sp_1p_0r      -             0      0      0      0 par1      int    IN   

              1 newton       sp_1p_1r      date          0      1      0      0 delta     int    IN   

              1 newton       sp_2p_6r      -             0      0      0      0 p_id      int    IN   

              1 newton       fun_1p_4rr    -             0      0      0      0 maxid     int    IN   

              1 newton       sp_2p_6r      -             0      0      0      0 p_echo    char   IN   

              1 newton       sp_1p_4rr     -             0      0      0      0 maxid     int    IN   

              1 newton       fun_2p_6r     -             0      0      0      0 p_id      int    IN   

              1 newton       fun_2p_6r     -             0      0      0      0 p_echo    char   IN  

    Adding SPs one by one I discovered that the SP causing the issue is "fun_2p_6r".  What I am trying to understand is why!  The result set doesn't seem to have any duplicate records, so there shouldn't be any key collision.

    Any help with this issue would be greatly appreciated.

    Thanks,

    Alex

    Tuesday, April 24, 2012 11:54 PM

All replies