-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
"Blank Recipe" theme and error at first running: "InvalidOperationException: The model item passed into the ViewDataDictionary is of type 'OrchardCore.Diagnostics.ViewModels.HttpErrorShapeViewModel', but this ViewDataDictionary instance requires a model item of type 'WebApp.Models.ErrorViewModel'" #15267
Comments
I noticed that there is a discrepancy in the official documentation. The second GIF image recommends using the NuGet packages After updating my WebApp to reference |
The issue starts with creating a new blank "ASP.NET Core Web Application" in VS 2022 using the manual method. This process, unlike the automated template, results in Visual Studio automatically adding I noticed that the official documentation does not mention to remove
|
@MarGraz |
@MikeAlhayek yes, thank you. I solved as I explained here. What do you think about the two questions I asked? |
@MarGraz sorry I did not see you follow up comments. Glad you fixed the issues. Yes feel free to submit a PR to modify the documentation to mention removing the views and controller if existing. |
@MikeAlhayek ok, I have just two questions:
Thank you |
In this section https://docs.orchardcore.net/en/main/docs/getting-started/templates/#from-visual-studio-manual-way we should add a section to mention removing the views and controllers. |
As discussed in this issue OrchardCMS#15267 I added the NuGet packages names to the guide, and the instruction to delete "Models", "Views" and "Controllers" folder, automatically added by the Visual Studio scaffolding.
Describe the bug
I followed the official documentation to create a new Orchard Core Web App and installed the
OrchardCore.Application.Cms.Targets
andOrchardCore.Application.Targets
NuGet packages as suggested in the second GIF image.After configuring the Web App to use a SQL Server on localhost and starting the app, I encountered an error on the front end:
An unhandled exception occurred while processing the request. InvalidOperationException: The model item passed into the ViewDataDictionary is of type 'OrchardCore.Diagnostics.ViewModels.HttpErrorShapeViewModel', but this ViewDataDictionary instance requires a model item of type 'WebApp.Models.ErrorViewModel'. Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary.EnsureCompatible(object value)
Despite using a blank recipe, which I thought might naturally lead to front-end errors, I followed the official guide to create my own theme (using the Code Generation Templates) and added a Layout.cshtml with only an "Hello world" text. I also updated the .csproj file to use the
Microsoft.NET.Sdk.Razor
SDK, but the error persisted.To Reproduce
Steps to reproduce the behavior:
ASP.NET Core Web Application
(.NET 8) in VS 2022 v. 17.8.6;OrchardCore.Application.Cms.Targets
v. 1.8.2 andOrchardCore.Application.Targets
v. 1.8.2 from the stable NuGet feed, as shown in the second GIF image;CTRL
+F5
and configure it to use a localhost SQL Server;Expected behavior
Using a "Blank Recipe" I expected not to see a template, but also not to encounter an exception. Ideally, a simple text page should appear, guiding the user to consult the documentation for creating a custom theme and locating the "Admin" panel.
Endpoint
Route Values
Exception details
Screenshots
The text was updated successfully, but these errors were encountered: