Skip to content

VS Community Preview 16.1.0 - Razor Components intellisense errors #9320

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

Closed
aford22 opened this issue Apr 12, 2019 · 12 comments
Closed

VS Community Preview 16.1.0 - Razor Components intellisense errors #9320

aford22 opened this issue Apr 12, 2019 · 12 comments
Labels
area-blazor Includes: Blazor, Razor Components Done This issue has been fixed ✔️ Resolution: Duplicate Resolved as a duplicate of another issue

Comments

@aford22
Copy link

aford22 commented Apr 12, 2019

Describe the bug

Regression with VS Community Preview 16.1.0 that was not present in previous Preview release. When authoring Razor Components the "Errors" window and Intellisense both show the same compilation "errors" that are not errors. The project still builds and runs despite those errors. See screenshot of error window:
image

These false compilation errors were not present in previous VS Community preview release.

To Reproduce

Steps to reproduce the behavior:

  1. Install VS Community Preview 16.1.0
  2. Use Razor Components "example" project that shipped with previous release of VS Community Preview (the project with the "Counter" page and "Fetch Data" weather forecasts page). I.e. the code:
@page "/counter"
@using WebApplication1.Services
@inject WeatherForecastService ForecastService

<h1>Counter</h1>
<p>Current count: @currentCount</p>
<button class="btn btn-primary" onclick="@IncrementCount">Click me</button>

@functions {
    int currentCount = 0;

    void IncrementCount()
    {
        currentCount++;
    }
}
  1. Build the project. You will see the false compilation errors
    image
  2. Project builds successfully and can be run with no issues

Expected behavior

False compilation errors should not be present in the "Errors" window nor as red wavy lines in the main "Code Editor" window

Additional context

These issues were not present in previous VS Community Preview release

@NTaylorMullen
Copy link

@aford22 a few questions to properly diagnose what you're seeing.

  • Are you able to reproduce the issue with a new project?
  • What's your dotnet --info output?
  • Do you see your button tag in Counter.razor as purple?
  • Would you mind pasting the contents of your .csproj

@Eilon Eilon added the area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates label Apr 12, 2019
@aford22
Copy link
Author

aford22 commented Apr 13, 2019

Are you able to reproduce the issue with a new project?

Well, unfortunately the "Razor Components" project template has disappeared from the latest VS Comm release... as have the Blazor project templates. This is a problem in itself.

However if I use the "ASP.Net Core Web Application" template then "Web Application" to create a new project, there are lots of files that then need changed to make them work with Razor Components. Like Startup, index, .csproj, etc. Its hacking the whole newly generated project so much that I am not sure what this proves...

What's your dotnet --info output?

.NET Core SDK (reflecting any global.json):
 Version:   3.0.100-preview3-010431
 Commit:    d72abce213

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.17763
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\3.0.100-preview3-010431\

Host (useful for support):
  Version: 3.0.0-preview3-27503-5
  Commit:  3844df9537

.NET Core SDKs installed:
  2.1.500 [C:\Program Files\dotnet\sdk]
  2.1.502 [C:\Program Files\dotnet\sdk]
  2.1.503 [C:\Program Files\dotnet\sdk]
  2.1.504 [C:\Program Files\dotnet\sdk]
  2.1.505 [C:\Program Files\dotnet\sdk]
  2.1.602 [C:\Program Files\dotnet\sdk]
  2.1.700-preview-009597 [C:\Program Files\dotnet\sdk]
  2.2.101 [C:\Program Files\dotnet\sdk]
  3.0.100-preview3-010431 [C:\Program Files\dotnet\sdk]

.NET Core runtimes installed:
  Microsoft.AspNetCore.All 2.1.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.1.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.1.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.1.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.2.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.App 2.1.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.1.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.1.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.1.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.2.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 3.0.0-preview3-19153-02 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 2.1.6 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.8 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.2.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.0.0-preview3-27503-5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.WindowsDesktop.App 3.0.0-preview3-27504-2 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

Do you see your button tag in Counter.razor as purple?

No, its blue. See screenshot.
image
You can also see the false error red wavy line...

Would you mind pasting the contents of your .csproj

Surely:

<Project Sdk="Microsoft.NET.Sdk.Web">

  <PropertyGroup>
    <TargetFramework>netcoreapp3.0</TargetFramework>
  </PropertyGroup>


  <ItemGroup>
    <PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="3.0.0-preview3-19153-02" />
  </ItemGroup>

</Project>

@henkmollema
Copy link
Contributor

I'm having the same issue with SDK v3.0.100-preview3-010431 and VS 16.1 Preview 1. I can reproduce it by creating a new Razor Components project with dotnet new razorcomponents and opening it in Visual Studio. I receive errors such as:

CS0428	Cannot convert method group 'IncrementCount' to non-delegate type 'object'. Did you intend to invoke the method? C:\tmp\razorcomponents\Components\Pages\Counter.razor:7

Also the HTML tags don't get their correct colorization:

image

The csproj looks like this:

<Project Sdk="Microsoft.NET.Sdk.Web">
  <PropertyGroup>
    <TargetFramework>netcoreapp3.0</TargetFramework>
    <LangVersion>7.3</LangVersion>
    <_RazorComponentInclude>Components\**\*.cshtml</_RazorComponentInclude>
  </PropertyGroup>
  <ItemGroup>
    <PackageReference Include="Microsoft.AspNetCore.Components.Server" Version="3.0.0-preview3-19153-02" />
    <PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="3.0.0-preview3-19153-02" />
  </ItemGroup>
</Project>

@mkArtakMSFT mkArtakMSFT added area-blazor Includes: Blazor, Razor Components ✔️ Resolution: Duplicate Resolved as a duplicate of another issue labels Apr 15, 2019
@mkArtakMSFT
Copy link
Contributor

Thanks for contacting us folks.
We believe this is now fix in our nightly releases and will be released as part of the next preview release.

@mkArtakMSFT mkArtakMSFT added the Done This issue has been fixed label Apr 15, 2019
@GerritBergen
Copy link

@mkArtakMSFT Any idea when the release that fixes this will come out?

@henkmollema
Copy link
Contributor

Updating to Preview 4 fixed this for me, using the same VS 16.1 Preview 1 version.

@GerritBergen
Copy link

@henkmollema oh I see. I'm having the same issue with VS 16.0.2 (public release) running core preview 4. Guess they fixed it in VS 16.1. I'll probably just deal with it until 16.1 goes public.

@mkArtakMSFT mkArtakMSFT removed area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates labels May 9, 2019
@tedekeroth
Copy link

I would like to reopen this issue, as this is present also in 3.0.100-preview5-011568. If I clone this repo:
https://github.com/torhovland/blazor-realworld-example-app

and replace the version of core in global.json with "3.0.100-preview5-011568", the exact behaviour as above appears:

  • The project can build and run
  • IntelliSense warns about errors for all '@...' statements.

Im running VS2019 Preview, v 16.2.0 Preview 1.0

Here is my dotnet --info:

C:\Users\wagge>dotnet --info
.NET Core SDK (reflecting any global.json):
Version: 3.0.100-preview5-011568
Commit: b487ff10aa

Runtime Environment:
OS Name: Windows
OS Version: 10.0.18362
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\3.0.100-preview5-011568\

Host (useful for support):
Version: 3.0.0-preview5-27626-15
Commit: 61f30f5a23

.NET Core SDKs installed:
2.1.507 [C:\Program Files\dotnet\sdk]
2.1.700 [C:\Program Files\dotnet\sdk]
2.1.800-preview-009677 [C:\Program Files\dotnet\sdk]
2.2.300 [C:\Program Files\dotnet\sdk]
2.2.400-preview-010195 [C:\Program Files\dotnet\sdk]
3.0.100-preview5-011568 [C:\Program Files\dotnet\sdk]

.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.1.11 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.2.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.11 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.2.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.0.0-preview5-19227-01 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.1.11 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.2.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.0.0-preview5-27626-15 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 3.0.0-preview5-27626-15 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

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

@rynowak
Copy link
Member

rynowak commented May 28, 2019

Hi, it looks like you are posting on a closed issue/PR/commit!

We're very likely to lose track of your bug/feedback/question unless you:

  1. Open a new issue
  2. Explain very clearly what you need help with
  3. If you think you have found a bug, include detailed repro steps so that we can investigate the problem

Thanks!

@tedekeroth
Copy link

INdeed, i thought it would be good to re-open an issue that wasnt really resolved, but I can create a new one of course =)

@MrFoxPro
Copy link

MrFoxPro commented Jul 21, 2019

Same error on 3.0.100-preview6-012264 / Razor.VSCode.
Should be reopened

@rynowak
Copy link
Member

rynowak commented Jul 21, 2019

Hi, it looks like you are posting on a closed issue/PR/commit!

We're very likely to lose track of your bug/feedback/question unless you:

  1. Open a new issue
  2. Explain very clearly what you need help with
  3. If you think you have found a bug, include detailed repro steps so that we can investigate the problem

Thanks!

@ghost ghost locked as resolved and limited conversation to collaborators Dec 3, 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 Done This issue has been fixed ✔️ Resolution: Duplicate Resolved as a duplicate of another issue
Projects
None yet
Development

No branches or pull requests

9 participants