Skip to content
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

[BUG] Problem in routes.razor with new modules #4562

Closed
allschu opened this issue Aug 25, 2024 · 8 comments
Closed

[BUG] Problem in routes.razor with new modules #4562

allschu opened this issue Aug 25, 2024 · 8 comments

Comments

@allschu
Copy link

allschu commented Aug 25, 2024

Oqtane Info

Version - 5.2.1
Render Mode - Static
Interactivity - Server
Database - Postgres

Describe the bug

Maybe this bug is already familiar but I couldn't find any answers. My apologies. Just point me to the right topic

When you start a new module (nothing fancy, just a new one, as default) and you publish the module to a page I get the following error.

System.InvalidOperationException: 'Cannot provide a value for property 'newsService' on type 'Schuurmans.Module.news.Index'. There is no registered service of type 'Schuurmans.Module.news.Services.InewsService'.'

It looks like it's trying to load the index page, but it cannot resolve the Service, which is needed as a dependency. Is it not automatically registered?

image

Expected Behavior

Show the index page of the newly created module

Steps To Reproduce

Get the latest version

Anything else?

@leigh-pointer
Copy link
Contributor

Hi @allschu, did you use the Oqtane templates to scaffold the module? I have just built a simple module using the Templates and have no issue.

@allschu
Copy link
Author

allschu commented Aug 25, 2024

@leigh-pointer yes I used the default templates. I found out what the problem is.
In version 5.1.0 I got a Startup class (in the module server project) in which the following registration are present

  services.AddTransient<INewsService, ServerNewsService>();
  services.AddDbContextFactory<NewsContext>(opt => { }, ServiceLifetime.Transient);

But in version 5.2.1 when I follow the same action to create a new Module, I don't get this startup class by default anymore.

@leigh-pointer
Copy link
Contributor

@allschu correct, the templates were change in #4541

@allschu
Copy link
Author

allschu commented Aug 25, 2024

@leigh-pointer if I add these registrations in a default clean 5.2.1 installation with my own serverstartup class everything works.

@sbwalker
Copy link
Member

The IServerStartup class should not have been deleted as part of #4541 - the fix was only intended to address the issue reported in the Client project - I am not sure how the file in the Server project got deleted.

@sbwalker
Copy link
Member

The ServerStartup.cs file is in my local environment - however for some reason Git removed it as part of #4541 and is not allowing me to add it back

image

Once I figure out my local Git problem I should be able to add the file back to the template

sbwalker added a commit that referenced this issue Aug 26, 2024
fix #4562 - module template issue caused by gitignore
@sbwalker
Copy link
Member

Resolved in #4565:

PR #4541 was not valid as it did not actually include the necessary changes to resolve issue #4537 - this was because the gitignore file was excluding files which should have been included. This PR fixes the gitignore and merges the default module template files which were supposed to be committed in #4541

@dvdobrovolskiy
Copy link

sorry. nope, used release version. Please close issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants