Questions tagged [callcontext]

15 questions
23
votes
2 answers

.NET Core equivalent of CallContext.LogicalGet/SetData

I am trying to move into .net core an existing .net application that is using CallContext.LogicalGet/SetData. When a web request hits the application I save a CorrelationId in the CallContext and whenever I need to log something later down the…
Gradinariu Cezar
  • 393
  • 3
  • 10
4
votes
1 answer

Disposing thread static variable

I have a ThreadStatic member in a static class. The static class is used in a multi threaded environment. I want to make sure that when a thread is returned to threadpool (or re-used), the member is disposed (or re-initialized), so any subsequent…
3
votes
0 answers

CallContext value set in web api action filter does not flow to Controller action

I have an asp.net web api where we are starting a transaction using TransactionScope (only for POST,PUT and DELETE but not for GET) in OnActionExecuting of a global action filter and then completing or rolling it back in OnActionExecuted. Recently…
Jags
  • 762
  • 6
  • 17
3
votes
1 answer

CallContext is carrying foreward the previous data which was set

I have this condition where I see that the thread's CallContext is carrying foreward the data in consequent calls. Consider I have a simple API which when queired, will set one data entry into CallContext using : // entry to the API execution…
Ajay Aradhya
  • 826
  • 12
  • 25
1
vote
0 answers

AsyncLocal & CallContext - How can I acheive both async *and* remoting logical context guarantees?

I'm attempting to develop a library that implements the loosely-defined Ambient Context pattern. I need to consider both a high-degree of parallelism and remoting (.NET Framework 4.6.2). It seems I have 2 options available: AsyncLocal and…
Matt
  • 1,624
  • 1
  • 14
  • 32
1
vote
2 answers

Using the CallContext to store the HttpContext for WCF

I currently have a WCF service used to perform some database queries and send a mail. Long story short, both methods are async use HttpContext.Current somewhere in their implementation. My initial problem is that after the first await,…
ssougnez
  • 4,202
  • 9
  • 36
  • 65
0
votes
2 answers

Data flow between Parent and child threads in Dotnetcore

I am trying to maintain data between parent and its child threads in .NET Core web applications. where I need to store the web application name and web request URL of the Parent thread and needs to use it when its child thread starts its execution.…
Durai
  • 87
  • 10
0
votes
0 answers

Alternative for Call Context in .NET Core

I understand that .Net Core doesn't support Call Context. But our application uses the same and we are planning to migrate it to .Net Core. I am trying to maintain data between parent and its child threads in Dotnetcore web applications. where I…
Durai
  • 87
  • 10
0
votes
0 answers

C# CallContext class can store 2 keys?

Existing code: public abstract class MyProjectDb: DB { public static DB ActualDb { get { DB d1 = CallContext.GetData("_d1_") as DB; if (d1 == null) { d1 = new…
0
votes
0 answers

CallContext - SetLogicalData Alternatives

TargetFramework - .Net 472 Framework I am using CallContext - LogicalGetData & LogicalSetData in order to save Audit data that I collect throughout flows in the system (HTTP requests). The problem is, when my flow begins with a certain thread and…
RanAB
  • 300
  • 1
  • 2
  • 13
0
votes
2 answers

How to prevent task from inheriting parent task Logical Call context

I am trying to use AsyncLocal as a replacement for Thread local storage when using Task.Run() and Async methods. The problem I have is that i need the code below to print from t1 t1 from t1 t1 from t2 t2 from t2 t2 This would be the behavior if…
0
votes
1 answer

Do I need to cleanup NLog MDLC myself?

I am using NLog 4.5.10 with C# 4.7.1 inside a REST server. There I am using the method MappedDiagnosticsLogicalContext.Set(item, value) to add some parameters of the request to my log message. The question now: Do I have to clean them up manually or…
Daniel P.
  • 43
  • 4
0
votes
1 answer

Create AppDomain without/empty CallContext

Inside an ASP.NET application, I want to create an AppDomain in which untrusted code will be running. However when initializing and unwrapping my assembly loader, an exception is thrown about a type that I'm not passing in. It's the current user…
Bouke
  • 10,025
  • 6
  • 49
  • 88
0
votes
1 answer

.net core AsyncLocal loses context with System.Reactive

I want to use AsyncLocal to pass information through async workflows for tracing purpose. Now i faced a problem with RX. Thios is my test code: using System; using System.Reactive.Linq; using System.Reactive.Subjects; using System.Threading; using…
0
votes
1 answer

Why AsyncLocal is different from CallContext

Running the bellow code you can see that there is a different between CallContext and AsyncLocal. using System; using System.Runtime.Remoting.Messaging; using System.Threading; namespace AsyncLocalIsDifferentThanCallContext { class Program …
Fitzchak Yitzchaki
  • 8,867
  • 7
  • 51
  • 94