1

Set up:

New MVC 3 project, using existing database. Created an EF file (edmx), used the automatic generator to create the POCO classes and DbContext, then deleted the edmx.

Scaffolded a number of controllers and views, using -Repository -Force -Area -ModelType flags from the Package Manager Console command line.

Problem:

When running the app I get the following error:

External Component has thrown an exception.

Right. Fat lot of use. Stopped and started Cassini. No joy. Closed and opened VS2010. No joy.

Can't think what else can be wrong. No one else seems to have the problem (according to Google).

Question:

What the heck is wrong?! Any suggestions?

awrigley
  • 13,481
  • 10
  • 83
  • 129
  • I know it may sound daft, but have tried hitting F5? I find that if an error occurs when a view is compiled, you quite often get this error and hitting F5 (maybe more than once) usually brings up a compilation error message that allows you to debug the problem. – Steve Morgan Aug 03 '11 at 13:21
  • It doesn't sound daft. That's wot I did. Didn't work either. See solution in my answer below (psst: just restart the PC). – awrigley Aug 03 '11 at 13:25

3 Answers3

9

OK, I restarted the computah and the problem went away.

Just like that.

As if by magic.

First thing I should've tried, isn't it?

    |||||||||||
       0   0
         |
    vvvvvvvvvvv
    ___________
    ^^^^^^^^U^^

(Self portrait of the Web Developer as an aging man)

Three hours of my life. Vaporised. No page, no pay. No pay, no dinner. No dinner, no web developer. No web developer, no page. The circle of life and death. Ying and Yang. The Tao.

Should've carried on doing Mathematical Physics. At least no one is to blame when the Universe doesn't do what the client expects.

awrigley
  • 13,481
  • 10
  • 83
  • 129
2

In case it helps anyone: I had this problem and found an error in a bug partial view. After fixing the bug in the partial, the error went away.

flying227
  • 1,231
  • 3
  • 22
  • 36
1

It happens when inside View1 you render @Html.Partial(View2, model) and pass a viewmodel that the View2 does not acccept (at least when the viewmodel is templated).

ValGe
  • 339
  • 4
  • 11