ASP.NET MVC 3: External component has thrown an exception - asp.net-mvc-3

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?

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.

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.

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).

Related

Joomla error "MODULO BY ZERO"

This error showed up as plain text on white background after logging in to the Maintenance Login window on the public front end of our Joomla 3.5.1 site. We are using a template from TemplateMonster called "theme3289" (default version), aka "Truckie".
For no apparent reason, we found we could not log in to the Maintenance Login window on the public front end. We got the error:
"Modulo by zero" on a plain white background.
No part of the front public end of the site could be navigated to, even by pasting in a link. However, we could navigate fine to the backend ([site_domain_name.com]/administrator)
Not sure exactly what caused this, but we did have the internet connection go down in the middle of saving an article. After re-gaining connection, the new article was missing. We had also made some simple content changes (not configuration or settings changes) in the articles inside the TM Parallax module.
Looking for help on this "Modulo by zero" error.
RESTORED DATABASE BACKUP = Solved the problem. I am pretty sure it was some kind of database error or corruption. We tried clearing the cache (Joomla System Menu) and a number of other things. Nothing worked.
We had two staff working on the site at the time of the error, one a newbie, one an advanced beginner. Interviewing them with "what were you doing at the time" didn't seem to lend any clues. Unless perhaps the TM Parallax module may have a bug (???) - or a corruption somehow when internet went down while saving an article.
SOLUTION: We restored a recent backup copy of the database made only 2 hours prior to the ERROR. This solved our problem.
This worked for us.
I faced this issue today, and I found out the cause. Its simple actually,as the issue says your code somewhere is attempting to do division or modulo by 0. Maybe you had added a new field with value 0 in your db after taking backup and the data there was causing it. This may not be helpful for you now but I'm leaving this here to make it easy if someone has a similar issue and ends up here.
I think the problem was caused by a change in the template. For example, some templates do not allow specific values to be zero, and will crash when this happens.
A good idea to discover the root cause of the problem is to compare the templates settings of the backup to the template settings of the problematic site. If everything is exactly the same, then you should compare the modules, and finally the menu items. It is not a fun job to do, but will help you isolate the problem in case it happens again.
For your reference. Just had this issue and the above information did not help. Finally found the solution:
In Article > global Options > Blog/Featured layout I had the columns set to 0

VS2013 - Error on a view causes browser to display symbols

Using vs2013 to create an MVC5.2 web app. I'm actually rebuilding an old app using the new mvc framework, so this works fine in vs2010 and MVC3.
In this app, whenever i have something that would trigger an error on the page (usually in a razor syntax, like
#{Html.RenderPartial("mypartial", mymodel);}
instead of getting a compilation error yellow screen when viewing it in a browser, i get a page of symbols:
I created an new web app and it doesn't do it in there, it displays the error as expected. I'm assuming this is caused by something i retrieved/updated via NuGet, but if anyone had any idea of where to start looking, it'd be appreciated.
EDIT: further experimenting seems to indicate that this only happens within areas. If i have a razor syntax error in the root controller, i get a yellowscreen. same error in a view that is in an area results in the symbol display below.
Figured out my problem- I had added a EnableCompression action filter that i was using in MVC3 to my MVC5 controllers. This was causing the weird display- taking it out completely cleared up the problem.
Apparently now gzip compression is handled either in IIS or in the web.config file, I've seen reports of both. At any rate, I no longer have to deal with it in the application itself.

MVVMCross How does this View get linked to the ViewModel?

I'm trying to figure out why I get an error message about not being able to find the right ViewModel when I'm running my iOS app.
The question I have is when I look at this example I don't understand where MainMenuView gets bound to MainMenuViewModel.
Can someone answer this for me?
Thanks,
PkL728
They are bound by class names: for XXXView should be corresponded XXXViewModel
Just want to add to the answer: double-check the names of the views after renaming (even Resharper renaming is not perfect). Spent several dozens of minutes (and a beer can), catching similar MvvmCross's error Could not find view for %ViewModelName%.
I'm getting this on a project that I've just upgraded to MvvmCross 4. I don't have much experience with MvvmCross, and the project hasn't been maintained for a few years, so it's possible something else is wrong.
I ended up hard coding the mappings in Setup::InitializeViewLookup because I don't have time to waste on it anymore.
For anyone who ends up here having the same problem I had. I was getting this error in an Android project because my (properly named) view was extending Activity and not MvxActivity (happens easily when you use Xamarin Studio's "Add Android Activity" feature)

MVC3 not finding a View in an Area

I have one area in my project (for admin).
I want to be able to use a view called Index.cshtml in the Admin area but my app always displays the Index.cshtml view for the main project (which isn't in a seperate area).
If I change the name of the view in the admin area to a name that doesn't exist anywhere else it works fine.
What am I missing? It must be something simple !
Answer (probably)
Bit of a mystery but it seems that maybe there was some sort of weird caching problem. I restarted the web server and now it works fine.
thanks to all who responded
Answered my own question to remove it from the unanswered list.
Bit of a mystery but it seems that maybe there was some sort of weird caching problem. I restarted the web server and now it works fine.
thanks to all who responded

How can I solve this strange VS 2010 form design view issue?

The problem: In VS2010, I have a form with a broken design view. It's breaking on a couple of Atalasoft imageviewer controls.
The weirdness: Took me some time to figure this out, but if I go into the forms designer.vb file, and comment out everything regarding these controls, save, uncomment, and save again, the form design view loads perfect. NOTE: I'm not changing anything. Just commenting/uncommenting portions of the designer and saving.
The form design view continues to work fine until I do any of the following:
close the form design view and the designer.vb file and try to view again.
close the solution and reopen.
After doing either of these things, it's back to square one and I have to comment/uncomment/save to view the form designer again.
I'm on Win7, 64 bit. I have worked on this app in the past with no issue. The app builds and runs just fine. It's just a VS form design view issue, and I'm flummoxed.
I'd love to hear any thoughts on how I can solve this. If I can provide any more specific info, please let me know.
I've seen this happen rarely, when something odd gets into the designer file for a form and the designer can't figure out how to display things anymore. A third-party control being part of it could be indicative of some bug with that control's designer-related code.
One thing to try might be re-creating the form in question from scratch, and see if that fixes it. Perhaps something inadvertently got fubared. Also see if there is anything out there with others having designer problems with the same control(s) in question.
Sorry can't offer more direct help; maybe someone else has experienced something more closely related.

Resources