I have an application whereby I'm creating a scope via IServiceScopeFactory.CreateScope.
From this scope, I first create an ILogger<T> and then add a scope to this logger.
var logScope = scopedLogger.BeginScope("SignalR connection. signalRConnectionId: {signalRConnectionId}", context.ConnectionId);
After this, I create various services (via the created scope), each of which I want to preserve the
logging scope I created.
This works fine initially, and I can see the scope against messages logged in the service constructor.
However, on later use, the logger that the service has, has lost the scope.
It has not been disposed, the IServiceScope has not been disposed, it just disappears.
My premise seems sound as it works in the initial constructor, but is somehow losing it along the way and I cannot see why that would be.