Problems running in VS2008

Aug 29, 2011 at 4:41 PM

I have a client who is running SnomTastic and would like some minor modification made to the application.  I was able install and run the production version on my development machine without any issues.  I downloaded the source code and it compiles fine, but I get the error below when I run it from inside VS2008.  When I step into the code ConfigurationManager.ConnectionStrings["cnn"].ConnectionString has a valid value.  Researching the Object reference not set to an instance of an object error the only thing I found outside of the obvious infraction of using an uninitialized variable had something to do with COM Interop stuff when using the old (standard) ADO with ASP.NET.  Since that is not the architecture of this application I'm sure that is not the issue.  I'm at a lose for what path to pusue to figure this out.  Any suggestions?

My development environment is:

  • Windows 7 Pro
  • IIS 7.5
  • SQL Server 2008 R2
  • Visual Studio 2008 Pro
  • Telerik WebUI VSExtensions 2011.02.712.0

  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.NullReferenceException: Object reference not set to an instance of an object.

Source Error:

Server Error in '/admin' Application.

Object reference not set to an instance of an object.

 

Line 20:         public SqlDataProvider()
Line 21:         {
Line 22:             this.ConnectionString = ConfigurationManager.ConnectionStrings["cnn"].ConnectionString;
Line 23:         }
Line 24: 


Source File: C:\Users\Rick\Documents\Visual Studio 2008\Projects\Snomtastic\shfa.snomtastic.data\SqlDataProvider.cs Line: 22

Stack Trace:

[NullReferenceException: Object reference not set to an instance of an object.]
   shfa.snomtastic.data.SqlDataProvider..ctor() in C:\Users\Rick\Documents\Visual Studio 2008\Projects\Snomtastic\shfa.snomtastic.data\SqlDataProvider.cs:22
   shfa.snomtastic.data.business.SiteNavController..ctor() in C:\Users\Rick\Documents\Visual Studio 2008\Projects\Snomtastic\shfa.snomtastic.data\Business\SiteNav\SiteNavController.cs:15
   shfa.snomtastic.admin._default.BuildTree() in C:\Users\Rick\Documents\Visual Studio 2008\Projects\Snomtastic\shfa.snomtastic.admin\default.aspx.cs:140
   shfa.snomtastic.admin._default.Page_Load(Object sender, EventArgs e) in C:\Users\Rick\Documents\Visual Studio 2008\Projects\Snomtastic\shfa.snomtastic.admin\default.aspx.cs:46
   System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +14
   System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +35
   System.Web.UI.Control.OnLoad(EventArgs e) +99
   System.Web.UI.Control.LoadRecursive() +50
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +627

 


Version Information: Microsoft .NET Framework Version:2.0.50727.5446; ASP.NET Version:2.0.50727.5420

<!-- [NullReferenceException]: Object reference not set to an instance of an object. at shfa.snomtastic.data.SqlDataProvider..ctor() in C:\Users\Rick\Documents\Visual Studio 2008\Projects\Snomtastic\shfa.snomtastic.data\SqlDataProvider.cs:line 22 at shfa.snomtastic.data.business.SiteNavController..ctor() in C:\Users\Rick\Documents\Visual Studio 2008\Projects\Snomtastic\shfa.snomtastic.data\Business\SiteNav\SiteNavController.cs:line 15 at shfa.snomtastic.admin._default.BuildTree() in C:\Users\Rick\Documents\Visual Studio 2008\Projects\Snomtastic\shfa.snomtastic.admin\default.aspx.cs:line 140 at shfa.snomtastic.admin._default.Page_Load(Object sender, EventArgs e) in C:\Users\Rick\Documents\Visual Studio 2008\Projects\Snomtastic\shfa.snomtastic.admin\default.aspx.cs:line 46 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.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) [HttpUnhandledException]: Exception of type 'System.Web.HttpUnhandledException' was thrown. at System.Web.UI.Page.HandleError(Exception e) at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) at System.Web.UI.Page.ProcessRequest() at System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context) at System.Web.UI.Page.ProcessRequest(HttpContext context) at ASP.default_aspx.ProcessRequest(HttpContext context) in c:\Windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\admin\15a950eb\178d0366\App_Web_szujn-vk.0.cs:line 0 at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) -->
Aug 31, 2011 at 4:38 PM

I was able to resolve this problem.  I changed to the Identity on the application pool from ApplicationPoolIdentity to LocalSystem.  I suspect the real issue with with directory permission somewhere down the line.  For now, this will let me experiment with the code.