madskristensen / RainbowBraces

A Visual Studio extension
Apache License 2.0
133 stars 7 forks source link

RainbowBraces stopped working after a VS crash #97

Open haraman21 opened 1 year ago

haraman21 commented 1 year ago

Hi First of all, its a great extension. I was using it from version 1.0.78 and it worked fine. But about 2 months ago (not sure but I think it was v1.0.105), Visual Studio 17.5.2 crashed and restarted. After the crash RainbowBraces stopped coloring braces. I have tried the following but to no avail:

Any suggestions on what could be the issue and how to track and resolve it?

lordfanger commented 1 year ago

Hi, that looks strange. Can you have a look at %appdata%\Microsoft\VisualStudio, there should be folder named 17.0_SOME_HASH (if there are more, the latest updated folder is likely the current Visual Studio) and in that folder there should be file named ActivityLog.xml. If there is anything related to RainbowBraces extension.

In 1.0.94 was implemented hack for Cascadia Code font. Are you using some unusual fonts? Or is missing Cascadia Code or Cascadia Mono from you computer?

When you try to install older version, is it working? (eg. https://github.com/madskristensen/RainbowBraces/releases/download/1.0.92/RainbowBraces.vsix )

haraman21 commented 1 year ago

Oh, sorry I forgot to mention above that I had also checked ActivityLog.xml. There was/is no record of anything related to RainbowBraces in the log.

I'm using default font Consolas. I've just tried changing font to Cascadia Code and then Cascadia Mono but it doesn't change anything. Installing older version didn't work either.

I'd like to repeat that everything before the VS crash was working fine for a few months. Immediately after the restart of VS on crash, RainbowBraces stopped working. There was no change/upgrade of VS or any extension at that time.

lordfanger commented 1 year ago

Well, I have no idea what can be wrong. Maybe some corrupted file?

Can you try download this repo, open it in Visual Studio and attach to the another instance of Visual Studio (devenv.exe) and set function breakpoints to: RainbowBraces.CreationListener.CreateTagger<T> (is called when new window is opened) RainbowBraces.RainbowTagger.ParseInternalAsync (is called every time a change occur and recalculate brace pairs)

image

And check if breakpoints are hit. If not, the extension is really somehow broken.

Also you can take a look if dll is loaded inside Visual Studio process with Modules window. image

image

haraman21 commented 1 year ago

Hi As guided I followed above steps with 1.0.147 and here are the observations:

I am not familiar with extension debugging/testing but do we also need to have the extension installed to debug its repo? RainbowBraces.dll loads in Modules window and CreateTagger breakpoint hits only when the extension is also installed. It did not load in Modules and the breakpoint did not hit when I uninstalled the extension and debugged the repo.

There were no errors in Output and Error List windows while debugging. There are no records in ActivityLog.xml

lordfanger commented 1 year ago

If extension is not installed then it can't be in Modules and no breakpoint can hit. You can debug/test the repo without extension installed in the main installation simply by debugging the project (F5). It will start the new experimental instance only with the project extension (no extensions from the main installation) and with default settings. You can try it. If it will work in experimental instance, I'll suspect some interference with another expension maybe?

To debug real instance you can use Attach to Process command. In fact you don't need the source code at all. The Visual Studio can decompile it for you. But the code will not be that nice and will be without comments. There shouldn't be any errors in Output or Error List because this extension don't report any errors and should not throw any exceptions.

Can you try again with installed extension to set breakpoint at line in finally block and check if it is hit. And if so, is in Locals tab local named $exception? image

image

lordfanger commented 1 year ago

Ah, and I forgot. Have you checked this? image