Open d00lar opened 1 year ago
We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.
anything? some temp fix ? idea how to do it 'diferent way' ? ;P regards !
anything? did someone even looked into it ?
??
Hello, I don't know if that question is still actual. I'm fighting with exactly same problem. I suppose the app freezing is because you are trying to inject a scoped service (Http) to a singleton service (LoggerProvider). It can't resolve that. Instead you can try to inject in your provider IServiceScopeFactory and then give it to your logger. After that you can use it like this:
using (var scope = _serviceScopeFactory.CreateScope())
{
var http = scope.ServiceProvider.GetService
var response = await http.PostAsJsonAsync($"{EndPoints.SendUiLogs}", logs);
response.EnsureSuccessStatusCode();
return true;
}
It's not a beautiful solution, but it works. Hope it helps. This is article to help understand that issue: https://samwalpole.com/using-scoped-services-inside-singletons
@d00lar, does @Andrey10183's suggestion solve the problem you're experiencing?
We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.
it does not solve this / it is the same thing as in my code / he only replaced GetRequiredService with GetService / this work when injecting scope to singelton YES but NOT when i want do do this in ILoggerProvider / ILoggerProvider is special somehow in this case. please resolve this somehow / add some message that not allowed somehow or it should work i think
Is there an existing issue for this?
Describe the bug
hi
I want log client blazor errors
via custom ilogger / ilogger provider like it should be but i want to sent it to api via httpclient. so i have in program.cs
so now i want to build my LoggerProvider
and this compile fine but freaze app on 'loading'
if i simply comment out this _http part
then it compiles fine also and works as usual - without any freeze
i checked also
or
but result is the same - same loading freeze if i want IHttpClientFactory / Httpclient in ctor.
why this is happening ? is it some .net bug? why i canot inject it here? thanks and regards
Expected Behavior
it should allow to inject or create somehow this http service instance here also and not 'hang' ?
Steps To Reproduce
https://github.com/d00lar/BlazorApp-issue-ilogger
Exceptions (if any)
none
.NET Version
7
Anything else?
if this is not allowed because of something then some error message should be thrown ?
thanks and regards