0

We have an ASP.NET 4.0 website which randomly throws "Object reference not set to an instance of an object" exceptions. These errors tend to occur in spurts, and the stack trace always points to line 0 in one of the "Temporary ASP.NET Files", "App_Web_f0ihyyu5.3.cs" for example. I am never able to reproduce the issue when attempting to troubleshoot it on our development server.

When these errors start occurring, clearing the temporary files seems to stop them for several days, and then they slowly start to re-occur. I'm not sure how to go about debugging this issue.

  • Do you have a sample stack trace? It is likely related to the call BEFORE the erroneous null reference exception. – tmesser Nov 01 '12 at 19:01
  • What's the web framework? Web Forms or MVC? – Cᴏʀʏ Nov 01 '12 at 19:17
  • Did you check the event viewer? may be more info there – Amitd Nov 01 '12 at 19:20
  • Also check this question http://stackoverflow.com/questions/5946618/asp-net-cann-not-access-to-windows-temp-folder and clearing out asp.net temp files http://blogs.msdn.com/b/dougste/archive/2008/08/11/clearing-out-temporary-asp-net-files.aspx – Amitd Nov 01 '12 at 19:23
  • Related, but no good solution: http://stackoverflow.com/q/7723192/74757 – Cᴏʀʏ Nov 01 '12 at 19:23

1 Answers1

1

I can't tell you the EXACT cause in your case but in my experience those temp files seem to not be updated correctly sometimes.

With each build new random names are generated, hence the funny "f0ihyyu5.3" part of the name. I believe some of these files get "left over" in the temp folder (can't be deleted) when they should have been deleted from your publish / refresh / reload, causing conflicts for a page.

The best resolution for me was to compile into a single assembly. Then you will also know exactly what dll name should be in the folder.

How to precompile ASP.NET 4.0 to a Single DLL with VS 2010

I know this is not a great technical answer for you, but I have lived through this more than once. Save yourself the pain and just compile into a single dll.

Community
  • 1
  • 1
Joe
  • 1,649
  • 12
  • 10