I am not sure what is going on but I keep getting the following exception when doing a query. \"Duplicate type name within an assembly.\" I have not been able to find a solu
As a work around, this only happens if you are single-stepping using the debugger. If you place your break point a few lines further down inside your source, the error will not show up.
I haven't uninstalled, and this at least allows me to continue working.
This is a new issue with EF 6.1.0, and the EF team is aware of the problem:
https://entityframework.codeplex.com/workitem/2228
Must be correcting "select Users;" segment of code :
var BaseQuery = from Users in db.Users
join UserInstalls in db.UserTenantInstalls on Users.ID equals UserInstalls.UserID
join Installs in db.TenantInstalls on UserInstalls.TenantInstallID equals Installs.ID
where
Users.Username == Username
&& Users.Password == Password
&& Installs.Name == Install
select Users;
Correction code :
select new { ID=Users.ID, F1= Users.forExampleField1,
F2= UserInstalls.forExampleFild1,
F3= Installs.forExampleFild1 ,
F4= Installs.forExampleFild2 };
The reason:
Foreign key fields in the class are present and "Linq" are not able to remove them which there was the following error:
Duplicate type name within an assembly
(Of course this problem Fault "entity framework" !)
I am a full explanation on this matter, But unfortunately my English is not very good and it is really hard for me to explain specialization, because I understand that many people do not understand what I mean. I apologize for this.
Turns out for us, a reboot of the server was all it was.
This seems to be fixed in 6.1.3.
Here's how I come to this conclusion:
I reliably reproduced this problem in a previous version (probably 6.1.2). Rebuilding my solution did not fix it. The stepping through with breakpoints before and after did reproduce the problem, while having breakpoints only after the point of the exception did not cause an exception, as stated here in other answers. [Summary: I seem to have the same problem as everyone else with the older version of EF.]
Given the exact same breakpoints and with no re-boot or anything like that, I just installed the update to Entity Framework. This did fix the issue, where I could step freely with breakpoints before and after the "problem code" with no exception being thrown anymore.
Since the issue is kind of random and temperamental to the conditions, it's hard to say definitively that the update to EF specifically addresses the issue, but so far so good.
I too was facing similar sort of issue, I fixed it by converting the result set to List i.e
var registers = registerRepository.All.ToList().Where(a=>a.AreaLatitude.Equals(0));
Converting the result ToList solved the issue to iterate it further.
and solved the issue.