question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Doesn't work on server side Blazor

See original GitHub issue

Steps do reproduce:

  1. Create a new server side blazor project (template from vs 16.2 preview)
  2. On ConfigureServices, add the di:
services.AddRazorPages();
services.AddServerSideBlazor();
services.AddBlazorStyled(isDevelopment: true);
services.AddSingleton<WeatherForecastService>();

when you try to run the project: InvalidOperationException: Cannot consume scoped service ‘Microsoft.JSInterop.IJSRuntime’ from singleton ‘BlazorStyled.Internal.StyledJsInterop’.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:10 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
chanancommented, Jul 1, 2019

Thanks to help from the nice folks on Gitter, got a blank library, CSB, and SSB project all working. Should be able to get a new build out tonight or early tomorrow morning

1reaction
chanancommented, Jul 2, 2019

This now works. Will make a build soon and update the docs for SSB differences. Which needs to work like this:

<div class="@div">Test</div>

@code {
    private string div;


    protected override async Task OnAfterRenderAsync()
    {
       div = await Styled.Css("background-color: pink;");
       StateHasChanged();
    }
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

UseExceptionHandler Blazor server-side not working
I'm new at Blazor development and I have the problem that I'm not able to test or to make the Error Page to...
Read more >
Blazor server app not working when deployed, works fine ...
I have a Blazor server-side project which I've been developing in Visual Studio 2019, using .NET5. All has been working fine.
Read more >
ASP.NET Core Blazor hosting models
Razor components can run server-side in ASP.NET Core (Blazor Server) versus client-side in the browser on a WebAssembly-based .
Read more >
IE11 fails to load a (server-side) Blazor web app
So, as shown in the article's image, when trying to access your web application using IE11, the page doesn't load at all. It's...
Read more >
Understanding Server-Side Blazor
Introduction. Blazor is a .NET Core web framework that runs C# code on the browser using WebAssembly. It offers an alternative to JavaScript ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found