aspnet / RazorTooling

Razor tooling for Visual Studio 2015

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

VS2015 RTM insta-crash in Razor editor while using custom tag helper

Eilon opened this issue · comments

Scenario / repro:

  1. I had an ASP.NET 5 app, plus a separate DNX class lib project with a rather trivial tag helper
  2. The tag helper did almost nothing: it had a simple Process method, an int property, and a string property
  3. I added @addTagHelper to my ViewImports, then tried using the tag helper from a view
  4. In the view I typed <cool my-int="123" my-string= and when I did that last = sign VS insta-crashed

I'm running VS2015 RTM from D14Rel 23017.0 (I do not have any extra WTE installed). I am however using the latest "beta5" build of the runtime, which is newer than what came with my VS build.

This repros every time on this build. You can download my project from here: https://microsoft-my.sharepoint.com/personal/elipton_microsoft_com/Documents/Shared%20with%20Everyone/WebApplication21.zip

Just go to Index.cshtml and use the <cool ... tag helper and auto-complete the properties.

Here's what's in my event log:

Fault bucket 128857971248, type 5
Event Name: CLR20r3
Response: Not available
Cab Id: 0

Problem signature:
P1: devenv.exe
P2: 14.0.23017.0
P3: 558111f5
P4: Microsoft.VisualStudio.Web.Editors.Razor.4_0
P5: 14.0.60610.0
P6: 5578b4a9
P7: e7
P8: 7
P9: System.InvalidOperationException
P10: 

Attached files:
C:\Users\elipton\AppData\Local\Microsoft\VSCommon\14.0\SQM\sqmdata.cvr
C:\Users\elipton\AppData\Local\Temp\WER73D7.tmp.WERInternalMetadata.xml

These files may be available here:
C:\Users\elipton\AppData\Local\Microsoft\Windows\WER\ReportArchive\AppCrash_devenv.exe_62d71d5719b06b52503a8cb8961e1e38c9fc194a_f1a8d2b9_221e8bc4

Analysis symbol: 
Rechecking for solution: 0
Report Id: 6522e152-1578-11e5-bf0b-f4b7e2e75de6
Report Status: 0
Hashed bucket: 97675f818b068d88d589f6a99c397048

And this stack trace was also in the event log:

Application: devenv.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.InvalidOperationException
Stack:
   at System.Collections.Generic.ArraySortHelper`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].Sort(System.__Canon[], Int32, Int32, System.Collections.Generic.IComparer`1<System.__Canon>)
   at System.Array.Sort[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]](System.__Canon[], Int32, Int32, System.Collections.Generic.IComparer`1<System.__Canon>)
   at System.Collections.Generic.List`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].Sort(System.Comparison`1<System.__Canon>)
   at Microsoft.VisualStudio.Web.Editors.Razor.RazorCodeGenerator.AppendFlattenedSpans(Microsoft.AspNet.Razor.Parser.SyntaxTree.SyntaxTreeNode, System.Collections.Generic.List`1<Microsoft.AspNet.Razor.Parser.SyntaxTree.Span>)
   at Microsoft.VisualStudio.Web.Editors.Razor.RazorCodeGenerator.AppendFlattenedSpans(Microsoft.AspNet.Razor.Parser.SyntaxTree.SyntaxTreeNode, System.Collections.Generic.List`1<Microsoft.AspNet.Razor.Parser.SyntaxTree.Span>)
   at Microsoft.VisualStudio.Web.Editors.Razor.RazorCodeGenerator.DocumentParseCompleteMainThread()
   at Microsoft.VisualStudio.Web.Editors.Razor.RazorCodeGenerator.<OnDocumentParseComplete>b__39_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 System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(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 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)

@NTaylorMullen @ToddGrun @barrytang found this while doing RTM sign-off. However, this wasn't with the new WTE, so I will try that tomorrow.

Note that this does not seem to crash when I install the latest WTE. It would be good to still take a quick look at this to see if there might be a bug lurking in there anyway.

Might be a version mismatch. Maybe the old WTE had super old razor binaries

@ToddGrun is this the exception you said you hit the other day prior to updating to new bits?

There were lots of issues prior to getting the latest bits, hard to know what happened here without debugging it.

Yeah my real concern here is not this exact crash per se, but rather a concern about if "something weird" happens in the Razor editor due to a mismatch, should my whole IDE insta-crash and I lose my progress. VS2015 RTM of course has to work with beta5, beta6, and perhaps beyond, so I want us to be sure that certain types of incompatibilities are safe.

The crash you saw was caused by the binaries that are shipped with VS itself. From my understanding (@ToddGrun correct me if i'm wrong) those binaries will be replaced when new WTE's are installed and limit the impact of a user moving from RC => RTM => U1 etc.

Should definitely play around with upgrade scenarios though, just trying to clarify where the problem existed/the concern surrounding it.

We could activity log the exception rather than letting it escape us and bring down VS, I suppose

@NTaylorMullen @ToddGrun, what happen when you have Dev14 RC + Beta 5 packages?

Adding @danroth27 as FYI too.

@barrytang Tried this out on an RC VS with beta5 packages after upgrading and no problems.

Thank you!