New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ASP.NET Core Blazor Language Services 15.7.10222 crash VS #597

Closed
aguacongas opened this Issue Apr 18, 2018 · 16 comments

Comments

Projects
None yet
7 participants
@aguacongas
Contributor

aguacongas commented Apr 18, 2018

I had VS crashes after updating Blazor extension

An unhandled exception of type 'System.InvalidOperationException' occurred in Microsoft.AspNetCore.Blazor.Razor.Extensions.dll

Additional information: Attribute nodes should either be minimized or a single content node.

@SIkebe

This comment has been minimized.

SIkebe commented Apr 18, 2018

@aguacongas Output dotnet --info?
Did you install .NET Core SDK 2.1.300-preview2-008533 ?

@aguacongas

This comment has been minimized.

Contributor

aguacongas commented Apr 18, 2018

dotnet --info
.NET Core SDK (reflecting any global.json):
 Version:   2.1.300-preview2-008533
 Commit:    996eb6c92c

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.15063
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\2.1.300-preview2-008533\

Host (useful for support):
  Version: 2.1.0-preview2-26406-04
  Commit:  6833f3026b

.NET Core SDKs installed:
  1.0.0 [C:\Program Files\dotnet\sdk]
  1.0.3 [C:\Program Files\dotnet\sdk]
  1.0.4 [C:\Program Files\dotnet\sdk]
  1.1.0 [C:\Program Files\dotnet\sdk]
  2.0.0 [C:\Program Files\dotnet\sdk]
  2.0.2 [C:\Program Files\dotnet\sdk]
  2.0.3 [C:\Program Files\dotnet\sdk]
  2.1.103 [C:\Program Files\dotnet\sdk]
  2.1.104 [C:\Program Files\dotnet\sdk]
  2.1.200-preview-007517 [C:\Program Files\dotnet\sdk]
  2.1.300-preview1-008174 [C:\Program Files\dotnet\sdk]
  2.1.300-preview2-008530 [C:\Program Files\dotnet\sdk]
  2.1.300-preview2-008533 [C:\Program Files\dotnet\sdk]

.NET Core runtimes installed:
  Microsoft.AspNetCore.All 2.1.0-preview1-final [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.1.0-preview2-final [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.App 2.1.0-preview1-final [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.1.0-preview2-final [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 1.0.1 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 1.0.4 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 1.0.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 1.1.1 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 1.1.2 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.0.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.0.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.0.6 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.0-preview1-26216-03 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.0-preview2-26406-04 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]

To install additional .NET Core runtimes or SDKs:
  https://aka.ms/dotnet-download
@aguacongas

This comment has been minimized.

Contributor

aguacongas commented Apr 18, 2018

It occurs each time I try to update :

<UserName Class="form-control" Value=@userName OnError=@OnError></UserName>

to

<UserName Class="form-control" bind-Value=@userName OnError=@OnError></UserName>
@SteveSandersonMS

This comment has been minimized.

Member

SteveSandersonMS commented Apr 18, 2018

@rynowak This does repro. After creating the minimal UserName.cshtml for the above code to be valid, performing that edit (then alt-tabbing out of VS then back in, for some reason) made VS hang and eventually get shut down by the OS. Is this something you could investigate when convenient?

@floreseken

This comment has been minimized.

floreseken commented Apr 18, 2018

I'm having also troubles loading my blazor solution, this was working fine with 0.1.
VS keeps saying "Repairing solution" just forever. If I exclude my blazor project I loads fine.

Separate (without the solution) the blazor project loads fine.
So only the combination fails.

@aguacongas

This comment has been minimized.

Contributor

aguacongas commented Apr 18, 2018

@floreseken delete .vs folder, it should fix it

@rynowak

This comment has been minimized.

Member

rynowak commented Apr 18, 2018

I unfortunately won't have access to a windows machine until Saturday. I'm at a conference and mine blew up. I'll try to write a test that reproduces the issue

@rynowak rynowak self-assigned this Apr 18, 2018

@rynowak rynowak added the investigate label Apr 18, 2018

@floreseken

This comment has been minimized.

floreseken commented Apr 18, 2018

Thanks @aguacongas ! that worked.

@SteveSandersonMS

This comment has been minimized.

Member

SteveSandersonMS commented Apr 18, 2018

@rynowak No worries - not urgent.

Update: Simpler repro is:

  • Create new project
  • Open Index.cshtml
  • Type <Counter bind-x="y" />
  • Alt-tab away from VS, then try to alt-tab back
@rynowak

This comment has been minimized.

Member

rynowak commented Apr 18, 2018

I haven't been able to write a unit test that reproduces the problem. I don't have access to a VS environment right now :(

The exception is here: https://github.com/aspnet/Blazor/blob/dev/src/Microsoft.AspNetCore.Blazor.Razor.Extensions/BlazorDesignTimeNodeWriter.cs#L424

My bet is that something in the bind lowering phase is rewriting this node incorrectly.

The reason why tabbing back and away causes the crash is that VS uses that as a trigger to force the generated code to update. Normal edits don't trigger a full code generation pass, they attempt to reuse and modify the existing codegen where possible.

@EdCharbeneau

This comment has been minimized.

EdCharbeneau commented Apr 18, 2018

I'm having the same issue. I have per the example in the Blazor 0.2.0 release notes on MSDN.

When I type bind-Content on my component, VS instantly freezes and crashes with the error: ASP.NET Core Blazor Language Services 15.7.10222 ....

Component code (reduced for clarity)

   public string Content { get; set; }
    public string FromUrl { get; set; }
    public Action<string> ContentChanged { get; set; }

Index.cshtml

<MyComponent bind-Content="@ContentValue"/>

@functions {
 public string ContentValue { get; set; } = "Let's do it";
}
@danroth27

This comment has been minimized.

Member

danroth27 commented Apr 18, 2018

I hit this a couple of times as well when investigating #610

rynowak added a commit that referenced this issue Apr 19, 2018

Fix #597 Allow multiple tokens in attributes
The issue here is that we were missing tests for the design time code
path. We have tests that the bind-... cases work at runtime but were
missing coverage for the editor.

I took the most relevant set of the tests for running bind-... code and
added them to the tests for codegen.

rynowak added a commit that referenced this issue Apr 19, 2018

Fix #597 Allow multiple tokens in attributes
The issue here is that we were missing tests for the design time code
path. We have tests that the bind-... cases work at runtime but were
missing coverage for the editor.

I took the most relevant set of the tests for running bind-... code and
added them to the tests for codegen.

rynowak added a commit that referenced this issue Apr 19, 2018

Fix #597 Allow multiple tokens in attributes
The issue here is that we were missing tests for the design time code
path. We have tests that the bind-... cases work at runtime but were
missing coverage for the editor.

I took the most relevant set of the tests for running bind-... code and
added them to the tests for codegen.

rynowak added a commit that referenced this issue Apr 19, 2018

Fix #597 Allow multiple tokens in attributes
The issue here is that we were missing tests for the design time code
path. We have tests that the bind-... cases work at runtime but were
missing coverage for the editor.

I took the most relevant set of the tests for running bind-... code and
added them to the tests for codegen.

@rynowak rynowak closed this in bc786e0 Apr 19, 2018

@rynowak rynowak reopened this Apr 19, 2018

@rynowak

This comment has been minimized.

Member

rynowak commented Apr 19, 2018

We've fixed the problem in the compiler. Keeping this open for now since folks with the 0.2.0 tooling will still hit it.

@SteveSandersonMS

This comment has been minimized.

Member

SteveSandersonMS commented Apr 19, 2018

@rynowak Your fix for that is bc786e0, right? I'm going to cherry-pick that over into a new release/0.2.1 branch (taken from release/0.2.0). Do you believe that's the only commit needed to fix the crashing issue, and the only thing we should release as 0.2.1? Dan and I would like to put this out as soon as we can.

@rynowak

This comment has been minimized.

Member

rynowak commented Apr 19, 2018

Yeah, that's what I had in mind. Sounds good

SteveSandersonMS added a commit that referenced this issue Apr 19, 2018

Fix #597 Allow multiple tokens in attributes
The issue here is that we were missing tests for the design time code
path. We have tests that the bind-... cases work at runtime but were
missing coverage for the editor.

I took the most relevant set of the tests for running bind-... code and
added them to the tests for codegen.
@SteveSandersonMS

This comment has been minimized.

Member

SteveSandersonMS commented Apr 20, 2018

The fix for this is now published in the 0.2.1 release.

How to update

You only need to update your Visual Studio extension. In VS, go to Tools, then Extensions and Updates, then in Updates select the Visual Studio Marketplace item. It should prompt you to update the ASP.NET Core Blazor Language Services extension to version 15.7.10237 (or later, depending on when you're reading this). Update to the latest version.

You don't need to update your project to the newly-released 0.2.1 package versions. You can do if you want to, but it makes no difference as they are identical to the 0.2.0 packages. The only reason we published updated 0.2.1 packages is because newly-created projects will reference 0.2.1 (our build system updates this automatically).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment