1-888-365-2779
+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / Object reference not set to an instance of an object.

Object reference not set to an instance of an object.

18 posts, 0 answered
  1. Matthew
    Matthew avatar
    38 posts
    Registered:
    24 Jun 2012
    09 Jul 2009
    Link to this post
    Help! After upgrading my site from 3.5 to 3.6, I checked all links, frontend and backend. All was working fine.
    I then check it 2 hours later and lo and behold:

     

    Server Error in '/' Application.

    Object reference not set to an instance of an object.

    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:

    Line 211:			if (viewPerm.CheckDemand())
    Line 212:			{
    Line 213: IList pages = manager.GetPages();Line 214:				inTrayInfo = new PagesInTrayInfo((string)this.GetLocalResourceObject("Pages"), (string)this.GetLocalResourceObject("RecentlyModified"));
    Line 215:				inTrayInfo.SortBy = "DateModified";

    Source File: \\filer\winweb\sitename\Sitefinity\Admin\Default.aspx.cs    Line: 213

    Stack Trace:

    [NullReferenceException: Object reference not set to an instance of an object.]
       Nolics.ORMapper.DataProviders.SQLDataProvider.ParseResult(Int32 fromRow, Int32 maxRows, DataSet dsResult, IDataReader rd) +480
       Nolics.ORMapper.DataProviders.SQLDataProvider.ExecQuery(DataSet queries) +466
       Nolics.ORMapper.Base.QueryBase`1.LoadQuery(Int32 maxElements, Int32 fromElement) +286
       Nolics.ORMapper.Base.QueryBase`1.LoadAll() +23
       Telerik.Cms.Data.DefaultProvider.GetPages() +104
       Telerik.Cms.CmsManager.GetPages() +12
       Admin_Default.Page_Load(Object sender, EventArgs e) in \\filer\winweb\sitename\Sitefinity\Admin\Default.aspx.cs:213
       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
       Telerik.Cms.Web.CmsPageBase.OnLoad(EventArgs e) +55
       Telerik.Cms.Web.AdminPage.OnLoad(EventArgs e) +19
       Admin_Default.OnLoad(EventArgs e) in \\filer\winweb\sitename\Sitefinity\Admin\Default.aspx.cs:69
       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.3082; ASP.NET Version:2.0.50727.3082
  2. Matthew
    Matthew avatar
    38 posts
    Registered:
    24 Jun 2012
    09 Jul 2009
    Link to this post
    further to this I found the admin not working as well.

    I ended up resolving by deleting the 3889AC4AF542BAC3C62ABB154E78FEA8.dll from both the BIN directory and the serviceassemblies folder in sitefinity.

    It seemed that after my initial tests of the web application when all was ok, the website was then released from Application Pool memory. Then 2 hours later on first request it must of recompiled and then threw the error - thats my only assumption I can make. Will it happen again?

    It could be due to the way I did the upgrade - note below;
    Site1 in IIS is LIVE site (Sitefinity 3.5)
    we created Site2 in IIS as new site (pointing to the same db as LIVE) while we configured and tested the new version (note - everytime we tested the Site2 it broke Site1 *.ashx links - to resolve we would have to delete the 3889AC4AF542BAC3C62ABB154E78FEA8.dll from Site1 and let it get recreated).
    To send Site2 live we just removed host headers from IIS Site1 and put in Site 2.

    Perhaps the above may give some clue to my issue? Maybe my mistake was to use the same DB for Site1 and Site2?

    Any advice appreciated.
  3. Matthew
    Matthew avatar
    38 posts
    Registered:
    24 Jun 2012
    10 Jul 2009
    Link to this post
    Same issue happened again today.
    Site works fine for a day and then fails with the above error which can only be resovled by deleting the dll.
    Note: This site is hosted on a UNC path - could this be a cause of the issue?
  4. Matthew
    Matthew avatar
    38 posts
    Registered:
    24 Jun 2012
    13 Jul 2009
    Link to this post
    Hi guys,

    this is continually happening. Do I need to report this as an official bug in the application or is someone looking into it?
  5. Georgi
    Georgi avatar
    3583 posts
    Registered:
    28 Oct 2016
    13 Jul 2009
    Link to this post
    Hello Matthew,

    If I should be on the right track, right now, you have only one web site tied with one database, is this correct? And your files are stored on a network share? I am not sure the service assembly is now. Please make sure it is located in the bin directory. You can delete move it to the bin directory, and this should be the fix for the problem.

    Please let me know if I am missing something.

    Sincerely yours,
    Georgi
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  6. Matthew
    Matthew avatar
    38 posts
    Registered:
    24 Jun 2012
    13 Jul 2009
    Link to this post
    Correct.
    1 site and 1 database.

    The dll resides in both ServiceAssemblies area and the root BIN folder.

    Removing the dll from either ServiceAssemblies or the BIN does not resolve the issue.
  7. Matthew
    Matthew avatar
    38 posts
    Registered:
    24 Jun 2012
    13 Jul 2009
    Link to this post

    Last night we tried moving the site from the UNC share to Local disk on the server. However same error occurred over night and site was down again this morning with the error on the home page:

     

    Server Error in '/' Application.

    Object reference not set to an instance of an object.

    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:

    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:

    [NullReferenceException: Object reference not set to an instance of an object.]
       Nolics.ORMapper.DataProviders.SQLDataProvider.ParseResult(Int32 fromRow, Int32 maxRows, DataSet dsResult, IDataReader rd) +480
       Nolics.ORMapper.DataProviders.SQLDataProvider.ExecuteKeyQuery(DataSet queries, Boolean fPrimaryKey) +262
       Nolics.ORMapper.DataProviders.SQLDataProvider.QueryByPrimaryKey(DataSet keys) +7
       Nolics.ORMapper.Base.PrimeryKeyQuery.LoadPKQuery() +46
       Nolics.ORMapper.Base.LinkToValue`1.Resolve(ObKey key, IOdbView fromClass) +243
       Telerik.Cms.Data.PageContentBase.get_Page() +297
       Telerik.Cms.Data.CmsPageContent.get_CmsPage() +11
       Telerik.Cms.Data.CmsPageContent.get_DisableViewState() +8
       Telerik.Cms.Web.InternalPage.SetPageSettings(ICmsPage cmsPage) +13
       Telerik.Cms.Web.InternalPage.OnPreInit(EventArgs e) +404
       System.Web.UI.Page.PerformPreInit() +31
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +282
    

     


    Version Information: Microsoft .NET Framework Version:2.0.50727.3082; ASP.NET Version:2.0.50727.3082




    On this occasion the ServiceAssemblies\3889AC4AF542BAC3C62ABB154E78FEA8.dll was locked and I couldnt delete.

    I then copied it to the bin directory which got the site recompiled and up again.

    However, it is just a matter of time for the error to appear again.

    Any other ideas on how I can troubleshoot further?

  8. Georgi
    Georgi avatar
    3583 posts
    Registered:
    28 Oct 2016
    15 Jul 2009
    Link to this post
    Hi Matthew,

    I am almost sure that the error is not related to this assembly. Looking at the exception and code, it happens somewhere in the page editor, when you chance page settings.

    I want to ask you, are you using the newsletter module anyway? You can try to turn it off and see if you will replicate the error. Take a look in the kb article How to turn off modules, services and tools.
    Let me know if this is an option.

    Kind regards,
    Georgi
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  9. Matthew
    Matthew avatar
    38 posts
    Registered:
    24 Jun 2012
    15 Jul 2009
    Link to this post
    Hi Georgi,

    You are correct. I totally removed that dll from both BIN and Service Assemblies, left it for a day and the error came up again.

    > want to ask you, are you using the newsletter module anyway? You can try to turn it off and see if you will replicate the error. Take a look in the kb article How to turn off modules, services and tools.

    The main reason I upgraded from 3.5 to 3.6 was due to the newsletter system not working in 3.5 (however in 3.5 I had 98.99% uptime for the last 6 months using pingdom! however since the upgrade it goes down randomly twice a day!). The client needs the newsletter system so its not an option.

    My next option is coding in some error diagnostics so I can post you guys more information.
  10. Matthew
    Matthew avatar
    38 posts
    Registered:
    24 Jun 2012
    16 Jul 2009
    Link to this post
    ok I have more information for support to help me troubleshoot.

    so far we have worked out that;
    1. The issue has nothing to do with the UNC as I have received the same error on local disk as well as UNC
    2. The issue has nothing to do with the 3889AC4AF542BAC3C62ABB154E78FEA8.dll inside either BIN or SiteFinity/ServiceAssemblies as I totally removed both and eventually got the same error.

    I then added some logging script to the Application_Error event in Global.asax and waited for it to happen again...which it has and I have the following error information below.

    Note: Pingdom checks the site /Home.aspx url every 5 minutes and sends me an error alert if down (which has been once a day since the upgrade). It does not access /sitefinity/cmsentrypoint.aspx as the error below suggests..all I can think of here is that Home.aspx calls /sitefinity/cmsentrypoint.aspx within the page?

    To temporary resolve the issue all I do is rename one of the dlls, then rename it back. It then recompiles and sorts itself out. Seems as any change to the BIN directory will temporary resolve the issue

    DateTime: Thursday, 16 July 2009 4:43:21 PM
    Offending URL: /sitefinity/cmsentrypoint.aspx
    Machine Name: GANYMEDE
    User Agent: Pingdom.com_bot_version_1.4_(http://www.pingdom.com/)

    Source: System.Web

    Message: Exception of type 'System.Web.HttpUnhandledException' was thrown.

    Stack trace: 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.sitefinity_cmsentrypoint_aspx.ProcessRequest(HttpContext context) at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

    Inner Exception: System.NullReferenceException: Object reference not set to an instance of an object. at Nolics.ORMapper.DataProviders.SQLDataProvider.ParseResult(Int32 fromRow, Int32 maxRows, DataSet dsResult, IDataReader rd) at Nolics.ORMapper.DataProviders.SQLDataProvider.ExecuteKeyQuery(DataSet queries, Boolean fPrimaryKey) at Nolics.ORMapper.DataProviders.SQLDataProvider.QueryByPrimaryKey(DataSet keys) at Nolics.ORMapper.Base.PrimeryKeyQuery.LoadPKQuery() at Nolics.ORMapper.Base.LinkToValue`1.Resolve(ObKey key, IOdbView fromClass) at Telerik.Cms.Data.PageContentBase.get_Page() at Telerik.Cms.Data.CmsPageContent.get_CmsPage() at Telerik.Cms.Data.CmsPageContent.get_DisableViewState() at Telerik.Cms.Web.InternalPage.SetPageSettings(ICmsPage cmsPage) at Telerik.Cms.Web.InternalPage.OnPreInit(EventArgs e) at System.Web.UI.Page.PerformPreInit() at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

    Request Form:

    Request Querystring:

  11. Matthew
    Matthew avatar
    38 posts
    Registered:
    24 Jun 2012
    20 Jul 2009
    Link to this post
    Any ideas appreciated.
  12. Georgi
    Georgi avatar
    3583 posts
    Registered:
    28 Oct 2016
    21 Jul 2009
    Link to this post
    Hi Matthew,

    There seems to be an issue with the pages - as I mentioned before, the stack trace shows that the problems happen after the visiting or setting some of the pages.
    You can try to enable the viewstate for all pages in your web site and check if this will make any difference. If you get an error while doing so, we will require to see your database here. Let us know if this is an option.

    Kind regards,
    Georgi
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  13. Matthew
    Matthew avatar
    38 posts
    Registered:
    24 Jun 2012
    21 Jul 2009
    Link to this post
    thanks for the feedback.

    FYI, I can confirm that no modification of the pages has occurred during this time -as we have put a freeze on the admin and entering of content.

    So if i understand correctly, I am to open each page (in the admin) and set viewstate=true somewhere? Is this in the UI or hardcoded in a page somewhere. - let me know the instructions.

    thanks
  14. Georgi
    Georgi avatar
    3583 posts
    Registered:
    28 Oct 2016
    21 Jul 2009
    Link to this post
    Hello Matthew,

    This is an option in the Page Properties. The code is failing when reading this setting, so I hope that this will be resolved if we switch the option.

    Please check my screenshot.

    Best wishes,
    Georgi
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  15. Matthew
    Matthew avatar
    38 posts
    Registered:
    24 Jun 2012
    22 Jul 2009
    Link to this post
    unfortunately it did not resolve the issue.

    I have posted you information here on how to download the database/site to review: http://www.telerik.com/account/support-tickets/general-feedback.aspx 
  16. Georgi
    Georgi avatar
    3583 posts
    Registered:
    28 Oct 2016
    22 Jul 2009
    Link to this post
    Hello Matthew,

    Thank you for the follow up. We will keep you informed about every step we take with the files, the download and the resolution.

    Sincerely yours,
    Georgi
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  17. Matthew
    Matthew avatar
    38 posts
    Registered:
    24 Jun 2012
    27 Jul 2009
    Link to this post
    Thanks to Georgi and Sitefinity team for helping me resolve this issue:

    Here is what might be happening:
    1. When someone requests a page through the older version, the database is being downgraded.
    2. When someone requests a page through the new version afterwards, the needed option is missing in the database, and an Object Reference error is thrown.



    If you follow this ticket, you can see that the site was upgraded. The problem was apparant after the upgrade and due to having the old sites IIS entry still accessible (albeit by a preview subdomain) in which the following describes a use case to replicate:

    Just found that the old site was still accessible through a test subdomain. Can I assume the following;

    To replicate this error you need to go the Old website after the LIVE website has been removed from Application cache? i.e. you need the JIT to kick in? As I went to the old site now and it compiled and worked. I then went to the LIVE site and it was down. I then got the LIVE site working by modifying the BIN directory to restart JIT compiler and it was back up. I then went to the OLD website and it was down....but the live site still worked after going to the old site.


    so it seems you need to hit either site when it is out of application cache so the JIT kicks in for it to update the database status?

    To which Georgi replied:

    You are correct.

    The database is being upgraded/downgraded when the providers (and the applications) are being initialized. This is not happening when the application is already running, so that is why you fix this error only when you start up the application again. Every change to the bin folder, or to the web.config file forces Asp.Net to restart the application, and initialize (downgrade/upgrade the db schema) the providers and services.



    So if you are doing an upgrade and create a seperate site, probably best to provision a new database instead of using the existing one.
    hope this helps.

  18. Georgi
    Georgi avatar
    3583 posts
    Registered:
    28 Oct 2016
    27 Jul 2009
    Link to this post
    Hello,

    I will add some notes to the upgrade instructions as well.

    Kind regards,
    Georgi
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
Register for webinar
18 posts, 0 answered