Skip to content

Commit 1725a6c

Browse files
committed
Suppressing execution context flow on admin function invocation
1 parent 5fb6f4d commit 1725a6c

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

src/WebJobs.Script.WebHost/Controllers/FunctionsController.cs

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -107,18 +107,21 @@ public IActionResult Invoke(string name, [FromBody] FunctionInvocation invocatio
107107
{ inputParameter.Name, invocation.Input }
108108
};
109109

110-
Task.Run(async () =>
110+
using (System.Threading.ExecutionContext.SuppressFlow())
111111
{
112-
IDictionary<string, object> loggerScope = new Dictionary<string, object>
112+
Task.Run(async () =>
113113
{
114-
{ "MS_IgnoreActivity", null }
115-
};
114+
IDictionary<string, object> loggerScope = new Dictionary<string, object>
115+
{
116+
{ "MS_IgnoreActivity", null }
117+
};
116118

117-
using (_logger.BeginScope(loggerScope))
118-
{
119-
await scriptHost.CallAsync(function.Name, arguments);
120-
}
121-
});
119+
using (_logger.BeginScope(loggerScope))
120+
{
121+
await scriptHost.CallAsync(function.Name, arguments);
122+
}
123+
});
124+
}
122125

123126
return Accepted();
124127
}

0 commit comments

Comments
 (0)