Windows 10, sourcetree 2.3.5, does not start
Asked by Ryan Martin:

Sourcetree starts up for about 5 seconds in task manager, then exits silently. Have tried uninstalling, reinstalling including clearing the AppData folders. Also tried installing an older version but that too force closes. Note: this issue is related to this specific machine, 2.3.5 is working on another machine of mine.

Thanks.

Here is the log:
>
> ```
> ERROR [2017-10-27 11:14:54,334] [1] [SourceTree.App] [.ctor] - finish EnsureSquirrelExecutionStubIsCopied
> ERROR [2017-10-27 11:14:54,490] [1] [SourceTree.App] [OnStartup] - Failed to start
> System.TypeInitializationException: The type initializer for 'MS.Win32.Penimc.UnsafeNativeMethods' threw an exception. ---> System.Runtime.InteropServices.COMException: Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG))
>  at MS.Win32.Penimc.UnsafeNativeMethods.CoCreateInstance(Guid& clsid, Object punkOuter, Int32 context, Guid& iid)
>  at MS.Win32.Penimc.UnsafeNativeMethods.CreatePimcManager()
>  at MS.Win32.Penimc.UnsafeNativeMethods..cctor()
>  --- End of inner exception stack trace ---
>  at MS.Win32.Penimc.UnsafeNativeMethods.CreateResetEvent(IntPtr& handle)
>  at System.Windows.Input.PenThreadWorker..ctor()
>  at System.Windows.Input.PenThreadPool.GetPenThreadForPenContextHelper(PenContext 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(InputManager inputManager, PresentationSource inputSource)
>  at System.Windows.Interop.HwndStylusInputProvider..ctor(HwndSource source)
>  at System.Windows.Interop.HwndSource.Initialize(HwndSourceParameters parameters)
>  at System.Windows.Window.CreateSourceWindow(Boolean duringShow)
>  at System.Windows.Window.ShowHelper(Object booleanBox)
>  at System.Windows.Window.ShowDialog()
>  at SourceTree.Utils.GeneralHelper.DownloadFile(String url, String destLocation, IInteractionsManager interactionsManager, IWebManager webManager, IDispatcher dispatcher, IRepoProcessFactory repoProcessFactory, INotificationsManager notificationsManager, String extractLocation)
>  at SourceTree.Download.DefaultDownloadManager.DownloadFile(String url, String downloadDestination, String extractionDestination)
>  at SourceTree.AppRoot.RunPreFlightChecks()
>  at SourceTree.AppRoot.OnStartup(StartupEventArgs e)
>  at SourceTree.App.OnStartup(StartupEventArgs e)
> ```


Answers:
author: Mikael Sandberg
body: Since you only see this on a specific machine, you may want to checkout this and see if it helps:

<https://answers.microsoft.com/en-us/windows/forum/windows_7-windows_programs/mswin32penimcunsafenativemethods/e572fda8-49e6-4c5f-ae35-27c9381f3533?auth=1>

comments: author: Ryan Martin
body: Thanks for the response, the link contained in there got me to the right area to get it working again.

My final solution:

open cmd with admin rights

browse to C:\\Windows\\Microsoft.NET\\Framework64\\v4.0.30319\\WPF

and run the command:  
regsvr32 PenIMC_v0400.dll

Source tree now loads after installation