You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If the referred assembly contains more than one lambda expression, the generated closure classes have the same name, and therefore the dictionary construction throws.
We should be able to handle this case without an exception - and, in general, give a better exception message than the currently pretty non-descript one (included at the bottom).
public class Repro
{
private class FooContainer
{
private Func<object, bool> Foo = _ => true;
}
private class BarContainer
{
private Func<object, bool> Bar = _ => false;
}
[Fact]
public void AssemblyRegistryThrows()
{
var registry = new AssemblyEventRegistry(typeof(Repro));
}
}
System.ArgumentException : An item with the same key has already been added. Key: <>c
at System.ThrowHelper.ThrowAddingDuplicateWithKeyArgumentException(Object key)
at System.Collections.Generic.Dictionary2.TryInsert(TKey key, TValue value, InsertionBehavior behavior) at System.Collections.Generic.Dictionary2.Add(TKey key, TValue value)
at System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement](IEnumerable1 source, Func2 keySelector, Func2 elementSelector, IEqualityComparer1 comparer)
at System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement](IEnumerable1 source, Func2 keySelector, Func2 elementSelector) at RdbmsEventStore.EventRegistry.AssemblyEventRegistry..ctor(Type markerType, Func2 namer, Func`2 inclusionPredicate) in C:\Work\Deloitte\EventSourcing.POC\src\RdbmsEventStore\EventRegistry\AssemblyEventRegistry.cs:line 25
at RdbmsEventStore.EventRegistry.AssemblyEventRegistry..ctor(Type markerType) in C:\Work\Deloitte\EventSourcing.POC\src\RdbmsEventStore\EventRegistry\AssemblyEventRegistry.cs:line 10
at RdbmsEventStore.Tests.Repro.AssemblyRegistryThrows() in C:\Work\Deloitte\EventSourcing.POC\src\RdbmsEventStore.Tests\Repro.cs:line 22
The text was updated successfully, but these errors were encountered:
If the referred assembly contains more than one lambda expression, the generated closure classes have the same name, and therefore the dictionary construction throws.
We should be able to handle this case without an exception - and, in general, give a better exception message than the currently pretty non-descript one (included at the bottom).
The text was updated successfully, but these errors were encountered: