Skip to content

Lost custom logs attributes after await calls #4583

@Leinnan

Description

@Leinnan

Describe the Bug

Custom log attributes scope are not preserved after awaiting promise.

To Reproduce

Steps to reproduce the behavior:

Use this code:

		[ClientCallable]
		public async Promise<int> Asddd(int a, int b)
		{
			try
			{
                using var _ = Log.Default.BeginScope(new Dictionary<string, object>
                {
                    ["battleType"] = "DSADAS",
                });
                Log.Information("REQUEST: Creating a single match from player new");
                Log.Information("REQUEST: Creating a single match from player2 new");
                var ss = Context.BeamContext;
				
                var userAuth = await Services.Auth.GetUser(Context.AccountId).Recover(_ => new User(){id =  -1});
                Log.Information("Creating a single match from player {playerId}", userAuth.id);
                return a;
			}
			catch (Exception ex)
			{
				Log.Error(ex, "Received exception while ");
				throw;
			}
		}

Expected Behavior

All three logs would have battleType stored in log on portal.

Actual Behavior

battleType is preserved only in first two logs, last one after awaiting call to Services no longer contains that attribute in log.

Screenshots

Image

Metadata

  • SDK version: latest
  • Engine version: n/a
  • Operating System: all

Metadata

Metadata

Labels

bugSomething isn't working

Type

No fields configured for Bug.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions