Art-Stea1th / Enhanced-Syntax-Highlighting

[Marketplace] Lightweight "editor classifier extension" for Visual Studio based on the async Roslyn APIs to enhanced highlighting custom tags in C# code.
https://marketplace.visualstudio.com/items?itemName=StanislavKuzmichArtStea1th.EnhancedSyntaxHighlighting
Other
76 stars 10 forks source link

extension stops working after VS2019 16.5 update #21

Open penCsharpener opened 4 years ago

penCsharpener commented 4 years ago

First, I love this extension. With my custom colors I can see immediately whether I'm dealing with a property or field.

Yesterday I was still running VS2019 16.4.6 and ESH was working fine. After the update ESH is not working at all anymore. The code highlighting has defaulted back to Visual Studio plain style. In the Font and Colors settings of VS my custom colors are still present but just not applied in the editor.

Further info: I'm using Resharper but with most features turned off. It worked before as well so can't imagine this being the issue.

flaengel commented 4 years ago

Same here.

Fuewburvpoa commented 4 years ago

Im pretty sure other have same error log but since no one posted ill leave it there. https://pastebin.com/Fw5JHETm This is ActivityLog.xml after exception being thrown. Look at record 1510, this is probably a change from MS library.

flaengel commented 4 years ago

A try/catch block made the extension work (at least looks like it for now, did not have time to investigate further what was going on), but it was really annoying to work without colors. If anyone interested in this band-aid fix.... don't judge me lol

image

penCsharpener commented 4 years ago

@flaengel is there any way for your to publish this hacky fix? I've done VS extension development yet to build my own modified version.

flaengel commented 4 years ago

Never did as well... Not sure if it is correct, but here it goes. Enhanced Syntax Highlighting.zip

penCsharpener commented 4 years ago

legend @flaengel. It worked. I should start looking into extension development. Carry so much potential for productivity.

sharwell commented 4 years ago

The fix here is to not call DeclarationModifiers.From if symbol is a INamespaceSymbol. Instead, use DeclarationModifiers.None for this case since namespaces cannot have modifiers.

flaengel commented 4 years ago

Thanks for the information @sharwell, update here :)

penCsharpener commented 4 years ago

It appears that ILocalSymbol also don't have modifiers.

Art-Stea1th commented 4 years ago

fixed in #22, Thanks

Fuewburvpoa commented 4 years ago

I've noticed that only single file was still throwing exception, then i proceed to comment out things till i found the problem. Code below would crash extension, as soon as i comment it out, coloring start working again.

  public List<string> FindByInput(string path)
  {
        return (from ret in Keys
                where ret == path
                select ret).ToList();
  }
stricq commented 4 years ago

I've noticed that only single file was still throwing exception, then i proceed to comment out things till i found the problem. Code below would crash extension, as soon as i comment it out, coloring start working again.

  public List<string> FindByInput(string path)
  {
        return (from ret in Keys
                where ret == path
                select ret).ToList();
  }

Can confirm. I have code very similar to this and the extension is crashing on this one file.

penCsharpener commented 4 years ago

trying to debug but since I'm not using linq queries like that much can you provide the other missing variables? what are the types of ret and Keys. Sounds like a dictionary...

Fuewburvpoa commented 4 years ago

Yes Keys are just Dictionary.Keys, and it looks like any linq query will reproduce this bug, something like will do it

List<string> myStrings = new List<string>();
var a = from str in myStrings select str;
Art-Stea1th commented 4 years ago

Reopened this issue, maybe someone wants to create a pull request. I will try to release these fixes as early as possible.

Regards

Ferrograph commented 2 years ago

Could be me but has this stopped working again in a new VS2019 update? Im on Version 16.11.15

I initially see the highlighting as expected when files load but then it stops and reverts. I see the same if I do a big scroll and then stop. Theres no error or exception.

Are there any logs I can examine?