Quantcast
Channel: RazorGenerator Issue Tracker Rss Feed
Viewing all 525 articles
Browse latest View live

Commented Issue: Security Exception [99]

$
0
0
I've been running template/MVC with no issues. Then this week I started receiving an exception when trying to access any compiled view. The site has been in medium trust (default for hosting), but moving to full trust fixed the issue. So I'm unsure if the issue is medium trust or some patch applied to the server that caused this. The host and I are both unsure of what this could be.

I did change my local version (using IIS Express) to <trust level="medium" /> and it ran with no problems, which confuses me more.

__Version (NUGET)__
<package id="RazorGenerator.Mvc" version="1.5.0.0" targetFramework="net40" />
<package id="RazorGenerator.Templating" version="1.5.2.0" targetFramework="net40" />

Any thoughts?

__Exception from ELMAH__
```
System.Security.SecurityException
Request failed.

System.TypeInitializationException: The type initializer for
'RazorGenerator.Mvc.PrecompiledMvcView' threw an exception. --->

System.MethodAccessException: Attempt by method
'RazorGenerator.Mvc.PrecompiledMvcView.CreateOverriddenLayoutSetterDelegate()'
to access method 'System.Web.Mvc.WebViewPage.set_OverridenLayoutPath(System.String)' failed. --->

System.Security.SecurityException: Request failed.

at System.Security.CodeAccessSecurityEngine.ThrowSecurityException(RuntimeAssembly asm, PermissionSet granted, PermissionSet refused, RuntimeMethodHandleInternal rmh, SecurityAction action, Object demand, IPermission permThatFailed)
at System.Security.CodeAccessSecurityEngine.ThrowSecurityException(Object assemblyOrString, PermissionSet granted, PermissionSet refused, RuntimeMethodHandleInternal rmh, SecurityAction action, Object demand, IPermission permThatFailed)
at System.Security.CodeAccessSecurityEngine.CheckSetHelper(PermissionSet grants, PermissionSet refused, PermissionSet demands, RuntimeMethodHandleInternal rmh, Object assemblyOrString, SecurityAction action, Boolean throwException)
at System.Security.PermissionSetTriple.CheckSetDemand(PermissionSet demandSet, PermissionSet& alteredDemandset, RuntimeMethodHandleInternal rmh)
at System.Security.PermissionListSet.CheckSetDemand(PermissionSet pset, RuntimeMethodHandleInternal rmh)
at System.Security.PermissionListSet.DemandFlagsOrGrantSet(Int32 flags, PermissionSet grantSet)
at System.Security.CodeAccessSecurityEngine.ReflectionTargetDemandHelper(Int32 permission, PermissionSet targetGrant, CompressedStack securityContext)
at System.Security.CodeAccessSecurityEngine.ReflectionTargetDemandHelper(Int32 permission, PermissionSet targetGrant)
--- End of inner exception stack trace ---
at System.Delegate.BindToMethodInfo(Object target, IRuntimeMethodInfo method, RuntimeType methodType, DelegateBindingFlags flags)
at System.Delegate.CreateDelegate(Type type, MethodInfo method, Boolean throwOnBindFailure)
at RazorGenerator.Mvc.PrecompiledMvcView.CreateOverriddenLayoutSetterDelegate()
at RazorGenerator.Mvc.PrecompiledMvcView..cctor()
--- End of inner exception stack trace ---
at RazorGenerator.Mvc.PrecompiledMvcView..ctor(String virtualPath, String masterPath, Type type, Boolean runViewStartPages, IEnumerable`1 fileExtension)
at RazorGenerator.Mvc.PrecompiledMvcEngine.CreateViewInternal(String viewPath, String masterPath, Boolean runViewStartPages)
at RazorGenerator.Mvc.PrecompiledMvcEngine.CreateView(ControllerContext controllerContext, String viewPath, String masterPath)
at System.Web.Mvc.VirtualPathProviderViewEngine.FindView(ControllerContext controllerContext, String viewName, String masterName, Boolean useCache)
at System.Web.Mvc.ViewEngineCollection.<>c__DisplayClassc.<FindView>b__b(IViewEngine e)
at System.Web.Mvc.ViewEngineCollection.Find(Func`2 lookup, Boolean trackSearchedPaths)
at System.Web.Mvc.ViewEngineCollection.FindView(ControllerContext controllerContext, String viewName, String masterName)
at System.Web.Mvc.ViewResult.FindView(ControllerContext context)
at System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context)
at System.Web.Mvc.ControllerActionInvoker.InvokeActionResult(ControllerContext controllerContext, ActionResult actionResult)
at System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClass1a.<InvokeActionResultWithFilters>b__17()
at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation)
at System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClass1a.<>c__DisplayClass1c.<InvokeActionResultWithFilters>b__19()
at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation)
at System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClass1a.<>c__DisplayClass1c.<InvokeActionResultWithFilters>b__19()
at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList`1 filters, ActionResult actionResult)
at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass25.<>c__DisplayClass2a.<BeginInvokeAction>b__20()
at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass25.<BeginInvokeAction>b__22(IAsyncResult asyncResult)
at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult`1.End()
at System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult)
at System.Web.Mvc.Controller.<>c__DisplayClass1d.<BeginExecuteCore>b__18(IAsyncResult asyncResult)
at System.Web.Mvc.Async.AsyncResultWrapper.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar)
at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult`1.End()
at System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult)
at System.Web.Mvc.Async.AsyncResultWrapper.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar)
at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult`1.End()
at System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult)
at System.Web.Mvc.Controller.System.Web.Mvc.Async.IAsyncController.EndExecute(IAsyncResult asyncResult)
at System.Web.Mvc.MvcHandler.<>c__DisplayClass8.<BeginProcessRequest>b__3(IAsyncResult asyncResult)
at System.Web.Mvc.Async.AsyncResultWrapper.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar)
at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult`1.End()
at System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult)
at System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result)
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

```
Comments: Hmmm, it's fascinating if it's able to execute that reflection code in medium trust without blowing up. I would not expect that...

Created Issue: PreemptPhysicalFiles ignored on partial views [100]

$
0
0
The PreemptPhysicalFiles = false works for views, but when RenderPartial is called the cshtml file from assembly is used even the file exist on disk.

There is missing condition for PreemptPhysicalFiles in FileExists, but the condition is present in CreateInstance. I fixed it by overriding the FileExists method.

```
public class PrecompiledMvcEngineFixed : PrecompiledMvcEngine
{
protected override bool FileExists(ControllerContext controllerContext, string virtualPath)
{
if (!PreemptPhysicalFiles && VirtualPathProvider.FileExists(virtualPath))
{
// If the physical file on disk exist and the user's opted in this behavior, serve it instead.
return false;
}
return base.FileExists(controllerContext, virtualPath);
}
}
```

Note that it works OK when engine is added at the end:
```
ViewEngines.Engines.Add(engine);
```
However it does not work when engine is put at the 1st place:
```
ViewEngines.Engines.Insert(0,engine);
```

Commented Issue: PreemptPhysicalFiles ignored on partial views [100]

$
0
0
The PreemptPhysicalFiles = false works for views, but when RenderPartial is called the cshtml file from assembly is used even the file exist on disk.

There is missing condition for PreemptPhysicalFiles in FileExists, but the condition is present in CreateInstance. I fixed it by overriding the FileExists method.

```
public class PrecompiledMvcEngineFixed : PrecompiledMvcEngine
{
protected override bool FileExists(ControllerContext controllerContext, string virtualPath)
{
if (!PreemptPhysicalFiles && VirtualPathProvider.FileExists(virtualPath))
{
// If the physical file on disk exist and the user's opted in this behavior, serve it instead.
return false;
}
return base.FileExists(controllerContext, virtualPath);
}
}
```

Note that it works OK when engine is added at the end:
```
ViewEngines.Engines.Add(engine);
```
However it does not work when engine is put at the 1st place:
```
ViewEngines.Engines.Insert(0,engine);
```
Comments: Could you send a pull request with the change? Thanks!

Commented Issue: PreemptPhysicalFiles ignored on partial views [100]

$
0
0
The PreemptPhysicalFiles = false works for views, but when RenderPartial is called the cshtml file from assembly is used even the file exist on disk.

There is missing condition for PreemptPhysicalFiles in FileExists, but the condition is present in CreateInstance. I fixed it by overriding the FileExists method.

```
public class PrecompiledMvcEngineFixed : PrecompiledMvcEngine
{
protected override bool FileExists(ControllerContext controllerContext, string virtualPath)
{
if (!PreemptPhysicalFiles && VirtualPathProvider.FileExists(virtualPath))
{
// If the physical file on disk exist and the user's opted in this behavior, serve it instead.
return false;
}
return base.FileExists(controllerContext, virtualPath);
}
}
```

Note that it works OK when engine is added at the end:
```
ViewEngines.Engines.Add(engine);
```
However it does not work when engine is put at the 1st place:
```
ViewEngines.Engines.Insert(0,engine);
```
Comments: Hope it is ok, first time using git :) http://razorgenerator.codeplex.com/SourceControl/network/forks/pub/razorgenerator/contribution/4104

Commented Issue: Removal of SuffixClassNames : bool [66]

$
0
0
Hey

I see SuffixClassNames : bool was removed after it was pulled in.

I really need this feature. I tend to not name my views Index, Edit, List etcetera but give them more meaningful names. However these names often clash with my domain entities. I therefor pushed this directive to explicitly (but optionally) suffix the type of view to the generated classname.

Was there any particular reason this feature was stripped ?

Thanks!

Comments: @pranavkm thanks for pulling it back in. I'm still missing the root directive that generates more verbose class names based on the type of view (i.e automatically append *Helper to helper views, *View to views etcetera) but if i can place a `ClassName: View` in a root razorgenrator.directives file that will work for me too :) Thanks! any hints on when this will make it in a new version ? I would like to get off my custom build :)

Commented Issue: Removal of SuffixClassNames : bool [66]

$
0
0
Hey

I see SuffixClassNames : bool was removed after it was pulled in.

I really need this feature. I tend to not name my views Index, Edit, List etcetera but give them more meaningful names. However these names often clash with my domain entities. I therefor pushed this directive to explicitly (but optionally) suffix the type of view to the generated classname.

Was there any particular reason this feature was stripped ?

Thanks!

Comments: Ebbo just pushed a new version of the Vsix. That ought to fix this issue. Could you update and verify?

Created Issue: VirtualPath case sensitive problem in IsPhysicalFileNewer. [101]

$
0
0

private bool IsPhysicalFileNewer(string virtualPath)
{
if (virtualPath.StartsWith(_baseVirtualPath ?? String.Empty, StringComparison.Ordinal))
......
}

can change __StringComparison.Ordinal__ to __StringComparison.OrdinalIgnoreCase__ ?

thanks...

Edited Issue: VirtualPath case sensitive problem in IsPhysicalFileNewer. [101]

$
0
0

private bool IsPhysicalFileNewer(string virtualPath)
{
if (virtualPath.StartsWith(_baseVirtualPath ?? String.Empty, StringComparison.Ordinal))
......
}

can change __StringComparison.Ordinal__ to __StringComparison.OrdinalIgnoreCase__ ?

thanks...

Commented Issue: VirtualPath case sensitive problem in IsPhysicalFileNewer. [101]

$
0
0

private bool IsPhysicalFileNewer(string virtualPath)
{
if (virtualPath.StartsWith(_baseVirtualPath ?? String.Empty, StringComparison.Ordinal))
......
}

can change __StringComparison.Ordinal__ to __StringComparison.OrdinalIgnoreCase__ ?

thanks...
Comments: Fixed in changeset dda031bc2655

Created Issue: RazorGenerator not generating complete code on .cshtml [102]

$
0
0
I'm running into an issue where it appears that razor generator is not generating complete code for some of my Shared Templates.

These are templates that are created from the "MvcSiteMap" package.

The Razor Code is listed here:
```
@model MvcSiteMapProvider.Web.Html.Models.MenuHelperModel
@using System.Web.Mvc.Html
@using MvcSiteMapProvider.Web.Html.Models
<ul id="menu">
@foreach (var node in Model.Nodes) {
<li id="@node.MetaAttributes["id"]">@Html.DisplayFor(m => node)
@if (node.Children.Any()) {
@Html.DisplayFor(m => node.Children)
}
</li>
}
</ul>
```

what is being generated by RazorGenerator is:
```
#pragma warning disable 1591
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.18033
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

namespace TP2012MVC.Views.Shared.DisplayTemplates
{
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Web;
using System.Web.Helpers;
using System.Web.Mvc;
using System.Web.Mvc.Ajax;

#line 2 "..\..\Views\Shared\DisplayTemplates\MenuHelperModel.cshtml"
using System.Web.Mvc.Html;

#line default
#line hidden
using System.Web.Routing;
using System.Web.Security;
using System.Web.UI;
using System.Web.WebPages;
using MvcSiteMapProvider.Web.Html;

#line 3 "..\..\Views\Shared\DisplayTemplates\MenuHelperModel.cshtml"
using MvcSiteMapProvider.Web.Html.Models;

#line default
#line hidden

[System.CodeDom.Compiler.GeneratedCodeAttribute("RazorGenerator", "1.5.4.0")]
public class MenuHelperModel : System.Web.WebPages.HelperPage
{
}
}
```

When the compiled code is being executed, the custom "id=@node....." is not being generated in the html.

Going through the generated models, I'm noticing that there are several of these templates that the class generated is empty.

This is RazorGenerator.Mvc 1.5.5.0
RazorGenerator Extension 1.5.4
Visual Studio 2012
MVC 4 (asp.net 4.5 application)

Any advice would be appreciated.

Commented Issue: RazorGenerator not generating complete code on .cshtml [102]

$
0
0
I'm running into an issue where it appears that razor generator is not generating complete code for some of my Shared Templates.

These are templates that are created from the "MvcSiteMap" package.

The Razor Code is listed here:
```
@model MvcSiteMapProvider.Web.Html.Models.MenuHelperModel
@using System.Web.Mvc.Html
@using MvcSiteMapProvider.Web.Html.Models
<ul id="menu">
@foreach (var node in Model.Nodes) {
<li id="@node.MetaAttributes["id"]">@Html.DisplayFor(m => node)
@if (node.Children.Any()) {
@Html.DisplayFor(m => node.Children)
}
</li>
}
</ul>
```

what is being generated by RazorGenerator is:
```
#pragma warning disable 1591
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.18033
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

namespace TP2012MVC.Views.Shared.DisplayTemplates
{
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Web;
using System.Web.Helpers;
using System.Web.Mvc;
using System.Web.Mvc.Ajax;

#line 2 "..\..\Views\Shared\DisplayTemplates\MenuHelperModel.cshtml"
using System.Web.Mvc.Html;

#line default
#line hidden
using System.Web.Routing;
using System.Web.Security;
using System.Web.UI;
using System.Web.WebPages;
using MvcSiteMapProvider.Web.Html;

#line 3 "..\..\Views\Shared\DisplayTemplates\MenuHelperModel.cshtml"
using MvcSiteMapProvider.Web.Html.Models;

#line default
#line hidden

[System.CodeDom.Compiler.GeneratedCodeAttribute("RazorGenerator", "1.5.4.0")]
public class MenuHelperModel : System.Web.WebPages.HelperPage
{
}
}
```

When the compiled code is being executed, the custom "id=@node....." is not being generated in the html.

Going through the generated models, I'm noticing that there are several of these templates that the class generated is empty.

This is RazorGenerator.Mvc 1.5.5.0
RazorGenerator Extension 1.5.4
Visual Studio 2012
MVC 4 (asp.net 4.5 application)

Any advice would be appreciated.
Comments: As an experiment, I renamed the DisplayTemplate to "test.cshtml", re-ran the generator and the generated class is correct. Renamed it back, reran the tool and the class is empty again.

Commented Issue: RazorGenerator not generating complete code on .cshtml [102]

$
0
0
I'm running into an issue where it appears that razor generator is not generating complete code for some of my Shared Templates.

These are templates that are created from the "MvcSiteMap" package.

The Razor Code is listed here:
```
@model MvcSiteMapProvider.Web.Html.Models.MenuHelperModel
@using System.Web.Mvc.Html
@using MvcSiteMapProvider.Web.Html.Models
<ul id="menu">
@foreach (var node in Model.Nodes) {
<li id="@node.MetaAttributes["id"]">@Html.DisplayFor(m => node)
@if (node.Children.Any()) {
@Html.DisplayFor(m => node.Children)
}
</li>
}
</ul>
```

what is being generated by RazorGenerator is:
```
#pragma warning disable 1591
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.18033
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

namespace TP2012MVC.Views.Shared.DisplayTemplates
{
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Web;
using System.Web.Helpers;
using System.Web.Mvc;
using System.Web.Mvc.Ajax;

#line 2 "..\..\Views\Shared\DisplayTemplates\MenuHelperModel.cshtml"
using System.Web.Mvc.Html;

#line default
#line hidden
using System.Web.Routing;
using System.Web.Security;
using System.Web.UI;
using System.Web.WebPages;
using MvcSiteMapProvider.Web.Html;

#line 3 "..\..\Views\Shared\DisplayTemplates\MenuHelperModel.cshtml"
using MvcSiteMapProvider.Web.Html.Models;

#line default
#line hidden

[System.CodeDom.Compiler.GeneratedCodeAttribute("RazorGenerator", "1.5.4.0")]
public class MenuHelperModel : System.Web.WebPages.HelperPage
{
}
}
```

When the compiled code is being executed, the custom "id=@node....." is not being generated in the html.

Going through the generated models, I'm noticing that there are several of these templates that the class generated is empty.

This is RazorGenerator.Mvc 1.5.5.0
RazorGenerator Extension 1.5.4
Visual Studio 2012
MVC 4 (asp.net 4.5 application)

Any advice would be appreciated.
Comments: So if you name it test.cshtml it works, but not with the other name? What's the file name where it doesn't work? Is there a predictable pattern of working vs not file names?

Commented Issue: RazorGenerator not generating complete code on .cshtml [102]

$
0
0
I'm running into an issue where it appears that razor generator is not generating complete code for some of my Shared Templates.

These are templates that are created from the "MvcSiteMap" package.

The Razor Code is listed here:
```
@model MvcSiteMapProvider.Web.Html.Models.MenuHelperModel
@using System.Web.Mvc.Html
@using MvcSiteMapProvider.Web.Html.Models
<ul id="menu">
@foreach (var node in Model.Nodes) {
<li id="@node.MetaAttributes["id"]">@Html.DisplayFor(m => node)
@if (node.Children.Any()) {
@Html.DisplayFor(m => node.Children)
}
</li>
}
</ul>
```

what is being generated by RazorGenerator is:
```
#pragma warning disable 1591
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.18033
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

namespace TP2012MVC.Views.Shared.DisplayTemplates
{
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Web;
using System.Web.Helpers;
using System.Web.Mvc;
using System.Web.Mvc.Ajax;

#line 2 "..\..\Views\Shared\DisplayTemplates\MenuHelperModel.cshtml"
using System.Web.Mvc.Html;

#line default
#line hidden
using System.Web.Routing;
using System.Web.Security;
using System.Web.UI;
using System.Web.WebPages;
using MvcSiteMapProvider.Web.Html;

#line 3 "..\..\Views\Shared\DisplayTemplates\MenuHelperModel.cshtml"
using MvcSiteMapProvider.Web.Html.Models;

#line default
#line hidden

[System.CodeDom.Compiler.GeneratedCodeAttribute("RazorGenerator", "1.5.4.0")]
public class MenuHelperModel : System.Web.WebPages.HelperPage
{
}
}
```

When the compiled code is being executed, the custom "id=@node....." is not being generated in the html.

Going through the generated models, I'm noticing that there are several of these templates that the class generated is empty.

This is RazorGenerator.Mvc 1.5.5.0
RazorGenerator Extension 1.5.4
Visual Studio 2012
MVC 4 (asp.net 4.5 application)

Any advice would be appreciated.
Comments: Correct.. The files right now I'm noticing a problem with have this structure: {PROJECT} -> Views -> Shared -> DisplayTemplates -> {View} So far I've identified a problem with the following named items: "MenuHelperModel.cshtml" "SiteMapHelperModel.cshtml" "SiteMapPathHelperModel.cshtml" "SiteMapTitleHelperModel.cshtml" The two others in that location DO generate correctly are: "SiteMapNodeModeIList.cshtml" and "SiteMapNodeModel.cshtml" If I rename any one of those to a different name, IE: test.cshtml, then to generator generates the full and correct class. These are all stock views that are added when adding the "MvcSiteMap" package to the view. I thought at first it might be due to the fact that the above classes that are not building correctly are classes in the MvcSiteMap dll/project and named the same but I somewhat dismissed that because the namespaces are totally different, however I would wager a guess that there is some connection to existing class names to the "generated" class names from RazorGenerator. Is there an easy method to debug the actual generation process? I have no issues pulling down the source and adding some debugging / breakpoints to see what is going on (I've never really analyzed the codegeneration applications so not sure if it's possible to call externally)

Commented Issue: RazorGenerator not generating complete code on .cshtml [102]

$
0
0
I'm running into an issue where it appears that razor generator is not generating complete code for some of my Shared Templates.

These are templates that are created from the "MvcSiteMap" package.

The Razor Code is listed here:
```
@model MvcSiteMapProvider.Web.Html.Models.MenuHelperModel
@using System.Web.Mvc.Html
@using MvcSiteMapProvider.Web.Html.Models
<ul id="menu">
@foreach (var node in Model.Nodes) {
<li id="@node.MetaAttributes["id"]">@Html.DisplayFor(m => node)
@if (node.Children.Any()) {
@Html.DisplayFor(m => node.Children)
}
</li>
}
</ul>
```

what is being generated by RazorGenerator is:
```
#pragma warning disable 1591
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.18033
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

namespace TP2012MVC.Views.Shared.DisplayTemplates
{
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Web;
using System.Web.Helpers;
using System.Web.Mvc;
using System.Web.Mvc.Ajax;

#line 2 "..\..\Views\Shared\DisplayTemplates\MenuHelperModel.cshtml"
using System.Web.Mvc.Html;

#line default
#line hidden
using System.Web.Routing;
using System.Web.Security;
using System.Web.UI;
using System.Web.WebPages;
using MvcSiteMapProvider.Web.Html;

#line 3 "..\..\Views\Shared\DisplayTemplates\MenuHelperModel.cshtml"
using MvcSiteMapProvider.Web.Html.Models;

#line default
#line hidden

[System.CodeDom.Compiler.GeneratedCodeAttribute("RazorGenerator", "1.5.4.0")]
public class MenuHelperModel : System.Web.WebPages.HelperPage
{
}
}
```

When the compiled code is being executed, the custom "id=@node....." is not being generated in the html.

Going through the generated models, I'm noticing that there are several of these templates that the class generated is empty.

This is RazorGenerator.Mvc 1.5.5.0
RazorGenerator Extension 1.5.4
Visual Studio 2012
MVC 4 (asp.net 4.5 application)

Any advice would be appreciated.
Comments: We try and guess if the file you are trying to generate is a Helper file (by looking for the string "Helper"s occurring in the file path. var mvcHelperRegex = new Regex(@"(^|\\)Views(\\.*)+Helpers?", RegexOptions.ExplicitCapture | RegexOptions.IgnoreCase); if (mvcHelperRegex.IsMatch(projectRelativePath)) { return "MvcHelper"; } var mvcViewRegex = new Regex(@"(^|\\)Views\\", RegexOptions.ExplicitCapture | RegexOptions.IgnoreCase); if (mvcViewRegex.IsMatch(projectRelativePath)) { return "MvcView"; } Clearly it's super hacky, but you can avoid it by adding a __@* Host: MvcView *@__ at the top of the file

Commented Issue: RazorGenerator not generating complete code on .cshtml [102]

$
0
0
I'm running into an issue where it appears that razor generator is not generating complete code for some of my Shared Templates.

These are templates that are created from the "MvcSiteMap" package.

The Razor Code is listed here:
```
@model MvcSiteMapProvider.Web.Html.Models.MenuHelperModel
@using System.Web.Mvc.Html
@using MvcSiteMapProvider.Web.Html.Models
<ul id="menu">
@foreach (var node in Model.Nodes) {
<li id="@node.MetaAttributes["id"]">@Html.DisplayFor(m => node)
@if (node.Children.Any()) {
@Html.DisplayFor(m => node.Children)
}
</li>
}
</ul>
```

what is being generated by RazorGenerator is:
```
#pragma warning disable 1591
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.18033
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

namespace TP2012MVC.Views.Shared.DisplayTemplates
{
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Web;
using System.Web.Helpers;
using System.Web.Mvc;
using System.Web.Mvc.Ajax;

#line 2 "..\..\Views\Shared\DisplayTemplates\MenuHelperModel.cshtml"
using System.Web.Mvc.Html;

#line default
#line hidden
using System.Web.Routing;
using System.Web.Security;
using System.Web.UI;
using System.Web.WebPages;
using MvcSiteMapProvider.Web.Html;

#line 3 "..\..\Views\Shared\DisplayTemplates\MenuHelperModel.cshtml"
using MvcSiteMapProvider.Web.Html.Models;

#line default
#line hidden

[System.CodeDom.Compiler.GeneratedCodeAttribute("RazorGenerator", "1.5.4.0")]
public class MenuHelperModel : System.Web.WebPages.HelperPage
{
}
}
```

When the compiled code is being executed, the custom "id=@node....." is not being generated in the html.

Going through the generated models, I'm noticing that there are several of these templates that the class generated is empty.

This is RazorGenerator.Mvc 1.5.5.0
RazorGenerator Extension 1.5.4
Visual Studio 2012
MVC 4 (asp.net 4.5 application)

Any advice would be appreciated.
Comments: Markup messed that up @* Host: MvcView *@

Commented Issue: RazorGenerator not generating complete code on .cshtml [102]

$
0
0
I'm running into an issue where it appears that razor generator is not generating complete code for some of my Shared Templates.

These are templates that are created from the "MvcSiteMap" package.

The Razor Code is listed here:
```
@model MvcSiteMapProvider.Web.Html.Models.MenuHelperModel
@using System.Web.Mvc.Html
@using MvcSiteMapProvider.Web.Html.Models
<ul id="menu">
@foreach (var node in Model.Nodes) {
<li id="@node.MetaAttributes["id"]">@Html.DisplayFor(m => node)
@if (node.Children.Any()) {
@Html.DisplayFor(m => node.Children)
}
</li>
}
</ul>
```

what is being generated by RazorGenerator is:
```
#pragma warning disable 1591
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.18033
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

namespace TP2012MVC.Views.Shared.DisplayTemplates
{
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Web;
using System.Web.Helpers;
using System.Web.Mvc;
using System.Web.Mvc.Ajax;

#line 2 "..\..\Views\Shared\DisplayTemplates\MenuHelperModel.cshtml"
using System.Web.Mvc.Html;

#line default
#line hidden
using System.Web.Routing;
using System.Web.Security;
using System.Web.UI;
using System.Web.WebPages;
using MvcSiteMapProvider.Web.Html;

#line 3 "..\..\Views\Shared\DisplayTemplates\MenuHelperModel.cshtml"
using MvcSiteMapProvider.Web.Html.Models;

#line default
#line hidden

[System.CodeDom.Compiler.GeneratedCodeAttribute("RazorGenerator", "1.5.4.0")]
public class MenuHelperModel : System.Web.WebPages.HelperPage
{
}
}
```

When the compiled code is being executed, the custom "id=@node....." is not being generated in the html.

Going through the generated models, I'm noticing that there are several of these templates that the class generated is empty.

This is RazorGenerator.Mvc 1.5.5.0
RazorGenerator Extension 1.5.4
Visual Studio 2012
MVC 4 (asp.net 4.5 application)

Any advice would be appreciated.
Comments: Hmm... I tried adding that to the top of the view but same result. The only other thing i noticed was you said you search for "Helpers", These files are just "Helper". Not saying this isn't the cause but adding the host info to the top of the view didn't correct it.

Commented Issue: RazorGenerator not generating complete code on .cshtml [102]

$
0
0
I'm running into an issue where it appears that razor generator is not generating complete code for some of my Shared Templates.

These are templates that are created from the "MvcSiteMap" package.

The Razor Code is listed here:
```
@model MvcSiteMapProvider.Web.Html.Models.MenuHelperModel
@using System.Web.Mvc.Html
@using MvcSiteMapProvider.Web.Html.Models
<ul id="menu">
@foreach (var node in Model.Nodes) {
<li id="@node.MetaAttributes["id"]">@Html.DisplayFor(m => node)
@if (node.Children.Any()) {
@Html.DisplayFor(m => node.Children)
}
</li>
}
</ul>
```

what is being generated by RazorGenerator is:
```
#pragma warning disable 1591
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.18033
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

namespace TP2012MVC.Views.Shared.DisplayTemplates
{
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Web;
using System.Web.Helpers;
using System.Web.Mvc;
using System.Web.Mvc.Ajax;

#line 2 "..\..\Views\Shared\DisplayTemplates\MenuHelperModel.cshtml"
using System.Web.Mvc.Html;

#line default
#line hidden
using System.Web.Routing;
using System.Web.Security;
using System.Web.UI;
using System.Web.WebPages;
using MvcSiteMapProvider.Web.Html;

#line 3 "..\..\Views\Shared\DisplayTemplates\MenuHelperModel.cshtml"
using MvcSiteMapProvider.Web.Html.Models;

#line default
#line hidden

[System.CodeDom.Compiler.GeneratedCodeAttribute("RazorGenerator", "1.5.4.0")]
public class MenuHelperModel : System.Web.WebPages.HelperPage
{
}
}
```

When the compiled code is being executed, the custom "id=@node....." is not being generated in the html.

Going through the generated models, I'm noticing that there are several of these templates that the class generated is empty.

This is RazorGenerator.Mvc 1.5.5.0
RazorGenerator Extension 1.5.4
Visual Studio 2012
MVC 4 (asp.net 4.5 application)

Any advice would be appreciated.
Comments: Actually, that is the problem.. just noticed that the class is being created as a "System.Web.WebPages.HelperPage". dropping the "r" in "Helper" and it compiled right. Just have to get the right syntax to override it

Commented Issue: RazorGenerator not generating complete code on .cshtml [102]

$
0
0
I'm running into an issue where it appears that razor generator is not generating complete code for some of my Shared Templates.

These are templates that are created from the "MvcSiteMap" package.

The Razor Code is listed here:
```
@model MvcSiteMapProvider.Web.Html.Models.MenuHelperModel
@using System.Web.Mvc.Html
@using MvcSiteMapProvider.Web.Html.Models
<ul id="menu">
@foreach (var node in Model.Nodes) {
<li id="@node.MetaAttributes["id"]">@Html.DisplayFor(m => node)
@if (node.Children.Any()) {
@Html.DisplayFor(m => node.Children)
}
</li>
}
</ul>
```

what is being generated by RazorGenerator is:
```
#pragma warning disable 1591
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.18033
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

namespace TP2012MVC.Views.Shared.DisplayTemplates
{
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Web;
using System.Web.Helpers;
using System.Web.Mvc;
using System.Web.Mvc.Ajax;

#line 2 "..\..\Views\Shared\DisplayTemplates\MenuHelperModel.cshtml"
using System.Web.Mvc.Html;

#line default
#line hidden
using System.Web.Routing;
using System.Web.Security;
using System.Web.UI;
using System.Web.WebPages;
using MvcSiteMapProvider.Web.Html;

#line 3 "..\..\Views\Shared\DisplayTemplates\MenuHelperModel.cshtml"
using MvcSiteMapProvider.Web.Html.Models;

#line default
#line hidden

[System.CodeDom.Compiler.GeneratedCodeAttribute("RazorGenerator", "1.5.4.0")]
public class MenuHelperModel : System.Web.WebPages.HelperPage
{
}
}
```

When the compiled code is being executed, the custom "id=@node....." is not being generated in the html.

Going through the generated models, I'm noticing that there are several of these templates that the class generated is empty.

This is RazorGenerator.Mvc 1.5.5.0
RazorGenerator Extension 1.5.4
Visual Studio 2012
MVC 4 (asp.net 4.5 application)

Any advice would be appreciated.
Comments: @* Generator: MvcView *@ That works Thanks guys

Closed Issue: RazorGenerator not generating complete code on .cshtml [102]

$
0
0
I'm running into an issue where it appears that razor generator is not generating complete code for some of my Shared Templates.

These are templates that are created from the "MvcSiteMap" package.

The Razor Code is listed here:
```
@model MvcSiteMapProvider.Web.Html.Models.MenuHelperModel
@using System.Web.Mvc.Html
@using MvcSiteMapProvider.Web.Html.Models
<ul id="menu">
@foreach (var node in Model.Nodes) {
<li id="@node.MetaAttributes["id"]">@Html.DisplayFor(m => node)
@if (node.Children.Any()) {
@Html.DisplayFor(m => node.Children)
}
</li>
}
</ul>
```

what is being generated by RazorGenerator is:
```
#pragma warning disable 1591
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.18033
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

namespace TP2012MVC.Views.Shared.DisplayTemplates
{
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Web;
using System.Web.Helpers;
using System.Web.Mvc;
using System.Web.Mvc.Ajax;

#line 2 "..\..\Views\Shared\DisplayTemplates\MenuHelperModel.cshtml"
using System.Web.Mvc.Html;

#line default
#line hidden
using System.Web.Routing;
using System.Web.Security;
using System.Web.UI;
using System.Web.WebPages;
using MvcSiteMapProvider.Web.Html;

#line 3 "..\..\Views\Shared\DisplayTemplates\MenuHelperModel.cshtml"
using MvcSiteMapProvider.Web.Html.Models;

#line default
#line hidden

[System.CodeDom.Compiler.GeneratedCodeAttribute("RazorGenerator", "1.5.4.0")]
public class MenuHelperModel : System.Web.WebPages.HelperPage
{
}
}
```

When the compiled code is being executed, the custom "id=@node....." is not being generated in the html.

Going through the generated models, I'm noticing that there are several of these templates that the class generated is empty.

This is RazorGenerator.Mvc 1.5.5.0
RazorGenerator Extension 1.5.4
Visual Studio 2012
MVC 4 (asp.net 4.5 application)

Any advice would be appreciated.

Created Issue: Problems with. 4.5 and net MVC4 [103]

$
0
0
I followed exactly the steps described in this post.
But the error is displayed below

> ASP.NET runtime error: There is no build provider registered for the extension '.cshtml'. You can register one in the <compilation><buildProviders> section in machine.config or web.config. Make sure is has a BuildProviderAppliesToAttribute attribute which includes the value 'Web' or 'All'.


What am I doing wrong?
Viewing all 525 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>