如何在注释行中修复错误?

时间:2014-02-17 03:17:36

标签: c# asp.net episerver

我在注释行中有一个错误。

对象引用未设置为对象的实例。

描述:执行当前Web请求期间发生了未处理的异常。请查看堆栈跟踪以获取有关错误及其源自代码的位置的更多信息。

异常详细信息:System.NullReferenceException:未将对象引用设置为对象的实例。

来源错误:

Line 41: 
Line 42:             //                //New sistem
Line 43:             //                //Add User  // ERROR
Line 44:             //                manager.AddAllUsersFromEpiServer();
Line 45:             //                //Associate to Admin Group

堆栈追踪:

[NullReferenceException: Object reference not set to an instance of an object.]
   Devcore.EpiCase.Controllers.BaseController.Initialize(RequestContext requestContext) in f:\Development\DevCore\EPiCase\modules\EpiCase\Controllers\BaseController.cs:43
   System.Web.Mvc.Controller.BeginExecute(RequestContext requestContext, AsyncCallback callback, Object state) +323
   System.Web.Mvc.Controller.System.Web.Mvc.Async.IAsyncController.BeginExecute(RequestContext requestContext, AsyncCallback callback, Object state) +49
   System.Web.Mvc.<>c__DisplayClass8.<BeginProcessRequest>b__2(AsyncCallback asyncCallback, Object asyncState) +127
   System.Web.Mvc.Async.WrappedAsyncResult`1.Begin(AsyncCallback callback, Object state, Int32 timeout) +161
   System.Web.Mvc.Async.AsyncResultWrapper.Begin(AsyncCallback callback, Object state, BeginInvokeDelegate beginDelegate, EndInvokeDelegate`1 endDelegate, Object tag, Int32 timeout) +92
   System.Web.Mvc.Async.AsyncResultWrapper.Begin(AsyncCallback callback, Object state, BeginInvokeDelegate beginDelegate, EndInvokeDelegate endDelegate, Object tag, Int32 timeout) +97
   System.Web.Mvc.Async.AsyncResultWrapper.Begin(AsyncCallback callback, Object state, BeginInvokeDelegate beginDelegate, EndInvokeDelegate endDelegate, Object tag) +53
   System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContextBase httpContext, AsyncCallback callback, Object state) +388
   System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContext httpContext, AsyncCallback callback, Object state) +88
   System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.BeginProcessRequest(HttpContext context, AsyncCallback cb, Object extraData) +50
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +832
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +188

1 个答案:

答案 0 :(得分:1)

您的dll和pdbs不同步,注释行不能抛出异常。

  • 检查您的项目参考:您是否在解决方案中引用了项目的输出,或者您是否添加了对.dll的直接引用?
  • 尝试“清洁解决方案”(右键单击解决方案)并重建整个解决方案。
  • 或者您可以尝试删除bin文件夹中的所有内容并重建。