Squirrel.Windows icon indicating copy to clipboard operation
Squirrel.Windows copied to clipboard

Couldn't write out staging user ID

Open tobloef opened this issue 10 years ago • 30 comments

Hello. I've gone through the Getting Started guide and the setup and application works great on my own computer, but whenever I try it on someone else's computer (or in this case a VM) the Setup.exe will briefly run and then crash. It manages to do a few things, like creating the desktop icon and so on, but when I look at the log I get this error:

2016-05-18 20:51:53> CheckForUpdateImpl: Couldn't write out staging user ID, this user probably shouldn't get beta anything: System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\Users\Test User\AppData\Local\MyProject\packages.betaId'. 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, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost) at System.IO.StreamWriter.CreateFile(String path, Boolean append, Boolean checkHost) at System.IO.StreamWriter..ctor(String path, Boolean append, Encoding encoding, Int32 bufferSize, Boolean checkHost) at System.IO.File.InternalWriteAllText(String path, String contents, Encoding encoding, Boolean checkHost) at System.IO.File.WriteAllText(String path, String contents, Encoding encoding) at Squirrel.UpdateManager.CheckForUpdateImpl.getOrCreateStagedUserId() 2016-05-18 20:51:53> CheckForUpdateImpl: Failed to load local releases, starting from scratch: System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\Users\Test User\AppData\Local\MyProject\packages\RELEASES'. 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, FileShare share) at Squirrel.Utility.LoadLocalReleases(String localReleaseFile) at Squirrel.UpdateManager.CheckForUpdateImpl.d__3f.MoveNext() 2016-05-18 20:51:53> CheckForUpdateImpl: Reading RELEASES file from C:\Users\Test User\AppData\Local\SquirrelTemp 2016-05-18 20:51:53> CheckForUpdateImpl: First run or local directory is corrupt, starting from scratch

If anyone could tell me what this error means and possibly how I can fix it, I would very much appreciate it.

tobloef avatar May 18 '16 19:05 tobloef

@TobLoef The staging message is just a warning, but in general it's a canary that this user's LocalAppData folder can't be written to, which is the Nr. 1 cause that Squirrel fails

anaisbetts avatar May 18 '16 19:05 anaisbetts

@paulcbetts Ah, good to know. It appears that the folder in the LocalAppData folder is getting created and contains a lot of files, so it seems to be working. Since nothing happens after Setup.exe is done and I cannot launch the application, this is then likely to be a bug in my own code, right? If that's the case, sorry for wasting your time, I just noticed the stacktrace and thought that could be the reason.

tobloef avatar May 18 '16 19:05 tobloef

Maybe? If you share the whole log we can tell

anaisbetts avatar May 18 '16 21:05 anaisbetts

I'll just close the issue for now. Maybe I'll reopen it, but for now I'll just assume that my own code is at fault.

tobloef avatar May 20 '16 08:05 tobloef

@paulcbetts I am getting a similar issue regarding this.

2016-05-22 23:34:33> CheckForUpdateImpl: Failed to load local releases, starting from scratch: System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\Users\patod\AppData\Local\electron-app\packages\RELEASES'.

2016-05-22 23:34:45> IEnableLogger: Failed to install package to app dir: System.AggregateException: One or more errors occurred. ---> System.IO.IOException: Access to the path 'resources' is denied.

Also I am unable to replicate this issue in any other system. I have tried it on 3 more windows 10 systems with admin / non admin accounts its working for them. Any idea what's going wrong here?

Target platform: Windows 10 64bit

Build Platform: Windows 8.1 64bit

Full log:

2016-05-22 23:34:33> Program: Starting Squirrel Updater: --install .
2016-05-22 23:34:33> Program: Starting install, writing to C:\Users\patod\AppData\Local\SquirrelTemp
2016-05-22 23:34:33> Program: About to install to: C:\Users\patod\AppData\Local\electron-app
2016-05-22 23:34:33> CheckForUpdateImpl: Couldn't write out staging user ID, this user probably shouldn't get beta anything: System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\Users\patod\AppData\Local\electron-app\packages\.betaId'.
   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, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
   at System.IO.StreamWriter.CreateFile(String path, Boolean append, Boolean checkHost)
   at System.IO.StreamWriter..ctor(String path, Boolean append, Encoding encoding, Int32 bufferSize, Boolean checkHost)
   at System.IO.File.InternalWriteAllText(String path, String contents, Encoding encoding, Boolean checkHost)
   at System.IO.File.WriteAllText(String path, String contents, Encoding encoding)
   at Squirrel.UpdateManager.CheckForUpdateImpl.getOrCreateStagedUserId()
2016-05-22 23:34:33> CheckForUpdateImpl: Failed to load local releases, starting from scratch: System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\Users\patod\AppData\Local\electron-app\packages\RELEASES'.
   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, FileShare share)
   at Squirrel.Utility.LoadLocalReleases(String localReleaseFile)
   at Squirrel.UpdateManager.CheckForUpdateImpl.<CheckForUpdate>d__3f.MoveNext()
2016-05-22 23:34:33> CheckForUpdateImpl: Reading RELEASES file from C:\Users\patod\AppData\Local\SquirrelTemp
2016-05-22 23:34:33> CheckForUpdateImpl: First run or local directory is corrupt, starting from scratch
2016-05-22 23:34:33> ApplyReleasesImpl: Writing files to app directory: C:\Users\patod\AppData\Local\electron-app\app-0.5.12
2016-05-22 23:34:45> IEnableLogger: Failed to install package to app dir: System.AggregateException: One or more errors occurred. ---> System.IO.IOException: Access to the path 'resources' is denied.
   at System.IO.DirectoryInfo.MoveTo(String destDirName)
   at Squirrel.UpdateManager.ApplyReleasesImpl.<>c__DisplayClassaf.<>c__DisplayClassb3.<>c__DisplayClassb5.<installPackageToAppDir>b__ad(DirectoryInfo subdir)
   at Squirrel.Utility.<>c__DisplayClass18`1.<>c__DisplayClass1a.<ForEachAsync>b__17()
   at System.Threading.Tasks.Task.InnerInvoke()
   at System.Threading.Tasks.Task.Execute()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Squirrel.Utility.<>c__DisplayClass1e`1.<>c__DisplayClass20.<<ForEachAsync>b__1d>d__22.MoveNext()
   --- End of inner exception stack trace ---
   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
   at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
   at Squirrel.UpdateManager.ApplyReleasesImpl.<>c__DisplayClassaf.<>c__DisplayClassb3.<installPackageToAppDir>b__ac(DirectoryInfo ld)
   at Squirrel.EnumerableExtensions.ForEach[TSource](IEnumerable`1 source, Action`1 onNext)
   at Squirrel.UpdateManager.ApplyReleasesImpl.<>c__DisplayClassaf.<<installPackageToAppDir>b__a9>d__b7.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Squirrel.Utility.<LogIfThrows>d__50`1.MoveNext()
---> (Inner Exception #0) System.IO.IOException: Access to the path 'resources' is denied.
   at System.IO.DirectoryInfo.MoveTo(String destDirName)
   at Squirrel.UpdateManager.ApplyReleasesImpl.<>c__DisplayClassaf.<>c__DisplayClassb3.<>c__DisplayClassb5.<installPackageToAppDir>b__ad(DirectoryInfo subdir)
   at Squirrel.Utility.<>c__DisplayClass18`1.<>c__DisplayClass1a.<ForEachAsync>b__17()
   at System.Threading.Tasks.Task.InnerInvoke()
   at System.Threading.Tasks.Task.Execute()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Squirrel.Utility.<>c__DisplayClass1e`1.<>c__DisplayClass20.<<ForEachAsync>b__1d>d__22.MoveNext()<---

2016-05-22 23:34:45> Unhandled exception: System.AggregateException: One or more errors occurred. ---> System.AggregateException: One or more errors occurred. ---> System.IO.IOException: Access to the path 'resources' is denied.
   at System.IO.DirectoryInfo.MoveTo(String destDirName)
   at Squirrel.UpdateManager.ApplyReleasesImpl.<>c__DisplayClassaf.<>c__DisplayClassb3.<>c__DisplayClassb5.<installPackageToAppDir>b__ad(DirectoryInfo subdir)
   at Squirrel.Utility.<>c__DisplayClass18`1.<>c__DisplayClass1a.<ForEachAsync>b__17()
   at System.Threading.Tasks.Task.InnerInvoke()
   at System.Threading.Tasks.Task.Execute()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Squirrel.Utility.<>c__DisplayClass1e`1.<>c__DisplayClass20.<<ForEachAsync>b__1d>d__22.MoveNext()
   --- End of inner exception stack trace ---
   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
   at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
   at Squirrel.UpdateManager.ApplyReleasesImpl.<>c__DisplayClassaf.<>c__DisplayClassb3.<installPackageToAppDir>b__ac(DirectoryInfo ld)
   at Squirrel.EnumerableExtensions.ForEach[TSource](IEnumerable`1 source, Action`1 onNext)
   at Squirrel.UpdateManager.ApplyReleasesImpl.<>c__DisplayClassaf.<<installPackageToAppDir>b__a9>d__b7.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Squirrel.Utility.<LogIfThrows>d__50`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
   at Squirrel.UpdateManager.ApplyReleasesImpl.<ApplyReleases>d__7b.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Squirrel.UpdateManager.<FullInstall>d__f.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
   at Squirrel.Update.Program.<Install>d__38.MoveNext()
   --- End of inner exception stack trace ---
   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
   at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
   at System.Threading.Tasks.Task.Wait()
   at Squirrel.Update.Program.executeCommandLine(String[] args)
   at Squirrel.Update.Program.main(String[] args)
---> (Inner Exception #0) System.AggregateException: One or more errors occurred. ---> System.IO.IOException: Access to the path 'resources' is denied.
   at System.IO.DirectoryInfo.MoveTo(String destDirName)
   at Squirrel.UpdateManager.ApplyReleasesImpl.<>c__DisplayClassaf.<>c__DisplayClassb3.<>c__DisplayClassb5.<installPackageToAppDir>b__ad(DirectoryInfo subdir)
   at Squirrel.Utility.<>c__DisplayClass18`1.<>c__DisplayClass1a.<ForEachAsync>b__17()
   at System.Threading.Tasks.Task.InnerInvoke()
   at System.Threading.Tasks.Task.Execute()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Squirrel.Utility.<>c__DisplayClass1e`1.<>c__DisplayClass20.<<ForEachAsync>b__1d>d__22.MoveNext()
   --- End of inner exception stack trace ---
   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
   at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
   at Squirrel.UpdateManager.ApplyReleasesImpl.<>c__DisplayClassaf.<>c__DisplayClassb3.<installPackageToAppDir>b__ac(DirectoryInfo ld)
   at Squirrel.EnumerableExtensions.ForEach[TSource](IEnumerable`1 source, Action`1 onNext)
   at Squirrel.UpdateManager.ApplyReleasesImpl.<>c__DisplayClassaf.<<installPackageToAppDir>b__a9>d__b7.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Squirrel.Utility.<LogIfThrows>d__50`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
   at Squirrel.UpdateManager.ApplyReleasesImpl.<ApplyReleases>d__7b.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Squirrel.UpdateManager.<FullInstall>d__f.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
   at Squirrel.Update.Program.<Install>d__38.MoveNext()
---> (Inner Exception #0) System.IO.IOException: Access to the path 'resources' is denied.
   at System.IO.DirectoryInfo.MoveTo(String destDirName)
   at Squirrel.UpdateManager.ApplyReleasesImpl.<>c__DisplayClassaf.<>c__DisplayClassb3.<>c__DisplayClassb5.<installPackageToAppDir>b__ad(DirectoryInfo subdir)
   at Squirrel.Utility.<>c__DisplayClass18`1.<>c__DisplayClass1a.<ForEachAsync>b__17()
   at System.Threading.Tasks.Task.InnerInvoke()
   at System.Threading.Tasks.Task.Execute()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Squirrel.Utility.<>c__DisplayClass1e`1.<>c__DisplayClass20.<<ForEachAsync>b__1d>d__22.MoveNext()<---
<---

vasumahesh1 avatar May 24 '16 05:05 vasumahesh1

Any help here? Can we re-open this issue?

shoaibmerchant avatar May 31 '16 06:05 shoaibmerchant

I have been seeing the same issue when installing an app on a PC that has antivirus scan enabled, and I think I have an explanation for the problem: In the process of unpacking the .nupkg, the contents of the dircetory under lib\net45 is moved up to the package directory. Now, if the virus scan is still scanning files and has some of the files under that directory open, the move fails (hence the System.IO.IOException: Access to the path 'resources' is denied error). My guess is that this conflict may happen for other reasons, but I have seen it with an antivirus (and I have been able to reproduce it by manually openning some of the files in teh directory to be moved) I have implemented a 'fix': retrying the move operations after sleeping for a short time. (Of course, setting a max on the number of retrials...) The fix is working for me. Let me know if you want a pull request....

albertsuchvi avatar Jun 14 '16 14:06 albertsuchvi

@albertsuchvi Interesting, I'd actually rather just rig the unzip target paths, but can you show me your change anyways?

anaisbetts avatar Jun 14 '16 17:06 anaisbetts

@albertsuchvi @paulcbetts Confirmed. I disabled the Antivirus (McAfee) and the extract worked like a charm.

vasumahesh1 avatar Jun 16 '16 10:06 vasumahesh1

Same issue here.

voondo avatar Jul 04 '16 07:07 voondo

@albertsuchvi can you push the fix to a fork?

shoaibmerchant avatar Jul 06 '16 12:07 shoaibmerchant

.@shoaibmerchant , I've been out of office for a few days, I need to do some other stuff and the reveiw the changes. In a couple of days I will be bale to push iy

albertsuchvi avatar Jul 11 '16 14:07 albertsuchvi

Alright thanks!

shoaibmerchant avatar Jul 12 '16 08:07 shoaibmerchant

This happens for me too (trying to install Slack); it's only because my work laptop came with the POS McAffee; uninstalled it and just deferring to Windows Defender solved it, so yeah, it does look like it's probably an I/O issue where the virus scanner jumps on the files.

ckpearson avatar Aug 03 '16 10:08 ckpearson

This is currently closed, but it doesn't look like the core issue was addressed. Can we at least get a link to the workaround? Many of our users are on corporate networks and can't disable their virus protection without admin interventions. This defeats one of the purposes of using electron. Looks like there is just a delay in reading the directory needed?

skilesare avatar Oct 11 '16 02:10 skilesare

There's no workaround for antivirus, other than proper signing

anaisbetts avatar Oct 11 '16 03:10 anaisbetts

@paulcbetts we are facing to the same problem although the binaries are properly signed

voondo avatar Oct 11 '16 07:10 voondo

@paulcbetts I'm speaking about this:

"In the process of unpacking the .nupkg, the contents of the dircetory under lib\net45 is moved up to the package directory. Now, if the virus scan is still scanning files and has some of the files under that directory open, the move fails (hence the System.IO.IOException: Access to the path 'resources' is denied error). My guess is that this conflict may happen for other reasons, but I have seen it with an antivirus (and I have been able to reproduce it by manually opening some of the files in teh directory to be moved) I have implemented a 'fix': retrying the move operations after sleeping for a short time. (Of course, setting a max on the number of retrials...) The fix is working for me. Let me know if you want a pull request...."

Digital signing probably wouldn't fix this issue if the issue is that the virus protector has locked some files.

cc @albertsuchvi

skilesare avatar Oct 11 '16 13:10 skilesare

"In the process of unpacking the .nupkg, the contents of the dircetory under lib\net45 is moved up to the package directory. Now, if the virus scan is still scanning files and has some of the files under that directory open, the move fails

Ah, I fixed this awhile ago by eliminating the move altogether

anaisbetts avatar Oct 11 '16 15:10 anaisbetts

Ahh...ok...I'll update to the latest version and see if it goes away.

skilesare avatar Oct 11 '16 15:10 skilesare