Skip to content
This repository has been archived by the owner on Dec 19, 2018. It is now read-only.

Crash in VS when editing @(@ #804

Closed
jodavis opened this issue Jul 15, 2016 · 1 comment
Closed

Crash in VS when editing @(@ #804

jodavis opened this issue Jul 15, 2016 · 1 comment
Assignees

Comments

@jodavis
Copy link

jodavis commented Jul 15, 2016

Create a new MVC View Page in an ASP.NET Core Web Application, and add the following at the top of the view page:

@{
    var @do = "do";
}

Then attempt to type <div>@(@do) in the view page.

Result:
VS crashes shortly after @(@

System.InvalidCastException: Unable to cast object of type 'Microsoft.AspNetCore.Razor.Chunks.TemplateChunk' to type 'Microsoft.AspNetCore.Razor.Chunks.ExpressionChunk'.
   at Microsoft.AspNetCore.Razor.CodeGenerators.Visitors.CSharpCodeVisitor.RenderDesignTimeExpressionBlockChunk(ExpressionBlockChunk chunk)
   at Microsoft.AspNetCore.Razor.CodeGenerators.Visitors.CSharpCodeVisitor.Visit(ExpressionBlockChunk chunk)
   at Microsoft.AspNetCore.Razor.CodeGenerators.Visitors.ChunkVisitor`1.Accept(Chunk chunk)
   at Microsoft.AspNetCore.Razor.CodeGenerators.Visitors.ChunkVisitor`1.Accept(IList`1 chunks)
   at Microsoft.AspNetCore.Razor.CodeGenerators.CSharpCodeGenerator.Generate()
   at Microsoft.AspNetCore.Razor.RazorTemplateEngine.GenerateCodeCore(ITextDocument input, String className, String rootNamespace, String sourceFileName, String checksum, Nullable`1 cancelToken)
   at Microsoft.AspNetCore.Razor.RazorTemplateEngine.GenerateCode(ITextBuffer input, String className, String rootNamespace, String sourceFileName, Nullable`1 cancelToken)
   at Microsoft.AspNetCore.Razor.Editor.BackgroundParser.BackgroundThread.ParseChange(ITextBuffer buffer, CancellationToken token)
   at Microsoft.AspNetCore.Razor.Editor.BackgroundParser.BackgroundThread.WorkerLoop()
   at System.Threading.ThreadHelper.ThreadStart_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.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ThreadHelper.ThreadStart()
@Eilon Eilon added this to the 1.1.0 milestone Jul 18, 2016
@Eilon
Copy link
Member

Eilon commented Jul 18, 2016

@NTaylorMullen FYI.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants