WebActivatorEx.PostApplicationStartMethod() not calling Start()

May 17, 2016 at 12:22 AM
Edited May 17, 2016 at 12:23 AM
I tried to install this nuGet into an existing MVC 3 application. Things seem to compile, however when I try to run and put a breakpoint in the Start() function it does not seem to execute this code. I did have some issues with versions etc. in order to get it to compile, seems like there was some issues with the dependencies etc. in particular on the version of system.web.webpages, that was installed, due to the function WriteAttribute method, being called in some of the precompilations. Apparently version 2 is needed rather than 1. This is a webapp that has been moved from vs2010 to vs2013.

I tried creating a new mvc 3 webapp in vs2010 and installed the generator into it, and it seems to work, breaking in Start() and startup. Is there a step that possibly has been missed when attaching the generator into an existing "mature" mvc application? Is there anything that might be overshadow the WebActivator?
May 17, 2016 at 1:18 AM
I tried deleting all razor views in an area, then the Start() function indeed was called, so maybe it was a cache issue. However the pre-compiled views were not being executed, the ajax call just fails. Have I understood this correct, that no source razor code is needed at runtime, and the pre-compiled views will be executed at run-time instead, if it exists?

I used the VS RazorGenerator extension to have the pre-compiled view be generated at every edit.

If I try to put a breakpoint in the Execute() function during runtime it tells me that no target code is associated with that line, like the pre-compiled views are not even part of the executable.
Coordinator
May 17, 2016 at 2:43 AM
FYI, this project moved to https://github.com/davidebbo/WebActivator a long time ago.
May 17, 2016 at 9:57 PM
Well, the problem I have is with RazorGenerator, has that moved to the same place? I installed RazorGenerator.Mvc into an existing MVC 3 application. I can generate the pre-compiled views and the project builds, however I am not entirely sure the pre-compiled views are actually running. If I put a breakpoint in the source view it still stops there. I have not made a separate library dll with the views, I just generated the .cs in the original location. Not sure if I am missing a step.

Here is what I have done
  1. Installed RazorGenerator.Mvc from nuGet
  2. Installed VS RazorGenerator extension, to get the menu actions etc. for the generator tool
  3. Put file called razorgenerator.directives with GeneratePrettyNames: true directive in view directory
  4. Set Build Action to None and Custom Tool to RazorGenerator and ViewName.generated.cs was created
  5. Build the web app, recycled the webserver
  6. Put breakpoint in the razor script view and ViewName.generated.cs in the Execute() section
  7. Kicked the web app off in debug mode from vs
  8. Did ajax call to activate call to view, program breaks in original razor script.
  9. Breakpoint in ViewName.generated.cs indicate that code is not in the binary. Is the code being generated somewhere else or is it never compiled into the project?
Coordinator
May 17, 2016 at 10:00 PM
RazorGenerator is on https://github.com/RazorGenerator/RazorGenerator. Nothing is on Codeplex anymore :)