change the oritation

change the oritation

--- FlightSimulatorNewForMultiTask/FlightSimulator/Form1.cs
+++ FlightSimulatorNewForMultiTask/FlightSimulator/Form1.cs
@@ -977,7 +977,7 @@
                     arr[temp] = 0;
                 }
             }
-
+
             return newarr;

         }
@@ -1029,7 +1029,7 @@
             this.btnStep3Start.Enabled = false;

             float settingDegree = 0;
-            oritation = 1;
+            oritation = -1;
             vf.SetRandomPoint();
             int TotalCircle = 0;

@@ -1107,7 +1107,18 @@
                         torqueData[expID].Add(troque_trans);
                         positionData[expID].Add(settingDegree);

-
+                        if (lpf3.Count == 400)
+                        {
+                            lpf3.Remove(lpf3[0]);
+                        }
+
+                        if (lpf4.Count == 400)
+                        {
+                            lpf4.Remove(lpf4[0]);
+                        }
+
+                        this.pbPosition.CreateGraphics().DrawImage(dp1.drawSignalCurve(lpf3, lpf4), 0, 0);
+
                         if (count == time * 20)
                         {
                             count = 0;
@@ -1115,7 +1126,7 @@
                             lpf3.Clear();
                             lpf4.Clear();
                             degree = 0;
-                            oritation = 1;
+                            oritation = -1;

                             expIndex++;
@@ -1140,17 +1151,7 @@

                         //this.pictureBox2.CreateGraphics().DrawImage(dp1.drawSignalCurve(lpf3, lpf4), 0, 0);

-                        if (lpf3.Count == 400)
-                        {
-                            lpf3.Remove(lpf3[0]);
-                        }
-
-                        if (lpf4.Count == 400)
-                        {
-                            lpf4.Remove(lpf4[0]);
-                        }
-
-                        this.pbPosition.CreateGraphics().DrawImage(dp1.drawSignalCurve(lpf3, lpf4), 0, 0);
+
                         //imageNow = dp2.drawCommunitivePoint(degree, false,sequenceIndexForExperiment);
                         //this.pbCommunitive.CreateGraphics().DrawImage(imageNow, 0, 0);

@@ -1192,6 +1193,20 @@

                         degree += troque_trans * k * 0.01f;

+                        lpf3.Add(degree);
+                        lpf4.Add(troque_trans);
+
+                        if (lpf3.Count == 400)
+                        {
+                            lpf3.Remove(lpf3[0]);
+                        }
+
+                        if (lpf4.Count == 400)
+                        {
+                            lpf4.Remove(lpf4[0]);
+                        }
+
+
                         this.lblEXPStateP.Text = degree.ToString();
                         this.lblEXPStateTRaw.Text = troque.ToString();
                         this.lblEXPSTateT.Text = troque_trans.ToString();
@@ -1207,11 +1222,11 @@
                         //debug mode
                         //degree += 1;

-
+                        this.pbPosition.CreateGraphics().DrawImage(dp1.drawSignalCurve(lpf3, lpf4), 0, 0);
                         //v.pictureBox1.CreateGraphics().DrawImage(vSti.DrawV_Test(degree), 0, 0);

-
+
                         if (count == 5 * 20)
                         {
                             count = 0;
@@ -1219,7 +1234,7 @@
                             lpf3.Clear();
                             lpf4.Clear();
                             settingDegree = 0;
-                            oritation = 1;
+                            oritation = -1;
                             if (expIndex == 6)
                             {


CSharpSyntaxFactsService.IsQueryKeyword check parent for every keyword to avoid regressions if keywords get used in other context in future language changes.

--- src/Workspaces/CSharp/Portable/LanguageServices/CSharpSyntaxFactsService.cs
+++ src/Workspaces/CSharp/Portable/LanguageServices/CSharpSyntaxFactsService.cs
@@ -322,30 +322,23 @@
             switch (token.Kind())
             {
                 case SyntaxKind.FromKeyword:
-                case SyntaxKind.GroupKeyword:
                 case SyntaxKind.JoinKeyword:
-                case SyntaxKind.IntoKeyword:
                 case SyntaxKind.LetKeyword:
-                case SyntaxKind.ByKeyword:
-                case SyntaxKind.SelectKeyword:
                 case SyntaxKind.OrderByKeyword:
+                case SyntaxKind.WhereKeyword:
                 case SyntaxKind.OnKeyword:
                 case SyntaxKind.EqualsKeyword:
+                case SyntaxKind.InKeyword:
+                    return token.Parent is QueryClauseSyntax;
+                case SyntaxKind.ByKeyword:
+                case SyntaxKind.GroupKeyword:
+                case SyntaxKind.SelectKeyword:
+                    return token.Parent is SelectOrGroupClauseSyntax;
                 case SyntaxKind.AscendingKeyword:
                 case SyntaxKind.DescendingKeyword:
-                    return true;
-                case SyntaxKind.InKeyword:
-                    switch (token.Parent.Kind())
-                    {
-                        case SyntaxKind.FromClause:
-                        case SyntaxKind.JoinClause:
-                        case SyntaxKind.JoinIntoClause:
-                            return true;
-                        default:
-                            return false;
-                    }
-                case SyntaxKind.WhereKeyword:
-                    return token.Parent.Kind() == SyntaxKind.WhereClause; // false for e.g. type parameter constraint
+                    return token.Parent is OrderingSyntax;
+                case SyntaxKind.IntoKeyword:
+                    return token.Parent.IsKind(SyntaxKind.JoinIntoClause, SyntaxKind.QueryContinuation);
                 default:
                     return false;
             }


Removed unwanted commented line of code

Removed unwanted commented line of code

--- Heroes.ReplayParser/MPQFiles/ReplayServerBattlelobby.cs
+++ Heroes.ReplayParser/MPQFiles/ReplayServerBattlelobby.cs
@@ -266,7 +266,6 @@
                     if (i != replay.ClientListByUserID.Length - 1)
                     {
                         // these similar bytes don't occur for last player?
-                        //bitReader.ReadBytes(31);
                         bitReader.ReadBytes(27);
                     }
                 }
@@ -343,4 +342,4 @@
                 throw new Exception("Not 0x00");
         }
     }
-}+}


Update SymbolSearchUpdateEngine.Update.cs

--- src/Workspaces/Core/Desktop/SymbolSearch/SymbolSearchUpdateEngine.Update.cs
+++ src/Workspaces/Core/Desktop/SymbolSearch/SymbolSearchUpdateEngine.Update.cs
@@ -65,7 +65,7 @@
         public Task UpdateContinuouslyAsync(string source, string localSettingsDirectory)
         {
             // Only the first thread to try to update this source should succeed
-            // and cause us to actually being the update loop.
+            // and cause us to actually begin the update loop.
             var ourSentinel = new object();
             var currentSentinel = _sourceToUpdateSentinel.GetOrAdd(source, ourSentinel);

@@ -640,4 +640,4 @@
             }
         }
     }
-}+}


Updated to upstream

Updated to upstream

--- Heroes.ReplayParser/MPQFiles/ReplayServerBattlelobby.cs
+++ Heroes.ReplayParser/MPQFiles/ReplayServerBattlelobby.cs
@@ -275,6 +275,8 @@
                     }
                     else
                     {
+                        bitReader.ReadBytes(12);
+
                         // each byte has a max value of 0x7F (127)
                         if (replay.ReplayBuild >= 48027)
                             bitReader.ReadInt16();
@@ -315,7 +317,6 @@

                     replay.ClientListByUserID[player].BattleTag = int.Parse(battleTag[1]);

-
                     if (replay.ReplayBuild >= 52860 || (replay.ReplayVersionMajor == 2 && replay.ReplayBuild >= 51978))
                         bitReader.ReadInt32(); // player's account level


Fix server stops listening for new clients when client authentication fails

--- Quasar.Server/Networking/Server.cs
+++ Quasar.Server/Networking/Server.cs
@@ -283,7 +283,7 @@
                         case SocketError.ConnectionReset:
                             break;
                         default:
-                            throw new Exception("SocketError");
+                            throw new SocketException((int) e.SocketError);
                     }

                     e.AcceptSocket = null; // enable reuse
@@ -310,9 +310,9 @@
         /// <param name="ar">The status of the asynchronous operation.</param>
         private void EndAuthenticateClient(IAsyncResult ar)
         {
+            var con = (PendingClient)ar.AsyncState;
             try
             {
-                var con = (PendingClient) ar.AsyncState;
                 con.Stream.EndAuthenticateAsServer(ar);

                 // only allow connection which are authenticated on both sides
@@ -330,7 +330,7 @@
             }
             catch (Exception)
             {
-                Disconnect();
+                con.Stream.Close();
             }
         }


Demonstrate resurrection of KSKioskViewController

--- KS_PSPDFKit-Demo-Xamarin.iOS/KSCatalogViewController.cs
+++ KS_PSPDFKit-Demo-Xamarin.iOS/KSCatalogViewController.cs
@@ -20,8 +20,7 @@
 		const string AnnotTestExample = "Annotation Test.pdf";

 		public bool clearCacheNeeded;
-		static KSKioskViewController kioskController;
-
+
 		public KSCatalogViewController () : base (UITableViewStyle.Grouped, null)
 		{
 			PSPDFKitGlobal.LogLevel = PSPDFLogLevel.Info;
@@ -39,7 +38,7 @@
 					new StringElement ("PSPDFViewController playground", () =>
 					{
 						var doc = new PSPDFDocument(hackerMagURL);
-						kioskController = new KSKioskViewController(doc);
+						var kioskController = new KSKioskViewController(doc);

 						kioskController.StatusBarStyleSetting = PSPDFStatusBarStyleSetting.Default;
 						this.NavigationController.PushViewController(kioskController, true);


Add test for proper binding placement

Add test for proper binding placement

--- QueryBuilder.Tests/GeneralTests.cs
+++ QueryBuilder.Tests/GeneralTests.cs
@@ -478,5 +478,28 @@
             Assert.Equal("WITH \"ROWS\" AS (SELECT 1 AS a, 2 AS b, 3 AS c FROM RDB$DATABASE UNION ALL SELECT 4 AS a, 5 AS b, 6 AS c FROM RDB$DATABASE)\nSELECT * FROM \"ROWS\"", c[EngineCodes.Firebird].ToString());
             Assert.Equal("WITH \"rows\" AS (SELECT 1 AS a, 2 AS b, 3 AS c FROM DUAL UNION ALL SELECT 4 AS a, 5 AS b, 6 AS c FROM DUAL)\nSELECT * FROM \"rows\"", c[EngineCodes.Oracle].ToString());
         }
+
+        [Fact]
+        public void AdHoc_ProperBindingsPlacement()
+        {
+            var query = new Query("rows")
+                .With("othercte", q => q.From("othertable").Where("othertable.status", "A"))
+                .Where("rows.foo", "bar")
+                .With("rows",
+                new[] { "a", "b", "c" },
+                new object[][] {
+                    new object[] { 1, 2, 3 },
+                    new object[] { 4, 5, 6 },
+                })
+                .Where("rows.baz", "buzz");
+
+            var c = Compilers.Compile(query);
+
+            Assert.Equal(string.Join("\n", new[] {
+                "WITH [othercte] AS (SELECT * FROM [othertable] WHERE [othertable].[status] = 'A'),",
+                "[rows] AS (SELECT 1 AS a, 2 AS b, 3 AS c UNION ALL SELECT 4 AS a, 5 AS b, 6 AS c)",
+                "SELECT * FROM [rows] WHERE [rows].[foo] = 'bar' AND [rows].[baz] = 'buzz'",
+            }), c[EngineCodes.SqlServer].ToString());
+        }
     }
 }


Removed in Version 2.8.1.0

Removed in Version 2.8.1.0

--- Handlers/MessageHandler.cs
+++ Handlers/MessageHandler.cs
@@ -1,36 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-using Discord.Commands;
-using Discord;
-using Discord.WebSocket;
-
-using DiscordBot;
-using DiscordBot.Common.Preconditions;
-using DiscordBot.Common;
-using DiscordBot.Extensions;
-using DiscordBot.Other;
-using DiscordBot.Logging;
-
-namespace DiscordBot.Handlers
-{
-	public class MessageHandler
-	{
-		public static Task MessageUpdated(Cacheable<IMessage, ulong> cachedMessage, SocketMessage message, ISocketMessageChannel channel)
-		{
-			var msg = message as SocketUserMessage;
-			MessageLogger.LogEditMessage(msg);
-			return Task.CompletedTask;
-		}
-
-		public static Task MessageDeleted(Cacheable<IMessage, ulong> cachedMessage, ISocketMessageChannel channel)
-		{
-			var msg = cachedMessage.Value as SocketUserMessage;
-			MessageLogger.LogDeleteMessage(msg);
-			return Task.CompletedTask;
-		}
-	}
-}


Fix URL parsing for some special case

Fix URL parsing for some special case

--- Hermod/HTTP/General/URL.cs
+++ Hermod/HTTP/General/URL.cs
@@ -196,10 +196,18 @@
                         if (!HTTPHostname.TryParse(elements[2].Substring(0, elements[2].IndexOf(":")),  out hostname))
                             return false;

-                        if (IPPort.       TryParse(elements[2].Substring(elements[2].IndexOf(":") + 1), out IPPort _port))
-                            port = _port;
-                        else
-                            return false;
+                        var portText = elements[2].Substring(elements[2].IndexOf(":") + 1)?.Trim();
+
+                        if (portText.IsNotNullOrEmpty())
+                        {
+
+                            if (IPPort.TryParse(elements[2].Substring(elements[2].IndexOf(":") + 1), out IPPort _port))
+                                port = _port;
+
+                            else
+                                return false;
+
+                        }

                     }


hyper-optimized-telemetry: remove unneeded namespace (#1601)

This caused the test runner to crash

--- exercises/concept/hyper-optimized-telemetry/HyperOptimizedTelemetryTests.cs
+++ exercises/concept/hyper-optimized-telemetry/HyperOptimizedTelemetryTests.cs
@@ -2,240 +2,237 @@
 using Xunit;
 using Exercism.Tests;

-namespace IntegralNumbers
+public class TelemetryBufferTests
 {
-    public class TelemetryBufferTests
-    {
-        [Fact]
-        public void ToBuffer_upper_long()
-        {
-            var bytes = TelemetryBuffer.ToBuffer(Int64.MaxValue);
-            Assert.Equal(new byte[] { 0xf8, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f }, bytes);
-        }
-
-        [Fact(Skip = "Remove this Skip property to run this test")]
-        public void ToBuffer_lower_long()
-        {
-            var bytes = TelemetryBuffer.ToBuffer((long)UInt32.MaxValue + 1);
-            Assert.Equal(new byte[] { 0xf8, 0x0, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0 }, bytes);
-        }
-
-        [Fact(Skip = "Remove this Skip property to run this test")]
-        public void ToBuffer_upper_uint()
-        {
-            var bytes = TelemetryBuffer.ToBuffer(UInt32.MaxValue);
-            Assert.Equal(new byte[] { 0x4, 0xff, 0xff, 0xff, 0xff, 0x0, 0x0, 0x0, 0x0 }, bytes);
-        }
-
-        [Fact(Skip = "Remove this Skip property to run this test")]
-        public void ToBuffer_lower_uint()
-        {
-            var bytes = TelemetryBuffer.ToBuffer((long)Int32.MaxValue + 1);
-            Assert.Equal(new byte[] { 0x4, 0x0, 0x0, 0x0, 0x80, 0x0, 0x0, 0x0, 0x0 }, bytes);
-        }
-
-        [Fact(Skip = "Remove this Skip property to run this test")]
-        public void ToBuffer_upper_int()
-        {
-            var bytes = TelemetryBuffer.ToBuffer(Int32.MaxValue);
-            Assert.Equal(new byte[] { 0xfc, 0xff, 0xff, 0xff, 0x7f, 0x0, 0x0, 0x0, 0x0 }, bytes);
-        }
-
-        [Fact(Skip = "Remove this Skip property to run this test")]
-        public void ToBuffer_lower_int()
-        {
-            var bytes = TelemetryBuffer.ToBuffer((long)UInt16.MaxValue + 1);
-            Assert.Equal(new byte[] { 0xfc, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0 }, bytes);
-        }
-
-        [Fact(Skip = "Remove this Skip property to run this test")]
-        public void ToBuffer_upper_ushort()
-        {
-            var bytes = TelemetryBuffer.ToBuffer(UInt16.MaxValue);
-            Assert.Equal(new byte[] { 0x2, 0xff, 0xff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 }, bytes);
-        }
-
-        [Fact(Skip = "Remove this Skip property to run this test")]
-        public void ToBuffer_lower_ushort()
-        {
-            var bytes = TelemetryBuffer.ToBuffer((long)Int16.MaxValue + 1);
-            Assert.Equal(new byte[] { 0x2, 0x0, 0x80, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 }, bytes);
-        }
-
-        [Fact(Skip = "Remove this Skip property to run this test")]
-        public void ToBuffer_upper_short()
-        {
-            var bytes = TelemetryBuffer.ToBuffer(Int16.MaxValue);
-            Assert.Equal(new byte[] { 0xfe, 0xff, 0x7f, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 }, bytes);
-        }
-
-        [Fact(Skip = "Remove this Skip property to run this test")]
-        public void ToBuffer_Zero()
-        {
-            var bytes = TelemetryBuffer.ToBuffer(0);
-            Assert.Equal(new byte[] { 0xfe, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 }, bytes);
-        }
-
-        [Fact(Skip = "Remove this Skip property to run this test")]
-        public void ToBuffer_upper_neg_short()
-        {
-            var bytes = TelemetryBuffer.ToBuffer(-1);
-            Assert.Equal(new byte[] { 0xfe, 0xff, 0xff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 }, bytes);
-        }
-
-        [Fact(Skip = "Remove this Skip property to run this test")]
-        public void ToBuffer_lower_neg_short()
-        {
-            var bytes = TelemetryBuffer.ToBuffer(Int16.MinValue);
-            Assert.Equal(new byte[] { 0xfe, 0x0, 0x80, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 }, bytes);
-        }
-
-        [Fact(Skip = "Remove this Skip property to run this test")]
-        public void ToBuffer_upper_neg_int()
-        {
-            int n = Int16.MinValue - 1;
-            var bytes = TelemetryBuffer.ToBuffer(n);
-            Assert.Equal(new byte[] { 0xfc, 0xff, 0x7f, 0xff, 0xff, 0x0, 0x0, 0x0, 0x0 }, bytes);
-        }
-
-        [Fact(Skip = "Remove this Skip property to run this test")]
-        public void ToBuffer_lower_neg_int()
-        {
-            var bytes = TelemetryBuffer.ToBuffer(Int32.MinValue);
-            Assert.Equal(new byte[] { 0xfc, 0x0, 0x0, 0x0, 0x80, 0x0, 0x0, 0x0, 0x0 }, bytes);
-        }
-
-        [Fact(Skip = "Remove this Skip property to run this test")]
-        public void ToBuffer_upper_neg_long()
-        {
-            var bytes = TelemetryBuffer.ToBuffer((long)Int32.MinValue - 1);
-            Assert.Equal(new byte[] { 0xf8, 0xff, 0xff, 0xff, 0x7f, 0xff, 0xff, 0xff, 0xff }, bytes);
-        }
-
-        [Fact(Skip = "Remove this Skip property to run this test")]
-        public void ToBuffer_lower_neg_long()
-        {
-            var bytes = TelemetryBuffer.ToBuffer(Int64.MinValue);
-            Assert.Equal(new byte[] { 0xf8, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x80 }, bytes);
-        }
-
-        [Fact(Skip = "Remove this Skip property to run this test")]
-        public void FromBuffer_Invalid()
-        {
-            Assert.Equal(0,
-                TelemetryBuffer.FromBuffer(new byte[] { 22, 0xff, 0xff, 0xff, 0x7f, 0, 0, 0, 0 }));
-        }
-
-        [Fact(Skip = "Remove this Skip property to run this test")]
-        public void FromBuffer_upper_long()
-        {
-            Assert.Equal(Int64.MaxValue,
-                TelemetryBuffer.FromBuffer(new byte[] { 0xf8, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f }));
-        }
-
-        [Fact(Skip = "Remove this Skip property to run this test")]
-        public void FromBuffer_lower_long()
-        {
-            Assert.Equal((long)UInt32.MaxValue + 1,
-                TelemetryBuffer.FromBuffer(new byte[] { 0xf8, 0x0, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0 }));
-        }
-
-        [Fact(Skip = "Remove this Skip property to run this test")]
-        public void FromBuffer_upper_uint()
-        {
-            Assert.Equal(UInt32.MaxValue,
-                TelemetryBuffer.FromBuffer(new byte[] { 0x4, 0xff, 0xff, 0xff, 0xff, 0x0, 0x0, 0x0, 0x0 }));
-        }
-
-        [Fact(Skip = "Remove this Skip property to run this test")]
-        public void FromBuffer_lower_uint()
-        {
-            Assert.Equal((long)Int32.MaxValue + 1,
-                TelemetryBuffer.FromBuffer(new byte[] { 0x4, 0x0, 0x0, 0x0, 0x80, 0x0, 0x0, 0x0, 0x0 }));
-        }
-
-        [Fact(Skip = "Remove this Skip property to run this test")]
-        public void FromBuffer_upper_int()
-        {
-            Assert.Equal(Int32.MaxValue,
-                TelemetryBuffer.FromBuffer(new byte[] { 0xfc, 0xff, 0xff, 0xff, 0x7f, 0x0, 0x0, 0x0, 0x0 }));
-        }
-
-        [Fact(Skip = "Remove this Skip property to run this test")]
-        public void FromBuffer_lower_int()
-        {
-            Assert.Equal(UInt16.MaxValue + 1,
-                TelemetryBuffer.FromBuffer(new byte[] { 0xfc, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0 }));
-        }
-
-        [Fact(Skip = "Remove this Skip property to run this test")]
-        public void FromBuffer_upper_ushort()
-        {
-            Assert.Equal(UInt16.MaxValue,
-                TelemetryBuffer.FromBuffer(new byte[] { 0x2, 0xff, 0xff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 }));
-        }
-
-        [Fact(Skip = "Remove this Skip property to run this test")]
-        public void FromBuffer_lower_ushort()
-        {
-            Assert.Equal(Int16.MaxValue + 1,
-                TelemetryBuffer.FromBuffer(new byte[] { 0x2, 0x0, 0x80, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 }));
-        }
-
-        [Fact(Skip = "Remove this Skip property to run this test")]
-        public void FromBuffer_upper_short()
-        {
-            Assert.Equal(Int16.MaxValue,
-                TelemetryBuffer.FromBuffer(new byte[] { 0xfe, 0xff, 0x7f, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 }));
-        }
-
-        [Fact(Skip = "Remove this Skip property to run this test")]
-        public void FromBuffer_Zero()
-        {
-            Assert.Equal(0,
-                TelemetryBuffer.FromBuffer(new byte[] { 0xfe, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 }));
-        }
-
-        [Fact(Skip = "Remove this Skip property to run this test")]
-        public void FromBuffer_upper_neg_short()
-        {
-            Assert.Equal(-1,
-                TelemetryBuffer.FromBuffer(new byte[] { 0xfe, 0xff, 0xff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 }));
-        }
-
-        [Fact(Skip = "Remove this Skip property to run this test")]
-        public void FromBuffer_lower_neg_short()
-        {
-            Assert.Equal(Int16.MinValue,
-                TelemetryBuffer.FromBuffer(new byte[] { 0xfe, 0x0, 0x80, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 }));
-        }
-
-        [Fact(Skip = "Remove this Skip property to run this test")]
-        public void FromBuffer_upper_neg_int()
-        {
-            Assert.Equal(Int16.MinValue - 1,
-                TelemetryBuffer.FromBuffer(new byte[] { 0xfc, 0xff, 0x7f, 0xff, 0xff, 0x0, 0x0, 0x0, 0x0 }));
-        }
-
-        [Fact(Skip = "Remove this Skip property to run this test")]
-        public void FromBuffer_lower_neg_int()
-        {
-            Assert.Equal(Int32.MinValue,
-                TelemetryBuffer.FromBuffer(new byte[] { 0xfc, 0x0, 0x0, 0x0, 0x80, 0x0, 0x0, 0x0, 0x0 }));
-        }
-
-        [Fact(Skip = "Remove this Skip property to run this test")]
-        public void FromBuffer_upper_neg_long()
-        {
-            Assert.Equal((long)Int32.MinValue - 1,
-                TelemetryBuffer.FromBuffer(new byte[] { 0xf8, 0xff, 0xff, 0xff, 0x7f, 0xff, 0xff, 0xff, 0xff }));
-        }
-
-        [Fact(Skip = "Remove this Skip property to run this test")]
-        public void FromBuffer_lower_neg_long()
-        {
-            Assert.Equal(Int64.MinValue,
-                TelemetryBuffer.FromBuffer(new byte[] { 0xf8, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x80 }));
-        }
+    [Fact]
+    public void ToBuffer_upper_long()
+    {
+        var bytes = TelemetryBuffer.ToBuffer(Int64.MaxValue);
+        Assert.Equal(new byte[] { 0xf8, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f }, bytes);
+    }
+
+    [Fact(Skip = "Remove this Skip property to run this test")]
+    public void ToBuffer_lower_long()
+    {
+        var bytes = TelemetryBuffer.ToBuffer((long)UInt32.MaxValue + 1);
+        Assert.Equal(new byte[] { 0xf8, 0x0, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0 }, bytes);
+    }
+
+    [Fact(Skip = "Remove this Skip property to run this test")]
+    public void ToBuffer_upper_uint()
+    {
+        var bytes = TelemetryBuffer.ToBuffer(UInt32.MaxValue);
+        Assert.Equal(new byte[] { 0x4, 0xff, 0xff, 0xff, 0xff, 0x0, 0x0, 0x0, 0x0 }, bytes);
+    }
+
+    [Fact(Skip = "Remove this Skip property to run this test")]
+    public void ToBuffer_lower_uint()
+    {
+        var bytes = TelemetryBuffer.ToBuffer((long)Int32.MaxValue + 1);
+        Assert.Equal(new byte[] { 0x4, 0x0, 0x0, 0x0, 0x80, 0x0, 0x0, 0x0, 0x0 }, bytes);
+    }
+
+    [Fact(Skip = "Remove this Skip property to run this test")]
+    public void ToBuffer_upper_int()
+    {
+        var bytes = TelemetryBuffer.ToBuffer(Int32.MaxValue);
+        Assert.Equal(new byte[] { 0xfc, 0xff, 0xff, 0xff, 0x7f, 0x0, 0x0, 0x0, 0x0 }, bytes);
+    }
+
+    [Fact(Skip = "Remove this Skip property to run this test")]
+    public void ToBuffer_lower_int()
+    {
+        var bytes = TelemetryBuffer.ToBuffer((long)UInt16.MaxValue + 1);
+        Assert.Equal(new byte[] { 0xfc, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0 }, bytes);
+    }
+
+    [Fact(Skip = "Remove this Skip property to run this test")]
+    public void ToBuffer_upper_ushort()
+    {
+        var bytes = TelemetryBuffer.ToBuffer(UInt16.MaxValue);
+        Assert.Equal(new byte[] { 0x2, 0xff, 0xff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 }, bytes);
+    }
+
+    [Fact(Skip = "Remove this Skip property to run this test")]
+    public void ToBuffer_lower_ushort()
+    {
+        var bytes = TelemetryBuffer.ToBuffer((long)Int16.MaxValue + 1);
+        Assert.Equal(new byte[] { 0x2, 0x0, 0x80, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 }, bytes);
+    }
+
+    [Fact(Skip = "Remove this Skip property to run this test")]
+    public void ToBuffer_upper_short()
+    {
+        var bytes = TelemetryBuffer.ToBuffer(Int16.MaxValue);
+        Assert.Equal(new byte[] { 0xfe, 0xff, 0x7f, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 }, bytes);
+    }
+
+    [Fact(Skip = "Remove this Skip property to run this test")]
+    public void ToBuffer_Zero()
+    {
+        var bytes = TelemetryBuffer.ToBuffer(0);
+        Assert.Equal(new byte[] { 0xfe, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 }, bytes);
+    }
+
+    [Fact(Skip = "Remove this Skip property to run this test")]
+    public void ToBuffer_upper_neg_short()
+    {
+        var bytes = TelemetryBuffer.ToBuffer(-1);
+        Assert.Equal(new byte[] { 0xfe, 0xff, 0xff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 }, bytes);
+    }
+
+    [Fact(Skip = "Remove this Skip property to run this test")]
+    public void ToBuffer_lower_neg_short()
+    {
+        var bytes = TelemetryBuffer.ToBuffer(Int16.MinValue);
+        Assert.Equal(new byte[] { 0xfe, 0x0, 0x80, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 }, bytes);
+    }
+
+    [Fact(Skip = "Remove this Skip property to run this test")]
+    public void ToBuffer_upper_neg_int()
+    {
+        int n = Int16.MinValue - 1;
+        var bytes = TelemetryBuffer.ToBuffer(n);
+        Assert.Equal(new byte[] { 0xfc, 0xff, 0x7f, 0xff, 0xff, 0x0, 0x0, 0x0, 0x0 }, bytes);
+    }
+
+    [Fact(Skip = "Remove this Skip property to run this test")]
+    public void ToBuffer_lower_neg_int()
+    {
+        var bytes = TelemetryBuffer.ToBuffer(Int32.MinValue);
+        Assert.Equal(new byte[] { 0xfc, 0x0, 0x0, 0x0, 0x80, 0x0, 0x0, 0x0, 0x0 }, bytes);
+    }
+
+    [Fact(Skip = "Remove this Skip property to run this test")]
+    public void ToBuffer_upper_neg_long()
+    {
+        var bytes = TelemetryBuffer.ToBuffer((long)Int32.MinValue - 1);
+        Assert.Equal(new byte[] { 0xf8, 0xff, 0xff, 0xff, 0x7f, 0xff, 0xff, 0xff, 0xff }, bytes);
+    }
+
+    [Fact(Skip = "Remove this Skip property to run this test")]
+    public void ToBuffer_lower_neg_long()
+    {
+        var bytes = TelemetryBuffer.ToBuffer(Int64.MinValue);
+        Assert.Equal(new byte[] { 0xf8, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x80 }, bytes);
+    }
+
+    [Fact(Skip = "Remove this Skip property to run this test")]
+    public void FromBuffer_Invalid()
+    {
+        Assert.Equal(0,
+            TelemetryBuffer.FromBuffer(new byte[] { 22, 0xff, 0xff, 0xff, 0x7f, 0, 0, 0, 0 }));
+    }
+
+    [Fact(Skip = "Remove this Skip property to run this test")]
+    public void FromBuffer_upper_long()
+    {
+        Assert.Equal(Int64.MaxValue,
+            TelemetryBuffer.FromBuffer(new byte[] { 0xf8, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f }));
+    }
+
+    [Fact(Skip = "Remove this Skip property to run this test")]
+    public void FromBuffer_lower_long()
+    {
+        Assert.Equal((long)UInt32.MaxValue + 1,
+            TelemetryBuffer.FromBuffer(new byte[] { 0xf8, 0x0, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0 }));
+    }
+
+    [Fact(Skip = "Remove this Skip property to run this test")]
+    public void FromBuffer_upper_uint()
+    {
+        Assert.Equal(UInt32.MaxValue,
+            TelemetryBuffer.FromBuffer(new byte[] { 0x4, 0xff, 0xff, 0xff, 0xff, 0x0, 0x0, 0x0, 0x0 }));
+    }
+
+    [Fact(Skip = "Remove this Skip property to run this test")]
+    public void FromBuffer_lower_uint()
+    {
+        Assert.Equal((long)Int32.MaxValue + 1,
+            TelemetryBuffer.FromBuffer(new byte[] { 0x4, 0x0, 0x0, 0x0, 0x80, 0x0, 0x0, 0x0, 0x0 }));
+    }
+
+    [Fact(Skip = "Remove this Skip property to run this test")]
+    public void FromBuffer_upper_int()
+    {
+        Assert.Equal(Int32.MaxValue,
+            TelemetryBuffer.FromBuffer(new byte[] { 0xfc, 0xff, 0xff, 0xff, 0x7f, 0x0, 0x0, 0x0, 0x0 }));
+    }
+
+    [Fact(Skip = "Remove this Skip property to run this test")]
+    public void FromBuffer_lower_int()
+    {
+        Assert.Equal(UInt16.MaxValue + 1,
+            TelemetryBuffer.FromBuffer(new byte[] { 0xfc, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0 }));
+    }
+
+    [Fact(Skip = "Remove this Skip property to run this test")]
+    public void FromBuffer_upper_ushort()
+    {
+        Assert.Equal(UInt16.MaxValue,
+            TelemetryBuffer.FromBuffer(new byte[] { 0x2, 0xff, 0xff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 }));
+    }
+
+    [Fact(Skip = "Remove this Skip property to run this test")]
+    public void FromBuffer_lower_ushort()
+    {
+        Assert.Equal(Int16.MaxValue + 1,
+            TelemetryBuffer.FromBuffer(new byte[] { 0x2, 0x0, 0x80, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 }));
+    }
+
+    [Fact(Skip = "Remove this Skip property to run this test")]
+    public void FromBuffer_upper_short()
+    {
+        Assert.Equal(Int16.MaxValue,
+            TelemetryBuffer.FromBuffer(new byte[] { 0xfe, 0xff, 0x7f, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 }));
+    }
+
+    [Fact(Skip = "Remove this Skip property to run this test")]
+    public void FromBuffer_Zero()
+    {
+        Assert.Equal(0,
+            TelemetryBuffer.FromBuffer(new byte[] { 0xfe, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 }));
+    }
+
+    [Fact(Skip = "Remove this Skip property to run this test")]
+    public void FromBuffer_upper_neg_short()
+    {
+        Assert.Equal(-1,
+            TelemetryBuffer.FromBuffer(new byte[] { 0xfe, 0xff, 0xff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 }));
+    }
+
+    [Fact(Skip = "Remove this Skip property to run this test")]
+    public void FromBuffer_lower_neg_short()
+    {
+        Assert.Equal(Int16.MinValue,
+            TelemetryBuffer.FromBuffer(new byte[] { 0xfe, 0x0, 0x80, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 }));
+    }
+
+    [Fact(Skip = "Remove this Skip property to run this test")]
+    public void FromBuffer_upper_neg_int()
+    {
+        Assert.Equal(Int16.MinValue - 1,
+            TelemetryBuffer.FromBuffer(new byte[] { 0xfc, 0xff, 0x7f, 0xff, 0xff, 0x0, 0x0, 0x0, 0x0 }));
+    }
+
+    [Fact(Skip = "Remove this Skip property to run this test")]
+    public void FromBuffer_lower_neg_int()
+    {
+        Assert.Equal(Int32.MinValue,
+            TelemetryBuffer.FromBuffer(new byte[] { 0xfc, 0x0, 0x0, 0x0, 0x80, 0x0, 0x0, 0x0, 0x0 }));
+    }
+
+    [Fact(Skip = "Remove this Skip property to run this test")]
+    public void FromBuffer_upper_neg_long()
+    {
+        Assert.Equal((long)Int32.MinValue - 1,
+            TelemetryBuffer.FromBuffer(new byte[] { 0xf8, 0xff, 0xff, 0xff, 0x7f, 0xff, 0xff, 0xff, 0xff }));
+    }
+
+    [Fact(Skip = "Remove this Skip property to run this test")]
+    public void FromBuffer_lower_neg_long()
+    {
+        Assert.Equal(Int64.MinValue,
+            TelemetryBuffer.FromBuffer(new byte[] { 0xf8, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x80 }));
     }
 }


Fix GC leakwheel scenario test (#17656)

Fix GC leakwheel scenario test (#17656)

* Fix GC leakwheel scenario test

* Should be passing for most cases

--- tests/src/GC/Scenarios/LeakWheel/leakwheel.cs
+++ tests/src/GC/Scenarios/LeakWheel/leakwheel.cs
@@ -100,57 +100,28 @@
             Console.WriteLine("Repro with these values:");
             Console.WriteLine("iMem= {0} MB, iIter= {1}, iTable={2} iSeed={3}", iMem, iIter, iTable, iSeed );

-            LeakWheel mv_obj = new LeakWheel();
+            LeakWheel my_obj = new LeakWheel();
+
+            while(!my_obj.RunGame())
+            {
+                GC.Collect(2);
+                GC.WaitForPendingFinalizers();
+                GC.Collect(2);
+
+                Console.WriteLine( "After Delete and GCed all Objects: {0}", GC.GetTotalMemory(false) );
+
+            }

-
-            if(mv_obj.RunGame())
-            {
-                Console.WriteLine("Test Passed!");
-                return 100;
-            }
-
-            Console.WriteLine("Test Failed!");
-            return 1;
-
-        }
-
-        [MethodImplAttribute(MethodImplOptions.NoInlining)]
-        public void DestroyLstNode() {
-            LstNode = null;
-        }
-
-        public bool RunGame()
-        {
-            Dictionary<int, WeakReference> oTable = new Dictionary<int, WeakReference>(10);
-            DestroyLstNode(); //the last node in the node chain//
-            Random  r = new Random (LeakWheel.iSeed);
-
-            for(int i=0; i<iIter; i++)
-            {
-                SpinWheel(oTable, LstNode, r);
-
-                if( GC.GetTotalMemory(false)/(1024*1024) >= iMem )
-                {
-                    DestroyLstNode();
-
-                    GC.Collect( );
-                    GC.WaitForPendingFinalizers();
-                    GC.Collect( );
-
-                    Console.WriteLine( "After Delete and GCed all Objects: {0}", GC.GetTotalMemory(false) );
-                }
-            }
-
-            DestroyLstNode();
-
-            GC.Collect();
+            GC.Collect(2);
             GC.WaitForPendingFinalizers();

             Thread.Sleep(100);
-            GC.Collect();
+            GC.Collect(2);
             GC.WaitForPendingFinalizers();
-            GC.Collect();
-
+            GC.Collect(2);
+            GC.WaitForPendingFinalizers();
+            GC.Collect(2);
+            GC.WaitForPendingFinalizers();

             Console.WriteLine("When test finished: {0}", GC.GetTotalMemory(false));
             Console.WriteLine("Created VarAry objects: {0} Finalized VarAry Objects: {1}", Node.iVarAryCreat, Node.iVarAryFinal);
@@ -160,13 +131,50 @@
             Console.WriteLine("Created Thread objects: {0} Finalized Thread Objects: {1}", Node.iThrdCreat, Node.iThrdFinal);

-            return (Node.iBitAryCreat == Node.iBitAryFinal &&
+            if (Node.iBitAryCreat == Node.iBitAryFinal &&
                     Node.iBiTreeCreat == Node.iBiTreeFinal &&
                     Node.iSmallCreat == Node.iSmallFinal &&
                     Node.iThrdCreat == Node.iThrdFinal &&
-                    Node.iVarAryCreat == Node.iVarAryFinal);
-        }
-
+                    Node.iVarAryCreat == Node.iVarAryFinal)
+            {
+                Console.WriteLine("Test Passed!");
+                return 100;
+            }
+
+            Console.WriteLine("Test Failed!");
+            return 1;
+
+        }
+
+        [MethodImplAttribute(MethodImplOptions.NoInlining)]
+        public void DestroyLstNode() {
+            LstNode = null;
+        }
+
+        [MethodImplAttribute(MethodImplOptions.NoInlining)]
+        public bool RunGame()
+        {
+            Dictionary<int, WeakReference> oTable = new Dictionary<int, WeakReference>(10);
+            DestroyLstNode(); //the last node in the node chain//
+            Random r = new Random (LeakWheel.iSeed);
+
+            for(int i=0; i<iIter; i++)
+            {
+                SpinWheel(oTable, LstNode, r);
+
+                if( GC.GetTotalMemory(false)/(1024*1024) >= iMem )
+                {
+                    DestroyLstNode();
+
+                    iIter -= i;  // Reduce the iteration count by how far we went
+                    return false;
+                }
+            }
+            DestroyLstNode();
+            return true;
+        }
+
+        [MethodImplAttribute(MethodImplOptions.NoInlining)]
         public void SpinWheel( Dictionary<int, WeakReference> oTable,  Node node, Random r )
         {
             int iKey;//the index which the new node will be set at
@@ -205,6 +213,7 @@
             //}
         }

+        [MethodImplAttribute(MethodImplOptions.NoInlining)]
         public void DeleteNode( int iKey, Dictionary<int, WeakReference> oTable)
         {
             //iSwitch is 0, delete one child Node at iKey;


Using first color in palette.

Using first color in palette.

--- ArcanumTextureSlicer/ArcanumTextureSlicer/BitmapExtensions.cs
+++ ArcanumTextureSlicer/ArcanumTextureSlicer/BitmapExtensions.cs
@@ -9,8 +9,6 @@
     public static class BitmapExtensions
     {
         private static Bitmap _sampleTile;
-
-        public static readonly Color AlphaColor = Color.Blue;

         public static Bitmap SampleTile =>
             _sampleTile ??
@@ -31,7 +29,7 @@
                 return source.Clone(rect, source.PixelFormat);
             }
             var bitmap = source.Clone(new Rectangle(0, 0, rect.Width, rect.Height), source.PixelFormat);
-            bitmap.SetColor(AlphaColor);
+            bitmap.SetColor(0);
             bitmap.DrawImage(source,
                 Math.Max(-rect.X, 0),
                 Math.Max(-rect.Y, 0),
@@ -41,10 +39,14 @@

         public static void SetColor(this Bitmap canvas, Color color)
         {
+            SetColor(canvas, canvas.GetColorIndex(color));
+        }
+
+        public static void SetColor(this Bitmap canvas, byte colorIndex)
+        {
             var data = canvas.LockBits(new Rectangle(0, 0, canvas.Width, canvas.Height),
                 ImageLockMode.WriteOnly, canvas.PixelFormat);
             var bytes = new byte[data.Height*data.Stride];
-            var colorIndex = canvas.GetColorIndex(color);

             for (var i = 0; i < bytes.Length; i++)
             {
@@ -63,8 +65,7 @@
             var canvasData = canvas.LockBits(rect, ImageLockMode.WriteOnly, canvas.PixelFormat);
             try
             {
-                var sampleAlphaIndex = sample.GetColorIndex(AlphaColor);
-                var canvasAlphaIndex = canvas.GetColorIndex(AlphaColor);
+                var sampleAlphaIndex = sample.GetColorIndex(Color.Blue);

                 var sampleBytes = new byte[sampleData.Height*sampleData.Stride];
                 var canvasBytes = new byte[canvasData.Height*canvasData.Stride];
@@ -77,7 +78,7 @@
                     {
                         if (sampleBytes[x + y*sampleData.Stride] == sampleAlphaIndex)
                         {
-                            canvasBytes[x + y*canvasData.Stride] = canvasAlphaIndex;
+                            canvasBytes[x + y*canvasData.Stride] = 0;
                         }
                     }
                 }


update test based on suggestions to remove win32 api p/invoke

--- Assets/MixedRealityToolkit.Tests/PlayModeTests/SpeechTests.cs
+++ Assets/MixedRealityToolkit.Tests/PlayModeTests/SpeechTests.cs
@@ -10,17 +10,15 @@
 // issue will likely persist for 2018, this issue is worked around by wrapping all
 // play mode tests in this check.

+using Microsoft.MixedReality.Toolkit.Diagnostics;
+using Microsoft.MixedReality.Toolkit.Input;
+using Microsoft.MixedReality.Toolkit.Utilities;
 using NUnit.Framework;
+using System;
 using System.Collections;
+using System.Linq;
 using UnityEngine;
 using UnityEngine.TestTools;
-using Microsoft.MixedReality.Toolkit.Input;
-using Microsoft.MixedReality.Toolkit.Utilities;
-using System.Linq;
-using Microsoft.MixedReality.Toolkit.Diagnostics;
-using System.Runtime.InteropServices;
-using System;
-using Microsoft.MixedReality.Toolkit.UI;

 namespace Microsoft.MixedReality.Toolkit.Tests
 {
@@ -38,16 +36,21 @@
             PlayModeTestUtilities.TearDown();
         }

-        /// <summary>
-        /// </summary>
-        /// <returns></returns>
         [UnityTest]
         public IEnumerator TestToggleProfilerCommand()
         {
-            // Confirm that the Diagnostics system is enabled and the VisualProfiler is in the scene.
+            int frameDelay = 10;
+
+            // Confirm that the diagnostics system is enabled.
             IMixedRealityDiagnosticsSystem diagnosticsSystem = null;
             MixedRealityServiceRegistry.TryGetService<IMixedRealityDiagnosticsSystem>(out diagnosticsSystem);
             Assert.IsNotNull(diagnosticsSystem, "The diagnostics system is not enabled in the scene.");
+            yield return null;
+
+            // This test uses the input system to simulate speech commands.
+            IMixedRealityInputSystem inputSystem = null;
+            MixedRealityServiceRegistry.TryGetService<IMixedRealityInputSystem>(out inputSystem);
+            Assert.IsNotNull(inputSystem, "The input system is not enabled in the scene.");
             yield return null;

             // Verfiy that the VisualProfiler is enabled.
@@ -55,50 +58,20 @@
             yield return null;

             // Toggle the profiler visualization off.
-            KeyboardEvent(VirtualKey_9, ScanCode_9, 0, IntPtr.Zero); // key down
-            yield return null;
-            KeyboardEvent(VirtualKey_9, ScanCode_9, KeyboardFlag_KeyUp, IntPtr.Zero); // key up
-            for (int i = 0; i < 10; i++) { yield return null; }
+            var gazeInputSource = inputSystem.DetectedInputSources.Where(x => x.SourceName.Equals("Gaze")).First();
+            inputSystem.RaiseSpeechCommandRecognized(
+                gazeInputSource,
+                RecognitionConfidenceLevel.High,
+                new TimeSpan(),
+                DateTime.Now,
+                new SpeechCommands("toggle profiler", KeyCode.Alpha9, MixedRealityInputAction.None));
+            // It may take a few frames before the event is handled and the system responds to the state change.
+            for (int i = 0; i < frameDelay; i++) { yield return null; }

             // Verify that the VisualProfiler is disabled.
             Assert.IsFalse(diagnosticsSystem.ShowProfiler, "The VisualProfiler is active (should be inactive).");
             yield return null;
-
-            // Toggle the profiler visualization on.
-            KeyboardEvent(VirtualKey_9, ScanCode_9, 0, IntPtr.Zero); // key down
-            yield return null;
-            KeyboardEvent(VirtualKey_9, ScanCode_9, KeyboardFlag_KeyUp, IntPtr.Zero); // key up
-            for (int i = 0; i < 10; i++) { yield return null; }
-
-            // Verfiy that the VisualProfiler is enabled.
-            Assert.IsTrue(diagnosticsSystem.ShowProfiler, "The VisualProfiler is inactive (should be active).");
-            yield return null;
         }
-
-        /// <summary>
-        /// Virutal Key Code and Scan Code values used in this test.
-        /// </summary>
-        private const Byte VirtualKey_9 = 0x39;
-        private const Byte ScanCode_9 = 0x0A;
-
-        /// <summary>
-        /// Flags, for the keybd_event function, used in this test.
-        /// </summary>
-        private const UInt32 KeyboardFlag_KeyUp = 0x0002;
-
-        /// <summary>
-        /// P/Invoke signature for the Windows keybd_event function.
-        /// </summary>
-        /// <param name="keyCode">Virtual Key Code for the desired keyboard event.</param>
-        /// <param name="scanCode">Scan Code for the desired keybaord event.</param>
-        /// <param name="flags">Flags used to interpret the keyboard event.</param>
-        /// <param name="extraInfo">Additional information associated with the keyboard event.</param>
-        [DllImport("user32.dll", EntryPoint = "keybd_event")]
-        private static extern void KeyboardEvent(
-            Byte keyCode,
-            Byte scanCode,
-            UInt32 flags,
-            IntPtr extraInfo);
     }
 }
 #endif


Update Assets/MixedRealityToolkit/Extensions/GameObjectExtensions.cs

Co-Authored-By: Will <03f7414553f4a516a3c3f51b46f4027c16f58f76@microsoft.com>

--- Assets/MixedRealityToolkit/Extensions/GameObjectExtensions.cs
+++ Assets/MixedRealityToolkit/Extensions/GameObjectExtensions.cs
@@ -134,7 +134,7 @@
         /// Destroys gameobject appropriately depending if in edit or playmode
         /// </summary>
         /// <param name="gameObject">gameobject to destroy</param>
-        /// <param name="t">time at which to destroy GameObject if applicable</param>
+        /// <param name="t">time in seconds at which to destroy GameObject if applicable</param>
         public static void DestroyGameObject(GameObject gameObject, float t = 0.0f)
         {
             if (Application.isPlaying)


fixes edit payment request

fixes edit payment request

--- BTCPayServer/Views/UIPaymentRequest/EditPaymentRequest.cshtml
+++ BTCPayServer/Views/UIPaymentRequest/EditPaymentRequest.cshtml
@@ -66,6 +66,9 @@

+

+
+

@@ -73,6 +76,9 @@

+

+
+

Additional Options

@@ -104,7 +110,7 @@

-
+

                 <button type="submit" class="btn btn-primary" id="SaveButton">
                     @(string.IsNullOrEmpty(Model.Id) ? "Create" : "Save")


Use actual font data to calculate underline and strikethrough

--- src/AvaloniaEdit/Text/TextLineRun.cs
+++ src/AvaloniaEdit/Text/TextLineRun.cs
@@ -240,11 +240,17 @@
                 drawingContext.DrawText(TextRun.Properties.ForegroundBrush,
                     new Point(x, y), _formattedText);

+                var glyphTypeface = TextRun.Properties.Typeface.GlyphTypeface;
+
+                var scale =  TextRun.Properties.FontSize / glyphTypeface.DesignEmHeight;
+
+                var baseline = y + -glyphTypeface.Ascent * scale;
+
                 if (TextRun.Properties.Underline)
                 {
-                    var pen = new Pen(TextRun.Properties.ForegroundBrush);
-
-                    var posY = y + _formattedText.Bounds.Height;
+                    var pen = new Pen(TextRun.Properties.ForegroundBrush, glyphTypeface.UnderlineThickness * scale);
+
+                    var posY = baseline + glyphTypeface.UnderlinePosition * scale;

                     drawingContext.DrawLine(pen,
                         new Point(x, posY),
@@ -253,9 +259,9 @@

                 if (TextRun.Properties.Strikethrough)
                 {
-                    var pen = new Pen(TextRun.Properties.ForegroundBrush);
-
-                    var posY = y + _formattedText.Bounds.Height / 2;
+                    var pen = new Pen(TextRun.Properties.ForegroundBrush, glyphTypeface.StrikethroughThickness * scale);
+
+                    var posY = baseline + glyphTypeface.StrikethroughPosition * scale;

                     drawingContext.DrawLine(pen,
                         new Point(x, posY),


Fix strikethrough line drawing in macOS

Fix strikethrough line drawing in macOS

--- src/AvaloniaEdit/Text/TextLineRun.cs
+++ src/AvaloniaEdit/Text/TextLineRun.cs
@@ -311,9 +311,15 @@

                 if (TextRun.Properties.Strikethrough)
                 {
-                    var pen = new Pen(TextRun.Properties.ForegroundBrush, glyphTypeface.StrikethroughThickness * scale);
-
-                    var posY = baseline + glyphTypeface.StrikethroughPosition * scale;
+                    double penThickness = glyphTypeface.StrikethroughThickness == 0 ?
+                        0.5 :
+                        glyphTypeface.StrikethroughThickness * scale;
+
+                    var pen = new Pen(TextRun.Properties.ForegroundBrush, penThickness);
+
+                    var posY = glyphTypeface.StrikethroughPosition == 0
+                        ? glyphTypeface.LineHeight * scale / 2
+                        : baseline + glyphTypeface.StrikethroughPosition * scale;

                     drawingContext.DrawLine(pen,
                         new Point(x, posY),


WebFrontAuthRemoteAuthenticateAsync renamed.

--- CK.AspNet.Auth/RemoteAuthenticationEventsContextExtensions.cs
+++ CK.AspNet.Auth/RemoteAuthenticationEventsContextExtensions.cs
@@ -16,18 +16,29 @@
     public static class RemoteAuthenticationEventsContextExtensions
     {
         /// <summary>
+        /// Obsolete.
+        /// </summary>
+        /// <typeparam name="TPayload">Type of the payload.</typeparam>
+        /// <param name="c">This ticket received context.</param>
+        /// <param name="payloadConfigurator">Action that must configure the payload.</param>
+        /// <returns>The awaitable.</returns>
+        [Obsolete( "Use WebFrontAuthOnTicketReceivedAsync (renaming).", error: false )]
+        public static Task WebFrontAuthRemoteAuthenticateAsync<TPayload>( this TicketReceivedContext c, Action<TPayload> payloadConfigurator )
+            => WebFrontAuthOnTicketReceivedAsync( c, payloadConfigurator );
+
+        /// <summary>
         /// Simple API used from <see cref="RemoteAuthenticationEvents.OnTicketReceived"/> to handle
-        /// external authentication: <see cref="WebFrontAuthService.HandleRemoteAuthentication{T}(TicketReceivedContext, Action{T})"/>
+        /// external authentication: <see cref="WebFrontAuthService.HandleRemoteAuthenticationAsync{T}(TicketReceivedContext, Action{T})"/>
         /// is called.
         /// </summary>
         /// <typeparam name="TPayload">Type of the payload.</typeparam>
         /// <param name="c">This ticket received context.</param>
         /// <param name="payloadConfigurator">Action that must configure the payload.</param>
         /// <returns>The awaitable.</returns>
-        public static Task WebFrontAuthRemoteAuthenticateAsync<TPayload>( this TicketReceivedContext c, Action<TPayload> payloadConfigurator )
+        public static Task WebFrontAuthOnTicketReceivedAsync<TPayload>( this TicketReceivedContext c, Action<TPayload> payloadConfigurator )
         {
             var authService = c.HttpContext.RequestServices.GetRequiredService<WebFrontAuthService>();
-            return authService.HandleRemoteAuthentication( c, payloadConfigurator );
+            return authService.HandleRemoteAuthenticationAsync( c, payloadConfigurator );
         }

         /// <summary>
@@ -36,15 +47,19 @@
         /// (This method calls <see cref="HandleRequestContext{T}.HandleResponse()"/> that ends any further response processing.)
         /// </summary>
         /// <param name="f">This remote failure context.</param>
+        /// <param name="setUnsafeLevel">
+        /// True to downgrade the current authentication to <see cref="AuthLevel.Unsafe"/>.
+        /// By default the current authentication is kept as-is.
+        /// </param>
         /// <param name="errorId">
         /// Error identifier: should be a dotted identifier that could easily be used as a resource
         /// name (to map to translations in different languages).
         /// </param>
         /// <param name="errorText">When null, <see cref="RemoteFailureContext.Failure"/>'s <see cref="Exception.Message"/> is used.</param>
         /// <returns>The awaitable.</returns>
-        public static Task WebFrontAuthRemoteFailureAsync( this RemoteFailureContext f, string errorId = "RemoteFailure", string? errorText = null )
+        public static Task WebFrontAuthOnRemoteFailureAsync( this RemoteFailureContext f, bool setUnsafeLevel = false, string errorId = "RemoteFailure", string? errorText = null )
         {
-            return OnError( f, f.Properties, errorId, errorText ?? f.Failure.Message );
+            return OnError( f, f.Properties, setUnsafeLevel, errorId, errorText ?? f.Failure.Message );
         }

         /// <summary>
@@ -53,50 +68,54 @@
         /// (This method calls <see cref="HandleRequestContext{T}.HandleResponse()"/> that ends any further response processing.)
         /// </summary>
         /// <param name="d">This remote failure context.</param>
+        /// <param name="setUnsafeLevel">
+        /// True to downgrade the current authentication to <see cref="AuthLevel.Unsafe"/>.
+        /// By default the current authentication is kept as-is.
+        /// </param>
         /// <param name="errorId">
         /// Error identifier: should be a dotted identifier that could easily be used as a resource
         /// name (to map to translations in different languages).
         /// </param>
         /// <param name="errorText">When null, <paramref name="errorId"/> is used.</param>
         /// <returns>The awaitable.</returns>
-        public static Task WebFrontAuthRemoteFailureAsync( this AccessDeniedContext d, string errorId = "AccessDenied", string? errorText = null )
+        public static Task WebFrontAuthOnAccessDeniedAsync( this AccessDeniedContext d, bool setUnsafeLevel = false, string errorId = "AccessDenied", string? errorText = null )
         {
-            return OnError( d, d.Properties, errorId, errorText ?? errorId );
+            return OnError( d, d.Properties, setUnsafeLevel, errorId, errorText ?? errorId );
         }

-        static Task OnError( HandleRequestContext<RemoteAuthenticationOptions> h, AuthenticationProperties properties, string errorId, string errorText )
+        static Task OnError( HandleRequestContext<RemoteAuthenticationOptions> h, AuthenticationProperties properties, bool setUnsafeLevel, string errorId, string errorText )
         {
             h.HandleResponse();
             var authService = h.HttpContext.RequestServices.GetRequiredService<WebFrontAuthService>();
-            WebFrontAuthHandler.ExtractClearWFAData( properties, out _, out var deviceId, out var initialScheme, out var returnUrl, out var callerOrigin );
-            return authService.SendRemoteAuthenticationError( h.HttpContext, deviceId, returnUrl, callerOrigin, errorId, errorText, initialScheme );
+            authService.GetWFAData( h.HttpContext, properties, out var fAuth, out var initialScheme, out var callerOrigin, out var returnUrl, out var userData );
+            if( setUnsafeLevel ) fAuth = fAuth.SetUnsafeLevel();
+            return authService.SendRemoteAuthenticationErrorAsync( h.HttpContext, fAuth, returnUrl, callerOrigin, errorId, errorText, initialScheme, h.Scheme.Name, userData );
         }
+
+        /// <summary>
+        /// Extracts the initial authentication from this context (from the "WFA-C" key of <see cref="RemoteFailureContext.Properties"/>).
+        /// </summary>
+        /// <param name="this">This ticket received context.</param>
+        /// <returns>The initial authentication.</returns>
+        public static IAuthenticationInfo GetTicketAuthenticationInfo( this TicketReceivedContext @this ) => GetFrontAuthenticationInfo( @this.HttpContext, @this.Properties ).Info;

         /// <summary>
         /// Extracts the initial authentication from this context (from the "WFA-C" key of <see cref="RemoteFailureContext.Properties"/>).
         /// </summary>
         /// <param name="this">This failure context.</param>
         /// <returns>The initial authentication.</returns>
-        public static IAuthenticationInfo GetTicketAuthenticationInfo( this RemoteFailureContext @this ) => GetAuthenticationInfo( @this.HttpContext, @this.Properties );
+        public static IAuthenticationInfo GetTicketAuthenticationInfo( this RemoteFailureContext @this ) => GetFrontAuthenticationInfo( @this.HttpContext, @this.Properties ).Info;

         /// <summary>
         /// Extracts the initial authentication from this context (from the "WFA-C" key of <see cref="RemoteFailureContext.Properties"/>).
         /// </summary>
         /// <param name="this">This failure context.</param>
         /// <returns>The initial authentication.</returns>
-        public static IAuthenticationInfo GetTicketAuthenticationInfo( this AccessDeniedContext d ) => GetAuthenticationInfo( d.HttpContext, d.Properties );
+        public static IAuthenticationInfo GetTicketAuthenticationInfo( this AccessDeniedContext d ) => GetFrontAuthenticationInfo( d.HttpContext, d.Properties ).Info;

-        static IAuthenticationInfo GetAuthenticationInfo( HttpContext h, AuthenticationProperties properties )
+        static FrontAuthenticationInfo GetFrontAuthenticationInfo( HttpContext httpContext, AuthenticationProperties properties )
         {
-            if( properties.Items.TryGetValue( "WFA-C", out var currentAuth ) )
-            {
-                var authService = h.RequestServices.GetRequiredService<WebFrontAuthService>();
-                return authService.UnprotectAuthenticationInfo( h, currentAuth ).Info;
-            }
-            WebFrontAuthHandler.ExtractClearWFAData( properties, out _, out var deviceId, out var _, out var _, out var _ );
-            var typeSystem = h.RequestServices.GetRequiredService<IAuthenticationTypeSystem>();
-            return typeSystem.AuthenticationInfo.Create( null, deviceId: deviceId );
+            return httpContext.RequestServices.GetRequiredService<WebFrontAuthService>().GetFrontAuthenticationInfo( httpContext, properties );
         }
-
     }
 }


Prefix summary of events and not only meetings with status cancelled, since Android uses this instead of exdates for recurrence exceptions, ticket #307.

--- CalDavSynchronizer/Implementation/Events/EventEntityMapper.cs
+++ CalDavSynchronizer/Implementation/Events/EventEntityMapper.cs
@@ -168,6 +168,10 @@
       }

       target.Summary = source.Subject;
+      if (!string.IsNullOrEmpty (target.Summary) &&
+          target.Summary.StartsWith ("Cancelled: "))
+        target.Status = EventStatus.Cancelled;
+
       target.Location = source.Location;

       if (_configuration.MapBody)
@@ -1406,8 +1410,15 @@
         }
       }

-
       targetWrapper.Inner.Subject = source.Summary;
+      if (source.Status == EventStatus.Cancelled)
+      {
+        if (string.IsNullOrEmpty (targetWrapper.Inner.Subject))
+          targetWrapper.Inner.Subject = "Cancelled: ";
+        else if (!targetWrapper.Inner.Subject.StartsWith ("Cancelled: "))
+          targetWrapper.Inner.Subject = "Cancelled: " + targetWrapper.Inner.Subject;
+      }
+
       targetWrapper.Inner.Location = source.Location;

       targetWrapper.Inner.Body = _configuration.MapBody ? source.Description : string.Empty;
@@ -1450,10 +1461,6 @@
         if (source.Status == EventStatus.Cancelled)
         {
           targetWrapper.Inner.MeetingStatus = OlMeetingStatus.olMeetingReceivedAndCanceled;
-          if (string.IsNullOrEmpty (targetWrapper.Inner.Subject))
-            targetWrapper.Inner.Subject = "Cancelled: ";
-          else if (!targetWrapper.Inner.Subject.StartsWith ("Cancelled: "))
-            targetWrapper.Inner.Subject = "Cancelled: " + targetWrapper.Inner.Subject;
         }
         else if (ownSourceAttendee != null && targetWrapper.Inner.ResponseStatus != OlResponseStatus.olResponseOrganized)
         {


Equation 12

Equation 12

--- CdmMethTools/ProjectEmissionsFromFlaringTool-EB68Annex15v2.cs
+++ CdmMethTools/ProjectEmissionsFromFlaringTool-EB68Annex15v2.cs
@@ -288,5 +288,26 @@
             // Return
             return Q_CO2_EG_m;
         }
+
+        /// <summary>
+        /// Equation 12: Calculates the quantity of O2 (moles) in the exhaust gas per kg of residual gas flared on a dry basis at reference conditions in minute m (kmol/kg residual gas)
+        /// </summary>
+        /// <param name="v_O2_EG_m">Volumetric fraction of O2 in the exhaust gas on a dry basis at reference conditions in the minute m</param>
+        /// <param name="MF_C_RG_m">Mass fraction of carbon in the residual gas in the minute m</param>
+        /// <param name="MF_N_RG_m">Mass fraction of nitrogen in the residual gas in the minute m</param>
+        /// <param name="F_O2_RG_m">Stochiometric quantity of moles of O2 required for a complete oxidation of one kg residual gas in minute m (kmol/kg residual gas)</param>
+        /// <returns>Quantity of O2 (moles) in the exhaust gas per kg of residual gas flared on a dry basis at reference conditions in minute m (kmol/kg residual gas)</returns>
+        public decimal Calc_n_O2_EG_m(decimal v_O2_EG_m, decimal MF_C_RG_m, decimal MF_N_RG_m, decimal F_O2_RG_m)
+        {
+            // Local Vars
+            decimal n_O2_EG_m = 0;
+
+            // Equation 12
+            n_O2_EG_m = (v_O2_EG_m / (1 - (v_O2_EG_m / Constants.v_O2_air))) * ((MF_C_RG_m / AtomicMass.C) + (MF_N_RG_m / (2 * AtomicMass.N)) + ((1 - Constants.v_O2_air) / Constants.v_O2_air) * F_O2_RG_m);
+
+            // Return
+            return n_O2_EG_m;
+        }
+
     }
 }


Station selector now prevents the user rom clicking hte Current button if the current station is filtered out

--- CmdrCompanion.Interface/ViewModel/StationSelectorViewModel.cs
+++ CmdrCompanion.Interface/ViewModel/StationSelectorViewModel.cs
@@ -151,9 +151,9 @@

         public bool CanSelectCurrent()
         {
-            return Environment.CurrentSituation.CurrentLocation != null && Environment.CurrentSituation.CurrentLocation is Station;
+            Station current = Environment.CurrentSituation.CurrentLocation as Station;
+            return current != null && (Filter == null || Filter(current));
         }
-

         private bool FilterInternal(object s)
         {


Fixed missing basepath in redirections in Nancy

--- Code/Nancy.SimpleAuthentication/SimpleAuthenticationModule.cs
+++ Code/Nancy.SimpleAuthentication/SimpleAuthenticationModule.cs
@@ -230,7 +230,7 @@

         private Uri GenerateCallbackUri(string providerName)
         {
-            return SystemHelpers.CreateCallBackUri(providerName, Request.Url, CallbackRoute);
+            return SystemHelpers.CreateCallBackUri(providerName, Request.Url, Request.Url.BasePath + CallbackRoute);
         }

         private string DetermineReturnUrl()


set html indent to 2 spaces, position ourselves for configurable json tab settings

--- Ior/Core/IorContentType.cs
+++ Ior/Core/IorContentType.cs
@@ -1,5 +1,6 @@
 using System;
 using System.Collections.Generic;
+using System.Globalization;
 using System.Linq;
 using System.Text;
 using System.Net.Mime;
@@ -72,47 +73,56 @@
             try {
                 switch (mtc) {
                     case IorMediaTypeCategory.Xml: {
-                            var doc = XDocument.Parse(content);
-                            var xml = doc.ToString();
-                            if (doc.Declaration != null)
-                                return doc.Declaration.ToString() + Environment.NewLine + xml;
-                            else
-                                return xml;
-                        }
+                        var doc = XDocument.Parse(content);
+                        var xml = doc.ToString();
+                        if (doc.Declaration != null)
+                            return doc.Declaration.ToString() + Environment.NewLine + xml;
+                        else
+                            return xml;
+                    }
                     case IorMediaTypeCategory.Javascript: //some APIs incorrectly use e.g. text/javascript when actual content-type is JSON
                     case IorMediaTypeCategory.Json: {
-                            dynamic parsedJson = JsonConvert.DeserializeObject(content);
-                            return JsonConvert.SerializeObject(parsedJson, Formatting.Indented);
+                        dynamic parsedJson = JsonConvert.DeserializeObject(content);
+
+                        var jsonSerializer = new JsonSerializer();
+                        var stringWriter = new StringWriter(new StringBuilder(256), CultureInfo.InvariantCulture);
+                        using (var jsonTextWriter = new JsonTextWriter(stringWriter)) {
+                            jsonTextWriter.Indentation = 2;
+                            jsonTextWriter.IndentChar = ' ';
+                            jsonTextWriter.Formatting = Formatting.Indented;
+                            jsonSerializer.Serialize(jsonTextWriter, parsedJson);
                         }
+                        return stringWriter.ToString();
+                    }
                     case IorMediaTypeCategory.Html: {
-                            //need to convert to utf16-little endian stream and set Document input/output encoding since Document.FromString screws up encoding.
-                            var stream = new MemoryStream(Encoding.Unicode.GetBytes(content));
-                            using (var doc = Document.FromStream(stream)) {
-                                doc.InputCharacterEncoding = EncodingType.Utf16LittleEndian;
-                                doc.OutputCharacterEncoding = EncodingType.Utf16LittleEndian;
-                                doc.ShowWarnings = false;
-                                doc.Quiet = true;
-                                doc.OutputXhtml = false;
-                                doc.OutputXml = false;
-                                doc.OutputHtml = false;
-                                doc.IndentBlockElements = AutoBool.Yes;
-                                doc.IndentSpaces = 4;
-                                doc.IndentAttributes = false;
-                                //doc.IndentCdata = true;
-                                doc.AddVerticalSpace = true;
-                                doc.AddTidyMetaElement = false;
-                                doc.WrapAt = 120;
+                        //need to convert to utf16-little endian stream and set Document input/output encoding since Document.FromString screws up encoding.
+                        var stream = new MemoryStream(Encoding.Unicode.GetBytes(content));
+                        using (var doc = Document.FromStream(stream)) {
+                            doc.InputCharacterEncoding = EncodingType.Utf16LittleEndian;
+                            doc.OutputCharacterEncoding = EncodingType.Utf16LittleEndian;
+                            doc.ShowWarnings = false;
+                            doc.Quiet = true;
+                            doc.OutputXhtml = false;
+                            doc.OutputXml = false;
+                            doc.OutputHtml = false;
+                            doc.IndentBlockElements = AutoBool.Yes;
+                            doc.IndentSpaces = 2;
+                            doc.IndentAttributes = false;
+                            //doc.IndentCdata = true;
+                            doc.AddVerticalSpace = true;
+                            doc.AddTidyMetaElement = false;
+                            doc.WrapAt = 120;

-                                doc.MergeDivs = AutoBool.No;
-                                doc.MergeSpans = AutoBool.No;
-                                doc.JoinStyles = false;
-                                doc.ForceOutput = true;
-                                doc.CleanAndRepair();
+                            doc.MergeDivs = AutoBool.No;
+                            doc.MergeSpans = AutoBool.No;
+                            doc.JoinStyles = false;
+                            doc.ForceOutput = true;
+                            doc.CleanAndRepair();

-                                string output = doc.Save();
-                                return output;
-                            }
+                            string output = doc.Save();
+                            return output;
                         }
+                    }
                     default:
                         return content;
                 }


Fixed pipe connection crashing because of wrong init order

--- source/UninstallTools/Uninstaller/BulkUninstallTask.cs
+++ source/UninstallTools/Uninstaller/BulkUninstallTask.cs
@@ -246,9 +246,9 @@
                         {
                             client = new NamedPipeClientStream(".", "UninstallAutomatizerDaemon", PipeDirection.Out);
                             writer = new StreamWriter(client);
+
+                            client.Connect(7000);
                             writer.AutoFlush = true;
-
-                            client.Connect(7000);
                         }
                         catch (SystemException ex)
                         {


Add comments to a new class.

Add comments to a new class.

--- LtiLibrary.AspNet/Outcomes/v1/ImsxXmlMediaTypeResult.cs
+++ LtiLibrary.AspNet/Outcomes/v1/ImsxXmlMediaTypeResult.cs
@@ -2,10 +2,15 @@

 namespace LtiLibrary.AspNet.Outcomes.v1
 {
+    ///
+    /// Use to attach a specific XML formatter to controller results. For example,
+    /// public ImsxXmlMediaTypeResult Post([ModelBinder(BinderType = typeof(ImsxXmlMediaTypeModelBinder))] imsx_POXEnvelopeType request)
+    ///
     public class ImsxXmlMediaTypeResult : ObjectResult
     {
         public ImsxXmlMediaTypeResult(object value) : base(value)
         {
+            // This formatter produces an imsx_POXEnvelopeType with an imsx_POXEnvelopeResponse
             Formatters.Add(new ImsxXmlMediaTypeOutputFormatter());
         }
     }


VM state recreation bug fixed. Now, Spectrum 128K unit tests work.

--- Core/Spect.Net.SpectrumEmu/Devices/Keyboard/KeyboardDevice.cs
+++ Core/Spect.Net.SpectrumEmu/Devices/Keyboard/KeyboardDevice.cs
@@ -119,6 +119,10 @@
         /// </summary>
         public void Reset()
         {
+            for (var i = 0; i < _lineStatus.Length; i++)
+            {
+                _lineStatus[i] = 0;
+            }
         }

         /// <summary>


failing test for Dictionary<string, Dictionary<string, foo>> when excluding nulls

--- JilTests/SerializeTests.cs
+++ JilTests/SerializeTests.cs
@@ -7692,5 +7692,17 @@
                 Assert.AreEqual(shouldMatch, streamStr);
             }
         }
+
+        class _DictionaryDictionary
+        {
+            public Dictionary<string, Dictionary<string, int>> A { get; set; }
+        }
+
+        [TestMethod]
+        public void DictionaryDictionary()
+        {
+            var str = JSON.Serialize<Dictionary<string, Dictionary<string, int>>>(new Dictionary<string, Dictionary<string, int>>(), Options.ExcludeNulls);
+            Assert.IsFalse(string.IsNullOrEmpty(str));
+        }
     }
 }


Added the posibility to search for epic withing a project.

--- Jira.SDK/Domain/Project.cs
+++ Jira.SDK/Domain/Project.cs
@@ -77,6 +77,11 @@
 			}
 		}

+        public Issue GetEpic(String epicName)
+        {
+            return JiraEnvironment.Client.SearchIssues(String.Format("project = '{0}' AND Type = Epic and 'Epic name' = '{1}'", this.Name, epicName)).FirstOrDefault();
+        }
+
 		public override int GetHashCode()
 		{
 			return this.Key.GetHashCode();


Implement t and T commands in normal mode

--- JustEnoughVi/NormalMode.cs
+++ JustEnoughVi/NormalMode.cs
@@ -339,6 +339,46 @@
                     return;

                 Editor.Caret.Offset = offset;
+            }
+        }
+    }
+
+    public class FindTillCommand : Command
+    {
+        public FindTillCommand(TextEditorData editor) : base(editor)
+        {
+            TakeArgument = true;
+        }
+
+        protected override void Run()
+        {
+            for (int i = 0; i < Count; i++)
+            {
+                var offset = StringUtils.FindNextInLine(Editor.Text, Editor.Caret.Offset, Argument);
+                if (offset <= 0)
+                    return;
+
+                Editor.Caret.Offset = offset - 1;
+            }
+        }
+    }
+
+    public class FindTillPreviousCommand : Command
+    {
+        public FindTillPreviousCommand(TextEditorData editor) : base(editor)
+        {
+            TakeArgument = true;
+        }
+
+        protected override void Run()
+        {
+            for (int i = 0; i < Count; i++)
+            {
+                var offset = StringUtils.FindPreviousInLine(Editor.Text, Editor.Caret.Offset, Argument);
+                if (offset <= 0)
+                    return;
+
+                Editor.Caret.Offset = offset + 1;
             }
         }
     }
@@ -800,6 +840,8 @@
             CommandMap.Add("D", new DeleteLineEndCommand(editor));
             CommandMap.Add("f", new FindCommand(editor));
             CommandMap.Add("F", new FindPreviousCommand(editor));
+            CommandMap.Add("t", new FindTillCommand(editor));
+            CommandMap.Add("T", new FindTillPreviousCommand(editor));
             CommandMap.Add("gg", new GoToLineCommand(editor));
             CommandMap.Add("gd", new GoToDeclarationCommand(editor));
             CommandMap.Add("gt", new GoToNextDocumentCommand(editor));


Update reference to RFC 8103

Update reference to RFC 8103

--- src/Cryptography/ChaCha20Poly1305.cs
+++ src/Cryptography/ChaCha20Poly1305.cs
@@ -17,9 +17,8 @@
     //
     //      RFC 5116 - An Interface and Algorithms for Authenticated Encryption
     //
-    //      draft-ietf-curdle-cms-chacha20-poly1305-06 - Using ChaCha20-Poly1305
-    //          Authenticated Encryption in the Cryptographic Message Syntax
-    //          (CMS)
+    //      RFC 8103 - Using ChaCha20-Poly1305 Authenticated Encryption in the
+    //          Cryptographic Message Syntax (CMS)
     //
     //  Parameters:
     //


new features to good to build

new features to good to build

--- ffmpeg-farm-server/API.WindowsService/Controllers/ScrubbingJobController.cs
+++ ffmpeg-farm-server/API.WindowsService/Controllers/ScrubbingJobController.cs
@@ -73,7 +73,8 @@

             foreach (var spriteSheetSize in jobRequest.SpriteSheetSizes)
             {
-                var numberOfThumbnailsPerFile = spriteSheetSize.SpriteSheetTiles(out var hTiles, out var vTiles);
+                int hTiles, vTiles;
+                var numberOfThumbnailsPerFile = spriteSheetSize.SpriteSheetTiles(out hTiles, out vTiles);
                 var framesBetweenDumps = calculateFramesBetweenDumps(info.Duration, numberOfThumbnailsPerFile, info.Framerate, jobRequest.MaxSecondsBetweenThumbnails, jobRequest.FirstThumbnailOffsetInSeconds);

                 foreach (var resolution in jobRequest.ThumbnailResolutions)
@@ -133,8 +134,10 @@

         private void generateWebVtt(string webVttFile, int numberOfFiles, string thumbBaseFilename, SpriteSheetSize spriteSheetSize, int framesBetweenDumps, int firstThumbnailOffsetInSeconds, int framePerSecond, int videoDurationInMilliseconds, string resolution)
         {
-            var numberOfThumbnailsPerFile = spriteSheetSize.SpriteSheetTiles(out var hTiles, out var vTiles);
-            getThumbWidthAndHeight(resolution, out var thumbWidth, out var thumbHeight);
+            int hTiles, vTiles;
+            var numberOfThumbnailsPerFile = spriteSheetSize.SpriteSheetTiles(out hTiles, out vTiles);
+            int thumbWidth, thumbHeight;
+            getThumbWidthAndHeight(resolution, out thumbWidth, out thumbHeight);

             var content = "WEBVTT ";
             var curThumb = 0;


Fixed layer-based collision.

Fixed layer-based collision.

--- RenderingLibrary/Graphics/Layer.cs
+++ RenderingLibrary/Graphics/Layer.cs
@@ -150,7 +150,24 @@
         {
             var effectiveZoom = LayerCameraSettings?.Zoom ?? camera.Zoom;

-            var transformationMatrix = Camera.GetTransformationMatrix(camera.X, camera.Y, effectiveZoom, camera.ClientWidth, camera.ClientHeight);
+            Matrix transformationMatrix;
+
+            if (camera.CameraCenterOnScreen == RenderingLibrary.CameraCenterOnScreen.Center)
+            {
+                // make local vars to make stepping in faster if debugging
+                var x = camera.X;
+                var y = camera.Y;
+                var zoom = effectiveZoom;
+                var width = camera.ClientWidth;
+                var height = camera.ClientHeight;
+                transformationMatrix = Camera.GetTransformationMatrix(x, y, zoom, width, height, false);
+            }
+            else
+            {
+                transformationMatrix =  Matrix.CreateTranslation(-camera.X, -camera.Y, 0) *
+                                         Matrix.CreateScale(new Vector3(effectiveZoom, effectiveZoom, 1));
+            }
+

             Matrix matrix = Matrix.Invert(transformationMatrix);


Revert "Handle cases with missing _id, and bypass merge for single drop buckets"

This reverts commit 18a2f9049b55555671b7a1fd8ab8a507829b37a9.

Revert async - memory consumption out of control

--- River.Components/Sources/Source.cs
+++ River.Components/Sources/Source.cs
@@ -89,16 +89,9 @@
         {
             var mergedDrop = new Dictionary<string, object>();

-            if (bucket.Count() > 1)
-            {
-                foreach (var drop in bucket)
-                {
-                    Merge(drop, mergedDrop);
-                }
-            }
-            else
-            {
-                mergedDrop = bucket.First();
+            foreach (var drop in bucket)
+            {
+                Merge(drop, mergedDrop);
             }

             return mergedDrop;
@@ -151,8 +144,7 @@
                 }
                 else
                 {
-                    // No _id, object cannot be merged therefore is it's own thing
-                    yield return new List<Dictionary<string, object>>() { drop };
+                    // Skip, noop
                 }
             }


Resolved #64

Resolved #64

--- Runtime/Helpers/HelperFramework.cs
+++ Runtime/Helpers/HelperFramework.cs
@@ -46,6 +46,26 @@
         fstr.Append(name);

         tr.name = fstr.ToString();
+      }
+    }
+
+
+    /// Use when an entity is an observer and you want to release this entity.
+    public static void ReleaseObserver(this ent entity)
+    {
+      if (entity.exist)
+      {
+        entity.ComponentObserver().length = 0;
+        entity.Release();
+      }
+    }
+
+    /// Use when an entity contains an observer and you want to stop the observer without releasing entity.
+    public static void StopObserver(this ent entity)
+    {
+      if (entity.exist)
+      {
+        entity.ComponentObserver().length = 0;
       }
     }


Updates version number

Updates version number

--- Development/PurpleKingdomGamesCore/Properties/AssemblyInfo.cs
+++ Development/PurpleKingdomGamesCore/Properties/AssemblyInfo.cs
@@ -33,6 +33,6 @@
 // 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.4.0")]
-[assembly: AssemblyFileVersion("1.0.4.0")]
+[assembly: AssemblyVersion("1.0.5.0")]
+[assembly: AssemblyFileVersion("1.0.5.0")]
 [assembly: NeutralResourcesLanguageAttribute("en-GB")]


Fixed correct recording of zero-length files

--- Duplicati/Library/Main/Operation/Backup/FileBlockProcessor.cs
+++ Duplicati/Library/Main/Operation/Backup/FileBlockProcessor.cs
@@ -79,10 +79,13 @@
                                 var lastread = 0;
                                 var buf = new byte[blocksize];
                                 var lastupdate = DateTime.Now;
+                                var firstBlock = true;

                                 // Core processing loop, read blocks of data and hash individually
-                                while((lastread = await fs.ForceStreamReadAsync(buf, blocksize)) != 0)
+                                while(((lastread = await fs.ForceStreamReadAsync(buf, blocksize)) != 0) || firstBlock)
                                 {
+                                    firstBlock = false;
+
                                     // Run file hashing concurrently to squeeze a little extra concurrency out of it
                                     var pftask = Task.Run(() => filehasher.TransformBlock(buf, 0, lastread, buf, 0));


Update JournalMarketSell.cs

Update JournalMarketSell.cs

--- EDDiscovery/EliteDangerous/JournalEvents/JournalMarketSell.cs
+++ EDDiscovery/EliteDangerous/JournalEvents/JournalMarketSell.cs
@@ -47,7 +47,7 @@
         public void Ledger(EDDiscovery2.DB.MaterialCommoditiesLedger mcl, DB.SQLiteConnectionUser conn)
         {
             EDDiscovery2.DB.MaterialCommodities mc = mcl.GetMaterialCommodity(EDDiscovery2.DB.MaterialCommodities.CommodityCategory, Type, conn);
-            mcl.AddEvent(Id, EventTimeUTC, EventTypeID, mc.name + " " + Count + " Avg " + AvgPricePaid, SellPrice, (double)(SellPrice - AvgPricePaid));
+            mcl.AddEvent(Id, EventTimeUTC, EventTypeID, mc.name + " " + Count + " Avg " + AvgPricePaid, TotalSale, (double)(SellPrice - AvgPricePaid));
         }

     }


fixed error in lastUpdatedBy

fixed error in lastUpdatedBy

--- Infrastructure.DataAccess/Interceptors/EFEntityInterceptor.cs
+++ Infrastructure.DataAccess/Interceptors/EFEntityInterceptor.cs
@@ -5,10 +5,12 @@
 using System.Data.Entity.Core.Metadata.Edm;
 using System.Data.Entity.Infrastructure.Interception;
 using System.Linq;
+using System.Runtime.InteropServices;
 using Core.Abstractions.Types;
 using Core.DomainModel;
 using Core.DomainServices.Context;
 using Core.DomainServices.Time;
+using EntityType = System.Data.Entity.Core.Metadata.Edm.EntityType;

 namespace Infrastructure.DataAccess.Interceptors
@@ -93,6 +95,15 @@
                 .Select(clause => ApplyUpdates(clause, updates))
                 .ToList();

+            var edmType = updateCommand.Target.VariableType.EdmType;
+            if (edmType is EntityType entityType)
+            {
+                if (entityType.Properties.Contains(LastChangedByUserIdColumnName))
+                {
+                    setClauses.Add(GetUpdateSetClause(LastChangedByUserIdColumnName, userId, updateCommand));
+                }
+            }
+
             return new DbUpdateCommandTree(
                 updateCommand.MetadataWorkspace,
                 updateCommand.DataSpace,
@@ -146,5 +157,18 @@
             //Return original
             return clause;
         }
+
+        private static DbSetClause GetUpdateSetClause(string column, DbExpression newValueToSetToDb, DbUpdateCommandTree updateCommand)
+        {
+            // Create the variable reference in order to create the property
+            var variableReference = updateCommand.Target.VariableType.Variable(updateCommand.Target.VariableName);
+
+            // Create the property to which will assign the correct value
+            var tenantProperty = variableReference.Property(column);
+
+            // Create the set clause, object representation of sql insert command
+            var newSetClause = DbExpressionBuilder.SetClause(tenantProperty, newValueToSetToDb);
+            return newSetClause;
+        }
     }
 }


Fixed null reference bug in template execution base.

--- IronVelocity.Tests/TemplateExecution/TemplateExecutionBase.cs
+++ IronVelocity.Tests/TemplateExecution/TemplateExecutionBase.cs
@@ -77,7 +77,11 @@
                 globalsDictionary = localsDictionary?.Where(x => x.Value != null).ToDictionary(x => x.Key, x => x.Value);

             fileName = fileName ?? Utility.GetName();
-            var template = CompileTemplate(input, fileName, new Dictionary<string, object>(globalsDictionary), customDirectives);
+            var globals2 = globalsDictionary != null
+                ? new Dictionary<string, object>(globalsDictionary)
+                : null;
+
+            var template = CompileTemplate(input, fileName, globals2, customDirectives);

             var context = new VelocityContext(localsDictionary);


Tweak cutoff effect for new Q value

Tweak cutoff effect for new Q value

--- osu.Game/Overlays/DialogOverlay.cs
+++ osu.Game/Overlays/DialogOverlay.cs
@@ -82,12 +82,14 @@
         {
             base.PopIn();
             this.FadeIn(PopupDialog.ENTER_DURATION, Easing.OutQuint);
-            lpFilter.CutoffTo(2000).Then().CutoffTo(150, 100, Easing.OutCubic);
+            lpFilter.CutoffTo(300, 100, Easing.OutCubic);
         }

         protected override void PopOut()
         {
             base.PopOut();
+
+            lpFilter.CutoffTo(lpFilter.MaxCutoff, 100, Easing.InCubic);

             if (CurrentDialog?.State.Value == Visibility.Visible)
             {
@@ -96,7 +98,6 @@
             }

             this.FadeOut(PopupDialog.EXIT_DURATION, Easing.InSine);
-            lpFilter.CutoffTo(2000, 100, Easing.InCubic).Then().CutoffTo(lpFilter.MaxCutoff);
         }

         public override bool OnPressed(KeyBindingPressEvent<GlobalAction> e)


Implement PrintSchema Document construct api

--- Kip/PrintSchemaDocument.cs
+++ Kip/PrintSchemaDocument.cs
@@ -16,6 +16,14 @@
         private List<ParameterDef> _parameters = new List<ParameterDef>();
         private List<Property> _properties = new List<Property>();

+        public Capabilities(params AddableToCapabilities[] elements)
+        {
+            foreach (var e in elements)
+            {
+                e.AddTo(this);
+            }
+        }
+
         public void Add(Feature feature)
         {
             _features.Add(feature);
@@ -70,6 +78,11 @@
         {
             return PrintSchemaReader.ReadCapabilities(reader);
         }
+    }
+
+    public interface AddableToCapabilities
+    {
+        void AddTo(Capabilities capablities);
     }

     public class Ticket
@@ -78,6 +91,14 @@
         private List<ParameterInit> _parameters = new List<ParameterInit>();
         private List<Property> _properties = new List<Property>();

+        public Ticket(params AddableToTicket[] elements)
+        {
+            foreach (var e in elements)
+            {
+                e.AddTo(this);
+            }
+        }
+
         public void Add(Feature feature)
         {
             _features.Add(feature);
@@ -124,7 +145,12 @@
         }
     }

-    public class Feature
+    public interface AddableToTicket
+    {
+        void AddTo(Ticket ticket);
+    }
+
+    public class Feature : AddableToCapabilities, AddableToTicket, AddableToFeature
     {
         private List<Property> _properties = new List<Property>();
         private List<Option> _options = new List<Option>();
@@ -135,6 +161,15 @@
             Name = name;
         }

+        public Feature(XName name, params AddableToFeature[] elements)
+        {
+            Name = name;
+            foreach (var e in elements)
+            {
+                e.AddTo(this);
+            }
+        }
+
         public XName Name
         {
             get;
@@ -179,6 +214,26 @@
         {
             return _features.FirstOrDefault(x => x.Name == name);
         }
+
+        void AddableToCapabilities.AddTo(Capabilities capablities)
+        {
+            capablities.Add(this);
+        }
+
+        void AddableToTicket.AddTo(Ticket ticket)
+        {
+            ticket.Add(this);
+        }
+
+        void AddableToFeature.AddTo(Feature feature)
+        {
+            feature.Add(this);
+        }
+    }
+
+    public interface AddableToFeature
+    {
+        void AddTo(Feature feature);
     }

     public sealed class Constraint
@@ -231,24 +286,30 @@
     }

-    public class Option
+    public class Option : AddableToFeature
     {
         private List<Property> _properties = new List<Property>();
         private List<ScoredProperty> _scoredProperty = new List<ScoredProperty>();

-        public Option()
-        {
-        }
-
-        public Option(XName name)
-        {
-            Name = name;
-        }
-
-        public Option(XName name, XName constrained)
+        public Option(params AddableToOption[] elements)
+            : this(null, null, elements)
+        {
+        }
+
+        public Option(XName name, params AddableToOption[] elements)
+            : this(name, null, elements)
+        {
+        }
+
+        public Option(XName name, XName constrained, params AddableToOption[] elements)
         {
             Name = name;
             Constrained = constrained;
+
+            foreach (var e in elements)
+            {
+                e.AddTo(this);
+            }
         }

         public XName Name
@@ -290,15 +351,30 @@
         {
             return _scoredProperty.FirstOrDefault(x => x.Name == name);
         }
-    }
-
-    public class ParameterDef
+
+        void AddableToFeature.AddTo(Feature feature)
+        {
+            feature.Add(this);
+        }
+    }
+
+    public interface AddableToOption
+    {
+        void AddTo(Option option);
+    }
+
+    public class ParameterDef : AddableToCapabilities
     {
         private List<Property> _properties = new List<Property>();

-        public ParameterDef(XName name)
+        public ParameterDef(XName name, params Property[] properties)
         {
             Name = name;
+
+            foreach (var p in properties)
+            {
+                Add(p);
+            }
         }

         public XName Name
@@ -320,9 +396,14 @@
         {
             return _properties.FirstOrDefault(x => x.Name == name);
         }
-    }
-
-    public class ParameterInit
+
+        void AddableToCapabilities.AddTo(Capabilities capablities)
+        {
+            capablities.Add(this);
+        }
+    }
+
+    public class ParameterInit : AddableToTicket
     {
         public ParameterInit(XName name)
             : this(name, null)
@@ -344,6 +425,11 @@
         {
             get; set;
         }
+
+        void AddableToTicket.AddTo(Ticket ticket)
+        {
+            ticket.Add(this);
+        }
     }

     public class ParameterRef
@@ -360,13 +446,29 @@
     }

     public class Property
+        : AddableToCapabilities
+        , AddableToTicket
+        , AddableToFeature
+        , AddableToOption
+        , AddableToProperty
+        , AddableToScoredProperty
     {
         private List<Property> _properties = new List<Property>();

-        public Property(XName name, Value value = null)
+        public Property(XName name, params AddableToProperty[] elements)
+            : this(name, null, elements)
+        {
+        }
+
+        public Property(XName name, Value value, params AddableToProperty[] elements)
         {
             Name = name;
             Value = value;
+
+            foreach (var e in elements)
+            {
+                e.AddTo(this);
+            }
         }

         public XName Name
@@ -394,16 +496,68 @@
         {
             return _properties.FirstOrDefault(x => x.Name == name);
         }
-    }
-
-    public class ScoredProperty
+
+        void AddableToCapabilities.AddTo(Capabilities capablities)
+        {
+            capablities.Add(this);
+        }
+
+        void AddableToTicket.AddTo(Ticket ticket)
+        {
+            ticket.Add(this);
+        }
+
+        void AddableToFeature.AddTo(Feature feature)
+        {
+            feature.Add(this);
+        }
+
+        void AddableToOption.AddTo(Option option)
+        {
+            option.Add(this);
+        }
+
+        void AddableToProperty.AddTo(Property property)
+        {
+            property.Add(this);
+        }
+
+        void AddableToScoredProperty.AddTo(ScoredProperty property)
+        {
+            property.Add(this);
+        }
+    }
+
+    public interface AddableToProperty
+    {
+        void AddTo(Property property);
+    }
+
+    public class ScoredProperty : AddableToOption, AddableToScoredProperty
     {
         private List<ScoredProperty> _scoredProperties = new List<ScoredProperty>();
         private List<Property> _properties = new List<Property>();

-        public ScoredProperty(XName name)
+        public ScoredProperty(XName name, params AddableToScoredProperty[] elements)
         {
             Name = name;
+
+            foreach (var e in elements)
+            {
+                e.AddTo(this);
+            }
+        }
+
+        public ScoredProperty(XName name, Value value, params AddableToScoredProperty[] elements)
+            : this(name, elements)
+        {
+            Value = value;
+        }
+
+        public ScoredProperty(XName name, ParameterRef parameter, params AddableToScoredProperty[] elements)
+            : this(name, elements)
+        {
+            ParameterRef = parameter;
         }

         public XName Name
@@ -450,6 +604,21 @@
         {
             return _properties.FirstOrDefault(x => x.Name == name);
         }
+
+        void AddableToOption.AddTo(Option option)
+        {
+            option.Add(this);
+        }
+
+        void AddableToScoredProperty.AddTo(ScoredProperty property)
+        {
+            property.Add(this);
+        }
+    }
+
+    public interface AddableToScoredProperty
+    {
+        void AddTo(ScoredProperty property);
     }

     public sealed class Value


Update Form1.Designer.cs

Update Form1.Designer.cs

--- LeapFrog/Form1.Designer.cs
+++ LeapFrog/Form1.Designer.cs
@@ -105,8 +105,6 @@
 			this.MinimumSize = new System.Drawing.Size(800, 800);
 			this.Name = "Form1";
 			this.Text = "Form1";
-			this.ResizeBegin += new System.EventHandler(this.Form1_ResizeBegin);
-			this.ResizeEnd += new System.EventHandler(this.Form1_ResizeEnd);
 			this.Paint += new System.Windows.Forms.PaintEventHandler(this.Form1_Paint);
 			this.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.Form1_KeyPress);
 			this.statusStrip1.ResumeLayout(false);


Update kod.cs

Update kod.cs

Druga wersja

--- kod.cs
+++ kod.cs
@@ -1 +1,3 @@
 int a = 2;
+
+ConsoleWriteLine(a);


Cache method value.

Cache method value.

--- src/Avalonia.Base/Utilities/WeakEventHandlerManager.cs
+++ src/Avalonia.Base/Utilities/WeakEventHandlerManager.cs
@@ -142,10 +142,12 @@
                     _data = ndata;
                 }

+                MethodInfo method = s.Method;
+
                 var subscriber = (TSubscriber)s.Target;
-                if (!s_Callers.TryGetValue(s.Method, out var caller))
-                    s_Callers[s.Method] = caller =
-                        (CallerDelegate)Delegate.CreateDelegate(typeof(CallerDelegate), null, s.Method);
+                if (!s_Callers.TryGetValue(method, out var caller))
+                    s_Callers[method] = caller =
+                        (CallerDelegate)Delegate.CreateDelegate(typeof(CallerDelegate), null, method);
                 _data[_count] = new Descriptor
                 {
                     Caller = caller,


Attempt to fix a race condition in TestBinaryLogRoundtrip. (#1870)

My hypothesis is that when serializing properties of a ProjectStartedEventArgs we were iterating over the properties twice, first to establish count and the second time to actually write the items.

By inspecting the binary stream I've found that the log expected to find 166 property name/value pairs, but in the stream there's actually a 167th:

"SBuildLastTaskResult\u0004true\u0001\bTestItem\u0004Test\0\v5#Building with tools version \"15.0"

So I'm guessing is that the MSBuildLastTaskResult property is being set to true right after we grab the property count, but before we iterate over the properties. At least that would explain the extra property in the stream that we don't expect.

In any case the change seems good and I'd like to get this in (I'm 60% positive this will fix it).

--- src/Build/Logging/BinaryLogger/BuildEventArgsWriter.cs
+++ src/Build/Logging/BinaryLogger/BuildEventArgsWriter.cs
@@ -434,8 +434,9 @@
             }

             var entries = items.OfType<DictionaryEntry>()
-                .Where(e => e.Key is string && e.Value is ITaskItem);
-            Write(entries.Count());
+                .Where(e => e.Key is string && e.Value is ITaskItem)
+                .ToArray();
+            Write(entries.Length);

             foreach (DictionaryEntry entry in entries)
             {
@@ -467,9 +468,13 @@
                 return;
             }

-            Write(properties.Cast<object>().Count());
-
-            foreach (DictionaryEntry entry in properties)
+            // there are no guarantees that the properties iterator won't change, so
+            // take a snapshot and work with the readonly copy
+            var propertiesArray = properties.OfType<DictionaryEntry>().ToArray();
+
+            Write(propertiesArray.Length);
+
+            foreach (DictionaryEntry entry in propertiesArray)
             {
                 if (entry.Key is string && entry.Value is string)
                 {


Revert "Try adding start/end"

Revert "Try adding start/end"

This reverts commit 216b574c4dd092dbf0f136276a7d7bb71dc2723a.

--- src/Cash-Flow-Projection/Controllers/HomeController.cs
+++ src/Cash-Flow-Projection/Controllers/HomeController.cs
@@ -173,8 +173,7 @@
                 return new StringBuilder()
                     .AppendLine("BEGIN:VEVENT")
                     .AppendLine($"SUMMARY:{entry.Description} ").AppendLine($"{entry.Amount:c}")
-                    .AppendLine("DTSTART:VALUE=DATE:" + entry.Date.ToString("yyyyMMdd"))
-                    .AppendLine("DTEND:VALUE=DATE:" + entry.Date.ToString("yyyyMMdd"))
+                    .AppendLine("DTSTART:" + entry.Date.ToString("yyyyMMdd"))
                     .AppendLine("LAST-MODIFIED:" + DateTime.UtcNow.ToString(DateFormat))
                     .AppendLine("UID:" + entry.id)
                     .AppendLine("DTSTAMP:" + DateTime.UtcNow.ToString(DateFormat))
@@ -188,8 +187,7 @@
             var sb = new StringBuilder()
                 .AppendLine("BEGIN:VCALENDAR")
                 .AppendLine("VERSION:2.0")
-                .AppendLine("PRODID:-//Red-Leg-Dev//Cash Flow Projections//EN")
-                .AppendLine("CALSCALE:GREGORIAN")
+                .AppendLine("PRODID:-//Red-Leg-Dev//Cash Flow Projections//EN")
                 .AppendLine("METHOD:PUBLISH");

             foreach (var entry in db.Entries.SinceBalance(DateTime.Today.AddYears(1)))


Fix mono bug in the FontHelper class

Fix mono bug in the FontHelper class

--- PalasoUIWindowsForms.Tests/FontTests/FontHelperTests.cs
+++ PalasoUIWindowsForms.Tests/FontTests/FontHelperTests.cs
@@ -1,6 +1,5 @@
 using System;
 using System.Drawing;
-using System.Linq;
 using NUnit.Framework;
 using Palaso.UI.WindowsForms;

@@ -30,22 +29,5 @@
 			Assert.AreEqual(sourceFont.FontFamily.Name, returnFont.FontFamily.Name);
 		}

-		[Test]
-		public void MakeFont_FontNameAndStyle_ValidFont()
-		{
-			// use Times New Roman
-			foreach (var family in FontFamily.Families.Where(family => family.Name == "Times New Roman"))
-			{
-				Font sourceFont = new Font(family, 10f, FontStyle.Regular);
-				Font returnFont = FontHelper.MakeFont(sourceFont, FontStyle.Bold);
-
-				Assert.AreEqual(sourceFont.FontFamily.Name, returnFont.FontFamily.Name);
-				Assert.AreEqual(FontStyle.Bold, returnFont.Style & FontStyle.Bold);
-
-				break;
-			}
-
-			Assert.IsTrue(true);
-		}
 	}
 }