Using the C# Debugger shows different Views than when using dotnet run
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 45/100
Hướng nghiên cứu
Bắt đầu bằng cách so sánh cấu hình trình gỡ lỗi mặc định trong .vscode/launch.json với quy trình dotnet run từ terminal, sau đó kiểm tra cách trình gỡ lỗi xử lý program.cs, Register.cshtml, Register.cshtml.cs cùng các view và tệp .resx liên quan. Công việc được hoàn tất khi trình gỡ lỗi và dotnet run tải cùng các view được tạo bằng scaffolding, các trường và các giá trị đã bản địa hóa.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Environment data
.NET SDK:
Version: 10.0.300
Commit: caa81fa497
Workload version: 10.0.300-manifests.b47d7e23
MSBuild version: 18.6.3+caa81fa49
Runtime Environment:
OS Name: org.freedesktop.platform
OS Version: 25.08
OS Platform: Linux
RID: linux-x64
Base Path: /usr/lib/sdk/dotnet10/lib/sdk/10.0.300/
.NET workloads installed:
There are no installed workloads to display.
Configured to use workload sets when installing new manifests.
No workload sets are installed. Run "dotnet workload restore" to install a workload set.
Host:
Version: 10.0.8
Architecture: x64
Commit: 94ea82652c
.NET SDKs installed:
10.0.300 [/usr/lib/sdk/dotnet10/lib/sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 10.0.8 [/usr/lib/sdk/dotnet10/lib/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 10.0.8 [/usr/lib/sdk/dotnet10/lib/shared/Microsoft.NETCore.App]
Steps to reproduce
- Project Setup
- Create a new MVC Project with Authentication enabled. Choose Individual Accounts for type.
- Scaffold the Register.cshtml page for a custom User class that inherits from IdentityUser by using the steps described in the official documentation for scaffolding Account pages.
- Make sure this User class has additional fields like First Name and Last Name
- Open the Register.cshtml page and add the additional fields for First Name and Last Name
- Open Register.cshtml.cs and expand Input to include the new fields.
- Set the First Name and Last Name fields in the custom User class in OnPostAsync in Register.cshtml.cs
- Debugger Setup
- Create the launch.json file in .vscode
- Use the default .NET Core Launch (Web) setup
- Change the "program" path to the .dll file.
Debugging
- Debug the program, the View Index cannot be found.
- Stop the Debugger and update program.cs by adding RazorRuntimeCompilation to the Services (needs NuGet Package)
- Debug the Program again. Views work now. Navigate to the Register page.
- The View is still the standard Register View and not the scaffolded version with the additional fields.
- Stop the debugger and open the terminal. Type
dotnet runand press enter - Navigate to the Register page and notice it now displays the correct View with the fields for First Name and Last Name.
Expected behavior
- Using both
dotnet runand the Debugger should show the same results in Views
Actual behavior
- Running the app with the Debugger shows different Views. The first image is using the Debugger. The second is when using
dotnet run
Additional context
- Similar issues occur when trying to use .resx files for translations. Using a ViewLocalizer in a Razor page will only display the Values when using
dotnet run. With the debugger, it simply displays the Keys as the .resx files appear to not be loaded / compiled when using the debugger. - This version of VS Code runs in a container, but it has full access to all files outside the container and the problem persists.
- Ngôn ngữ chính
- TypeScript
- Star
- 3.1k
- Fork
- 740
- Merge trung bình
- 1 ngày 3 giờ
- Pull request đã merge (30 ngày)
- 52
Chuẩn bị môi trường
Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của dotnet/vscode-csharp
-
Remove temporary .NET 11 CI container digest pinCó thể làm lại được Pull request cho issue này đã bị đóng mà không được merge. Đang mởInfrastructure Test
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
dotnet/vscode-csharp#9791 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Error in project blazorĐang mởC#DK untriaged
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 25/100
dotnet/vscode-csharp#9911 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
reporteĐang mởC#DK untriaged
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 35/100
dotnet/vscode-csharp#9910 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
aĐang mởC#DK untriaged
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 25/100
dotnet/vscode-csharp#9901 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Debugger untriaged
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
dotnet/vscode-csharp#9891 · 6 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của dotnet/vscode-csharp
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
Merit-Systems/x402scan#1312 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Native Web
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 80/100
digitalfabrik/integreat-app#4517 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
TLS guide repeats certs/ in the certificate directoryCó thể đã có người làm @maheshrijal đã nhận hôm nay. Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 92/100
prometheus/docs#3156 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 83/100
medusajs/dtc-starter#90 ·
Maintainer thường phản hồi trong vòng 1 ngày