Skip to content

Instantly share code, notes, and snippets.

@andrewdavey
Created February 24, 2012 13:26
Nancy razor helper problem
<!DOCTYPE html>
<html>
<head>
<title>Resource</title>
</head>
<body>
@TestHelper()
</body>
</html>
@helper TestHelper() {
<p>test</p>
}
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[ArgumentNullException: Value cannot be null.
Parameter name: typeName]
System.Web.Razor.Generator.CSharpCodeWriter.EmitStartConstructor(String typeName) +245131
System.Web.Razor.Generator.RazorCodeGenerator.VisitSpan(HelperHeaderSpan span) +331
System.Web.Razor.Generator.RazorCodeGenerator.TryVisit(Span baseSpan, Action`1 subclassVisitor) +84
System.Web.Razor.Generator.RazorCodeGenerator.TryVisitSpecialSpanCore(Span span) +241
System.Web.Razor.Generator.RazorCodeGenerator.VisitSpan(Span span) +74
System.Web.Razor.Parser.VisitorPair.VisitSpan(Span span) +34
System.Web.Razor.Parser.ParserContext.FlushNextOutputSpan() +31
System.Web.Razor.Parser.ParserContext.EndBlock() +13
System.Web.Razor.Utils.DisposableAction.Dispose(Boolean disposing) +20
System.Web.Razor.Utils.DisposableAction.Dispose() +20
System.Web.Razor.Parser.HtmlMarkupParser.ParseRootBlock(Tuple`2 nestingSequences, Boolean caseSensitive) +417
System.Web.Razor.Parser.HtmlMarkupParser.ParseDocument() +22
System.Web.Razor.Parser.RazorParser.Parse(LookaheadTextReader input, ParserVisitor visitor) +121
System.Web.Razor.RazorTemplateEngine.GenerateCodeCore(LookaheadTextReader input, String className, String rootNamespace, String sourceFileName, Nullable`1 cancelToken) +231
Nancy.ViewEngines.Razor.RazorViewEngine.GetCompiledViewFactory(String extension, TextReader reader, Assembly referencingAssembly, Type passedModelType) +200
Nancy.ViewEngines.Razor.<>c__DisplayClass3f.<GetOrCompileView>b__3e(ViewLocationResult x) +48
Nancy.ViewEngines.DefaultViewCache.GetOrAdd(ViewLocationResult viewLocationResult, Func`2 valueFactory) +88
Nancy.ViewEngines.Razor.RazorViewEngine.GetOrCompileView(ViewLocationResult viewLocationResult, IRenderContext renderContext, Assembly referencingAssembly, Type passedModelType) +117
Nancy.ViewEngines.Razor.RazorViewEngine.GetViewInstance(ViewLocationResult viewLocationResult, IRenderContext renderContext, Assembly referencingAssembly, Object model) +874
Nancy.ViewEngines.Razor.<>c__DisplayClass1e.<RenderView>b__1d(Stream stream) +479
Nancy.Hosting.Aspnet.NancyHandler.SetNancyResponseToHttpResponse(HttpContextBase context, Response response) +98
Nancy.Hosting.Aspnet.NancyHandler.ProcessRequest(HttpContextBase context) +69
Nancy.Hosting.Aspnet.NancyHttpRequestHandler.ProcessRequest(HttpContext context) +62
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +100
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment