【问题标题】:mini-profiler nullreferenceexception迷你探查器 nullreferenceexception
【发布时间】:2011-12-15 04:30:57
【问题描述】:

当我正在运行的存储过程执行 mini-profiler 时会抛出一个空引用并导致我的应用程序停止。在这种情况下,SP 不会返回任何内容。

这是堆栈跟踪:

   at MvcMiniProfiler.MiniProfiler.AddSqlTiming(SqlTiming stats) in C:\Users\sam\Desktop\mvc-mini-profiler\MvcMiniProfiler\MiniProfiler.cs:line 274
   at MvcMiniProfiler.SqlTiming..ctor(DbCommand command, ExecuteType type, MiniProfiler profiler) in C:\Users\sam\Desktop\mvc-mini-profiler\MvcMiniProfiler\SqlTiming.cs:line 137
   at MvcMiniProfiler.SqlProfiler.ExecuteStartImpl(DbCommand command, ExecuteType type) in C:\Users\sam\Desktop\mvc-mini-profiler\MvcMiniProfiler\SqlProfiler.cs:line 39
   at MvcMiniProfiler.SqlProfilerExtensions.ExecuteStart(SqlProfiler sqlProfiler, DbCommand command, ExecuteType type) in C:\Users\sam\Desktop\mvc-mini-profiler\MvcMiniProfiler\SqlProfiler.cs:line 93
   at MvcMiniProfiler.MiniProfiler.MvcMiniProfiler.Data.IDbProfiler.ExecuteStart(DbCommand profiledDbCommand, ExecuteType executeType) in C:\Users\sam\Desktop\mvc-mini-profiler\MvcMiniProfiler\MiniProfiler.IDbProfiler.cs:line 14
   at MvcMiniProfiler.Data.ProfiledDbCommand.ExecuteDbDataReader(CommandBehavior behavior) in C:\Users\sam\Desktop\mvc-mini-profiler\MvcMiniProfiler\Data\ProfiledDbCommand.cs:line 158
   at System.Data.Common.DbCommand.ExecuteReader()
   at System.Data.Linq.SqlClient.SqlProvider.Execute(Expression query, QueryInfo queryInfo, IObjectReaderFactory factory, Object[] parentArgs, Object[] userArgs, ICompiledSubQuery[] subQueries, Object lastResult)
   at System.Data.Linq.SqlClient.SqlProvider.ExecuteAll(Expression query, QueryInfo[] queryInfos, IObjectReaderFactory factory, Object[] userArguments, ICompiledSubQuery[] subQueries)
   at System.Data.Linq.SqlClient.SqlProvider.System.Data.Linq.Provider.IProvider.Execute(Expression query)
   at System.Data.Linq.DataContext.ExecuteMethodCall(Object instance, MethodInfo methodInfo, Object[] parameters)
   at NetINFO.NetINFODataContext.usp_SRM_GetPlansByType(Nullable`1 sRM_ID, Nullable`1 sRM_PlanTypeID) in C:\Code\netinfo\NetInfo.Web\App_Data\NetINFO.designer.cs:line 1949
   at NetINFO.NetCMG.SRM.GetSRMPlans(Int32 pPlanType) in C:\Code\netinfo\NetInfo.Web\pages\NetCMG\classes\SRM.cs:line 673
   at NetINFO.NetCMG.SRM.Validate() in C:\Code\netinfo\NetInfo.Web\pages\NetCMG\classes\SRM.cs:line 540
   at NetCMG.Controls.TicketErrorsCtl.ValidateTicket(SRM Ticket) in C:\Code\netinfo\NetInfo.Web\pages\NetCMG\Controls\TicketErrorsCtl.ascx.cs:line 29
   at NetCMG.Controls.TicketErrorsCtl.Page_Load(Object sender, EventArgs e) in C:\Code\netinfo\NetInfo.Web\pages\NetCMG\Controls\TicketErrorsCtl.ascx.cs:line 16
   at System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e)
   at System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e)
   at System.Web.UI.Control.OnLoad(EventArgs e)
   at System.Web.UI.Control.LoadRecursive()
   at System.Web.UI.Control.LoadRecursive()
   at System.Web.UI.Control.LoadRecursive()
   at System.Web.UI.Control.LoadRecursive()
   at System.Web.UI.Control.LoadRecursive()
   at System.Web.UI.Control.LoadRecursive()
   at System.Web.UI.Control.LoadRecursive()
   at System.Web.UI.Control.LoadRecursive()
   at System.Web.UI.Control.LoadRecursive()
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

【问题讨论】:

  • @ChaseFlorell 我找到了解决问题的方法。不确定它是否与您的相同?
  • 不幸的是我得到这个错误现在很好。尝试将依赖项注入自定义 RoleProvider 时发生。出了点问题。

标签: mvc-mini-profiler


【解决方案1】:

我终于找到了解决上述问题的方法。该错误发生在对网格使用 sql 数据源的旧版 webforms 应用程序上。 sql 数据源正在使用“ProviderName”属性。一旦我删除了这个属性,一切都开始工作了。

【讨论】:

  • 谢谢,我在 SqlDataSource 上遇到了另一个但类似的错误,而您的答案(删除属性 ProviderName)就是解决方案。
【解决方案2】:

有同样的问题:从应用程序启动 NRE。发生异常at MvcMiniProfiler.MiniProfiler.AddSqlTiming(SqlTiming stats)

问题原因:Application_AuthenticateRequest() 中的数据库调用

问题解决方案:MiniProfiler.Start(); 移至 Application_AuthenticateRequest() 方法的末尾。

【讨论】:

    猜你喜欢
    • 2011-12-21
    • 2011-09-15
    • 1970-01-01
    • 2011-09-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多