Summary
2sxc HotBuild feature only allowing unregistered users to compile app code if an initial code compilation has been triggered by a registered user. Otherwise an error is thrown.
Description
I have a 2sxc app with views that rely on 2sxc's HotBuild feature. When I am logged in to DNN (with or without admin permissions), and I visit a page with this app, HotBuild compiles the app code successfully. If I make a change to the code and open the page in another browser without logging in, HotBuild also compiles the app code successfully. In other words, the app code compiles for both registered and unregistered users.
However, the next day, once my login has expired, when I try to view the same app on the same page as an unregistered user, the following error is logged to the 2sxc Insights:
Depth 1 in mscorlib: System.UnauthorizedAccessException: Access to the path 'C:\WINDOWS\TEMP\fcty3lxt\fcty3lxt.tmp' is denied. at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost) at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access) at System.CodeDom.Compiler.TempFileCollection.EnsureTempNameCreated() at System.CodeDom.Compiler.TempFileCollection.AddExtension(String fileExtension, Boolean keepFile) at Microsoft.CodeDom.Providers.DotNetCompilerPlatform.Compiler.FromFileBatch(CompilerParameters options, String[] fileNames) at Microsoft.CodeDom.Providers.DotNetCompilerPlatform.Compiler.CompileAssemblyFromFileBatch(CompilerParameters options, String[] fileNames) at ToSic.Sxc.Code.AppCodeCompilerNetFull.GetCompiledAssemblyFromFolder(String[] sourceFiles, String assemblyFilePath) in C:\Projects\2sxc\2sxc\Src\Dnn\ToSic.Sxc.Dnn.Core\Dnn\Compile\AppCodeCompilerNetFull.cs:line 109 at ToSic.Sxc.Code.AppCodeCompilerNetFull.GetAppCode(String relativePath, HotBuildSpec spec) in C:\Projects\2sxc\2sxc\Src\Dnn\ToSic.Sxc.Dnn.Core\Dnn\Compile\AppCodeCompilerNetFull.cs:line 46
When I log back in to the site (as a regular user or an admin), the code compiles and the error is resolved. In other words, the app does not compile for unregistered users until after a registered user triggers a code compilation.
This behavior also occurs when the site is restarted (DNN Settings \ Servers \ Restart Application). The app code does not compile until a registered user triggers the compilation.
EDIT: The names of the sub-directory and .tmp file within *C:\WINDOWS\TEMP* vary with each compilation.
Failed attempts to resolve the issue include,
EDIT:
System versions 2sxc: 17.10.00 DNN: 9.11.00
Upgrading to 2sxc v18 resolved the issue as recommended in the following GitHub issue: https://github.com/2sic/2sxc/issues/3583