Giter Club home page Giter Club logo

Comments (26)

pheuter avatar pheuter commented on May 26, 2024 1

Using v1.0.0 which is the latest.

from logging.

chucker avatar chucker commented on May 26, 2024

@moonolgerd did you update to version 1.0.0 of the package?

Also, if you upgraded, try closing VS, deleting the .vs, bin and obj folders, and relaunching VS.

from logging.

jwdebruin avatar jwdebruin commented on May 26, 2024

I am facing the same issue, even when I create a new blazor project, and configure logging then the exception occurs.

from logging.

davidgriffithfm avatar davidgriffithfm commented on May 26, 2024

I have the same issue. I just downloaded VS 2019, created a new Blazor project and pulled in this extension via nuget. If I comment out this line in Startup.cs the runtime error goes away: .AddBrowserConsole(), but I need that line in order to get logging to work. I tried closing VS, deleting the .vs, bin and obj folders, and relaunching VS but that didn't help. I also updated node to the most recent stable version. When I try to build your source locally I get the following error when loading the project: The command "git rev-parse --show-toplevel" exited with code 128

from logging.

pheuter avatar pheuter commented on May 26, 2024

It appears there is a circular dependency between IJSRuntime and BrowserConsoleLogger which may be at the core of this error.

The error I'm seeing:

System.AggregateException
  HResult=0x80131500
  Message=Some services are not able to be constructed
  Source=Microsoft.Extensions.DependencyInjection
  StackTrace:
   at Microsoft.Extensions.DependencyInjection.ServiceProvider..ctor(IEnumerable`1 serviceDescriptors, ServiceProviderOptions options)
   at Microsoft.Extensions.DependencyInjection.ServiceCollectionContainerBuilderExtensions.BuildServiceProvider(IServiceCollection services, ServiceProviderOptions options)
   at Microsoft.Extensions.DependencyInjection.DefaultServiceProviderFactory.CreateServiceProvider(IServiceCollection containerBuilder)
   at Microsoft.Extensions.Hosting.Internal.ServiceFactoryAdapter`1.CreateServiceProvider(Object containerBuilder)
   at Microsoft.Extensions.Hosting.HostBuilder.CreateServiceProvider()
   at Microsoft.Extensions.Hosting.HostBuilder.Build()
   at CareSwitch.Program.<Main>d__0.MoveNext() in C:\Users\MarkFayngersh\source\repos\CareSwitch Blazor\Program.cs:line 18

Inner Exception 1:
InvalidOperationException: Error while validating the service descriptor 'ServiceType: Microsoft.Extensions.Hosting.IHostApplicationLifetime Lifetime: Singleton ImplementationType: Microsoft.Extensions.Hosting.Internal.ApplicationLifetime': A circular dependency was detected for the service of type 'Microsoft.JSInterop.IJSRuntime'.
Microsoft.Extensions.Hosting.IHostApplicationLifetime(Microsoft.Extensions.Hosting.Internal.ApplicationLifetime) -> Microsoft.Extensions.Logging.ILogger<Microsoft.Extensions.Hosting.Internal.ApplicationLifetime>(Blazor.Extensions.Logging.BrowserConsoleLogger<Microsoft.Extensions.Hosting.Internal.ApplicationLifetime>) -> Microsoft.JSInterop.IJSRuntime(Microsoft.AspNetCore.Components.Server.Circuits.RemoteJSRuntime) -> Microsoft.Extensions.Logging.ILogger<Microsoft.AspNetCore.Components.Server.Circuits.RemoteJSRuntime>(Blazor.Extensions.Logging.BrowserConsoleLogger<Microsoft.AspNetCore.Components.Server.Circuits.RemoteJSRuntime>) -> Microsoft.JSInterop.IJSRuntime

Inner Exception 2:
InvalidOperationException: A circular dependency was detected for the service of type 'Microsoft.JSInterop.IJSRuntime'.
Microsoft.Extensions.Hosting.IHostApplicationLifetime(Microsoft.Extensions.Hosting.Internal.ApplicationLifetime) -> Microsoft.Extensions.Logging.ILogger<Microsoft.Extensions.Hosting.Internal.ApplicationLifetime>(Blazor.Extensions.Logging.BrowserConsoleLogger<Microsoft.Extensions.Hosting.Internal.ApplicationLifetime>) -> Microsoft.JSInterop.IJSRuntime(Microsoft.AspNetCore.Components.Server.Circuits.RemoteJSRuntime) -> Microsoft.Extensions.Logging.ILogger<Microsoft.AspNetCore.Components.Server.Circuits.RemoteJSRuntime>(Blazor.Extensions.Logging.BrowserConsoleLogger<Microsoft.AspNetCore.Components.Server.Circuits.RemoteJSRuntime>) -> Microsoft.JSInterop.IJSRuntime

from logging.

galvesribeiro avatar galvesribeiro commented on May 26, 2024

Could you please try the latest package? It is working properly here.

from logging.

galvesribeiro avatar galvesribeiro commented on May 26, 2024

Can you build a very minimal repro project and put it on github somewhere?

I don't have that problem at all here.

from logging.

pheuter avatar pheuter commented on May 26, 2024

Are you using Blazor Server or Blazor Client with WebAssembly?

from logging.

galvesribeiro avatar galvesribeiro commented on May 26, 2024

WASM. Are you using Server?

from logging.

pheuter avatar pheuter commented on May 26, 2024

Yeah, so that was my intuition for the difference. I'm using Server so it makes sense for that to be a problem since IJSRuntime may need to log and the logger needs IJSRuntime to do the logging.

from logging.

galvesribeiro avatar galvesribeiro commented on May 26, 2024

Interesting... I'll investigate more. But for now, I suggest you to use the regular ILogger providers available to regular .net applications.

from logging.

pheuter avatar pheuter commented on May 26, 2024

Yeah that's what I've already been using. Of course the regular ILogger goes to console and not the browser console, but that'll have to do for now.

from logging.

galvesribeiro avatar galvesribeiro commented on May 26, 2024

I'll investigate the server side.

from logging.

vip32 avatar vip32 commented on May 26, 2024

having the same issue with blazor server side. tried the release and preview of this package. any workaround or fix?

"InvalidOperationException: Error while validating the service descriptor 'ServiceType: Microsoft.Extensions.Hosting.IHostedService Lifetime: Singleton ImplementationType: Microsoft.AspNetCore.Hosting.GenericWebHostService': A circular dependency was detected for the service of type 'Microsoft.JSInterop.IJSRuntime'. Microsoft.Extensions.Hosting.IHostedService(Microsoft.AspNetCore.Hosting.GenericWebHostService) -> Microsoft.AspNetCore.Hosting.Server.IServer(Microsoft.AspNetCore.Server.IIS.Core.IISHttpServer) -> Microsoft.Extensions.Hosting.IHostApplicationLifetime(Microsoft.Extensions.Hosting.Internal.ApplicationLifetime) -> Microsoft.Extensions.Logging.ILogger<Microsoft.Extensions.Hosting.Internal.ApplicationLifetime>(Blazor.Extensions.Logging.BrowserConsoleLogger<Microsoft.Extensions.Hosting.Internal.ApplicationLifetime>) -> Microsoft.JSInterop.IJSRuntime(Microsoft.AspNetCore.Components.Server.Circuits.RemoteJSRuntime) -> Microsoft.Extensions.Logging.ILogger<Microsoft.AspNetCore.Components.Server.Circuits.RemoteJSRuntime>(Blazor.Extensions.Logging.BrowserConsoleLogger<Microsoft.AspNetCore.Components.Server.Circuits.RemoteJSRuntime>) -> Microsoft.JSInterop.IJSRuntime"

from logging.

Leafhood avatar Leafhood commented on May 26, 2024

Same problem here, a minimal server side project. Any updates on this?

from logging.

pvanroos avatar pvanroos commented on May 26, 2024

I'm having the same problem. Browser console logging would be very helpful of the Server.

from logging.

Andras-Csanyi avatar Andras-Csanyi commented on May 26, 2024

Any update on this? The issue still persist.

from logging.

anton-matsyshyn avatar anton-matsyshyn commented on May 26, 2024

Same problem, any solutions?

from logging.

KrazyTako avatar KrazyTako commented on May 26, 2024

Jumping into Blazor here, would love to get some logging in the browser console.

from logging.

EvanWeeks avatar EvanWeeks commented on May 26, 2024

Same issue here, breaks server-side.

from logging.

EvanWeeks avatar EvanWeeks commented on May 26, 2024

I think at least in my case it's because I was trying to use this with a server-side Blazor project. That said, I'm having the "cannot find blazor.extensions.logger in window" error now on client-side blazor (addressed in #41 and #51 )

from logging.

chucker avatar chucker commented on May 26, 2024

Blazor Server won't work for now.

Blazor WASM was broken by .NET Core 3.1 final. Pull requests #49 or #51 would address this, but there hasn't been a new NuGet release (@galvesribeiro?). You can compile it yourself and/or host it on your own feed, and it'll work.

from logging.

attilah avatar attilah commented on May 26, 2024

We've updated the package to Blazor RC1, give it a spin!

from logging.

gto406 avatar gto406 commented on May 26, 2024

Hi, this still seems to be an issue (Server approach) - Nuget reports Blazor.Extensions.Logging 1.1.1 (assuming that is the latest as of this comment). Checking the latest Blazor Web Assembly - the ILogger (through the Dev-Tools on the browser) works fine. I guess no plans to fix Server? Just use the regular console logger?

from logging.

attilah avatar attilah commented on May 26, 2024

@gto406 for Server side I'd not register the console logger. What would be your use case? To forward all the logging to the browser's console, regardless of how is the Blazor App hosted? so in case of server side Blazor, even "classic backend components", would log to the browser's console?

from logging.

gto406 avatar gto406 commented on May 26, 2024

@gto406 for Server side I'd not register the console logger. What would be your use case? To forward all the logging to the browser's console, regardless of how is the Blazor App hosted? so in case of server side Blazor, even "classic backend components", would log to the browser's console?

Hi Atilla

My use-case captures activity from C# server-side controllers and Blazor pages. I have integrated NLog - and am logging successfully from our controllers. Log statements injected via ILogger inside razor pages currently are not working. Still some work to do 8*)

Thanks!
Brian.

from logging.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.