protected void HandleObjects(Object objects, ILinkedMap <Type, PrefetchPath[]> entityTypeToPrefetchPath, AlreadyHandledSet alreadyHandledSet, IdentityLinkedMap <ICacheIntern, IISet <IObjRef> > cacheToOrisLoadedHistory, IdentityLinkedMap <ICacheIntern, IISet <IObjRelation> > cacheToOrelsLoadedHistory, IdentityLinkedMap <ICacheIntern, IISet <IObjRef> > cacheToOrisToLoad, IdentityLinkedMap <ICacheIntern, IMap <IObjRelation, Boolean> > cacheToOrelsToLoad, List <PrefetchCommand> loadItems) { if (objects is IEnumerable && !objects.GetType().Equals(typeof(String))) { foreach (Object item in (IEnumerable)objects) { if (item == null) { continue; } HandleObjects(item, entityTypeToPrefetchPath, alreadyHandledSet, cacheToOrisLoadedHistory, cacheToOrelsLoadedHistory, cacheToOrisToLoad, cacheToOrelsToLoad, loadItems); } return; } PrefetchPath[] cachePaths = null; if (entityTypeToPrefetchPath != null) { IEntityMetaData metaData = EntityMetaDataProvider.GetMetaData(objects.GetType()); cachePaths = entityTypeToPrefetchPath.Get(metaData.EntityType); if (cachePaths == null || cachePaths.Length == 0) { return; } } EnsureInitializedRelationsIntern3(objects, cachePaths, entityTypeToPrefetchPath, cacheToOrisToLoad, cacheToOrelsToLoad, cacheToOrisLoadedHistory, cacheToOrelsLoadedHistory, alreadyHandledSet, loadItems); }
protected IPrefetchState EnsureInitializedRelationsIntern2(Object objects, ILinkedMap <Type, PrefetchPath[]> entityTypeToPrefetchPath) { bool setCreated = false; try { AlreadyHandledSet alreadyHandledSet = alreadyHandledSetTL.Value; if (alreadyHandledSet == null) { alreadyHandledSet = new AlreadyHandledSet(); alreadyHandledSetTL.Value = alreadyHandledSet; setCreated = true; } IEntityMetaDataProvider entityMetaDataProvider = this.EntityMetaDataProvider; ValueHolderContainerMixin valueHolderContainerMixin = this.ValueHolderContainerMixin; IdentityLinkedMap <ICacheIntern, IISet <IObjRef> > cacheToOrisLoadedHistory = new IdentityLinkedMap <ICacheIntern, IISet <IObjRef> >(); IdentityLinkedMap <ICacheIntern, IISet <IObjRelation> > cacheToOrelsLoadedHistory = new IdentityLinkedMap <ICacheIntern, IISet <IObjRelation> >(); IdentityLinkedMap <ICacheIntern, IISet <IObjRef> > cacheToOrisToLoad = new IdentityLinkedMap <ICacheIntern, IISet <IObjRef> >(); IdentityLinkedMap <ICacheIntern, IMap <IObjRelation, bool> > cacheToOrelsToLoad = new IdentityLinkedMap <ICacheIntern, IMap <IObjRelation, bool> >(); List <PrefetchCommand> loadItems = new List <PrefetchCommand>(); HandleObjects(objects, entityTypeToPrefetchPath, alreadyHandledSet, cacheToOrisLoadedHistory, cacheToOrelsLoadedHistory, cacheToOrisToLoad, cacheToOrelsToLoad, loadItems); // Remove all oris which have already been tried to load before if (cacheToOrisToLoad.Count == 0 && cacheToOrelsToLoad.Count == 0) { // No ori remaining which makes sense to try to load if (setCreated) { return(new PrefetchState(alreadyHandledSet)); } return(null); } List <Object> hardRefList = new List <Object>(); // Store hard-ref-list to global hard ref alreadyHandledSet.Put(hardRefList, null, true); ProcessPendingOrelsAndObjRefs(entityTypeToPrefetchPath, alreadyHandledSet, cacheToOrisLoadedHistory, cacheToOrelsLoadedHistory, cacheToOrisToLoad, cacheToOrelsToLoad, loadItems, hardRefList); // No ori remaining which makes sense to try to load if (setCreated) { return(new PrefetchState(alreadyHandledSet)); } return(null); } finally { if (setCreated) { alreadyHandledSetTL.Value = null; } } }
protected IList <Object> EvaluatePausedEventTargets() { IdentityLinkedMap <Object, PausedEventTargetItem> pausedTargets = this.pausedTargets; List <Object> pausedEventTargets = new List <Object>(pausedTargets.Count); foreach (Entry <Object, PausedEventTargetItem> entry in pausedTargets) { PausedEventTargetItem pauseETI = entry.Value; pausedEventTargets.Add(pauseETI.EventTarget); } return(pausedEventTargets); }
protected IList <Object> EvaluatePausedEventTargetsOfForeignThreads() { Thread currentThread = Thread.CurrentThread; IdentityLinkedMap <Object, PausedEventTargetItem> pausedTargets = this.pausedTargets; List <Object> pausedEventTargets = new List <Object>(pausedTargets.Count); foreach (Entry <Object, PausedEventTargetItem> entry in pausedTargets) { PausedEventTargetItem pauseETI = entry.Value; if (!Object.ReferenceEquals(pauseETI.Thread, currentThread)) { pausedEventTargets.Add(pauseETI.EventTarget); } } return(pausedEventTargets); }
public ICUDResult CreateCUDResult(MergeHandle mergeHandle) { ILinkedMap <Type, ICUDResultExtension> typeToCudResultExtension = extensions.GetExtensions(); foreach (Entry <Type, ICUDResultExtension> entry in typeToCudResultExtension) { entry.Value.Extend(mergeHandle); } IdentityLinkedMap <Object, IList <IUpdateItem> > objToModDict = mergeHandle.objToModDict; IdentityHashSet <Object> objToDeleteSet = mergeHandle.objToDeleteSet; HashMap <Type, IPrimitiveUpdateItem[]> entityTypeToFullPuis = new HashMap <Type, IPrimitiveUpdateItem[]>(); HashMap <Type, IRelationUpdateItem[]> entityTypeToFullRuis = new HashMap <Type, IRelationUpdateItem[]>(); List <IChangeContainer> allChanges = new List <IChangeContainer>(objToModDict.Count); List <Object> originalRefs = new List <Object>(objToModDict.Count); foreach (Object objToDelete in objToDeleteSet) { IObjRef ori = OriHelper.GetCreateObjRef(objToDelete, mergeHandle); DeleteContainer deleteContainer = new DeleteContainer(); deleteContainer.Reference = ori; allChanges.Add(deleteContainer); originalRefs.Add(objToDelete); } IEntityMetaDataProvider entityMetaDataProvider = this.EntityMetaDataProvider; foreach (Entry <Object, IList <IUpdateItem> > entry in objToModDict) { Object obj = entry.Key; IList <IUpdateItem> modItems = entry.Value; IEntityMetaData metaData = entityMetaDataProvider.GetMetaData(obj.GetType()); IPrimitiveUpdateItem[] fullPuis = GetEnsureFullPUIs(metaData, entityTypeToFullPuis); IRelationUpdateItem[] fullRuis = GetEnsureFullRUIs(metaData, entityTypeToFullRuis); int puiCount = 0, ruiCount = 0; for (int a = modItems.Count; a-- > 0;) { IUpdateItem modItem = modItems[a]; Member member = metaData.GetMemberByName(modItem.MemberName); if (modItem is IRelationUpdateItem) { fullRuis[metaData.GetIndexByRelation(member)] = (IRelationUpdateItem)modItem; ruiCount++; } else { fullPuis[metaData.GetIndexByPrimitive(member)] = (IPrimitiveUpdateItem)modItem; puiCount++; } } IRelationUpdateItem[] ruis = CompactRUIs(fullRuis, ruiCount); IPrimitiveUpdateItem[] puis = CompactPUIs(fullPuis, puiCount); IObjRef ori = OriHelper.GetCreateObjRef(obj, mergeHandle); originalRefs.Add(obj); if (ori is IDirectObjRef) { CreateContainer createContainer = new CreateContainer(); ((IDirectObjRef)ori).CreateContainerIndex = allChanges.Count; createContainer.Reference = ori; createContainer.Primitives = puis; createContainer.Relations = ruis; allChanges.Add(createContainer); } else { UpdateContainer updateContainer = new UpdateContainer(); updateContainer.Reference = ori; updateContainer.Primitives = puis; updateContainer.Relations = ruis; allChanges.Add(updateContainer); } } return(new CUDResult(allChanges, originalRefs)); }
public void AddMembers(EntityMetaData metaData, IEntityConfig entityConfig) { Type realType = entityConfig.RealType; ISet <String> memberNamesToIgnore = new HashSet <String>(); ISet <String> explicitBasicMemberNames = new HashSet <String>(); IList <IMemberConfig> embeddedMembers = new List <IMemberConfig>(); IMap <String, IMemberConfig> nameToMemberConfig = new HashMap <String, IMemberConfig>(); IMap <String, IRelationConfig> nameToRelationConfig = new HashMap <String, IRelationConfig>(); IdentityLinkedMap <String, Member> nameToMemberMap = new IdentityLinkedMap <String, Member>(); FillNameCollections(entityConfig, memberNamesToIgnore, explicitBasicMemberNames, embeddedMembers, nameToMemberConfig, nameToRelationConfig); IdentityLinkedSet <PrimitiveMember> alternateIdMembers = new IdentityLinkedSet <PrimitiveMember>(); IdentityLinkedSet <PrimitiveMember> primitiveMembers = new IdentityLinkedSet <PrimitiveMember>(); IdentityLinkedSet <RelationMember> relationMembers = new IdentityLinkedSet <RelationMember>(); IdentityLinkedSet <Member> notMergeRelevant = new IdentityLinkedSet <Member>(); IdentityLinkedSet <Member> containedInAlternateIdMember = new IdentityLinkedSet <Member>(); IPropertyInfo[] properties = PropertyInfoProvider.GetProperties(realType); IdentityLinkedMap <String, Member> explicitlyConfiguredMemberNameToMember = new IdentityLinkedMap <String, Member>(); HashMap <String, IOrmConfig> nameToConfigMap = new HashMap <String, IOrmConfig>(); // Resolve members for all explicit configurations - both simple and composite ones, each with embedded // functionality (dot-member-path) foreach (IMemberConfig memberConfig in entityConfig.GetMemberConfigIterable()) { PutNameToConfigMap(memberConfig, nameToConfigMap); if (memberConfig.Ignore) { continue; } HandleMemberConfig(metaData, realType, memberConfig, explicitlyConfiguredMemberNameToMember, nameToMemberMap); } foreach (IRelationConfig relationConfig in entityConfig.GetRelationConfigIterable()) { PutNameToConfigMap(relationConfig, nameToConfigMap); HandleRelationConfig(realType, relationConfig, explicitlyConfiguredMemberNameToMember); } PutNameToConfigMap(entityConfig.IdMemberConfig, nameToConfigMap); PutNameToConfigMap(entityConfig.VersionMemberConfig, nameToConfigMap); PutNameToConfigMap(entityConfig.CreatedByMemberConfig, nameToConfigMap); PutNameToConfigMap(entityConfig.CreatedOnMemberConfig, nameToConfigMap); PutNameToConfigMap(entityConfig.UpdatedByMemberConfig, nameToConfigMap); PutNameToConfigMap(entityConfig.UpdatedOnMemberConfig, nameToConfigMap); metaData.IdMember = HandleMemberConfig(metaData, realType, entityConfig.IdMemberConfig, explicitlyConfiguredMemberNameToMember, nameToMemberMap); metaData.VersionMember = HandleMemberConfig(metaData, realType, entityConfig.VersionMemberConfig, explicitlyConfiguredMemberNameToMember, nameToMemberMap); metaData.CreatedByMember = HandleMemberConfig(metaData, realType, entityConfig.CreatedByMemberConfig, explicitlyConfiguredMemberNameToMember, nameToMemberMap); metaData.CreatedOnMember = HandleMemberConfig(metaData, realType, entityConfig.CreatedOnMemberConfig, explicitlyConfiguredMemberNameToMember, nameToMemberMap); metaData.UpdatedByMember = HandleMemberConfig(metaData, realType, entityConfig.UpdatedByMemberConfig, explicitlyConfiguredMemberNameToMember, nameToMemberMap); metaData.UpdatedOnMember = HandleMemberConfig(metaData, realType, entityConfig.UpdatedOnMemberConfig, explicitlyConfiguredMemberNameToMember, nameToMemberMap); IdentityHashSet <Member> idMembers = new IdentityHashSet <Member>(); Member idMember = metaData.IdMember; if (idMember is CompositeIdMember) { idMembers.AddAll(((CompositeIdMember)idMember).Members); } else { idMembers.Add(idMember); } // Handle all explicitly configured members foreach (Entry <String, Member> entry in explicitlyConfiguredMemberNameToMember) { String memberName = entry.Key; IOrmConfig ormConfig = nameToConfigMap.Get(memberName); Member member = entry.Value; if (idMembers.Contains(member)) { continue; } if (ormConfig.ExplicitlyNotMergeRelevant) { notMergeRelevant.Add(member); } if (ormConfig is IRelationConfig) { if (!relationMembers.Add((RelationMember)member)) { throw new Exception("Member has been registered as relation multiple times: " + member.Name); } continue; } if (!(ormConfig is IMemberConfig)) { continue; } if (((IMemberConfig)ormConfig).AlternateId) { if (!alternateIdMembers.Add((PrimitiveMember)member)) { throw new Exception("Member has been registered as alternate id multiple times: " + member.Name); } if (member is CompositeIdMember) { Member[] containedMembers = ((CompositeIdMember)member).Members; containedInAlternateIdMember.AddAll(containedMembers); } } if (!(member is CompositeIdMember) && metaData.VersionMember != member) { // Alternate Ids are normally primitives, too. But Composite Alternate Ids not - only their composite // items are primitives primitiveMembers.Add((PrimitiveMember)member); } } IdentityHashSet <String> explicitTypeInfoItems = IdentityHashSet <String> .Create(explicitlyConfiguredMemberNameToMember.Count); foreach (Entry <String, Member> entry in explicitlyConfiguredMemberNameToMember) { Member member = entry.Value; explicitTypeInfoItems.Add(member.Name); if (member is IEmbeddedMember) { explicitTypeInfoItems.Add(((IEmbeddedMember)member).GetMemberPath()[0].Name); } } // Go through the available members to look for potential auto-mapping (simple, no embedded) for (int i = 0; i < properties.Length; i++) { IPropertyInfo property = properties[i]; String memberName = property.Name; if (memberNamesToIgnore.Contains(memberName)) { continue; } if (explicitTypeInfoItems.Contains(memberName)) { // already configured, no auto mapping needed for this member continue; } MethodPropertyInfo mProperty = (MethodPropertyInfo)property; Type elementType = TypeInfoItemUtil.GetElementTypeUsingReflection(mProperty.Getter.ReturnType, null); if ((nameToMemberMap.Get(property.Name) is RelationMember) || RelationProvider.IsEntityType(elementType)) { RelationMember member = GetRelationMember(metaData.EntityType, property, nameToMemberMap); relationMembers.Add(member); continue; } PrimitiveMember member2 = GetPrimitiveMember(metaData.EntityType, property, nameToMemberMap); if (metaData.IdMember == null && memberName.Equals(EntityMetaData.DEFAULT_NAME_ID)) { metaData.IdMember = member2; continue; } if (idMembers.Contains(member2) && !alternateIdMembers.Contains(member2) && !containedInAlternateIdMember.Contains(member2)) { continue; } if (member2.Equals(metaData.IdMember) || member2.Equals(metaData.VersionMember) || member2.Equals(metaData.CreatedByMember) || member2.Equals(metaData.CreatedOnMember) || member2.Equals(metaData.UpdatedByMember) || member2.Equals(metaData.UpdatedOnMember)) { continue; } if (metaData.VersionMember == null && memberName.Equals(EntityMetaData.DEFAULT_NAME_VERSION)) { metaData.VersionMember = member2; continue; } if (metaData.CreatedByMember == null && memberName.Equals(EntityMetaData.DEFAULT_NAME_CREATED_BY)) { metaData.CreatedByMember = member2; } else if (metaData.CreatedOnMember == null && memberName.Equals(EntityMetaData.DEFAULT_NAME_CREATED_ON)) { metaData.CreatedOnMember = member2; } else if (metaData.UpdatedByMember == null && memberName.Equals(EntityMetaData.DEFAULT_NAME_UPDATED_BY)) { metaData.UpdatedByMember = member2; } else if (metaData.UpdatedOnMember == null && memberName.Equals(EntityMetaData.DEFAULT_NAME_UPDATED_ON)) { metaData.UpdatedOnMember = member2; } primitiveMembers.Add(member2); } foreach (PrimitiveMember member in primitiveMembers) { String memberName = member.Name; if (explicitBasicMemberNames.Contains(memberName)) { // Even if the name would match, this member was explicitly configured as "basic" continue; } if (metaData.CreatedByMember == null && memberName.Equals(EntityMetaData.DEFAULT_NAME_CREATED_BY)) { metaData.CreatedByMember = member; } else if (metaData.CreatedOnMember == null && memberName.Equals(EntityMetaData.DEFAULT_NAME_CREATED_ON)) { metaData.CreatedOnMember = member; } else if (metaData.UpdatedByMember == null && memberName.Equals(EntityMetaData.DEFAULT_NAME_UPDATED_BY)) { metaData.UpdatedByMember = member; } else if (metaData.UpdatedOnMember == null && memberName.Equals(EntityMetaData.DEFAULT_NAME_UPDATED_ON)) { metaData.UpdatedOnMember = member; } } FilterWrongRelationMappings(relationMembers); // Order of setter calls is important PrimitiveMember[] primitives = primitiveMembers.ToArray(); PrimitiveMember[] alternateIds = alternateIdMembers.ToArray(); RelationMember[] relations = relationMembers.ToArray(); Array.Sort(primitives); Array.Sort(alternateIds); Array.Sort(relations); metaData.PrimitiveMembers = primitives; metaData.AlternateIdMembers = alternateIds; metaData.RelationMembers = relations; foreach (Member member in notMergeRelevant) { metaData.SetMergeRelevant(member, false); } if (metaData.IdMember == null) { throw new Exception("No ID member could be resolved for entity of type " + metaData.RealType); } }
protected void ProcessPendingOrelsAndObjRefs(ILinkedMap <Type, PrefetchPath[]> entityTypeToPrefetchPath, AlreadyHandledSet alreadyHandledSet, IdentityLinkedMap <ICacheIntern, IISet <IObjRef> > cacheToOrisLoadedHistory, IdentityLinkedMap <ICacheIntern, IISet <IObjRelation> > cacheToOrelsLoadedHistory, IdentityLinkedMap <ICacheIntern, IISet <IObjRef> > cacheToOrisToLoad, IdentityLinkedMap <ICacheIntern, IMap <IObjRelation, bool> > cacheToOrelsToLoad, List <PrefetchCommand> pendingPrefetchCommands, List <Object> hardRefList) { // all relation members where at least one instance of the owning entity type needs a prefetch on this member in the immediate next step MergePrefetchPathsCache mergePrefetchPathsCache = new MergePrefetchPathsCache(EntityMetaDataProvider); IdentityLinkedSet <Member> prioMembers = PrioMembersProvider.GetPrioMembers(entityTypeToPrefetchPath, pendingPrefetchCommands, mergePrefetchPathsCache); LoadAndAddOrels(cacheToOrelsToLoad, hardRefList, cacheToOrelsLoadedHistory, cacheToOrisToLoad, prioMembers); LoadAndAddOris(cacheToOrisToLoad, hardRefList, cacheToOrisLoadedHistory); while (pendingPrefetchCommands.Count > 0) { PrefetchCommand[] currentPrefetchCommands = pendingPrefetchCommands.ToArray(); // Clear the items to be ready for cascaded items in new batch recursion step pendingPrefetchCommands.Clear(); if (prioMembers.Count > 0) { for (int a = 0, size = currentPrefetchCommands.Length; a < size; a++) { PrefetchCommand prefetchCommand = currentPrefetchCommands[a]; DirectValueHolderRef valueHolder = prefetchCommand.valueHolder; if (!prioMembers.Contains(valueHolder.Member)) { currentPrefetchCommands[a] = null; pendingPrefetchCommands.Add(prefetchCommand); } } } GuiThreadHelper.InvokeInGuiAndWait(delegate() { ICacheModification cacheModification = CacheModification; ValueHolderContainerMixin valueHolderContainerMixin = ValueHolderContainerMixin; bool oldActive = cacheModification.Active; if (!oldActive) { cacheModification.Active = true; } try { foreach (PrefetchCommand prefetchCommand in currentPrefetchCommands) { if (prefetchCommand == null) { continue; } DirectValueHolderRef valueHolder = prefetchCommand.valueHolder; PrefetchPath[] cachePaths = prefetchCommand.prefetchPaths; RelationMember member = valueHolder.Member; // Merge the root prefetch path with the relative prefetch path cachePaths = mergePrefetchPathsCache.MergePrefetchPaths(member.ElementType, cachePaths, entityTypeToPrefetchPath); IObjRefContainer vhc = valueHolder.Vhc; ICacheIntern targetCache; bool doSetValue = false; if (valueHolder is IndirectValueHolderRef) { IndirectValueHolderRef valueHolderKey = (IndirectValueHolderRef)valueHolder; targetCache = valueHolderKey.RootCache; } else { targetCache = ((IValueHolderContainer)vhc).__TargetCache; doSetValue = true; } int relationIndex = vhc.Get__EntityMetaData().GetIndexByRelation(member); IObjRef[] objRefs = vhc.Get__ObjRefs(relationIndex); Object obj = valueHolderContainerMixin.GetValue(vhc, relationIndex, member, targetCache, objRefs, CacheDirective.FailEarly); if (doSetValue && obj != null) { member.SetValue(vhc, obj); } EnsureInitializedRelationsIntern3(obj, cachePaths, entityTypeToPrefetchPath, cacheToOrisToLoad, cacheToOrelsToLoad, cacheToOrisLoadedHistory, cacheToOrelsLoadedHistory, alreadyHandledSet, pendingPrefetchCommands); } } finally { if (!oldActive) { cacheModification.Active = false; } } }); // Remove all oris which have already been tried to load before if (cacheToOrisToLoad.Count == 0 && cacheToOrelsToLoad.Count == 0 && pendingPrefetchCommands.Count == 0) { return; } prioMembers = PrioMembersProvider.GetPrioMembers(entityTypeToPrefetchPath, pendingPrefetchCommands, mergePrefetchPathsCache); LoadAndAddOrels(cacheToOrelsToLoad, hardRefList, cacheToOrelsLoadedHistory, cacheToOrisToLoad, prioMembers); LoadAndAddOris(cacheToOrisToLoad, hardRefList, cacheToOrisLoadedHistory); } }
public void Resume(Object eventTarget) { if (GuiThreadHelper.IsInGuiThread()) { // Nothing to do return; } IEventTargetExtractor eventTargetExtractor = typeToEventTargetExtractorsDict.GetExtension(eventTarget.GetType()); if (eventTargetExtractor == null) { return; } eventTarget = eventTargetExtractor.ExtractEventTarget(eventTarget); if (eventTarget == null) { return; } IdentityLinkedSet <WaitForResumeItem> freeLatchMap = null; try { PausedEventTargetItem pauseETI; listenersWriteLock.Lock(); try { IdentityLinkedMap <Object, PausedEventTargetItem> pausedTargets = this.pausedTargets; pauseETI = pausedTargets.Get(eventTarget); if (pauseETI == null) { throw new System.Exception("No pause() active for target " + eventTarget); } pauseETI.PauseCount--; if (pauseETI.PauseCount > 0) { return; } pausedTargets.Remove(eventTarget); IList <Object> remainingPausedEventTargets = EvaluatePausedEventTargets(); IdentityHashSet <Object> remainingPausedEventTargetsSet = new IdentityHashSet <Object>(); Iterator <WaitForResumeItem> iter = waitForResumeSet.Iterator(); while (iter.MoveNext()) { WaitForResumeItem pauseItem = iter.Current; remainingPausedEventTargetsSet.AddAll(remainingPausedEventTargets); remainingPausedEventTargetsSet.RetainAll(pauseItem.PendingPauses); if (remainingPausedEventTargetsSet.Count == 0) { iter.Remove(); if (freeLatchMap == null) { freeLatchMap = new IdentityLinkedSet <WaitForResumeItem>(); } freeLatchMap.Add(pauseItem); } remainingPausedEventTargetsSet.Clear(); } } finally { listenersWriteLock.Unlock(); } } finally { if (freeLatchMap != null) { foreach (WaitForResumeItem wfrItem in freeLatchMap) { wfrItem.Latch.CountDown(); } foreach (WaitForResumeItem wfrItem in freeLatchMap) { try { wfrItem.ResultLatch.Await(); } catch (System.Exception e) { throw new System.Exception("Fatal state occured. This may result in a global deadlock", e); } } } } }