VS2013 - Error on a view causes browser to display symbols - visual-studio-2013

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.

Related

Problem with "Edit and Continue" in a ASP.NET core mixed Razor Pages and MVC app

I'm trying to update an old webpage that I had developed using MVC. Now I'm adding Razor Pages, but then Edit and Continue won't work anymore.
I can isolate/reproduce the problem in a minimal context. It seems to occur when there are files both in Pages and in Views, e.g. _ViewStart.cshtml.
Here is how to reproduce:
Create an ASP.NET Core Web App, .NET 5.0, No Authentication, no HTTPs, no Docker, enable Razor runtime compilation
Place a breakpoint in IndexModel constructor
Run App
When hitting the breakpoint, edit the code (just add a semicolon in the ctor), continue: code will compile and continue
Add new folder "Views"
Copy _ViewStart.cshtml from Pages to Views
Run App again
When hitting the breakpoint, edit the code (just add a semicolon in the ctor), continue, get message: "Edits were made to the code which cannot be applied while debugging"
I could probably work around the issue, but I'd rather try to understand why this happens.
This also happens when I add the Identity package and try to customize the pages, in which case I also need a double _ViewStart.cshtml...
Any ideas?

MVC 5 Razor view displays Linq errors but page renders correctly

I frequently get errors such as displayed in the picture below when using Linq in a Razor view. I have obviously added the #using System.Linq include on the top of the page (although it will strangely work without it), but still get the errors no matter what i try.
Is there any way to prevent these errors from appearing? I know i shouldn't be using too much code inside a view, perhaps the best solution would be to build the list in the code, use it here and stop worrying about editor syntax errors?
Razor Linq Error
This kind of problems is often in some way related to the config files. Have you seen this answer?
The type 'IEnumerable<>' is defined in an assembly that is not referenced
You can also try to create a test project and see if everything works as expected there and if it does, compare the web config files for possible differences... Note that there are two of those in each mvc project...

is "CKEditor for ASP.NET" deprecated?

I'm looking at the download page for ckeditor and I see that the ASP.NET control was last released in 2014. The version string is 3.6.6.2. Does this mean that the control is deprecated? It seems to work properly w/ 4.4.x, but I'm chasing down some weird ckeditor control issues and I wanted to make sure this isn't somehow the cause.
Some of the weird issues I've been chasing
Sometimes when I'm doing a save via form submit, I'll get an exception thrown by the guts of ckeditor: Uncaught IndexSizeError: Failed to execute 'extend' on 'Selection': 1 is larger than the given node's length.
Selecting text in the control prior to save makes it go away
Only happens in Chrome from what I can tell
If I remove the divarea plugin, that makes it go away
I feel like sometimes I'm getting weird errors with it complaining that jquery is missing when I use the asp.net control -- they don't seem to happen under the markup / script based method. I haven't pinned this down yet.
The overall build is the 3.6.6.2 of the asp.net control. The ckeditor build is 4.4.7. There are custom config.js files used in some places and in some places the control is configured by markup in the asp.net control.

Weird jump to top of page behavior with MarkdownDeep

I am playing with MarkdownDeep .Net/Javascipt Edition for an MVC 3 application. Added it via NuGet. The page renders Markdown sharp box just fine. However I get a weird jump to top of page behavior if any of the icons on the markdown sharp toolbar are clicked. I googled and didn't find anyone else having this issue.
Any thoughts? The script file and css are being loaded properly - no errors in Chrome console.
Have you checked that the microsoft ajax scripts are included in the page and that the web.config file is configured to use it? Try something simple like a ajax.beginform to see if it posts the page or if it calls an ajax post.

ASP.NET 4 UpdatePanel and IIS7 Problem

I have an ASP.NET 4 webpage that contains an update panel which just allows me to add a few items to a drop down list without reloading the entire page.
The page works fine on the Visual Studio 2010 ASP.NET Development Server, performs the Async call and the page is properly laid out. However, when I deploy the page to IIS7, the Async call no longer works (the page is completely reloaded) and the layout of some items on the page is incorrect.
I used Fiddler to look at what's happening and it looks like there are 404's when the page tries to access ScriptResource.axd, with everything else working correctly. I think that has to do with the Javascript required for the call but I'm not sure how to fix it. Any suggestions?
I had the same issue. After reading, this and this2 I checked the ISAPI handlers definition in the root site of my IIS, but it looked fine, so I kept struggling some more.
Finally fixed it by realizing the ISAPI Handlers definition had been modified at the site level, and wasnt inheriting the same definitions as in the root site. It was fixed selecting my site in IIS Manager, going to the "Handler Mappings" section, and then clicking in "Revert To Inherited".

Resources