I am working on an ASP.Net MVC 3 web application using EF 4.1. Since today, I am getting this error:

System.ArgumentException: Duplicate type name within an assembly

and I can't figure out what is causing it. It is happening in my repository when performing a Find:

public virtual T GetById(long id)
{
    return dbset.Find(id);
}

Here is the stack trace:

[ArgumentException: Duplicate type name within an assembly.]
   System.Reflection.Emit.ModuleBuilder.CheckTypeNameConflict(String strTypeName, TypeBuilder enclosingType) +9544354
   System.Reflection.Emit.AssemblyBuilderData.CheckTypeNameConflict(String strTypeName, TypeBuilder enclosingType) +53
   System.Reflection.Emit.TypeBuilder.Init(String fullname, TypeAttributes attr, Type parent, Type[] interfaces, Module module, PackingSize iPackingSize, Int32 iTypeSize, TypeBuilder enclosingType) +178
   System.Reflection.Emit.ModuleBuilder.DefineType(String name, TypeAttributes attr, Type parent, Type[] interfaces) +118
   System.Data.Objects.Internal.ProxyTypeBuilder.get_TypeBuilder() +299
   System.Data.Objects.Internal.ProxyTypeBuilder.CreateType(ModuleBuilder moduleBuilder) +227
   System.Data.Objects.Internal.EntityProxyFactory.BuildType(ModuleBuilder moduleBuilder, ClrEntityType ospaceEntityType) +63
   System.Data.Objects.Internal.EntityProxyFactory.TryCreateProxyType(EntityType ospaceEntityType) +193
   System.Data.Objects.Internal.EntityProxyFactory.GetProxyType(ClrEntityType ospaceEntityType) +104
   System.Data.Common.Internal.Materialization.Translator.Visit(EntityColumnMap columnMap, TranslatorArg arg) +178
   System.Data.Query.InternalTrees.EntityColumnMap.Accept(ColumnMapVisitorWithResults`2 visitor, TArgType arg) +16
   System.Data.Common.Internal.Materialization.Translator.ProcessCollectionColumnMap(CollectionColumnMap columnMap, TranslatorArg arg, ColumnMap discriminatorColumnMap, Object discriminatorValue) +116
   System.Data.Common.In
Edit
Report