Forum Visual Studio

Visual Studio for Mac crashes Finder

Sometimes Visual Studio for Mac will crash when trying to select a .cs file from Finder to add to my project. Once that happens, Finder is forever hosed until I reboot. Even with Visual Studio for Mac not running, if I go to Finder and just select a .cs file, Finder crashes! I would guess it has something to do with a bug in Quick Look or whatever a Mac application does to customize Finder when it gets installed?? Very annoying!

Posts

  • That is weird. I don't think it has to do with Visual Studio for Mac anymore. I did more testing and it was a specific .cs file that was causing the problem. I was able to open up the file in a text editor and noticed 2 strange characters at the beginning of the file:

    Not sure how they got there, but I removed them and everything seems ok now.

  • JGoldbergerJGoldberger USMember, Forum Administrator, Xamarin Team, University Xamurai

    Glad you got that sorted out.

    Just as a side note, you should be able to relaunch Finder without rebooting the whole machine.

    1. Click on the Apple menu in the menu bar and select "Force Quit..."
    2. Select Finder in the dialog that opens.
    3. Click Relaunch

    That should restart Finder and make it work again.

  • i think visual studio for mac is sometimes putting <feff> characters at the beginning of cs files. not sure when, but i have found several that have them. each one crashes Finder when selecting them. Finder then restarts automatically. 100% repeatable just not sure if VS for mac is the culprit for these mysterious <feff> characters.
  • JGoldbergerJGoldberger USMember, Forum Administrator, Xamarin Team, University Xamurai

    Can you perhaps attach a .cs file that has these characters (with anything sensitive stripped out)?

    Are you using any version control? Do you use any other app to open .cs files?

  • ShawnCastrianni.5092ShawnCastrianni.5092 US ✭✭✭
    edited August 2017

    I have attached the file here. We use TFS for SCM. We use Eclipse with TFS anywhere so Eclipse would also handle .cs files. I had to use VI to inspect the files and see the <feff> characters and remove them. In HEX, the beginning of the attached file is:

    ef bb bf ef bb bf ef bb bf

  • JGoldbergerJGoldberger USMember, Forum Administrator, Xamarin Team, University Xamurai

    Hmm... searching on those characters and .cs it seems that might be a byte order mark (BOM) added by Visual Studio and/or TFS. See these search results:

    https://stackoverflow.com/questions/44098326/ef-bb-bf-at-the-beginning-of-json-files-created-in-visual-studio

    https://social.msdn.microsoft.com/Forums/vstudio/en-US/f587055d-cd7d-47ca-a6a6-e713739868fe/how-to-stop-automatic-encoding-changes?forum=tfsversioncontrol

    https://zzz.buzz/2016/06/25/visual-studio-and-the-bom/

    And I can reproduce the crash in Visual Studio for Mac when opening that file from within the IDE, and Finder relaunching when selecting that file. If I right click on the file and select "Open With->Visual Studio.app" then the file opens in Visual Studio successfully. I will get a bug report filed for this issue. I think it is an UPSTREAM issue because of the Finder crash and I notice that VS for Mac crashes just selecting the file in the Finder dialog when opening the file... IOW before clicking the "Open" button after selecting the file in the dialog... so that would seem to be Finder crashing as well and taking down VSfM with it. Filing the bug anyway for visibility.

    Bug report: https://bugzilla.xamarin.com/show_bug.cgi?id=59053

  • amirvenusamirvenus USMember ✭✭✭

    This is what helped me:

    rm -rf ~/Library/Caches/VisualStudio
    rm -rf ~/Library/Preferences/VisualStudio
    rm -rf ~/Library/Preferences/Visual\ Studio
    rm -rf ~/Library/Logs/VisualStudio
    rm -rf ~/Library/VisualStudio
    rm -rf ~/Library/Preferences/Xamarin/
    rm -rf ~/Library/Developer/Xamarin
    
Sign In or Register to comment.