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
561 stars 97 forks source link

Version 1.1.3001 crash #189

Closed JSeb-92 closed 3 years ago

JSeb-92 commented 4 years ago

Hello, here is the Visual Studio 2017 log `

652
<time>2020/03/06 09:18:36.590</time>
<type>Error</type>
<source>Editor or Editor Extension</source>
<description>System.AggregateException: One or more errors occurred. ---&gt; System.InvalidCastException: Specified cast is not valid.&#x000D;&#x000A;   at ShaderTools.CodeAnalysis.Options.OptionSet.GetOption[T](Option`1 option)&#x000D;&#x000A;   at ShaderTools.CodeAnalysis.Hlsl.Options.HlslOptionsService.GetFormattingOptions(OptionSet options)&#x000D;&#x000A;   at ShaderTools.CodeAnalysis.Editor.Hlsl.Formatting.HlslEditorFormattingService.&lt;GetFormattingChangesAsync&gt;d__12.MoveNext()&#x000D;&#x000A;--- End of stack trace from previous location where exception was thrown ---&#x000D;&#x000A;   at Microsoft.VisualStudio.Telemetry.WindowsErrorReporting.WatsonReport.GetClrWatsonExceptionInfo(Exception exceptionObject)&#x000D;&#x000A;   --- End of inner exception stack trace ---&#x000D;&#x000A;   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)&#x000D;&#x000A;   at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)&#x000D;&#x000A;   at ShaderTools.CodeAnalysis.Editor.Implementation.Formatting.FormatCommandHandler.TryFormat(ITextView textView, Document document, IEditorFormattingService formattingService, Char typedChar, Int32 position, Boolean formatOnReturn, CancellationToken cancellationToken)&#x000D;&#x000A;   at ShaderTools.CodeAnalysis.Editor.Implementation.Formatting.FormatCommandHandler.ExecuteReturnOrTypeCommand(EditorCommandArgs args, Action nextHandler, CancellationToken cancellationToken)&#x000D;&#x000A;   at ShaderTools.CodeAnalysis.Editor.Implementation.Formatting.FormatCommandHandler.ExecuteCommand(TypeCharCommandArgs args, Action nextHandler, CommandExecutionContext context)&#x000D;&#x000A;   at Microsoft.VisualStudio.Commanding.CommandHandlerExtensions.ExecuteCommand[T](ICommandHandler commandHandler, T args, Action nextCommandHandler, CommandExecutionContext executionContext)&#x000D;&#x000A;   at Microsoft.VisualStudio.UI.Text.Commanding.Implementation.EditorCommandHandlerService.&lt;&gt;c__DisplayClass14_1`1.&lt;Execute&gt;b__1()&#x000D;&#x000A;   at Microsoft.VisualStudio.Text.Utilities.GuardedOperations.CallExtensionPoint(Object errorSource, Action call, Predicate`1 exceptionFilter)&#x000D;&#x000A;---&gt; (Inner Exception #0) System.InvalidCastException: Specified cast is not valid.&#x000D;&#x000A;   at ShaderTools.CodeAnalysis.Options.OptionSet.GetOption[T](Option`1 option)&#x000D;&#x000A;   at ShaderTools.CodeAnalysis.Hlsl.Options.HlslOptionsService.GetFormattingOptions(OptionSet options)&#x000D;&#x000A;   at ShaderTools.CodeAnalysis.Editor.Hlsl.Formatting.HlslEditorFormattingService.&lt;GetFormattingChangesAsync&gt;d__12.MoveNext()&#x000D;&#x000A;--- End of stack trace from previous location where exception was thrown ---&#x000D;&#x000A;   at Microsoft.VisualStudio.Telemetry.WindowsErrorReporting.WatsonReport.GetClrWatsonExceptionInfo(Exception exceptionObject)&lt;---&#x000D;&#x000A;</description>

`

DigitalJokerMan commented 4 years ago

I'm also getting this issue. It only appears once, which seems to be whenever I use Intellisense on an HLSL file for the first time in a session. I'm not entirely sure, but I think this might also be the cause of some issues I'm getting where the extensions seems to just want to duplicate things, like semicolons, brackets, and things that I paste in.

tgjones commented 3 years ago

Apologies for the long delay - I didn't know what the problem was here, but @PiezPiedPy found both the bug and the solution, so it's fixed now. I'll release a new version shortly.