Crash on startup (Windows10)
Asked by M?rio Csapl?r:

Hello, I have tried everything - removing, reinstalling, updating to newest version but SourceTree keeps crashing on startup. Here's info from event log:

Application: SourceTree.exe  
Framework Version: v4.0.30319  
Description: The process was terminated due to an unhandled exception.  
Exception Info: System.ArithmeticException

Exception Info: System.OverflowException  
at System.Windows.Media.Imaging.ColorConvertedBitmap.FinalizeCreation()  
at System.Windows.Media.Imaging.BitmapSource.CreateCachedBitmap(System.Windows.Media.Imaging.BitmapFrame, System.Windows.Media.Imaging.BitmapSourceSafeMILHandle, System.Windows.Media.Imaging.BitmapCreateOptions, System.Windows.Media.Imaging.BitmapCacheOption, System.Windows.Media.Imaging.BitmapPalette)  
at System.Windows.Media.Imaging.BitmapFrameDecode.FinalizeCreation()  
at System.Windows.Media.Imaging.BitmapDecoder.SetupFrames(System.Windows.Media.Imaging.BitmapDecoder, System.Collections.ObjectModel.ReadOnlyCollection\`1\<System.Windows.Media.Imaging.BitmapFrame\>)  
at System.Windows.Media.Imaging.BitmapDecoder.get_Frames()  
at System.Windows.Media.Imaging.BitmapFrame.CreateFromUriOrStream(System.Uri, System.Uri, System.IO.Stream, System.Windows.Media.Imaging.BitmapCreateOptions, System.Windows.Media.Imaging.BitmapCacheOption, System.Net.Cache.RequestCachePolicy)  
at System.Windows.Media.ImageSourceConverter.ConvertFrom(System.ComponentModel.ITypeDescriptorContext, System.Globalization.CultureInfo, System.Object)  
at SourceTree.Controls.BookmarkStatusControl.DpiWindow_DPIChanged(Double, SourceTree.UI.Theme.Wpf.Controls.PerMonitorDpiWindow)  
at SourceTree.Controls.BookmarkStatusControl..cctor()

Exception Info: System.TypeInitializationException  
at System.Runtime.CompilerServices.RuntimeHelpers._RunClassConstructor(System.RuntimeType)  
at System.Windows.DependencyProperty.FromName(System.String, System.Type)  
at System.Windows.Baml2006.WpfXamlType.FindDependencyPropertyBackedProperty(System.String, Boolean, Boolean)  
at System.Windows.Baml2006.WpfXamlType.FindMember(System.String, Boolean, Boolean)  
at System.Xaml.XamlType.GetMember(System.String)  
at System.Windows.Baml2006.Baml2006SchemaContext.GetProperty(Int16, System.Xaml.XamlType)  
at System.Windows.Baml2006.Baml2006Reader.Process_PropertyWithExtension()  
at System.Windows.Baml2006.Baml2006Reader.Process_OneBamlRecord()  
at System.Windows.Baml2006.Baml2006Reader.ReadObject(System.Windows.Baml2006.KeyRecord)  
at System.Windows.ResourceDictionary.CreateObject(System.Windows.Baml2006.KeyRecord)  
at System.Windows.ResourceDictionary.OnGettingValue(System.Object, System.Object ByRef, Boolean ByRef)  
at System.Windows.ResourceDictionary.OnGettingValuePrivate(System.Object, System.Object ByRef, Boolean ByRef)  
at System.Windows.ResourceDictionary.GetValueWithoutLock(System.Object, Boolean ByRef)  
at System.Windows.ResourceDictionary.GetValue(System.Object, Boolean ByRef)  
at System.Windows.DeferredResourceReference.GetValue(System.Windows.BaseValueSourceInternal)  
at System.Windows.StaticResourceExtension.TryProvideValueImpl(System.IServiceProvider, Boolean, Boolean)  
at System.Windows.StaticResourceExtension.ProvideValueInternal(System.IServiceProvider, Boolean)  
at MS.Internal.Xaml.Runtime.ClrObjectRuntime.CallProvideValue(System.Windows.Markup.MarkupExtension, System.IServiceProvider)

Exception Info: System.Windows.Markup.XamlParseException  
at System.Windows.Markup.XamlReader.RewrapException(System.Exception, System.Xaml.IXamlLineInfo, System.Uri)  
at System.Windows.FrameworkTemplate.LoadTemplateXaml(System.Xaml.XamlReader, System.Xaml.XamlObjectWriter)  
at System.Windows.FrameworkTemplate.LoadTemplateXaml(System.Xaml.XamlObjectWriter)  
at System.Windows.FrameworkTemplate.LoadOptimizedTemplateContent(System.Windows.DependencyObject, System.Windows.Markup.IComponentConnector, System.Windows.Markup.IStyleConnector, System.Collections.Generic.List\`1\<System.Windows.DependencyObject\>, System.Windows.UncommonField\`1\<System.Collections.Hashtable\>)  
at System.Windows.FrameworkTemplate.LoadContent(System.Windows.DependencyObject, System.Collections.Generic.List\`1\<System.Windows.DependencyObject\>)  
at System.Windows.StyleHelper.ApplyTemplateContent(System.Windows.UncommonField\`1\<System.Collections.Specialized.HybridDictionary\[\]\>, System.Windows.DependencyObject, System.Windows.FrameworkElementFactory, Int32, System.Collections.Specialized.HybridDictionary, System.Windows.FrameworkTemplate)  
at System.Windows.FrameworkTemplate.ApplyTemplateContent(System.Windows.UncommonField\`1\<System.Collections.Specialized.HybridDictionary\[\]\>, System.Windows.FrameworkElement)  
at System.Windows.FrameworkElement.ApplyTemplate()  
at System.Windows.FrameworkElement.MeasureCore(System.Windows.Size)  
at System.Windows.UIElement.Measure(System.Windows.Size)  
at System.Windows.Controls.VirtualizingStackPanel.MeasureChild(System.Windows.Controls.Primitives.IItemContainerGenerator ByRef, System.Windows.Controls.Primitives.IContainItemStorage ByRef, System.Windows.Controls.Primitives.IContainItemStorage ByRef, System.Object ByRef, Boolean ByRef, Double ByRef, Double ByRef, Boolean ByRef, Boolean ByRef, System.Collections.IList ByRef, System.Object ByRef, System.Collections.IList ByRef, Int32 ByRef, Boolean ByRef, Boolean ByRef, System.Windows.Size ByRef, System.Windows.Rect ByRef, System.Windows.Controls.VirtualizationCacheLength ByRef, System.Windows.Controls.VirtualizationCacheLengthUnit ByRef, Int64 ByRef, Boolean ByRef, Double ByRef, System.Windows.Size ByRef, System.Windows.Size ByRef, System.Windows.Size ByRef, System.Windows.Size ByRef, System.Windows.Size ByRef, System.Windows.Size ByRef, System.Windows.Size ByRef, System.Windows.Size ByRef, Boolean ByRef, Boolean, Boolean, Boolean, Boolean, Boolean, Boolean ByRef, Boolean ByRef)  
at System.Windows.Controls.VirtualizingStackPanel.MeasureOverrideImpl(System.Windows.Size, System.Nullable\`1\<Double\> ByRef, System.Collections.Generic.List\`1\<Double\> ByRef, System.Nullable\`1\<Double\> ByRef, Boolean)  
at System.Windows.Controls.VirtualizingStackPanel.MeasureOverride(System.Windows.Size)  
at System.Windows.FrameworkElement.MeasureCore(System.Windows.Size)  
at System.Windows.UIElement.Measure(System.Windows.Size)  
at System.Windows.ContextLayoutManager.UpdateLayout()  
at System.Windows.ContextLayoutManager.UpdateLayoutCallback(System.Object)  
at System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks()  
at System.Windows.Media.MediaContext.RenderMessageHandlerCore(System.Object)  
at System.Windows.Media.MediaContext.RenderMessageHandler(System.Object)  
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32)  
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate)  
at System.Windows.Threading.DispatcherOperation.InvokeImpl()  
at MS.Internal.CulturePreservingExecutionContext.CallbackWrapper(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 MS.Internal.CulturePreservingExecutionContext.Run(MS.Internal.CulturePreservingExecutionContext, System.Threading.ContextCallback, System.Object)  
at System.Windows.Threading.DispatcherOperation.Invoke()  
at System.Windows.Threading.Dispatcher.ProcessQueue()  
at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)  
at MS.Win32.HwndWrapper.WndProc(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)  
at MS.Win32.HwndSubclass.DispatcherCallbackOperation(System.Object)  
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32)  
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate)  
at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(System.Windows.Threading.DispatcherPriority, System.TimeSpan, System.Delegate, System.Object, Int32)  
at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr, Int32, IntPtr, IntPtr)  
at MS.Win32.UnsafeNativeMethods.DispatchMessage(System.Windows.Interop.MSG ByRef)  
at System.Windows.Threading.Dispatcher.PushFrameImpl(System.Windows.Threading.DispatcherFrame)  
at System.Windows.Application.RunDispatcher(System.Object)  
at System.Windows.Application.RunInternal(System.Windows.Window)  
at SourceTree.App.Main()


Answers:
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!