tgjones / HlslTools

A Visual Studio extension that provides enhanced support for editing High Level Shading Language (HLSL) files
http://timjones.io/blog/archive/2016/04/25/hlsl-tools-for-visual-studio-v1.0-released
Other
562 stars 97 forks source link

Crash when editing HLSL files, NavigationTargetsVisitor #72

Closed OndrejPetrzilka closed 7 years ago

OndrejPetrzilka commented 7 years ago

This crash occurs when writing or pasting HLSL code. So far I'm unable to get exact HLSL code where it happens, because my changes to HLSL are lost when VS crashes. Will update the issue when exact repro steps are found.

EDIT: It occurs quite a lot in specific cases (3x in last 10 minutes)

System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.
   at ShaderTools.Core.Text.TextSpan.FromBounds(SourceText sourceText, Int32 start, Int32 end)
   at ShaderTools.Editor.VisualStudio.Hlsl.Navigation.NavigationTargetsVisitor.<VisitVariableDeclarationStatement>d__16.MoveNext()
   at System.Linq.Enumerable.<SelectManyIterator>d__16`2.MoveNext()
   at System.Linq.Enumerable.WhereEnumerableIterator`1.MoveNext()
   at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
   at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
   at ShaderTools.Editor.VisualStudio.Hlsl.Navigation.NavigationTargetsVisitor.<GetTargets>d__5.MoveNext()
   at System.Collections.Generic.List`1.InsertRange(Int32 index, IEnumerable`1 collection)
   at ShaderTools.Editor.VisualStudio.Hlsl.Navigation.EditorNavigationSource.<>c__DisplayClass5_0.<InvalidateTargets>b__0()
   at System.Threading.Tasks.Task.InnerInvoke()
   at System.Threading.Tasks.Task.Execute()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at ShaderTools.Editor.VisualStudio.Hlsl.Navigation.EditorNavigationSource.<InvalidateTargets>d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at ShaderTools.Editor.VisualStudio.Hlsl.Navigation.EditorNavigationSource.<>c__DisplayClass3_0.<<-ctor>b__1>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at ShaderTools.Editor.VisualStudio.Core.Util.ExceptionHelper.<TryCatchCancellation>d__0.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at ShaderTools.Editor.VisualStudio.Hlsl.Navigation.EditorNavigationSource.<<-ctor>b__3_0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.<>c.<ThrowAsync>b__6_1(Object state)
   at System.Threading.QueueUserWorkItemCallback.WaitCallback_Context(Object state)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
   at System.Threading.ThreadPoolWorkQueue.Dispatch()
   at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()