Open TheCyberCore opened 4 years ago
I haven’t seen this issue. I do test both on client and server side projects.
The current master branch of the project doesn’t have that class anymore - as well as the preview release in Nuget. Could you zip up the project and attach it or post it on github and I can take a look?
I created a minimum test project. The error occurs when trying to get access to IStyled in Startup.Configure().
Thanks! I will take a look tomorrow evening
Thank you :) I now also tested the latest preview 3.00 alpha 5 and the error still persists but changed slightly.
System.InvalidOperationException: "Cannot resolve 'BlazorStyled.IStyled' from root provider because it requires scoped service 'BlazorStyled.Internal.ScriptManager'."
Took a quick look. Remove the line in Startup.cs
-> Configure
method: IStyled styled = app.ApplicationServices.GetRequiredService<IStyled>();
. Once you do that, you can use it in Inde.razor (or where ever) either by using the <Styled />
tag or if you want to use the API you can use: @inject BlazorStyled.IStyled Styled
@TheCyberCore were you able to get this working?
@chanan Yes, thank you. This works. But it does not really fit in my app, because the theming variables should be active before the first razor subpage loads. I also tried to initialize the theming within the razor root page/layout page, but the injection seems to work only on sub-page level.
Hi, I ran in a little issue with the latest version of this library with .NET Core 3.1. The project was generated with the Visual Studio 2019 wizard. When adding the service via AddBlazorStyled() in Startup.ConfigureServices() the following exception occurs.
As IStyleSheet and its implementations are internal elements of BlazorStyled, I am also not able to add the DI object manually.
I think this is a bug?