void QueueInference()
        {
            var doc = this.CU as XmlParsedDocument;

            if (doc == null || doc.XDocument == null || inferenceQueued)
            {
                return;
            }
            if (inferredCompletionData != null)
            {
                if ((doc.LastWriteTimeUtc - inferredCompletionData.TimeStampUtc).TotalSeconds < 5)
                {
                    return;
                }
            }
            inferenceQueued = true;
            ThreadPool.QueueUserWorkItem(delegate {
                try {
                    inferredCompletionData = MSBuildResolveContext.Create(doc, inferredCompletionData);
                    inferenceQueued        = false;
                } catch (Exception ex) {
                    LoggingService.LogInternalError("Unhandled error in XML inference", ex);
                }
            });
        }
		public static MSBuildResolveContext Create (XmlParsedDocument doc, MSBuildResolveContext previous)
		{
			var ctx = new MSBuildResolveContext ();
			ctx.Populate (doc.XDocument);
			if (doc.Errors.Count > 0)
				ctx.Merge (previous);
			return ctx;
		}
Example #3
0
        public static MSBuildResolveContext Create(XmlParsedDocument doc, MSBuildResolveContext previous)
        {
            var ctx = new MSBuildResolveContext();

            ctx.Populate(doc.XDocument);
            if (doc.Errors.Count > 0)
            {
                ctx.Merge(previous);
            }
            return(ctx);
        }
Example #4
0
 void Merge(MSBuildResolveContext other)
 {
     foreach (var otherItem in other.items)
     {
         HashSet <string> item;
         if (items.TryGetValue(otherItem.Key, out item))
         {
             foreach (var att in otherItem.Value)
             {
                 item.Add(att);
             }
         }
         else
         {
             items [otherItem.Key] = otherItem.Value;
         }
     }
     foreach (var otherTask in other.tasks)
     {
         HashSet <string> task;
         if (tasks.TryGetValue(otherTask.Key, out task))
         {
             foreach (var att in otherTask.Value)
             {
                 task.Add(att);
             }
         }
         else
         {
             tasks [otherTask.Key] = otherTask.Value;
         }
     }
     foreach (var prop in other.properties)
     {
         properties.Add(prop);
     }
     foreach (var imp in other.imports)
     {
         imports.Add(imp);
     }
 }
		void Merge (MSBuildResolveContext other)
		{
			foreach (var otherItem in other.items) {
				HashSet<string> item;
				if (items.TryGetValue (otherItem.Key, out item)) {
					foreach (var att in otherItem.Value)
						item.Add (att);
				} else {
					items [otherItem.Key] = otherItem.Value;
				}
			}
			foreach (var otherTask in other.tasks) {
				HashSet<string> task;
				if (tasks.TryGetValue (otherTask.Key, out task)) {
					foreach (var att in otherTask.Value)
						task.Add (att);
				} else {
					tasks [otherTask.Key] = otherTask.Value;
				}
			}
			foreach (var prop in other.properties) {
				properties.Add (prop);
			}
			foreach (var imp in other.imports) {
				imports.Add (imp);
			}
		}
		void QueueInference ()
		{
			var doc = this.CU as XmlParsedDocument;
			if (doc == null || doc.XDocument == null || inferenceQueued)
				return;
			if (inferredCompletionData != null) {
				if ((doc.LastWriteTimeUtc - inferredCompletionData.TimeStampUtc).TotalSeconds < 5)
					return;
			}
			inferenceQueued = true;
			ThreadPool.QueueUserWorkItem (delegate {
				try {
					inferredCompletionData = MSBuildResolveContext.Create (doc, inferredCompletionData);
					inferenceQueued = false;
				} catch (Exception ex) {
					LoggingService.LogInternalError ("Unhandled error in XML inference", ex);
				}
			});
		}