© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•14mo ago•
12 replies
SevenMgCreatine

LINQ: Duplicate key after GroupBy

Hello,

I have the following problem: I get an ArgumentException in the following code:

https://paste.mod.gg/jmzxdwctfzpw/0

The exception in the client system is: System.ArgumentException - An item with the same key has already been added. I don't understand how this could happen, because I
m already grouping the values by the userid and this is also the  key for the dictionary. So "GroupBy" creates multiple groups with the "same key"?

I don't have access to the client system, so I
m already grouping the values by the userid and this is also the  key for the dictionary. So "GroupBy" creates multiple groups with the "same key"?

I don't have access to the client system, so I
m looking for potential causes for the exception. I am working with EF Core.

Thanks for helping.
BlazeBin - jmzxdwctfzpw
A tool for sharing your source code with the world!
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

CosmosDB Linq GroupBy
C#CC# / help
3y ago
✅ LINQ GroupBy error
C#CC# / help
4y ago
❔ Predicate in LINQ GroupBy
C#CC# / help
4y ago
duplicate key error efcore
C#CC# / help
2y ago