fork-dev / TrackerWin

Bug and issue tracker for Fork for Windows
450 stars 10 forks source link

Fork crashes on startup #2232

Closed willl closed 2 weeks ago

willl commented 3 weeks ago

Here's the content from the log file

Fork logs ``` 🔷 2024-06-12 15:47:30.907 Start IPC server Fork_Pipe29788_AskPass ◽️ 2024-06-12 15:47:30.907 Fork_Pipe29788_AskPass: waiting for next event '214' 🔷 2024-06-12 15:47:30.907 Start IPC server Fork_Pipe29788_Default ◽️ 2024-06-12 15:47:30.907 Fork_Pipe29788_Default: waiting for next event '214' 🔷 2024-06-12 15:47:31.604 Refresh Theme 🔷 2024-06-12 15:47:31.768 Log target: AppData log file 🔷 2024-06-12 15:47:32.022 Last update check: 12/05/2024 12:00:00 AM. Next one: 13/05/2024 12:00:00 AM 🔷 2024-06-12 15:47:32.422 Restore workspance 'Work' with 1 tabs 🔷 2024-06-12 15:47:32.648 RefreshRepositoryData ◽️ 2024-06-12 15:47:32.664 a-repo-name RefreshRepositoryDataGitCommand All ◽️ 2024-06-12 15:47:32.680 12 ms: bt_get_git_config ◽️ 2024-06-12 15:47:32.695 Loading a-repo-name settings 🔷 2024-06-12 15:47:32.805 WindowActivated ◽️ 2024-06-12 15:47:32.931 912 ms: Initialize Paddle ❌ 2024-06-12 15:47:32.976 Cannot parse reference refs/gitbutler/develop 🔷 2024-06-12 15:47:32.976 App start: 1656ms, AppInitialization: 1159ms, MainWindowOpening: 645ms, MainWindowActivation: 566ms, Total: 4026ms 🔷 2024-06-12 15:47:33.108 Refresh 'a-repo-name' data. Updated. 🔷 2024-06-12 15:47:33.108 RefreshRepositoryStatus 🔷 2024-06-12 15:47:34.258 Refresh 'a-repo-name' status. Updated 17 files ``` I changed the local repo name to be `a-repo-name`. The original name is 3 words separated by a single dash.

I had installed Git Butler, but then removed that tool, so unsure why there's still a reference to it in fork's logs.

And here's the logs from Event Viewer

Event Viewer entry ``` Application: Fork.exe Framework Version: v4.0.30319 Description: The process was terminated due to an unhandled exception. Exception Info: System.AccessViolationException Exception Info: System.Reflection.TargetInvocationException at System.RuntimeMethodHandle.InvokeMethod(System.Object, System.Object[], System.Signature, Boolean) at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(System.Object, System.Object[], System.Object[]) at System.Reflection.RuntimeMethodInfo.Invoke(System.Object, System.Reflection.BindingFlags, System.Reflection.Binder, System.Object[], System.Globalization.CultureInfo) at .Main(System.String[]) ```

Fork was working fine on this machine yesterday. And Git Butler was installed alongside with Fork a few months ago without issue (but only used once). I only removed Git Butler after experiencing issues with Fork, so I don't think it's the issue?

Happy to attempt to investigate this further if anyone has any hints as to what to look for?

StepKie commented 3 weeks ago

still no luck, sorry

cristian-recoseanu commented 3 weeks ago

OK, I'm out of ideas ☹️.

I will probably make a build without file icons for people who can't run Fork and will wait for a fix from Microsoft.

Would it be easier to just maintain the same behaviour as you have now in the hope that Microsoft fix it, but just do a build to allow us to manually opt out of loading icons through configuration in settings.json? I'm just thinking it might be easier to maintain.

Also, I'm wondering if this is happening for anyone running Windows 11?

Canadastartes commented 3 weeks ago

Also, I'm wondering if this is happening for anyone running Windows 11?

I'm on Win 10. It doesn't crash on Fork start for me, but it crashes if I navigate from the File Tree in a folder with a .sln file in it.

jecook commented 3 weeks ago

This has been happening to me too, today and yesterday. I am on Windows 10 and also installed the KB5039211 update. I attempted to uninstall the Windows update, but that did not fix the issue.

May or may not be related, but I keep up to date with the Visual Studio preview releases, and installed that yesterday too.

As well as Fork crashing, I was also getting Explorer crashes when a) looking at the Visual Studio taskbar jump list and b) going to some folders with a .sln file. Oddly not all .sln files were causing a crash. I found that changing the encoding of the offending .sln files to UTF-8 with BOM stopped explorer crashing on viewing the folder, but didn't fix the jump list issue.

This made me suspect that it was the process that creates the VS version number overlay that was falling over on some .sln files. So I went into my registry, disabled the icon handler for VS solution files, and rebooted. So far I have had no crashes from Fork, Explorer or the taskbar jump list.

Not sure what the ultimate answer is, but at least I can continue developing.

To disable the icon overlay I renamed the HKEY_CLASSES_ROOT\VisualStudio.sln.ffddf647\ShellEx\IconHandler key. Then it's enough to kill the explorer process and start it again.

JRahnama commented 3 weeks ago

Also, I'm wondering if this is happening for anyone running Windows 11?

I am on Windows 11 and it crashes

willl commented 3 weeks ago

May or may not be related, but I keep up to date with the Visual Studio preview releases, and installed that yesterday too.

I'm also a user of VS Preview releases also did install the latest preview release (17.11.0 Preview 2.0) before Fork broke. Not sure if that's a coincidence or not.

dominikjeske commented 3 weeks ago

I'm also on Win11 and installed VS preview - I'm not sure but it could be connected

DanPristupov commented 3 weeks ago

@jecook Wow, this is a high-level investigation! Everything looks logical and it seems to me very likely that you are right in every detail.

DanPristupov commented 3 weeks ago

@davkean @KirillOsenkov Not sure if I can contact you this way, but if you have a chance to notice this, can you please leave a comment?

We have a problem that requesting file icon using SHGetFileInfo WinAPI function causes crash on .sln files for some users.

Is it possible that this crash is caused by the latest Visual Studio Preview release?

StepKie commented 3 weeks ago

Can confirm that I also have latest Visual Studio 2022 versions installed (regular AND preview), on Windows 11.

@jecook Thanks for your research! Do you know whether Microsoft aware of this, has it been reported as an issue? Edit: I guess Dan is on top of it :)

MartinZikmund commented 3 weeks ago

@davkean @KirillOsenkov Not sure if I can contact you this way, but if you have a chance to notice this, can you please leave a comment?

We have a problem that requesting file icon using SHGetFileInfo WinAPI function causes crash on .sln files for some users.

  • It seems to happen to users who installed the latest Visual Studio preview release (17.11.0 Preview 2.0) which was released just a few days ago (June 11th, 2024).
  • It affects not only Fork, but also other apps, including Windows Explorer
  • The crash seems to be caused by memory corruption, but I can't be 100% sure. My application (Fork) crashes with System.AccessViolationException
  • You can find more details in this comment Fork crashes on startup #2232 (comment)

Is it possible that this crash is caused by the latest Visual Studio Preview release?

Can confirm I have updated to Visual Studio 2022 Preview on both machines where I got the problem!

JRahnama commented 3 weeks ago

~I removed net9 preview and it started working, but I also noticed fork is on a newer version 1.98.0. Failing was happening on 1.97.~

Update: it worked on previously existing repos, the moment i cloned a new repository it failed again.

MartinZikmund commented 3 weeks ago

@JRahnama Quite possible that the icon was already cached there and now it is no longer cached

KirillOsenkov commented 3 weeks ago

Do we have a dump?

create C:\CrashDumps and save and run this: https://github.com/KirillOsenkov/dotfiles/blob/main/LocalDumps.reg

Go to Visual Studio help and open a new Developer Community issue (report a problem), attach the dump privately to the issue.

Can you also make a standalone C# app that does the same thing and crashes the same way?

DanPristupov commented 3 weeks ago

I made a simple WPF app which loads icons for every file in the folder (recursively).

Can anyone try if it crashes, please?

Compiled: https://cdn.fork.dev/prerelease/GetFileIcons-1.0.zip Source code: https://github.com/DanPristupov/GetFileIcons.git

Canadastartes commented 3 weeks ago

Here's the crash dump for GetFileIcons -> GetFileIcons.exe.19880.zip

BTW explorer.exe crashes just by creating a .sln file in it.

KirillOsenkov commented 3 weeks ago

We don't recommend uploading dumps publicly because the memory may contain sensitive or private information or secrets (environment variables etc). It's better to upload the dump in a private attachment to a developer community ticket.

KirillOsenkov commented 3 weeks ago

The problem is in VSFileHandler.dll:

    shell32.dll!SHSimpleIDListFromFindDataAndFlags(const wchar_t * pszPath, const _WIN32_FIND_DATAW * pfd, SIMPLE_IDLIST_FLAGS ppidl, _ITEMIDLIST_ABSOLUTE * *) Line 421    C++
    [Inline Frame] shell32.dll!SHSimpleIDListFromFindData(const wchar_t *) Line 456 C++
    shell32.dll!SHSimpleIDListFromPath(const wchar_t * pszPath) Line 2991   C++
    VSFileHandler.dll!CVsShellExtHandler::GetIExtractIconObject() Line 48   C++
>   VSFileHandler.dll!CVsShellExtHandler::GetIconLocation(unsigned int uFlags, wchar_t * pwzIconFile, unsigned int cchMax, int * piIndex, unsigned int * pwFlags) Line 86   C++
    windows.storage.dll!CIconAndThumbnailOplockWrapper::GetIconLocation(unsigned int uFlags, char * pszIconFile, unsigned int cchMax, int * piIndex, unsigned int * pwFlags) Line 248   C++
    shell32.dll!_GetILIndexGivenPXIcon(PXICONPARAMS * pip, int * piImage) Line 186  C++
    shell32.dll!_GetILIndexFromItem(IShellFolder * psf, const _ITEMID_CHILD * pidl, unsigned int flags, int * piImage) Line 383 C++
    shell32.dll!_GetFileInfoSections(const _ITEMIDLIST_ABSOLUTE * pidl, _SHFILEINFOW * psfi, unsigned int uFlags) Line 970  C++
    shell32.dll!SHGetFileInfoW(const wchar_t * pszPath, unsigned long dwFileAttributes, _SHFILEINFOW * psfi, unsigned int uFlags, unsigned int) Line 1152   C++
    shell32.dll!SHGetFileInfoA(const char * pszPath, unsigned long dwFileAttributes, _SHFILEINFOA * psfi, unsigned int cbFileInfo, unsigned int uFlags) Line 1213   C++
    [Managed to Native Transition]  
    GetFileIcons.exe!GetFileIcons.IconTools.GetIconForFile(string filename, GetFileIcons.ShellIconSize size) Line 70    C#
    GetFileIcons.exe!GetFileIcons.IconTools.GetIconForExtension(string extension, GetFileIcons.ShellIconSize size) Line 63  C#
    GetFileIcons.exe!GetFileIcons.MainWindow.RefreshIcons() Line 65 C#
    GetFileIcons.exe!GetFileIcons.MainWindow.OpenButton_Click(object sender, System.Windows.RoutedEventArgs e) Line 48  C#
KirillOsenkov commented 3 weeks ago

image

KirillOsenkov commented 3 weeks ago

I have the dump now, feel free to delete it, thanks!

KirillOsenkov commented 3 weeks ago

Can someone Help -> Report a Problem and paste the link to the developer community ticket here? image

It's better if this comes from someone who is actually experiencing the issue.

KirillOsenkov commented 3 weeks ago

rgszTemplateIconFiles[68] is NULL: image

KirillOsenkov commented 3 weeks ago

ah OK this has been fixed on Monday in VS/pullrequest/556663

KirillOsenkov commented 3 weeks ago

I've asked to see when the fix will ship, will hear back soon hopefully. There's no longer a need to file a dev community ticket.

DanPristupov commented 3 weeks ago

@KirillOsenkov

Wow, getting such a fast and professional support is very, very rare nowadays! Thank you very much ❤️.

Can you think of any workaround that can be applied on our side? Skipping just .sln files didn't help.

KirillOsenkov commented 3 weeks ago

The problem is in VSFileHandler.dll shell extension. I'm not sure how to detect whether it is installed or to disable/uninstall it. But my advice is if it crashes, just uninstall the latest preview of Visual Studio. The fix was checked in and should be coming soon although I can't tell you when exactly. Unfortunately I can't think of any workaround other than stop calling into that get file icon API and use a hardcoded rectangle instead of a custom icon. You'll have no custom icons for a while but at least you won't crash.

MartinZikmund commented 2 weeks ago

A workaround is listed here - https://developercommunity.visualstudio.com/t/Report:-Visual-Studio-2013-sln-File-Cau/10682545#T-N10682561

NickHodgeBB commented 2 weeks ago

thank you.

also watching your issue in git


From: Martin Zikmund @.> Sent: Tuesday, 18 June 2024 3:39 PM To: fork-dev/TrackerWin @.> Cc: Nick Hodge @.>; Manual @.> Subject: Re: [fork-dev/TrackerWin] Fork crashes on startup (Issue #2232)

A workaround is listed here - https://developercommunity.visualstudio.com/t/Report:-Visual-Studio-2013-sln-File-Cau/10682545#T-N10682561

— Reply to this email directly, view it on GitHubhttps://github.com/fork-dev/TrackerWin/issues/2232#issuecomment-2175054581, or unsubscribehttps://github.com/notifications/unsubscribe-auth/BEDWOSW3MPCRK5PTBBYLKH3ZH7B2ZAVCNFSM6AAAAABJFU5SH6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNZVGA2TINJYGE. You are receiving this because you are subscribed to this thread.Message ID: @.***>

mAcf00bar commented 2 weeks ago

Hi! Today I did update to VS 2022 Preview 17.10.0 Preview 2.0 and experienced the same crashes on Explorer (but didn't notice it at first) and only after a restart of Fork (and consecutive crashes) I found the same eventlog entries.

I have downgraded to VS 2022 17.11.0 Preview 1.1 and the crashes are gone.

Canadastartes commented 2 weeks ago

It is supposedly fixed in 17.11.0-pre-2.1. See Top bug fixes -> https://learn.microsoft.com/en-us/visualstudio/releases/2022/release-notes-preview#17.11.0-pre.2.1

Fixes an issue where a singleton assembly shipped by VS can cause applications which load icons to crash when loading icons related to VS such as .sln files Preview 2.1

Canadastartes commented 2 weeks ago

Version 17.11.0 Preview 2.1 fixes it for me.

hennys commented 2 weeks ago

Can confirm that updating VS to 17.11.0 Preview 2.1 fixes the issue for me as well.

willl commented 2 weeks ago

Closing this issue as Preview 2.1 fixes the issue for me and others above.

MartinZikmund commented 2 weeks ago

Thanks everyone for the help, especially @DanPristupov for the many Fork test builds to zero in on the issue!

DanPristupov commented 2 weeks ago

Fork has the smartest users in the world! With your help we just went from a 'random crash' to the exact problem in preview release of other application in just 2 days!

Many thanks to everyone who helped and participated ❤️