Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Sourcetree won't load

Will Koegelenberg May 8, 2019

I've been using SourceTree for months and this morning it won't load. The splash screen comes up and the disappears. I checked the log and the following error was logged with every attempt at launching it:

ERROR [2019-05-09 09:17:39,903] [1] [Sourcetree.Composition.VSMef.Net471.VSMefCompositionManager] [Log] - Unable to load MEF components
System.InvalidOperationException: Sequence contains no elements
at System.Linq.Enumerable.First[TSource](IEnumerable`1 source)
at Microsoft.VisualStudio.Composition.PartDiscovery.GetElementTypeFromMany(Type type)
at Microsoft.VisualStudio.Composition.RuntimeComposition.RuntimeImport.get_ImportingSiteTypeWithoutCollection()
at Microsoft.VisualStudio.Composition.RuntimeComposition.RuntimeImport.get_IsLazy()
at Microsoft.VisualStudio.Composition.RuntimeComposition.RuntimeImport.get_LazyFactory()
at Microsoft.VisualStudio.Composition.RuntimeExportProviderFactory.RuntimeExportProvider.GetValueForImportSite(RuntimePartLifecycleTracker importingPartTracker, RuntimeImport import)
at Microsoft.VisualStudio.Composition.RuntimeExportProviderFactory.RuntimeExportProvider.RuntimePartLifecycleTracker.SatisfyImports()
at Microsoft.VisualStudio.Composition.ExportProvider.PartLifecycleTracker.SatisfyImmediateImports()
at Microsoft.VisualStudio.Composition.ExportProvider.PartLifecycleTracker.MoveNext(PartLifecycleState nextState)
at Microsoft.VisualStudio.Composition.ExportProvider.PartLifecycleTracker.MoveToState(PartLifecycleState requiredState)
at Microsoft.VisualStudio.Composition.ExportProvider.PartLifecycleTracker.GetValueReadyToExpose()
at Microsoft.VisualStudio.Composition.RuntimeExportProviderFactory.RuntimeExportProvider.<>c__DisplayClass15_0.<GetExportedValueHelper>b__0()
at Microsoft.VisualStudio.Composition.RuntimeExportProviderFactory.RuntimeExportProvider.GetValueForImportElement(RuntimePartLifecycleTracker importingPartTracker, RuntimeImport import, RuntimeExport export, Func`3 lazyFactory)
at Microsoft.VisualStudio.Composition.RuntimeExportProviderFactory.RuntimeExportProvider.GetValueForImportSite(RuntimePartLifecycleTracker importingPartTracker, RuntimeImport import)
at Microsoft.VisualStudio.Composition.RuntimeExportProviderFactory.RuntimeExportProvider.RuntimePartLifecycleTracker.<CreateValue>b__10_0(RuntimeImport import)
at System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext()
at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
at Microsoft.VisualStudio.Composition.RuntimeExportProviderFactory.RuntimeExportProvider.RuntimePartLifecycleTracker.CreateValue()
at Microsoft.VisualStudio.Composition.ExportProvider.PartLifecycleTracker.Create()
at Microsoft.VisualStudio.Composition.ExportProvider.PartLifecycleTracker.MoveNext(PartLifecycleState nextState)
at Microsoft.VisualStudio.Composition.ExportProvider.PartLifecycleTracker.MoveToState(PartLifecycleState requiredState)
at Microsoft.VisualStudio.Composition.ExportProvider.PartLifecycleTracker.GetValueReadyToExpose()
at Microsoft.VisualStudio.Composition.RuntimeExportProviderFactory.RuntimeExportProvider.<>c__DisplayClass15_0.<GetExportedValueHelper>b__0()
at Microsoft.VisualStudio.Composition.RuntimeExportProviderFactory.RuntimeExportProvider.GetValueForImportElement(RuntimePartLifecycleTracker importingPartTracker, RuntimeImport import, RuntimeExport export, Func`3 lazyFactory)
at Microsoft.VisualStudio.Composition.RuntimeExportProviderFactory.RuntimeExportProvider.GetValueForImportSite(RuntimePartLifecycleTracker importingPartTracker, RuntimeImport import)
at Microsoft.VisualStudio.Composition.RuntimeExportProviderFactory.RuntimeExportProvider.RuntimePartLifecycleTracker.<CreateValue>b__10_0(RuntimeImport import)
at System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext()
at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
at Microsoft.VisualStudio.Composition.RuntimeExportProviderFactory.RuntimeExportProvider.RuntimePartLifecycleTracker.CreateValue()
at Microsoft.VisualStudio.Composition.ExportProvider.PartLifecycleTracker.Create()
at Microsoft.VisualStudio.Composition.ExportProvider.PartLifecycleTracker.MoveNext(PartLifecycleState nextState)
at Microsoft.VisualStudio.Composition.ExportProvider.PartLifecycleTracker.MoveToState(PartLifecycleState requiredState)
at Microsoft.VisualStudio.Composition.ExportProvider.PartLifecycleTracker.GetValueReadyToExpose()
at Microsoft.VisualStudio.Composition.RuntimeExportProviderFactory.RuntimeExportProvider.<>c__DisplayClass15_0.<GetExportedValueHelper>b__0()
at Microsoft.VisualStudio.Composition.RuntimeExportProviderFactory.RuntimeExportProvider.GetValueForImportElement(RuntimePartLifecycleTracker importingPartTracker, RuntimeImport import, RuntimeExport export, Func`3 lazyFactory)
at Microsoft.VisualStudio.Composition.RuntimeExportProviderFactory.RuntimeExportProvider.GetValueForImportSite(RuntimePartLifecycleTracker importingPartTracker, RuntimeImport import)
at Microsoft.VisualStudio.Composition.RuntimeExportProviderFactory.RuntimeExportProvider.RuntimePartLifecycleTracker.<CreateValue>b__10_0(RuntimeImport import)
at System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext()
at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
at Microsoft.VisualStudio.Composition.RuntimeExportProviderFactory.RuntimeExportProvider.RuntimePartLifecycleTracker.CreateValue()
at Microsoft.VisualStudio.Composition.ExportProvider.PartLifecycleTracker.Create()
at Microsoft.VisualStudio.Composition.ExportProvider.PartLifecycleTracker.MoveNext(PartLifecycleState nextState)
at Microsoft.VisualStudio.Composition.ExportProvider.PartLifecycleTracker.MoveToState(PartLifecycleState requiredState)
at Microsoft.VisualStudio.Composition.ExportProvider.PartLifecycleTracker.GetValueReadyToExpose()
at Microsoft.VisualStudio.Composition.RuntimeExportProviderFactory.RuntimeExportProvider.<>c__DisplayClass15_0.<GetExportedValueHelper>b__0()
at Microsoft.VisualStudio.Composition.RuntimeExportProviderFactory.RuntimeExportProvider.GetValueForImportElement(RuntimePartLifecycleTracker importingPartTracker, RuntimeImport import, RuntimeExport export, Func`3 lazyFactory)
at Microsoft.VisualStudio.Composition.RuntimeExportProviderFactory.RuntimeExportProvider.GetValueForImportSite(RuntimePartLifecycleTracker importingPartTracker, RuntimeImport import)
at Microsoft.VisualStudio.Composition.RuntimeExportProviderFactory.RuntimeExportProvider.RuntimePartLifecycleTracker.<CreateValue>b__10_0(RuntimeImport import)
at System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext()
at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
at Microsoft.VisualStudio.Composition.RuntimeExportProviderFactory.RuntimeExportProvider.RuntimePartLifecycleTracker.CreateValue()
at Microsoft.VisualStudio.Composition.ExportProvider.PartLifecycleTracker.Create()
at Microsoft.VisualStudio.Composition.ExportProvider.PartLifecycleTracker.MoveNext(PartLifecycleState nextState)
at Microsoft.VisualStudio.Composition.ExportProvider.PartLifecycleTracker.MoveToState(PartLifecycleState requiredState)
at Microsoft.VisualStudio.Composition.ExportProvider.PartLifecycleTracker.GetValueReadyToExpose()
at Microsoft.VisualStudio.Composition.RuntimeExportProviderFactory.RuntimeExportProvider.<>c__DisplayClass15_0.<GetExportedValueHelper>b__0()
at Microsoft.VisualStudio.Composition.RuntimeExportProviderFactory.RuntimeExportProvider.GetValueForImportElement(RuntimePartLifecycleTracker importingPartTracker, RuntimeImport import, RuntimeExport export, Func`3 lazyFactory)
at Microsoft.VisualStudio.Composition.RuntimeExportProviderFactory.RuntimeExportProvider.GetValueForImportSite(RuntimePartLifecycleTracker importingPartTracker, RuntimeImport import)
at Microsoft.VisualStudio.Composition.RuntimeExportProviderFactory.RuntimeExportProvider.RuntimePartLifecycleTracker.<CreateValue>b__10_0(RuntimeImport import)
at System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext()
at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
at Microsoft.VisualStudio.Composition.RuntimeExportProviderFactory.RuntimeExportProvider.RuntimePartLifecycleTracker.CreateValue()
at Microsoft.VisualStudio.Composition.ExportProvider.PartLifecycleTracker.Create()
at Microsoft.VisualStudio.Composition.ExportProvider.PartLifecycleTracker.MoveNext(PartLifecycleState nextState)
at Microsoft.VisualStudio.Composition.ExportProvider.PartLifecycleTracker.MoveToState(PartLifecycleState requiredState)
at Microsoft.VisualStudio.Composition.ExportProvider.PartLifecycleTracker.GetValueReadyToExpose()
at System.Lazy`1.CreateValue()
at System.Lazy`1.LazyInitValue()
at Microsoft.VisualStudio.Composition.NetFxAdapters.MefV1ExportProvider.<>c__DisplayClass12_0.<UnwrapExport>b__1()
at System.ComponentModel.Composition.Primitives.Export.get_Value()
at System.ComponentModel.Composition.ReflectionModel.ImportingItem.Cast(Type type, Export export)
at System.ComponentModel.Composition.ReflectionModel.ReflectionComposablePart.SetImport(ImportingItem item, Export[] exports)
at System.ComponentModel.Composition.Hosting.ImportEngine.PartManager.TrySetImport(ImportDefinition import, Export[] exports)
at System.ComponentModel.Composition.Hosting.ImportEngine.TrySatisfyImportSubset(PartManager partManager, IEnumerable`1 imports, AtomicComposition atomicComposition)
at System.ComponentModel.Composition.Hosting.ImportEngine.TrySatisfyImportsStateMachine(PartManager partManager, ComposablePart part)
at System.ComponentModel.Composition.Hosting.ImportEngine.TrySatisfyImports(PartManager partManager, ComposablePart part, Boolean shouldTrackImports)
at System.ComponentModel.Composition.Hosting.ImportEngine.SatisfyImportsOnce(ComposablePart part)
at System.ComponentModel.Composition.Hosting.CompositionContainer.SatisfyImportsOnce(ComposablePart part)
at System.ComponentModel.Composition.AttributedModelServices.SatisfyImportsOnce(ICompositionService compositionService, Object attributedPart)
at Sourcetree.Composition.VSMef.Net471.VSMefCompositionManager.<Compose>d__5.MoveNext()

4 answers

62 votes
Jonathan Folland June 14, 2023

I deleted file "\AppData\Local\Atlassian\SourceTree.exe_Url_lt03l1ybxwq1qoho5ydpzegbicen0mbc\3.4.11.0\Composition.cache"

This resolved the issue for me and so far I have not seen any issues.

David Smith June 14, 2023

This is the perfect fix!

 

For those who stumble across this with the same issue.



Last night I left my laptop on stand by with Sourcetree and Visual Studio open.

Windows decided to do a security update overnight so Sourcetree showed this exact issue in the morning.

I reversed the update but the corruption of the cache remained. Removing this file and relaunching the software resolved my issue as it rebuilt the cache with the new information.

I have logged a complaint with Microsoft as this looks like a .NET/Visual Studio issue caused by the changes in their update.

Thank you for the help Jonathan, absolute lifesaver!

Like # people like this
Mauro Bertoli June 14, 2023

@Jonathan Folland thank you, life saver, it did work form me too. The same problem happened after a Windows 11 update. After the update and the reboot, Sourcetree 3.4.13 just shown his splash screen and then crashed.

To help others, you can just rename the file without deleting it.

Be aware that you need to find the folder with your current/latest version (as you can have many similar folders with different IDs) and rename `Composition.cache` to `_Composition.cache` and then start Sourcetree. A new `Composition.cache` file will appear.

Out of curiosity, I did compare the two (binary) files, and found out that the only change was related to the `Sourcetree` folder renamed in `SourceTree` 🤣
Ex:
before => C:/Users/[user]/AppData/Local/Sourcetree/app-3.4.13/

after => C:/Users/[user]/AppData/Local/SourceTree/app-3.4.13/

Like # people like this
David Brady June 14, 2023

Thank you! Same thing happened to me. Windows 11 updated and then Sourcetree wouldn't load. And deleting the cache file fixed it.

Like # people like this
Matthew Sweeney June 14, 2023

This worked for me, after Windows Update apparently screwed up Sourcetree.

Like # people like this
Andrés Rosero T. June 14, 2023

Same for me, the new Windows 11 update crashed my SourceTree installation. I deleted the cache file, and now it works again! Thanks a lot! :-)

Like # people like this
Denis Birnie June 14, 2023

Happened on Windows 10 too - so suspecting this month's .Net updates, applied yesterday.

Like Jonathan Folland likes this
Haerun Syahnur June 14, 2023

this also worked for me and yes, also after Windows update

Like # people like this
Jean Zunino June 14, 2023
Jonathan Folland, thank you.
Same situation happened to me. And deleting Composition.cache fixed the problem.
Like Matthew Sweeney likes this
DMCDEV June 15, 2023

RIGHT ON!

Thanks for this; I just spent an hour trying to debug this, looking for errors in the sourcetree.log file after the app failed to launch.  I'm amused by how much attention this post received yesterday after being dormant for so long. 

Like Matthew Sweeney likes this
Alan Ma June 15, 2023

Thanks! this worked for me.

Hondaman900 June 18, 2023

You saved my life!!  This worked and I found this post/solution right as I was about to uninstall and reinstall SourceTree and rebuild my project and server access etc. That would have been very painful. I renamed the cache file and everything worked again.

Thank you!

Haoyang Lu June 18, 2023

You my hero Mr.Folland!

Antonio cano montes June 19, 2023

Jonathan Folland thank you for your answer, you have saved my time

frjonesandson June 19, 2023

Thanks so much, major time saver!

Emerson R June 20, 2023

Can confirm, this worked for me as well.

Thank you!

Rahul Mishra June 21, 2023

Thank you very much, this worked for me. How did you get to this solution of removing this particular file? I am curious to know the thought process. 

p.s. In hindsight, now that you have mentioned that Composition.cache needs to be deleted, there  are related error entries in log file that mention Composition (Microsoft.VisualStudio.Composition.PartDiscovery.GetElementTypeFromMany)

But I would never have reached to this solution by looking at these entries. :-)

Mukherjee, Apratim June 26, 2023

Thank you, this worked for me

Christoffer Jedbäck June 27, 2023

👍 Works like a charm! 😊

wilson June 27, 2023

You saved my time! perfect worked for me.

jpguillebaud June 28, 2023

Thank you, that fix solved it for me also!

Darrell Thacher July 5, 2023

Worked for me too! Thanks!

 

Seems like with all the increased security updates to our computers, we are now spending significant time troubleshooting post-security-update issues!

Leo Tohill August 24, 2023

SAME SAME.

2 votes
Danny Gorter June 14, 2023

None of this worked for me. Apparently the folder names were mixed up. My executable is in AppData\Local\SourceTree\app-3.4.2 and the config of Atlassion appeared to be in \AppData\Local\Atlassian\SourceTree.exe_{ID}\3.4.2.0

I renamed the first folder to app-3.4.2.0 (so I added the 0) and then it started a fresh registration os Sourcetre. Did not complete this but killed it and changed the folder name back to app-3.4.2 and it started properly again.

jermainefeng June 14, 2023

Yep, I've tried your solution and works.

By the way I rename the folder back to origin name again and all the settings and repos keep the same.

And a prompt with temp files shown, I think this is the root cause why the source tree not loaded.

0 votes
Ellianaa423 June 17, 2023
  • The error message you provided indicates that SourceTree is unable to load the MEF (Managed Extensibility Framework) components. The specific error encountered is "System.InvalidOperationException: Sequence contains no elements."
  • This error typically occurs when there is a problem with the installation or configuration of SourceTree's MEF components. Here are a few troubleshooting steps you can try to resolve the issue:

  • Restart your computer: Sometimes, a simple restart can resolve temporary issues with the application or its dependencies.
  • Update SourceTree: Ensure that you are using the latest version of SourceTree. Visit the official website or check for updates within the application itself.
  • Repair or reinstall SourceTree: Try repairing or reinstalling SourceTree to ensure that all necessary components are properly installed and configured. Uninstall SourceTree, restart your computer, and then install it again.
  • Clear SourceTree settings: There might be a corrupted configuration causing the issue. You can try clearing the SourceTree settings by deleting the following folder:
  • Windows: %LocalAppData%\Atlassian\SourceTree
0 votes
Ana Retamal
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 15, 2019

Hi Will,

Are you still experiencing this issue?

I've checked the log and I can see several mentions of Visual Studio, are you using Sourcetree with Visual Studio? Can you try wiping Sourcetree preferences and starting it again, and see if this time it works?

If you're still having issues, can you let us know which Sourcetree and Windows version are you using, so we can help you troubleshoot this issue?

Best regards,

Ana

tangwei cai October 25, 2020

I also have this problem. Has it been solved?

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events