Sourcetree is failing to start
Asked by Lawrence Constantino:

1. Open SourceTree

2. Displays flash screen

3. Then nothing

Tried to clear everything (uninstall) and deleted below folders

/AppData/Local/Atlassian/SourceTree

/AppData/Local/SourceTree

then install the latest version (3.4.9) same problem.

Below is the error I've got

ERROR \[2022-08-12 15:32:41,280\] \[1\] \[Sourcetree.Composition.VSMef.Net48.VSMefCompositionManager\] \[Log\] - Unable to load MEF components  
System.IO.FileNotFoundException: Could not load file or assembly 'System.Diagnostics.Tracing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.  
File name: 'System.Diagnostics.Tracing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'  
at System.Threading.Tasks.Dataflow.TransformBlock\`2..ctor(Func\`2 transformSync, Func\`2 transformAsync, ExecutionDataflowBlockOptions dataflowBlockOptions)  
at Microsoft.VisualStudio.Composition.PartDiscovery.CreateDiscoveryBlockChain(Boolean typeExplicitlyRequested, IProgress\`1 progress, CancellationToken cancellationToken)  
at Microsoft.VisualStudio.Composition.PartDiscovery.CreateAssemblyDiscoveryBlockChain(IProgress\`1 progress, CancellationToken cancellationToken)  
at Microsoft.VisualStudio.Composition.PartDiscovery.\<CreatePartsAsync\>d__10.MoveNext()  
--- End of stack trace from previous location where exception was thrown ---  
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()  
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)  
at System.Runtime.CompilerServices.TaskAwaiter\`1.GetResult()  
at Sourcetree.Composition.VSMef.Net48.VSMefCompositionManager.\<Compose\>d__5.MoveNext()

WRN: Assembly binding logging is turned OFF.  
To enable assembly bind failure logging, set the registry value \[HKLM\\Software\\Microsoft\\Fusion!EnableLog\] (DWORD) to 1.  
Note: There is some performance penalty associated with assembly bind failure logging.  
To turn this feature off, remove the registry value \[HKLM\\Software\\Microsoft\\Fusion!EnableLog\].


Answers:
author: rohanatcomet
body: Hi Maged Sallam,

I managed to solve this issue. I realized this issue indeed is dependent on recent windows update messing up WMI classes. I found a post from this issue :

<https://jira.atlassian.com/projects/SRCTREEWIN/issues/SRCTREEWIN-13875?filter=allissues>

which leads to this Article <https://techcommunity.microsoft.com/t5/ask-the-performance-team/wmi-missing-or-failing-wmi-providers-or-invalid-wmi-class/ba-p/375485>

that helped me to resolve the issue.

e.g. In my case, after windows updates, I had error WMI Invalid Class. You can verify this, by :

1. Go to start-run and type in **wmimgmt.msc**
2. Right click on **Local Wmi Control**(Local)and select properties
3. In General Menu, you would see some error WMI Invalid class or namespace if there is any. If there is no errors then you can skip this post completely because then you would have different issue.
4. If the issue is there as described in point 3. For Example, WMI Invalid Class. You can stick with the mentioned Article or follow below steps(which is also from same article explicitly for Error Win32_Processor:WMI Invalid Class and Win32_WMISetting: WMI Invalid Class.
5. Find the Provider it from [www.msdn.com](http://www.msdn.com) i.e. for mentioned example, it is CIMWin32 (Refer : <https://docs.microsoft.com/en-us/windows/win32/cimwin32prov/win32-processor> )

6. Verify if WMI Repo is consistent : Check if the repository is corrupted or not by running following command from command prompt with admin rights: **winmgmt /verifyrepository**

7. If Step 6 is consistent then next, run command, in already opened CMD prompt: cd C:\\Windows\\System32\\Wbem

8. Next Install the Missing Class Provider for mentioned example by running: mofcomp.exe CIMWin32.mof

9. Reregister installed wmi class by running : regsvr32 CIMWin32.dll

10. close **wmimgmt.msc and restart it. In general , now if the error is resolved and then there would not be same error as found in step 3.** **I would of added some snapshots but i could simply not copy paste so please dont mind ;)**

comments: author: Maged Sallam
body: Thanks so much,, this worked for me :)


author: rohanatcomet
body: Deleting this post- Check the other recent answer.


author: Jamie Keen
body: Hi,  

I've had this same issue for the past 2 days and I've managed to fix it. I had to reset the WMI Repository on my PC.

I first uninstalled Sourcetree and removed all traces of it from this location on my PC: C:\\Users\\\*username\*\\AppData\\Local  
That involved backing up and removing the Soucretree folder and the Atlassian folder

Then I reset the WMI repo

These instructions on how to reset it are from Blizzard support:

1. Right-click on **Command Prompt** and select **Run as Administrator**
2. Type **net stop winmgmt** into the command prompt and press enter.
3. When prompted if you wish to continue, type **Y** and press enter.
4. Type **winmgmt /resetrepository** into the command prompt and press enter.
5. Restart your computer to pick up the changes

Hope this helps!

comments: author: rohanatcomet
body: Hi Jamie Keen,

I have been having the exactly same issue as described by initial statement of this issue since today morning.

I tried all steps in suggested manner by you but it did not work.

After step 5. Restarting PC, when i tried to install source tree, same issue occurs: source tree banner flashes for couple of seconds and then nothing.

Here is the details of error on win10 eventviewer :

Application: SourceTree.exe  
Framework Version: v4.0.30319  
Description: The process was terminated due to an unhandled exception.  
Exception Info: System.Management.ManagementException  
at System.Management.ManagementException.ThrowWithExtendedInfo(System.Management.ManagementStatus)  
at System.Management.ManagementObjectCollection+ManagementObjectEnumerator.MoveNext()  
at SourceTree.Utils.WindowsOSHelper.GetWindowsVersion()  
at SourceTree.App..ctor()  
at SourceTree.App.Main()


author: Maged Sallam
body: I have the same issue, and tried Jamies solution it didnt work, it seems that more people have this issue,

I will be waiting to see more answers