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

Error on startup #5

Open
jbonnett92 opened this issue Mar 27, 2023 · 4 comments
Open

Error on startup #5

jbonnett92 opened this issue Mar 27, 2023 · 4 comments

Comments

@jbonnett92
Copy link

jbonnett92 commented Mar 27, 2023

Hi,

Whilst trying to use your package I get this error on a Blazor Server app:

 Some services are not able to be constructed (Error while validating the service descriptor 'ServiceType: BlazorCurrentDevice.IBlazorCurrentDeviceService Lifetime: Singleton ImplementationType: BlazorCurrentDevice.BlazorCurrentDeviceService': Cannot consume scoped service 'Microsoft.JSInterop.IJSRuntime' from singleton 'BlazorCurrentDevice.IBlazorCurrentDeviceService'.)
 ---> System.InvalidOperationException: Error while validating the service descriptor 'ServiceType: BlazorCurrentDevice.IBlazorCurrentDeviceService Lifetime: Singleton ImplementationType: BlazorCurrentDevice.BlazorCurrentDeviceService': Cannot consume scoped service 'Microsoft.JSInterop.IJSRuntime' from singleton 'BlazorCurrentDevice.IBlazorCurrentDeviceService'.
 ---> System.InvalidOperationException: Cannot consume scoped service 'Microsoft.JSInterop.IJSRuntime' from singleton 'BlazorCurrentDevice.IBlazorCurrentDeviceService'.

It compiles on the Maui Blazor Hybrid app, though crashes the app when I assess pages where I use it, but other pages that don't the styles are all over the place.

Any ideas? Just a little informmation that may be relevent is that I am running seperate projects for the views.

@HugoVG
Copy link

HugoVG commented Jun 6, 2023

the issue was that it was placed as Singleton and not as Scoped, i fixed it in my PR

@arivera12
Copy link
Owner

I will take a look soon, I have been off for a while

@ledpup
Copy link

ledpup commented Dec 8, 2023

I will take a look soon, I have been off for a while

It would be great if you could merge in the PR for this and create a new NuGet package. I've tested the branch and it works well.

@HugoVG
Copy link

HugoVG commented Mar 22, 2024

@jbonnett92 Sorry for the really really late ping but I added where to find an upgraded package in the comment here #6 (comment)
https://github.com/HugoVG/CurrentDevice

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