mscorlib(4.0.0.0) API with additions
Context.cs
6 using System.Security;
8 using System.Threading;
9 
11 {
13  [ComVisible(true)]
14  public class Context
15  {
16  internal const int CTX_DEFAULT_CONTEXT = 1;
17 
18  internal const int CTX_FROZEN = 2;
19 
20  internal const int CTX_THREADPOOL_AWARE = 4;
21 
22  private const int GROW_BY = 8;
23 
24  private const int STATICS_BUCKET_SIZE = 8;
25 
26  private IContextProperty[] _ctxProps;
27 
28  private DynamicPropertyHolder _dphCtx;
29 
30  private volatile LocalDataStoreHolder _localDataStore;
31 
32  private IMessageSink _serverContextChain;
33 
34  private IMessageSink _clientContextChain;
35 
36  private AppDomain _appDomain;
37 
38  private object[] _ctxStatics;
39 
40  private IntPtr _internalContext;
41 
42  private int _ctxID;
43 
44  private int _ctxFlags;
45 
46  private int _numCtxProps;
47 
48  private int _ctxStaticsCurrentBucket;
49 
50  private int _ctxStaticsFreeIndex;
51 
52  private static DynamicPropertyHolder _dphGlobal = new DynamicPropertyHolder();
53 
54  private static LocalDataStoreMgr _localDataStoreMgr = new LocalDataStoreMgr();
55 
56  private static int _ctxIDCounter = 0;
57 
60  public virtual int ContextID
61  {
62  [SecurityCritical]
63  get
64  {
65  return _ctxID;
66  }
67  }
68 
69  internal virtual IntPtr InternalContextID => _internalContext;
70 
71  internal virtual AppDomain AppDomain => _appDomain;
72 
73  internal bool IsDefaultContext => _ctxID == 0;
74 
77  public static Context DefaultContext
78  {
79  [SecurityCritical]
80  get
81  {
82  return Thread.GetDomain().GetDefaultContext();
83  }
84  }
85 
86  internal virtual bool IsThreadPoolAware => (_ctxFlags & 4) == 4;
87 
90  public virtual IContextProperty[] ContextProperties
91  {
92  [SecurityCritical]
93  get
94  {
95  if (_ctxProps == null)
96  {
97  return null;
98  }
99  lock (this)
100  {
101  IContextProperty[] array = new IContextProperty[_numCtxProps];
102  Array.Copy(_ctxProps, array, _numCtxProps);
103  return array;
104  }
105  }
106  }
107 
108  private LocalDataStore MyLocalStore
109  {
110  get
111  {
112  if (_localDataStore == null)
113  {
114  lock (_localDataStoreMgr)
115  {
116  if (_localDataStore == null)
117  {
118  _localDataStore = _localDataStoreMgr.CreateLocalDataStore();
119  }
120  }
121  }
122  return _localDataStore.Store;
123  }
124  }
125 
126  internal virtual IDynamicProperty[] PerContextDynamicProperties
127  {
128  get
129  {
130  if (_dphCtx == null)
131  {
132  return null;
133  }
134  return _dphCtx.DynamicProperties;
135  }
136  }
137 
138  internal static ArrayWithSize GlobalDynamicSinks
139  {
140  [SecurityCritical]
141  get
142  {
143  return _dphGlobal.DynamicSinks;
144  }
145  }
146 
147  internal virtual ArrayWithSize DynamicSinks
148  {
149  [SecurityCritical]
150  get
151  {
152  if (_dphCtx == null)
153  {
154  return null;
155  }
156  return _dphCtx.DynamicSinks;
157  }
158  }
159 
161  [SecurityCritical]
162  public Context()
163  : this(0)
164  {
165  }
166 
167  [SecurityCritical]
168  private Context(int flags)
169  {
170  _ctxFlags = flags;
171  if ((_ctxFlags & 1) != 0)
172  {
173  _ctxID = 0;
174  }
175  else
176  {
177  _ctxID = Interlocked.Increment(ref _ctxIDCounter);
178  }
179  DomainSpecificRemotingData remotingData = Thread.GetDomain().RemotingData;
180  if (remotingData != null)
181  {
182  IContextProperty[] appDomainContextProperties = remotingData.AppDomainContextProperties;
183  if (appDomainContextProperties != null)
184  {
185  for (int i = 0; i < appDomainContextProperties.Length; i++)
186  {
187  SetProperty(appDomainContextProperties[i]);
188  }
189  }
190  }
191  if ((_ctxFlags & 1) != 0)
192  {
193  Freeze();
194  }
195  SetupInternalContext((_ctxFlags & 1) == 1);
196  }
197 
198  [MethodImpl(MethodImplOptions.InternalCall)]
199  [SecurityCritical]
200  private extern void SetupInternalContext(bool bDefault);
201 
203  [SecuritySafeCritical]
204  ~Context()
205  {
206  if (_internalContext != IntPtr.Zero && (_ctxFlags & 1) == 0)
207  {
208  CleanupInternalContext();
209  }
210  }
211 
212  [MethodImpl(MethodImplOptions.InternalCall)]
213  [SecurityCritical]
214  private extern void CleanupInternalContext();
215 
216  [SecurityCritical]
217  internal static Context CreateDefaultContext()
218  {
219  return new Context(1);
220  }
221 
225  [SecurityCritical]
226  public virtual IContextProperty GetProperty(string name)
227  {
228  if (_ctxProps == null || name == null)
229  {
230  return null;
231  }
232  IContextProperty result = null;
233  for (int i = 0; i < _numCtxProps; i++)
234  {
235  if (_ctxProps[i].Name.Equals(name))
236  {
237  result = _ctxProps[i];
238  break;
239  }
240  }
241  return result;
242  }
243 
249  [SecurityCritical]
250  public virtual void SetProperty(IContextProperty prop)
251  {
252  if (prop == null || prop.Name == null)
253  {
254  throw new ArgumentNullException((prop == null) ? "prop" : "property name");
255  }
256  if ((_ctxFlags & 2) != 0)
257  {
258  throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_AddContextFrozen"));
259  }
260  lock (this)
261  {
262  CheckPropertyNameClash(prop.Name, _ctxProps, _numCtxProps);
263  if (_ctxProps == null || _numCtxProps == _ctxProps.Length)
264  {
265  _ctxProps = GrowPropertiesArray(_ctxProps);
266  }
267  _ctxProps[_numCtxProps++] = prop;
268  }
269  }
270 
271  [SecurityCritical]
272  internal virtual void InternalFreeze()
273  {
274  _ctxFlags |= 2;
275  for (int i = 0; i < _numCtxProps; i++)
276  {
277  _ctxProps[i].Freeze(this);
278  }
279  }
280 
283  [SecurityCritical]
284  public virtual void Freeze()
285  {
286  lock (this)
287  {
288  if ((_ctxFlags & 2) != 0)
289  {
290  throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_ContextAlreadyFrozen"));
291  }
292  InternalFreeze();
293  }
294  }
295 
296  internal virtual void SetThreadPoolAware()
297  {
298  _ctxFlags |= 4;
299  }
300 
301  [SecurityCritical]
302  internal static void CheckPropertyNameClash(string name, IContextProperty[] props, int count)
303  {
304  int num = 0;
305  while (true)
306  {
307  if (num < count)
308  {
309  if (props[num].Name.Equals(name))
310  {
311  break;
312  }
313  num++;
314  continue;
315  }
316  return;
317  }
318  throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_DuplicatePropertyName"));
319  }
320 
321  internal static IContextProperty[] GrowPropertiesArray(IContextProperty[] props)
322  {
323  int num = ((props != null) ? props.Length : 0) + 8;
324  IContextProperty[] array = new IContextProperty[num];
325  if (props != null)
326  {
327  Array.Copy(props, array, props.Length);
328  }
329  return array;
330  }
331 
332  [SecurityCritical]
333  internal virtual IMessageSink GetServerContextChain()
334  {
335  if (_serverContextChain == null)
336  {
337  IMessageSink messageSink = ServerContextTerminatorSink.MessageSink;
338  object obj = null;
339  int num = _numCtxProps;
340  while (num-- > 0)
341  {
342  obj = _ctxProps[num];
343  IContributeServerContextSink contributeServerContextSink = obj as IContributeServerContextSink;
344  if (contributeServerContextSink != null)
345  {
346  messageSink = contributeServerContextSink.GetServerContextSink(messageSink);
347  if (messageSink == null)
348  {
349  throw new RemotingException(Environment.GetResourceString("Remoting_Contexts_BadProperty"));
350  }
351  }
352  }
353  lock (this)
354  {
355  if (_serverContextChain == null)
356  {
357  _serverContextChain = messageSink;
358  }
359  }
360  }
361  return _serverContextChain;
362  }
363 
364  [SecurityCritical]
365  internal virtual IMessageSink GetClientContextChain()
366  {
367  if (_clientContextChain == null)
368  {
369  IMessageSink messageSink = ClientContextTerminatorSink.MessageSink;
370  object obj = null;
371  for (int i = 0; i < _numCtxProps; i++)
372  {
373  obj = _ctxProps[i];
374  IContributeClientContextSink contributeClientContextSink = obj as IContributeClientContextSink;
375  if (contributeClientContextSink != null)
376  {
377  messageSink = contributeClientContextSink.GetClientContextSink(messageSink);
378  if (messageSink == null)
379  {
380  throw new RemotingException(Environment.GetResourceString("Remoting_Contexts_BadProperty"));
381  }
382  }
383  }
384  lock (this)
385  {
386  if (_clientContextChain == null)
387  {
388  _clientContextChain = messageSink;
389  }
390  }
391  }
392  return _clientContextChain;
393  }
394 
395  [SecurityCritical]
396  internal virtual IMessageSink CreateServerObjectChain(MarshalByRefObject serverObj)
397  {
398  IMessageSink messageSink = new ServerObjectTerminatorSink(serverObj);
399  object obj = null;
400  int num = _numCtxProps;
401  while (num-- > 0)
402  {
403  obj = _ctxProps[num];
404  IContributeObjectSink contributeObjectSink = obj as IContributeObjectSink;
405  if (contributeObjectSink != null)
406  {
407  messageSink = contributeObjectSink.GetObjectSink(serverObj, messageSink);
408  if (messageSink == null)
409  {
410  throw new RemotingException(Environment.GetResourceString("Remoting_Contexts_BadProperty"));
411  }
412  }
413  }
414  return messageSink;
415  }
416 
417  [SecurityCritical]
418  internal virtual IMessageSink CreateEnvoyChain(MarshalByRefObject objectOrProxy)
419  {
420  IMessageSink messageSink = EnvoyTerminatorSink.MessageSink;
421  object obj = null;
422  for (int i = 0; i < _numCtxProps; i++)
423  {
424  obj = _ctxProps[i];
425  IContributeEnvoySink contributeEnvoySink = obj as IContributeEnvoySink;
426  if (contributeEnvoySink != null)
427  {
428  messageSink = contributeEnvoySink.GetEnvoySink(objectOrProxy, messageSink);
429  if (messageSink == null)
430  {
431  throw new RemotingException(Environment.GetResourceString("Remoting_Contexts_BadProperty"));
432  }
433  }
434  }
435  return messageSink;
436  }
437 
438  [SecurityCritical]
439  internal IMessage NotifyActivatorProperties(IMessage msg, bool bServerSide)
440  {
441  IMessage result = null;
442  try
443  {
444  int num = _numCtxProps;
445  object obj = null;
446  while (num-- != 0)
447  {
448  obj = _ctxProps[num];
449  IContextPropertyActivator contextPropertyActivator = obj as IContextPropertyActivator;
450  if (contextPropertyActivator != null)
451  {
452  IConstructionCallMessage constructionCallMessage = msg as IConstructionCallMessage;
453  if (constructionCallMessage != null)
454  {
455  if (!bServerSide)
456  {
457  contextPropertyActivator.CollectFromClientContext(constructionCallMessage);
458  }
459  else
460  {
461  contextPropertyActivator.DeliverClientContextToServerContext(constructionCallMessage);
462  }
463  }
464  else if (bServerSide)
465  {
466  contextPropertyActivator.CollectFromServerContext((IConstructionReturnMessage)msg);
467  }
468  else
469  {
470  contextPropertyActivator.DeliverServerContextToClientContext((IConstructionReturnMessage)msg);
471  }
472  }
473  }
474  return result;
475  }
476  catch (Exception e)
477  {
478  IMethodCallMessage methodCallMessage = null;
479  methodCallMessage = ((!(msg is IConstructionCallMessage)) ? new ErrorMessage() : ((IMethodCallMessage)msg));
480  result = new ReturnMessage(e, methodCallMessage);
481  if (msg == null)
482  {
483  return result;
484  }
485  ((ReturnMessage)result).SetLogicalCallContext((LogicalCallContext)msg.Properties[Message.CallContextKey]);
486  return result;
487  }
488  }
489 
492  public override string ToString()
493  {
494  return "ContextID: " + _ctxID;
495  }
496 
499  [SecurityCritical]
500  public void DoCallBack(CrossContextDelegate deleg)
501  {
502  if (deleg == null)
503  {
504  throw new ArgumentNullException("deleg");
505  }
506  if ((_ctxFlags & 2) == 0)
507  {
508  throw new RemotingException(Environment.GetResourceString("Remoting_Contexts_ContextNotFrozenForCallBack"));
509  }
510  Context currentContext = Thread.CurrentContext;
511  if (currentContext == this)
512  {
513  deleg();
514  return;
515  }
516  currentContext.DoCallBackGeneric(InternalContextID, deleg);
517  GC.KeepAlive(this);
518  }
519 
520  [SecurityCritical]
521  internal static void DoCallBackFromEE(IntPtr targetCtxID, IntPtr privateData, int targetDomainID)
522  {
523  if (targetDomainID == 0)
524  {
525  CallBackHelper @object = new CallBackHelper(privateData, bFromEE: true, targetDomainID);
526  CrossContextDelegate deleg = @object.Func;
527  Thread.CurrentContext.DoCallBackGeneric(targetCtxID, deleg);
528  return;
529  }
530  TransitionCall msg = new TransitionCall(targetCtxID, privateData, targetDomainID);
531  Message.PropagateCallContextFromThreadToMessage(msg);
532  IMessage message = Thread.CurrentContext.GetClientContextChain().SyncProcessMessage(msg);
533  Message.PropagateCallContextFromMessageToThread(message);
534  IMethodReturnMessage methodReturnMessage = message as IMethodReturnMessage;
535  if (methodReturnMessage == null || methodReturnMessage.Exception == null)
536  {
537  return;
538  }
539  throw methodReturnMessage.Exception;
540  }
541 
542  [SecurityCritical]
543  internal void DoCallBackGeneric(IntPtr targetCtxID, CrossContextDelegate deleg)
544  {
545  TransitionCall msg = new TransitionCall(targetCtxID, deleg);
546  Message.PropagateCallContextFromThreadToMessage(msg);
547  IMessage message = GetClientContextChain().SyncProcessMessage(msg);
548  if (message != null)
549  {
550  Message.PropagateCallContextFromMessageToThread(message);
551  }
552  IMethodReturnMessage methodReturnMessage = message as IMethodReturnMessage;
553  if (methodReturnMessage != null && methodReturnMessage.Exception != null)
554  {
555  throw methodReturnMessage.Exception;
556  }
557  }
558 
559  [MethodImpl(MethodImplOptions.InternalCall)]
560  [SecurityCritical]
561  internal static extern void ExecuteCallBackInEE(IntPtr privateData);
562 
565  [SecurityCritical]
567  {
568  return _localDataStoreMgr.AllocateDataSlot();
569  }
570 
574  [SecurityCritical]
575  public static LocalDataStoreSlot AllocateNamedDataSlot(string name)
576  {
577  return _localDataStoreMgr.AllocateNamedDataSlot(name);
578  }
579 
583  [SecurityCritical]
584  public static LocalDataStoreSlot GetNamedDataSlot(string name)
585  {
586  return _localDataStoreMgr.GetNamedDataSlot(name);
587  }
588 
591  [SecurityCritical]
592  public static void FreeNamedDataSlot(string name)
593  {
594  _localDataStoreMgr.FreeNamedDataSlot(name);
595  }
596 
600  [SecurityCritical]
601  public static void SetData(LocalDataStoreSlot slot, object data)
602  {
603  Thread.CurrentContext.MyLocalStore.SetData(slot, data);
604  }
605 
609  [SecurityCritical]
610  public static object GetData(LocalDataStoreSlot slot)
611  {
612  return Thread.CurrentContext.MyLocalStore.GetData(slot);
613  }
614 
615  private int ReserveSlot()
616  {
617  if (_ctxStatics == null)
618  {
619  _ctxStatics = new object[8];
620  _ctxStatics[0] = null;
621  _ctxStaticsFreeIndex = 1;
622  _ctxStaticsCurrentBucket = 0;
623  }
624  if (_ctxStaticsFreeIndex == 8)
625  {
626  object[] array = new object[8];
627  object[] array2 = _ctxStatics;
628  while (array2[0] != null)
629  {
630  array2 = (object[])array2[0];
631  }
632  array2[0] = array;
633  _ctxStaticsFreeIndex = 1;
634  _ctxStaticsCurrentBucket++;
635  }
636  return _ctxStaticsFreeIndex++ | (_ctxStaticsCurrentBucket << 16);
637  }
638 
647  [SecuritySafeCritical]
648  [SecurityPermission(SecurityAction.Demand, Flags = SecurityPermissionFlag.Infrastructure)]
650  {
651  bool flag = false;
652  if (prop == null || prop.Name == null || !(prop is IContributeDynamicSink))
653  {
654  throw new ArgumentNullException("prop");
655  }
656  if (obj != null && ctx != null)
657  {
658  throw new ArgumentException(Environment.GetResourceString("Argument_NonNullObjAndCtx"));
659  }
660  if (obj != null)
661  {
662  return IdentityHolder.AddDynamicProperty(obj, prop);
663  }
664  return AddDynamicProperty(ctx, prop);
665  }
666 
675  [SecuritySafeCritical]
676  [SecurityPermission(SecurityAction.Demand, Flags = SecurityPermissionFlag.Infrastructure)]
677  public static bool UnregisterDynamicProperty(string name, ContextBoundObject obj, Context ctx)
678  {
679  if (name == null)
680  {
681  throw new ArgumentNullException("name");
682  }
683  if (obj != null && ctx != null)
684  {
685  throw new ArgumentException(Environment.GetResourceString("Argument_NonNullObjAndCtx"));
686  }
687  bool flag = false;
688  if (obj != null)
689  {
690  return IdentityHolder.RemoveDynamicProperty(obj, name);
691  }
692  return RemoveDynamicProperty(ctx, name);
693  }
694 
695  [SecurityCritical]
696  internal static bool AddDynamicProperty(Context ctx, IDynamicProperty prop)
697  {
698  return ctx?.AddPerContextDynamicProperty(prop) ?? AddGlobalDynamicProperty(prop);
699  }
700 
701  [SecurityCritical]
702  private bool AddPerContextDynamicProperty(IDynamicProperty prop)
703  {
704  if (_dphCtx == null)
705  {
706  DynamicPropertyHolder dphCtx = new DynamicPropertyHolder();
707  lock (this)
708  {
709  if (_dphCtx == null)
710  {
711  _dphCtx = dphCtx;
712  }
713  }
714  }
715  return _dphCtx.AddDynamicProperty(prop);
716  }
717 
718  [SecurityCritical]
719  private static bool AddGlobalDynamicProperty(IDynamicProperty prop)
720  {
721  return _dphGlobal.AddDynamicProperty(prop);
722  }
723 
724  [SecurityCritical]
725  internal static bool RemoveDynamicProperty(Context ctx, string name)
726  {
727  return ctx?.RemovePerContextDynamicProperty(name) ?? RemoveGlobalDynamicProperty(name);
728  }
729 
730  [SecurityCritical]
731  private bool RemovePerContextDynamicProperty(string name)
732  {
733  if (_dphCtx == null)
734  {
735  throw new RemotingException(string.Format(CultureInfo.CurrentCulture, Environment.GetResourceString("Remoting_Contexts_NoProperty"), name));
736  }
737  return _dphCtx.RemoveDynamicProperty(name);
738  }
739 
740  [SecurityCritical]
741  private static bool RemoveGlobalDynamicProperty(string name)
742  {
743  return _dphGlobal.RemoveDynamicProperty(name);
744  }
745 
746  [SecurityCritical]
747  internal virtual bool NotifyDynamicSinks(IMessage msg, bool bCliSide, bool bStart, bool bAsync, bool bNotifyGlobals)
748  {
749  bool result = false;
750  if (bNotifyGlobals && _dphGlobal.DynamicProperties != null)
751  {
752  ArrayWithSize globalDynamicSinks = GlobalDynamicSinks;
753  if (globalDynamicSinks != null)
754  {
755  DynamicPropertyHolder.NotifyDynamicSinks(msg, globalDynamicSinks, bCliSide, bStart, bAsync);
756  result = true;
757  }
758  }
759  ArrayWithSize dynamicSinks = DynamicSinks;
760  if (dynamicSinks != null)
761  {
762  DynamicPropertyHolder.NotifyDynamicSinks(msg, dynamicSinks, bCliSide, bStart, bAsync);
763  result = true;
764  }
765  return result;
766  }
767  }
768 }
virtual void SetProperty(IContextProperty prop)
Sets a specific context property by name.
Definition: Context.cs:250
The exception that is thrown when a null reference (Nothing in Visual Basic) is passed to a method th...
Describes a set of security permissions applied to code. This class cannot be inherited.
static void FreeNamedDataSlot(string name)
Frees a named data slot on all the contexts.
Definition: Context.cs:592
static object GetData(LocalDataStoreSlot slot)
Retrieves the value from the specified slot on the current context.
Definition: Context.cs:610
Holds a message returned in response to a method call on a remote object.
Encapsulates a memory slot to store local data. This class cannot be inherited.
static void SetData(LocalDataStoreSlot slot, object data)
Sets the data in the specified slot on the current context.
Definition: Context.cs:601
Defines the method call return message interface.
IMessage SyncProcessMessage(IMessage msg)
Synchronously processes the given message.
Represents the construction call request of an object.
static Context DefaultContext
Gets the default context for the current application domain.
Definition: Context.cs:78
Gathers naming information from the context property and determines whether the new context is ok for...
Defines the method call message interface.
Indicates that the implementing property should be registered at runtime through the M:System....
virtual int ContextID
Gets the context ID for the current context.
Definition: Context.cs:61
Definition: __Canon.cs:3
override string ToString()
Returns a T:System.String class representation of the current context.
Definition: Context.cs:492
static void KeepAlive(object obj)
References the specified object, which makes it ineligible for garbage collection from the start of t...
Definition: GC.cs:267
void DoCallBack(CrossContextDelegate deleg)
Executes code in another context.
Definition: Context.cs:500
Defines an environment for the objects that are resident inside it and for which a policy can be enfo...
Definition: Context.cs:14
Indicates that the implementing property will be registered at runtime through the M:System....
IDictionary Properties
Gets an T:System.Collections.IDictionary that represents a collection of the message's properties.
Definition: IMessage.cs:15
string Name
Gets the name of the dynamic property.
Represents an application domain, which is an isolated environment where applications execute....
Definition: AppDomain.cs:33
static bool UnregisterDynamicProperty(string name, ContextBoundObject obj, Context ctx)
Unregisters a dynamic property implementing the T:System.Runtime.Remoting.Contexts....
Definition: Context.cs:677
SecurityAction
Specifies the security actions that can be performed using declarative security.
Identifies a T:System.Runtime.Remoting.Messaging.IMethodReturnMessage that is returned after attempti...
Provides information about, and means to manipulate, the current environment and platform....
Definition: Environment.cs:21
Defines the base class for all context-bound classes.
static int Increment(ref int location)
Increments a specified variable and stores the result, as an atomic operation.
Definition: Interlocked.cs:18
static bool RegisterDynamicProperty(IDynamicProperty prop, ContextBoundObject obj, Context ctx)
Registers a dynamic property implementing the T:System.Runtime.Remoting.Contexts.IDynamicProperty int...
Definition: Context.cs:649
A platform-specific type that is used to represent a pointer or a handle.
Definition: IntPtr.cs:14
virtual IContextProperty GetProperty(string name)
Returns a specific context property, specified by name.
Definition: Context.cs:226
delegate void CrossContextDelegate()
Represents the method that will handle the requests of execution of some code in another context.
Context()
Initializes a new instance of the T:System.Runtime.Remoting.Contexts.Context class.
Definition: Context.cs:162
Provides methods for creating, manipulating, searching, and sorting arrays, thereby serving as the ba...
Definition: Array.cs:17
string Name
Gets the name of the property under which it will be added to the context.
MethodImplOptions
Defines the details of how a method is implemented.
static LocalDataStoreSlot GetNamedDataSlot(string name)
Looks up a named data slot.
Definition: Context.cs:584
static AppDomain GetDomain()
Returns the current domain in which the current thread is running.
Definition: Thread.cs:1096
Indicates that data in the pipe is transmitted and read as a stream of messages.
Provides a set of properties that are carried with the execution code path during remote method calls...
Controls the system garbage collector, a service that automatically reclaims unused memory.
Definition: GC.cs:11
Contains communication data sent between cooperating message sinks.
Definition: IMessage.cs:9
static LocalDataStoreSlot AllocateDataSlot()
Allocates an unnamed data slot.
Definition: Context.cs:566
virtual IContextProperty [] ContextProperties
Gets the array of the current context properties.
Definition: Context.cs:91
static LocalDataStoreSlot AllocateNamedDataSlot(string name)
Allocates a named data slot.
Definition: Context.cs:575
static CultureInfo CurrentCulture
Gets or sets the T:System.Globalization.CultureInfo object that represents the culture used by the cu...
Definition: CultureInfo.cs:120
The exception that is thrown when one of the arguments provided to a method is not valid.
static void Copy(Array sourceArray, Array destinationArray, int length)
Copies a range of elements from an T:System.Array starting at the first element and pastes them into ...
Definition: Array.cs:1275
Defines the interface for a message sink.
Definition: IMessageSink.cs:8
The exception that is thrown when a method call is invalid for the object's current state.
Provides information about a specific culture (called a locale for unmanaged code development)....
Definition: CultureInfo.cs:16
void Freeze(Context newContext)
Called when the context is frozen.
SecurityPermissionFlag
Specifies access flags for the security permission object.
Provides atomic operations for variables that are shared by multiple threads.
Definition: Interlocked.cs:10
static Context CurrentContext
Gets the current context in which the thread is executing.
Definition: Thread.cs:285
The exception that is thrown when something has gone wrong during remoting.
Exception Exception
Gets the exception thrown during the method call.
virtual void Freeze()
Freezes the context, making it impossible to add or remove context properties from the current contex...
Definition: Context.cs:284
Creates and controls a thread, sets its priority, and gets its status.
Definition: Thread.cs:18