Skip to content
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 #16193

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

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

aguacongas opened this issue Apr 18, 2018 · 16 comments
Assignees
Labels
area-blazor Includes: Blazor, Razor Components

Comments

@aguacongas
Copy link
Contributor

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
Copy link
Contributor

SIkebe commented Apr 18, 2018

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

@aguacongas
Copy link
Contributor Author

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
Copy link
Contributor Author

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
Copy link
Member

@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
Copy link

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
Copy link
Contributor Author

@floreseken delete .vs folder, it should fix it

@rynowak
Copy link
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
@floreseken
Copy link

Thanks @aguacongas ! that worked.

@SteveSandersonMS
Copy link
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
Copy link
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
Copy link

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
Copy link
Member

I hit this a couple of times as well when investigating https://github.com/aspnet/Blazor/issues/610

rynowak referenced this issue in dotnet/blazor Apr 19, 2018
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 referenced this issue in dotnet/blazor Apr 19, 2018
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 referenced this issue in dotnet/blazor Apr 19, 2018
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 referenced this issue in dotnet/blazor Apr 19, 2018
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 reopened this Apr 19, 2018
@rynowak
Copy link
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
Copy link
Member

@rynowak Your fix for that is bc786e0253947dea35e5984531b026d446cef3ec, 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
Copy link
Member

rynowak commented Apr 19, 2018

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

SteveSandersonMS referenced this issue in dotnet/blazor Apr 19, 2018
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
Copy link
Member

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).

SteveSandersonMS referenced this issue in SteveSandersonMS/BlazorMigration Nov 27, 2018
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.
@mkArtakMSFT mkArtakMSFT transferred this issue from dotnet/blazor Oct 27, 2019
@mkArtakMSFT mkArtakMSFT added the area-blazor Includes: Blazor, Razor Components label Oct 27, 2019
@ghost ghost locked as resolved and limited conversation to collaborators Dec 4, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-blazor Includes: Blazor, Razor Components
Projects
None yet
Development

No branches or pull requests

8 participants