Source Tree failing to install and run
Asked by petestarkeyltd:

Hi,

I had previously been running Source Tree for years. When the v2 installer came up, I installed it, and left v1.9 on my machine. It worked for a while, but now for no obvious reason, neither version will run.

I uninstalled both and tried a fresh install of both versions. Neither have worked. The v2 installer just errors on install and produces logs. v1.9 goes through the wizard, installs, but errors when I run it. I have tried deleting prefs files, repairing .net installations, using ccleaner and all other suggestions, but to no avail.

I'm on Win7 Pro 64.

When I try to launch v2 (although it says it failed to install, there is a shortcut in my start menu that appears to try to laumch something), I get these errors in Event Viewer:

```
Update.exe_Update    1.4.3.0    57ab6f1a    KERNELBASE.dll    6.1.7601.23807    5915f98e    e0434352    0000c54f    189c    01d2f1d36628a036    C:\Users\Pete\AppData\Local\SquirrelTemp\Update.exe    C:\Windows\syswow64\KERNELBASE.dll    a7063b56-5dc6-11e7-a4ff-74d02b93217d 
```

and:

```
?Application: Update.exe Framework Version: v4.0.30319 Description: The process was terminated due to an unhandled exception. Exception Info: System.Runtime.InteropServices.COMException at MS.Win32.Penimc.UnsafeNativeMethods.CoCreateInstance(System.Guid ByRef, System.Object, Int32, System.Guid ByRef) at MS.Win32.Penimc.UnsafeNativeMethods.CreatePimcManager() at MS.Win32.Penimc.UnsafeNativeMethods..cctor() Exception Info: System.TypeInitializationException at MS.Win32.Penimc.UnsafeNativeMethods.CreateResetEvent(IntPtr ByRef) at System.Windows.Input.PenThreadWorker..ctor() at System.Windows.Input.PenThreadPool.GetPenThreadForPenContextHelper(System.Windows.Input.PenContext) at System.Windows.Input.PenThreadPool.GetPenThreadForPenContext(System.Windows.Input.PenContext) at System.Windows.Input.StylusWisp.WispTabletDeviceCollection.UpdateTabletsImpl() at System.Windows.Input.StylusWisp.WispTabletDeviceCollection.UpdateTablets() at System.Windows.Input.StylusWisp.WispTabletDeviceCollection..ctor() at System.Windows.Input.StylusWisp.WispLogic.get_WispTabletDevices() at System.Windows.Input.StylusWisp.WispLogic.RegisterHwndForInput(System.Windows.Input.InputManager, System.Windows.PresentationSource) at System.Windows.Interop.HwndStylusInputProvider..ctor(System.Windows.Interop.HwndSource) at System.Windows.Interop.HwndSource.Initialize(System.Windows.Interop.HwndSourceParameters) at System.Windows.Window.CreateSourceWindow(Boolean) at System.Windows.Window.CreateSourceWindowDuringShow() at System.Windows.Window.SafeCreateWindowDuringShow() at System.Windows.Window.ShowHelper(System.Object) at System.Windows.Window.Show() at Squirrel.Update.AnimatedGifWindow+<>c__DisplayClass1_0.<ShowWindow>b__0() at System.Threading.ThreadHelper.ThreadStart_Context(System.Object) at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean) at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean) at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object) at System.Threading.ThreadHelper.ThreadStart()
```

Squirrel.log says:

```
2017-06-30 20:12:51> Program: Starting Squirrel Updater: --install .2017-06-30 20:12:51> Program: Starting install, writing to C:\Users\Pete\AppData\Local\SquirrelTemp2017-06-30 20:12:51> Program: About to install to: C:\Users\Pete\AppData\Local\SourceTree2017-06-30 20:12:51> 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\Pete\AppData\Local\SourceTree\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()2017-06-30 20:12:51> CheckForUpdateImpl: Failed to load local releases, starting from scratch: System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\Users\Pete\AppData\Local\SourceTree\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__2.MoveNext()2017-06-30 20:12:51> CheckForUpdateImpl: Reading RELEASES file from C:\Users\Pete\AppData\Local\SquirrelTemp2017-06-30 20:12:51> CheckForUpdateImpl: First run or local directory is corrupt, starting from scratch2017-06-30 20:12:51> ApplyReleasesImpl: Writing files to app directory: C:\Users\Pete\AppData\Local\SourceTree\app-2.1.2.52017-06-30 20:12:52> ApplyReleasesImpl: Squirrel Enabled Apps: []2017-06-30 20:12:52> ApplyReleasesImpl: No apps are marked as Squirrel-aware! Going to run them all2017-06-30 20:12:52> ApplyReleasesImpl: About to create shortcuts for SourceTree.exe, rootAppDir C:\Users\Pete\AppData\Local\SourceTree2017-06-30 20:12:52> ApplyReleasesImpl: Creating shortcut for SourceTree.exe => C:\Users\Pete\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Atlassian\SourceTree.lnk2017-06-30 20:12:52> ApplyReleasesImpl: About to save shortcut: C:\Users\Pete\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Atlassian\SourceTree.lnk (target C:\Users\Pete\AppData\Local\SourceTree\Update.exe, workingDir C:\Users\Pete\AppData\Local\SourceTree\app-2.1.2.5, args --processStart "SourceTree.exe")2017-06-30 20:12:53> ApplyReleasesImpl: Creating shortcut for SourceTree.exe => C:\Users\Pete\Desktop\SourceTree.lnk2017-06-30 20:12:53> ApplyReleasesImpl: About to save shortcut: C:\Users\Pete\Desktop\SourceTree.lnk (target C:\Users\Pete\AppData\Local\SourceTree\Update.exe, workingDir C:\Users\Pete\AppData\Local\SourceTree\app-2.1.2.5, args --processStart "SourceTree.exe")2017-06-30 20:12:53> ApplyReleasesImpl: Examining Pin: Adobe Fireworks CS6.lnk2017-06-30 20:12:53> ApplyReleasesImpl: Examining Pin: Google Chrome.lnk2017-06-30 20:12:53> ApplyReleasesImpl: Examining Pin: Windows Explorer.lnk2017-06-30 20:12:53> ApplyReleasesImpl: Starting fixPinnedExecutables2017-06-30 20:12:53> ApplyReleasesImpl: Examining Pin: Adobe Fireworks CS6.lnk2017-06-30 20:12:53> ApplyReleasesImpl: Examining Pin: Google Chrome.lnk2017-06-30 20:12:53> ApplyReleasesImpl: Examining Pin: Windows Explorer.lnk2017-06-30 20:12:53> ApplyReleasesImpl: Fixing up tray icons2017-06-30 20:12:53> ApplyReleasesImpl: cleanDeadVersions: for version 2.1.2.52017-06-30 20:12:53> ApplyReleasesImpl: cleanDeadVersions: exclude folder app-2.1.2.5
```

Any ideas anyone? I've wasted hours on this! Thanks.


Answers:
author: petestarkeyltd
body: Fixed! I uninstalled .net framework 4.7, then ran windows update to reinstall the recommended .net components (but NOT 4.7), and now Source Tree v2 works.

Seems other people have had this problem <https://community.atlassian.com/t5/SourceTree-questions/Can-t-re-install-SourceTree/qaq-p/598270>

comments: author: heszar
body: yeah thats a great solution uninstall your new .Net  
Better uninstall SourceTree than install gitkraken.


author: jbolinics
body: Looks like this is an old thread, but this issue comes back in Windows 10. Unfortunately, uninstalling .NET is not an option with Windows 10.

comments: author: jbolinics
body: Just to close the loop, the only solution that worked was a complete reimage/rebuild of Windows 10. We attempted to rebuild the user profiles (gave the appearance initially that was the issue), but that failed to fix.


author: Ariel Odiz
body: Hi, I'm having the same problem but I already have de .net framework 4.7 and the issue persists. Any ideas?

comments: author: petestarkeyltd
body: Hi Ariel, try **uninstalling** .net 4.7 - this worked for me! Good luck.


author: heszar
body: I see this is open since July, they dont want to fix this problem, then I keep away from Atlassian.