SourceTree failed to start
Asked by Keith Olson:

Please help!

On Windows 10, SourceTree wasn't opening anymore, so I removed the software and deleted the Atlassian folder in my users/AppData/Local folder, then downloaded and reinstalled SourceTree v.2.3.1.0. Same problem.

I found the sourcetree.log file, and this is what it contains:

ERROR \[2017-09-19 09:28:53,181\] \[1\] \[SourceTree.App\] \[.ctor\] - finish EnsureSquirrelExecutionStubIsCopied  
ERROR \[2017-09-19 09:28:53,306\] \[1\] \[SourceTree.App\] \[OnStartup\] - Failed to start  
System.NullReferenceException: Object reference not set to an instance of an object.  
at SourceTree.Notifications.NotificationsManager.SetOwner(NotificationDialogWindow notificationWindow)  
at SourceTree.Notifications.NotificationsManager.ShowNotificationDialog\[T\](NotificationDialogWindow notificationWindow, Tuple\`2 customAction, VistaTaskDialogIcon icon)  
at SourceTree.Notifications.NotificationsManager.ShowNotificationDialog\[T\](String title, String message, Tuple\`2 customAction, String cancelLabel, String suppressionSetting, Action\`1 suppressionChangedAction, Object contentControl, String contentCommandLabel, Action contentAction)  
at SourceTree.Notifications.NotificationsManager.ShowNotificationDialogWithYesConfirmation(String title, String message, String details)  
at SourceTree.Configuration.WpfSpellCheckerPreFlightCheck.Run()  
at SourceTree.AppRoot.RunPreFlightChecks()  
at SourceTree.AppRoot.OnStartup(StartupEventArgs e)  
at SourceTree.App.OnStartup(StartupEventArgs e)


Answers:
author: Mike Corsaro
body: Hello! This is a known issue. Please navigate to the config file location (C:\\Users\\{USERNAME}\\AppData\\Local\\Atlassian\\SourceTree.exe_{RANDOM_GUID}\\2.3.1.0\\user.config) and find the following line:

```
<setting name="AutomaticallyCleanUpDictionaryFiles" serializeAs="String"> 
     <value>True</value> 
</setting>
```

Make sure that value is set to ***True***

comments: author: monospacesoftware
body: I had to add this setting, as it was not present probably due to reinstalling to try to fix the problem. But adding the setting fixes it. The installer was not even running without this setting.


author: Keith Olson
body: That did it! I'm glad it was a simple as that.

Thanks much!


author: MarconiM
body: Thank god! That was it. Worked instantly after adding the setting and running sourcetree again.


author: Cameron Haddad
body: This worked.

**Can you had this into the installer and make a new version ASAP**. Its really frustrating as there is not UI on the installer (really bad idea) or the application with this error. And lots of threads with installer/load issues. Took me a while to find this.


author: Frank Frank
body: No such line. Plus, I don't really like this way of doing things. Basically, you are asking users to delete something that they don't want to.


author: edozier
body: Frank,

You don't delete it, you add it.


author: Ralph Trickey
body: That worked, although I now need to re-add all my projects since I followed other advice on this forum and deleted the apps folder.

I'm disappointed, it's over a week since it was reported and a fix found, I would have expected a new installer to have already been out that fixed it.


author: FarshanAhamed
body: Thanks, I've been searching for this. And i got fixed.


author: Niklas Rosencrantz
body: Thanks Mike but I can't believe that a mature software has such major problems that it doesn't even start.

Why can't they write working code?


author: Mario Schwarz
body: Took me quite a while to find this after sourcetree just stopped working. Finally fixed it thanks.

This is not easy enough to find for a known issue.


author: Jay Renz Morgado
body: Whoa what a fix. I hope they can have a real fix for these. I almost reinstalled my windows vm.


author: Robert Prom
body: Ran the installer (v2.3.1.0) on Win10 and it seems nothing happened, however, the app was actually installed. When trying to run the app I'd see the sourcetree.exe process for about 5 seconds and then it'd go away. Once I added that setting to the user.config the app worked fine. No reinstall was needed.


author: Ivan Sager
body: Did the job. Thanks!


author: Mike Purrington
body: So, this worked for me. Downloaded a brand new installer this morning and it is STILL not fixed in the installer. I blew away an hour of my time trying to get this thing to load.

I work on a small software team and we frequently have some QC issues like this as well. THIS makes me feel a lot better about my own product and QC processes!


author: matt raffel
body: this did not work for me. when I found the user.config file, I found it was corrupt. parsely formatted XML with jibberish at the end. No idea how it got that way. I copied user.config from a previous folder and then I was able to open SourceTree 2.3.1


author: Thi?u t? Ph?m Xu?n B?ch
body: This didn't work.


author: Ana Retamal
body: Hi everyone! As an update, we've started the progressive rollout of Sourcetree v2.3.5.0 which includes a fix for this issue. You should be prompted to upgrade at some point over the next 14 days or, alternatively, you can download it directly from <https://downloads.atlassian.com/software/sourcetree/windows/ga/SourceTreeSetup-2.3.5.0.exe>

Cheers :)

Ana

comments: author: matt raffel
body: Ana

Can you explain why SourceTree installs in the user appdata folder rather than program files folder like most windows apps? I find this very strange.


author: Frank Frank
body: // SourceTree.Notifications.NotificationsManager  
private static void SetOwner(NotificationDialogWindow notificationWindow)  
{  
Window currentWindow = WindowsOSHelper.GetCurrentWindow();  
Window window = (currentWindow == notificationWindow) ? null : currentWindow;  
if (window != null \&\& window.IsVisible)  
{  
notificationWindow.Owner = window;  
return;  
}  
NotificationsManager.Logger.Error(string.Format("Unable to set owner as parent {0} is not visible", window.Name)); // \<- Problem's here. If windows == null. It's not going to work.  
}

comments: author: Nicolas Frelat
body: Same bug for me. No workaround works.


author: Ian Daintith
body: Amazing. I lost 2 hours today with this.


author: Andy Luff
body: None of the above solutions worked for me. Tried a clean install of 2.3.5 after deleting all %localappdata%. Same error... \[ERROR \[2017-11-08 15:53:23,111\] \[1\] \[SourceTree.App\] \[.ctor\] - finish EnsureSquirrelExecutionStubIsCopied\]

Wasted too many hours on this, now moving to alternative product.

comments: author: colinrobertbrooks
body: I'm in the same doom loop. What did you switch to?


author: hitokun-s
body: I'm in the same situation. I tried many products, but nothing was better than Sourcetree. I hope SourceTree dev team investigate this issue seriously...


author: M
body: OMG! Can you just fix this problem in new version?

For searching solution I'm lost all settings...


author: Philippe RIVAT
body: Merci beaucoup.  
Arr?tez de pleurer alors que vous ne payez m?me pas le logiciel !!!


author: coder_trader
body: It works for me, I added to the file

```
<setting name="AutomaticallyCleanUpDictionaryFiles" serializeAs="String"> 
     <value>True</value> 
</setting>
```


author: Dan Haywood
body: None of the above worked for me, but the solution on this thread [https://community.atlassian.com/t5/Sourcetree-questions/SourceTree-will-no-longer-start/qaq-p/642054#U648488](https://community.atlassian.com/t5/Sourcetree-questions/SourceTree-will-no-longer-start/qaq-p/642054#U648488?) did work.

comments: author: Markus Weser
body: Thanks! Adding this setting solved for me (Win 10 16299.15, SourceTree 2.3.1.0)!


author: Frank Frank
body: Hi [@Nicolas Frelat](/t5/user/viewprofilepage/user-id/1153238),

If you do have the same call stack in you log file, here's the other way to fix the issue:

1. Open RegEdit. Navigate to:

2. Computer\\HKEY_CURRENT_USER\\Software\\Microsoft\\Spelling\\Dictionaries

3. Double click the "_Global_"

4. Check each file and see if they exists.

5. Remove the one that's not there.

6. Hit OK.

7. Start your SourceTree.

There's another solution provided by [@Mike Corsaro](/t5/user/viewprofilepage/user-id/842547) might also be working. However:

1. You might be scared, as I was, by both the popup message or the setting name "Remove the dictionary files" or "Cleanup dictionary files". In fact, it's not going to remove any file but the path of the non-existing file in the registry if you read the source code.

2. You might find that there is no such "AutomaticallyCleanUpDictionaryFiles" in the user.config file on your local machine. And you entered the panic mode because the file is huge and you don't know where would be the right spot to put it in as I did.

Cheers,

Frank

P.S.:

Not sure why they think the missing files will causing the slowness. Maybe it's about the network issue. However, I don't really like the way it is now which confuses users a lot. It should:

1. Measure the time of loading the dictionary files and ask users if they like to not loading these files if it's too slow. Trying to load a missing file on local machine should not be taking too long, especially compared with the time asking user to read the popup and think about why I have to do that. Or,

2. Lazy loading the files asynchronously. It should not be affecting the core feature even if some of the files do not finished loading on time. Or,

3. At least fix the message to not scare the user but tell the truth. It's not cleaning up the files. The files are not corrupted. It's just prevent check and loading the non-existing files only.

comments: author: Nicolas Frelat
body: Hi,

The registry edition tip did the job! After the change, I had some more glitches but now it works.

Thank you.


Tags: windows