{"action":"created","issue":{"url":"https://api.github.com/repos/Antaris/RazorEngine/issues/218","labels_url":"https://api.github.com/repos/Antaris/RazorEngine/issues/218/labels{/name}","comments_url":"https://api.github.com/repos/Antaris/RazorEngine/issues/218/comments","events_url":"https://api.github.com/repos/Antaris/RazorEngine/issues/218/events","html_url":"https://github.com/Antaris/RazorEngine/issues/218","id":55287603,"number":218,"title":"RazorEngine crashes when compiling template","user":{"login":"PhilipDaniels","id":1809220,"avatar_url":"https://avatars.githubusercontent.com/u/1809220?v=3","gravatar_id":"","url":"https://api.github.com/users/PhilipDaniels","html_url":"https://github.com/PhilipDaniels","followers_url":"https://api.github.com/users/PhilipDaniels/followers","following_url":"https://api.github.com/users/PhilipDaniels/following{/other_user}","gists_url":"https://api.github.com/users/PhilipDaniels/gists{/gist_id}","starred_url":"https://api.github.com/users/PhilipDaniels/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PhilipDaniels/subscriptions","organizations_url":"https://api.github.com/users/PhilipDaniels/orgs","repos_url":"https://api.github.com/users/PhilipDaniels/repos","events_url":"https://api.github.com/users/PhilipDaniels/events{/privacy}","received_events_url":"https://api.github.com/users/PhilipDaniels/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-01-23T14:35:44Z","updated_at":"2015-01-23T15:29:32Z","closed_at":null,"body":"I am trying to compile a template with a model in a static site generator I am writing (early days yet). The code is on Github. To reproduce, follow these instructions\r\n\r\ngit clone https://github.com/PhilipDaniels/Lithogen\r\ngit checkout a1f3cefa8f6c06d12fad1ad095caddd327286c48   # Version known to fail\r\nThen open a command prompt and run install_npm_modules.cmd\r\nOpen Lithogen.sln in Visual Studio, and Build Lithogen.TaskShim and Lithogen.\r\nRebuild Lithogen.Boilerplate (it will error out). This causes the shim to write Lithogen.xml and Lithogen.json, which Lithogen.exe needs. In the Lithogen.Boilerplate\\Lithogen\\Tools\\Lithogen folder you will find Lithogen.exe. In that same folder will be Lithogen.log which will contain this stack trace.\r\n\r\nStick a breakpoint in RazorProcessor.Process() in Lithogen.Core.\r\nSet the startup project to Lithogen.\r\nNow you can debug in the normal way.\r\n\r\n2015-01-23 12:59:35.87 [         0.93] ViewDirectoryProcessor: processing C:\\Users\\pdaniels\\repos\\Lithogen\\src\\Lithogen.Boilerplate\\Views\\solarsystem.cshtml.\r\n2015-01-23 12:59:35.87 [  0.01,  0.93] RazorProcessor: compiling C:\\Users\\pdaniels\\repos\\Lithogen\\src\\Lithogen.Boilerplate\\Views\\solarsystem.cshtml.\r\n2015-01-23 12:59:35.91 [  0.04,  0.97] RazorEngineReferenceResolver: Attempting to get references.\r\n2015-01-23 12:59:35.92 [  0.01,  0.98] RazorEngineReferenceResolver: Returning C:\\Users\\pdaniels\\repos\\Lithogen\\src\\Lithogen.Boilerplate\\bin\\Lithogen.Boilerplate.dll.\r\n2015-01-23 12:59:35.92 [         0.98] RazorEngineReferenceResolver: Returning C:\\Users\\pdaniels\\repos\\Lithogen\\src\\Lithogen.Boilerplate\\bin\\Newtonsoft.Json.dll.\r\n2015-01-23 12:59:35.92 [         0.99] RazorEngineReferenceResolver: Returning C:\\Users\\pdaniels\\repos\\Lithogen\\src\\Lithogen.Boilerplate\\bin\\System.Net.Http.Formatting.dll.\r\n2015-01-23 12:59:35.93 [         0.99] RazorEngineReferenceResolver: Returning C:\\Users\\pdaniels\\repos\\Lithogen\\src\\Lithogen.Boilerplate\\bin\\System.Web.Http.dll.\r\n2015-01-23 12:59:36.09 [  0.16,  1.15] System.NullReferenceException: Object reference not set to an instance of an object.\r\n   at RazorEngine.Templating.CompiledTemplate.get_TemplateAssembly()\r\n   at RazorEngine.Templating.DefaultCachingProvider.<>c__DisplayClass5.<CacheTemplateHelper>b__0(String key)\r\n   at System.Collections.Concurrent.ConcurrentDictionary`2.AddOrUpdate(TKey key, Func`2 addValueFactory, Func`3 updateValueFactory)\r\n   at RazorEngine.Templating.DefaultCachingProvider.CacheTemplateHelper(ICompiledTemplate template, ITemplateKey templateKey, Type modelTypeKey)\r\n   at RazorEngine.Templating.DefaultCachingProvider.CacheTemplate(ICompiledTemplate template, ITemplateKey templateKey)\r\n   at RazorEngine.Templating.RazorEngineService.CompileAndCacheInternal(ITemplateKey key, Type modelType)\r\n   at RazorEngine.Templating.RazorEngineService.GetCompiledTemplate(ITemplateKey key, Type modelType, Boolean compileOnCacheMiss)\r\n   at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)\r\n   at RazorEngine.Templating.DynamicWrapperService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)\r\n   at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass4.<RunCompile>b__3(TextWriter writer)\r\n   at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)\r\n   at RazorEngine.Templating.RazorEngineServiceExtensions.RunCompile(IRazorEngineService service, String name, Type modelType, Object model, DynamicViewBag viewBag)\r\n   at RazorEngine.Templating.RazorEngineServiceExtensions.RunCompile(IRazorEngineService service, String templateSource, String name, Type modelType, Object model, DynamicViewBag viewBag)\r\n   at Lithogen.Core.Implementations.RazorProcessor.Process(String filename, String contents) in c:\\Users\\pdaniels\\repos\\Lithogen\\src\\Lithogen.Core\\Implementations\\RazorProcessor.cs:line 39\r\n   at Lithogen.Core.Implementations.ViewDirectoryProcessor.Execute() in c:\\Users\\pdaniels\\repos\\Lithogen\\src\\Lithogen.Core\\Implementations\\ViewDirectoryProcessor.cs:line 57\r\n   at Lithogen.Core.Implementations.Builder.ExecuteViewsStep() in c:\\Users\\pdaniels\\repos\\Lithogen\\src\\Lithogen.Core\\Implementations\\Builder.cs:line 107\r\n   at Lithogen.Core.Implementations.Builder.Build() in c:\\Users\\pdaniels\\repos\\Lithogen\\src\\Lithogen.Core\\Implementations\\Builder.cs:line 36\r\n   at Lithogen.Program.Main(String[] args) in c:\\Users\\pdaniels\\repos\\Lithogen\\src\\Lithogen\\Program.cs:line 46"},"comment":{"url":"https://api.github.com/repos/Antaris/RazorEngine/issues/comments/71209610","html_url":"https://github.com/Antaris/RazorEngine/issues/218#issuecomment-71209610","issue_url":"https://api.github.com/repos/Antaris/RazorEngine/issues/218","id":71209610,"user":{"login":"matthid","id":1866463,"avatar_url":"https://avatars.githubusercontent.com/u/1866463?v=3","gravatar_id":"","url":"https://api.github.com/users/matthid","html_url":"https://github.com/matthid","followers_url":"https://api.github.com/users/matthid/followers","following_url":"https://api.github.com/users/matthid/following{/other_user}","gists_url":"https://api.github.com/users/matthid/gists{/gist_id}","starred_url":"https://api.github.com/users/matthid/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/matthid/subscriptions","organizations_url":"https://api.github.com/users/matthid/orgs","repos_url":"https://api.github.com/users/matthid/repos","events_url":"https://api.github.com/users/matthid/events{/privacy}","received_events_url":"https://api.github.com/users/matthid/received_events","type":"User","site_admin":false},"created_at":"2015-01-23T15:29:32Z","updated_at":"2015-01-23T15:29:32Z","body":"The problem is that while loading the template assembly the runtime cannot find Lithogen.Boilerplate.dll. I can only improve the exception message but not the root case (which lies in your setup)."}}