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

Broken Razor editing in default Blazor Server app with .NET 5 #4769

Closed
danroth27 opened this issue Jun 25, 2021 · 9 comments · Fixed by #3930 or dotnet/vscode-csharp#4642
Closed

Broken Razor editing in default Blazor Server app with .NET 5 #4769

danroth27 opened this issue Jun 25, 2021 · 9 comments · Fixed by #3930 or dotnet/vscode-csharp#4642
Assignees
Milestone

Comments

@danroth27
Copy link
Member

Is this a Bug or Feature request?:

Bug

Steps to reproduce

Install .NET 5 SDK
Create Blazor Server app
Open in VS Code
Open Index.razor.

Description of the problem:

Survey component isn't recognized.

Expected behavior:

Full Razor intellisense and editing experience without errors

Actual behavior:

Errors for Survey component

image

Logs

OmniSharp

Starting OmniSharp server at 6/28/2021, 1:55:09 PM
    Target: c:\Users\WDAGUtilityAccount\Desktop\BlazorApp

OmniSharp server started.
    Path: c:\Users\WDAGUtilityAccount\.vscode\extensions\ms-dotnettools.csharp-1.23.12\.omnisharp\1.37.10\OmniSharp.exe
    PID: 7064

[info]: OmniSharp.Stdio.Host
        Starting OmniSharp on Windows 6.2.9200.0 (x64)
[info]: OmniSharp.Services.DotNetCliService
        DotNetPath set to dotnet
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Located 1 MSBuild instance(s)
            1: StandAlone 16.11.0 - "c:\Users\WDAGUtilityAccount\.vscode\extensions\ms-dotnettools.csharp-1.23.12\.omnisharp\1.37.10\.msbuild\Current\Bin"
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        MSBUILD_EXE_PATH environment variable set to 'c:\Users\WDAGUtilityAccount\.vscode\extensions\ms-dotnettools.csharp-1.23.12\.omnisharp\1.37.10\.msbuild\Current\Bin\MSBuild.exe'
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Registered MSBuild instance: StandAlone 16.11.0 - "c:\Users\WDAGUtilityAccount\.vscode\extensions\ms-dotnettools.csharp-1.23.12\.omnisharp\1.37.10\.msbuild\Current\Bin"
            CscToolExe = csc.exe
            CscToolPath = c:\Users\WDAGUtilityAccount\.vscode\extensions\ms-dotnettools.csharp-1.23.12\.omnisharp\1.37.10\.msbuild\Current\Bin\Roslyn
            MSBuildExtensionsPath = c:\Users\WDAGUtilityAccount\.vscode\extensions\ms-dotnettools.csharp-1.23.12\.omnisharp\1.37.10\.msbuild
            MSBuildToolsPath = c:\Users\WDAGUtilityAccount\.vscode\extensions\ms-dotnettools.csharp-1.23.12\.omnisharp\1.37.10\.msbuild\Current\Bin
[info]: OmniSharp.WorkspaceInitializer
        Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.CSharpFormattingWorkspaceOptionsProvider, Order: 0
[info]: OmniSharp.WorkspaceInitializer
        Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.Completion.CompletionOptionsProvider, Order: 0
[info]: OmniSharp.WorkspaceInitializer
        Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.RenameWorkspaceOptionsProvider, Order: 100
[info]: OmniSharp.WorkspaceInitializer
        Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.ImplementTypeWorkspaceOptionsProvider, Order: 110
[info]: OmniSharp.WorkspaceInitializer
        Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.BlockStructureWorkspaceOptionsProvider, Order: 140
[info]: OmniSharp.Cake.CakeProjectSystem
        Detecting Cake files in 'c:\Users\WDAGUtilityAccount\Desktop\BlazorApp'.
[info]: OmniSharp.Cake.CakeProjectSystem
        Could not find any Cake files
[info]: OmniSharp.MSBuild.ProjectSystem
        No solution files found in 'c:\Users\WDAGUtilityAccount\Desktop\BlazorApp'
[info]: OmniSharp.MSBuild.ProjectManager
        Queue project update for 'c:\Users\WDAGUtilityAccount\Desktop\BlazorApp\BlazorApp.csproj'
[info]: OmniSharp.Script.ScriptProjectSystem
        Detecting CSX files in 'c:\Users\WDAGUtilityAccount\Desktop\BlazorApp'.
[info]: OmniSharp.Script.ScriptProjectSystem
        Could not find any CSX files
[info]: OmniSharp.WorkspaceInitializer
        Configuration finished.
[info]: OmniSharp.Stdio.Host
        Omnisharp server running using Stdio at location 'c:\Users\WDAGUtilityAccount\Desktop\BlazorApp' on host 6644.
[info]: OmniSharp.MSBuild.ProjectManager
        Loading project: c:\Users\WDAGUtilityAccount\Desktop\BlazorApp\BlazorApp.csproj
[info]: OmniSharp.MSBuild.ProjectManager
        Successfully loaded project file 'c:\Users\WDAGUtilityAccount\Desktop\BlazorApp\BlazorApp.csproj'.
[info]: OmniSharp.MSBuild.ProjectManager
        Adding project 'c:\Users\WDAGUtilityAccount\Desktop\BlazorApp\BlazorApp.csproj'
[info]: OmniSharp.MSBuild.ProjectManager
        Update project: BlazorApp

Razor

Expand

[Client - 1:52:32 PM] -- Starting Issue Data Collection-- 
[Client - 1:52:33 PM] Notifying document 'c:\Users\anonymous\Desktop\BlazorApp\Pages\Index.razor' changed 'closed'
[Client - 1:52:35 PM] Notifying document 'c:\Users\anonymous\Desktop\BlazorApp\Pages\Index.razor' changed 'opened'
[Client - 1:52:35 PM] Updating the C# document for Razor file 'c:/Users/anonymous/Desktop/BlazorApp/Pages/Index.razor' (1)
[Client - 1:52:35 PM] Notifying document 'c:\Users\anonymous\Desktop\BlazorApp\Pages\Index.razor' changed 'csharpChanged'
[Client - 1:52:35 PM] Updating the HTML document for Razor file 'c:/Users/anonymous/Desktop/BlazorApp/Pages/Index.razor' (1)
[Client - 1:52:35 PM] Notifying document 'c:\Users\anonymous\Desktop\BlazorApp\Pages\Index.razor' changed 'htmlChanged'
[Client - 1:52:45 PM] -- Stopping Issue Data Collection-- 

Workspace information

Razor document:

Expand

@page "/"

<h1>Hello, world!</h1>

Welcome to your new app.

<SurveyPrompt Title="How is Blazor working for you?" />

Projected CSharp document:

Expand

////////////////////// Projected CSharp as seen by extension ///////////////////////
// <auto-generated/>
#pragma warning disable 1591
namespace __GeneratedComponent
{
    #line hidden
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Threading.Tasks;
    using Microsoft.AspNetCore.Components;
#nullable restore
#line 1 "c:/Users/anonymous/Desktop/BlazorApp/_Imports.razor"
using System.Net.Http;

#line default
#line hidden
#nullable disable
#nullable restore
#line 2 "c:/Users/anonymous/Desktop/BlazorApp/_Imports.razor"
using Microsoft.AspNetCore.Authorization;

#line default
#line hidden
#nullable disable
#nullable restore
#line 3 "c:/Users/anonymous/Desktop/BlazorApp/_Imports.razor"
using Microsoft.AspNetCore.Components.Authorization;

#line default
#line hidden
#nullable disable
#nullable restore
#line 4 "c:/Users/anonymous/Desktop/BlazorApp/_Imports.razor"
using Microsoft.AspNetCore.Components.Forms;

#line default
#line hidden
#nullable disable
#nullable restore
#line 5 "c:/Users/anonymous/Desktop/BlazorApp/_Imports.razor"
using Microsoft.AspNetCore.Components.Routing;

#line default
#line hidden
#nullable disable
#nullable restore
#line 6 "c:/Users/anonymous/Desktop/BlazorApp/_Imports.razor"
using Microsoft.AspNetCore.Components.Web;

#line default
#line hidden
#nullable disable
#nullable restore
#line 7 "c:/Users/anonymous/Desktop/BlazorApp/_Imports.razor"
using Microsoft.AspNetCore.Components.Web.Virtualization;

#line default
#line hidden
#nullable disable
#nullable restore
#line 8 "c:/Users/anonymous/Desktop/BlazorApp/_Imports.razor"
using Microsoft.JSInterop;

#line default
#line hidden
#nullable disable
#nullable restore
#line 9 "c:/Users/anonymous/Desktop/BlazorApp/_Imports.razor"
using BlazorApp;

#line default
#line hidden
#nullable disable
#nullable restore
#line 10 "c:/Users/anonymous/Desktop/BlazorApp/_Imports.razor"
using BlazorApp.Shared;

#line default
#line hidden
#nullable disable
    [Microsoft.AspNetCore.Components.RouteAttribute("/")]
    public partial class AspNetCore_839027db1720f1bc6976286f4d4a958fc6156c73 : Microsoft.AspNetCore.Components.ComponentBase
    {
        #pragma warning disable 219
        private void __RazorDirectiveTokenHelpers__() {
        ((System.Action)(() => {
#nullable restore
#line 1 "c:/Users/anonymous/Desktop/BlazorApp/Pages/Index.razor"
global::System.Object __typeHelper = "/";

#line default
#line hidden
#nullable disable
        }
        ))();
        }
        #pragma warning restore 219
        #pragma warning disable 0414
        private static System.Object __o = null;
        #pragma warning restore 0414
        #pragma warning disable 1998
        protected override void BuildRenderTree(Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder)
        {
        }
        #pragma warning restore 1998
    }
}
#pragma warning restore 1591



////////////////////// Projected CSharp as seen by VSCode ///////////////////////
// <auto-generated/>
#pragma warning disable 1591
namespace __GeneratedComponent
{
    #line hidden
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Threading.Tasks;
    using Microsoft.AspNetCore.Components;
#nullable restore
#line 1 "c:/Users/anonymous/Desktop/BlazorApp/_Imports.razor"
using System.Net.Http;

#line default
#line hidden
#nullable disable
#nullable restore
#line 2 "c:/Users/anonymous/Desktop/BlazorApp/_Imports.razor"
using Microsoft.AspNetCore.Authorization;

#line default
#line hidden
#nullable disable
#nullable restore
#line 3 "c:/Users/anonymous/Desktop/BlazorApp/_Imports.razor"
using Microsoft.AspNetCore.Components.Authorization;

#line default
#line hidden
#nullable disable
#nullable restore
#line 4 "c:/Users/anonymous/Desktop/BlazorApp/_Imports.razor"
using Microsoft.AspNetCore.Components.Forms;

#line default
#line hidden
#nullable disable
#nullable restore
#line 5 "c:/Users/anonymous/Desktop/BlazorApp/_Imports.razor"
using Microsoft.AspNetCore.Components.Routing;

#line default
#line hidden
#nullable disable
#nullable restore
#line 6 "c:/Users/anonymous/Desktop/BlazorApp/_Imports.razor"
using Microsoft.AspNetCore.Components.Web;

#line default
#line hidden
#nullable disable
#nullable restore
#line 7 "c:/Users/anonymous/Desktop/BlazorApp/_Imports.razor"
using Microsoft.AspNetCore.Components.Web.Virtualization;

#line default
#line hidden
#nullable disable
#nullable restore
#line 8 "c:/Users/anonymous/Desktop/BlazorApp/_Imports.razor"
using Microsoft.JSInterop;

#line default
#line hidden
#nullable disable
#nullable restore
#line 9 "c:/Users/anonymous/Desktop/BlazorApp/_Imports.razor"
using BlazorApp;

#line default
#line hidden
#nullable disable
#nullable restore
#line 10 "c:/Users/anonymous/Desktop/BlazorApp/_Imports.razor"
using BlazorApp.Shared;

#line default
#line hidden
#nullable disable
    [Microsoft.AspNetCore.Components.RouteAttribute("/")]
    public partial class AspNetCore_839027db1720f1bc6976286f4d4a958fc6156c73 : Microsoft.AspNetCore.Components.ComponentBase
    {
        #pragma warning disable 219
        private void __RazorDirectiveTokenHelpers__() {
        ((System.Action)(() => {
#nullable restore
#line 1 "c:/Users/anonymous/Desktop/BlazorApp/Pages/Index.razor"
global::System.Object __typeHelper = "/";

#line default
#line hidden
#nullable disable
        }
        ))();
        }
        #pragma warning restore 219
        #pragma warning disable 0414
        private static System.Object __o = null;
        #pragma warning restore 0414
        #pragma warning disable 1998
        protected override void BuildRenderTree(Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder)
        {
        }
        #pragma warning restore 1998
    }
}
#pragma warning restore 1591

// 8

Projected Html document:

Expand

////////////////////// Projected Html as seen by extension ///////////////////////
~~~~~ ~~~

<h1>Hello, world!</h1>

Welcome to your new app.

<SurveyPrompt Title="How is Blazor working for you?" />



////////////////////// Projected Html as seen by VSCode ///////////////////////
~~~~~ ~~~

<h1>Hello, world!</h1>

Welcome to your new app.

<SurveyPrompt Title="How is Blazor working for you?" />

// 11

Machine information

VSCode version: 1.57.1
Razor.VSCode version: 1.23.12

dotnet --info

Expand

.NET SDK (reflecting any global.json):
 Version:   5.0.301
 Commit:    ef17233f86

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.19041
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\5.0.301\

Host (useful for support):
  Version: 5.0.7
  Commit:  556582d964

.NET SDKs installed:
  5.0.301 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 5.0.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 5.0.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.WindowsDesktop.App 5.0.7 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

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

Extensions

Expand

Extension Author Version
csharp ms-dotnettools 1.23.12

@danroth27
Copy link
Member Author

@NTaylorMullen
Copy link
Contributor

@danroth27 could you include the O# logs?

@jtsom
Copy link

jtsom commented Jun 28, 2021

FYI ... I do not see this with Blazor Server app, but do see problems with a BlazorWasm app (as detailed in dotnet/vscode-csharp#4618)

@danroth27
Copy link
Member Author

@NTaylorMullen Added O# logs. Need anything else?

@eustachi0
Copy link

I hope this help
csharperrorsv 1 23 12

@danroth27
Copy link
Member Author

🎉

NTaylorMullen referenced this issue in dotnet/vscode-csharp Jul 9, 2021
@jtsom
Copy link

jtsom commented Jul 19, 2021

This is NOT fixed in v1.23.13:
image
image

@danroth27
Copy link
Member Author

@jtsom I'm unable to reproduce this issue anymore with 1.23.13. Could you please open a new issue for the problem you are seeing using the "Razor: Report a Razor issue" command in VS Code? This will collect the logs that we need.

@Xeevis
Copy link

Xeevis commented Jul 19, 2021

This is NOT fixed in v1.23.13

Had this same problem, took the easy route and just deleted cache, bin, obj, VS code app data and it went away. 🤷🏻‍♂️

@ghost ghost locked as resolved and limited conversation to collaborators Aug 18, 2021
@dotnet dotnet unlocked this conversation Oct 8, 2021
@allisonchou allisonchou transferred this issue from dotnet/aspnetcore Oct 8, 2021
@allisonchou allisonchou added this to the 17.0-Preview3 milestone Oct 8, 2021
@ghost ghost locked as resolved and limited conversation to collaborators Nov 7, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
6 participants