static public CompressedStack GetCompressedStack() { #if !FEATURE_COMPRESSEDSTACK throw new NotSupportedException(); #else // Note: CompressedStack.GetCompressedStack doesn't return null // like Thread.CurrentThread.GetCompressedStack if no compressed // stack is present. CompressedStack cs = Thread.CurrentThread.ExecutionContext.SecurityContext.CompressedStack; if (cs == null || cs.IsEmpty()) { cs = CompressedStack.Capture(); } else { cs = cs.CreateCopy(); // merge the existing compressed stack (from a previous Thread) with the current // Thread stack so we can assign "all of it" to yet another Thread CompressedStack newstack = CompressedStack.Capture(); for (int i = 0; i < newstack._list.Count; i++) { cs._list.Add(newstack._list [i]); } } return(cs); #endif }
static public void Run(CompressedStack compressedStack, ContextCallback callback, object state) { #if !FEATURE_COMPRESSEDSTACK throw new NotSupportedException(); #else if (compressedStack == null) { throw new ArgumentException("compressedStack"); } Thread t = Thread.CurrentThread; CompressedStack original = null; try { original = t.ExecutionContext.SecurityContext.CompressedStack; t.ExecutionContext.SecurityContext.CompressedStack = compressedStack; callback(state); } finally { if (original != null) { t.ExecutionContext.SecurityContext.CompressedStack = original; } } #endif }
public static void Run(CompressedStack compressedStack, ContextCallback callback, object?state) { ArgumentNullException.ThrowIfNull(compressedStack); // The original code was not checking for a null callback and would throw NullReferenceException callback(state); }
internal static CompressedStackSwitcher SetCompressedStack(CompressedStack cs, CompressedStack prevCS) { CompressedStackSwitcher result = default(CompressedStackSwitcher); RuntimeHelpers.PrepareConstrainedRegions(); try { RuntimeHelpers.PrepareConstrainedRegions(); try { } finally { CompressedStack.SetCompressedStackThread(cs); result.prev_CS = prevCS; result.curr_CS = cs; result.prev_ADStack = CompressedStack.SetAppDomainStack(cs); } } catch { result.UndoNoThrow(); throw; } return(result); }
internal static CompressedStackSwitcher SetCompressedStack(CompressedStack cs, CompressedStack prevCS) { CompressedStackSwitcher compressedStackSwitcher = new CompressedStackSwitcher(); RuntimeHelpers.PrepareConstrainedRegions(); try { RuntimeHelpers.PrepareConstrainedRegions(); try { } finally { CompressedStack.SetCompressedStackThread(cs); compressedStackSwitcher.prev_CS = prevCS; compressedStackSwitcher.curr_CS = cs; compressedStackSwitcher.prev_ADStack = CompressedStack.SetAppDomainStack(cs); } } catch { compressedStackSwitcher.UndoNoThrow(); throw; } return(compressedStackSwitcher); }
internal CompressedStackRunData(CompressedStack cs, ContextCallback cb, Object state) { this.cs = cs; this.callBack = cb; this.state = state; this.cssw = new CompressedStackSwitcher(); }
// internal stuff internal bool Equals(CompressedStack cs) { if (IsEmpty()) { return(cs.IsEmpty()); } if (cs.IsEmpty()) { return(false); } if (_list.Count != cs._list.Count) { return(false); } for (int i = 0; i < _list.Count; i++) { SecurityFrame sf1 = (SecurityFrame)_list [i]; SecurityFrame sf2 = (SecurityFrame)cs._list [i]; if (!sf1.Equals(sf2)) { return(false); } } return(true); }
internal static CompressedStack GetCompressedStack(ref StackCrawlMark stackMark) { CompressedStack cs; CompressedStack innerCS = null; if (CodeAccessSecurityEngine.QuickCheckForAllDemands()) { cs = new CompressedStack(null); } else if (CodeAccessSecurityEngine.AllDomainsHomogeneousWithNoStackModifiers()) { cs = new CompressedStack(null); cs.m_pls = PermissionListSet.CreateCompressedState_HG(); } else { // regular stackwalking case cs = new CompressedStack(GetDelayedCompressedStack(ref stackMark)); if (cs.CompressedStackHandle != null && IsImmediateCompletionCandidate(cs.CompressedStackHandle, out innerCS)) { cs.CompleteConstruction(innerCS); DestroyDCSList(cs.CompressedStackHandle); } } return(cs); }
internal static void SetCompressedStackThread(CompressedStack cs) { Thread currentThread = Thread.CurrentThread; if (currentThread.GetExecutionContextReader().SecurityContext.CompressedStack == cs) { return; } ExecutionContext executionContext = currentThread.GetMutableExecutionContext(); if (executionContext.SecurityContext != null) { executionContext.SecurityContext.CompressedStack = cs; } else { if (cs == null) { return; } executionContext.SecurityContext = new SecurityContext() { CompressedStack = cs }; } }
[MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable public static CompressedStack GetCompressedStack() { // This is a Capture() StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller; return(CompressedStack.GetCompressedStack(ref stackMark)); }
[HandleProcessCorruptedStateExceptions] // #endif // FEATURE_CORRUPTING_EXCEPTIONS internal static CompressedStackSwitcher SetCompressedStack(CompressedStack cs, CompressedStack prevCS) { CompressedStackSwitcher cssw = new CompressedStackSwitcher(); RuntimeHelpers.PrepareConstrainedRegions(); try { // Order is important in this block. // Also, we dont want any THreadAborts happening when we try to set it RuntimeHelpers.PrepareConstrainedRegions(); try { // Empty try block to ensure no ThreadAborts in the finally block } finally { // SetCompressedStackThread can throw - only if it suceeds we shd update the switcher and overrides SetCompressedStackThread(cs); cssw.prev_CS = prevCS; cssw.curr_CS = cs; cssw.prev_ADStack = SetAppDomainStack(cs); } } catch { cssw.UndoNoThrow(); throw; // throw the original exception } return(cssw); }
internal CompressedStack(CompressedStack cs) { if (cs != null && cs._list != null) { this._list = (ArrayList)cs._list.Clone(); } }
internal bool Equals(CompressedStack cs) { if (this.IsEmpty()) { return(cs.IsEmpty()); } if (cs.IsEmpty()) { return(false); } if (this._list.Count != cs._list.Count) { return(false); } for (int i = 0; i < this._list.Count; i++) { SecurityFrame securityFrame = (SecurityFrame)this._list[i]; SecurityFrame sf = (SecurityFrame)cs._list[i]; if (!securityFrame.Equals(sf)) { return(false); } } return(true); }
// copy constructor internal SecurityContext (SecurityContext sc) { _capture = true; _winid = sc._winid; if (sc._stack != null) _stack = sc._stack.CreateCopy (); }
internal CompressedStack(CompressedStack cs) { if ((cs != null) && (cs._list != null)) { _list = (ArrayList)cs._list.Clone(); } }
public void SetCompressedStack(CompressedStack stack) { #if MOBILE throw new NotSupportedException(); #else ExecutionContext.SecurityContext.CompressedStack = stack; #endif }
// copy constructor internal SecurityContext (SecurityContext sc) { _capture = true; #if !MOBILE _winid = sc._winid; if (sc._stack != null) _stack = sc._stack.CreateCopy (); #endif }
CompressedStack GetCompressedStack() { // Note: returns null if no CompressedStack has been set. // However CompressedStack.GetCompressedStack returns an // (empty?) CompressedStack instance. CompressedStack cs = ExecutionContext.SecurityContext.CompressedStack; return(((cs == null) || cs.IsEmpty()) ? null : cs.CreateCopy()); }
public static void Run(CompressedStack compressedStack, ContextCallback callback, object state) { if (compressedStack == null) { throw new ArgumentNullException(nameof(compressedStack)); } // The original code was not checking for a null callback and would throw NullReferenceException callback(state); }
public void SetCompressedStack(CompressedStack stack) { if (stack != null) { SetCompressedStackInternal(stack.UnmanagedCompressedStack); } else { SetCompressedStackInternal((IntPtr)0); } }
public CompressedStack GetCompressedStack() { #if MOBILE throw new NotSupportedException(); #else // Note: returns null if no CompressedStack has been set. // However CompressedStack.GetCompressedStack returns an // (empty?) CompressedStack instance. CompressedStack cs = ExecutionContext.SecurityContext.CompressedStack; return(((cs == null) || cs.IsEmpty()) ? null : cs.CreateCopy()); #endif }
public void Undo () { if ((_cs != null) && (_t != null)) { lock (_cs) { if ((_cs != null) && (_t != null)) { _t.SetCompressedStack (_cs); } _t = null; _cs = null; } } }
static CompressedStack Capture () { CompressedStack cs = new CompressedStack (0); cs._list = SecurityFrame.GetStack (1); // include any current CompressedStack inside the new Capture CompressedStack currentCs = Thread.CurrentThread.GetCompressedStack (); if (currentCs != null) { for (int i=0; i < currentCs._list.Count; i++) cs._list.Add (currentCs._list [i]); } return cs; }
public static CompressedStack Capture () { CompressedStack cs = new CompressedStack (0); cs._list = SecurityFrame.GetStack (1); // include any current CompressedStack inside the new Capture CompressedStack currentCs = Thread.CurrentThread.GetCompressedStack (); if (currentCs != null) { for (int i=0; i < currentCs._list.Count; i++) cs._list.Add (currentCs._list [i]); } return cs; }
internal void CompleteConstruction(CompressedStack innerCS) { if (this.PLS == null) { PermissionListSet set = PermissionListSet.CreateCompressedState(this, innerCS); lock (this) { if (this.PLS == null) { this.m_pls = set; } } } }
public static void Run(CompressedStack compressedStack, ContextCallback callback, object state) { if (compressedStack == null) { throw new ArgumentException(Environment.GetResourceString("Arg_NamedParamNull"), "compressedStack"); } if (CompressedStack.cleanupCode == null) { CompressedStack.tryCode = new RuntimeHelpers.TryCode(CompressedStack.runTryCode); CompressedStack.cleanupCode = new RuntimeHelpers.CleanupCode(CompressedStack.runFinallyCode); } CompressedStack.CompressedStackRunData compressedStackRunData = new CompressedStack.CompressedStackRunData(compressedStack, callback, state); RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(CompressedStack.tryCode, CompressedStack.cleanupCode, (object)compressedStackRunData); }
public void Undo() { if ((this.curr_CS != null) || (this.prev_CS != null)) { if (this.prev_ADStack != IntPtr.Zero) { CompressedStack.RestoreAppDomainStack(this.prev_ADStack); } CompressedStack.SetCompressedStackThread(this.prev_CS); this.prev_CS = null; this.curr_CS = null; this.prev_ADStack = IntPtr.Zero; } }
public void Undo() { if ((_cs != null) && (_t != null)) { lock (_cs) { if ((_cs != null) && (_t != null)) { _t.SetCompressedStack(_cs); } _t = null; _cs = null; } } }
public void Undo() { if (this.curr_CS == null && this.prev_CS == null) { return; } if (this.prev_ADStack != (IntPtr)0) { CompressedStack.RestoreAppDomainStack(this.prev_ADStack); } CompressedStack.SetCompressedStackThread(this.prev_CS); this.prev_CS = null; this.curr_CS = null; this.prev_ADStack = (IntPtr)0; }
internal static void SetCompressedStackThread(CompressedStack cs) { ExecutionContext ec = Thread.CurrentThread.ExecutionContext; if (ec.SecurityContext != null) { ec.SecurityContext.CompressedStack = cs; } else if (cs != null) { SecurityContext sc = new SecurityContext(); sc.CompressedStack = cs; ec.SecurityContext = sc; } }
/// <summary>Captures the compressed stack from the current thread.</summary> /// <returns>A <see cref="T:System.Threading.CompressedStack" /> object.</returns> /// <filterpriority>1</filterpriority> public static CompressedStack Capture() { CompressedStack compressedStack = new CompressedStack(0); compressedStack._list = SecurityFrame.GetStack(1); CompressedStack compressedStack2 = Thread.CurrentThread.GetCompressedStack(); if (compressedStack2 != null) { for (int i = 0; i < compressedStack2._list.Count; i++) { compressedStack._list.Add(compressedStack2._list[i]); } } return(compressedStack); }
internal void CompleteConstruction(CompressedStack innerCS) { if (PLS != null) { return; } PermissionListSet pls = PermissionListSet.CreateCompressedState(this, innerCS); lock (this) { if (PLS == null) { m_pls = pls; } } }
internal static void SetCompressedStackThread(CompressedStack cs) { ExecutionContext executionContext = Thread.CurrentThread.ExecutionContext; if (executionContext.SecurityContext != null) { executionContext.SecurityContext.CompressedStack = cs; } else if (cs != null) { SecurityContext context2 = new SecurityContext { CompressedStack = cs }; executionContext.SecurityContext = context2; } }
[System.Security.SecurityCritical] // auto-generated internal static CompressedStack GetCompressedStack(ref StackCrawlMark stackMark) { CompressedStack cs; CompressedStack innerCS = null; if (CodeAccessSecurityEngine.QuickCheckForAllDemands()) { cs = new CompressedStack(null); cs.CanSkipEvaluation = true; } else if (CodeAccessSecurityEngine.AllDomainsHomogeneousWithNoStackModifiers()) { // if all AppDomains on the stack are homogeneous, we don't need to walk the stack // however, we do need to capture the AppDomain stack. cs = new CompressedStack(GetDelayedCompressedStack(ref stackMark, false)); cs.m_pls = PermissionListSet.CreateCompressedState_HG(); } else { // regular stackwalking case // We want this to complete without ThreadAborts - if we're in a multiple AD callstack and an intermediate AD gets unloaded, // preventing TAs here prevents a race condition where a SafeCompressedStackHandle is created to a DCS belonging to an AD that's // gone away cs = new CompressedStack(null); RuntimeHelpers.PrepareConstrainedRegions(); try { // Empty try block to ensure no ThreadAborts in the finally block } finally { cs.CompressedStackHandle = GetDelayedCompressedStack(ref stackMark, true); if (cs.CompressedStackHandle != null && IsImmediateCompletionCandidate(cs.CompressedStackHandle, out innerCS)) { try { cs.CompleteConstruction(innerCS); } finally { DestroyDCSList(cs.CompressedStackHandle); } } } } return(cs); }
public static CompressedStack Capture () { #if !FEATURE_COMPRESSEDSTACK throw new NotSupportedException (); #else CompressedStack cs = new CompressedStack (0); cs._list = new ArrayList (); // include any current CompressedStack inside the new Capture CompressedStack currentCs = Thread.CurrentThread.ExecutionContext.SecurityContext.CompressedStack; if (currentCs != null) { for (int i=0; i < currentCs._list.Count; i++) cs._list.Add (currentCs._list [i]); } return cs; #endif }
[System.Security.SecurityCritical] // auto-generated private static void ReflectionTargetDemandHelper(int permission, PermissionSet targetGrant, CompressedStack securityContext) { Contract.Assert(securityContext != null, "securityContext != null"); // We need to remove all identity permissions from the grant set of the target, otherwise the // disjunctive demand will fail unless we're reflecting on the same assembly. PermissionSet demandSet = null; if (targetGrant == null) { demandSet = new PermissionSet(PermissionState.Unrestricted); } else { demandSet = targetGrant.CopyWithNoIdentityPermissions(); demandSet.AddPermission(new ReflectionPermission(ReflectionPermissionFlag.RestrictedMemberAccess)); } securityContext.DemandFlagsOrGrantSet((1 << (int)permission), demandSet); }
[System.Security.SecurityCritical] // auto-generated internal static void CheckHelper(CompressedStack cs, PermissionSet grantedSet, PermissionSet refusedSet, CodeAccessPermission demand, PermissionToken permToken, RuntimeMethodHandleInternal rmh, RuntimeAssembly asm, SecurityAction action) { if (cs != null) cs.CheckDemand(demand, permToken, rmh); else CheckHelper(grantedSet, refusedSet, demand, permToken, rmh, (Object)asm, action, true); }
[System.Security.SecurityCritical] // auto-generated internal static void CheckSetHelper(CompressedStack cs, PermissionSet grants, PermissionSet refused, PermissionSet demands, RuntimeMethodHandleInternal rmh, RuntimeAssembly asm, SecurityAction action) { if (cs != null) cs.CheckSetDemand(demands, rmh); else CheckSetHelper(grants, refused, demands, rmh, (Object)asm, action, true); }
public void SetCompressedStack(CompressedStack stack);
// public(internal) interface begins... // Creation functions static internal PermissionListSet CreateCompressedState(CompressedStack cs, CompressedStack innerCS) { // function that completes the construction of the compressed stack if not done so already (bottom half for demand evaluation) bool bHaltConstruction = false; if (cs.CompressedStackHandle == null) return null; // FT case or Security off PermissionListSet pls = new PermissionListSet(); PermissionSetTriple currentTriple = new PermissionSetTriple(); int numDomains = CompressedStack.GetDCSCount(cs.CompressedStackHandle); for (int i=numDomains-1; (i >= 0 && !bHaltConstruction) ; i--) { DomainCompressedStack dcs = CompressedStack.GetDomainCompressedStack(cs.CompressedStackHandle, i); if (dcs == null) continue; // we hit a FT Domain if (dcs.PLS == null) { // We failed on some DCS throw new SecurityException(String.Format(CultureInfo.InvariantCulture, Environment.GetResourceString("Security_Generic"))); } pls.UpdateZoneAndOrigin(dcs.PLS); pls.Update(currentTriple, dcs.PLS); bHaltConstruction = dcs.ConstructionHalted; } if (!bHaltConstruction) { PermissionListSet tmp_pls = null; // Construction did not halt. if (innerCS != null) { innerCS.CompleteConstruction(null); tmp_pls = innerCS.PLS; } pls.Terminate(currentTriple, tmp_pls); } else { pls.Terminate(currentTriple); } return pls; }
void SetCompressedStack (CompressedStack stack) { ExecutionContext.SecurityContext.CompressedStack = stack; }
public void SetCompressedStack(CompressedStack stack) { throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_ThreadAPIsNotSupported")); }
// internal stuff internal bool Equals (CompressedStack cs) { if (IsEmpty ()) return cs.IsEmpty (); if (cs.IsEmpty ()) return false; if (_list.Count != cs._list.Count) return false; return true; }
internal CompressedStack (CompressedStack cs) { if ((cs != null) && (cs._list != null)) _list = (ArrayList) cs._list.Clone (); }
static public void Run (CompressedStack compressedStack, ContextCallback callback, object state) { #if !FEATURE_COMPRESSEDSTACK throw new NotSupportedException (); #else if (compressedStack == null) throw new ArgumentException ("compressedStack"); Thread t = Thread.CurrentThread; CompressedStack original = null; try { original = t.ExecutionContext.SecurityContext.CompressedStack; t.ExecutionContext.SecurityContext.CompressedStack = compressedStack; callback (state); } finally { if (original != null) t.ExecutionContext.SecurityContext.CompressedStack = original; } #endif }
private void Init(string name, MethodAttributes attributes, CallingConventions callingConvention, Type returnType, Type[] signature, Type owner, System.Reflection.Module m, bool skipVisibility, bool transparentMethod) { CheckConsistency(attributes, callingConvention); if (signature != null) { this.m_parameterTypes = new RuntimeType[signature.Length]; for (int i = 0; i < signature.Length; i++) { if (signature[i] == null) { throw new ArgumentException(Environment.GetResourceString("Arg_InvalidTypeInSignature")); } this.m_parameterTypes[i] = signature[i].UnderlyingSystemType as RuntimeType; if (((this.m_parameterTypes[i] == null) || !this.m_parameterTypes[i].IsRuntimeType) || (this.m_parameterTypes[i] == typeof(void))) { throw new ArgumentException(Environment.GetResourceString("Arg_InvalidTypeInSignature")); } } } else { this.m_parameterTypes = new RuntimeType[0]; } this.m_returnType = (returnType == null) ? ((RuntimeType) typeof(void)) : (returnType.UnderlyingSystemType as RuntimeType); if (((this.m_returnType == null) || !this.m_returnType.IsRuntimeType) || this.m_returnType.IsByRef) { throw new NotSupportedException(Environment.GetResourceString("Arg_InvalidTypeInRetType")); } if (transparentMethod) { this.m_module = GetDynamicMethodsModule(); if (skipVisibility) { this.m_restrictedSkipVisibility = true; this.m_creationContext = CompressedStack.Capture(); } } else { if (m != null) { this.m_module = m.ModuleHandle.GetRuntimeModule(); } else if (((owner != null) && (owner.UnderlyingSystemType != null)) && owner.UnderlyingSystemType.IsRuntimeType) { this.m_typeOwner = owner.UnderlyingSystemType.TypeHandle.GetRuntimeType(); if ((this.m_typeOwner.HasElementType || this.m_typeOwner.ContainsGenericParameters) || (this.m_typeOwner.IsGenericParameter || this.m_typeOwner.IsInterface)) { throw new ArgumentException(Environment.GetResourceString("Argument_InvalidTypeForDynamicMethod")); } this.m_module = (RuntimeModule) this.m_typeOwner.Module; } this.m_skipVisibility = skipVisibility; } this.m_ilGenerator = null; this.m_fInitLocals = true; this.m_methodHandle = null; if (name == null) { throw new ArgumentNullException("name"); } this.m_dynMethod = new RTDynamicMethod(this, name, attributes, callingConvention); }
public void Undo() { if (curr_CS == null && prev_CS == null) return; if (prev_ADStack != (IntPtr)0) CompressedStack.RestoreAppDomainStack(prev_ADStack); CompressedStack.SetCompressedStackThread(prev_CS); prev_CS = null; curr_CS = null; prev_ADStack = (IntPtr)0; }
[System.Security.SecurityCritical] // auto-generated internal static void GetZoneAndOriginHelper( CompressedStack cs, PermissionSet grantSet, PermissionSet refusedSet, ArrayList zoneList, ArrayList originList ) { if (cs != null) cs.GetZoneAndOrigin(zoneList, originList, PermissionToken.GetToken(typeof(ZoneIdentityPermission)), PermissionToken.GetToken(typeof(UrlIdentityPermission))); else { ZoneIdentityPermission zone = (ZoneIdentityPermission)grantSet.GetPermission( typeof( ZoneIdentityPermission ) ); UrlIdentityPermission url = (UrlIdentityPermission)grantSet.GetPermission( typeof( UrlIdentityPermission ) ); if (zone != null) zoneList.Add( zone.SecurityZone ); if (url != null) originList.Add( url.Url ); } }
public void SetCompressedStack (CompressedStack stack) { #if MOBILE throw new NotSupportedException (); #else ExecutionContext.SecurityContext.CompressedStack = stack; #endif }
public static void Run(CompressedStack compressedStack, ContextCallback callback, Object state) { }
static public void Run (CompressedStack compressedStack, ContextCallback callback, object state) { if (compressedStack == null) throw new ArgumentException ("compressedStack"); Thread t = Thread.CurrentThread; CompressedStack original = null; try { original = t.GetCompressedStack (); t.SetCompressedStack (compressedStack); callback (state); } finally { if (original != null) t.SetCompressedStack (original); } }
[System.Security.SecurityCritical] // auto-generated private unsafe void Init(String name, MethodAttributes attributes, CallingConventions callingConvention, Type returnType, Type[] signature, Type owner, Module m, bool skipVisibility, bool transparentMethod, ref StackCrawlMark stackMark) { DynamicMethod.CheckConsistency(attributes, callingConvention); // check and store the signature if (signature != null) { m_parameterTypes = new RuntimeType[signature.Length]; for (int i = 0; i < signature.Length; i++) { if (signature[i] == null) throw new ArgumentException(Environment.GetResourceString("Arg_InvalidTypeInSignature")); m_parameterTypes[i] = signature[i].UnderlyingSystemType as RuntimeType; if ( m_parameterTypes[i] == null || !(m_parameterTypes[i] is RuntimeType) || m_parameterTypes[i] == (RuntimeType)typeof(void) ) throw new ArgumentException(Environment.GetResourceString("Arg_InvalidTypeInSignature")); } } else { m_parameterTypes = Array.Empty<RuntimeType>(); } // check and store the return value m_returnType = (returnType == null) ? (RuntimeType)typeof(void) : returnType.UnderlyingSystemType as RuntimeType; if ( (m_returnType == null) || !(m_returnType is RuntimeType) || m_returnType.IsByRef ) throw new NotSupportedException(Environment.GetResourceString("Arg_InvalidTypeInRetType")); if (transparentMethod) { Contract.Assert(owner == null && m == null, "owner and m cannot be set for transparent methods"); m_module = GetDynamicMethodsModule(); if (skipVisibility) { m_restrictedSkipVisibility = true; } #if FEATURE_COMPRESSEDSTACK m_creationContext = CompressedStack.Capture(); #endif // FEATURE_COMPRESSEDSTACK } else { Contract.Assert(m != null || owner != null, "PerformSecurityCheck should ensure that either m or owner is set"); Contract.Assert(m == null || !m.Equals(s_anonymouslyHostedDynamicMethodsModule), "The user cannot explicitly use this assembly"); Contract.Assert(m == null || owner == null, "m and owner cannot both be set"); if (m != null) m_module = m.ModuleHandle.GetRuntimeModule(); // this returns the underlying module for all RuntimeModule and ModuleBuilder objects. else { RuntimeType rtOwner = null; if (owner != null) rtOwner = owner.UnderlyingSystemType as RuntimeType; if (rtOwner != null) { if (rtOwner.HasElementType || rtOwner.ContainsGenericParameters || rtOwner.IsGenericParameter || rtOwner.IsInterface) throw new ArgumentException(Environment.GetResourceString("Argument_InvalidTypeForDynamicMethod")); m_typeOwner = rtOwner; m_module = rtOwner.GetRuntimeModule(); } } m_skipVisibility = skipVisibility; } // initialize remaining fields m_ilGenerator = null; m_fInitLocals = true; m_methodHandle = null; if (name == null) throw new ArgumentNullException("name"); #if FEATURE_APPX if (AppDomain.ProfileAPICheck) { if (m_creatorAssembly == null) m_creatorAssembly = RuntimeAssembly.GetExecutingAssembly(ref stackMark); if (m_creatorAssembly != null && !m_creatorAssembly.IsFrameworkAssembly()) m_profileAPICheck = true; } #endif // FEATURE_APPX m_dynMethod = new RTDynamicMethod(this, name, attributes, callingConvention); }
public void SetCompressedStack(CompressedStack stack) { Contract.Ensures(false); }
public void SetCompressedStack(CompressedStack stack) { throw new InvalidOperationException(SR.Thread_GetSetCompressedStack_NotSupported); }
public XmlTextReaderImpl( string url, XmlNameTable nt ): this( nt ) { if ( url == null ) { throw new ArgumentNullException( "url" ); } if ( url.Length == 0 ) { throw new ArgumentException( Res.GetString( Res.Xml_EmptyUrl ), "url" ); } namespaceManager = new XmlNamespaceManager( nt ); compressedStack = CompressedStack.Capture(); this.url = url; ps.baseUri = xmlResolver.ResolveUri( null, url ); ps.baseUriStr = ps.baseUri.ToString(); reportedBaseUri = ps.baseUriStr; parsingFunction = ParsingFunction.OpenUrl; }
internal extern static bool IsImmediateCompletionCandidate(SafeCompressedStackHandle compressedStack, out CompressedStack innerCS);
// internal stuff internal bool Equals (CompressedStack cs) { if (IsEmpty ()) return cs.IsEmpty (); if (cs.IsEmpty ()) return false; if (_list.Count != cs._list.Count) return false; for (int i=0; i < _list.Count; i++) { SecurityFrame sf1 = (SecurityFrame) _list [i]; SecurityFrame sf2 = (SecurityFrame) cs._list [i]; if (!sf1.Equals (sf2)) return false; } return true; }