Smidge icon indicating copy to clipboard operation
Smidge copied to clipboard

NullReferenceException in ValidateFile

Open Rockerby opened this issue 2 years ago • 4 comments

We had an issue this morning where our site stopped working with a NullReferenceException in the ValidateFile function. It was running yesterday and there have been no code / file changes since then (also no server updates or restarts). The ValidateFile function is pretty small so assuming that the file that it's passing in along the way is null. The bundle in question is a CSS bundle.

My gut is telling me this is something to do with the application pool going idle as a restart fixes the issue. Relevant stack trace extract below:

System.NullReferenceException: Object reference not set to an instance of an object.
   at Smidge.BundleFileSetGenerator.ValidateFile(IWebFile file)
   at Smidge.BundleFileSetGenerator.GetOrderedFileSet(IEnumerable`1 files, PreProcessPipeline pipeline)
   at Smidge.BundleFileSetGenerator.GetOrderedFileSet(Bundle bundle, PreProcessPipeline pipeline)
   at Smidge.SmidgeHelper.GenerateBundleUrlsAsync(String bundleName, String fileExt, Boolean debug)
   at Smidge.TagHelpers.SmidgeLinkTagHelper.ProcessAsync(TagHelperContext context, TagHelperOutput output)
   at Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperRunner.<RunAsync>g__Awaited|0_0(Task task, TagHelperExecutionContext executionContext, Int32 i, Int32 count)

For reference, this is an Umbraco 9.5.0 site (.NET 5), running Smidge 4.0.3 hosted on Windows Server 2019, IIS 10.

Rockerby avatar May 26 '22 08:05 Rockerby

I have the same issue with the exact same conditions. It happened to 2 different websites so far. We might also need to report this to the Umbraco git repo so they can also look in to it.

nikro412956 avatar Jul 26 '22 08:07 nikro412956

@Rockerby What cache buster are you using? I am using the Timestamp cache buster. So i am curious which one you are using and if using the other cache buster can prevent this problem from occurring.

nikro412956 avatar Jul 26 '22 08:07 nikro412956

Hey @nikro412956 - this was using the Version cache buster type. I couldn't replicate this on a dev machine; purely on a live/staging environment.

Rockerby avatar Jul 26 '22 14:07 Rockerby

Yes, we got the same issue in production.

A couple of days ago the Igloo css-bundle returned 500 with the same exception. It was resoved after a restart. Now the js-bundle got the same issue.

The site is using Version-cachebuster and I have disabled Smidge MemoryCache for now to se if it helps.

Umbraco 10.5.1 + Smdige 4.5 Windows server

madsoulswe avatar Jan 31 '24 09:01 madsoulswe