Open doggy8088 opened 3 months ago
Remember:
I can reproduce the issue every time. Just clone my code: https://github.com/doggy8088/VS2022ScaffoldingBug
Here are the steps to reproduce the issue:
Open Solution Explorer, Right-click on the Controllers folder, then Add > Controller.
Add > Controller
Choose the item template: MVC Controller with views, using Entity Framework
MVC Controller with views, using Entity Framework
Model class: Course
Course
DbContext class: ContosoUniversityContext
ContosoUniversityContext
Hit Add button.
Add
Then you will see the following error:
There was an error running the selected code generator: 'Exception of type 'System.InvalidOperationException' was thrown.'
The error message is really too vague. I took 2 hours to figure it out the root cause. I think the error message can be improved.
I also reported this issue there for VS2022: https://developercommunity.visualstudio.com/t/I-wish-there-is-a-feature-that-can-save/10691680?port=1025&fsid=ce2921a1-dd02-402d-8377-b214f05199a5
N/A
Microsoft.VisualStudio.Web.CodeGeneration.Design version: 8.0.2 Target framework: .NET 8.0 Operating system: Microsoft Windows [Version 10.0.19045.4412] IDE: Visual Studio 2022 17.10.3
8.0.2
.NET 8.0
Microsoft Windows [Version 10.0.19045.4412]
Visual Studio 2022 17.10.3
File a bug
Remember:
Include your code
I can reproduce the issue every time. Just clone my code: https://github.com/doggy8088/VS2022ScaffoldingBug
Here are the steps to reproduce the issue:
Open Solution Explorer, Right-click on the Controllers folder, then
Add > Controller
.Choose the item template:
MVC Controller with views, using Entity Framework
Model class:
Course
DbContext class:
ContosoUniversityContext
Hit
Add
button.Then you will see the following error:
The error message is really too vague. I took 2 hours to figure it out the root cause. I think the error message can be improved.
I also reported this issue there for VS2022: https://developercommunity.visualstudio.com/t/I-wish-there-is-a-feature-that-can-save/10691680?port=1025&fsid=ce2921a1-dd02-402d-8377-b214f05199a5
Include stack traces
N/A
Include provider and version information
Microsoft.VisualStudio.Web.CodeGeneration.Design version:
8.0.2
Target framework:.NET 8.0
Operating system:Microsoft Windows [Version 10.0.19045.4412]
IDE:Visual Studio 2022 17.10.3