Nancy 2.0.0预发行版中ViewEngine的随机问题

时间:2017-04-12 14:23:45

标签: nancy

我的应用程序遇到了一些奇怪的问题,我不确定如何追踪,因为它是如此随机。我想知道是否有任何基于下面的堆栈跟踪的想法。

以下是一些快速要点:

  • 问题似乎与View(.cshtml)
  • 中的代码有关
  • 它随机出现,它与会话cookie有关,因为如果您从另一台计算机上尝试,那么它没有问题,或者如果您清除缓存,则没有问题
  • 我的GetUserByIdentifier包含在try {} catch {}中,如果我们输入catch {} ..它将返回NULL,它应该重定向到登录屏幕。

这可能是内部导致错误消息的内容吗?这个未处理的异常甚至可能发生在我的login.cshtml页面上,该页面在视图中甚至没有任何代码。

错误消息:

Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index

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: 


[ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index]
   System.ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument argument, ExceptionResource resource) +72
   System.SZArrayHelper.get_Item(Int32 index) +13816967
   Nancy.ViewEngines.Razor.RazorViewEngine.GetLineNumber(Int32 startLineIndex, IReadOnlyList`1 compilationSource) +39
   Nancy.ViewEngines.Razor.<>c__DisplayClass19_0.<BuildErrorMessages>b__0(Diagnostic error) +118
   System.Linq.WhereSelectArrayIterator`2.MoveNext() +80
   System.Linq.WhereEnumerableIterator`1.MoveNext() +51
   System.Linq.Buffer`1..ctor(IEnumerable`1 source) +250
   System.Linq.Enumerable.ToArray(IEnumerable`1 source) +106
   Nancy.ViewEngines.Razor.RazorViewEngine.BuildErrorMessages(IEnumerable`1 errors, IList`1 templateLines, IReadOnlyList`1 compilationSource) +272
   Nancy.ViewEngines.Razor.RazorViewEngine.BuildErrorMessage(EmitResult result, ViewLocationResult viewLocationResult, String sourceCode) +366
   Nancy.ViewEngines.Razor.<>c__DisplayClass14_0.<GenerateRazorViewFactory>b__0() +49
   Nancy.ViewEngines.Razor.RazorViewEngine.GetViewInstance(ViewLocationResult viewLocationResult, IRenderContext renderContext, Object model) +1064
   Nancy.ViewEngines.Razor.<>c__DisplayClass9_0.<RenderView>b__0(Stream stream) +4700
   Nancy.Hosting.Aspnet.<ProcessRequest>d__2.MoveNext() +381
   System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +13891908
   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +61
   System.Web.TaskAsyncHelper.EndTask(IAsyncResult ar) +69
   System.Web.CallHandlerExecutionStep.OnAsyncHandlerCompletion(IAsyncResult ar) +178

0 个答案:

没有答案