Join our community!

Get everything you need to start developing EPiServer solutions.

Requesting method to easily find the cause of ''Object reference not set to an instance of an object.''

October 2 2012, 16:17

'Object reference not set to an instance of an object.' is a common error reference when viewing an Episerver-site when a property is missing. The problem is that it is hard to find which property is missing.


I request that you at Episerver should develop an method for making this easier to track down.

:

 

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:


[No relevant source lines]


Source File: c:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\2eb86b5f\4574ca70\App_global.asax.po8rtfx0.0.cs    Line: 0

Stack Trace:


[NullReferenceException: Object reference not set to an instance of an object.]
   EPiServer.Data.DataInitialization.InitializeCacheProvider() +428
   EPiServer.Data.DataInitialization.Initialize(InitializationEngine context) +113
   EPiServer.Framework.Initialization.InitializationEngine.InitializeModules() +425
   EPiServer.Framework.Initialization.InitializationEngine.Initialize(HostType hostType) +196
   EPiServer.Framework.Initialization.InitializationModule.Initialize(HostType hostType) +266
   EPiServer.Framework.Initialization.InitializationModule.FrameworkInitialization(HostType hostType) +86
   EPiServer.Global..ctor() +89
   EPiServer.Templates.Global..ctor() +28
   ASP.global_asax..ctor() in c:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\2eb86b5f\4574ca70\App_global.asax.po8rtfx0.0.cs:0

[TargetInvocationException: Exception has been thrown by the target of an invocation.]
   System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck) +0
   System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark) +114
   System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark) +232
   System.Activator.CreateInstance(Type type, Boolean nonPublic) +83
   System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, StackCrawlMark& stackMark) +1135
   System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) +128
   System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture) +18
   System.Web.HttpRuntime.CreateNonPublicInstance(Type type, Object[] args) +60
   System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +260
   System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +296

[HttpException (0x80004005): Exception has been thrown by the target of an invocation.]
   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +9850940
   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +101
   System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +254


Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.17626 

  

Thanks in advance!


  • October 8 2012, 10:28

    You're error message seems to be from app startup and not from actually requesting a page.

  • December 10 2012, 20:47

    If you only use c# and asp.net webcontrols there will be up to us, developers of the website, to make sure this do not happen. If you instead use the <episerver:property /> webcontrol this might not happen to often anyway :) You can use a "DisplayMissingMessage"-property on that webcontrol that will tell you if a property is missing or not. Most of the time though the developer need to make sure this will not happen.

    But as Johan mentioned above your message does not look like an error message when missing a property from a page.