blipson89 / Synthesis

Synthesis is a universal object mapper for Sitecore
MIT License
75 stars 25 forks source link

Intermittent exception on start for synthesis model check #58

Closed fuzzyducky closed 6 years ago

fuzzyducky commented 7 years ago

We sometimes get this exception on site load after app pool recycle but goes away on the 2nd request. Is this something you have seen before? I don't have a problem hitting the /Synthesis.aspx page.



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.]
   Synthesis.Utility.TypeCollectionUtility.WithAttribute(IEnumerable`1 types) +80
   Synthesis.Synchronization.SynchronizationEngine.get_ModelDictionary() +77
   Synthesis.Synchronization.SynchronizationEngine.IsTemplateSynchronized(ITemplateInfo template) +38
   Synthesis.Synchronization.SynchronizationEngine.AreTemplatesSynchronized() +211
   Synthesis.<>c__DisplayClass1_0.<CheckSyncAll>b__0(IProviderConfiguration configuration, TemplateGenerationMetadata metadata) +30
   Synthesis.SynthesisHelper.ExecMetadataWithAutoFriending(IEnumerable`1 configurations, Action`2 processAction) +332
   Synthesis.SynthesisHelper.CheckSyncAll() +107
   Synthesis.Pipelines.Initialize.CheckModelSynchronization.DoLogSync() +32
   Synthesis.Pipelines.Initialize.CheckModelSynchronization.Process(PipelineArgs args) +87
   (Object , Object[] ) +56
   Sitecore.Pipelines.PipelineMethod.Invoke(Object[] parameters) +36
   Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args) +365
   Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args, String pipelineDomain, Boolean failIfNotExists) +162
   Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args, String pipelineDomain) +18
   Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args) +18
   Sitecore.Pipelines.CorePipeline.Run(String pipelineName, PipelineArgs args) +49
   Sitecore.Nexus.Web.HttpModule.Application_Start() +156
   Sitecore.Nexus.Web.HttpModule.Init(HttpApplication app) +472
   System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +536
   System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +172
   System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +336
   System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +296

[HttpException (0x80004005): Object reference not set to an instance of an object.]
   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +9963380
   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +101
   System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +254```
kamsar commented 7 years ago

Sounds like an issue dynamically loading a type. Since Synthesis defaults to scanning all assemblies for Synthesis types, it's probably some other assembly doing something weird that messes things up.

You can avoid this by whitelisting model assemblies to look in. From Synthesis.config:

<typeListProvider type="Synthesis.Configuration.ConfigurationTypeListProvider, Synthesis" />
                <!--<typeListProvider type="Synthesis.Configuration.ConfigurationTypeListProvider, Synthesis">
                    <assemblies hint="list:AddAssembly">
                        <web>SynthesisDemo.Web</web>
                        Wildcards are also supported:
                        <foo>MyProject.Sites.*</foo>
                    </assemblies>
                </typeListProvider>-->

Sorry for the delay, my inbox sucks :(

blipson89 commented 6 years ago

Hi @fuzzyducky,

Are you still experiencing this problem?

fuzzyducky commented 6 years ago

I think I disabled the check on app start and haven't tried messing with it since.