Implemented photo capture for front camera

--- CITS/ProblemPage.xaml.cs
+++ CITS/ProblemPage.xaml.cs
@@ -1,7 +1,12 @@
 using System;
 using System.Collections.Generic;
-
+using System.IO;
 using Xamarin.Forms;
+using Microsoft.ProjectOxford.Emotion;
+using Microsoft.ProjectOxford.Common.Contract;
+using System.Threading.Tasks;
+using Plugin.Media.Abstractions;
+using Plugin.Connectivity;

 namespace CITS
 {
@@ -10,31 +15,33 @@
         public event EventHandler SolutionSubmitted;
         public event EventHandler HintRequested;
         private int currentHintNumber = 0;
+        private readonly EmotionServiceClient emotionServiceClient;
         public String ProblemNumber
         {
             get;
             set;
         }
-		public String Problem
-		{
-			get;
-			set;
-		}
+        public String Problem
+        {
+            get;
+            set;
+        }

         public String Solution
         {
             get;
             set;
         }
-		public Entry SolutionTextField
-		{
-            get;
-			set;
-		}
+        public Entry SolutionTextField
+        {
+            get;
+            set;
+        }

         public ProblemPage()
         {
             InitializeComponent();
+            this.emotionServiceClient = new EmotionServiceClient("MyAPIKey");
         }

         public List<String> Hints
@@ -45,27 +52,188 @@

         void Handle_TextChanged(object sender, Xamarin.Forms.TextChangedEventArgs e)
         {
-         //   throw new NotImplementedException();
-        }
-
-		void OnSubmitButtonClicked(object sender, EventArgs args)
-		{
+            //   throw new NotImplementedException();
+        }
+
+        async void OnSubmitButtonClicked(object sender, EventArgs args)
+        {
             this.Solution = SolutionEntry.Text;
-            SolutionSubmitted(this, EventArgs.Empty);
-			//await Navigation.PopModalAsync();
-		}
-
-       public void UpdateProblemPage()
+            //TakePictureAndPostIt();
+            //    this.SolutionEntry.Unfocus();
+            //      this.SolutionEntry.Unfocus();
+            //      this.SolutionEntry.Unfocus();
+            //	this.Focus();
+            TakePictureAndShrinkIt();
+
+            SolutionSubmitted(this, EventArgs.Empty);
+            //await Navigation.PopModalAsync();
+        }
+
+        async private void TakePictureAndPostIt()
+        {
+            var photo = await Plugin.Media.CrossMedia.Current.TakePhotoAsync(new Plugin.Media.Abstractions.StoreCameraMediaOptions() { });
+
+            if (photo != null)
+                PhotoImage.Source = ImageSource.FromStream(() => { return photo.GetStream(); });
+        }
+
+        async private void TakePictureAndShrinkIt()
+        {
+            var mediaOptions = new Plugin.Media.Abstractions.StoreCameraMediaOptions
+            {
+                DefaultCamera = Plugin.Media.Abstractions.CameraDevice.Front,
+            };
+            var photo = await Plugin.Media.CrossMedia.Current.TakePhotoAsync(mediaOptions);
+            ClearEmotionResults("{Analyzing...}");
+            //if (photo != null)
+            //PhotoImage.Source = ImageSource.FromStream(() => { return photo.GetStream(); });
+
+            //  await analyseImage(photo.GetStream());
+            var emotions = await DetectEmotionsAsync(photo);
+            photo.Dispose();
+            this.AngerLabel.Text = $"Anger: {emotions.Anger.ToString()}";
+            this.ContemptLabel.Text = $"Contempt: {emotions.Contempt.ToString()}";
+            this.DisgustLabel.Text = $"Disgust: {emotions.Disgust.ToString()}";
+            this.FearLabel.Text = $"Fear: {emotions.Fear.ToString()}";
+            this.HappinessLabel.Text = $"Happiness: {emotions.Happiness.ToString()}";
+            this.NeutralLabel.Text = $"Neutral: {emotions.Neutral.ToString()}";
+            this.SadnessLabel.Text = $"Sadness: {emotions.Sadness.ToString()}";
+            this.SurpriseLabel.Text = $"Surprise: {emotions.Surprise.ToString()}";
+
+            //  var highestEmotion = emotions.ToRankedList().GetEnumerator().MoveNext(()=>{};
+            // var enumeratorOfEmotions =
+            KeyValuePair<string, float> e = new KeyValuePair<string, float>("zero", 0);
+            using (IEnumerator<KeyValuePair<string, float>> enumer = emotions.ToRankedList().GetEnumerator())
+            {
+                if (enumer.MoveNext()) e = enumer.Current;
+            }
+            //this.GetType().GetProperty(highestEmotion + "Label.TextColor").SetValue(this, Color.Blue, null);
+            string highestEmotion = e.Key;
+            var highlightedColor = Color.Red;
+            switch (highestEmotion)
+            {
+                case "Anger":
+                    this.AngerLabel.TextColor = highlightedColor;
+                    break;
+                case "Contempt":
+                    this.ContemptLabel.TextColor = highlightedColor;
+                    break;
+                case "Disgust":
+                    this.DisgustLabel.TextColor = highlightedColor;
+                    break;
+                case "Fear":
+                    this.FearLabel.TextColor = highlightedColor;
+                    break;
+
+                case "Happiness":
+                    this.HappinessLabel.TextColor = highlightedColor;
+                    break;
+
+                case "Neutral":
+                    this.NeutralLabel.TextColor = highlightedColor;
+                    break;
+
+                case "Sadness":
+
+                    this.SadnessLabel.TextColor = highlightedColor;
+                    break;
+
+
+                case "Surprise":
+
+                    this.SurpriseLabel.TextColor = highlightedColor;
+                    break;
+                default: break;
+
+            }
+
+
+        }
+
+        private void ClearEmotionResults(string status)
+        {
+            this.AngerLabel.Text = $"Anger: {status}";
+            this.ContemptLabel.Text = $"Contempt: {status}";
+            this.DisgustLabel.Text = $"Disgust: {status}";
+            this.FearLabel.Text = $"Fear: {status}";
+            this.HappinessLabel.Text = $"Happiness: {status}";
+            this.NeutralLabel.Text = $"Neutral: {status}";
+            this.SadnessLabel.Text = $"Sadness: {status}";
+            this.SurpriseLabel.Text = $"Surprise: {status}";
+
+            var defaultTextColor = Color.Black;
+            this.AngerLabel.TextColor = defaultTextColor;
+            this.ContemptLabel.TextColor = defaultTextColor;
+            this.DisgustLabel.TextColor = defaultTextColor;
+            this.FearLabel.TextColor = defaultTextColor;
+            this.HappinessLabel.TextColor = defaultTextColor;
+            this.NeutralLabel.TextColor = defaultTextColor;
+            this.SadnessLabel.TextColor = defaultTextColor;
+            this.SurpriseLabel.TextColor = defaultTextColor;
+        }
+        //UIImage ScaledImage(UIImage image, nfloat maxWidth, nfloat maxHeight)
+        //{
+        //	var maxResizeFactor = Math.Min(maxWidth / image.Size.Width, maxHeight / image.Size.Height);
+        //	var width = maxResizeFactor * image.Size.Width;
+        //	var height = maxResizeFactor * image.Size.Height;
+        //	return image.Scale(new CoreGraphics.CGSize(width, height));
+        //}
+
+        private async Task<EmotionScores> DetectEmotionsAsync(MediaFile inputFile)
+        {
+            if (!CrossConnectivity.Current.IsConnected)
+            {
+                await DisplayAlert("Network error",
+                  "Please check your network connection and retry.", "OK");
+                return null;
+            }
+
+            try
+            {
+                // Get emotions from the specified stream
+                Emotion[] emotionResult = await
+                  emotionServiceClient.RecognizeAsync(inputFile.GetStream());
+                // Assuming the picture has one face, retrieve emotions for the
+                // first item in the returned array
+                var faceEmotion = emotionResult[0]?.Scores;
+
+                return faceEmotion;
+            }
+            catch (Exception ex)
+            {
+                await DisplayAlert("Error", ex.Message, "OK");
+                return null;
+            }
+        }
+        //async System.Threading.Tasks.Task analyseImage(Stream imageStream)
+        //{
+        //	try
+        //	{
+        //		VisionServiceClient visionClient = new VisionServiceClient("<<YOUR API KEY HERE>>");
+        //		VisualFeature[] features = { VisualFeature.Tags, VisualFeature.Categories, VisualFeature.Description };
+        //		var analysisResult = await visionClient.AnalyzeImageAsync(imageStream, features.ToList(), null);
+        //		AnalysisLabel.Text = string.Empty;
+        //		analysisResult.Description.Tags.ToList().ForEach(tag => AnalysisLabel.Text = AnalysisLabel.Text + tag + "\n");
+        //	}
+        //	catch (Microsoft.ProjectOxford.Vision.ClientException ex)
+        //	{
+        //		AnalysisLabel.Text = ex.Error.Message;
+        //	}
+        //}
+
+        public void UpdateProblemPage(string status)
         {
             ProblemNumberLabel.Text = ProblemNumber;
             ProblemLabel.Text = Problem;
-            SolutionEntry.Text="";
+            SolutionEntry.Text = "";
             currentHintNumber = 0;
             SolutionTextField = SolutionEntry;
-        }
-
-		void OnHintButtonClicked(object sender, EventArgs args)
-		{
+            ClearEmotionResults(status);
+            //    SolutionEntry.Focus();
+        }
+
+        void OnHintButtonClicked(object sender, EventArgs args)
+        {
             if (currentHintNumber < Hints.Count)
             {
                 DisplayAlert("Hint", this.Hints[currentHintNumber], "OK");
@@ -76,6 +244,6 @@
             {
                 DisplayAlert("Hint", "There are no more hints for this problem", "OK");
             }
-		}
+        }
     }
 }


Make back button work on bread crumbs

Make back button work on bread crumbs

--- MatterControlLib/PartPreviewWindow/LibraryBrowserPage.cs
+++ MatterControlLib/PartPreviewWindow/LibraryBrowserPage.cs
@@ -42,11 +42,10 @@
 		protected MHTextEditWidget itemNameWidget;
 		protected ILibraryContext libraryNavContext;
 		protected LibraryListView librarySelectorWidget;
+		private FolderBreadCrumbWidget breadCrumbWidget = null;

 		public LibraryBrowserPage(Action<string, ILibraryWritableContainer> acceptCallback, string acceptButtonText)
 		{
-			FolderBreadCrumbWidget breadCrumbWidget = null;
-
 			this.WindowSize = new Vector2(480, 500);

 			contentRow.Padding = 0;
@@ -96,6 +95,22 @@
 			this.AddPageAction(acceptButton);
 		}

+		public override void OnMouseDown(MouseEventArgs mouseEvent)
+		{
+			if (mouseEvent.Button == MouseButtons.XButton1)
+			{
+				// user pressed the back button
+				NavigateBack();
+			}
+
+			base.OnMouseDown(mouseEvent);
+		}
+
+		public void NavigateBack()
+		{
+			breadCrumbWidget.NavigateBack();
+		}
+
 		public override void OnLoad(EventArgs args)
 		{
 			if (itemNameWidget != null


Do not switch to tab when restoring PartTab

--- MatterControlLib/PartPreviewWindow/PartPreviewContent.cs
+++ MatterControlLib/PartPreviewWindow/PartPreviewContent.cs
@@ -453,7 +453,6 @@
 			};

 			tabControl.AddTab(partTab);
-			tabControl.ActiveTab = partTab;

 			partTab.CloseClicked += (s, e) =>
 			{


Fix formatting

Fix formatting

--- CSGL.Vulkan/Swapchain.cs
+++ CSGL.Vulkan/Swapchain.cs
@@ -128,12 +128,12 @@
         }

         public VkResult AcquireNextImage(ulong timeout, Semaphore semaphore, Fence fence, out uint index) {
-            VkSemaphore sTemp = VkSemaphore.Null;
-            VkFence fTemp = VkFence.Null;
-            if (semaphore != null) sTemp = semaphore.Native;
-            if (fence != null) fTemp = fence.Native;
+            VkSemaphore semaphoreNative = VkSemaphore.Null;
+            VkFence fenceNative = VkFence.Null;
+            if (semaphore != null) semaphoreNative = semaphore.Native;
+            if (fence != null) fenceNative = fence.Native;

-            var result = Device.Commands.acquireNextImage(Device.Native, swapchain, timeout, sTemp, fTemp, out index);
+            var result = Device.Commands.acquireNextImage(Device.Native, swapchain, timeout, semaphoreNative, fenceNative, out index);
             if (!(result == VkResult.Success || result == VkResult.SuboptimalKhr || result == VkResult.NotReady || result == VkResult.Timeout)) {
                 throw new SwapchainException(result, string.Format("Error acquiring image: {0}", result));
             }


Arreglo en test de finalizar desafio wake me up

--- BeatItTest/Test.cs
+++ BeatItTest/Test.cs
@@ -58,17 +58,17 @@

             challenge.CompleteChallenge(1);
             // El ultimo puntaje y el mejor deberian ser 20.
-            Assert.AreEqual(challenge.State.BestScore, 20);
-            Assert.AreEqual(challenge.State.LastScore, 20);
+            Assert.AreEqual(challenge.State.BestScore, 80);
+            Assert.AreEqual(challenge.State.LastScore, 80);

             challenge.CompleteChallenge(2);
             // El ultimo puntaje y el mejor deberian ser 40
-            Assert.AreEqual(challenge.State.BestScore, 40);
-            Assert.AreEqual(challenge.State.LastScore, 40);
+            Assert.AreEqual(challenge.State.BestScore, 160);
+            Assert.AreEqual(challenge.State.LastScore, 160);

             challenge.CompleteChallenge(0);
             // El ultimo puntaje deberia ser 0 y el mejor 40.
-            Assert.AreEqual(challenge.State.BestScore, 40);
+            Assert.AreEqual(challenge.State.BestScore, 160);
             Assert.AreEqual(challenge.State.LastScore, 0);
         }
     };


save non-200 http status code

save non-200 http status code

ref #365

--- src/FilterLists.Services/Snapshot/Snapshot.cs
+++ src/FilterLists.Services/Snapshot/Snapshot.cs
@@ -87,12 +87,14 @@
             }
             catch (HttpRequestException hre)
             {
+                await dbContext.SaveChangesAsync();
                 await TrackException(hre);
                 return null;
             }
             catch (WebException we)
             {
                 snapEntity.HttpStatusCode = ((int)((HttpWebResponse)we.Response).StatusCode).ToString();
+                await dbContext.SaveChangesAsync();
                 await TrackException(we);
                 return null;
             }


temp send emails for long rules

temp send emails for long rules

--- src/FilterLists.Services/Snapshot/Snapshot.cs
+++ src/FilterLists.Services/Snapshot/Snapshot.cs
@@ -114,7 +114,11 @@
                 {
                     string line;
                     while ((line = await streamReader.ReadLineAsync()) != null)
+                    {
                         lines.AddIfNotNullOrEmpty(line.LintLine());
+                        if (line.Length >= 191)
+                            await emailService.SendEmailAsync("Long Line Possibly Truncated", line);
+                    }
                 }
             }


fix: throw an exception if DirectionRequest.Origin isn't set

--- src/Google.Maps/Direction/DirectionRequest.cs
+++ src/Google.Maps/Direction/DirectionRequest.cs
@@ -107,6 +107,8 @@

 		public override Uri ToUri()
 		{
+			if (Origin == null) throw new InvalidOperationException("Origin is required");
+
 			var qsb = new Google.Maps.Internal.QueryStringBuilder()
 				.Append("origin", (Origin == null ? (string)null : Origin.GetAsUrlParameter()))
 				.Append("destination", (Destination == null ? (string)null : Destination.GetAsUrlParameter()))


Fix expiration sort, remove unused values

--- contractContainer.cs
+++ contractContainer.cs
@@ -36,8 +36,8 @@
 	internal class contractContainer
 	{
 		internal Contract contract;
-		internal float science, repReward, repPenalty, totalScience, totalRepReward, totalRepPenalty;
-		internal double expiration, acceptance, duration, reward, advance, penalty, totalReward, totalPenalty;
+		internal float totalScience, totalRepReward, totalRepPenalty;
+		internal double deadline, totalReward, totalPenalty;
 		internal bool showParams;
 		internal string daysToExpire;
 		internal List<parameterContainer> paramList = new List<parameterContainer>();
@@ -46,16 +46,20 @@
 		internal contractContainer(Contract Contract)
 		{
 			contract = Contract;
-			expiration = contract.DateDeadline;
-			daysToExpire = timeInDays(expiration - Planetarium.GetUniversalTime());
-			acceptance = contract.DateAccepted;
-			duration = expiration - acceptance;
-			advance = contract.FundsAdvance;
-			reward = totalReward = contract.FundsCompletion;
-			penalty = totalPenalty = contract.FundsFailure;
-			science = totalScience = contract.ScienceCompletion;
-			repReward = totalRepReward = contract.ReputationCompletion;
-			repPenalty = totalRepPenalty = contract.ReputationFailure;
+
+			//No-expiration date contracts have negative DateExpire values
+			deadline = contract.DateDeadline;
+			if (deadline <= 0 && contract.ContractState == Contracts.Contract.State.Active)
+				deadline = double.MaxValue;
+
+			//Calculate time in day values using Kerbin or Earth days
+			daysToExpire = timeInDays(contract.DateDeadline - Planetarium.GetUniversalTime());
+
+			totalReward = contract.FundsCompletion;
+			totalPenalty = contract.FundsFailure;
+			totalScience = contract.ScienceCompletion;
+			totalRepReward = contract.ReputationCompletion;
+			totalRepPenalty = contract.ReputationFailure;
 			showParams = true;

 			foreach (ContractParameter param in contract.AllParameters)
@@ -71,7 +75,7 @@

 		private string timeInDays(double D)
 		{
-			if (D < 0)
+			if (D <= 0)
 				return "---";

 			int[] time = KSPUtil.GetDateFromUT((int)D);
@@ -116,7 +120,7 @@
 		Default = 1,
 		Expiration = 2,
 		Acceptance = 3,
-		Duration = 4,
+		Difficulty = 4,
 		Reward = 5,
 	}


Add clarifying comment to HttpMethods.cs (#12441)

To help prevent well-meaning (but not actually desirable) changes like https://github.com/aspnet/AspNetCore/pull/12439

--- src/Http/Http.Abstractions/src/HttpMethods.cs
+++ src/Http/Http.Abstractions/src/HttpMethods.cs
@@ -7,6 +7,14 @@
 {
     public static class HttpMethods
     {
+        // We are intentionally using 'static readonly' here instead of 'const'.
+        // 'const' values would be embedded in to each assembly that used them
+        // and each consuming assembly would have a different 'string' instance.
+        // Using .'static readonly' means that all consumers get thee exact same
+        // 'string' instance, which means the 'ReferenceEquals' checks below work
+        // and allow us to optimize comparisons when these constants are used.
+
+        // Please do NOT change these to 'const'
         public static readonly string Connect = "CONNECT";
         public static readonly string Delete = "DELETE";
         public static readonly string Get = "GET";


Codecov version was updated

Codecov version was updated

--- build/build.cake
+++ build/build.cake
@@ -1,5 +1,5 @@
 #tool "nuget:?package=OpenCover"
-#tool "nuget:?package=Codecov&version=1.5.0"
+#tool "nuget:?package=Codecov&version=1.12.3"
 #addin "nuget:?package=Cake.Codecov"
 using System.Linq;
 using System.Text.RegularExpressions;


- fixing compiler warning

- fixing compiler warning

--- src/JsonFx.UI/EcmaScript/EcmaScriptBuilder.cs
+++ src/JsonFx.UI/EcmaScript/EcmaScriptBuilder.cs
@@ -94,10 +94,13 @@
 			{
 				block = parser.Parse(this.CodeSettings);
 			}
+#if DEBUG
 			catch (Exception ex)
 			{
-#if DEBUG
 				Trace.WriteLine(ex.Message);
+#else
+			catch
+			{
 #endif
 				return null;
 			}


Correct Group Name

Correct Group Name

--- src/JustSending/Controllers/HomeController.cs
+++ src/JustSending/Controllers/HomeController.cs
@@ -36,11 +36,11 @@
                         .Select(x => new
                         {
                             Year = x.Key,
-                            Items = x.GroupBy(y => y.Id.ToString().Substring(2, 2))
+                            Months = x.GroupBy(y => y.Id.ToString().Substring(2, 2))
                                         .Select(c => new
                                         {
                                             Month = c.Key,
-                                            Items = c
+                                            Days = c
                                         })
                         });


Added TriggerBase.ToString(). Also, OnFire() does not fire the event if the trigger is disabled.

--- src/Kephas.Scheduling/Triggers/TriggerBase.cs
+++ src/Kephas.Scheduling/Triggers/TriggerBase.cs
@@ -20,19 +20,19 @@
     /// <summary>
     /// A trigger base.
     /// </summary>
-    public abstract class TriggerBase : Expando, ITrigger, IInitializable, IDisposable
+    public abstract class TriggerBase : Expando, ITrigger, IInitializable
     {
         private bool isDisposed = false;

         /// <summary>
         /// Occurs when the trigger is fired.
         /// </summary>
-        public event EventHandler Fire;
+        public event EventHandler? Fire;

         /// <summary>
         /// Occurs when the trigger reached its end of life.
         /// </summary>
-        public event EventHandler Disposed;
+        public event EventHandler? Disposed;

         /// <summary>
         /// Gets or sets a value indicating whether the trigger is enabled.
@@ -50,7 +50,7 @@
         /// <returns>
         /// The type information.
         /// </returns>
-        public virtual ITriggerInfo GetTypeInfo() => (ITriggerInfo)this.GetRuntimeTypeInfo();
+        public virtual ITriggerInfo GetTypeInfo() => (ITriggerInfo)this.GetRuntimeTypeInfo()!;

         /// <summary>
         /// Gets type information.
@@ -59,6 +59,17 @@
         /// The type information.
         /// </returns>
         ITypeInfo IInstance.GetTypeInfo() => this.GetTypeInfo();
+
+        /// <summary>
+        /// Returns a string that represents the current object.
+        /// </summary>
+        /// <returns>
+        /// A string that represents the current object.
+        /// </returns>
+        public override string ToString()
+        {
+            return $"{this.GetTypeInfo().Name} ({this.Id})";
+        }

         /// <summary>
         /// Initializes the service.
@@ -103,7 +114,10 @@
         /// </summary>
         protected virtual void OnFire()
         {
-            this.Fire?.Invoke(this, EventArgs.Empty);
+            if (this.IsEnabled)
+            {
+                this.Fire?.Invoke(this, EventArgs.Empty);
+            }
         }

         /// <summary>


AppVeyor not liking inline variable on parse!

--- src/Merchello.Core/Services/InvoiceService.cs
+++ src/Merchello.Core/Services/InvoiceService.cs
@@ -1695,7 +1695,8 @@
             var discounts = invoice.Items.Where(x => x.LineItemType == LineItemType.Discount).Sum(x => x.TotalPrice);

             // Calculate a new total
-            invoice.Total = Math.Round(decimal.TryParse((charges - discounts).ToString(CultureInfo.InvariantCulture), NumberStyles.AllowDecimalPoint, CultureInfo.InvariantCulture.NumberFormat, out var converted) ? converted : 0, 2);
+            decimal converted;
+            invoice.Total = Math.Round(decimal.TryParse((charges - discounts).ToString(CultureInfo.InvariantCulture), NumberStyles.AllowDecimalPoint, CultureInfo.InvariantCulture.NumberFormat, out converted) ? converted : 0, 2);

             // Save the invoice
             Save(invoice);


Get validation attributes for data tables.


Update WcfConsumerExtensions.cs

Update WcfConsumerExtensions.cs

--- src/WcfConsumerExtensions.cs
+++ src/WcfConsumerExtensions.cs
@@ -3,11 +3,12 @@
 using System.Xml;
 using System.Linq;
 using System.Xml.Linq;
+using System.ServiceModel;

 namespace HallLibrary.Extensions {
 	public static class WcfConsumerExtensions {
 		public static TReturn CallWCFMethodWithHeaders<TChannel, TReturn> (TChannel channel, IEnumerable<System.ServiceModel.Channels.MessageHeader> headers, Func<TChannel, TReturn> callWCFMethod) {
-			using (var ocs = new OperationContextScope((System.ServiceModel.IContextChannel)channel)) {
+			using (var ocs = new OperationContextScope((IContextChannel)channel)) {
 				foreach (var header in headers)
 					OperationContext.Current.OutgoingMessageHeaders.Add(header);
 				return callWCFMethod(channel);
@@ -19,7 +20,7 @@
 		}

 		public static System.ServiceModel.Channels.MessageHeader CreateWCFHeader<T> (string name, T value, string nameSpace = null) {
-			return new System.ServiceModel.MessageHeader<T>(value).GetUntypedHeader(name, nameSpace ?? string.Empty);
+			return new MessageHeader<T>(value).GetUntypedHeader(name, nameSpace ?? string.Empty);
 		}
 	}

@@ -29,6 +30,7 @@
 		public DateTime TimeCreated;
 		public string Action;
 		public string MessageType;
+		public Guid ActivityID;
 		public string Source;
 		public string Address;
 		public XElement Content;
@@ -131,7 +133,7 @@
 								var soapEnvelope = messageLog.GetElementByName("Envelope", true);
 								if (soapEnvelope == null)
 								{
-									messageLog.Dump();
+									//messageLog.Dump();
 								}
 								else
 								{


Update SyncToFile.cs

Update SyncToFile.cs

text formatting

--- SyncToFile.cs
+++ SyncToFile.cs
@@ -7,15 +7,15 @@

 namespace Burnsba.Toolbox
 {
-  public interface IWatchable
+    public interface IWatchable
     {
         event EventHandler Changed;
     }
-	public interface ISerializable
+    public interface ISerializable
     {
         XElement ToXElement();
     }
-	public interface ISerializeWatchable : ISerializable, IWatchable
+    public interface ISerializeWatchable : ISerializable, IWatchable
     {
     }


enumerator support for keys and values in dictionaries

--- C5/Dictionaries.cs
+++ C5/Dictionaries.cs
@@ -430,6 +430,9 @@
             public LiftedEnumerable(SCG.IEnumerable<H> keys) { this.keys = keys; }
             public SCG.IEnumerator<KeyValuePair<K, V>> GetEnumerator() { foreach (H key in keys) yield return new KeyValuePair<K, V>(key); }

+
+
+
             #region IEnumerable Members

             System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
@@ -569,16 +572,90 @@

             internal ValuesCollection(ICollection<KeyValuePair<K, V>> pairs)
-            { this.pairs = pairs; }
+            {
+                this.pairs = pairs;
+                _internalEnumerator = new ValueEnumerator(pairs, MemoryType.Safe);
+            }
+
+            private readonly ValueEnumerator _internalEnumerator;
+
+            #region Private Enumerator
+
+            [Serializable]
+            private class ValueEnumerator : MemorySafeEnumerator<V>
+            {
+                private ICollection<KeyValuePair<K, V>> _internalList;
+
+                private SCG.IEnumerator<KeyValuePair<K, V>> _internalEnumerator;
+
+                //-1 means an iterator is not in use.
+                private int _iteratorState;
+
+
+                public ValueEnumerator(ICollection<KeyValuePair<K, V>> list, MemoryType memoryType)
+                    : base(memoryType)
+                {
+                    _internalList = list;
+                }
+
+                internal void UpdateReference(ICollection<KeyValuePair<K, V>> list)
+                {
+                    _internalList = list;
+                    Current = default(V);
+                }
+
+
+                public void Dispose()
+                {
+                    _iteratorState = -1;
+                }
+
+                public override bool MoveNext()
+                {
+                    ICollection<KeyValuePair<K, V>> list = _internalList;
+
+                    if (_internalEnumerator == null)
+                        _internalEnumerator = list.GetEnumerator();
+
+                    if (_internalEnumerator.MoveNext())
+                    {
+                        Current = _internalEnumerator.Current.Value;
+                        return true;
+                    }
+
+
+
+                    Current = default(V);
+                    return false;
+                }
+
+                public override void Reset()
+                {
+                    Current = default(V);
+                }
+
+
+                protected override MemorySafeEnumerator<V> Clone()
+                {
+                    var enumerator = new ValueEnumerator(_internalList, MemoryType)
+                    {
+                        Current = default(V)
+                    };
+                    return enumerator;
+                }
+            }
+            #endregion

             public override V Choose() { return pairs.Choose().Value; }

             public override SCG.IEnumerator<V> GetEnumerator()
             {
+                _internalEnumerator.UpdateReference(pairs);
+                return _internalEnumerator.GetEnumerator();
                 //Updatecheck is performed by the pairs enumerator
-                foreach (KeyValuePair<K, V> p in pairs)
-                    yield return p.Value;
+                //foreach (KeyValuePair<K, V> p in pairs)
+                //    yield return p.Value;
             }

             public override bool IsEmpty { get { return pairs.IsEmpty; } }
@@ -593,16 +670,87 @@
         {
             ICollection<KeyValuePair<K, V>> pairs;

+            private readonly KeyEnumerator  _internalEnumerator;
+
+            #region Private Enumerator
+
+            [Serializable]
+            private class KeyEnumerator : MemorySafeEnumerator<K>
+            {
+                private ICollection<KeyValuePair<K, V>> _internalList;
+
+                private SCG.IEnumerator<KeyValuePair<K, V>> _internalEnumerator;
+
+                //-1 means an iterator is not in use.
+                private int _iteratorState;
+
+
+                public KeyEnumerator(ICollection<KeyValuePair<K, V>> list, MemoryType memoryType)
+                    : base(memoryType)
+                {
+                    _internalList = list;
+                }
+
+                internal void UpdateReference(ICollection<KeyValuePair<K, V>> list)
+                {
+                    _internalList = list;
+                    Current = default(K);
+                }
+
+
+                public void Dispose()
+                {
+                    _iteratorState = -1;
+                }
+
+                public override bool MoveNext()
+                {
+                    ICollection<KeyValuePair<K, V>> list = _internalList;
+
+                    if (_internalEnumerator == null)
+                        _internalEnumerator = list.GetEnumerator();
+
+                    if (_internalEnumerator.MoveNext())
+                    {
+                        Current = _internalEnumerator.Current.Key;
+                        return true;
+                    }
+
+
+
+                    Current = default(K);
+                    return false;
+                }
+
+                public override void Reset()
+                {
+                    Current = default(K);
+                }
+
+
+                protected override MemorySafeEnumerator<K> Clone()
+                {
+                    var enumerator = new KeyEnumerator(_internalList, MemoryType)
+                    {
+                        Current = default(K)
+                    };
+                    return enumerator;
+                }
+            }
+            #endregion

             internal KeysCollection(ICollection<KeyValuePair<K, V>> pairs)
-            { this.pairs = pairs; }
+            {
+                this.pairs = pairs;
+                _internalEnumerator = new KeyEnumerator(pairs, MemoryType.Safe);
+            }

             public override K Choose() { return pairs.Choose().Key; }

             public override SCG.IEnumerator<K> GetEnumerator()
             {
-                foreach (KeyValuePair<K, V> p in pairs)
-                    yield return p.Key;
+                _internalEnumerator.UpdateReference(pairs);
+                return _internalEnumerator.GetEnumerator();
             }

             public override bool IsEmpty { get { return pairs.IsEmpty; } }


* automata with many states

* automata with many states

--- TAIO/Form1.cs
+++ TAIO/Form1.cs
@@ -186,7 +186,7 @@

         private void GenerateTests(object sender, EventArgs e)
         {
-            int[] basicStates = new int[] { 4, 6, 10, 15 };
+            int[] basicStates = new int[] { 4, 6, 10, 15, 20, 30, 50, 80 };
             int automataAmount = 1;
             int maxNumberOfLetters = 5;
             alphabetLetters = new string[] { "0", "1", "2", "3", "4" };
@@ -196,7 +196,6 @@
                 {
                     automaton = Automaton.GetRandomAutomaton(maxNumberOfLetters, basicStates[j]);
                     findResultButton_Click(sender, e);
-                    int state = foundAutomaton.GetFinalState("01");
                 }
             }
         }


Added TagFactory.CreateTag overloads

Added TagFactory.CreateTag overloads

Added TagFactory.CreateTag overloads to allow specifying the tag's name
and value of the new tag.

--- TagFactory.cs
+++ TagFactory.cs
@@ -7,6 +7,16 @@
     #region  Public Class Methods

     public static ITag CreateTag(TagType tagType)
+    {
+      return TagFactory.CreateTag(tagType, null);
+    }
+
+    public static ITag CreateTag(TagType tagType, object defaultValue)
+    {
+      return TagFactory.CreateTag(tagType, null, defaultValue);
+    }
+
+    public static ITag CreateTag(TagType tagType, string name, object defaultValue)
     {
       ITag result;

@@ -49,6 +59,10 @@
           throw new ArgumentException("Invalid tag type.", "tagType");
       }

+      result.Name = name;
+      if (defaultValue != null)
+        result.Value = defaultValue;
+
       return result;
     }


fixed a bug that cannot load commands from assemblies

git-svn-id: 264d93eb9283b6a3bfed80dd266caeb8f93e7ca3@70206 81fbe566-5dc4-48c1-bdea-7421811ca204

--- mainline/SuperWebSocket/SubProtocol/BasicSubProtocol.cs
+++ mainline/SuperWebSocket/SubProtocol/BasicSubProtocol.cs
@@ -86,42 +86,42 @@
         {
             var commandAssembly = config.Options.GetValue("commandAssembly");

-            if (string.IsNullOrEmpty(commandAssembly))
-                return true;
+            if (!string.IsNullOrEmpty(commandAssembly))
+            {
+                var protocolAssemblies = commandAssembly.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);

-            var protocolAssemblies = commandAssembly.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
+                for (var i = 0; i < protocolAssemblies.Length; i++)
+                {
+                    var p = protocolAssemblies[i].Split(new char[] { ':' }, StringSplitOptions.RemoveEmptyEntries);

-            for (var i = 0; i < protocolAssemblies.Length; i++)
-            {
-                var p = protocolAssemblies[i].Split(new char[] { ':' }, StringSplitOptions.RemoveEmptyEntries);
+                    if (p.Length == 1)
+                    {
+                        if (Name.Equals(DefaultName, StringComparison.OrdinalIgnoreCase))
+                        {
+                            if (!ResolveCommmandAssembly(p[0]))
+                                return false;

-                if (p.Length == 1)
-                {
-                    if (Name.Equals(DefaultName, StringComparison.OrdinalIgnoreCase))
+                            continue;
+                        }
+                    }
+                    else if (p.Length == 2)
                     {
-                        if (!ResolveCommmandAssembly(p[0]))
-                            return false;
+                        if (string.IsNullOrEmpty(p[0]) || string.IsNullOrEmpty(p[1]))
+                            continue;

-                        continue;
+                        if (Name.Equals(p[0].Trim(), StringComparison.OrdinalIgnoreCase))
+                        {
+                            if (!ResolveCommmandAssembly(p[1]))
+                                return false;
+
+                            continue;
+                        }
                     }
-                }
-                else if (p.Length == 2)
-                {
-                    if (string.IsNullOrEmpty(p[0]) || string.IsNullOrEmpty(p[1]))
-                        continue;
-
-                    if (Name.Equals(p[0].Trim(), StringComparison.OrdinalIgnoreCase))
+                    else
                     {
-                        if (!ResolveCommmandAssembly(p[1]))
-                            return false;
-
-                        continue;
+                        LogUtil.LogError("Invalid command assembly: " + commandAssembly);
+                        return false;
                     }
-                }
-                else
-                {
-                    LogUtil.LogError("Invalid command assembly: " + commandAssembly);
-                    return false;
                 }
             }


Fix BreakTest to return valid cursor pos in any case.

--- TextEditor.cs
+++ TextEditor.cs
@@ -239,7 +239,7 @@
             Predicate<char> isBreakChar = c => breakChars.IndexOf(c) >= 0;
             if (buffer.Length == 0)
             {
-                return -1;
+                return 0;
             }
             var pos = cursorPos;
             if (dir < 0)


rework so we can save our progress and reconnect when TrackerBehaviour disconnects our trusted node for too many false positives

--- NBitcoin.SPV.TrackAddressBasic/Program.cs
+++ NBitcoin.SPV.TrackAddressBasic/Program.cs
@@ -24,63 +24,34 @@
             var ipaddr = IPAddress.Parse("127.0.0.1");
             var peer = new NetworkAddress(ipaddr, 18333);

-            var parameters = new NodeConnectionParameters();
-
-            // ping pong
-            parameters.TemplateBehaviors.FindOrCreate<PingPongBehavior>();
-
-            // chain behavior keep chain in sync
-            var chain = new ConcurrentChain(network);
-            parameters.TemplateBehaviors.Add(new ChainBehavior(chain));
-
-            // tracker behavior tracks our addresses
-            var tracker = new Tracker();
-            var trackerBehavior = new TrackerBehavior(tracker, chain);
-            parameters.TemplateBehaviors.Add(trackerBehavior);
-
             // initial scan location
             var scanLocation = new BlockLocator();
             scanLocation.Blocks.Add(network.GetGenesis().GetHash());

             // connect node
-            var node = Node.Connect(network, peer, parameters);
-            trackerBehavior.Attach(node); // TODO: not sure why we need to do this manually
+            var chain = new ConcurrentChain(network);
+            Node node = null;
+            NodeEventHandler nodeDisconnect = null;
+            nodeDisconnect = (Node node1) =>
+            {
+                // TrackerBehavior has probably disconnected the node because of too many false positives...
+                Console.WriteLine("Disconnected!");

-            // debug fluff
-            node.MessageReceived += (node1, message) =>
-            {
-                if (message.Message.Command != "headers" && message.Message.Command != "merkleblock")
-                    Console.WriteLine(message.Message.Command);
+                // save progress
+                var trackerBehavior = node1.Behaviors.Find<TrackerBehavior>();
+                scanLocation = trackerBehavior.CurrentProgress;
+
+                Task.Run(() =>
+                {
+                    System.Threading.Thread.Sleep(1000);
+
+                    // reconnect
+                    node = ConnectNode(key, peer, chain, scanLocation, nodeDisconnect);
+                    HandshakeNode(node, peer);
+                });
             };
-
-            // setup tracker with our addresse
-            node.StateChanged += (node1, oldState) =>
-            {
-                if (node1.State == NodeState.HandShaked)
-                {
-                    trackerBehavior.Scan(scanLocation, DateTimeOffset.MinValue);
-                    trackerBehavior.SendMessageAsync(new MempoolPayload());
-
-                    tracker.Add(key.ScriptPubKey);
-
-                    trackerBehavior.RefreshBloomFilter();
-                }
-            };
-
-            node.Disconnected += (Node node1) =>
-            {
-                Console.WriteLine("Disconnected!");
-            };
-
-            // more debug fluff
-            tracker.NewOperation += (Tracker sender, Tracker.IOperation trackerOperation) =>
-            {
-                Console.WriteLine("tracker operation: {0}", trackerOperation.ToString());
-            };
-
-            // do node handshake
-            node.VersionHandshake();
-            Console.WriteLine("Successful handshake with {0}", peer.Endpoint);
+            node = ConnectNode(key, peer, chain, scanLocation, nodeDisconnect);
+            HandshakeNode(node, peer);

             int chainHeight = 0;
             while (true)
@@ -93,5 +64,68 @@
                 System.Threading.Thread.Sleep(5000);
             }
         }
+
+        private static Node ConnectNode(Key key, NetworkAddress peer, ConcurrentChain chain, BlockLocator scanLocation, NodeEventHandler nodeDisconnect)
+        {
+            var parameters = new NodeConnectionParameters();
+
+            // ping pong
+            parameters.TemplateBehaviors.FindOrCreate<PingPongBehavior>();
+
+            // chain behavior keep chain in sync
+            parameters.TemplateBehaviors.Add(new ChainBehavior(chain));
+
+            // tracker behavior tracks our address
+            Console.WriteLine("Tracking {0}", key.PubKey.GetAddress(network));
+            var tracker = new Tracker();
+            tracker.Add(key.ScriptPubKey);
+            var trackerBehavior = new TrackerBehavior(tracker, chain);
+            parameters.TemplateBehaviors.Add(trackerBehavior);
+            tracker.NewOperation += (Tracker sender, Tracker.IOperation trackerOperation) =>
+            {
+                Console.WriteLine("tracker operation: {0}", trackerOperation.ToString());
+            };
+
+            var node = Node.Connect(network, peer, parameters);
+            trackerBehavior.Detach();
+            trackerBehavior.Attach(node);
+
+            // debug fluff
+            node.MessageReceived += (node1, message) =>
+            {
+                if (message.Message.Command != "headers" && message.Message.Command != "merkleblock")
+                {
+                    if (message.Message.Payload is TxPayload)
+                    {
+                        var txPayload = (TxPayload)message.Message.Payload;
+                        Console.WriteLine("tx {0}", txPayload.Object.GetHash());
+                    }
+                        else
+                    Console.WriteLine(message.Message.Command);
+                }
+            };
+
+            // start tracker scanning
+            node.StateChanged += (node1, oldState) =>
+            {
+                if (node1.State == NodeState.HandShaked)
+                {
+                    trackerBehavior.Scan(scanLocation, DateTimeOffset.MinValue);
+                    trackerBehavior.SendMessageAsync(new MempoolPayload());
+
+                    trackerBehavior.RefreshBloomFilter();
+                }
+            };
+
+            node.Disconnected += nodeDisconnect;
+
+            return node;
+        }
+
+        private static void HandshakeNode(Node node, NetworkAddress peer)
+        {
+            node.VersionHandshake();
+            Console.WriteLine("Successful handshake with {0}", peer.Endpoint);
+        }
     }
 }


Removed redundant code.

Removed redundant code.

--- NaudioPlayer/NaudioWrapper/AudioPlayer.cs
+++ NaudioPlayer/NaudioWrapper/AudioPlayer.cs
@@ -9,6 +9,8 @@
         {
             PlaybackStoppedByUser, PlaybackStoppedReachingEndOfFile
         }
+
+        public PlaybackStopTypes PlaybackStopType { get; set; } = PlaybackStopTypes.PlaybackStoppedReachingEndOfFile;

         private AudioFileReader _audioFileReader;

@@ -85,12 +87,7 @@
         {
             if (_output != null)
             {
-                Dispose();
-
-                if (PlaybackStopped != null)
-                {
-                    PlaybackStopped();
-                }
+                _output.Stop();
             }
         }


Fix expected message

Fix expected message

--- Nodejs/Tests/Core.UI/BasicProjectTests.cs
+++ Nodejs/Tests/Core.UI/BasicProjectTests.cs
@@ -326,7 +326,7 @@
             dialog.FolderName = Path.GetFullPath(@"TestData\NodejsProjectData\AddExistingFolder");
             dialog.SelectFolder();

-            VisualStudioApp.CheckMessageBox("Cannot add folder 'AddExistingFolder' to one of its own children.");
+            VisualStudioApp.CheckMessageBox("Cannot add folder 'AddExistingFolder' as a child or decedent of self.");
         }

         [TestMethod, Priority(0), TestCategory("Core")]


Don't make RPC API calls during View populating

--- MultiMiner.UX/ViewModels/ApplicationViewModel.cs
+++ MultiMiner.UX/ViewModels/ApplicationViewModel.cs
@@ -1616,10 +1616,16 @@
             }
         }

+        //this is a high-traffic call, guard against making repeated RPC calls
         public bool NetworkDeviceWasStopped(DeviceViewModel networkDevice)
         {
-            // networkDevicePools is keyed by IP:port, use .Path
-            List<PoolInformation> poolInformation = GetCachedPoolInfoFromAddress(networkDevice.Path);
+            List<PoolInformation> poolInformation = null;
+
+            //networkDevicePools is keyed by IP:port, use .Path
+            //do not call GetCachedPoolInfoFromAddress() as it may make an RPC call
+            //see method warning above
+            if (NetworkDevicePools.ContainsKey(networkDevice.Path))
+                poolInformation = NetworkDevicePools[networkDevice.Path];

             if (poolInformation == null)
                 //RPC API call timed out


Finished sentence

Finished sentence

--- Hazel/Udp/UdpConnectionListener.cs
+++ Hazel/Udp/UdpConnectionListener.cs
@@ -129,7 +129,7 @@
                 //Client no longer reachable, pretend it didn't happen
                 //TODO should this not inform the connection this client is lost???

-                //This thread suggests the IP is not passed out from WinSoc so maybe not
+                //This thread suggests the IP is not passed out from WinSoc so maybe not possible
                 //http://stackoverflow.com/questions/2576926/python-socket-error-on-udp-data-receive-10054

                 StartListeningForData();


pushed to nuget

pushed to nuget

--- Jot/Properties/AssemblyInfo.cs
+++ Jot/Properties/AssemblyInfo.cs
@@ -40,8 +40,8 @@
 // You can specify all the values or you can default the Build and Revision Numbers
 // by using the '*' as shown below:
 // [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.1.0")]
-[assembly: AssemblyFileVersion("1.0.1.0")]
+[assembly: AssemblyVersion("1.1.0.0")]
+[assembly: AssemblyFileVersion("1.1.0.0")]

 [assembly:InternalsVisibleTo("Jot.Tests")]
 [assembly:InternalsVisibleTo("Jot.Tests.NoConfig")]


Add method to check if empty collections should be included in result serialized json result

--- src/Nest/Resolvers/ElasticContractResolver.cs
+++ src/Nest/Resolvers/ElasticContractResolver.cs
@@ -156,6 +156,20 @@
 		{
 			var property = base.CreateProperty(member, memberSerialization);

+			// Skip serialization of empty collections that has DefaultValueHandling set to Ignore.
+			if (property.DefaultValueHandling.HasValue
+				&& property.DefaultValueHandling.Value == DefaultValueHandling.Ignore
+				&& !typeof(string).IsAssignableFrom(property.PropertyType)
+				&& typeof(IEnumerable).IsAssignableFrom(property.PropertyType))
+			{
+				Predicate<object> shouldSerialize = obj =>
+				{
+					var collection = property.ValueProvider.GetValue(obj) as ICollection;
+					return collection == null || collection.Count != 0;
+				};
+				property.ShouldSerialize = property.ShouldSerialize == null ? shouldSerialize : (o => property.ShouldSerialize(o) && shouldSerialize(o));
+			}
+
 			var attributes = member.GetCustomAttributes(typeof(IElasticPropertyAttribute), false);
 			if (attributes == null || !attributes.Any())
 				return property;


Cleanup

Cleanup

--- NElasticsearch/Commands/MultiDocumentCommands.cs
+++ NElasticsearch/Commands/MultiDocumentCommands.cs
@@ -29,7 +29,6 @@
             var request = new RestRequest("/_bulk", Method.POST);
             request.RequestFormat = DataFormat.Json;
             request.AddParameter("text/json", sb.ToString(), ParameterType.RequestBody);
-            //request.AddBody(sb.ToString());
             var response = client.Execute(request);

             // TODO


New clientlib ver

New clientlib ver

--- KalturaClient/KalturaClient.cs
+++ KalturaClient/KalturaClient.cs
@@ -34,7 +34,7 @@
 		public KalturaClient(KalturaConfiguration config) : base(config)
 		{
 				ApiVersion = "3.3.0";
-				ClientTag = "dotnet:16-08-12";
+				ClientTag = "dotnet:16-08-13";
 		}

 		KalturaAccessControlProfileService _AccessControlProfileService;


Adding constructor to SpanAttributes to accept collection (#1126)

* Adding new constructor to SpanAttributes

* reiley's comments

* changing param comment

Co-authored-by: Cijo Thomas <242191b8c991f635fefc07748c2f69af50b38db4@microsoft.com>

--- src/OpenTelemetry.Api/Trace/SpanAttributes.cs
+++ src/OpenTelemetry.Api/Trace/SpanAttributes.cs
@@ -15,6 +15,7 @@
 // </copyright>

 using System;
+using System.Collections.Generic;
 using System.Diagnostics;

 namespace OpenTelemetry.Trace
@@ -32,6 +33,23 @@
             this.Attributes = new ActivityTagsCollection();
         }

+        /// <summary>
+        /// Initializes a new instance of the <see cref="SpanAttributes"/> class.
+        /// </summary>
+        /// <param name="attributes">Initial attributes to store in the collection.</param>
+        public SpanAttributes(IEnumerable<KeyValuePair<string, object>> attributes)
+        {
+            if (attributes == null)
+            {
+                throw new ArgumentNullException(nameof(attributes));
+            }
+
+            foreach (KeyValuePair<string, object> kvp in attributes)
+            {
+                this.AddInternal(kvp.Key, kvp.Value);
+            }
+        }
+
         internal ActivityTagsCollection Attributes { get; }

         /// <summary>
@@ -41,7 +59,7 @@
         /// <param name="value">Entry value.</param>
         public void Add(string key, long value)
         {
-            this.PrivateAdd(key, value);
+            this.AddInternal(key, value);
         }

         /// <summary>
@@ -51,7 +69,7 @@
         /// <param name="value">Entry value.</param>
         public void Add(string key, string value)
         {
-            this.PrivateAdd(key, value);
+            this.AddInternal(key, value);
         }

         /// <summary>
@@ -61,7 +79,7 @@
         /// <param name="value">Entry value.</param>
         public void Add(string key, bool value)
         {
-            this.PrivateAdd(key, value);
+            this.AddInternal(key, value);
         }

         /// <summary>
@@ -71,7 +89,7 @@
         /// <param name="value">Entry value.</param>
         public void Add(string key, double value)
         {
-            this.PrivateAdd(key, value);
+            this.AddInternal(key, value);
         }

         /// <summary>
@@ -81,7 +99,7 @@
         /// <param name="values">Entry value.</param>
         public void Add(string key, long[] values)
         {
-            this.PrivateAdd(key, values);
+            this.AddInternal(key, values);
         }

         /// <summary>
@@ -91,7 +109,7 @@
         /// <param name="values">Entry value.</param>
         public void Add(string key, string[] values)
         {
-            this.PrivateAdd(key, values);
+            this.AddInternal(key, values);
         }

         /// <summary>
@@ -101,7 +119,7 @@
         /// <param name="values">Entry value.</param>
         public void Add(string key, bool[] values)
         {
-            this.PrivateAdd(key, values);
+            this.AddInternal(key, values);
         }

         /// <summary>
@@ -111,10 +129,10 @@
         /// <param name="values">Entry value.</param>
         public void Add(string key, double[] values)
         {
-            this.PrivateAdd(key, values);
+            this.AddInternal(key, values);
         }

-        private void PrivateAdd(string key, object value)
+        private void AddInternal(string key, object value)
         {
             if (key == null)
             {


New clientlib ver

New clientlib ver

--- KalturaClient/KalturaClient.cs
+++ KalturaClient/KalturaClient.cs
@@ -34,7 +34,7 @@
 		public KalturaClient(KalturaConfiguration config) : base(config)
 		{
 				ApiVersion = "3.3.0";
-				ClientTag = "dotnet:15-11-08";
+				ClientTag = "dotnet:15-11-09";
 		}

 		KalturaAccessControlProfileService _AccessControlProfileService;


#18339: Isolating shells creation

#18339: Isolating shells creation

Work Item: 18339

--HG--
branch : 1.x

--- src/Orchard/Environment/DefaultOrchardHost.cs
+++ src/Orchard/Environment/DefaultOrchardHost.cs
@@ -1,3 +1,4 @@
+using System;
 using System.Linq;
 using System.Collections.Generic;

@@ -129,8 +130,13 @@
             // load all tenants, and activate their shell
             if (allSettings.Any()) {
                 foreach (var settings in allSettings) {
-                    var context = CreateShellContext(settings);
-                    ActivateShell(context);
+                    try {
+                        var context = CreateShellContext(settings);
+                        ActivateShell(context);
+                    }
+                    catch(Exception e) {
+                        Logger.Error(e, "A tenant could not be started: " + settings.Name);
+                    }
                 }
             }
             // no settings, run the Setup


Port upstream IOQueue lock free implementation (#7449)

--- src/Orleans.Core/Networking/Shared/IOQueue.cs
+++ src/Orleans.Core/Networking/Shared/IOQueue.cs
@@ -7,10 +7,8 @@
 {
     internal sealed class IOQueue : PipeScheduler,  IThreadPoolWorkItem
     {
-        private readonly object _workSync = new object();
         private readonly ConcurrentQueue<Work> _workItems = new();
-
-        private bool _doingWork;
+        private int _doingWork;

         public override void Schedule(Action<object> action, object state)
         {
@@ -18,13 +16,11 @@

             _workItems.Enqueue(work);

-            lock (_workSync)
+            // Set working if it wasn't (via atomic Interlocked).
+            if (Interlocked.CompareExchange(ref _doingWork, 1, 0) == 0)
             {
-                if (!_doingWork)
-                {
-                    System.Threading.ThreadPool.UnsafeQueueUserWorkItem(this, preferLocal: false);
-                    _doingWork = true;
-                }
+                // Wasn't working, schedule.
+                _ = System.Threading.ThreadPool.UnsafeQueueUserWorkItem(this, preferLocal: false);
             }
         }

@@ -37,14 +33,31 @@
                     item.Callback(item.State);
                 }

-                lock (_workSync)
+                // All work done.
+
+                // Set _doingWork (0 == false) prior to checking IsEmpty to catch any missed work in interim.
+                // This doesn't need to be volatile due to the following barrier (i.e. it is volatile).
+                _doingWork = 0;
+
+                // Ensure _doingWork is written before IsEmpty is read.
+                // As they are two different memory locations, we insert a barrier to guarantee ordering.
+                Thread.MemoryBarrier();
+
+                // Check if there is work to do
+                if (_workItems.IsEmpty)
                 {
-                    if (_workItems.IsEmpty)
-                    {
-                        _doingWork = false;
-                        return;
-                    }
+                    // Nothing to do, exit.
+                    break;
                 }
+
+                // Is work, can we set it as active again (via atomic Interlocked), prior to scheduling?
+                if (Interlocked.Exchange(ref _doingWork, 1) == 1)
+                {
+                    // Execute has been rescheduled already, exit.
+                    break;
+                }
+
+                // Is work, wasn't already scheduled so continue loop.
             }
         }


Fixed JsonSupport buffering of request body.

--- Kayak/Framework/JsonSupport.cs
+++ Kayak/Framework/JsonSupport.cs
@@ -94,14 +94,16 @@
             int bytesRead = 0;
             byte[] buffer = new byte[1024];

+            int contentLength = context.Request.Headers.GetContentLength();
+
             while (true)
             {
                 yield return context.Request.Body.ReadAsync(buffer, 0, buffer.Length).Do(n => bytesRead = n);

-                if (bytesRead == 0)
+                stream.Write(buffer, 0, bytesRead);
+
+                if (stream.Length == contentLength)
                     break;
-
-                stream.Write(buffer, 0, bytesRead);
             }

             buffer = null;


Added ammounts for payment method

Added ammounts for payment method

--- Mollie.Api/Models/PaymentMethod/PaymentMethodResponse.cs
+++ Mollie.Api/Models/PaymentMethod/PaymentMethodResponse.cs
@@ -19,6 +19,16 @@
         /// The full name of the payment method.
         /// </summary>
         public string Description { get; set; }
+
+        /// <summary>
+        /// Minimum payment amount required to use this payment method.
+        /// </summary>
+        public Amount MinimumAmount { get; set; }
+
+        /// <summary>
+        /// Maximum payment amount allowed when using this payment method. (Could be null)
+        /// </summary>
+        public Amount MaximumAmount { get; set; }

         /// <summary>
         /// URLs of images representing the payment method.


default 0 instead of null for int

default 0 instead of null for int

--- Antlr4.Runtime/Lexer.cs
+++ Antlr4.Runtime/Lexer.cs
@@ -515,7 +515,7 @@
             string text = _input.GetText(Interval.Of(_tokenStartCharIndex, _input.Index));
             string msg = "token recognition error at: '" + GetErrorDisplay(text) + "'";
             IAntlrErrorListener<int> listener = GetErrorListenerDispatch();
-            listener.SyntaxError(this, null, _tokenStartLine, _tokenStartCharPositionInLine,
+            listener.SyntaxError(this, 0, _tokenStartLine, _tokenStartCharPositionInLine,
                 msg, e);
         }


Minor style fixes

Minor style fixes

--- IceBuilder/DocumentEventHandler.cs
+++ IceBuilder/DocumentEventHandler.cs
@@ -84,17 +84,17 @@
                 if(fFirstShow != 0)
                 {
                     IVsProject project = null;
-                    uint item = 0;
+                    uint itemref = 0;
                     string path = null;
-                    GetDocumentInfo(docCookie, ref project, ref item, ref path);
+                    GetDocumentInfo(docCookie, ref project, ref itemref, ref path);
                     if(project != null && !string.IsNullOrEmpty(path))
                     {
                         if(project.IsIceBuilderGeneratedItem(path))
                         {
-                            ProjectItem i = ProjectUtil.GetProjectItem(project, item);
-                            if(i != null)
-                            {
-                                i.Document.ReadOnly = true;
+                            ProjectItem item = ProjectUtil.GetProjectItem(project, itemref);
+                            if(item != null)
+                            {
+                                item.Document.ReadOnly = true;
                             }
                         }
                     }


Correct IPv6 send event in PossibleExfiltration example.

--- hiddentreasure-etw-demo/PossibleExfiltration.cs
+++ hiddentreasure-etw-demo/PossibleExfiltration.cs
@@ -17,7 +17,7 @@
         {
             var filter = new EventFilter(
                 Filter.EventIdIs(10) // IPv4 send
-                .Or(Filter.EventIdIs(58))); // IPv6 send
+                .Or(Filter.EventIdIs(26))); // IPv6 send

             filter.OnEvent += (IEventRecord r) => {
                 var daddr = r.GetIPAddress("daddr"); // destination


Vector Util

Vector Util

--- VectorUtil.cs
+++ VectorUtil.cs
@@ -32,23 +32,26 @@

         public static float StandardDeviation(this IEnumerable<float> vector)
         {
+            float mean;
+            return vector.StandardDeviation(out mean);
+        }
+
+        public static float StandardDeviation(this IEnumerable<float> vector, out float mean)
+        {
             float xi2 = 0;
             float xi = 0;
             int count = 0;
-            float mean = 0;

             foreach (float val in vector)
             {
                 count++;
-                mean += val;
-
                 xi += val;
                 xi2 += val * val;
             }

-            mean /= count;
+            mean = xi / count;

-            return (float)Math.Sqrt(mean + (xi2 - 2 * mean * xi) / count);
+            return (float)Math.Sqrt(xi2 / count - mean * mean);
         }


Added support for parsing http port.

Added support for parsing http port.

--- NtApiDotNet/Win32/Rpc/EndpointMapper/RpcProtocolTower.cs
+++ NtApiDotNet/Win32/Rpc/EndpointMapper/RpcProtocolTower.cs
@@ -207,6 +207,7 @@
             {
                 case RpcProtocolSequenceIdentifier.Tcp:
                 case RpcProtocolSequenceIdentifier.Udp:
+                case RpcProtocolSequenceIdentifier.Http:
                     return BitConverter.ToUInt16(endpoint, 0).SwapEndian().ToString();
                 default:
                     return BinaryEncoding.Instance.GetString(endpoint).TrimEnd('\0');


Other null checks

Other null checks

--- Purchasing.Mvc/Views/Report/ProcessingTimeSummary.cshtml
+++ Purchasing.Mvc/Views/Report/ProcessingTimeSummary.cshtml
@@ -176,7 +176,7 @@
             },
             credits: {enabled: false},
             subtitle: {
-                text: 'Average total time to completion: @TimeSpan.FromMinutes(Model.Columns.AverageTimeToCompletion.Value).ToString("dd'd:'hh'h:'mm'm'")'
+                text: 'Average total time to completion: @(Model.Columns.AverageTimeToCompletion.HasValue ? TimeSpan.FromMinutes(Model.Columns.AverageTimeToCompletion.Value).ToString("dd'd:'hh'h:'mm'm'") : string.Empty)'
             },
             title: {
                 text: 'Average Time to Task Completion By Role'
@@ -195,9 +195,9 @@
                 type: 'pie',
                 name: '',
                 data: [
-                    ['Avg Approve', @Model.Columns.AverageTimeToApprover.Value ],
-                    ['Avg Account Manager', @Model.Columns.AverageTimeToAccountManagers.Value ],
-                    ['Avg Purchase', @Model.Columns.AverageTimeToPurchaser.Value ]
+                    ['Avg Approve', @(Model.Columns != null && Model.Columns.AverageTimeToApprover.HasValue ? Model.Columns.AverageTimeToApprover.Value : 0)],
+                    ['Avg Account Manager', @(Model.Columns.AverageTimeToAccountManagers.HasValue ? Model.Columns.AverageTimeToAccountManagers.Value : 0) ],
+                    ['Avg Purchase', @(Model.Columns.AverageTimeToPurchaser.HasValue ? Model.Columns.AverageTimeToPurchaser.Value : 0)]
                 ]
             }]
         });


fix https://github.com/peachpiecompiler/peachpie/commit/af3c9d593734b37ad4898469f81b985721f56f8d

--- src/Peachpie.Runtime/Dynamic/BinderHelpers.cs
+++ src/Peachpie.Runtime/Dynamic/BinderHelpers.cs
@@ -927,7 +927,7 @@
                         BindMagicMethod(type, classCtx, target, ctx, TypeMethods.MagicMethods.__get, field, null);

                     // Template: TryGetField(result) ? isset(result) : (bool)(__isset(key)??NULL)
-                    result = Expression.IfThenElse(
+                    result = Expression.Condition(
                             trygetfield,
                             Expression.Call(Cache.Operators.IsSet_PhpValue, resultvar),
                             ConvertExpression.BindToBool(InvokeHandler(ctx, target, field, __isset, access)));


Null check in swap object

Null check in swap object

--- src/Qwack.Core/Instruments/Asset/AsianSwap.cs
+++ src/Qwack.Core/Instruments/Asset/AsianSwap.cs
@@ -171,8 +171,8 @@
                     AverageStartDate = AverageStartDate,
                     AverageEndDate = AverageEndDate,
                     FixingDates = (DateTime[])FixingDates.Clone(),
-                    FixingCalendar = FixingCalendar.Name,
-                    PaymentCalendar = PaymentCalendar.Name,
+                    FixingCalendar = FixingCalendar?.Name,
+                    PaymentCalendar = PaymentCalendar?.Name,
                     SpotLag = SpotLag.ToString(),
                     SpotLagRollType = SpotLagRollType,
                     PaymentLag = PaymentLag.ToString(),


Fixes #21

Fixes #21

--- src/RoslynPad.Common/Editor/CodeTextEditor.cs
+++ src/RoslynPad.Common/Editor/CodeTextEditor.cs
@@ -9,6 +9,7 @@
 using ICSharpCode.AvalonEdit;
 using ICSharpCode.AvalonEdit.CodeCompletion;
 using ICSharpCode.AvalonEdit.Document;
+using ICSharpCode.AvalonEdit.Editing;
 using ICSharpCode.AvalonEdit.Highlighting;
 using ICSharpCode.AvalonEdit.Search;

@@ -18,7 +19,7 @@

     public class CodeTextEditor : TextEditor
     {
-        private CompletionWindow _completionWindow;
+        private CustomCompletionWindow _completionWindow;
         private OverloadInsightWindow _insightWindow;

         public CodeTextEditor()
@@ -242,7 +243,7 @@
                 _insightWindow?.Close();

                 // Open code completion after the user has pressed dot:
-                _completionWindow = new CompletionWindow(TextArea)
+                _completionWindow = new CustomCompletionWindow(TextArea)
                 {
                     MinWidth = 200,
                     Background = CompletionBackground,
@@ -299,5 +300,18 @@
         }

         #endregion
+
+        private class CustomCompletionWindow : CompletionWindow
+        {
+            public CustomCompletionWindow(TextArea textArea) : base(textArea)
+            {
+            }
+
+            protected override void OnKeyDown(KeyEventArgs e)
+            {
+                if (e.Key == Key.Home || e.Key == Key.End) return;
+                base.OnKeyDown(e);
+            }
+        }
     }
 }


default value binder fix

default value binder fix

--- src/Runtime/pchpcor/Dynamic/OverloadBinder.cs
+++ src/Runtime/pchpcor/Dynamic/OverloadBinder.cs
@@ -373,7 +373,7 @@

                         value.TrueInitializer = Expression.ArrayIndex(_argsarray, Expression.Constant(srcarg));
                         value.FalseInitializer = ConvertExpression.BindDefault(value.TrueInitializer.Type); // ~ default(_argsarray.Type.GetElementType())
-                        value.Expression = Expression.Variable(value.TrueInitializer.Type);
+                        value.Expression = Expression.Variable(value.TrueInitializer.Type, "arg_" + srcarg);

                         //
                         _tmpvars[key] = value;
@@ -397,10 +397,10 @@

                                 value2.TrueInitializer = ConvertExpression.Bind(value.Expression, targetparam.ParameterType);   // reuse the value already obtained from argv
                                 value2.FalseInitializer = ConvertExpression.Bind(defaultValueExpr, value2.TrueInitializer.Type); // ~ default(targetparam)
-                                value2.Expression = Expression.Variable(value2.TrueInitializer.Type);
+                                value2.Expression = Expression.Variable(value2.TrueInitializer.Type, "arg_" + srcarg + "_" + defaultValueStr);

                                 //
-                                _tmpvars[key] = value;
+                                _tmpvars[key2] = value2;
                             }

                             return value2.Expression;   // already converted to targetparam.ParameterType


Fixed when the music should play in the background

--- BattleShip/View/Menu.cs
+++ BattleShip/View/Menu.cs
@@ -21,24 +21,31 @@
         }
         private void btnNewGame_Click(object sender, EventArgs e)
         {
+            sound.Stop();
             Game game = new Game();
             this.Hide();
             if (game.ShowDialog() == DialogResult.Cancel) {
                 this.Show();
+                sound.Play();
             }
+
         }

         private void btnControls_Click(object sender, EventArgs e)
         {
+          sound.Stop();
             Controls controls = new Controls();
             this.Hide();
             if (controls.ShowDialog() == DialogResult.Cancel) {
                 this.Show();
+                sound.Play();
             }
+
         }

         private void btnExit_Click(object sender, EventArgs e)
         {
+            sound.Stop();
             Application.Exit();
         }


Remove spaces in the inspector

Remove spaces in the inspector

--- APAnimatorComponent/Editor/APAnimatorEditor.cs
+++ APAnimatorComponent/Editor/APAnimatorEditor.cs
@@ -291,12 +291,12 @@
                 DrawGizmoCurveColorPicker();
                 DrawRotationCurveColorPicker();

-                EditorGUILayout.Space();
+                //EditorGUILayout.Space();

                 DrawShortJumpValueField();
                 DrawLongJumpValueField();

-                EditorGUILayout.Space();
+                //EditorGUILayout.Space();

                 DrawSettingsAssetField();
                 DrawSkinSelectionControl();


Fixed scrolling to the active move.

Fixed scrolling to the active move.


Added Input to Main

Added Input to Main


Fix for applying ContentConverter updates.

--- Libraries/Http/HttpHandlers.cs
+++ Libraries/Http/HttpHandlers.cs
@@ -307,7 +307,7 @@
                 var stream = await response.Content.ReadAsStreamAsync();
                 response.Content = new HttpValueContent<TValue>(
                     response.Content,
-                    Converter.Invoke(stream)
+                    Converter.Convert(stream)
                 );
             }
             return response;


Comment out the else as recommended by Ubit.

--- OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -2041,7 +2041,7 @@
                     //if (this.m_newStyleMovement && direc != Vector3.Zero)//  let avas be stopped !!
                     if (direc == Vector3.Zero)
                         PhysicsActor.Velocity = Vector3.Zero;
-                    else
+                    //else
                         PhysicsActor.SetMovementForce(direc);
                 }
                 IAgentUpdateMonitor reporter = (IAgentUpdateMonitor)m_scene.RequestModuleInterface<IMonitorModule>().GetMonitor(m_scene.RegionInfo.RegionID.ToString(), "Agent Update Count");


discard var

discard var

--- src/Avalonia.Input/FocusManager.cs
+++ src/Avalonia.Input/FocusManager.cs
@@ -166,7 +166,7 @@
         {
             scope = scope ?? throw new ArgumentNullException(nameof(scope));

-            if (_focusScopes.TryGetValue(scope, out var e))
+            if (_focusScopes.TryGetValue(scope, out _))
             {
                 SetFocusedElement(scope, null);
                 _focusScopes.Remove(scope);


Fix usage of AddClassHandler in non-static ctor.

Property `AddClassHandler`s should only be added in static constructors. In this case it's not so important because `FocusManager` is a singleton, but best to fix the usage anyway.

Fixes #2315.

--- src/Avalonia.Input/FocusManager.cs
+++ src/Avalonia.Input/FocusManager.cs
@@ -23,7 +23,7 @@
         /// <summary>
         /// Initializes a new instance of the <see cref="FocusManager"/> class.
         /// </summary>
-        public FocusManager()
+        static FocusManager()
         {
             InputElement.PointerPressedEvent.AddClassHandler(
                 typeof(IInputElement),
@@ -174,7 +174,7 @@
         /// </summary>
         /// <param name="sender">The event sender.</param>
         /// <param name="e">The event args.</param>
-        private void OnPreviewPointerPressed(object sender, RoutedEventArgs e)
+        private static void OnPreviewPointerPressed(object sender, RoutedEventArgs e)
         {
             var ev = (PointerPressedEventArgs)e;

@@ -191,7 +191,7 @@

                 if (element != null)
                 {
-                    Focus(element, NavigationMethod.Pointer, ev.InputModifiers);
+                    Instance?.Focus(element, NavigationMethod.Pointer, ev.InputModifiers);
                 }
             }
         }


[X11] Abort GLX context creation if GL_VERSION is null

--- src/Avalonia.X11/Glx/GlxDisplay.cs
+++ src/Avalonia.X11/Glx/GlxDisplay.cs
@@ -80,6 +80,8 @@
             ImmediateContext.MakeCurrent();

             GlInterface = GlInterface.FromNativeUtf8GetProcAddress(p => GlxGetProcAddress(p));
+            if (GlInterface.Version == null)
+                throw new OpenGlException("GL version string is null, aborting");
         }

         public void ClearContext() => GlxMakeCurrent(_x11.Display, IntPtr.Zero, IntPtr.Zero);


Remove unnecessary ShouldUpdate check from XNATextBox

--- XNATextBox.cs
+++ XNATextBox.cs
@@ -144,9 +144,6 @@

         protected override void OnUpdateControl(GameTime gameTime)
         {
-            if (!ShouldUpdate())
-                return;
-
             if (DrawAreaWithParentOffset.Contains(CurrentMouseState.Position))
             {
                 Highlighted = true;


* Fixed bad start position clamping in MakeRootAgent()

--- OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -828,41 +828,15 @@
                 pos.Y = crossedBorder.BorderLine.Z - 1;
             }

-
-            if (pos.X < 0 || pos.Y < 0 || pos.Z < 0)
-            {
-                Vector3 emergencyPos = new Vector3(((int)Constants.RegionSize * 0.5f), ((int)Constants.RegionSize * 0.5f), 128);
-
-                if (pos.X < 0)
-                {
-                    emergencyPos.X = (int)Constants.RegionSize + pos.X;
-                    if (!(pos.Y < 0))
-                        emergencyPos.Y = pos.Y;
-                    if (!(pos.Z < 0))
-                        emergencyPos.X = pos.X;
-                }
-                if (pos.Y < 0)
-                {
-                    emergencyPos.Y = (int)Constants.RegionSize + pos.Y;
-                    if (!(pos.X < 0))
-                        emergencyPos.X = pos.X;
-                    if (!(pos.Z < 0))
-                        emergencyPos.Z = pos.Z;
-                }
-                if (pos.Z < 0)
-                {
-                    if (!(pos.X < 0))
-                        emergencyPos.X = pos.X;
-                    if (!(pos.Y < 0))
-                        emergencyPos.Y = pos.Y;
-                    //Leave as 128
-                }
-
+            if (pos.X < 0f || pos.Y < 0f || pos.Z < 0f)
+            {
                 m_log.WarnFormat(
-                    "[SCENE PRESENCE]: MakeRootAgent() was given an illegal position of {0} for avatar {1}, {2}.  Substituting {3}",
-                    pos, Name, UUID, emergencyPos);
-
-                pos = emergencyPos;
+                    "[SCENE PRESENCE]: MakeRootAgent() was given an illegal position of {0} for avatar {1}, {2}. Clamping",
+                    pos, Name, UUID);
+
+                if (pos.X < 0f) pos.X = 0f;
+                if (pos.Y < 0f) pos.Y = 0f;
+                if (pos.Z < 0f) pos.Z = 0f;
             }

             float localAVHeight = 1.56f;
@@ -873,7 +847,7 @@

             float posZLimit = 0;

-            if (pos.X <Constants.RegionSize && pos.Y < Constants.RegionSize)
+            if (pos.X < Constants.RegionSize && pos.Y < Constants.RegionSize)
                 posZLimit = (float)m_scene.Heightmap[(int)pos.X, (int)pos.Y];

             float newPosZ = posZLimit + localAVHeight / 2;


observable visibility

observable visibility

--- PowerArgs/CLI/Games/SpacialElements/Character.cs
+++ PowerArgs/CLI/Games/SpacialElements/Character.cs
@@ -7,7 +7,7 @@

     public class Character : SpacialElement, IObservableObject
     {
-        public bool IsVisible { get; set; } = true;
+        public bool IsVisible { get => observable.Get<bool>(); set => observable.Set(value); }
         public MultiPlayerClient MultiPlayerClient { get; set; }
         public char? Symbol { get; set; }
         public Inventory Inventory { get => observable.Get<Inventory>(); set => observable.Set(value); }
@@ -27,6 +27,7 @@
         public Character()
         {
             observable = new ObservableObject(this);
+            IsVisible = true;
             this.SubscribeForLifetime(nameof(Inventory), () => this.Inventory.Owner = this, this.Lifetime);
             Inventory = new Inventory();
             Speed = new SpeedTracker(this) { Bounciness = 0 };


Fix false page-move detections#2

Fix false page-move detections#2

--- src/BloomExe/Edit/ThumbNailList.cs
+++ src/BloomExe/Edit/ThumbNailList.cs
@@ -263,9 +263,21 @@

 				Debug.WriteLine("Dragging");
 				Cursor = Cursors.Hand;
-				var target = _listView.GetItemAt(e.X, e.Y);
+				ListViewItem  target=null;
+				if (null == _listView.GetItemAt(e.X, e.Y))
+				{
+					target = _listView.GetItemAt(e.X+20, e.Y);
+				}
+				else
+				{
+					target = _listView.GetItemAt(e.X, e.Y);
+				}
+
 				if (target == null)
 				{
+					//when we point right in the middle, we'll get a null target, but we sure want one,
+					//so try looking to one side
+
 					Debug.WriteLine("null target");
 				}
 				else


Fix release stage filtering on cocoa platforms

During delivery, if notify release stages is non-null, then reports are
only sent if release stage is in notify release stages. On cocoa, the
value defaults to nil, but was parsed into an empty array, so no reports
could ever be sent.

--- src/BugsnagUnity/IConfiguration.cs
+++ src/BugsnagUnity/IConfiguration.cs
@@ -330,6 +330,10 @@
           handle.Free();
         }

+        if (releaseStages.Count == 0)
+        {
+            return null;
+        }
         return releaseStages.ToArray();
       }
       set => SetNotifyReleaseStages(NativeConfiguration, value, value.Length);
@@ -468,6 +472,10 @@
           handle.Free();
         }

+        if (releaseStages.Count == 0)
+        {
+            return null;
+        }
         return releaseStages.ToArray();
       }
       set => SetNotifyReleaseStages(NativeConfiguration, value, value.Length);


Now using opportunistic intern in task registry.

--- src/Build/Instance/TaskRegistry.cs
+++ src/Build/Instance/TaskRegistry.cs
@@ -308,7 +308,7 @@

                 if (assemblyFile != null && !Path.IsPathRooted(assemblyFile))
                 {
-                    assemblyFile = Path.Combine(directoryOfImportingFile, assemblyFile);
+                    assemblyFile = OpportunisticIntern.InternStringIfPossible(Path.Combine(directoryOfImportingFile, assemblyFile));
                 }

                 if (String.Equals(taskFactory, RegisteredTaskRecord.CodeTaskFactory, StringComparison.OrdinalIgnoreCase) || String.Equals(taskFactory, RegisteredTaskRecord.XamlTaskFactory, StringComparison.OrdinalIgnoreCase))


Improved value missing check

Improved value missing check

--- AngleSharp/DOM/Html/Forms/HTMLSelectElement.cs
+++ AngleSharp/DOM/Html/Forms/HTMLSelectElement.cs
@@ -263,7 +263,7 @@
         protected override void Check(ValidityState state)
         {
             var value = Value;
-            state.IsValueMissing = IsRequired && value == null;
+            state.IsValueMissing = IsRequired && String.IsNullOrEmpty(value);
         }

         #endregion


Changed TweetLoader to use INotifyPropertyChanged instead of DanielVaughan's ObservableObject

--- Library/Twitter/TweetLoader.cs
+++ Library/Twitter/TweetLoader.cs
@@ -8,11 +8,13 @@
 using System.Threading;
 using Ocell.Library.Twitter;
 using Ocell.Library.Twitter.Comparers;
-using DanielVaughan.ComponentModel;
+using System.Windows.Controls;
+using System.Windows;
+using System.ComponentModel;

 namespace Ocell.Library.Twitter
 {
-    public class TweetLoader : ObservableObject, IDisposable
+    public class TweetLoader : INotifyPropertyChanged, IDisposable
     {
         private int _loaded;
         private const int _toLoad = 1;
@@ -26,6 +28,8 @@
         private static DateTime _rateResetTime;
         private ConversationService _conversationService;

+        public event PropertyChangedEventHandler PropertyChanged;
+
         public TwitterResource Resource
         {
             get
@@ -51,7 +55,23 @@
         public bool IsLoading
         {
             get { return _isLoading; }
-            protected set { Assign("IsLoading", ref _isLoading, value); }
+            protected set
+            {
+                if (value == _isLoading)
+                    return;
+                _isLoading = value;
+                var dispatcher = Deployment.Current.Dispatcher;
+                if (dispatcher.CheckAccess())
+                    OnPropertyChanged("IsLoading");
+                else
+                    dispatcher.BeginInvoke(() => OnPropertyChanged("IsLoading"));
+            }
+        }
+
+        protected void OnPropertyChanged(string propName)
+        {
+            if(PropertyChanged != null)
+                PropertyChanged(this, new PropertyChangedEventArgs(propName));
         }

         #region Constructors
@@ -85,7 +105,7 @@

             Error += new OnError(CheckForRateLimit);
         }
-        #endregion
+        #endregion

         #region Cache
         private void SaveToCacheThreaded()
@@ -221,7 +241,7 @@
                     _srv.ListTweetsOnHomeTimelineBefore(last, TweetsToLoadPerRequest, ReceiveTweets);
                     break;
                 case ResourceType.Mentions:
-                    _srv.ListTweetsMentioningMeBefore(last, TweetsToLoadPerRequest,  ReceiveTweets);
+                    _srv.ListTweetsMentioningMeBefore(last, TweetsToLoadPerRequest, ReceiveTweets);
                     if (LoadRetweetsAsMentions)
                     {
                         _requestsInProgress++;
@@ -329,7 +349,7 @@
             if (list.Any())
                 LastId = list.Min(item => item.Id);

-
+
             if (LoadFinished != null && _resource.Type != ResourceType.Conversation)
                 LoadFinished(this, new EventArgs());
             else if (PartialLoad != null && _resource.Type == ResourceType.Conversation)
@@ -401,7 +421,7 @@
             if (LoadFinished != null)
                 LoadFinished(this, e);
         }
-
+
         #region Events
         public event EventHandler LoadFinished;


forgot one :)

forgot one :)

--- src/Umbraco.Tests/UmbracoExamine/IndexTest.cs
+++ src/Umbraco.Tests/UmbracoExamine/IndexTest.cs
@@ -19,7 +19,7 @@
     /// <summary>
     /// Tests the standard indexing capabilities
     /// </summary>
-    //[DatabaseTestBehavior(DatabaseBehavior.NewDbFileAndSchemaPerTest)]
+    [DatabaseTestBehavior(DatabaseBehavior.NewDbFileAndSchemaPerTest)]
     [TestFixture, RequiresSTA]
     public class IndexTest : ExamineBaseTest
 	{


Catch/Finally implemented

Catch/Finally implemented

--- src/UnityFx.Async/Api/Core/AsyncExtensions.cs
+++ src/UnityFx.Async/Api/Core/AsyncExtensions.cs
@@ -336,10 +336,11 @@
 		#region Then

 		/// <summary>
-		/// Adds a completion callback to be executed after the operation has succeeded.
+		/// Schedules a callback to be executed after the operation has succeeded.
 		/// </summary>
 		/// <param name="op">The target operation.</param>
 		/// <param name="successCallback">The callback to be executed when the operation has completed.</param>
+		/// <returns>TODO</returns>
 		/// <seealso href="https://promisesaplus.com/"/>
 		public static IAsyncOperation Then(this IAsyncOperation op, Action successCallback)
 		{
@@ -380,7 +381,52 @@
 		}

 		/// <summary>
-		/// Adds a completion callback to be executed after the operation has succeeded.
+		/// Schedules a callback to be executed after the operation has succeeded.
+		/// </summary>
+		/// <param name="op">The target operation.</param>
+		/// <param name="successCallback">The callback to be executed when the operation has completed.</param>
+		/// <returns>TODO</returns>
+		/// <seealso href="https://promisesaplus.com/"/>
+		public static IAsyncOperation Then<T>(this IAsyncOperation<T> op, Action<T> successCallback)
+		{
+			if (successCallback == null)
+			{
+				throw new ArgumentNullException(nameof(successCallback));
+			}
+
+			var result = new AsyncCompletionSource(AsyncOperationStatus.Running);
+
+			op.AddCompletionCallback(
+				asyncOp =>
+				{
+					try
+					{
+						if (asyncOp.IsCompletedSuccessfully)
+						{
+							successCallback((asyncOp as IAsyncOperation<T>).Result);
+							result.TrySetCompleted();
+						}
+						else if (asyncOp.IsFaulted)
+						{
+							result.TrySetException(asyncOp.Exception);
+						}
+						else
+						{
+							result.TrySetCanceled();
+						}
+					}
+					catch (Exception e)
+					{
+						result.TrySetException(e);
+					}
+				},
+				AsyncContinuationOptions.CaptureSynchronizationContext);
+
+			return result;
+		}
+
+		/// <summary>
+		/// Schedules a callback to be executed after the operation has succeeded.
 		/// </summary>
 		/// <param name="op">The target operation.</param>
 		/// <param name="successCallback">The callback to be executed when the operation has completed.</param>
@@ -401,7 +447,9 @@
 					{
 						if (asyncOp.IsCompletedSuccessfully)
 						{
-							successCallback().AddCompletionCallback(asyncOp2 => result.CopyCompletionState(asyncOp2, false), AsyncContinuationOptions.None);
+							successCallback().AddCompletionCallback(
+								asyncOp2 => result.CopyCompletionState(asyncOp2, false),
+								AsyncContinuationOptions.None);
 						}
 						else if (asyncOp.IsFaulted)
 						{
@@ -423,7 +471,52 @@
 		}

 		/// <summary>
-		/// Adds a completion callback to be executed after the operation has succeeded.
+		/// Schedules a callback to be executed after the operation has succeeded.
+		/// </summary>
+		/// <param name="op">The target operation.</param>
+		/// <param name="successCallback">The callback to be executed when the operation has completed.</param>
+		/// <seealso href="https://promisesaplus.com/"/>
+		public static IAsyncOperation Then<T>(this IAsyncOperation<T> op, Func<T, IAsyncOperation> successCallback)
+		{
+			if (successCallback == null)
+			{
+				throw new ArgumentNullException(nameof(successCallback));
+			}
+
+			var result = new AsyncCompletionSource(AsyncOperationStatus.Running);
+
+			op.AddCompletionCallback(
+				asyncOp =>
+				{
+					try
+					{
+						if (asyncOp.IsCompletedSuccessfully)
+						{
+							successCallback((asyncOp as IAsyncOperation<T>).Result).AddCompletionCallback(
+								asyncOp2 => result.CopyCompletionState(asyncOp2, false),
+								AsyncContinuationOptions.None);
+						}
+						else if (asyncOp.IsFaulted)
+						{
+							result.TrySetException(asyncOp.Exception);
+						}
+						else
+						{
+							result.TrySetCanceled();
+						}
+					}
+					catch (Exception e)
+					{
+						result.TrySetException(e);
+					}
+				},
+				AsyncContinuationOptions.CaptureSynchronizationContext);
+
+			return result;
+		}
+
+		/// <summary>
+		/// Schedules a callbacks to be executed after the operation has completed.
 		/// </summary>
 		/// <param name="op">The target operation.</param>
 		/// <param name="successCallback">The callback to be executed when the operation has succeeded.</param>
@@ -466,7 +559,58 @@
 					}
 					catch (Exception e)
 					{
-						errorCallback(e);
+						result.TrySetException(e);
+					}
+				},
+				AsyncContinuationOptions.CaptureSynchronizationContext);
+
+			return result;
+		}
+
+		/// <summary>
+		/// Schedules a callbacks to be executed after the operation has completed.
+		/// </summary>
+		/// <param name="op">The target operation.</param>
+		/// <param name="successCallback">The callback to be executed when the operation has succeeded.</param>
+		/// <param name="errorCallback">The callback to be executed when the operation has faulted/was canceled.</param>
+		/// <seealso href="https://promisesaplus.com/"/>
+		public static IAsyncOperation Then<T>(this IAsyncOperation<T> op, Action<T> successCallback, Action<Exception> errorCallback)
+		{
+			if (successCallback == null)
+			{
+				throw new ArgumentNullException(nameof(successCallback));
+			}
+
+			if (errorCallback == null)
+			{
+				throw new ArgumentNullException(nameof(errorCallback));
+			}
+
+			var result = new AsyncCompletionSource(AsyncOperationStatus.Running);
+
+			op.AddCompletionCallback(
+				asyncOp =>
+				{
+					try
+					{
+						if (asyncOp.IsCompletedSuccessfully)
+						{
+							successCallback((asyncOp as IAsyncOperation<T>).Result);
+							result.TrySetCompleted();
+						}
+						else if (asyncOp.IsFaulted)
+						{
+							errorCallback(asyncOp.Exception.InnerException);
+							result.TrySetException(asyncOp.Exception);
+						}
+						else
+						{
+							errorCallback(new OperationCanceledException());
+							result.TrySetCanceled();
+						}
+					}
+					catch (Exception e)
+					{
 						result.TrySetException(e);
 					}
 				},
@@ -514,7 +658,36 @@
 				throw new ArgumentNullException(nameof(errorCallback));
 			}

-			throw new NotImplementedException();
+			var result = new AsyncCompletionSource(AsyncOperationStatus.Running);
+
+			op.AddCompletionCallback(
+				asyncOp =>
+				{
+					try
+					{
+						if (asyncOp.IsCompletedSuccessfully)
+						{
+							result.TrySetCompleted();
+						}
+						else if (asyncOp.IsFaulted)
+						{
+							errorCallback(asyncOp.Exception.InnerException);
+							result.TrySetCompleted();
+						}
+						else
+						{
+							errorCallback(new OperationCanceledException());
+							result.TrySetCompleted();
+						}
+					}
+					catch (Exception e)
+					{
+						result.TrySetException(e);
+					}
+				},
+				AsyncContinuationOptions.CaptureSynchronizationContext);
+
+			return result;
 		}

 		#endregion
@@ -534,7 +707,36 @@
 				throw new ArgumentNullException(nameof(action));
 			}

-			throw new NotImplementedException();
+			var result = new AsyncCompletionSource(AsyncOperationStatus.Running);
+
+			op.AddCompletionCallback(
+				asyncOp =>
+				{
+					try
+					{
+						action();
+
+						if (asyncOp.IsCompletedSuccessfully)
+						{
+							result.TrySetCompleted();
+						}
+						else if (asyncOp.IsFaulted)
+						{
+							result.TrySetCompleted();
+						}
+						else
+						{
+							result.TrySetCompleted();
+						}
+					}
+					catch (Exception e)
+					{
+						result.TrySetException(e);
+					}
+				},
+				AsyncContinuationOptions.CaptureSynchronizationContext);
+
+			return result;
 		}

 		#endregion


Simplified test

Simplified test

--- src/UsefulDataToolsTests/IsSimpleTypeTests.cs
+++ src/UsefulDataToolsTests/IsSimpleTypeTests.cs
@@ -8,85 +8,6 @@
     [TestClass]
     public class IsSimpleTypeTests
     {
-        private TestDemoClass _testDemoClass;
-        private DateTime _today;
-        private DateTime _utc;
-
-        [TestInitialize]
-        public void Initialize()
-        {
-            _today = DateTime.Today;
-            _utc = DateTime.UtcNow;
-
-            _testDemoClass = new TestDemoClass
-                             {
-                                 BooleanProperty = false,
-                                 ByteProperty = 0,
-                                 CharacterProperty = 'A',
-                                 DateTimeProperty = _utc,
-                                 DecimalProperty = 0M,
-                                 DoubleProperty = 0,
-                                 FloatProperty = 0,
-                                 IntProperty = 0,
-                                 LongProperty = 0,
-                                 NullableBooleanProperty = true,
-                                 NullableByteProperty = 1,
-                                 NullableCharacterProperty = 'a',
-                                 NullableDateTimeProperty = _today,
-                                 NullableDecimalProperty = 1M,
-                                 NullableDoubleProperty = 1,
-                                 NullableFloatProperty = 1,
-                                 NullableIntProperty = 1,
-                                 NullableLongProperty = 1,
-                                 NullableSByteProperty = 1,
-                                 NullableShortProperty = 1,
-                                 NullableUIntProperty = 1,
-                                 NullableULongProperty = 1,
-                                 NullableUShortProperty = 1,
-                                 NullableTestDemoEnumProperty = TestDemoEnum.Value2,
-                                 SByteProperty = 0,
-                                 ShortProperty = 0,
-                                 StringProperty = "Bar Foo",
-                                 UIntProperty = 0,
-                                 ULongProperty = 0,
-                                 UShortProperty = 0,
-                                 TestDemoClassProperty = new TestDemoClass(),
-                                 TestDemoEnumProperty = TestDemoEnum.Value1,
-                                 BooleanField = true,
-                                 ByteField = 1,
-                                 CharacterField = 'a',
-                                 DateTimeField = _today,
-                                 DecimalField = 1M,
-                                 DoubleField = 1,
-                                 FloatField = 0,
-                                 IntField = 1,
-                                 LongField = 1,
-                                 NullableBooleanField = false,
-                                 NullableByteField = 0,
-                                 NullableCharacterField = 'A',
-                                 NullableDateTimeField = _utc,
-                                 NullableDecimalField = 0M,
-                                 NullableDoubleField = 0,
-                                 NullableFloatField = 0,
-                                 NullableIntField = 0,
-                                 NullableLongField = 0,
-                                 NullableSByteField = 0,
-                                 NullableShortField = 0,
-                                 NullableUIntField = 0,
-                                 NullableULongField = 0,
-                                 NullableUShortField = 0,
-                                 NullableTestDemoEnumField = TestDemoEnum.Value2,
-                                 SByteField = 1,
-                                 ShortField = 1,
-                                 StringField = "Foo Bar",
-                                 UIntField = 1,
-                                 ULongField = 1,
-                                 UShortField = 1,
-                                 TestDemoClassField = new TestDemoClass(),
-                                 TestDemoEnumField = TestDemoEnum.Value1
-                             };
-        }
-
         [TestMethod]
         public void NonNullableSimpleFieldsTest()
         {


remove count assert

remove count assert

--- CatelFody/CatelTests.cs
+++ CatelFody/CatelTests.cs
@@ -355,7 +355,6 @@
         var type = assembly.GetType("ClassWithCompilerGeneratedClasses");
         var instance = (dynamic)Activator.CreateInstance(type);
         instance.AsyncMethod();
-        Assert.AreEqual(1, Debugs.Count);
         Assert.IsTrue(Debugs.First().StartsWith("[ClassWithCompilerGeneratedClasses] Method: 'Void AsyncMethod()'. Line: ~"));
     }


A change missed from previous push.

A change missed from previous push.

--- Rhino.ServiceBus/Impl/AbstractRhinoServiceBusFacility.cs
+++ Rhino.ServiceBus/Impl/AbstractRhinoServiceBusFacility.cs
@@ -23,7 +23,7 @@
         protected readonly List<Type> messageModules = new List<Type>();
         private Type serializerImpl = typeof(XmlMessageSerializer);
         protected IsolationLevel queueIsolationLevel = IsolationLevel.Serializable;
-        public bool consumeInTransaction = true;
+        public bool consumeInTxn = true;

         protected AbstractRhinoServiceBusFacility()
         {
@@ -51,7 +51,7 @@

         public bool ConsumeInTransaction
         {
-            get { return consumeInTransaction; }
+            get { return consumeInTxn; }
         }

         public AbstractRhinoServiceBusFacility AddMessageModule<TModule>()


fix opening file directly after creation

--- Assets/Plugins/Editor/JetBrains/RiderPlugin.cs
+++ Assets/Plugins/Editor/JetBrains/RiderPlugin.cs
@@ -112,6 +112,7 @@
         if (selected.GetType().ToString() == "UnityEditor.MonoScript" ||
             selected.GetType().ToString() == "UnityEngine.Shader")
         {
+          SyncSolution(); // added to handle opening file, which was just recently created.
           var assetFilePath = Path.Combine(appPath, AssetDatabase.GetAssetPath(selected));
           if (!CallUDPRider(line, SlnFile, assetFilePath))
           {


Patient treatment minor fix

Patient treatment minor fix

--- Assets/Scripts/Entities/Switchables/Patient.cs
+++ Assets/Scripts/Entities/Switchables/Patient.cs
@@ -60,7 +60,7 @@

     public override void Switch()
     {
-        if (!treated && !timer.running)
+        if (!treated && !isHeld)
         {
             player.AnimState = PlayerController.PlayerAnimState.Wash;


Added parameter check and documentation for ScpClient.Download(string,Stream).

--- Renci.SshClient/Renci.SshNet/ScpClient.cs
+++ Renci.SshClient/Renci.SshNet/ScpClient.cs
@@ -170,8 +170,17 @@
         /// </summary>
         /// <param name="filename">Remote host file name.</param>
         /// <param name="destination">The stream where to download remote file.</param>
+        /// <exception cref="ArgumentException"><paramref name="filename"/> is null or contains whitespace characters.</exception>
+        /// <exception cref="ArgumentNullException"><paramref name="destination"/> is null.</exception>
+        /// <remarks>Method calls made by this method to <paramref name="destination"/>, may under certain conditions result in exceptions thrown by the stream.</remarks>
         public void Download(string filename, Stream destination)
         {
+            if (filename.IsNullOrWhiteSpace())
+                throw new ArgumentException("filename");
+
+            if (destination == null)
+                throw new ArgumentNullException("destination");
+
             using (var input = new PipeStream())
             using (var channel = this.Session.CreateChannel<ChannelSession>())
             {