I'm seeing this in a 5.2.3 install on 64 bit windons 2003 using plesk.
I've also seen it in my development environment while running debug (5.2.1 I think) - the problem is that there is no portalSettings context when the schedule thread executes. I would expect this to be the case when a scheduled event is running on timer mode rather that request mode. ON timer mode there is no portalSettings object to use.
It's in the 'FileProvider.vb' file, about line 77 :
Private Shared Function GetCacheFolder() As String
Dim cacheFolder As String = String.Concat(PortalController.GetCurrentPortalSettings.HomeDirectoryMapPath, "\Cache\Modules\")
If Not Directory.Exists(cacheFolder) Then
Directory.CreateDirectory(cacheFolder)
End If
Return cacheFolder
End Function
The simple solution / workaround is to do a check for a valid portalSettings object before trying to get the homedirectorymappath. If it's not valid, some other method will have to be used to determine the current home directory for the portal, or just skip the caching step. You can get the home directory of the portal with this code:
PortalInfo portal = pc.GetPortal(portalId);
DotNetNuke.Common.Globals.ApplicationPath + "/" + portal.HomeDirectory + "/";
However, eagle-eyed readers will note that you can't easily tell which portal you're using when there is no context to set it in. In other words - in the absence of a request with a domain in it, how do you know which portal to use? The answer is that the scheduled item must specify the portal id in some way. I suspect this might be getting a bit complicated in some cases, or at the very least the GetCacheFolder might need an overload to accept the portalId.
Creating the directory doesn't fix the problem because that's not what the error is. The error is that PortalController.GetCurrentPortalSettings is null when a scheduled event runs on timer mode, and not on request mode. That's my theory anyway - I haven't fully tested it - been too busy with other issues.
Note: this blog post might make for enlightening reading on the subject
http://www.ifinity.com.au/Blog/EntryI...
(edits : added code and Url to blog post)