During the development of nopCommerce plugin, I am getting this not so useful null reference error. If you look careful enough though, this not so useful error did give me some hints though.
NullReferenceException: Object reference not set to an instance of an object.]
ASP.<>c__DisplayClass1.<GenerateSubCategories>b__0(TextWriter __razor_helper_writer) in c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root\683926bd\eece36df\App_Web_ta.plugin.widgets.megamenu.views.widgetsmegamenu.megamenu.cshtml.4107764b.if7iazw3.0.cs:0
It is complaining about an object not found in the temporary folder. Occasionally the temporary folder is outdated and Visual Studio is not able to clear during recompilation. I manually deleted the temporary folder, recompile and everything work fine again.