Comments (26)
Using v1.0.0 which is the latest.
from logging.
@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.
I am facing the same issue, even when I create a new blazor project, and configure logging then the exception occurs.
from logging.
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.
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.
Could you please try the latest package? It is working properly here.
from logging.
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.
Are you using Blazor Server or Blazor Client with WebAssembly?
from logging.
WASM. Are you using Server?
from logging.
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.
Interesting... I'll investigate more. But for now, I suggest you to use the regular ILogger
providers available to regular .net applications.
from logging.
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.
I'll investigate the server side.
from logging.
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.
Same problem here, a minimal server side project. Any updates on this?
from logging.
I'm having the same problem. Browser console logging would be very helpful of the Server.
from logging.
Any update on this? The issue still persist.
from logging.
Same problem, any solutions?
from logging.
Jumping into Blazor here, would love to get some logging in the browser console.
from logging.
Same issue here, breaks server-side.
from logging.
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.
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.
We've updated the package to Blazor RC1, give it a spin!
from logging.
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.
@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 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)
- NullReferenceException when configuring logging service HOT 2
- Need new release for Blazor 0.8.0 HOT 1
- Need new release for Blazor 0.9.0 HOT 3
- V 0.1.10 for Blazor V3.0P4 has reference to old package, produces compile time error HOT 2
- V0.1.11 fails to write to Chrome Console HOT 2
- Trace logs are freezing firefox HOT 1
- Show category? HOT 1
- InvalidOperationException in preview7 HOT 4
- Logging Objects HOT 2
- Question HOT 1
- Building is failing after updating Blazor application to dotnet core 3.0 preview 9 HOT 1
- Microsoft.JSInterop.JSException: Could not find 'BlazorExtensions' in 'window' HOT 5
- Expose ILoggingProvider HOT 3
- Log object to console HOT 2
- JavaScript file download location HOT 1
- Unhandled Exception during log write HOT 3
- Logging Levels are not mapped correctly
- .AddFilter Broken for ILogger<> messages with .AddBrowserConsole()
- AddBrowserConsole() causes circular dependency in server-side blazor HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from logging.