Menu Close

Tag: problem

Entity Framework’s quirk: imagined ambiguity


Lots have been said about Entity Framework, in past mostly bad things. Lately I hear more and more voices speaking in advantage of this library. It is being said that it has reached maturity point and is actually usable now. Of course it was usable earlier, but it had its quirks. Unfortunately some are still there. I have recently found one that I couldn’t really believe is true. I had(also severe) problems with EF before, but this one is absolutely no-go for me. If exception message below reads familiar, then most probably you are experiencing it too.


Schema specified is not valid. Errors:

The mapping of CLR type to EDM type is ambiguous because multiple CLR types match the EDM type ‘<<entity name>>’. Previously found CLR type ‘<<namespace1.entity name>>’, newly found CLR type ‘<<namespace2.entity name>>’.

Custom Tool Error when updating service reference in VS 2010[Solved]

Day as usual, I was assigned some task to do in project, that I am working on. To meet the requirement I had to update service reference to one of WCF web-services included in solution. This was nothing new, service was in this solution almost from the start of the project, even before I got to work on it, being one of it’s central parts. I was really surprised, when operation, that I’ve completed many times before failed with error:

Error    27    Custom tool error: Failed to generate code for the service reference ‘<<serviceName>>’. Please check other error and warning messages for details.

After looking through the warnings I’ve found that three of them seemed to be the causes of this error. They looked something like this:

Custom tool warning: Cannot import wsdl:binding
Detail: There was an error importing a wsdl:portType that the wsdl:binding is dependent on.
<some more info, some XPaths>

and alike for “port” and “portType”. I’ve looked at Reference.cs – there was no code inside, only some generated, commented out header.

That’s a bummer! After googling I’ve found that most popular solutions were:

  • remove reference, restart VS, add it from scratch
  • try restarting machine
  • check “Reuse types from referenced assemblies”
  • if you have installed VS2012 uninstall it reinstall VS2010

First and second one did not work. Third one was no good solution. Well, it made service reference to update, but in project referencing it I had all types doubled, so ambiguous types references all over the place. Fourth solution did not help.