dotnet / dotnet/Scaffolding

Generate Razor view failed with non ascii words

Open
#2,289 0 comments 0 reactions 1 assignee Claimed by @deepchoudhery View on GitHub
area-scaffolding customer-reported
Dominant language
C#
Stars
818
Forks
260
Avg merge
1d 8h
Merged PRs (30d)
10

Description

When my .Net Core MVC Project have dependency injection with non ascii words.
```
services.AddScoped<中文, 中文>();
```
If I Create Razor view with model (add -> view -> select model)
I will get following errors
```
Attempting to compile the application in memory.
Could not get the reflection type for DbContext : NS3Web.Models.NS3Context
at Microsoft.VisualStudio.Web.CodeGeneration.ActionInvoker.b__6_0()
at Microsoft.Extensions.CommandLineUtils.CommandLineApplication.Execute(String[] args)
at Microsoft.VisualStudio.Web.CodeGeneration.ActionInvoker.Execute(String[] args)
at Microsoft.VisualStudio.Web.CodeGeneration.CodeGenCommand.Execute(String[] args)
```

or
```
Attempting to compile the application in memory with the modified DbContext.
There was an error creating a DbContext : MY_PROJECT\Startup.cs(66,32): error CS1525:
```

currently my workaround is just comment out this line when creating view.
Is three any other solution?

IDE: Visual Studio 2019 16.11.24
Target framework: NET 5.0
Package:Microsoft.VisualStudio.Web.CodeGeneration.Design 5.0.2

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.