sboulema / TGit

Control TortoiseGit from within Visual Studio
MIT License
31 stars 9 forks source link

Crash in VS 2022 after start, making it unusable #76

Closed ygoe closed 2 years ago

ygoe commented 2 years ago

I'm setting up my new environment in Visual Studio 2022, still in the preview version. As soon as I install this extension, I cannot use Visual Studio anymore. After opening the main window with no code, a moment later it freezes and then disappears with no trace. Disabling this extension fixes this reliably. All the other extensions run fine, but this alone crashes it in a way that isn't handled by Visual Studio.

That's sad because I liked to use the Git menu to run TortoiseGit from there. Hopefully this will be fixed so I can continue using the TGit extension.

Tested with Visual Studio 2022 17.2.0 Preview 2.1 on Windows 10.

lukamicoder commented 2 years ago

I have the same issue: after updating Visual Studio 2022 to 17.2 visual studio would crash with this error:

Application: devenv.exe Framework Version: v4.0.30319 Description: The process was terminated due to an unhandled exception. Exception Info: System.Runtime.InteropServices.COMException at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32, IntPtr) at Community.VisualStudio.Toolkit.SolutionItem.GetFullPath() at Community.VisualStudio.Toolkit.SolutionItem..ctor(Microsoft.VisualStudio.Shell.IVsHierarchyItem, Community.VisualStudio.Toolkit.SolutionItemType) at Community.VisualStudio.Toolkit.SolutionItem.FromHierarchyItem(Microsoft.VisualStudio.Shell.IVsHierarchyItem) at Community.VisualStudio.Toolkit.Solutions+<GetCurrentSolutionAsync>d__1.MoveNext() at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(System.Threading.Tasks.Task) at SamirBoulema.TGit.Helpers.FileHelper+<GetSolutionDir>d__3.MoveNext() at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(System.Threading.Tasks.Task) at SamirBoulema.TGit.Helpers.FileHelper+<HasSolutionDir>d__4.MoveNext() at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(System.Threading.Tasks.Task) at SamirBoulema.TGit.Helpers.CommandHelper+<SolutionVisibility_BeforeQueryStatus>d__1.MoveNext() at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() 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)

The only solution is to disable TGit extension.

ygoe commented 2 years ago

@lukamicoder Thanks for the log. Looks like this call to VS.Solutions.GetCurrentSolutionAsync() could use a try/catch handler around it.

madskristensen commented 2 years ago

Can this be Closed if it was fixed by https://github.com/sboulema/TGit/commit/2d97bfb70d5a852a968f87576532f02141a02c0e?

Also, we're seeing crash data come in from Visual Studio users. It would be great with a new release of the extension containing this fix.

sboulema commented 2 years ago

I got an error uploading to the marketplace :(

Haven't had the time to look into it. Something about supporting vs2022 in the same vsix as older versions. Bit afraid I have to split the vsix now...

madskristensen commented 2 years ago

That's an issue only on the CLI publishing side. They are fixing that as we speak. But you can upload from the Marketplace website without that error showing

sboulema commented 2 years ago

The new version has been uploaded to the marketplace!

madskristensen commented 2 years ago

Thank you so much!!

MelchiorGaspar commented 2 years ago

is there a way to manually update this extension as I cannot successfully load Visual Studios long enough to install the update? EDIT: nvm I just download the vsix file from your release page... hope that works... ;-)

MelchiorGaspar commented 2 years ago

VS 2022 Community ed. complained it was already installed... some how... even though the updater errored out... while trying to install TGit v5.2.5 from within VS..... I managed to get it loaded finally uninstalled and reinstalled it ... VS seems to be loading successfully now.. thx for the fix.