Scenario in our Sitecore 8.1 instance is that, we have a .NET
FileSystemWatcher object that is initialized in
global.asax. When a file is dropped in the watched folder, callback code interacts with Sitecore and at some point, attempts to add a new item version (via
Item.Versions.AddVersion). At this point, a
NullReferenceException is raised and we've traced this to a custom
LinkProvider code that uses
Context.Site, that turned out to be the null reference.
Is this expected behavior? Any suggestions, how we can work around this issue?