Add regression test for #2000

Add regression test for #2000

--- StyleCop.Analyzers/StyleCop.Analyzers.Test/OrderingRules/SA1211UnitTests.cs
+++ StyleCop.Analyzers/StyleCop.Analyzers.Test/OrderingRules/SA1211UnitTests.cs
@@ -196,6 +196,38 @@
             await this.VerifyCSharpFixAsync(testCode, fixedTestCode).ConfigureAwait(false);
         }

+        /// <summary>
+        /// Verifies that the analyzer will not combine using directives that refer to the same type. This is a
+        /// regression test for DotNetAnalyzers/StyleCopAnalyzers#2000.
+        /// </summary>
+        /// <returns>A <see cref="Task"/> representing the asynchronous unit test.</returns>
+        [Fact]
+        public async Task TestSameUsingWithDifferentAliasAsync()
+        {
+            string testCode = @"namespace NamespaceName
+{
+    using Func2 = System.Func<int>;
+    using Func1 = System.Func<int>;
+
+    internal delegate void DelegateName(Func1 arg1, Func2 arg2);
+}
+";
+            string fixedCode = @"namespace NamespaceName
+{
+    using Func1 = System.Func<int>;
+    using Func2 = System.Func<int>;
+
+    internal delegate void DelegateName(Func1 arg1, Func2 arg2);
+}
+";
+
+            var expected = this.CSharpDiagnostic().WithLocation(4, 5).WithArguments("Func1", "Func2");
+
+            await this.VerifyCSharpDiagnosticAsync(testCode, expected, CancellationToken.None).ConfigureAwait(false);
+            await this.VerifyCSharpDiagnosticAsync(fixedCode, EmptyDiagnosticResults, CancellationToken.None).ConfigureAwait(false);
+            await this.VerifyCSharpFixAsync(testCode, fixedCode, cancellationToken: CancellationToken.None).ConfigureAwait(false);
+        }
+
         /// <inheritdoc/>
         protected override IEnumerable<DiagnosticAnalyzer> GetCSharpDiagnosticAnalyzers()
         {


Fix the LEGO solver not running the chained command properly

--- TwitchPlaysAssembly/Src/ComponentSolvers/Modded/Misc/LEGOComponentSolver.cs
+++ TwitchPlaysAssembly/Src/ComponentSolvers/Modded/Misc/LEGOComponentSolver.cs
@@ -113,7 +113,7 @@
 	protected override IEnumerator ForcedSolveIEnumerator()
 	{
 		yield return null;
-		yield return RespondToCommandInternal("right 8;clear"); // Move to the build page and clear.
+		yield return ChainCommand("right 8;clear"); // Move to the build page and clear.

 		int[] shiftedSolution = _component.CallMethod<int[]>("ShiftGrid", _component.GetValue<int[]>("SolutionDisplay"));
 		for (int i = 1; i <= shiftedSolution.Max(); i++)


Fix issues related to the slot numbers in passwords

--- TwitchPlaysAssembly/Src/ComponentSolvers/Vanilla/PasswordComponentSolver.cs
+++ TwitchPlaysAssembly/Src/ComponentSolvers/Vanilla/PasswordComponentSolver.cs
@@ -40,7 +40,7 @@
 			var slots = new HashSet<int>();
 			foreach (var piece in m.Groups[1].Value.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries))
 			{
-				if (!int.TryParse(piece, out var i))
+				if (!int.TryParse(piece, out var i) || i < 1 || i > 5)
 				{
 					yield return string.Format("sendtochaterror “{0}” is not a number from 1 to 5.", piece);
 					yield break;
@@ -52,7 +52,7 @@
 				yield return "password";
 				foreach (var slot in slots)
 				{
-					IEnumerator spinnerCoroutine = CycleCharacterSpinnerCoroutine(_spinners[slot]);
+					IEnumerator spinnerCoroutine = CycleCharacterSpinnerCoroutine(_spinners[slot - 1]);
 					while (spinnerCoroutine.MoveNext())
 						yield return spinnerCoroutine.Current;
 				}


rename

rename

--- LiveRoku/MainWindow.xaml.cs
+++ LiveRoku/MainWindow.xaml.cs
@@ -118,7 +118,7 @@
             if(ctx != null) {
                 ctx.Fetcher?.stop();
                 ctx.Fetcher?.Dispose();
-                Parallel.ForEach(ctx.Plugins, plugin => {
+                ctx.Plugins.ForEach(plugin => {
                     Utils.runSafely(() => plugin.onDetach(ctx));
                 });
                 //assign settings


need an easier way to update the DB

need an easier way to update the DB

--- MIMEngine/Core/Item/Item.cs
+++ MIMEngine/Core/Item/Item.cs
@@ -9,8 +9,10 @@
     public class Item :BaseItem
     {
         public List<Item> containerItems;
-
-
+        public string attackType { get; set; }
+        public string weaponType { get; set; }
+        public int weaponSpeed { get; set; }
+
     }


clarifying comment

clarifying comment

--- Mapsui.UI.Uwp/MapControl.cs
+++ Mapsui.UI.Uwp/MapControl.cs
@@ -79,6 +79,7 @@
             ManipulationMode = ManipulationModes.Scale | ManipulationModes.TranslateX | ManipulationModes.TranslateY | ManipulationModes.Rotate;
             ManipulationDelta += OnManipulationDelta;
             ManipulationCompleted += OnManipulationCompleted;
+            //see event handler for how to force re-draw while manipulation is occuring
             ManipulationStarted += OnManipulationStarted;
             ManipulationInertiaStarting += OnManipulationInertiaStarting;


Limiting in wpf on mouse drag

Limiting in wpf on mouse drag

--- Mapsui.UI.Wpf/MapControl.cs
+++ Mapsui.UI.Wpf/MapControl.cs
@@ -397,6 +397,9 @@
                 }

                 _viewport.Transform(_currentMousePosition, _previousMousePosition);
+                // Viewport has no internal limiter so we need to explicitly limit it here. This could be improved.
+                Map.Limiter.LimitExtent(_viewport, Map.Envelope);
+
                 RefreshGraphics();

                 _previousMousePosition = _currentMousePosition;


formatting

formatting

--- ksp_plugin_adapter/ksp_plugin_adapter.cs
+++ ksp_plugin_adapter/ksp_plugin_adapter.cs
@@ -835,9 +835,14 @@
       --index;
       changed = true;
     }
+    UnityEngine.TextAnchor old_alignment =
+        UnityEngine.GUI.skin.textArea.alignment;
+    UnityEngine.GUI.skin.textArea.alignment =
+        UnityEngine.TextAnchor.MiddleRight;
     UnityEngine.GUILayout.TextArea(
         text    : String.Format(format, array[index]),
-        options : UnityEngine.GUILayout.Width(100));
+        options : UnityEngine.GUILayout.Width(75));
+    UnityEngine.GUI.skin.textArea.alignment = old_alignment;
     if (UnityEngine.GUILayout.Button(
             text    : index == array.Length - 1 ? "max" : "+",
             options : UnityEngine.GUILayout.Width(50)) &&
@@ -858,12 +863,12 @@
              ref prediction_step_index_,
              "Step count (computational cost)",
              ref changed_settings,
-             "{0,6:###,###}");
+             "{0:###,###}");
     Selector(prediction_lengths_,
              ref prediction_length_index_,
              "Length",
              ref changed_settings,
-             "{0:000e0} s");
+             "{0:0.00e0} s");
     if (changed_settings) {
       ResetRenderedTrajectory();
     }


IDispatcher defined

IDispatcher defined

--- relmah/src/RElmah/Contracts.cs
+++ relmah/src/RElmah/Contracts.cs
@@ -26,4 +26,15 @@
     {
         Task Store(ErrorPayload payload);
     }
+
+    /// <summary>
+    /// This contract represents an errors
+    /// dispatcher, which is able to route
+    /// errors to the right destination(s)
+    /// as soon as they get in.
+    /// </summary>
+    public interface IDispatcher
+    {
+        Task DispatchError(ErrorPayload payload);
+    }
 }


ScrubbingJobController validates duration of input file, and throws an exception if it's 0 (or below).

--- ffmpeg-farm-server/API.WindowsService/Controllers/ScrubbingJobController.cs
+++ ffmpeg-farm-server/API.WindowsService/Controllers/ScrubbingJobController.cs
@@ -68,6 +68,9 @@

             var jobs = new List<ScrubbingJob>();
             var info = _helper.GetMediainfo(sourceFilename);
+            if (info.Duration <= 0)
+                throw new InvalidDataException($"Scrubbing request failed. Input file is invalid. Duration: {info.Duration} sec.");
+
             foreach (var spriteSheetSize in jobRequest.SpriteSheetSizes)
             {
                 var numberOfThumbnailsPerFile = spriteSheetSize.SpriteSheetTiles(out var hTiles, out var vTiles);


Changed site name

Changed site name

--- source/Core.TestServices/TestCoreSettings.cs
+++ source/Core.TestServices/TestCoreSettings.cs
@@ -148,7 +148,7 @@

         public string GetSiteName()
         {
-            return "tt.IdSrv 3";
+            return "IdentityServer v3 - alpha1";
         }


#143 Wrong key was used

#143 Wrong key was used

--- source/FFImageLoading.Shared/ImageService.cs
+++ source/FFImageLoading.Shared/ImageService.cs
@@ -345,14 +345,15 @@
 		{
 			InitializeIfNeeded();

-			if (!(await Config.DiskCache.ExistsAsync(string.IsNullOrWhiteSpace(customCacheKey) ? imageUrl : customCacheKey)))
-			{
-				string fileName = string.IsNullOrWhiteSpace(customCacheKey) ? _md5Helper.MD5(imageUrl) : _md5Helper.MD5(customCacheKey);
+			string fileName = string.IsNullOrWhiteSpace(customCacheKey) ? _md5Helper.MD5(imageUrl) : _md5Helper.MD5(customCacheKey);
+
+			if (!(await Config.DiskCache.ExistsAsync(fileName)))
+			{
 				string filePath = await Config.DiskCache.GetFilePathAsync(fileName);
 				await Config.DownloadCache.DownloadBytesAndCacheAsync(imageUrl, fileName, filePath, cancellationToken, duration);

 				return true;
-			}
+			}

 			return false;
 		}


Remove CanGetColymns test SQLServer override

--- test/SimpleStack.Orm.Tests/ExpressionTests.cs
+++ test/SimpleStack.Orm.Tests/ExpressionTests.cs
@@ -254,56 +254,57 @@
             // Not supported
         }

-        public override void CanGetColumns()
-        {
-            using (var db = OpenDbConnection())
-            {
-                db.CreateTable<TestType2>(true);
-                var columns = db.GetTableColumns("TestType2").ToArray();
-                Assert.AreEqual(9, columns.Length);
-
-                Assert.AreEqual("id", columns[0].Name.ToLower());
-                Assert.True(columns[0].PrimaryKey);
-                Assert.AreEqual(DbType.Int32, columns[0].DbType);
-                Assert.False(columns[0].Nullable);
-
-                Assert.AreEqual("textcol", columns[1].Name.ToLower());
-                Assert.AreEqual(false, columns[1].PrimaryKey);
-                Assert.AreEqual(DbType.String, columns[1].DbType);
-                Assert.True(columns[1].Nullable);
-
-                Assert.AreEqual("boolcol", columns[2].Name.ToLower());
-                Assert.AreEqual(false, columns[2].PrimaryKey);
-                Assert.AreEqual(DbType.Boolean, columns[2].DbType);
-                Assert.False(columns[2].Nullable);
-
-                Assert.AreEqual("datecol", columns[3].Name.ToLower());
-                Assert.AreEqual(false, columns[3].PrimaryKey);
-                Assert.AreEqual(DbType.DateTime, columns[3].DbType);
-                Assert.False(columns[3].Nullable);
-
-                Assert.AreEqual("nullabledatecol", columns[4].Name.ToLower());
-                Assert.False(columns[4].PrimaryKey);
-                Assert.AreEqual(DbType.DateTime, columns[4].DbType);
-                Assert.True(columns[4].Nullable);
-
-                Assert.AreEqual("enumcol", columns[5].Name.ToLower());
-                Assert.AreEqual(false, columns[5].PrimaryKey);
-                Assert.AreEqual(DbType.Int32, columns[5].DbType);
-
-                Assert.AreEqual("guidcol", columns[6].Name.ToLower());
-                Assert.AreEqual(false, columns[6].PrimaryKey);
-                Assert.AreEqual(DbType.Guid, columns[6].DbType);
-
-                Assert.AreEqual("complexobjcol", columns[7].Name.ToLower());
-                Assert.AreEqual(false, columns[7].PrimaryKey);
-                Assert.AreEqual(DbType.String, columns[7].DbType);
-
-                Assert.AreEqual("longcol", columns[8].Name.ToLower());
-                Assert.AreEqual(false, columns[8].PrimaryKey);
-                Assert.AreEqual(DbType.Int64, columns[8].DbType);
-            }
-        }
+        // [Test]
+        // public override void CanGetColumns()
+        // {
+        //     using (var db = OpenDbConnection())
+        //     {
+        //         db.CreateTable<TestType2>(true);
+        //         var columns = db.GetTableColumns("TestType2").ToArray();
+        //         Assert.AreEqual(8, columns.Length);
+        //
+        //         Assert.AreEqual("id", columns[0].Name.ToLower());
+        //         Assert.True(columns[0].PrimaryKey);
+        //         Assert.AreEqual(DbType.Int32, columns[0].DbType);
+        //         Assert.False(columns[0].Nullable);
+        //
+        //         Assert.AreEqual("textcol", columns[1].Name.ToLower());
+        //         Assert.AreEqual(false, columns[1].PrimaryKey);
+        //         Assert.AreEqual(DbType.String, columns[1].DbType);
+        //         Assert.True(columns[1].Nullable);
+        //
+        //         Assert.AreEqual("boolcol", columns[2].Name.ToLower());
+        //         Assert.AreEqual(false, columns[2].PrimaryKey);
+        //         Assert.AreEqual(DbType.Boolean, columns[2].DbType);
+        //         Assert.False(columns[2].Nullable);
+        //
+        //         Assert.AreEqual("datecol", columns[3].Name.ToLower());
+        //         Assert.AreEqual(false, columns[3].PrimaryKey);
+        //         Assert.AreEqual(DbType.DateTime, columns[3].DbType);
+        //         Assert.False(columns[3].Nullable);
+        //
+        //         Assert.AreEqual("nullabledatecol", columns[4].Name.ToLower());
+        //         Assert.False(columns[4].PrimaryKey);
+        //         Assert.AreEqual(DbType.DateTime, columns[4].DbType);
+        //         Assert.True(columns[4].Nullable);
+        //
+        //         Assert.AreEqual("enumcol", columns[5].Name.ToLower());
+        //         Assert.AreEqual(false, columns[5].PrimaryKey);
+        //         Assert.AreEqual(DbType.Int32, columns[5].DbType);
+        //
+        //         Assert.AreEqual("guidcol", columns[6].Name.ToLower());
+        //         Assert.AreEqual(false, columns[6].PrimaryKey);
+        //         Assert.AreEqual(DbType.Guid, columns[6].DbType);
+        //
+        //         Assert.AreEqual("complexobjcol", columns[7].Name.ToLower());
+        //         Assert.AreEqual(false, columns[7].PrimaryKey);
+        //         Assert.AreEqual(DbType.String, columns[7].DbType);
+        //
+        //         Assert.AreEqual("longcol", columns[8].Name.ToLower());
+        //         Assert.AreEqual(false, columns[8].PrimaryKey);
+        //         Assert.AreEqual(DbType.Int64, columns[8].DbType);
+        //     }
+        // }
     }

     public class SQLLiteTests : ExpressionTests


Added resource cleanup on start/stop testing (#47)

--- src/Akka.Streams.Kafka.Tests/KafkaFixture.cs
+++ src/Akka.Streams.Kafka.Tests/KafkaFixture.cs
@@ -23,10 +23,13 @@
         private const string KafkaImageTag = "5.3.0";
         private const string ZookeeperImageName = "confluentinc/cp-zookeeper";
         private const string ZookeeperImageTag = "5.3.0";
-
-        private readonly string _kafkaContainerName = $"kafka-{Guid.NewGuid():N}";
-        private readonly string _zookeeperContainerName = $"zookeeper-{Guid.NewGuid():N}";
-        private readonly string _networkName = $"network-{Guid.NewGuid():N}";
+
+        private const string KafkaContainerNameBase = "akka.net-kafka-test";
+        private const string ZookeeperContainerNameBase = "akka.net-zookeeper-test";
+        private const string NetworkNameBase = "akka.net-network-test";
+        private readonly string _kafkaContainerName = $"{KafkaContainerNameBase}-{Guid.NewGuid():N}";
+        private readonly string _zookeeperContainerName = $"{ZookeeperContainerNameBase}-{Guid.NewGuid():N}";
+        private readonly string _networkName = $"{NetworkNameBase}-{Guid.NewGuid():N}";

         private readonly DockerClient _client;

@@ -55,6 +58,9 @@
             // Generate random ports for zookeeper and kafka
             var zookeeperPort = ThreadLocalRandom.Current.Next(32000, 33000);
             KafkaPort = ThreadLocalRandom.Current.Next(28000, 29000);
+
+            // Make resources cleanup before allocating new containers/networks
+            await ResourceCleanup();

             // create the containers
             await CreateContainer(ZookeeperImageName, ZookeeperImageTag, _zookeeperContainerName, zookeeperPort, new Dictionary<string, string>()
@@ -72,15 +78,6 @@
                 ["KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR"] = "1"
             });

-            /*
-            // Remove old networks, if there are any
-            var networks = await _client.Networks.ListNetworksAsync(new NetworksListParameters());
-            foreach (var existingNetwork in networks.Where(n => n.Name.StartsWith("network-")))
-            {
-                await _client.Networks.DeleteNetworkAsync(existingNetwork.ID);
-            }
-            */
-
             // Setting up network for containers to communicate
             var network = await _client.Networks.CreateNetworkAsync(new NetworksCreateParameters(new NetworkCreate())
             {
@@ -107,19 +104,59 @@
         {
             if (_client != null)
             {
-                // Stop Kafka
-                await _client.Containers.StopContainerAsync(_kafkaContainerName, new ContainerStopParameters());
-                await _client.Containers.RemoveContainerAsync(_kafkaContainerName, new ContainerRemoveParameters { Force = true });
-
-                // Stop Zookeeper
-                await _client.Containers.StopContainerAsync(_zookeeperContainerName, new ContainerStopParameters());
-                await _client.Containers.RemoveContainerAsync(_zookeeperContainerName, new ContainerRemoveParameters { Force = true });
-
-                // Delete network between containers
-                await _client.Networks.DeleteNetworkAsync(_networkName);
+                await ResourceCleanup();

                 _client.Dispose();
             }
+        }
+
+        /// <summary>
+        /// This performs cleanup of allocated containers/networks during tests
+        /// </summary>
+        /// <returns></returns>
+        private async Task ResourceCleanup()
+        {
+            if (_client == null)
+                return;
+
+            // This task loads list of containers and stops/removes those which were started during tests
+            var containerCleanupTask = _client.Containers.ListContainersAsync(new ContainersListParameters()).ContinueWith(
+                async t =>
+                {
+                    if (t.IsFaulted)
+                        return;
+
+                    var containersToStop = t.Result.Where(c => c.Names.Any(name => name.Contains(KafkaContainerNameBase)) ||
+                                                               c.Names.Any(name => name.Contains(ZookeeperContainerNameBase)));
+
+                    var stopTasks = containersToStop.Select(async container =>
+                    {
+                        await _client.Containers.StopContainerAsync(container.ID, new ContainerStopParameters());
+                        await _client.Containers.RemoveContainerAsync(container.ID, new ContainerRemoveParameters { Force = true });
+                    });
+                    await Task.WhenAll(stopTasks);
+                }).Unwrap();
+
+            // This tasks loads docker networks and removes those which were started during tests
+            var networkCleanupTask = _client.Networks.ListNetworksAsync(new NetworksListParameters()).ContinueWith(
+                async t =>
+                {
+                    if (t.IsFaulted)
+                        return;
+
+                    var networksToDelete = t.Result.Where(network => network.Name.Contains(NetworkNameBase));
+
+                    var deleteTasks = networksToDelete.Select(network => _client.Networks.DeleteNetworkAsync(network.ID));
+
+                    await Task.WhenAll(deleteTasks);
+                });
+
+            try
+            {
+                // Wait until cleanup is finished
+                await Task.WhenAll(containerCleanupTask, networkCleanupTask);
+            }
+            catch { /* If the cleanup failes, this is not the reason to fail tests */ }
         }

         private async Task CreateContainer(string imageName, string imageTag, string containerName, int portToExpose, Dictionary<string, string> env)


Improved DragSource

Improved DragSource

the drag source now gets the preferred drag effect and handles keyboard
inputs too

--- src/Avalonia.Controls/DragDrop/DragSource.cs
+++ src/Avalonia.Controls/DragDrop/DragSource.cs
@@ -19,13 +19,14 @@
         private const InputModifiers MOUSE_INPUTMODIFIERS = InputModifiers.LeftMouseButton|InputModifiers.MiddleMouseButton|InputModifiers.RightMouseButton;
         private readonly IDragDropDevice _dragDrop;
         private readonly IInputManager _inputManager;
-
-
         private readonly Subject<DragDropEffects> _result = new Subject<DragDropEffects>();
+
+        private DragDropEffects _allowedEffects;
         private IDataObject _draggedData;
         private IInputElement _lastRoot;
+        private Point _lastPosition;
+        private object _lastCursor;
         private InputModifiers? _initialInputModifiers;
-        private object _lastCursor;

         public DragSource()
         {
@@ -40,35 +41,58 @@
             {
                 _draggedData = data;
                 _lastRoot = null;
-
-                using (_inputManager.PreProcess.OfType<RawMouseEventArgs>().Subscribe(e => ProcessMouseEvents(e, allowedEffects)))
-                {
-                    var effect = await _result.FirstAsync();
-                    return effect;
+                _lastPosition = default(Point);
+                _allowedEffects = allowedEffects;
+
+                using (_inputManager.PreProcess.OfType<RawMouseEventArgs>().Subscribe(ProcessMouseEvents))
+                {
+                    using (_inputManager.PreProcess.OfType<RawKeyEventArgs>().Subscribe(ProcessKeyEvents))
+                    {
+                        var effect = await _result.FirstAsync();
+                        return effect;
+                    }
                 }
             }
             return DragDropEffects.None;
         }

-        private DragDropEffects RaiseDragEvent(RawDragEventType type, IInputElement root, Point pt, DragDropEffects allowedEffects)
-        {
-            RawDragEvent rawEvent = new RawDragEvent(_dragDrop, type, root, pt, _draggedData, allowedEffects);
+
+        private DragDropEffects RaiseEventAndUpdateCursor(RawDragEventType type, IInputElement root, Point pt, InputModifiers modifiers)
+        {
+            _lastPosition = pt;
+
+            RawDragEvent rawEvent = new RawDragEvent(_dragDrop, type, root, pt, _draggedData, _allowedEffects);
             var tl = root.GetSelfAndVisualAncestors().OfType<TopLevel>().FirstOrDefault();
             tl.PlatformImpl.Input(rawEvent);
-
-            SetCursor(root, rawEvent.Effects);
-            return rawEvent.Effects;
+
+            var effect = GetPreferredEffect(rawEvent.Effects & _allowedEffects, modifiers);
+            UpdateCursor(root, effect);
+            return effect;
+        }
+
+        private DragDropEffects GetPreferredEffect(DragDropEffects effect, InputModifiers modifiers)
+        {
+            if (effect == DragDropEffects.Copy || effect == DragDropEffects.Move || effect == DragDropEffects.Link || effect == DragDropEffects.None)
+                return effect; // No need to check for the modifiers.
+            if (effect.HasFlag(DragDropEffects.Link) && modifiers.HasFlag(InputModifiers.Alt))
+                return DragDropEffects.Link;
+            if (effect.HasFlag(DragDropEffects.Copy) && modifiers.HasFlag(InputModifiers.Control))
+                return DragDropEffects.Copy;
+            return DragDropEffects.Move;
         }

         private Cursor GetCursorForDropEffect(DragDropEffects effects)
         {
-            // Todo. Needs to choose cursor by effect.
-            if (effects == DragDropEffects.None)
-                return new Cursor(StandardCursorType.No);
-            return new Cursor(StandardCursorType.Hand);
+            if (effects.HasFlag(DragDropEffects.Copy))
+                return new Cursor(StandardCursorType.DragCopy);
+            if (effects.HasFlag(DragDropEffects.Move))
+                return new Cursor(StandardCursorType.DragMove);
+            if (effects.HasFlag(DragDropEffects.Link))
+                return new Cursor(StandardCursorType.DragLink);
+            return new Cursor(StandardCursorType.No);
         }

-        private void SetCursor(IInputElement root, DragDropEffects effect)
+        private void UpdateCursor(IInputElement root, DragDropEffects effect)
         {
             if (_lastRoot != root)
             {
@@ -96,25 +120,45 @@
             if (root is InputElement ie)
                 ie.Cursor = GetCursorForDropEffect(effect);
         }
-
-        private void ProcessMouseEvents(RawMouseEventArgs e, DragDropEffects allowedEffects)
+
+        private void CancelDragging()
+        {
+            if (_lastRoot != null)
+                RaiseEventAndUpdateCursor(RawDragEventType.DragLeave, _lastRoot, _lastPosition, InputModifiers.None);
+            UpdateCursor(null, DragDropEffects.None);
+            _result.OnNext(DragDropEffects.None);
+        }
+
+        private void ProcessKeyEvents(RawKeyEventArgs e)
+        {
+            if (e.Type == RawKeyEventType.KeyDown && e.Key == Key.Escape)
+            {
+                if (_lastRoot != null)
+                    RaiseEventAndUpdateCursor(RawDragEventType.DragLeave, _lastRoot, _lastPosition, e.Modifiers);
+                UpdateCursor(null, DragDropEffects.None);
+                _result.OnNext(DragDropEffects.None);
+                e.Handled = true;
+            }
+            else if (e.Key == Key.LeftCtrl || e.Key == Key.RightCtrl || e.Key == Key.LeftAlt || e.Key == Key.RightAlt)
+                RaiseEventAndUpdateCursor(RawDragEventType.DragOver, _lastRoot, _lastPosition, e.Modifiers);
+        }
+
+        private void ProcessMouseEvents(RawMouseEventArgs e)
         {
             if (!_initialInputModifiers.HasValue)
                 _initialInputModifiers = e.InputModifiers & MOUSE_INPUTMODIFIERS;

-            void CancelDragging()
-            {
-                if (_lastRoot != null)
-                    RaiseDragEvent(RawDragEventType.DragLeave, _lastRoot, _lastRoot.PointToClient(e.Root.PointToScreen(e.Position)), allowedEffects);
-                SetCursor(null, DragDropEffects.None);
-                _result.OnNext(DragDropEffects.None);
-                e.Handled = true;
-            }
-            void AcceptDragging()
-            {
-                var result = RaiseDragEvent(RawDragEventType.Drop, e.Root, e.Position, allowedEffects) & allowedEffects;
-                SetCursor(null, DragDropEffects.None);
-                _result.OnNext(result);
+
+            void CheckDraggingAccepted(InputModifiers changedMouseButton)
+            {
+                if (_initialInputModifiers.Value.HasFlag(changedMouseButton))
+                {
+                    var result = RaiseEventAndUpdateCursor(RawDragEventType.Drop, e.Root, e.Position, e.InputModifiers);
+                    UpdateCursor(null, DragDropEffects.None);
+                    _result.OnNext(result);
+                }
+                else
+                    CancelDragging();
                 e.Handled = true;
             }

@@ -125,45 +169,34 @@
                 case RawMouseEventType.MiddleButtonDown:
                 case RawMouseEventType.NonClientLeftButtonDown:
                     CancelDragging();
+                    e.Handled = true;
                     return;
                 case RawMouseEventType.LeaveWindow:
-                    RaiseDragEvent(RawDragEventType.DragLeave, e.Root, e.Position, allowedEffects);
-                    break;
+                    RaiseEventAndUpdateCursor(RawDragEventType.DragLeave, e.Root, e.Position,  e.InputModifiers); break;
                 case RawMouseEventType.LeftButtonUp:
-                    if (_initialInputModifiers.Value.HasFlag(InputModifiers.LeftMouseButton))
-                        AcceptDragging();
-                    else
-                        CancelDragging();
-                    return;
+                    CheckDraggingAccepted(InputModifiers.LeftMouseButton); break;
                 case RawMouseEventType.MiddleButtonUp:
-                    if (_initialInputModifiers.Value.HasFlag(InputModifiers.MiddleMouseButton))
-                        AcceptDragging();
-                    else
-                        CancelDragging();
-                    return;
+                    CheckDraggingAccepted(InputModifiers.MiddleMouseButton); break;
                 case RawMouseEventType.RightButtonUp:
-                    if (_initialInputModifiers.Value.HasFlag(InputModifiers.RightMouseButton))
-                        AcceptDragging();
-                    else
-                        CancelDragging();
-                    return;
+                    CheckDraggingAccepted(InputModifiers.RightMouseButton); break;
                 case RawMouseEventType.Move:
                     var mods = e.InputModifiers & MOUSE_INPUTMODIFIERS;
                     if (_initialInputModifiers.Value != mods)
                     {
                         CancelDragging();
+                        e.Handled = true;
                         return;
                     }

                     if (e.Root != _lastRoot)
                     {
                         if (_lastRoot != null)
-                            RaiseDragEvent(RawDragEventType.DragLeave, _lastRoot, _lastRoot.PointToClient(e.Root.PointToScreen(e.Position)), allowedEffects);
-                        RaiseDragEvent(RawDragEventType.DragEnter, e.Root, e.Position, allowedEffects);
+                            RaiseEventAndUpdateCursor(RawDragEventType.DragLeave, _lastRoot, _lastRoot.PointToClient(e.Root.PointToScreen(e.Position)), e.InputModifiers);
+                        RaiseEventAndUpdateCursor(RawDragEventType.DragEnter, e.Root, e.Position, e.InputModifiers);
                     }
                     else
-                        RaiseDragEvent(RawDragEventType.DragOver, e.Root, e.Position, allowedEffects);
-                    return;
+                        RaiseEventAndUpdateCursor(RawDragEventType.DragOver, e.Root, e.Position, e.InputModifiers);
+                    break;
             }
         }
     }


THRIFT-2470 THttpHandler swallows exceptions from processor
Client: C#
Patch: Adam Conelly

This closes #100

commit 6dcb1c3dc5d3259574863f0bc6af67b241b4653e
 Author: Adam Connelly <adam@resdiary.com>
 Date: 2014-04-16T14:37:54Z

THRIFT-2470: Stop THttpHandler from swallowing processor exceptions

The problem with the way it works currently is that it makes it very difficult to figure out what's going on when I've got a handler running on a remote web server. If the handler just allows the exceptions to bubble up like normal, they get caught by our normal exception handling code and logged.

I also added a new project for unit tests, and some tests for the changes I've made.

--- lib/csharp/src/Transport/THttpHandler.cs
+++ lib/csharp/src/Transport/THttpHandler.cs
@@ -63,30 +63,23 @@
         {
             TTransport transport = new TStreamTransport(input,output);

-            TProtocol inputProtocol = null;
-            TProtocol outputProtocol = null;
-
             try
             {
-                inputProtocol = inputProtocolFactory.GetProtocol(transport);
-                outputProtocol = outputProtocolFactory.GetProtocol(transport);
+                var inputProtocol = inputProtocolFactory.GetProtocol(transport);
+                var outputProtocol = outputProtocolFactory.GetProtocol(transport);

-                while (processor.Process(inputProtocol, outputProtocol)) { }
+                while (processor.Process(inputProtocol, outputProtocol))
+                {
+                }
             }
             catch (TTransportException)
             {
                 // Client died, just move on
             }
-            catch (TApplicationException tx)
+            finally
             {
-                Console.Error.Write(tx);
+                transport.Close();
             }
-            catch (Exception x)
-            {
-                Console.Error.Write(x);
-            }
-
-            transport.Close();
         }

         public bool IsReusable


Remove useless stuff

Remove useless stuff

--- src/ConvNetSharp.Core/Training/SgdTrainer.cs
+++ src/ConvNetSharp.Core/Training/SgdTrainer.cs
@@ -6,14 +6,13 @@
 {
     /// <summary>
     ///     Stochastic gradient descent
-    /// TODO: L1DecayLoss, L2DecayLoss
     /// </summary>
     public class SgdTrainer<T> : TrainerBase<T>, IDisposable where T : struct, IEquatable<T>, IFormattable
     {
+        private readonly List<Volume<T>> regGrads = new List<Volume<T>>();
+
         // last iteration gradients (used for momentum calculations)
         private readonly List<Volume<T>> velocities = new List<Volume<T>>();
-        private readonly List<Volume<T>> deltas = new List<Volume<T>>();
-        private readonly List<Volume<T>> regGrads = new List<Volume<T>>();

         public SgdTrainer(INet<T> net) : base(net)
         {
@@ -25,28 +24,19 @@

         public T Momentum { get; set; }

-        public T L2DecayLoss { get; private set; }
-
-        public T L1DecayLoss { get; private set; }
-
         public T LearningRate { get; set; }

         public void Dispose()
         {
-            foreach (var v in velocities)
+            foreach (var v in this.velocities)
+            {
                 v.Dispose();
-            foreach (var d in deltas)
-                d.Dispose();
-            foreach (var r in regGrads)
+            }
+
+            foreach (var r in this.regGrads)
+            {
                 r.Dispose();
-        }
-
-        protected override void Backward(Volume<T> y)
-        {
-            base.Backward(y);
-
-            this.L2DecayLoss = Ops<T>.Zero;
-            this.L1DecayLoss = Ops<T>.Zero;
+            }
         }

         protected override void TrainImplem()
@@ -60,7 +50,6 @@
                 foreach (var parameter in parametersAndGradients)
                 {
                     this.velocities.Add(BuilderInstance<T>.Volume.SameAs(parameter.Volume.Shape));
-                    this.deltas.Add(BuilderInstance<T>.Volume.SameAs(parameter.Volume.Shape));
                     this.regGrads.Add(BuilderInstance<T>.Volume.SameAs(parameter.Volume.Shape));
                 }
             }
@@ -71,57 +60,24 @@
                 var parametersAndGradient = parametersAndGradients[i];
                 var parameters = parametersAndGradient.Volume;
                 var gradients = parametersAndGradient.Gradient;
-                var delta = this.deltas[i];
-                var regularizationGradients = this.regGrads[i];
                 var velocity = this.velocities[i];

-                // learning rate for some parameters.
-                var l2DecayMul = parametersAndGradient.L2DecayMul ?? Ops<T>.One;
-                var l1DecayMul = parametersAndGradient.L1DecayMul ?? Ops<T>.One;
-                var l2Decay = Ops<T>.Multiply(this.L2Decay, l2DecayMul);
-                var l1Decay = Ops<T>.Multiply(this.L1Decay, l1DecayMul);
+                var batchAdjustedLearningRate = Ops<T>.Divide(this.LearningRate, Ops<T>.Cast(this.BatchSize));

-                //  this.L2DecayLoss += l2Decay * vol.Get(j) * vol.Get(j) / 2; // accumulate weight decay loss
-                //  this.L1DecayLoss += l1Decay * Math.Abs(vol.Get(j));
-
-                //L1 regularization
-                if (Ops<T>.GreaterThan(l1Decay, Ops<T>.Zero))
-                {
-                    //l1Grad = l1Grad * l1Decay;
-                    parameters.Storage.Map(x => Ops<T>.GreaterThan(x, Ops<T>.Zero) ? Ops<T>.One : Ops<T>.Negate(Ops<T>.One), regularizationGradients.Storage);
-                    regularizationGradients.DoMultiply(delta, l1Decay);
-                }
-                else
-                {
-                    delta.Clear();
-                }
-
-                //L2 regularization
-                if (Ops<T>.GreaterThan(l2Decay, Ops<T>.Zero))
-                {
-                    //l2Grad = vol * l2Decay;
-                    parameters.DoMultiply(regularizationGradients, l2Decay);
-                    delta.DoAdd(regularizationGradients, delta);
-                }
-
-                T batchAdjustedLearningRate = Ops<T>.Divide(this.LearningRate, Ops<T>.Cast(this.BatchSize));
-
-                //delta = gradient + regularization;
-                gradients.DoMultiply(gradients, batchAdjustedLearningRate);
-                delta.DoMultiply(delta, this.LearningRate);
-                delta.DoAdd(gradients, delta);
+                // delta = gradient + regularization;
+                gradients.DoMultiply(batchAdjustedLearningRate, gradients);

                 if (isMomentumGreaterThanZero)
                 {
                     // sgd with momentum update
-                    velocity.DoMultiply(velocity, this.Momentum);    // step
-                    velocity.DoAdd(delta, velocity);
+                    velocity.DoMultiply(this.Momentum, velocity); // step
+                    velocity.DoAdd(gradients, velocity);
                     velocity.DoSubtractFrom(parameters, parameters); // apply corrected gradient
                 }
                 else
                 {
                     // vanilla sgd
-                    delta.DoSubtractFrom(parameters, parameters);
+                    gradients.DoSubtractFrom(parameters, parameters);
                 }

                 // zero out gradient so that we can begin accumulating anew


Update ShapeStateFlags.cs

Update ShapeStateFlags.cs

--- src/Core2D/Model/Renderer/ShapeStateFlags.cs
+++ src/Core2D/Model/Renderer/ShapeStateFlags.cs
@@ -29,28 +29,38 @@
         Locked = 4,

         /// <summary>
+        /// Shape size is scaled.
+        /// </summary>
+        Size = 8,
+
+        /// <summary>
+        /// Shape thickness is scaled.
+        /// </summary>
+        Thickness = 16,
+
+        /// <summary>
         /// Shape is connector.
         /// </summary>
-        Connector = 8,
+        Connector = 32,

         /// <summary>
         /// Shape in none.
         /// </summary>
-        None = 16,
+        None = 64,

         /// <summary>
         /// Shape is standalone.
         /// </summary>
-        Standalone = 32,
+        Standalone = 128,

         /// <summary>
         /// Shape is an input.
         /// </summary>
-        Input = 64,
+        Input = 256,

         /// <summary>
         /// Shape is and output.
         /// </summary>
-        Output = 128
+        Output = 512
     }
 }


Update ShapeState.cs

Update ShapeState.cs

--- src/Core2D/ViewModels/Renderer/ShapeState.cs
+++ src/Core2D/ViewModels/Renderer/ShapeState.cs
@@ -27,6 +27,8 @@
             Notify(nameof(Visible));
             Notify(nameof(Printable));
             Notify(nameof(Locked));
+            Notify(nameof(Size));
+            Notify(nameof(Thickness));
             Notify(nameof(Connector));
             Notify(nameof(None));
             Notify(nameof(Standalone));
@@ -63,6 +65,20 @@
         }

         /// <inheritdoc/>
+        public bool Size
+        {
+            get => _flags.HasFlag(ShapeStateFlags.Size);
+            set => Flags = value ? _flags | ShapeStateFlags.Size : _flags & ~ShapeStateFlags.Size;
+        }
+
+        /// <inheritdoc/>
+        public bool Thickness
+        {
+            get => _flags.HasFlag(ShapeStateFlags.Thickness);
+            set => Flags = value ? _flags | ShapeStateFlags.Thickness : _flags & ~ShapeStateFlags.Thickness;
+        }
+
+        /// <inheritdoc/>
         public bool Connector
         {
             get => _flags.HasFlag(ShapeStateFlags.Connector);
@@ -160,6 +176,18 @@
         public virtual bool ShouldSerializeLocked() => false;

         /// <summary>
+        /// The <see cref="Size"/> property is not serialized.
+        /// </summary>
+        /// <returns>Returns always false.</returns>
+        public virtual bool ShouldSerializeSize() => false;
+
+        /// <summary>
+        /// The <see cref="Thickness"/> property is not serialized.
+        /// </summary>
+        /// <returns>Returns always false.</returns>
+        public virtual bool ShouldSerializeThickness() => false;
+
+        /// <summary>
         /// The <see cref="Connector"/> property is not serialized.
         /// </summary>
         /// <returns>Returns always false.</returns>


fix: invoke CommandExecuted on async exception failures

--- src/Discord.Net.Commands/Info/CommandInfo.cs
+++ src/Discord.Net.Commands/Info/CommandInfo.cs
@@ -272,6 +272,10 @@

                 var wrappedEx = new CommandException(this, context, ex);
                 await Module.Service._cmdLogger.ErrorAsync(wrappedEx).ConfigureAwait(false);
+
+                var result = ExecuteResult.FromError(CommandError.Exception, ex.Message);
+                await Module.Service._commandExecutedEvent.InvokeAsync(this, context, result).ConfigureAwait(false);
+
                 if (Module.Service._throwOnError)
                 {
                     if (ex == originalEx)
@@ -280,7 +284,7 @@
                         ExceptionDispatchInfo.Capture(ex).Throw();
                 }

-                return ExecuteResult.FromError(CommandError.Exception, ex.Message);
+                return result;
             }
             finally
             {


Update SelectionTool.cs

Update SelectionTool.cs

--- src/Draw2D.ViewModels/Tools/SelectionTool.cs
+++ src/Draw2D.ViewModels/Tools/SelectionTool.cs
@@ -1140,11 +1140,13 @@
                                 {
                                     figureShape.Points.Remove(pointShape);
                                     figureShape.MarkAsDirty(true);
+                                    container.MarkAsDirty(true);
                                 }
                                 else
                                 {
                                     figureShape.Shapes.Remove(shape);
                                     figureShape.MarkAsDirty(true);
+                                    container.MarkAsDirty(true);
                                 }
                             }
                             break;
@@ -1154,11 +1156,13 @@
                                 {
                                     pathShape.Points.Remove(pointShape);
                                     pathShape.MarkAsDirty(true);
+                                    container.MarkAsDirty(true);
                                 }
                                 else
                                 {
                                     pathShape.Shapes.Remove(shape);
                                     pathShape.MarkAsDirty(true);
+                                    container.MarkAsDirty(true);
                                 }
                             }
                             break;
@@ -1168,11 +1172,13 @@
                                 {
                                     groupShape.Points.Remove(pointShape);
                                     groupShape.MarkAsDirty(true);
+                                    container.MarkAsDirty(true);
                                 }
                                 else
                                 {
                                     groupShape.Shapes.Remove(shape);
                                     groupShape.MarkAsDirty(true);
+                                    container.MarkAsDirty(true);
                                 }
                             }
                             break;
@@ -1184,6 +1190,7 @@
                                     if (shape.Owner is IDirty dirty)
                                     {
                                         dirty.MarkAsDirty(true);
+                                        container.MarkAsDirty(true);
                                     }
                                 }
                             }


Test: fix unexecuted integration test code (#31)

Some parts of the integration test code were not executed.

--- src/Dse.Test.Integration/Graph/GraphTests.cs
+++ src/Dse.Test.Integration/Graph/GraphTests.cs
@@ -53,10 +53,10 @@
                 var rs = session.ExecuteGraph(new SimpleGraphStatement("g.V()"));
                 var resultArray = rs.ToArray();
                 Assert.Greater(resultArray.Length, 0);
-                foreach (Vertex v in rs)
+                foreach (Vertex v in resultArray)
                 {
                     Assert.NotNull(v);
-                    Assert.AreEqual("vertex", v.Label);
+                    Assert.IsTrue(v.Label == "person" || v.Label == "software");
                     Assert.True(v.Properties.ContainsKey("name"));
                 }
                 Assert.NotNull(rs);
@@ -75,10 +75,10 @@
                 var rs = session.ExecuteGraph(new SimpleGraphStatement("g.V().has('name', 'marko').out('knows')"));
                 var resultArray = rs.ToArray();
                 Assert.AreEqual(2, resultArray.Length);
-                foreach (Vertex v in rs)
+                foreach (Vertex v in resultArray)
                 {
                     Assert.NotNull(v);
-                    Assert.AreEqual("vertex", v.Label);
+                    Assert.AreEqual("person", v.Label);
                     Assert.True(v.Properties.ContainsKey("name"));
                 }
                 Assert.NotNull(rs);
@@ -118,15 +118,13 @@
                 var session = cluster.Connect();
                 var rs = session.ExecuteGraph(new SimpleGraphStatement("g.V().has('name', namedParam)", new { namedParam = "marko" }));

+                Assert.NotNull(rs);
                 var resultArray = rs.ToArray();
                 Assert.AreEqual(1, resultArray.Length);
-                foreach (Vertex vertex in rs)
-                {
-                    Assert.NotNull(vertex);
-                    Assert.AreEqual("vertex", vertex.Label);
-                    Assert.AreEqual("marko", vertex.Properties["name"]);
-                }
-                Assert.NotNull(rs);
+                var vertex = resultArray[0].ToVertex();
+                Assert.NotNull(vertex);
+                Assert.AreEqual("person", vertex.Label);
+                Assert.AreEqual("marko", vertex.Properties["name"].ToArray()[0].Get<string>("value"));
             }
         }

@@ -524,15 +522,12 @@
                 session.ExecuteGraph(new SimpleGraphStatement(schemaQuery, new {vertexLabel = vertexLabel, propertyName = propertyName}));

                 var parameters = new { vertexLabel = vertexLabel, propertyName = propertyName, val = value};
-
                 var rs = session.ExecuteGraph(new SimpleGraphStatement("g.addV(label, vertexLabel, propertyName, val)", parameters));
-
                 ValidateVertexResult(rs, vertexLabel, propertyName, expectedString);

                 rs =
                     session.ExecuteGraph(
                         new SimpleGraphStatement("g.V().hasLabel(vertexLabel).has(propertyName, val).next()", parameters));
-
                 ValidateVertexResult(rs, vertexLabel, propertyName, expectedString);
             }
         }


Remove storage check for now

Remove storage check for now

--- src/Exceptionless.Insulation/Bootstrapper.cs
+++ src/Exceptionless.Insulation/Bootstrapper.cs
@@ -93,7 +93,7 @@

                 .AddAutoNamedCheck<ElasticsearchHealthCheck>("Critical")
                 .AddAutoNamedCheck<CacheHealthCheck>("Critical")
-                .AddAutoNamedCheck<StorageHealthCheck>("EventPosts", "AllJobs")
+                //.AddAutoNamedCheck<StorageHealthCheck>("EventPosts", "AllJobs")

                 .AddAutoNamedCheck<QueueHealthCheck<EventPost>>("EventPosts", "AllJobs")
                 .AddAutoNamedCheck<QueueHealthCheck<EventUserDescription>>("EventUserDescriptions", "AllJobs")


Moved nofetch option so it doesn't skip normalisation entirely when specified

--- src/GitVersionCore/BuildServers/GitHelper.cs
+++ src/GitVersionCore/BuildServers/GitHelper.cs
@@ -12,13 +12,6 @@

         public static void NormalizeGitDirectory(string gitDirectory, Authentication authentication, bool noFetch)
         {
-            //If noFetch is enabled, then GitVersion will assume that the git repository is normalized before execution, so that fetching from remotes is not required.
-            if (noFetch)
-            {
-                Logger.WriteInfo("Skipping fetching");
-                return;
-            }
-
             using (var repo = new Repository(gitDirectory))
             {
                 var remote = EnsureOnlyOneRemoteIsDefined(repo);
@@ -28,8 +21,14 @@
                 Logger.WriteInfo(string.Format("Fetching from remote '{0}' using the following refspecs: {1}.",
                     remote.Name, string.Join(", ", remote.FetchRefSpecs.Select(r => r.Specification))));

-                var fetchOptions = BuildFetchOptions(authentication.Username, authentication.Password);
-                repo.Network.Fetch(remote, fetchOptions);
+
+                //If noFetch is enabled, then GitVersion will assume that the git repository is normalized before execution, so that fetching from remotes is not required.
+                if (!noFetch)
+                {
+                    Logger.WriteInfo("Skipping fetching");
+                    var fetchOptions = BuildFetchOptions(authentication.Username, authentication.Password);
+                    repo.Network.Fetch(remote, fetchOptions);
+                }

                 CreateMissingLocalBranchesFromRemoteTrackingOnes(repo, remote.Name);


update

update

--- src/Hangfire.LiteDB/LiteDbDistributedLock.cs
+++ src/Hangfire.LiteDB/LiteDbDistributedLock.cs
@@ -13,6 +13,13 @@
     public sealed class LiteDbDistributedLock : IDisposable
     {

+        // EventWaitHandle is not supported on UNIX systems
+        // https://github.com/dotnet/coreclr/pull/1387
+        // Instead of using a compiler directive, we catch the
+        // exception and handles it. This way, when EventWaitHandle
+        // becomes available on UNIX, we will start working.
+        private static bool _isEventWaitHandleSupported = true;
+
         private static readonly ILog Logger = LogProvider.For<LiteDbDistributedLock>();

         private static readonly ThreadLocal<Dictionary<string, int>> AcquiredLocks
@@ -125,7 +132,7 @@
                 var now = DateTime.Now;
                 var lockTimeoutTime = now.Add(timeout);

-                while ((lockTimeoutTime >= now))
+                while (!isLockAcquired && (lockTimeoutTime >= now))
                 {
                     var result = _database.DistributedLock.FindOne(x => x.Resource == _resource);
                     var distributedLock = result??new DistributedLock();
@@ -140,24 +147,29 @@
                     }
                     else
                     {
-                        try
+                        EventWaitHandle eventWaitHandle = null;
+                        var waitTime = (int)timeout.TotalMilliseconds / 10;
+                        if (_isEventWaitHandleSupported)
                         {
-                            // Wait on the event. This allows us to be "woken" up sooner rather than later.
-                            // We wait in chunks as we need to "wake-up" from time to time and poll LiteDB,
-                            // in case that the lock was acquired on another machine or instance.
-                            var eventWaitHandle = new EventWaitHandle(false, EventResetMode.AutoReset, EventWaitHandleName);
-                            eventWaitHandle.WaitOne((int)timeout.TotalMilliseconds / 10);
+                            try
+                            {
+                                // Wait on the event. This allows us to be "woken" up sooner rather than later.
+                                // We wait in chunks as we need to "wake-up" from time to time and poll mongo,
+                                // in case that the lock was acquired on another machine or instance.
+                                eventWaitHandle = new EventWaitHandle(false, EventResetMode.AutoReset, EventWaitHandleName);
+                                eventWaitHandle.WaitOne(waitTime);
+                            }
+                            catch (PlatformNotSupportedException)
+                            {
+                                // See _isEventWaitHandleSupported definition for more info.
+                                _isEventWaitHandleSupported = false;
+                                eventWaitHandle = null;
+                            }
                         }
-                        catch (PlatformNotSupportedException)
+                        if (eventWaitHandle == null)
                         {
-                            // EventWaitHandle is not supported on UNIX systems
-                            // https://github.com/dotnet/coreclr/pull/1387
-                            // Instead of using a compiler directive, we catch the
-                            // exception and handles it. This way, when EventWaitHandle
-                            // becomes available on UNIX, we will start working.
-                            // So in this case, we just sleep for a while and then
-                            // check if the lock has been released.
-                            Thread.Sleep((int)timeout.TotalMilliseconds / 10);
+                            // Sleep for a while and then check if the lock has been released.
+                            Thread.Sleep(waitTime);
                         }
                         now = DateTime.Now;
                     }
@@ -189,19 +201,21 @@
             {
                 // Remove resource lock
                 _database.DistributedLock.Delete(_ => _.Resource== _resource);
-                EventWaitHandle eventWaitHandler;
-                if (EventWaitHandle.TryOpenExisting(EventWaitHandleName, out eventWaitHandler))
-                {
-                    eventWaitHandler.Set();
-                }
-            }
-            catch (PlatformNotSupportedException)
-            {
-                // EventWaitHandle is not supported on UNIX systems
-                // https://github.com/dotnet/coreclr/pull/1387
-                // So we are not able to signal anyone waiting
-                // for this lock, in order for them to acquire
-                // it sooner rather than later.
+                if (_isEventWaitHandleSupported)
+                {
+                    try
+                    {
+                        if (EventWaitHandle.TryOpenExisting(EventWaitHandleName, out EventWaitHandle eventWaitHandler))
+                        {
+                            eventWaitHandler.Set();
+                        }
+                    }
+                    catch (PlatformNotSupportedException)
+                    {
+                        // See _isEventWaitHandleSupported definition for more info.
+                        _isEventWaitHandleSupported = false;
+                    }
+                }
             }
             catch (Exception ex)
             {


- tweaking param name for consistency

- tweaking param name for consistency

--- src/JsonFx/EcmaScript/EcmaScriptFormatter.cs
+++ src/JsonFx/EcmaScript/EcmaScriptFormatter.cs
@@ -114,14 +114,14 @@
 		#region Namespace Methods

 		/// <summary>
-		/// Returns a block of script for ensuring that a namespace is declared
+		/// Emits a block of script ensuring that a namespace is declared
 		/// </summary>
 		/// <param name="writer">the output writer</param>
 		/// <param name="ident">the namespace to ensure</param>
 		/// <param name="namespaces">list of namespaces already emitted</param>
 		/// <param name="debug">determines if should emit pretty-printed</param>
 		/// <returns>if was a namespaced identifier</returns>
-		public static bool WriteNamespaceDeclaration(TextWriter writer, string ident, List<string> namespaces, bool isDebug)
+		public static bool WriteNamespaceDeclaration(TextWriter writer, string ident, List<string> namespaces, bool prettyPrint)
 		{
 			if (String.IsNullOrEmpty(ident))
 			{
@@ -159,7 +159,7 @@

 				if (i == 0)
 				{
-					if (isDebug)
+					if (prettyPrint)
 					{
 						writer.Write(EcmaScriptFormatter.RootDeclarationDebug, ns,
 							String.Join(NamespaceDelim, nsParts, 0, nsParts.Length-1));
@@ -170,7 +170,7 @@
 					}
 				}

-				if (isDebug)
+				if (prettyPrint)
 				{
 					writer.WriteLine(EcmaScriptFormatter.NamespaceCheckDebug, ns);
 				}
@@ -180,7 +180,7 @@
 				}
 			}

-			if (isDebug && isNested)
+			if (prettyPrint && isNested)
 			{
 				writer.WriteLine();
 			}


Add new character sets from latest version of MySQL.

--- src/MySql.Data/Serialization/CharacterSet.cs
+++ src/MySql.Data/Serialization/CharacterSet.cs
@@ -3,7 +3,7 @@
 	/// <summary>
 	/// MySQL character set codes.
 	/// </summary>
-	/// <remarks>Obtained from <c>SELECT id, collation_name FROM information_schema.collations ORDER BY id;</c> on MySQL 5.6.29.</remarks>
+	/// <remarks>Obtained from <c>SELECT id, collation_name FROM information_schema.collations ORDER BY id;</c> on MySQL 5.7.11.</remarks>
 	internal enum CharacterSet : ushort
 	{
 		None = 0,
@@ -226,5 +226,8 @@
 		Utf8Mb4CroatianCaseInsensitive = 245,
 		Utf8Mb4Unicode520CaseInsensitive = 246,
 		Utf8Mb4VietnameseCaseInsensitive = 247,
+		Gb18030ChineseCaseInsensitive = 248,
+		Gb18030Binary = 249,
+		Gb18030Unicode520CaseInsensitive = 250,
 	}
 }


Fixed init

Fixed init

--- src/NSwag/Commands/WebApiToSwaggerCommand.cs
+++ src/NSwag/Commands/WebApiToSwaggerCommand.cs
@@ -16,6 +16,7 @@
         public WebApiToSwaggerCommand()
         {
             Settings = new WebApiAssemblyToSwaggerGeneratorSettings();
+            ControllerNames = new string[] { };
         }

         [JsonIgnore]
@@ -98,7 +99,7 @@
             {
                 var generator = new WebApiAssemblyToSwaggerGenerator(Settings);

-                var controllerNames = ControllerNames?.ToList() ?? new List<string>();
+                var controllerNames = ControllerNames.ToList();
                 if (!string.IsNullOrEmpty(ControllerName))
                     controllerNames.Add(ControllerName);


pluralization

pluralization

--- src/NuGetGallery/Views/Users/Packages.cshtml
+++ src/NuGetGallery/Views/Users/Packages.cshtml
@@ -39,69 +39,85 @@

 @helper PrintPublishedPackages(IEnumerable<PackageViewModel> packages, bool unlisted)
 {
-    var totlalDownloads = 0;
-

-

-

-                Actions
-                Package
-                Package ID
-                Description
-                Downloads
+    var totalDownloads = 0;
+    var totalPackages = packages.Count();
+
+    if (totalPackages > 0)
+    {
+

+

+

+                    Actions
+                    Package
+                    Package ID
+                    Description
+                    Downloads

-

-

-

-            @foreach (var package in packages)
-            {
+

+

+

+                @foreach (var package in packages)
+                {
+

+
+                            @if (unlisted)
+                            {
+
+
+
+                            }
+                            else
+                            {
+
+
+
+
+
+
+                            }
+
+
+                            @package.Title
+
+                        @package.Id
+
+                            @if (String.IsNullOrEmpty(package.Description) || package.Description.Length < 65)
+                            {
+                                @package.Description
+                            }
+                            else
+                            {
+                                @package.Description.Substring(0, 65)
+                                ...
+                            }
+
+
+                        @package.DownloadCount
+

+                    totalDownloads += package.DownloadCount;
+                }
+

+

-
-                        @if (unlisted)
+
+                        @if (totalPackages > 1)
                         {
-
-
-
+                            @(string.Format("You have a total of {0} packages.", totalPackages))
                         }
                         else
                         {
-
-
-
-
-
-
+                            @("You have one package.")
                         }

-
-                        @package.Title
+
+                        @totalDownloads

-                    @package.Id
-
-                        @if (String.IsNullOrEmpty(package.Description) || package.Description.Length < 65)
-                        {
-                            @package.Description
-                        }
-                        else
-                        {
-                            @package.Description.Substring(0, 65)
-                            ...
-                        }
-
-
-                    @package.DownloadCount

-                totlalDownloads += package.DownloadCount;
-            }
-

-

-

-
-                    You have a total of @packages.Count() package(s).
-
-
-                    @totlalDownloads
-
-

-

-

+

+

+    }
+    else
+    {
+
You don't have any packages here.

+    }
 }


Avoid closing known-masked connections on client (#6683)

--- src/Orleans.Core/Messaging/GatewayManager.cs
+++ src/Orleans.Core/Messaging/GatewayManager.cs
@@ -353,7 +353,7 @@
                 // receive responses
                 var connectionsToKeepAlive = new List<SiloAddress>(live);
                 connectionsToKeepAlive.AddRange(knownMasked.Select(e => e.Key));
-                this.CloseEvictedGatewayConnections(live);
+                this.CloseEvictedGatewayConnections(connectionsToKeepAlive);
             }
         }


Fix XMLSchedulingDataProcessor null group handling

--- src/Quartz/Xml/XMLSchedulingDataProcessor.cs
+++ src/Quartz/Xml/XMLSchedulingDataProcessor.cs
@@ -25,6 +25,7 @@
 using System.Xml;
 using System.Xml.Schema;
 using System.Xml.Serialization;
+
 using Microsoft.Extensions.Logging;

 using Quartz.Impl.Matchers;
@@ -216,7 +217,7 @@
             MaybeThrowValidationException();

             // deserialize as object model
-            var xs = new XmlSerializer(typeof (QuartzXmlConfiguration20));
+            var xs = new XmlSerializer(typeof(QuartzXmlConfiguration20));
             var data = (QuartzXmlConfiguration20?) xs.Deserialize(new StringReader(xml));

             if (data == null)
@@ -242,6 +243,7 @@
                             }
                         }
                     }
+
                     if (command.deletetriggersingroup != null)
                     {
                         foreach (string s in command.deletetriggersingroup)
@@ -253,6 +255,7 @@
                             }
                         }
                     }
+
                     if (command.deletejob != null)
                     {
                         foreach (preprocessingcommandsTypeDeletejob s in command.deletejob)
@@ -264,21 +267,24 @@
                             {
                                 throw new SchedulerConfigException("Encountered a 'delete-job' command without a name specified.");
                             }
-                            jobsToDelete.Add(new JobKey(name, group!));
+
+                            jobsToDelete.Add(new JobKey(name, group ?? Key<string>.DefaultGroup));
                         }
                     }
+
                     if (command.deletetrigger != null)
                     {
                         foreach (preprocessingcommandsTypeDeletetrigger s in command.deletetrigger)
                         {
                             var name = s.name.TrimEmptyToNull();
-                            var group = s.group.TrimEmptyToNull();
+                            var group = s.group.TrimEmptyToNull() ?? Key<string>.DefaultGroup;

                             if (name == null)
                             {
                                 throw new SchedulerConfigException("Encountered a 'delete-trigger' command without a name specified.");
                             }
-                            triggersToDelete.Add(new TriggerKey(name, group!));
+
+                            triggersToDelete.Add(new TriggerKey(name, group));
                         }
                     }
                 }
@@ -298,29 +304,29 @@
             if (data.processingdirectives != null && data.processingdirectives.Length > 0)
             {
                 bool overWrite = data.processingdirectives[0].overwriteexistingdata;
-                logger.LogDebug("Directive 'overwrite-existing-data' specified as: {Overwrite}",overWrite);
+                logger.LogDebug("Directive 'overwrite-existing-data' specified as: {Overwrite}", overWrite);
                 OverWriteExistingData = overWrite;
             }
             else
             {
-                logger.LogDebug("Directive 'overwrite-existing-data' not specified, defaulting to {Overwrite}",OverWriteExistingData);
+                logger.LogDebug("Directive 'overwrite-existing-data' not specified, defaulting to {Overwrite}", OverWriteExistingData);
             }

             if (data.processingdirectives != null && data.processingdirectives.Length > 0)
             {
                 bool ignoreduplicates = data.processingdirectives[0].ignoreduplicates;
-                logger.LogDebug("Directive 'ignore-duplicates' specified as: {IgnoreDuplicates}",ignoreduplicates);
+                logger.LogDebug("Directive 'ignore-duplicates' specified as: {IgnoreDuplicates}", ignoreduplicates);
                 IgnoreDuplicates = ignoreduplicates;
             }
             else
             {
-                logger.LogDebug("Directive 'ignore-duplicates' not specified, defaulting to {IgnoreDuplicates}",IgnoreDuplicates);
+                logger.LogDebug("Directive 'ignore-duplicates' not specified, defaulting to {IgnoreDuplicates}", IgnoreDuplicates);
             }

             if (data.processingdirectives != null && data.processingdirectives.Length > 0)
             {
                 bool scheduleRelative = data.processingdirectives[0].scheduletriggerrelativetoreplacedtrigger;
-                logger.LogDebug("Directive 'schedule-trigger-relative-to-replaced-trigger' specified as: {ScheduleRelative}",scheduleRelative);
+                logger.LogDebug("Directive 'schedule-trigger-relative-to-replaced-trigger' specified as: {ScheduleRelative}", scheduleRelative);
                 ScheduleTriggerRelativeToReplacedTrigger = scheduleRelative;
             }
             else
@@ -349,7 +355,7 @@
             foreach (jobdetailType jobDetailType in jobNodes)
             {
                 var jobName = jobDetailType.name.TrimEmptyToNull();
-                var jobGroup = jobDetailType.group.TrimEmptyToNull();
+                var jobGroup = jobDetailType.group.TrimEmptyToNull() ?? Key<string>.DefaultGroup;
                 var jobDescription = jobDetailType.description.TrimEmptyToNull();
                 var jobTypeName = jobDetailType.jobtype.TrimEmptyToNull();
                 bool jobDurability = jobDetailType.durable;
@@ -358,7 +364,7 @@
                 Type jobType = TypeLoadHelper.LoadType(jobTypeName!)!;

                 IJobDetail jobDetail = JobBuilder.Create(jobType!)
-                    .WithIdentity(jobName!, jobGroup!)
+                    .WithIdentity(jobName!, jobGroup)
                     .WithDescription(jobDescription)
                     .StoreDurably(jobDurability)
                     .RequestRecovery(jobRecoveryRequested)
@@ -376,7 +382,7 @@

                 if (logger.IsEnabled(LogLevel.Debug))
                 {
-                    logger.LogDebug("Parsed job definition: {JobDetail}",jobDetail);
+                    logger.LogDebug("Parsed job definition: {JobDetail}", jobDetail);
                 }

                 AddJobToSchedule(jobDetail);
@@ -403,11 +409,11 @@
             foreach (triggerType triggerNode in triggerEntries)
             {
                 var triggerName = triggerNode.Item.name.TrimEmptyToNull()!;
-                var triggerGroup = triggerNode.Item.group.TrimEmptyToNull()!;
+                var triggerGroup = triggerNode.Item.group.TrimEmptyToNull() ?? Key<string>.DefaultGroup;
                 var triggerDescription = triggerNode.Item.description.TrimEmptyToNull();
                 var triggerCalendarRef = triggerNode.Item.calendarname.TrimEmptyToNull();
                 string triggerJobName = triggerNode.Item.jobname.TrimEmptyToNull()!;
-                string triggerJobGroup = triggerNode.Item.jobgroup.TrimEmptyToNull()!;
+                string triggerJobGroup = triggerNode.Item.jobgroup.TrimEmptyToNull() ?? Key<string>.DefaultGroup;

                 int triggerPriority = TriggerConstants.DefaultPriority;
                 if (!triggerNode.Item.priority.IsNullOrWhiteSpace())
@@ -428,7 +434,7 @@
                     }
                 }

-                DateTime? triggerEndTime = triggerNode.Item.endtimeSpecified ? triggerNode.Item.endtime : (DateTime?) null;
+                DateTime? triggerEndTime = triggerNode.Item.endtimeSpecified ? triggerNode.Item.endtime : null;

                 IScheduleBuilder sched;

@@ -486,15 +492,15 @@
                 }

                 IMutableTrigger trigger = (IMutableTrigger) TriggerBuilder.Create()
-                                                                .WithIdentity(triggerName, triggerGroup)
-                                                                .WithDescription(triggerDescription)
-                                                                .ForJob(triggerJobName, triggerJobGroup)
-                                                                .StartAt(triggerStartTime)
-                                                                .EndAt(triggerEndTime)
-                                                                .WithPriority(triggerPriority)
-                                                                .ModifiedByCalendar(triggerCalendarRef)
-                                                                .WithSchedule(sched)
-                                                                .Build();
+                    .WithIdentity(triggerName, triggerGroup)
+                    .WithDescription(triggerDescription)
+                    .ForJob(triggerJobName, triggerJobGroup)
+                    .StartAt(triggerStartTime)
+                    .EndAt(triggerEndTime)
+                    .WithPriority(triggerPriority)
+                    .ModifiedByCalendar(triggerCalendarRef)
+                    .WithSchedule(sched)
+                    .Build();

                 if (triggerNode.Item.jobdatamap != null && triggerNode.Item.jobdatamap.entry != null)
                 {
@@ -508,7 +514,7 @@

                 if (logger.IsEnabled(LogLevel.Debug))
                 {
-                    logger.LogDebug("Parsed trigger definition: {Trigger}",trigger);
+                    logger.LogDebug("Parsed trigger definition: {Trigger}", trigger);
                 }

                 AddTriggerToSchedule(trigger);
@@ -533,8 +539,8 @@

         protected virtual int ReadMisfireInstructionFromString(string misfireinstruction)
         {
-            Constants c = new Constants(typeof (MisfireInstruction), typeof (MisfireInstruction.CronTrigger),
-                                        typeof (MisfireInstruction.SimpleTrigger));
+            Constants c = new Constants(typeof(MisfireInstruction), typeof(MisfireInstruction.CronTrigger),
+                typeof(MisfireInstruction.SimpleTrigger));
             return c.AsNumber(misfireinstruction);
         }

@@ -549,21 +555,23 @@
             {
                 throw new SchedulerConfigException("Unknown interval unit for DateIntervalTrigger: " + intervalUnit);
             }
+
             return retValue;
         }

         protected virtual bool TryParseEnum<T>(string str, out T value) where T : struct
         {
-            var names = Enum.GetNames(typeof (T));
-            value = (T) Enum.GetValues(typeof (T)).GetValue(0)!;
+            var names = Enum.GetNames(typeof(T));
+            value = (T) Enum.GetValues(typeof(T)).GetValue(0)!;
             foreach (var name in names)
             {
                 if (name == str)
                 {
-                    value = (T) Enum.Parse(typeof (T), name);
+                    value = (T) Enum.Parse(typeof(T), name);
                     return true;
                 }
             }
+
             return false;
         }

@@ -573,9 +581,9 @@
             {
                 var settings = new XmlReaderSettings
                 {
-                    ValidationType = ValidationType.Schema,
-                    ValidationFlags = XmlSchemaValidationFlags.ProcessInlineSchema
-                                      | XmlSchemaValidationFlags.ProcessSchemaLocation
+                    ValidationType = ValidationType.Schema,
+                    ValidationFlags = XmlSchemaValidationFlags.ProcessInlineSchema
+                                      | XmlSchemaValidationFlags.ProcessSchemaLocation
                                       | XmlSchemaValidationFlags.ReportValidationWarnings
                 };

@@ -585,7 +593,7 @@
                 {
                     throw new Exception("Could not read XSD from embedded resource");
                 }
-
+
                 var schema = XmlSchema.Read(stream, XmlValidationCallBack);
                 settings.Schemas.Add(schema!);
                 settings.ValidationEventHandler += XmlValidationCallBack;
@@ -598,7 +606,7 @@
             }
             catch (Exception ex)
             {
-                logger.LogWarning(ex, "Unable to validate XML with schema: {Message}",ex.Message);
+                logger.LogWarning(ex, "Unable to validate XML with schema: {Message}", ex.Message);
             }
         }

@@ -692,6 +700,7 @@
             {
                 ProcessInternal(await sr.ReadToEndAsync().ConfigureAwait(false));
             }
+
             await ExecutePreProcessCommands(sched, cancellationToken).ConfigureAwait(false);
             await ScheduleJobs(sched, cancellationToken).ConfigureAwait(false);
         }
@@ -731,7 +740,7 @@
                     if (e.InnerException is TypeLoadException && OverWriteExistingData)
                     {
                         // We are going to replace jobDetail anyway, so just delete it first.
-                        logger.LogInformation("Removing job: {JobKey}",detail.Key);
+                        logger.LogInformation("Removing job: {JobKey}", detail.Key);
                         await sched.DeleteJob(detail.Key, cancellationToken).ConfigureAwait(false);
                     }
                     else
@@ -744,9 +753,10 @@
                 {
                     if (!OverWriteExistingData && IgnoreDuplicates)
                     {
-                        logger.LogInformation("Not overwriting existing job: {JobKey}",dupeJ.Key);
+                        logger.LogInformation("Not overwriting existing job: {JobKey}", dupeJ.Key);
                         continue; // just ignore the entry
                     }
+
                     if (!OverWriteExistingData && !IgnoreDuplicates)
                     {
                         throw new ObjectAlreadyExistsException(detail);
@@ -755,11 +765,11 @@

                 if (dupeJ != null)
                 {
-                    logger.LogInformation("Replacing job: {JobKey}",detail.Key);
+                    logger.LogInformation("Replacing job: {JobKey}", detail.Key);
                 }
                 else
                 {
-                    logger.LogInformation("Adding job: {JobKey}",detail.Key);
+                    logger.LogInformation("Adding job: {JobKey}", detail.Key);
                 }

                 triggersByFQJobName.TryGetValue(detail.Key, out var triggersOfJob);
@@ -780,7 +790,6 @@
                             detail.Key);
                     }
                 }
-

                 if (dupeJ != null || detail.Durable)
                 {
@@ -855,9 +864,10 @@
                                 if (logger.IsEnabled(LogLevel.Debug))
                                 {
                                     logger.LogDebug("Adding trigger: {TriggerKey} for job: {JobKey} failed because the trigger already existed.  "
-                                        + "This is likely due to a race condition between multiple instances "
-                                        + "in the cluster.  Will try to reschedule instead.", trigger.Key, detail.Key);
+                                                    + "This is likely due to a race condition between multiple instances "
+                                                    + "in the cluster.  Will try to reschedule instead.", trigger.Key, detail.Key);
                                 }
+
                                 // Let's try one more time as reschedule.
                                 var oldTrigger = await sched.GetTrigger(trigger.Key, cancellationToken).ConfigureAwait(false);
                                 await DoRescheduleJob(sched, trigger, oldTrigger, cancellationToken).ConfigureAwait(false);
@@ -877,12 +887,12 @@
                     {
                         if (logger.IsEnabled(LogLevel.Debug))
                         {
-                            logger.LogDebug("Rescheduling job: {JobKey} with updated trigger: {TriggerKey}", trigger.JobKey , trigger.Key);
+                            logger.LogDebug("Rescheduling job: {JobKey} with updated trigger: {TriggerKey}", trigger.JobKey, trigger.Key);
                         }
                     }
                     else if (IgnoreDuplicates)
                     {
-                        logger.LogInformation("Not overwriting existing trigger: {JobKey}",dupeT.Key);
+                        logger.LogInformation("Not overwriting existing trigger: {JobKey}", dupeT.Key);
                         continue; // just ignore the trigger
                     }
                     else
@@ -918,6 +928,7 @@
                                 "This is likely due to a race condition between multiple instances " +
                                 "in the cluster.  Will try to reschedule instead.");
                         }
+
                         // Let's rescheduleJob one more time.
                         var oldTrigger = await sched.GetTrigger(trigger.Key, cancellationToken).ConfigureAwait(false);
                         await DoRescheduleJob(sched, trigger, oldTrigger, cancellationToken).ConfigureAwait(false);
@@ -928,7 +939,7 @@

         private void ReportDuplicateTrigger(IMutableTrigger trigger)
         {
-            logger.LogWarning("Possibly duplicately named ({TriggerKey}) trigger in configuration, this can be caused by not having a fixed job key for targeted jobs",
+            logger.LogWarning("Possibly duplicately named ({TriggerKey}) trigger in configuration, this can be caused by not having a fixed job key for targeted jobs",
                 trigger.Key);
         }

@@ -945,10 +956,10 @@

                 var oldTriggerPreviousFireTime = oldTrigger.GetPreviousFireTimeUtc();
                 trigger.StartTimeUtc = oldTrigger.StartTimeUtc;
-                ((IOperableTrigger)trigger).SetPreviousFireTimeUtc(oldTriggerPreviousFireTime);
+                ((IOperableTrigger) trigger).SetPreviousFireTimeUtc(oldTriggerPreviousFireTime);
                 // if oldTriggerPreviousFireTime is null then NextFireTime should be set relative to oldTrigger.StartTimeUtc
                 // to be able to handle misfiring for an existing trigger that has never been executed before.
-                ((IOperableTrigger)trigger).SetNextFireTimeUtc(trigger.GetFireTimeAfter(oldTriggerPreviousFireTime ?? oldTrigger.StartTimeUtc));
+                ((IOperableTrigger) trigger).SetNextFireTimeUtc(trigger.GetFireTimeAfter(oldTriggerPreviousFireTime ?? oldTrigger.StartTimeUtc));
             }

             return sched.RescheduleJob(trigger.Key, trigger, cancellationToken);
@@ -965,6 +976,7 @@
                     triggersOfJob = new List<IMutableTrigger>();
                     triggersByFQJobName[trigger.JobKey] = triggersOfJob;
                 }
+
                 triggersOfJob.Add(trigger);
             }

@@ -1052,7 +1064,6 @@
             }
         }

-
         /// <summary>
         /// Adds a detected validation exception.
         /// </summary>
@@ -1095,7 +1106,6 @@
             triggerGroupsToNeverDelete.Add(triggerGroupName);
         }

-
         /// <summary>
         /// Helper class to map constant names to their values.
         /// </summary>


Strings in .NET aren't (at build time) IEnumerable<char> anymore. Rather than use ToCharArray() and allocate more junk, switch to indexed access.

--- src/Serilog/Parsing/MessageTemplateParser.cs
+++ src/Serilog/Parsing/MessageTemplateParser.cs
@@ -103,23 +103,32 @@
             if (propertyName == "" || !char.IsLetterOrDigit(propertyName[0]))
                 return new TextToken(rawText);

-            foreach (var c in propertyName)
+            for (var i = 0; i < propertyName.Length; ++i)
+            {
+                var c = propertyName[i];
                 if (!IsValidInPropertyName(c))
                     return new TextToken(rawText);
+            }

             if (format != null)
             {
-                foreach (var c in format)
+                for (var i = 0; i < format.Length; ++i)
+                {
+                    var c = format[i];
                     if (!IsValidInFormat(c))
                         return new TextToken(rawText);
+                }
             }

             Alignment? alignmentValue = null;
             if (alignment != null)
             {
-                foreach (var c in alignment)
+                for (var i = 0; i < alignment.Length; ++i)
+                {
+                    var c = alignment[i];
                     if (!IsValidInAlignment(c))
                         return new TextToken(rawText);
+                }

                 var lastDash = alignment.LastIndexOf('-');
                 if (lastDash > 0)


Workaround for ItemsRepeater producing nonsensical values

--- src/Skia/Avalonia.Skia/DrawingContextImpl.cs
+++ src/Skia/Avalonia.Skia/DrawingContextImpl.cs
@@ -248,6 +248,13 @@
         /// <inheritdoc />
         public void DrawRectangle(IBrush brush, IPen pen, RoundedRect rect, BoxShadows boxShadows = default)
         {
+            if (rect.Rect.Height <= 0 || rect.Rect.Width <= 0)
+                return;
+            // Arbitrary chosen values
+            // On OSX Skia breaks OpenGL context when asked to draw, e. g. (0, 0, 623, 6666600) rect
+            if (rect.Rect.Height > 8192 || rect.Rect.Width > 8192)
+                boxShadows = default;
+
             var rc = rect.Rect.ToSKRect();
             var isRounded = rect.IsRounded;
             var needRoundRect = rect.IsRounded || (boxShadows.HasInsetShadows);


optimization.

optimization.

--- src/TWCore/Net/Multicast/DiscoveryService.cs
+++ src/TWCore/Net/Multicast/DiscoveryService.cs
@@ -37,7 +37,7 @@
     public static class DiscoveryService
     {
         private static readonly PeerConnection PeerConnection;
-        private static readonly List<RegisteredService> LocalServices;
+        private static readonly List<RegisteredServiceContainer> LocalServices;
         private static readonly TimeoutDictionary<Guid, ReceivedService> ReceivedServices;
         private static readonly TimeSpan ServiceTimeout = TimeSpan.FromSeconds(60);
         private static Task _sendThread;
@@ -94,7 +94,7 @@
         #region .ctor
         static DiscoveryService()
         {
-            LocalServices = new List<RegisteredService>();
+            LocalServices = new List<RegisteredServiceContainer>();
             ReceivedServices = new TimeoutDictionary<Guid, ReceivedService>();
             ReceivedServices.OnItemTimeout += (s, e) => Try.Do(vTuple => OnServiceExpired?.Invoke(vTuple.s, new EventArgs<ReceivedService>(vTuple.e.Value)), (s, e), false);
             PeerConnection = new PeerConnection();
@@ -166,8 +166,12 @@
             service.ServiceId = serviceText.GetHashSHA1Guid();
             lock (LocalServices)
             {
-                if (LocalServices.All((s, serviceId) => s.ServiceId != serviceId, service.ServiceId))
-                    LocalServices.Add(service);
+                if (LocalServices.All((s, serviceId) => s.Service.ServiceId != serviceId, service.ServiceId))
+                {
+                    var sObj = new SerializedObject(service, Serializer);
+                    var sObjArr = (byte[])sObj.ToSubArray();
+                    LocalServices.Add(new RegisteredServiceContainer(service, Serializer, sObjArr));
+                }
             }
             return service.ServiceId;
         }
@@ -196,8 +200,10 @@
             service.ServiceId = serviceText.GetHashSHA1Guid();
             lock (LocalServices)
             {
-                if (LocalServices.All((s, serviceId) => s.ServiceId != serviceId, service.ServiceId))
-                    LocalServices.Add(service);
+                if (LocalServices.All((s, serviceId) => s.Service.ServiceId != serviceId, service.ServiceId))
+                {
+                    LocalServices.Add(new RegisteredServiceContainer(service, Serializer, null));
+                }
             }
             return service.ServiceId;
         }
@@ -232,7 +238,7 @@
         public static bool UnregisterService(Guid serviceId)
         {
             lock (LocalServices)
-                return LocalServices.RemoveAll(s => s.ServiceId == serviceId) > 0;
+                return LocalServices.RemoveAll(s => s.Service.ServiceId == serviceId) > 0;
         }
         #endregion

@@ -286,74 +292,94 @@
             {
                 var serObj = SerializedObject.FromSubArray(e.Data);
                 if (serObj == null) return;
-                if (!(serObj.GetValue() is List<RegisteredService> lstRegisteredService)) return;
-
-                foreach (var rService in lstRegisteredService)
+                if (!(serObj.GetValue() is RegisteredService rService)) return;
+
+                try
                 {
-                    try
+                    var received = new ReceivedService
                     {
-                        var received = new ReceivedService
+                        ServiceId = rService.ServiceId,
+                        Category = rService.Category,
+                        Name = rService.Name,
+                        Description = rService.Description,
+                        MachineName = rService.MachineName,
+                        ApplicationName = rService.ApplicationName,
+                        FrameworkVersion = rService.FrameworkVersion,
+                        EnvironmentName = rService.EnvironmentName,
+                        Data = rService.Data,
+                        Addresses = new[] { e.Address }
+                    };
+                    bool exist;
+                    lock (ReceivedServices)
+                    {
+                        exist = ReceivedServices.TryRemove(received.ServiceId, out var oldReceived);
+                        if (exist)
+                            received.Addresses = received.Addresses.Concat(oldReceived.Addresses).Distinct()
+                                .ToArray();
+                        ReceivedServices.TryAdd(received.ServiceId, received, ServiceTimeout);
+                    }
+
+                    var eArgs = new EventArgs<ReceivedService>(received);
+                    if (!exist)
+                        OnNewServiceReceived?.Invoke(sender, eArgs);
+                    OnServiceReceived?.Invoke(sender, eArgs);
+                }
+                catch (Exception)
+                {
+                    //
+                }
+            }
+            catch(Exception)
+            {
+                //
+            }
+        }
+        private static async Task SendThreadAsync()
+        {
+            while (!_token.IsCancellationRequested)
+            {
+                var servicesBytes = new List<byte[]>();
+                lock (LocalServices)
+                {
+                    foreach (var srv in LocalServices)
+                    {
+                        if (srv.DataToSend != null)
                         {
-                            ServiceId = rService.ServiceId,
-                            Category = rService.Category,
-                            Name = rService.Name,
-                            Description = rService.Description,
-                            MachineName = rService.MachineName,
-                            ApplicationName = rService.ApplicationName,
-                            FrameworkVersion = rService.FrameworkVersion,
-                            EnvironmentName = rService.EnvironmentName,
-                            Data = rService.Data,
-                            Addresses = new[] {e.Address}
-                        };
-                        bool exist;
-                        lock (ReceivedServices)
+                            if (srv.Serializer != Serializer)
+                            {
+                                srv.DataToSend = (byte[]) new SerializedObject(srv.Service, Serializer).ToSubArray();
+                                srv.Serializer = Serializer;
+                            }
+                            servicesBytes.Add(srv.DataToSend);
+                        }
+                        else if (srv.Service.GetDataFunc != null)
                         {
-                            exist = ReceivedServices.TryRemove(received.ServiceId, out var oldReceived);
-                            if (exist)
-                                received.Addresses = received.Addresses.Concat(oldReceived.Addresses).Distinct()
-                                    .ToArray();
-                            ReceivedServices.TryAdd(received.ServiceId, received, ServiceTimeout);
+                            srv.Service.Data = srv.Service.GetDataFunc();
+                            servicesBytes.Add((byte[])new SerializedObject(srv.Service, Serializer).ToSubArray());
                         }
-
-                        var eArgs = new EventArgs<ReceivedService>(received);
-                        if (!exist)
-                            OnNewServiceReceived?.Invoke(sender, eArgs);
-                        OnServiceReceived?.Invoke(sender, eArgs);
-                    }
-                    catch (Exception)
-                    {
-                        //
                     }
                 }
-            }
-            catch(Exception)
-            {
-                //
-            }
-        }
-        private static async Task SendThreadAsync()
-        {
-            while (!_token.IsCancellationRequested)
-            {
-                List<RegisteredService> tmpList;
-                lock (LocalServices)
-                    tmpList = new List<RegisteredService>(LocalServices);
-
-                foreach (var srv in tmpList)
-                {
-                    if (srv.GetDataFunc != null)
-                        srv.Data = srv.GetDataFunc();
-                }
-
-                var sObj = new SerializedObject(tmpList, Serializer);
-                var sObjArr = sObj.ToSubArray();
-                await PeerConnection.SendAsync(sObjArr).ConfigureAwait(false);
+                foreach(var bytes in servicesBytes)
+                    await PeerConnection.SendAsync(bytes).ConfigureAwait(false);
                 await Task.Delay(30000, _token).ConfigureAwait(false);
             }
         }
         #endregion

         #region Nested Types
+        private class RegisteredServiceContainer
+        {
+            public RegisteredService Service;
+            public ISerializer Serializer;
+            public byte[] DataToSend;
+
+            public RegisteredServiceContainer(RegisteredService service, ISerializer serializer, byte[] dataToSend)
+            {
+                Service = service;
+                Serializer = serializer;
+                DataToSend = dataToSend;
+            }
+        }
         /// <summary>
         /// Registered Service
         /// </summary>