Skip to content

[dotnet-sdk-9.0.100-preview.3.24175.24] CS1646 error when building Hawaso #10186

@Junjun-zhao

Description

@Junjun-zhao

Application Name: Hawaso
OS: Windows 10 22H2
CPU: X64
.NET Build Number: dotnet-sdk-9.0.100-preview.3.24175.24
App Source Location Checking at:
https://devdiv.visualstudio.com/DevDiv/_workitems/edit/2012415

Github Link:
https://github.com/VisualAcademy/Hawaso

Verify Scenarios:

  1. Windows10 21h2 x64 + dotnet-sdk-9.0.100-preview.3.24175.24: Fail
  2. Windows10 21h2 x64 + dotnet-sdk-9.0.100-preview.2.24129.7: Pass
  3. Windows10 21h2 x64 + dotnet-sdk-8.0.202: Pass

Description:
CS1646 error shows when we build Hawaso\Hawaso project with dotnet-sdk-9.0.100-preview.3.24175.24

Minimal Repro steps (Demo attached):
Demo.zip

The machine has dotnet-sdk-9.0.100-preview.3.24175.24 installed.

  1. Create default 8.0 ASP .NET Core Web App(Razor Pages).
  2. Create class MyTagHelper.cs:
using Microsoft.AspNetCore.Razor.TagHelpers;
using System;
namespace Demo
{
    [HtmlTargetElement("mytag", Attributes = "myattr")]
    public class MyTagHelper:TagHelper
    {
        [HtmlAttributeName("myattr")]
        public int MyAttr { get; set; }
    }
}
  1. Import taghelper in _ViewImports.cshtml:
@using Demo
@namespace Demo.Pages
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
@addTagHelper *, Demo
  1. Add the following code in Index.cshtml:
@page
@model IndexModel
@{
    ViewData["Title"] = "Home page";
    int count = 0;
}
<div>
    <mytag myattr='Convert.ToInt32(@count)'></mytag>
</div>

7.Build the app with 9.0.100-preview.3.24175.24 SDK

Expected Result: Build successfully.
Actual Result:

Build failed with error: CS1646 Keyword, identifier, or string expected after verbatim specifier: @.

dotnet info:

.NET SDK:
 Version:           9.0.100-preview.3.24175.24
 Commit:            09d6f381e6
 Workload version:  9.0.100-manifests.77bb7ba9
 MSBuild version:   17.10.0-preview-24175-03+89b42a486

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.19045
 OS Platform: Windows
 RID:         win-x64
 Base Path:   C:\Program Files\dotnet\sdk\9.0.100-preview.3.24175.24\

.NET workloads installed:
There are no installed workloads to display.

Host:
  Version:      9.0.0-preview.3.24172.9
  Architecture: x64
  Commit:       9e6ba1f68c

.NET SDKs installed:
  9.0.100-preview.3.24175.24 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 9.0.0-preview.3.24172.13 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 9.0.0-preview.3.24172.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.WindowsDesktop.App 9.0.0-preview.3.24175.3 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

@dotnet-actwx-bot @dotnet/compat

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions