danielscherzer / GLSL

VSIX Project that provides GLSL language integration.
258 stars 28 forks source link

Visual Studio crashes when using Code search for files #125

Closed Genhis closed 6 months ago

Genhis commented 6 months ago

Installed product versions

Description

Visual Studio crashes when using Code search for file names, likely because it wants to show a preview of a GLSL file. When it's reopened again, it shows this message:

A previous session ended unexpectedly. Disabling the extension GLSL language integration (for VS2022) 0.11.171 might help.

Disabling the extension indeed fixes the problem. The crash isn't consistent, but I can reproduce it quite frequently. I think it started occuring after I updated VS to 17.9.5 from 17.7.

Application: devenv.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.ArgumentException
   at System.IO.Path.NormalizePath(System.String, Boolean, Int32, Boolean)
   at System.IO.Path.InternalGetDirectoryName(System.String)
   at DMS.GLSL.Errors.SquiggleTaggerProvider+<>c__DisplayClass1_1`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].<CreateTagger>g__RequestCompileShader|4(System.String)
   at System.Reactive.AnonymousSafeObserver`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].OnNext(System.__Canon)
   at System.Reactive.Linq.ObservableImpl.Throttle`1+_[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].Propagate(UInt64)
   at System.Reactive.Concurrency.Scheduler.Invoke[[System.ValueTuple`2[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.UInt64, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]](System.ValueTuple`2<System.ValueTuple`2<System.__Canon,UInt64>,System.Action`1<System.ValueTuple`2<System.__Canon,UInt64>>>)
   at System.Reactive.Concurrency.Scheduler+<>c__78`1[[System.ValueTuple`2[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.UInt64, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].<ScheduleAction>b__78_0(System.Reactive.Concurrency.IScheduler, System.ValueTuple`2<System.ValueTuple`2<System.__Canon,UInt64>,System.Action`1<System.ValueTuple`2<System.__Canon,UInt64>>>)
   at System.Reactive.Concurrency.UserWorkItem`1[[System.ValueTuple`2[[System.ValueTuple`2[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.UInt64, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].Run()
   at System.Reactive.Concurrency.ConcurrencyAbstractionLayerImpl+Timer.Tick()
   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.TimerQueueTimer.CallCallback()
   at System.Threading.TimerQueueTimer.Fire()
   at System.Threading.TimerQueue.FireNextTimers()

Steps to recreate

  1. Have GLSL files in your project.
  2. Open "Code seach" for files and look up one of GLSL files.
  3. Visual Studio crashes (sometimes).

EDIT: It crashes even if I search for other files. I usually start typing as soon as I open the search window.

danielscherzer commented 6 months ago

Hi, thanks for your feedback. I could not reproduce the error with 17.9.4. Updating... A colleague of mine and me could not reproduce the error with 17.9.6. Maybe an update to 17.9.6. helps?

Genhis commented 6 months ago

I do have 17.9.6 and crashes are frequent. I wish I could provide a simple example which would consistently reproduce it. I am happy to try anything you suggest.

It seems Path.GetDirectoryName() throws ArgumentException if given an empty path, could this happen in any way? E.g. because of SquiggleTaggerProvider.cs#L78?

Genhis commented 6 months ago

I bet this is the cause: aaac0f49550bb50b36ecd8f58922746f36a192cc. I might have updated the extension in the past together with Visual Studio and it started crashing since then.

EDIT: I downloaded v0.11.167 which doesn't have this commit and it works nicely, no crashes so far.

danielscherzer commented 6 months ago

Thanks for your error analysis. I uploaded a new version that hopefully fixes this issue.

Genhis commented 6 months ago

Thanks, it seems to have solved the problem. I will keep using the new version and report back if I find any issues.

danielscherzer commented 6 months ago

Thanks!