Load Type from Assembly Error PSA (aka the old PK Issue)

Because I’m interested in continuing to make E10help a repository for potential issues and errors, I figured I’d post this for posterity:

If you receive an error with inner exception syntax: Could not load type 'Erp.Tables.[SomeTable]' from assembly 'Erp.Data.910100' or Could not load type 'Ice.Tables.[SomeTable]' from assembly 'Ice.Data.Model', it may be that one of your table’s primary keys was somehow removed.

The data model generator will not load tables without primary keys into the context .edmx intermediary files prior to generating the data model DLLs, and while it usually gives warnings / errors, I’ve just encountered a situation where it reported repeated successful regeneration, but threw errors within the application with the above text.

Re-adding the associated primary key(s) fixes the issue. If you find the above issue, possibly relating to other dlls, but all PKs are in tact, then there’s likely a version mismatch between assemblies (maybe you’re amidst an upgrade?).