madskristensen / RainbowBraces

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

Rainbow braces is causing visual studio to crash when opening certain files #16

Closed Andyc751 closed 1 year ago

Andyc751 commented 1 year ago

Visual Studio 2022 is crashing when opening a .cshtml file. (.NET Framework 4.8)

To fix the Issue, I had to disable RainbowBraces then I could open the file. A clear and concise description of what the bug is.

To Reproduce Steps to reproduce the behavior: Try to open a file it cannot handle.

When RainbowBraces is enabled and the file is opened Visual Studio Crashes. When RainbowBraces is disabled the file can open normally in Visual Studio.

Expected behavior Visual Studio not to crash.

Screenshots If applicable, add screenshots to help explain your problem.

Additional context Environment: Version 17.2.6 OS: Windows 11 Project Framework: .NET Framework 4.8

Here is the event viewer log. Application: devenv.exe Framework Version: v4.0.30319 Description: The process was terminated due to an unhandled exception. Exception Info: System.ArgumentException at Microsoft.VisualStudio.Text.SnapshotSpan.TranslateTo(Microsoft.VisualStudio.Text.ITextSnapshot, Microsoft.VisualStudio.Text.SpanTrackingMode) at Microsoft.VisualStudio.Text.Tagging.Implementation.TagAggregator1+<GetTagsForBuffer>d__49[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].MoveNext() at Microsoft.VisualStudio.Text.Tagging.Implementation.TagAggregator1+d52[[System.Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].MoveNext() at Microsoft.VisualStudio.Text.Classification.Implementation.ClassifierAggregator.InternalGetClassificationSpans(Microsoft.VisualStudio.Text.SnapshotSpan, System.Collections.Generic.IEnumerable1<Microsoft.VisualStudio.Text.Tagging.IMappingTagSpan1>) at Microsoft.VisualStudio.Text.Classification.Implementation.ClassifierAggregator.GetClassificationSpans(Microsoft.VisualStudio.Text.SnapshotSpan) at Microsoft.VisualStudio.Text.Formatting.Implementation.NormalizedSpanGenerator.CreateClassifiedRuns(Microsoft.VisualStudio.Text.SnapshotSpan, Microsoft.VisualStudio.Text.Classification.IAccurateClassifier, Microsoft.VisualStudio.Text.Classification.IClassificationFormatMap, Int32 ByRef, Int32, System.Nullable1<System.Threading.CancellationToken>) at Microsoft.VisualStudio.Text.Formatting.Implementation.NormalizedSpanGenerator.Create(Microsoft.VisualStudio.Text.Formatting.ITextAndAdornmentCollection, Microsoft.VisualStudio.Text.ITextSnapshot, Microsoft.VisualStudio.Text.Classification.IAccurateClassifier, Microsoft.VisualStudio.Text.Classification.IClassificationFormatMap, Int32, System.Nullable1) at Microsoft.VisualStudio.Text.Formatting.Implementation.FormattedLineSource.FormatLineInVisualBuffer(Microsoft.VisualStudio.Text.ITextSnapshotLine, System.Nullable1<System.Threading.CancellationToken>) at Microsoft.VisualStudio.Text.Editor.Implementation.WpfTextView.FormatSnapshotLine(Microsoft.VisualStudio.Text.ITextSnapshotLine, System.Nullable1) at Microsoft.VisualStudio.Text.Editor.Implementation.WpfTextView.LayoutRemainingLines(LayoutDescription, System.Nullable1<System.Threading.CancellationToken>, Boolean) at Microsoft.VisualStudio.Text.Editor.Implementation.WpfTextView.PerformLayout(Microsoft.VisualStudio.Text.SnapshotPoint, Double, Microsoft.VisualStudio.Text.Editor.ViewRelativePosition, Double, Double, Boolean, System.Nullable1) at Microsoft.VisualStudio.Text.Editor.Implementation.WpfTextView.PerformLayout() at Microsoft.VisualStudio.Text.Editor.Implementation.WpfTextView.b__278_1() at Microsoft.VisualStudio.Text.Editor.Implementation.WpfTextView.b__278_0() at System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32) at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate) at System.Windows.Threading.DispatcherOperation.InvokeImpl() at MS.Internal.CulturePreservingExecutionContext.CallbackWrapper(System.Object) 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.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object) at MS.Internal.CulturePreservingExecutionContext.Run(MS.Internal.CulturePreservingExecutionContext, System.Threading.ContextCallback, System.Object) at System.Windows.Threading.DispatcherOperation.Invoke() at System.Windows.Threading.Dispatcher.ProcessQueue() at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef) at MS.Win32.HwndWrapper.WndProc(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef) at MS.Win32.HwndSubclass.DispatcherCallbackOperation(System.Object) at System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32) at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate) at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(System.Windows.Threading.DispatcherPriority, System.TimeSpan, System.Delegate, System.Object, Int32) at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr, Int32, IntPtr, IntPtr)

madskristensen commented 1 year ago

@Andyc751 is this using the latest version? I disabled the rainbow braces for any HTML-style files including Razor

Andyc751 commented 1 year ago

I was using 1.0.16 (The latest at the time).

madskristensen commented 1 year ago

It should have been fixed, but I've never been able to reproduce, so I can't verify it