Jeff-Lewis / nhaml

Automatically exported from code.google.com/p/nhaml
0 stars 0 forks source link

NHamlMvcViewEngine fails to compile template when a certain (legitimate) overload of View() is used #41

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

1. Open the NHaml solution and check you can run the NHaml.Samples.Mvc 
project, rendering a list of beverages

2. Go to ProductsController.cs and alter the Category(int id) method as 
follows:

        public ActionResult Category( int id )
        {
            var category = northwind.GetCategoryById( id );

            return new ViewResult {
                ViewName = "List",
                ViewData = new ViewDataDictionary(category)
            };
        }

Note that this is semantically identical to the original code and therefore 
should not cause any change of behaviour. Other view engines (WebForm, 
Spark, NVelocity, and Brail) are all happy to be invoked in this way.

3. Try running it. Boom: "An error occurred when compiling the file"

What version of the product are you using? On what operating system?

Current source version checked out at revision 105.

Original issue reported on code.google.com by fla...@gmail.com on 17 Feb 2009 at 12:03

GoogleCodeExporter commented 9 years ago
Accepted. This seems to be a problem in MVC. Ive reported it to them here:

http://www.codeplex.com/aspnet/WorkItem/View.aspx?WorkItemId=3220

I they dont fix it, we have to find a workaround for that.

Original comment by lanwin...@gmail.com on 17 Feb 2009 at 1:28

GoogleCodeExporter commented 9 years ago
As long as we have not resolution for that, the following snipped should make 
it work
(untestet).

  ViewData = new ViewDataDictionary(category)

  return new ViewResult {
    ViewName = "List",
    ViewData
  };

Original comment by lanwin...@gmail.com on 18 Feb 2009 at 11:33

GoogleCodeExporter commented 9 years ago
Ok it seems that this dose not get changed by the mvc team. 

Since we must changes this when we want to precompile the views, we will fix 
this is 
http://code.google.com/p/nhaml/issues/detail?id=44 is done. In the mean time you
could use the above snipped.

Original comment by lanwin...@gmail.com on 16 Mar 2009 at 4:16