Closed OnamChilwan closed 7 years ago
Please create a small repro project for me to work with.
Have a workaround in place whereby I have included an additional middleware
which adds to the owin context
and then as part of the func
you expose I then evaluate the owin dictionary
and add as necessary. This is because, as part of the UseApplicationInsights()
you already commit the telemetry data so if I were to commit anything afterwards it would appear as multiple tracks against the request.
In a nutshell it looks like this:
app.UseApplicationInsights(getContextProperties: GetContextProperties());
app.Use<Middleware1>();
private static Func<IOwinRequest, IOwinResponse, KeyValuePair<string, string>[]> GetContextProperties()
{
return (req, res) =>
{
object value;
if (response.Context.Environment.TryGetValue("foo", out value))
{
return new KeyValuePair<string, string>("Foo", value.ToString())
}
return new[] { new KeyValuePair<string, string>(string.Empty, string.Empty) };
};
}
public class Middleware1 : OwinMiddleware
{
public Middleware1(OwinMiddleware next) : base(next)
{
}
public override async Task Invoke(IOwinContext context)
{
if (context.Response.StatusCode == (int)HttpStatusCode.BadRequest)
{
context.Response.Environment.Add("foo", "hello world");
}
}
}
Sorry, but I don't understand how this is related to missing operation id issue. It would really help to see some working code that exposes the problem.
Seen a couple of issues related to the
OperationId
being null but they seem to have gone off the grid due to inactivity. I tried using theRestoreOperationIdContext()
just beforeUseWebApi()
however theid
still remains null. In a nutshell this is what I have:Thanks.