public void Dispose() { Task childScopeTasks = Task.WhenAll(ChildScopes.Select(s => s.DisposalTask)); Task.WhenAny(childScopeTasks, Task.Delay(5000)) .ContinueWith(t => { Container.Dispose(); }); }
/// <summary> /// Returns the innermost scope that surrounds the given source location. /// </summary> /// <param name="loc">The source location to search for.</param> /// <returns>The lowest child of this scope that surrounds the given location, or null if it /// cannot be found.</returns> public IScope GetScopeForLocation(SourceLocation loc) { //first search in children var foundScope = ChildScopes.Select(c => c.GetScopeForLocation(loc)).FirstOrDefault(r => r != null); //if loc not found, check ourselves if (foundScope == null && this.IsScopeFor(loc)) { foundScope = this; } return(foundScope); }